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. Free version to Paid version

I've got a situation a lot of us do, where I have released a free
version and now need to make a Paid version of the same app.

As those who have tried will know, you can't change an app from Free
to Paid (a silly feature of the Market).

So, what I'm planning to do is release a "Plus" version that has more

What are others doing to help direct users to their paid versions from
their Free versions?
I'n my case its an input method, so I have to be careful about how I
tell the user about the paid version with more features.


- Brill Pappin


2. Regarding gcov using arm-eabi toolchain

Dear All,

We have developed an application for which we would like to check the code
We have used gcov available in android toolchain.

In our file we have added the following LOCAL_FLAGS and included
the libgcov static library.

LOCAL_CFLAGS:= -fprofile-arcs -ftest-coverage


We got some compilation issues which was resolved by copying the libgcov
library from
using BUILD_PREBUILT make rules.

The output executable size is also increased with this and in out folder was
can see *.gcno files getting created.

When we execute the test *.gcda files are generated on target but when we
try to take the code coverage using lcov it is not generating the code
coverage report.

lcov --directory code_coverage/ --capture --output-file ./
genhtml -o code_coverage/ ./

We have tested the same setup with arm-linux toolchain and it works fine.

Please provide some pointer which we can look into.



3. Android 2.2 appWidgetManager.updateAppWidget not work?

4. Difference between Android 2.2 and Google API for Android

5. playing RTP/TCP/AVP video stream (RTSP over HTTP tunnel)

6. Can't download the Android SDK

7. [ASK] Newbie coders in android