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. force ContentProvider to synchronize with database

I'm sharing informations with a content provider. But whent something
change, the provider seems to ignore it untill I close my program. Or
do not write data on the database until I close it. So is there a
commend or a method to force ContentProvider to synchronize with his
respective database and set a listner with coold make it automatic?
Someting like ContentProvider().update(uri)... or
thank you


2. pause mediaplayer when incoming call

Hi All,

How to pause music when user recieves incoming call in android?

Can i know i am getting incoming call from any API's?

Please help,Its urgent.



3. Speed Test: Opera Mini 5 vs. Stock Android Browse

4. OOT: miring dream

5. How to Upgrade Application without losing data.

6. Oot: tes pake 1.5

7. Verizon's Nexus One specs leaked : Sense UI