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. Can I develop android applications on a phone without service?

I am stuck on a sprint service plan for sometime.  Is it possible to
buy an Android phone
and develop applications without having any service at all?

Or is it possible to get a prepaid t-mobile sim and use wifi for the
applications development?



2. Android dev 1 3G networks

Hello guys

I want to get the Dev1 phone, and I need to know what 3G network it
uses. I live in Egypt and our 3G is 2100. I have a relative in the USA
and I can get it via him but I need to check the 3G first.


3. Can I get access to paid apps outside US with US phone?

4. Can I get access to paid apps outside US with US phone?

5. How to use TextAppearence in Code without styleable?

6. How to detect PDP context activation/deactivation and out of coverage scenarios?

7. When will copyrighted material be stamped out of the market?