Community
Participate
Working Groups
Given a nested team in a role file that extends a non-team role the reconciler throws NPE during AST creation like this: java.lang.NullPointerException at org.eclipse.objectteams.otdt.internal.core.compiler.bytecode.BytecodeTransformer.checkCopyNonWideConstants(BytecodeTransformer.java:117) at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.generateCode(TypeDeclaration.java:972) at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.generateCode(TypeDeclaration.java:1145) at org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.generateCode(CompilationUnitDeclaration.java:424) at org.eclipse.objectteams.otdt.internal.core.compiler.control.Dependencies.establishUnitState(Dependencies.java:357) at org.eclipse.objectteams.otdt.internal.core.compiler.control.Dependencies.ensureState(Dependencies.java:257) at org.eclipse.objectteams.otdt.internal.core.compiler.control.Dependencies.ensureState(Dependencies.java:212) at org.eclipse.jdt.core.dom.CompilationUnitResolver.resolve(CompilationUnitResolver.java:1233) at org.eclipse.jdt.core.dom.CompilationUnitResolver.resolve(CompilationUnitResolver.java:693) at org.eclipse.jdt.core.dom.ASTParser.internalCreateAST(ASTParser.java:1180) at org.eclipse.jdt.core.dom.ASTParser.createAST(ASTParser.java:806) This is caused by the TeamMethodGenerator having no valid bytecode of o.o.Team. The regular compiler, however, does not have this problem.
Created attachment 178218 [details] test and fix When the TeamMethodGenerator tries to fetch the class bytes, they may have already been nulled by ClassFileReader.initialize(). It turns out, however, that some MethodInfos still hold on to the byte codes (due to our own hack in MethodInfo). To make the new test pass also some additions to JCLMin are needed, because we need to resolve the constant pool references of method bodies from o.o.Team against this library.
Patch has been committed as r760 - r766 (incl. deploying JCLMin1.5).
Created attachment 178305 [details] additional fixes This patch implements more cases for fetching bytecode of o.o.Team: * when compiling o.o.Team from source collect bytes via different call chains using existing mechanim in MethodModel * when o.o.Team is converted from JavaElement do not try to copy bytecodes, we have none. No new tests, debugged using a rt-workbench with two workspace projects: org.eclipse.objectteams.runtime (for Team.java) and org.eclipse.objectteams.otdt.jdt.ui (for CreateMethodMappingCompletionProposal)
Verified using I201009211735, both by the test in OTReconcilerTests and by frequently challenging CreateMethodMappingCompletionProposal.