I have written a short class with the http://www.ow2.org/view/ActivitiesDashboard/ASM library. Eclipse (Version: 4.3.1 Build id: M20130911-1000) marks the marked statement as an error ("Type mismatch: cannot convert from element type Object to FieldNode"). I'm compiling with jre7. This is incorrect as the source-code of the used jar shows. But first of all here is my class source:
import org.objectweb.asm.tree.ClassNode;
public class AccessTransformer
{
ClassNode classNode = new ClassNode();
public byte[] transform(String name, String transformedName, byte[] bytes)
{
for (FieldNode n : this.classNode.fields) // <----- HERE IS THE ERROR
{
if (n.name.equals("test"))
{
n.access = 0;
}
}
}
}
The jar though states (class org.objectweb.asm.tree.ClassNode):
/**
* The fields of this class. This list is a list of {@link FieldNode}
* objects.
*
* @associates org.objectweb.asm.tree.FieldNode
*/
public List<FieldNode> fields;
Does anyone have an idea what I may have done wrong? How can I assure that eclipse "sees" the parametrized type of the list as FieldNode?
I try not to use refletion because it would slow the process down for nothing. I could introduce an "unsafe" cast but the problem is more meta, I wonder why eclipse shows "type mismatch".