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. Ada Yang Tau Cara Setting Yahoo Account pada "MAIL" nya HTC MAGIC ga?Sama Mau tanya Paket Data IM3

kan ada software MAIL tuh di HTC MAGIC...

nah saya coba pake Yahoo Account tapi ko ga bisa yah?

kenapa yah kira2?

apa ada yang punya settingannya?

sama 1 lagi nih...

kenapa tiap2 saya pake paket data,suka ga bs online?saya pake IM3

tapi waktu saya unregistered Internet di handset normal kembali....

kenapa yah kira2?

"Indonesian Android Community [id-android]" 

2. Please improve the soft keypad and add a password check box.

It really isn't possible unless you have a bigger screen.
Little hint though: If you hold your finger on the screen, it will
show you what button you are over in a little bubble above your
finger. When you are in the right place, lift your finger then THAT
key will be "pressed".

> Thanks for considering this request.

3. Power event

4. Android bootup process from linux-omap-pm branch

5. File download-an dari market disimpen dimana y

6. Tidak bisa transfer file dari samsung spica ke P

7. to get/generate nonce. error in random, getBytes Options