Need help with error message

Boaz Nahum boaznahum at
Mon Sep 9 05:53:57 PDT 2013

Build lambda/lambda repo today.

The compiler error is strange

public List<String> getList(List<Integer> keys) {
  return null;

MyData data = new MyData();

//this is wrong, should be List<Integer>
List keys = new ArrayList();

String item= data.getList(keys).get(0);

The error message is:
java: incompatible types: java.lang.Object cannot be converted to

But if I split it to:
List<String> list = data.getList(keys);
           String item = list.get(0);

then it compile fine.

The error message remind smells like compiler treats getList as generic

-------------- next part --------------
An HTML attachment was scrubbed...

More information about the compiler-dev mailing list