Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 90208 Details for
Bug 219625
[1.5][compiler] Generics related AbstractMethodError that is not given by Sun Java
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Java class demonstrating bug
GenericsAbstractMethodError.java (text/x-java), 1.22 KB, created by
Matt Hillsdon
on 2008-02-20 12:13:23 EST
(
hide
)
Description:
Java class demonstrating bug
Filename:
MIME Type:
Creator:
Matt Hillsdon
Created:
2008-02-20 12:13:23 EST
Size:
1.22 KB
patch
obsolete
> >/** > * There appears to be a bug in the type checking. > * > * @copyright > * @author mth > */ >public class GenericsAbstractMethodError { > > interface Foo<T> { > T getValue(); > void doSomething(T o); > } > > public static abstract class AbstractFoo<T> implements Foo<T> { > /** > * If this is removed ConcreteFoo no longer compiles. > */ > public void doSomething(final String o) { > } > } > > public static final class ConcreteFoo extends AbstractFoo<String> { > public String getValue() { > return "I am a string"; > } > } > > /** > * We lose the type infomation here so try but fail to call the doSomething(Object) method. > */ > private static <T> void feedFoosValueIntoFoo(final Foo<T> foo) { > foo.doSomething(foo.getValue()); > } > > private static void testTypedString() { > final ConcreteFoo foo = new ConcreteFoo(); > foo.doSomething(foo.getValue()); > } > > /** > * This gives an AbstractMethodError in Eclipse 3.3.1.1 > * but (interestingly) works fine in Sun Java 1.6.0_03. > */ > private static void testGenericString() { > feedFoosValueIntoFoo(new ConcreteFoo()); > } > > public static void main(String[] args) { > testTypedString(); > testGenericString(); > System.out.println("Success."); > } > >} >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 219625
: 90208 |
92492