Community
Participate
Working Groups
If you have a value whose type is an interface, you cannot access its Object methods. For instance, the following will result in the error "Couldn't resolve reference to JVMIdentifiableElement 'class'" when attempting to resolve the getClass() method on foo, whose type is the interface List: val List foo = new ArrayList() foo.^class However, if the type of the variable is a concrete type (ArrayList in this case), then there is no error: val bar = new ArrayList() bar.^class This is a regression in Xtend 2.1; both of the above cases worked without errors in Xtend 2.0.
This works for me: val List<String> l = null l.^class Please provide more information and reopen the ticket if the problem persists.
Hi Sebastian, I did some more investigation, and found out that the problem exists only in some rather particular circumstances. If I just have a simple Xtend file with a single method that has any of the code snippets above in it, it works fine. BUT if I introduce another method that appends values to a collection, the error appears. Try the following Xtend class - you should see an error in methodTwo on the ^class accessor: package foo import java.util.List import java.util.HashSet class Foo { def methodOne() { val strings = new HashSet<String>() strings += "a" } def methodTwo() { val List<String> l = null l.^class } }
Pushed to master.
Closing all bugs that were set to RESOLVED before Neon.0