Java Guru needed -- compiler bug?

by Zsolt Vasvari » Fri, 20 May 2011 16:50:55 GMT

Sponsored Links
 private void method(Collection<String> s)
        // Nothing

    private void caller()
       // Complies fine
        Collection<String> s = Collections.emptyList();

       // Doesn't compile -- gives error message
       // The method method(Collection<String>) in the type Import is
not applicable for the arguments
       //  (List<Object>)

What's going on here?   The two statements look identical to me...


Re: Java Guru needed -- compiler bug?

by Nikolay Elenkov » Fri, 20 May 2011 16:57:01 GMT


I'm not going to pretend to be a guru, but here goes :)

It's a generic method:

public static final <T> List<T> emptyList()

In the second call there is no way to determine the type of the generic
parameter, so you get a list of Object.


Sponsored Links

Other Threads

1. job oppurtunities now

job oppurtunities now
click here above link and see more details about
job oppurtunities s, find more reliable things
about job.


2. Basic Layout

Why has it got to be soooo difficult?  For a week now Ie been
reading and playing around with code and have still not found the

I want a simple 3 column layout, with images going from bottom to top
in each.
Whenever I put 3 LinearLayouts next to each other in the Activity, the
first one takes up all the space.
That is if I add an ImageView to it in the XML. If I don then all
none of the Layouts appear.

Very frustrated and about to quit Android altogether. Please help!


3. How to make chat window?

4. AudioTrack create failure

5. help with onchildclick in ExpandableListView

6. Notification Flag: "FLAG_ONLY_ALERT_ONCE" not working?

7. how to stop sound notification/let it only play once?