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. RecognizerIntent.EXTRA_LANGUAGE is ignored

I've seen a few other posts about this, but no real response.

The official Android Developers Blog post about the Speech Input API:


"Google's servers currently support English, Mandarin Chinese, and

However, setting RecognizerIntent.EXTRA_LANGUAGE in the intent, does
not seem to work.

I also tried changing my locale (to Chinese) but voice input was still
being treated as english.


2. Input method recreated many times

hi all,

I am trying to create an input method which has some heavy
initialization to do in OnCreate(). The problem is whenever i am
switching to my Ime from another ime, it is taking 2-3 seconds to
initialize and in mean time if i press edit text repeatedly,
OnCreate() and OnDestroy() of my IME are called multiple times. Can I
somehow prevent this from happening?

Thanks in advance.


3. does Foryo will have Arabic Support ...

4. GestureOverlayView coming back null, using Playing with Graphics tutorial

5. I want to drop HVGA support. WVGA only.

6. Getting back from security & location to my application

7. Android: Streaming audio over Sockets