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 235495 Details for
Bug 417288
Compilation error from mismatching generic return type
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
main.java source for the problem (same as github)
file_417288.txt (text/plain), 1005 bytes, created by
Sterling Greene
on 2013-09-15 16:36:51 EDT
(
hide
)
Description:
main.java source for the problem (same as github)
Filename:
MIME Type:
Creator:
Sterling Greene
Created:
2013-09-15 16:36:51 EDT
Size:
1005 bytes
patch
obsolete
>import java.util.ArrayList; >import java.util.Collections; >import java.util.List; > >public class main { > public static List<?> method(Object... things) { > System.out.println("method(Object...)"); > return null; > } > > public static <T> List<T> method(Class<T> type, Object... things) { > System.out.println("method(Class, Object...)"); > Object thing = things[0]; > Iterable<?> iterableThing = (Iterable<?>) thing; > List<T> list = new ArrayList<T>(); > for (Object thingThing : iterableThing) { > // This doesn't compile > list.addAll(method(type, thingThing)); > // or this > // list.addAll(method((Class<T>)type, thingThing)); > > // these compile: > // list.addAll(method((Class)type, thingThing)); > // list.addAll(anotherNameForMethod(type, thingThing)); > // List<T> list2 = method(type, thingThing); > // list.addAll(list2); > > } > > return null; > } > > public static <T> List<T> anotherNameForMethod(Class<T> type, Object... things) { > return null; > } > >}
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 417288
: 235495