issue_id
int64
2.04k
425k
title
stringlengths
9
251
body
stringlengths
4
32.8k
status
stringclasses
6 values
after_fix_sha
stringlengths
7
7
project_name
stringclasses
6 values
repo_url
stringclasses
6 values
repo_name
stringclasses
6 values
language
stringclasses
1 value
issue_url
null
before_fix_sha
null
pull_url
null
commit_datetime
timestamp[us, tz=UTC]
report_datetime
timestamp[us, tz=UTC]
updated_file
stringlengths
23
187
chunk_content
stringlengths
1
22k
230,817
Bug 230817 LazyMethodGen.remap() NullPointerException
This has been reported a few times by different users, but has always proved tough to diagnose. The typical stack trace is something like: java.lang.NullPointerException org.aspectj.weaver.bcel.LazyMethodGen.remap(LazyMethodGen.java:1237) org.aspectj.weaver.bcel.LazyMethodGen.addExceptionHandlers(LazyMethodGen.java:1132) org.aspectj.weaver.bcel.LazyMethodGen.packBody(LazyMethodGen.java:1078) org.aspectj.weaver.bcel.LazyMethodGen.pack(LazyMethodGen.java:977) org.aspectj.weaver.bcel.LazyMethodGen.getMethod(LazyMethodGen.java:484) org.aspectj.weaver.bcel.LazyClassGen.writeBack(LazyClassGen.java:512) org.aspectj.weaver.bcel.LazyClassGen.getJavaClassBytesIncludingReweavable(LazyClassGen.java:652) org.aspectj.weaver.bcel.BcelWeaver.getClassFilesFor(BcelWeaver.java:1420) org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1390) And that is an exception on this line in remap() ih = ih.getNext(); called from the addExceptionHandlers() line: gen.addExceptionHandler( remap(r.getRealStart(), map), remap(r.getRealEnd(), map), remap(r.getHandler(), map), (r.getCatchType() == null) ? null : (ObjectType) BcelWorld.makeBcelType(r.getCatchType())); During weaving, an instruction list is augmented with extra entries representing where shadows start and end (method-call, method-execution, handler, etc). When weaving is complete we want to remove these temporary elements and use the remaining instructions to produce the method bytecode. Now sometimes these temporary entries are targeted by other elements (line number tags, local variable tags and exception handlers usually). During packing we use remap() to reposition the locations so they move off of temporary placeholders and onto real instructions that will make it out into the bytecode. What the above exception tells us is that we started walking over temporary placeholder entries, but before we came to a real instruction, we ran out of instructions! This cannot happen, and indicates something went seriously wrong, we should always encounter an instruction when remapping off a temporary element. After some digging it is actually the remap() call for the handler (not the start or end) that leads to the problem. The handler represents where to jump to in the code when an exception of the specified type occurs between the instructions pointed at by start and end. I sent a debug build to a user encountering this problem (I could not recreate it) and in that I was looking at where in fact the handler was pointing before we called remap(). I learned that when this problem occurs, the handler is not pointing to anywhere in the method currently being processed (not good). In a second debug build I tried to ascertain who was setting these handlers to point to nowhere. This debug never triggered, no-one was setting them to point to nowhere... I happened to notice whilst going through the instructions in the debug output that cobertura was being used, a coverage toolkit that works by doing bytecode manipulation to insert calls out to a library. AspectJ was being called after cobertura and I asked the user to try the steps the other way round - it worked fine. Indicating cobertura was doing something to the bytecode that gave us problems. After much messing about, I recreated it by applying around advice to within(*) to all the classes in rt.jar (I just used that as a very large standalone jar file I could weave into). I learned that Cobertura creates catch blocks that look a little different to what javac and other compilers create. The typical bytecode sequence a compiler produces for a catch block starts with a STORE instruction, to store the exception being caught (whether the body of the catch block uses it or not). But the cobertura catch blocks started with an INVOKESTATIC instruction, a call out to another method. What does this mean? It means the same instruction has two shadows, a 'handler' shadow and a 'method-call' shadow - and it turns out this is what causes our problem. If around advice is applied to the call join point and it cannot be inlined then the body of the call shadow (the call itself) is pulled out into a new method. Because the handler was the same instruction, this meant the handler *was also being pulled out* into the new method, leaving behind an exception handler that jumped to an invalid location (in fact it 'jumped' to an instruction in a different method!). So the reason I never saw the handler location being set incorrectly is that it was set correctly up front, but then dragged out with the method-call shadow into the wrong place. In bytecode terms it looks like this: method-execution() | ICONST_0 | ISTORE_2 | SIPUSH -1 | ISTORE_3 | catch java.lang.Exception (1806389629) -> E0 | | method-call(ProjectData ProjectData.getGlobalProjectData()) | | | INVOKESTATIC ProjectData.getGlobalProjectData () | | method-call(ProjectData getGlobalProjectData()) | | LDC "SomeString" | | method-call(ClassData getOrCreateClassData(java.lang.String)) | | | INVOKEVIRTUAL ProjectData.getOrCreateClassData (LString;) | | method-call(ClassData ProjectData.getOrCreateClassData(String)) | | SIPUSH 106 | | method-call(void ClassData.touch(int)) | | | INVOKEVIRTUAL ClassData.touch (I)V | | method-call(void ClassData.touch(int)) | | ALOAD_1 | | method-call(Object Expression.getValue()) | | | INVOKEVIRTUAL Expression.getValue () | | method-call(Object Expression.getValue()) | catch java.lang.Exception (1806389629) -> E0 | ARETURN | method-call(nProjectData ProjectData.getGlobalProjectData()) | | E0: INVOKESTATIC ProjectData.getGlobalProjectData () | method-call(ProjectData ProjectData.getGlobalProjectData()) | LDC "Object" We can see the problem in that final method-call. The target for the exception handler seen earlier (E0) is within the method-call shadow. What to do?
resolved fixed
5f97d46
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2008-05-07T15:31:18Z
2008-05-07T03:13:20Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
} match(mg, h, beforeSuperOrThisCall ? null : enclosingShadow, shadowAccumulator); } } if (canMatch(Shadow.ConstructorExecution)) match(enclosingShadow, shadowAccumulator); } if (superOrThisCall != null && ! isThisCall(superOrThisCall)) { InstructionHandle curr = enclosingShadow.getRange().getStart(); for (Iterator i = addedSuperInitializersAsList.iterator(); i.hasNext(); ) { IfaceInitList l = (IfaceInitList) i.next(); Member ifaceInitSig = AjcMemberMaker.interfaceConstructor(l.onType); BcelShadow initShadow = BcelShadow.makeIfaceInitialization(world, mg, ifaceInitSig); InstructionList inits = genInitInstructions(l.list, false); if (match(initShadow, shadowAccumulator) || !inits.isEmpty()) { initShadow.initIfaceInitializer(curr); initShadow.getRange().insert(inits, Range.OutsideBefore); } } InstructionList inits = genInitInstructions(addedThisInitializers, false);
230,817
Bug 230817 LazyMethodGen.remap() NullPointerException
This has been reported a few times by different users, but has always proved tough to diagnose. The typical stack trace is something like: java.lang.NullPointerException org.aspectj.weaver.bcel.LazyMethodGen.remap(LazyMethodGen.java:1237) org.aspectj.weaver.bcel.LazyMethodGen.addExceptionHandlers(LazyMethodGen.java:1132) org.aspectj.weaver.bcel.LazyMethodGen.packBody(LazyMethodGen.java:1078) org.aspectj.weaver.bcel.LazyMethodGen.pack(LazyMethodGen.java:977) org.aspectj.weaver.bcel.LazyMethodGen.getMethod(LazyMethodGen.java:484) org.aspectj.weaver.bcel.LazyClassGen.writeBack(LazyClassGen.java:512) org.aspectj.weaver.bcel.LazyClassGen.getJavaClassBytesIncludingReweavable(LazyClassGen.java:652) org.aspectj.weaver.bcel.BcelWeaver.getClassFilesFor(BcelWeaver.java:1420) org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1390) And that is an exception on this line in remap() ih = ih.getNext(); called from the addExceptionHandlers() line: gen.addExceptionHandler( remap(r.getRealStart(), map), remap(r.getRealEnd(), map), remap(r.getHandler(), map), (r.getCatchType() == null) ? null : (ObjectType) BcelWorld.makeBcelType(r.getCatchType())); During weaving, an instruction list is augmented with extra entries representing where shadows start and end (method-call, method-execution, handler, etc). When weaving is complete we want to remove these temporary elements and use the remaining instructions to produce the method bytecode. Now sometimes these temporary entries are targeted by other elements (line number tags, local variable tags and exception handlers usually). During packing we use remap() to reposition the locations so they move off of temporary placeholders and onto real instructions that will make it out into the bytecode. What the above exception tells us is that we started walking over temporary placeholder entries, but before we came to a real instruction, we ran out of instructions! This cannot happen, and indicates something went seriously wrong, we should always encounter an instruction when remapping off a temporary element. After some digging it is actually the remap() call for the handler (not the start or end) that leads to the problem. The handler represents where to jump to in the code when an exception of the specified type occurs between the instructions pointed at by start and end. I sent a debug build to a user encountering this problem (I could not recreate it) and in that I was looking at where in fact the handler was pointing before we called remap(). I learned that when this problem occurs, the handler is not pointing to anywhere in the method currently being processed (not good). In a second debug build I tried to ascertain who was setting these handlers to point to nowhere. This debug never triggered, no-one was setting them to point to nowhere... I happened to notice whilst going through the instructions in the debug output that cobertura was being used, a coverage toolkit that works by doing bytecode manipulation to insert calls out to a library. AspectJ was being called after cobertura and I asked the user to try the steps the other way round - it worked fine. Indicating cobertura was doing something to the bytecode that gave us problems. After much messing about, I recreated it by applying around advice to within(*) to all the classes in rt.jar (I just used that as a very large standalone jar file I could weave into). I learned that Cobertura creates catch blocks that look a little different to what javac and other compilers create. The typical bytecode sequence a compiler produces for a catch block starts with a STORE instruction, to store the exception being caught (whether the body of the catch block uses it or not). But the cobertura catch blocks started with an INVOKESTATIC instruction, a call out to another method. What does this mean? It means the same instruction has two shadows, a 'handler' shadow and a 'method-call' shadow - and it turns out this is what causes our problem. If around advice is applied to the call join point and it cannot be inlined then the body of the call shadow (the call itself) is pulled out into a new method. Because the handler was the same instruction, this meant the handler *was also being pulled out* into the new method, leaving behind an exception handler that jumped to an invalid location (in fact it 'jumped' to an instruction in a different method!). So the reason I never saw the handler location being set incorrectly is that it was set correctly up front, but then dragged out with the method-call shadow into the wrong place. In bytecode terms it looks like this: method-execution() | ICONST_0 | ISTORE_2 | SIPUSH -1 | ISTORE_3 | catch java.lang.Exception (1806389629) -> E0 | | method-call(ProjectData ProjectData.getGlobalProjectData()) | | | INVOKESTATIC ProjectData.getGlobalProjectData () | | method-call(ProjectData getGlobalProjectData()) | | LDC "SomeString" | | method-call(ClassData getOrCreateClassData(java.lang.String)) | | | INVOKEVIRTUAL ProjectData.getOrCreateClassData (LString;) | | method-call(ClassData ProjectData.getOrCreateClassData(String)) | | SIPUSH 106 | | method-call(void ClassData.touch(int)) | | | INVOKEVIRTUAL ClassData.touch (I)V | | method-call(void ClassData.touch(int)) | | ALOAD_1 | | method-call(Object Expression.getValue()) | | | INVOKEVIRTUAL Expression.getValue () | | method-call(Object Expression.getValue()) | catch java.lang.Exception (1806389629) -> E0 | ARETURN | method-call(nProjectData ProjectData.getGlobalProjectData()) | | E0: INVOKESTATIC ProjectData.getGlobalProjectData () | method-call(ProjectData ProjectData.getGlobalProjectData()) | LDC "Object" We can see the problem in that final method-call. The target for the exception handler seen earlier (E0) is within the method-call shadow. What to do?
resolved fixed
5f97d46
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2008-05-07T15:31:18Z
2008-05-07T03:13:20Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
enclosingShadow.getRange().insert(inits, Range.OutsideBefore); } boolean addedInitialization = match( BcelShadow.makeUnfinishedInitialization(world, mg), initializationShadows); addedInitialization |= match( BcelShadow.makeUnfinishedPreinitialization(world, mg), initializationShadows); mg.matchedShadows = shadowAccumulator; return addedInitialization || !shadowAccumulator.isEmpty(); } private boolean shouldWeaveBody(LazyMethodGen mg) { if (mg.isBridgeMethod()) return false; if (mg.isAjSynthetic()) return mg.getName().equals("<clinit>"); AjAttribute.EffectiveSignatureAttribute a = mg.getEffectiveSignature(); if (a != null) return a.isWeaveBody(); return true; } /** * first sorts the mungers, then gens the initializers in the right order */ private InstructionList genInitInstructions(List list, boolean isStatic) { list = PartialOrder.sort(list);
230,817
Bug 230817 LazyMethodGen.remap() NullPointerException
This has been reported a few times by different users, but has always proved tough to diagnose. The typical stack trace is something like: java.lang.NullPointerException org.aspectj.weaver.bcel.LazyMethodGen.remap(LazyMethodGen.java:1237) org.aspectj.weaver.bcel.LazyMethodGen.addExceptionHandlers(LazyMethodGen.java:1132) org.aspectj.weaver.bcel.LazyMethodGen.packBody(LazyMethodGen.java:1078) org.aspectj.weaver.bcel.LazyMethodGen.pack(LazyMethodGen.java:977) org.aspectj.weaver.bcel.LazyMethodGen.getMethod(LazyMethodGen.java:484) org.aspectj.weaver.bcel.LazyClassGen.writeBack(LazyClassGen.java:512) org.aspectj.weaver.bcel.LazyClassGen.getJavaClassBytesIncludingReweavable(LazyClassGen.java:652) org.aspectj.weaver.bcel.BcelWeaver.getClassFilesFor(BcelWeaver.java:1420) org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1390) And that is an exception on this line in remap() ih = ih.getNext(); called from the addExceptionHandlers() line: gen.addExceptionHandler( remap(r.getRealStart(), map), remap(r.getRealEnd(), map), remap(r.getHandler(), map), (r.getCatchType() == null) ? null : (ObjectType) BcelWorld.makeBcelType(r.getCatchType())); During weaving, an instruction list is augmented with extra entries representing where shadows start and end (method-call, method-execution, handler, etc). When weaving is complete we want to remove these temporary elements and use the remaining instructions to produce the method bytecode. Now sometimes these temporary entries are targeted by other elements (line number tags, local variable tags and exception handlers usually). During packing we use remap() to reposition the locations so they move off of temporary placeholders and onto real instructions that will make it out into the bytecode. What the above exception tells us is that we started walking over temporary placeholder entries, but before we came to a real instruction, we ran out of instructions! This cannot happen, and indicates something went seriously wrong, we should always encounter an instruction when remapping off a temporary element. After some digging it is actually the remap() call for the handler (not the start or end) that leads to the problem. The handler represents where to jump to in the code when an exception of the specified type occurs between the instructions pointed at by start and end. I sent a debug build to a user encountering this problem (I could not recreate it) and in that I was looking at where in fact the handler was pointing before we called remap(). I learned that when this problem occurs, the handler is not pointing to anywhere in the method currently being processed (not good). In a second debug build I tried to ascertain who was setting these handlers to point to nowhere. This debug never triggered, no-one was setting them to point to nowhere... I happened to notice whilst going through the instructions in the debug output that cobertura was being used, a coverage toolkit that works by doing bytecode manipulation to insert calls out to a library. AspectJ was being called after cobertura and I asked the user to try the steps the other way round - it worked fine. Indicating cobertura was doing something to the bytecode that gave us problems. After much messing about, I recreated it by applying around advice to within(*) to all the classes in rt.jar (I just used that as a very large standalone jar file I could weave into). I learned that Cobertura creates catch blocks that look a little different to what javac and other compilers create. The typical bytecode sequence a compiler produces for a catch block starts with a STORE instruction, to store the exception being caught (whether the body of the catch block uses it or not). But the cobertura catch blocks started with an INVOKESTATIC instruction, a call out to another method. What does this mean? It means the same instruction has two shadows, a 'handler' shadow and a 'method-call' shadow - and it turns out this is what causes our problem. If around advice is applied to the call join point and it cannot be inlined then the body of the call shadow (the call itself) is pulled out into a new method. Because the handler was the same instruction, this meant the handler *was also being pulled out* into the new method, leaving behind an exception handler that jumped to an invalid location (in fact it 'jumped' to an instruction in a different method!). So the reason I never saw the handler location being set incorrectly is that it was set correctly up front, but then dragged out with the method-call shadow into the wrong place. In bytecode terms it looks like this: method-execution() | ICONST_0 | ISTORE_2 | SIPUSH -1 | ISTORE_3 | catch java.lang.Exception (1806389629) -> E0 | | method-call(ProjectData ProjectData.getGlobalProjectData()) | | | INVOKESTATIC ProjectData.getGlobalProjectData () | | method-call(ProjectData getGlobalProjectData()) | | LDC "SomeString" | | method-call(ClassData getOrCreateClassData(java.lang.String)) | | | INVOKEVIRTUAL ProjectData.getOrCreateClassData (LString;) | | method-call(ClassData ProjectData.getOrCreateClassData(String)) | | SIPUSH 106 | | method-call(void ClassData.touch(int)) | | | INVOKEVIRTUAL ClassData.touch (I)V | | method-call(void ClassData.touch(int)) | | ALOAD_1 | | method-call(Object Expression.getValue()) | | | INVOKEVIRTUAL Expression.getValue () | | method-call(Object Expression.getValue()) | catch java.lang.Exception (1806389629) -> E0 | ARETURN | method-call(nProjectData ProjectData.getGlobalProjectData()) | | E0: INVOKESTATIC ProjectData.getGlobalProjectData () | method-call(ProjectData ProjectData.getGlobalProjectData()) | LDC "Object" We can see the problem in that final method-call. The target for the exception handler seen earlier (E0) is within the method-call shadow. What to do?
resolved fixed
5f97d46
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2008-05-07T15:31:18Z
2008-05-07T03:13:20Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
if (list == null) { throw new BCException("circularity in inter-types"); } InstructionList ret = new InstructionList(); for (Iterator i = list.iterator(); i.hasNext();) { ConcreteTypeMunger cmunger = (ConcreteTypeMunger) i.next(); NewFieldTypeMunger munger = (NewFieldTypeMunger) cmunger.getMunger(); ResolvedMember initMethod = munger.getInitMethod(cmunger.getAspectType()); if (!isStatic) ret.append(InstructionConstants.ALOAD_0); ret.append(Utility.createInvoke(fact, world, initMethod)); } return ret; } private void match( LazyMethodGen mg, InstructionHandle ih, BcelShadow enclosingShadow, List shadowAccumulator) { Instruction i = ih.getInstruction(); if ((i instanceof FieldInstruction) && (canMatch(Shadow.FieldGet) || canMatch(Shadow.FieldSet)) ) { FieldInstruction fi = (FieldInstruction) i; if (fi instanceof PUTFIELD || fi instanceof PUTSTATIC) {
230,817
Bug 230817 LazyMethodGen.remap() NullPointerException
This has been reported a few times by different users, but has always proved tough to diagnose. The typical stack trace is something like: java.lang.NullPointerException org.aspectj.weaver.bcel.LazyMethodGen.remap(LazyMethodGen.java:1237) org.aspectj.weaver.bcel.LazyMethodGen.addExceptionHandlers(LazyMethodGen.java:1132) org.aspectj.weaver.bcel.LazyMethodGen.packBody(LazyMethodGen.java:1078) org.aspectj.weaver.bcel.LazyMethodGen.pack(LazyMethodGen.java:977) org.aspectj.weaver.bcel.LazyMethodGen.getMethod(LazyMethodGen.java:484) org.aspectj.weaver.bcel.LazyClassGen.writeBack(LazyClassGen.java:512) org.aspectj.weaver.bcel.LazyClassGen.getJavaClassBytesIncludingReweavable(LazyClassGen.java:652) org.aspectj.weaver.bcel.BcelWeaver.getClassFilesFor(BcelWeaver.java:1420) org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1390) And that is an exception on this line in remap() ih = ih.getNext(); called from the addExceptionHandlers() line: gen.addExceptionHandler( remap(r.getRealStart(), map), remap(r.getRealEnd(), map), remap(r.getHandler(), map), (r.getCatchType() == null) ? null : (ObjectType) BcelWorld.makeBcelType(r.getCatchType())); During weaving, an instruction list is augmented with extra entries representing where shadows start and end (method-call, method-execution, handler, etc). When weaving is complete we want to remove these temporary elements and use the remaining instructions to produce the method bytecode. Now sometimes these temporary entries are targeted by other elements (line number tags, local variable tags and exception handlers usually). During packing we use remap() to reposition the locations so they move off of temporary placeholders and onto real instructions that will make it out into the bytecode. What the above exception tells us is that we started walking over temporary placeholder entries, but before we came to a real instruction, we ran out of instructions! This cannot happen, and indicates something went seriously wrong, we should always encounter an instruction when remapping off a temporary element. After some digging it is actually the remap() call for the handler (not the start or end) that leads to the problem. The handler represents where to jump to in the code when an exception of the specified type occurs between the instructions pointed at by start and end. I sent a debug build to a user encountering this problem (I could not recreate it) and in that I was looking at where in fact the handler was pointing before we called remap(). I learned that when this problem occurs, the handler is not pointing to anywhere in the method currently being processed (not good). In a second debug build I tried to ascertain who was setting these handlers to point to nowhere. This debug never triggered, no-one was setting them to point to nowhere... I happened to notice whilst going through the instructions in the debug output that cobertura was being used, a coverage toolkit that works by doing bytecode manipulation to insert calls out to a library. AspectJ was being called after cobertura and I asked the user to try the steps the other way round - it worked fine. Indicating cobertura was doing something to the bytecode that gave us problems. After much messing about, I recreated it by applying around advice to within(*) to all the classes in rt.jar (I just used that as a very large standalone jar file I could weave into). I learned that Cobertura creates catch blocks that look a little different to what javac and other compilers create. The typical bytecode sequence a compiler produces for a catch block starts with a STORE instruction, to store the exception being caught (whether the body of the catch block uses it or not). But the cobertura catch blocks started with an INVOKESTATIC instruction, a call out to another method. What does this mean? It means the same instruction has two shadows, a 'handler' shadow and a 'method-call' shadow - and it turns out this is what causes our problem. If around advice is applied to the call join point and it cannot be inlined then the body of the call shadow (the call itself) is pulled out into a new method. Because the handler was the same instruction, this meant the handler *was also being pulled out* into the new method, leaving behind an exception handler that jumped to an invalid location (in fact it 'jumped' to an instruction in a different method!). So the reason I never saw the handler location being set incorrectly is that it was set correctly up front, but then dragged out with the method-call shadow into the wrong place. In bytecode terms it looks like this: method-execution() | ICONST_0 | ISTORE_2 | SIPUSH -1 | ISTORE_3 | catch java.lang.Exception (1806389629) -> E0 | | method-call(ProjectData ProjectData.getGlobalProjectData()) | | | INVOKESTATIC ProjectData.getGlobalProjectData () | | method-call(ProjectData getGlobalProjectData()) | | LDC "SomeString" | | method-call(ClassData getOrCreateClassData(java.lang.String)) | | | INVOKEVIRTUAL ProjectData.getOrCreateClassData (LString;) | | method-call(ClassData ProjectData.getOrCreateClassData(String)) | | SIPUSH 106 | | method-call(void ClassData.touch(int)) | | | INVOKEVIRTUAL ClassData.touch (I)V | | method-call(void ClassData.touch(int)) | | ALOAD_1 | | method-call(Object Expression.getValue()) | | | INVOKEVIRTUAL Expression.getValue () | | method-call(Object Expression.getValue()) | catch java.lang.Exception (1806389629) -> E0 | ARETURN | method-call(nProjectData ProjectData.getGlobalProjectData()) | | E0: INVOKESTATIC ProjectData.getGlobalProjectData () | method-call(ProjectData ProjectData.getGlobalProjectData()) | LDC "Object" We can see the problem in that final method-call. The target for the exception handler seen earlier (E0) is within the method-call shadow. What to do?
resolved fixed
5f97d46
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2008-05-07T15:31:18Z
2008-05-07T03:13:20Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
InstructionHandle prevHandle = ih.getPrev(); Instruction prevI = prevHandle.getInstruction(); if (Utility.isConstantPushInstruction(prevI)) { Member field = BcelWorld.makeFieldJoinPointSignature(clazz, (FieldInstruction) i); ResolvedMember resolvedField = field.resolve(world); if (resolvedField == null) { } else if (Modifier.isFinal(resolvedField.getModifiers())) { } else { if (canMatch(Shadow.FieldSet)) matchSetInstruction(mg, ih, enclosingShadow, shadowAccumulator); } } else { if (canMatch(Shadow.FieldSet)) matchSetInstruction(mg, ih, enclosingShadow, shadowAccumulator); } } else { if (canMatch(Shadow.FieldGet)) matchGetInstruction(mg, ih, enclosingShadow, shadowAccumulator); } } else if (i instanceof InvokeInstruction) { InvokeInstruction ii = (InvokeInstruction) i; if (ii.getMethodName(clazz.getConstantPoolGen()).equals("<init>")) { if (canMatch(Shadow.ConstructorCall)) match(
230,817
Bug 230817 LazyMethodGen.remap() NullPointerException
This has been reported a few times by different users, but has always proved tough to diagnose. The typical stack trace is something like: java.lang.NullPointerException org.aspectj.weaver.bcel.LazyMethodGen.remap(LazyMethodGen.java:1237) org.aspectj.weaver.bcel.LazyMethodGen.addExceptionHandlers(LazyMethodGen.java:1132) org.aspectj.weaver.bcel.LazyMethodGen.packBody(LazyMethodGen.java:1078) org.aspectj.weaver.bcel.LazyMethodGen.pack(LazyMethodGen.java:977) org.aspectj.weaver.bcel.LazyMethodGen.getMethod(LazyMethodGen.java:484) org.aspectj.weaver.bcel.LazyClassGen.writeBack(LazyClassGen.java:512) org.aspectj.weaver.bcel.LazyClassGen.getJavaClassBytesIncludingReweavable(LazyClassGen.java:652) org.aspectj.weaver.bcel.BcelWeaver.getClassFilesFor(BcelWeaver.java:1420) org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1390) And that is an exception on this line in remap() ih = ih.getNext(); called from the addExceptionHandlers() line: gen.addExceptionHandler( remap(r.getRealStart(), map), remap(r.getRealEnd(), map), remap(r.getHandler(), map), (r.getCatchType() == null) ? null : (ObjectType) BcelWorld.makeBcelType(r.getCatchType())); During weaving, an instruction list is augmented with extra entries representing where shadows start and end (method-call, method-execution, handler, etc). When weaving is complete we want to remove these temporary elements and use the remaining instructions to produce the method bytecode. Now sometimes these temporary entries are targeted by other elements (line number tags, local variable tags and exception handlers usually). During packing we use remap() to reposition the locations so they move off of temporary placeholders and onto real instructions that will make it out into the bytecode. What the above exception tells us is that we started walking over temporary placeholder entries, but before we came to a real instruction, we ran out of instructions! This cannot happen, and indicates something went seriously wrong, we should always encounter an instruction when remapping off a temporary element. After some digging it is actually the remap() call for the handler (not the start or end) that leads to the problem. The handler represents where to jump to in the code when an exception of the specified type occurs between the instructions pointed at by start and end. I sent a debug build to a user encountering this problem (I could not recreate it) and in that I was looking at where in fact the handler was pointing before we called remap(). I learned that when this problem occurs, the handler is not pointing to anywhere in the method currently being processed (not good). In a second debug build I tried to ascertain who was setting these handlers to point to nowhere. This debug never triggered, no-one was setting them to point to nowhere... I happened to notice whilst going through the instructions in the debug output that cobertura was being used, a coverage toolkit that works by doing bytecode manipulation to insert calls out to a library. AspectJ was being called after cobertura and I asked the user to try the steps the other way round - it worked fine. Indicating cobertura was doing something to the bytecode that gave us problems. After much messing about, I recreated it by applying around advice to within(*) to all the classes in rt.jar (I just used that as a very large standalone jar file I could weave into). I learned that Cobertura creates catch blocks that look a little different to what javac and other compilers create. The typical bytecode sequence a compiler produces for a catch block starts with a STORE instruction, to store the exception being caught (whether the body of the catch block uses it or not). But the cobertura catch blocks started with an INVOKESTATIC instruction, a call out to another method. What does this mean? It means the same instruction has two shadows, a 'handler' shadow and a 'method-call' shadow - and it turns out this is what causes our problem. If around advice is applied to the call join point and it cannot be inlined then the body of the call shadow (the call itself) is pulled out into a new method. Because the handler was the same instruction, this meant the handler *was also being pulled out* into the new method, leaving behind an exception handler that jumped to an invalid location (in fact it 'jumped' to an instruction in a different method!). So the reason I never saw the handler location being set incorrectly is that it was set correctly up front, but then dragged out with the method-call shadow into the wrong place. In bytecode terms it looks like this: method-execution() | ICONST_0 | ISTORE_2 | SIPUSH -1 | ISTORE_3 | catch java.lang.Exception (1806389629) -> E0 | | method-call(ProjectData ProjectData.getGlobalProjectData()) | | | INVOKESTATIC ProjectData.getGlobalProjectData () | | method-call(ProjectData getGlobalProjectData()) | | LDC "SomeString" | | method-call(ClassData getOrCreateClassData(java.lang.String)) | | | INVOKEVIRTUAL ProjectData.getOrCreateClassData (LString;) | | method-call(ClassData ProjectData.getOrCreateClassData(String)) | | SIPUSH 106 | | method-call(void ClassData.touch(int)) | | | INVOKEVIRTUAL ClassData.touch (I)V | | method-call(void ClassData.touch(int)) | | ALOAD_1 | | method-call(Object Expression.getValue()) | | | INVOKEVIRTUAL Expression.getValue () | | method-call(Object Expression.getValue()) | catch java.lang.Exception (1806389629) -> E0 | ARETURN | method-call(nProjectData ProjectData.getGlobalProjectData()) | | E0: INVOKESTATIC ProjectData.getGlobalProjectData () | method-call(ProjectData ProjectData.getGlobalProjectData()) | LDC "Object" We can see the problem in that final method-call. The target for the exception handler seen earlier (E0) is within the method-call shadow. What to do?
resolved fixed
5f97d46
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2008-05-07T15:31:18Z
2008-05-07T03:13:20Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
BcelShadow.makeConstructorCall(world, mg, ih, enclosingShadow), shadowAccumulator); } else if (ii instanceof INVOKESPECIAL) { String onTypeName = ii.getClassName(cpg); if (onTypeName.equals(mg.getEnclosingClass().getName())) { matchInvokeInstruction(mg, ih, ii, enclosingShadow, shadowAccumulator); } else { } } else { matchInvokeInstruction(mg, ih, ii, enclosingShadow, shadowAccumulator); } } else if (world.isJoinpointArrayConstructionEnabled() && (i instanceof NEWARRAY || i instanceof ANEWARRAY || i instanceof MULTIANEWARRAY)) { if (canMatch(Shadow.ConstructorCall)) { boolean debug = false; if (debug) System.err.println("Found new array instruction: "+i); if (i instanceof ANEWARRAY) { ANEWARRAY arrayInstruction = (ANEWARRAY)i; ObjectType arrayType = arrayInstruction.getLoadClassType(clazz.getConstantPoolGen()); if (debug) System.err.println("Array type is "+arrayType); BcelShadow ctorCallShadow = BcelShadow.makeArrayConstructorCall(world,mg,ih,enclosingShadow); match(ctorCallShadow,shadowAccumulator); } else if (i instanceof NEWARRAY) { NEWARRAY arrayInstruction = (NEWARRAY)i; Type arrayType = arrayInstruction.getType(); if (debug) System.err.println("Array type is "+arrayType); BcelShadow ctorCallShadow = BcelShadow.makeArrayConstructorCall(world,mg,ih,enclosingShadow); match(ctorCallShadow,shadowAccumulator);
230,817
Bug 230817 LazyMethodGen.remap() NullPointerException
This has been reported a few times by different users, but has always proved tough to diagnose. The typical stack trace is something like: java.lang.NullPointerException org.aspectj.weaver.bcel.LazyMethodGen.remap(LazyMethodGen.java:1237) org.aspectj.weaver.bcel.LazyMethodGen.addExceptionHandlers(LazyMethodGen.java:1132) org.aspectj.weaver.bcel.LazyMethodGen.packBody(LazyMethodGen.java:1078) org.aspectj.weaver.bcel.LazyMethodGen.pack(LazyMethodGen.java:977) org.aspectj.weaver.bcel.LazyMethodGen.getMethod(LazyMethodGen.java:484) org.aspectj.weaver.bcel.LazyClassGen.writeBack(LazyClassGen.java:512) org.aspectj.weaver.bcel.LazyClassGen.getJavaClassBytesIncludingReweavable(LazyClassGen.java:652) org.aspectj.weaver.bcel.BcelWeaver.getClassFilesFor(BcelWeaver.java:1420) org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1390) And that is an exception on this line in remap() ih = ih.getNext(); called from the addExceptionHandlers() line: gen.addExceptionHandler( remap(r.getRealStart(), map), remap(r.getRealEnd(), map), remap(r.getHandler(), map), (r.getCatchType() == null) ? null : (ObjectType) BcelWorld.makeBcelType(r.getCatchType())); During weaving, an instruction list is augmented with extra entries representing where shadows start and end (method-call, method-execution, handler, etc). When weaving is complete we want to remove these temporary elements and use the remaining instructions to produce the method bytecode. Now sometimes these temporary entries are targeted by other elements (line number tags, local variable tags and exception handlers usually). During packing we use remap() to reposition the locations so they move off of temporary placeholders and onto real instructions that will make it out into the bytecode. What the above exception tells us is that we started walking over temporary placeholder entries, but before we came to a real instruction, we ran out of instructions! This cannot happen, and indicates something went seriously wrong, we should always encounter an instruction when remapping off a temporary element. After some digging it is actually the remap() call for the handler (not the start or end) that leads to the problem. The handler represents where to jump to in the code when an exception of the specified type occurs between the instructions pointed at by start and end. I sent a debug build to a user encountering this problem (I could not recreate it) and in that I was looking at where in fact the handler was pointing before we called remap(). I learned that when this problem occurs, the handler is not pointing to anywhere in the method currently being processed (not good). In a second debug build I tried to ascertain who was setting these handlers to point to nowhere. This debug never triggered, no-one was setting them to point to nowhere... I happened to notice whilst going through the instructions in the debug output that cobertura was being used, a coverage toolkit that works by doing bytecode manipulation to insert calls out to a library. AspectJ was being called after cobertura and I asked the user to try the steps the other way round - it worked fine. Indicating cobertura was doing something to the bytecode that gave us problems. After much messing about, I recreated it by applying around advice to within(*) to all the classes in rt.jar (I just used that as a very large standalone jar file I could weave into). I learned that Cobertura creates catch blocks that look a little different to what javac and other compilers create. The typical bytecode sequence a compiler produces for a catch block starts with a STORE instruction, to store the exception being caught (whether the body of the catch block uses it or not). But the cobertura catch blocks started with an INVOKESTATIC instruction, a call out to another method. What does this mean? It means the same instruction has two shadows, a 'handler' shadow and a 'method-call' shadow - and it turns out this is what causes our problem. If around advice is applied to the call join point and it cannot be inlined then the body of the call shadow (the call itself) is pulled out into a new method. Because the handler was the same instruction, this meant the handler *was also being pulled out* into the new method, leaving behind an exception handler that jumped to an invalid location (in fact it 'jumped' to an instruction in a different method!). So the reason I never saw the handler location being set incorrectly is that it was set correctly up front, but then dragged out with the method-call shadow into the wrong place. In bytecode terms it looks like this: method-execution() | ICONST_0 | ISTORE_2 | SIPUSH -1 | ISTORE_3 | catch java.lang.Exception (1806389629) -> E0 | | method-call(ProjectData ProjectData.getGlobalProjectData()) | | | INVOKESTATIC ProjectData.getGlobalProjectData () | | method-call(ProjectData getGlobalProjectData()) | | LDC "SomeString" | | method-call(ClassData getOrCreateClassData(java.lang.String)) | | | INVOKEVIRTUAL ProjectData.getOrCreateClassData (LString;) | | method-call(ClassData ProjectData.getOrCreateClassData(String)) | | SIPUSH 106 | | method-call(void ClassData.touch(int)) | | | INVOKEVIRTUAL ClassData.touch (I)V | | method-call(void ClassData.touch(int)) | | ALOAD_1 | | method-call(Object Expression.getValue()) | | | INVOKEVIRTUAL Expression.getValue () | | method-call(Object Expression.getValue()) | catch java.lang.Exception (1806389629) -> E0 | ARETURN | method-call(nProjectData ProjectData.getGlobalProjectData()) | | E0: INVOKESTATIC ProjectData.getGlobalProjectData () | method-call(ProjectData ProjectData.getGlobalProjectData()) | LDC "Object" We can see the problem in that final method-call. The target for the exception handler seen earlier (E0) is within the method-call shadow. What to do?
resolved fixed
5f97d46
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2008-05-07T15:31:18Z
2008-05-07T03:13:20Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
} else if (i instanceof MULTIANEWARRAY) { MULTIANEWARRAY arrayInstruction = (MULTIANEWARRAY)i; ObjectType arrayType = arrayInstruction.getLoadClassType(clazz.getConstantPoolGen()); if (debug) System.err.println("Array type is "+arrayType); BcelShadow ctorCallShadow = BcelShadow.makeArrayConstructorCall(world,mg,ih,enclosingShadow); match(ctorCallShadow,shadowAccumulator); } } } else if ( world.isJoinpointSynchronizationEnabled() && ((i instanceof MONITORENTER) || (i instanceof MONITOREXIT))) { if (i instanceof MONITORENTER) { BcelShadow monitorEntryShadow = BcelShadow.makeMonitorEnter(world,mg,ih,enclosingShadow); match(monitorEntryShadow,shadowAccumulator); } else { BcelShadow monitorExitShadow = BcelShadow.makeMonitorExit(world,mg,ih,enclosingShadow); match(monitorExitShadow,shadowAccumulator); } } } if (!canMatch(Shadow.ExceptionHandler)) return; if (Range.isRangeHandle(ih)) return; InstructionTargeter[] targeters = ih.getTargeters(); if (targeters != null) { for (int j = 0; j < targeters.length; j++) { InstructionTargeter t = targeters[j]; if (t instanceof ExceptionRange) {
230,817
Bug 230817 LazyMethodGen.remap() NullPointerException
This has been reported a few times by different users, but has always proved tough to diagnose. The typical stack trace is something like: java.lang.NullPointerException org.aspectj.weaver.bcel.LazyMethodGen.remap(LazyMethodGen.java:1237) org.aspectj.weaver.bcel.LazyMethodGen.addExceptionHandlers(LazyMethodGen.java:1132) org.aspectj.weaver.bcel.LazyMethodGen.packBody(LazyMethodGen.java:1078) org.aspectj.weaver.bcel.LazyMethodGen.pack(LazyMethodGen.java:977) org.aspectj.weaver.bcel.LazyMethodGen.getMethod(LazyMethodGen.java:484) org.aspectj.weaver.bcel.LazyClassGen.writeBack(LazyClassGen.java:512) org.aspectj.weaver.bcel.LazyClassGen.getJavaClassBytesIncludingReweavable(LazyClassGen.java:652) org.aspectj.weaver.bcel.BcelWeaver.getClassFilesFor(BcelWeaver.java:1420) org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1390) And that is an exception on this line in remap() ih = ih.getNext(); called from the addExceptionHandlers() line: gen.addExceptionHandler( remap(r.getRealStart(), map), remap(r.getRealEnd(), map), remap(r.getHandler(), map), (r.getCatchType() == null) ? null : (ObjectType) BcelWorld.makeBcelType(r.getCatchType())); During weaving, an instruction list is augmented with extra entries representing where shadows start and end (method-call, method-execution, handler, etc). When weaving is complete we want to remove these temporary elements and use the remaining instructions to produce the method bytecode. Now sometimes these temporary entries are targeted by other elements (line number tags, local variable tags and exception handlers usually). During packing we use remap() to reposition the locations so they move off of temporary placeholders and onto real instructions that will make it out into the bytecode. What the above exception tells us is that we started walking over temporary placeholder entries, but before we came to a real instruction, we ran out of instructions! This cannot happen, and indicates something went seriously wrong, we should always encounter an instruction when remapping off a temporary element. After some digging it is actually the remap() call for the handler (not the start or end) that leads to the problem. The handler represents where to jump to in the code when an exception of the specified type occurs between the instructions pointed at by start and end. I sent a debug build to a user encountering this problem (I could not recreate it) and in that I was looking at where in fact the handler was pointing before we called remap(). I learned that when this problem occurs, the handler is not pointing to anywhere in the method currently being processed (not good). In a second debug build I tried to ascertain who was setting these handlers to point to nowhere. This debug never triggered, no-one was setting them to point to nowhere... I happened to notice whilst going through the instructions in the debug output that cobertura was being used, a coverage toolkit that works by doing bytecode manipulation to insert calls out to a library. AspectJ was being called after cobertura and I asked the user to try the steps the other way round - it worked fine. Indicating cobertura was doing something to the bytecode that gave us problems. After much messing about, I recreated it by applying around advice to within(*) to all the classes in rt.jar (I just used that as a very large standalone jar file I could weave into). I learned that Cobertura creates catch blocks that look a little different to what javac and other compilers create. The typical bytecode sequence a compiler produces for a catch block starts with a STORE instruction, to store the exception being caught (whether the body of the catch block uses it or not). But the cobertura catch blocks started with an INVOKESTATIC instruction, a call out to another method. What does this mean? It means the same instruction has two shadows, a 'handler' shadow and a 'method-call' shadow - and it turns out this is what causes our problem. If around advice is applied to the call join point and it cannot be inlined then the body of the call shadow (the call itself) is pulled out into a new method. Because the handler was the same instruction, this meant the handler *was also being pulled out* into the new method, leaving behind an exception handler that jumped to an invalid location (in fact it 'jumped' to an instruction in a different method!). So the reason I never saw the handler location being set incorrectly is that it was set correctly up front, but then dragged out with the method-call shadow into the wrong place. In bytecode terms it looks like this: method-execution() | ICONST_0 | ISTORE_2 | SIPUSH -1 | ISTORE_3 | catch java.lang.Exception (1806389629) -> E0 | | method-call(ProjectData ProjectData.getGlobalProjectData()) | | | INVOKESTATIC ProjectData.getGlobalProjectData () | | method-call(ProjectData getGlobalProjectData()) | | LDC "SomeString" | | method-call(ClassData getOrCreateClassData(java.lang.String)) | | | INVOKEVIRTUAL ProjectData.getOrCreateClassData (LString;) | | method-call(ClassData ProjectData.getOrCreateClassData(String)) | | SIPUSH 106 | | method-call(void ClassData.touch(int)) | | | INVOKEVIRTUAL ClassData.touch (I)V | | method-call(void ClassData.touch(int)) | | ALOAD_1 | | method-call(Object Expression.getValue()) | | | INVOKEVIRTUAL Expression.getValue () | | method-call(Object Expression.getValue()) | catch java.lang.Exception (1806389629) -> E0 | ARETURN | method-call(nProjectData ProjectData.getGlobalProjectData()) | | E0: INVOKESTATIC ProjectData.getGlobalProjectData () | method-call(ProjectData ProjectData.getGlobalProjectData()) | LDC "Object" We can see the problem in that final method-call. The target for the exception handler seen earlier (E0) is within the method-call shadow. What to do?
resolved fixed
5f97d46
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2008-05-07T15:31:18Z
2008-05-07T03:13:20Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
ExceptionRange er = (ExceptionRange) t; if (er.getCatchType() == null) continue; if (isInitFailureHandler(ih)) return; match( BcelShadow.makeExceptionHandler( world, er, mg, ih, enclosingShadow), shadowAccumulator); } } } } private boolean isInitFailureHandler(InstructionHandle ih) { InstructionHandle twoInstructionsAway = ih.getNext().getNext(); if (twoInstructionsAway.getInstruction() instanceof PUTSTATIC) { String name = ((PUTSTATIC)twoInstructionsAway.getInstruction()).getFieldName(cpg); if (name.equals(NameMangler.INITFAILURECAUSE_FIELD_NAME)) return true; } return false; } private void matchSetInstruction( LazyMethodGen mg, InstructionHandle ih,
230,817
Bug 230817 LazyMethodGen.remap() NullPointerException
This has been reported a few times by different users, but has always proved tough to diagnose. The typical stack trace is something like: java.lang.NullPointerException org.aspectj.weaver.bcel.LazyMethodGen.remap(LazyMethodGen.java:1237) org.aspectj.weaver.bcel.LazyMethodGen.addExceptionHandlers(LazyMethodGen.java:1132) org.aspectj.weaver.bcel.LazyMethodGen.packBody(LazyMethodGen.java:1078) org.aspectj.weaver.bcel.LazyMethodGen.pack(LazyMethodGen.java:977) org.aspectj.weaver.bcel.LazyMethodGen.getMethod(LazyMethodGen.java:484) org.aspectj.weaver.bcel.LazyClassGen.writeBack(LazyClassGen.java:512) org.aspectj.weaver.bcel.LazyClassGen.getJavaClassBytesIncludingReweavable(LazyClassGen.java:652) org.aspectj.weaver.bcel.BcelWeaver.getClassFilesFor(BcelWeaver.java:1420) org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1390) And that is an exception on this line in remap() ih = ih.getNext(); called from the addExceptionHandlers() line: gen.addExceptionHandler( remap(r.getRealStart(), map), remap(r.getRealEnd(), map), remap(r.getHandler(), map), (r.getCatchType() == null) ? null : (ObjectType) BcelWorld.makeBcelType(r.getCatchType())); During weaving, an instruction list is augmented with extra entries representing where shadows start and end (method-call, method-execution, handler, etc). When weaving is complete we want to remove these temporary elements and use the remaining instructions to produce the method bytecode. Now sometimes these temporary entries are targeted by other elements (line number tags, local variable tags and exception handlers usually). During packing we use remap() to reposition the locations so they move off of temporary placeholders and onto real instructions that will make it out into the bytecode. What the above exception tells us is that we started walking over temporary placeholder entries, but before we came to a real instruction, we ran out of instructions! This cannot happen, and indicates something went seriously wrong, we should always encounter an instruction when remapping off a temporary element. After some digging it is actually the remap() call for the handler (not the start or end) that leads to the problem. The handler represents where to jump to in the code when an exception of the specified type occurs between the instructions pointed at by start and end. I sent a debug build to a user encountering this problem (I could not recreate it) and in that I was looking at where in fact the handler was pointing before we called remap(). I learned that when this problem occurs, the handler is not pointing to anywhere in the method currently being processed (not good). In a second debug build I tried to ascertain who was setting these handlers to point to nowhere. This debug never triggered, no-one was setting them to point to nowhere... I happened to notice whilst going through the instructions in the debug output that cobertura was being used, a coverage toolkit that works by doing bytecode manipulation to insert calls out to a library. AspectJ was being called after cobertura and I asked the user to try the steps the other way round - it worked fine. Indicating cobertura was doing something to the bytecode that gave us problems. After much messing about, I recreated it by applying around advice to within(*) to all the classes in rt.jar (I just used that as a very large standalone jar file I could weave into). I learned that Cobertura creates catch blocks that look a little different to what javac and other compilers create. The typical bytecode sequence a compiler produces for a catch block starts with a STORE instruction, to store the exception being caught (whether the body of the catch block uses it or not). But the cobertura catch blocks started with an INVOKESTATIC instruction, a call out to another method. What does this mean? It means the same instruction has two shadows, a 'handler' shadow and a 'method-call' shadow - and it turns out this is what causes our problem. If around advice is applied to the call join point and it cannot be inlined then the body of the call shadow (the call itself) is pulled out into a new method. Because the handler was the same instruction, this meant the handler *was also being pulled out* into the new method, leaving behind an exception handler that jumped to an invalid location (in fact it 'jumped' to an instruction in a different method!). So the reason I never saw the handler location being set incorrectly is that it was set correctly up front, but then dragged out with the method-call shadow into the wrong place. In bytecode terms it looks like this: method-execution() | ICONST_0 | ISTORE_2 | SIPUSH -1 | ISTORE_3 | catch java.lang.Exception (1806389629) -> E0 | | method-call(ProjectData ProjectData.getGlobalProjectData()) | | | INVOKESTATIC ProjectData.getGlobalProjectData () | | method-call(ProjectData getGlobalProjectData()) | | LDC "SomeString" | | method-call(ClassData getOrCreateClassData(java.lang.String)) | | | INVOKEVIRTUAL ProjectData.getOrCreateClassData (LString;) | | method-call(ClassData ProjectData.getOrCreateClassData(String)) | | SIPUSH 106 | | method-call(void ClassData.touch(int)) | | | INVOKEVIRTUAL ClassData.touch (I)V | | method-call(void ClassData.touch(int)) | | ALOAD_1 | | method-call(Object Expression.getValue()) | | | INVOKEVIRTUAL Expression.getValue () | | method-call(Object Expression.getValue()) | catch java.lang.Exception (1806389629) -> E0 | ARETURN | method-call(nProjectData ProjectData.getGlobalProjectData()) | | E0: INVOKESTATIC ProjectData.getGlobalProjectData () | method-call(ProjectData ProjectData.getGlobalProjectData()) | LDC "Object" We can see the problem in that final method-call. The target for the exception handler seen earlier (E0) is within the method-call shadow. What to do?
resolved fixed
5f97d46
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2008-05-07T15:31:18Z
2008-05-07T03:13:20Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
BcelShadow enclosingShadow, List shadowAccumulator) { FieldInstruction fi = (FieldInstruction) ih.getInstruction(); Member field = BcelWorld.makeFieldJoinPointSignature(clazz, fi); if (field.getName().startsWith(NameMangler.PREFIX)) return; ResolvedMember resolvedField = field.resolve(world); if (resolvedField == null) { return; } else if ( Modifier.isFinal(resolvedField.getModifiers()) && Utility.isConstantPushInstruction(ih.getPrev().getInstruction())) { return; } else if (resolvedField.isSynthetic()) { return; } else { BcelShadow bs= BcelShadow.makeFieldSet(world, resolvedField, mg, ih, enclosingShadow); String cname = fi.getClassName(cpg); if (!resolvedField.getDeclaringType().getName().equals(cname)) { bs.setActualTargetType(cname); } match(bs, shadowAccumulator);
230,817
Bug 230817 LazyMethodGen.remap() NullPointerException
This has been reported a few times by different users, but has always proved tough to diagnose. The typical stack trace is something like: java.lang.NullPointerException org.aspectj.weaver.bcel.LazyMethodGen.remap(LazyMethodGen.java:1237) org.aspectj.weaver.bcel.LazyMethodGen.addExceptionHandlers(LazyMethodGen.java:1132) org.aspectj.weaver.bcel.LazyMethodGen.packBody(LazyMethodGen.java:1078) org.aspectj.weaver.bcel.LazyMethodGen.pack(LazyMethodGen.java:977) org.aspectj.weaver.bcel.LazyMethodGen.getMethod(LazyMethodGen.java:484) org.aspectj.weaver.bcel.LazyClassGen.writeBack(LazyClassGen.java:512) org.aspectj.weaver.bcel.LazyClassGen.getJavaClassBytesIncludingReweavable(LazyClassGen.java:652) org.aspectj.weaver.bcel.BcelWeaver.getClassFilesFor(BcelWeaver.java:1420) org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1390) And that is an exception on this line in remap() ih = ih.getNext(); called from the addExceptionHandlers() line: gen.addExceptionHandler( remap(r.getRealStart(), map), remap(r.getRealEnd(), map), remap(r.getHandler(), map), (r.getCatchType() == null) ? null : (ObjectType) BcelWorld.makeBcelType(r.getCatchType())); During weaving, an instruction list is augmented with extra entries representing where shadows start and end (method-call, method-execution, handler, etc). When weaving is complete we want to remove these temporary elements and use the remaining instructions to produce the method bytecode. Now sometimes these temporary entries are targeted by other elements (line number tags, local variable tags and exception handlers usually). During packing we use remap() to reposition the locations so they move off of temporary placeholders and onto real instructions that will make it out into the bytecode. What the above exception tells us is that we started walking over temporary placeholder entries, but before we came to a real instruction, we ran out of instructions! This cannot happen, and indicates something went seriously wrong, we should always encounter an instruction when remapping off a temporary element. After some digging it is actually the remap() call for the handler (not the start or end) that leads to the problem. The handler represents where to jump to in the code when an exception of the specified type occurs between the instructions pointed at by start and end. I sent a debug build to a user encountering this problem (I could not recreate it) and in that I was looking at where in fact the handler was pointing before we called remap(). I learned that when this problem occurs, the handler is not pointing to anywhere in the method currently being processed (not good). In a second debug build I tried to ascertain who was setting these handlers to point to nowhere. This debug never triggered, no-one was setting them to point to nowhere... I happened to notice whilst going through the instructions in the debug output that cobertura was being used, a coverage toolkit that works by doing bytecode manipulation to insert calls out to a library. AspectJ was being called after cobertura and I asked the user to try the steps the other way round - it worked fine. Indicating cobertura was doing something to the bytecode that gave us problems. After much messing about, I recreated it by applying around advice to within(*) to all the classes in rt.jar (I just used that as a very large standalone jar file I could weave into). I learned that Cobertura creates catch blocks that look a little different to what javac and other compilers create. The typical bytecode sequence a compiler produces for a catch block starts with a STORE instruction, to store the exception being caught (whether the body of the catch block uses it or not). But the cobertura catch blocks started with an INVOKESTATIC instruction, a call out to another method. What does this mean? It means the same instruction has two shadows, a 'handler' shadow and a 'method-call' shadow - and it turns out this is what causes our problem. If around advice is applied to the call join point and it cannot be inlined then the body of the call shadow (the call itself) is pulled out into a new method. Because the handler was the same instruction, this meant the handler *was also being pulled out* into the new method, leaving behind an exception handler that jumped to an invalid location (in fact it 'jumped' to an instruction in a different method!). So the reason I never saw the handler location being set incorrectly is that it was set correctly up front, but then dragged out with the method-call shadow into the wrong place. In bytecode terms it looks like this: method-execution() | ICONST_0 | ISTORE_2 | SIPUSH -1 | ISTORE_3 | catch java.lang.Exception (1806389629) -> E0 | | method-call(ProjectData ProjectData.getGlobalProjectData()) | | | INVOKESTATIC ProjectData.getGlobalProjectData () | | method-call(ProjectData getGlobalProjectData()) | | LDC "SomeString" | | method-call(ClassData getOrCreateClassData(java.lang.String)) | | | INVOKEVIRTUAL ProjectData.getOrCreateClassData (LString;) | | method-call(ClassData ProjectData.getOrCreateClassData(String)) | | SIPUSH 106 | | method-call(void ClassData.touch(int)) | | | INVOKEVIRTUAL ClassData.touch (I)V | | method-call(void ClassData.touch(int)) | | ALOAD_1 | | method-call(Object Expression.getValue()) | | | INVOKEVIRTUAL Expression.getValue () | | method-call(Object Expression.getValue()) | catch java.lang.Exception (1806389629) -> E0 | ARETURN | method-call(nProjectData ProjectData.getGlobalProjectData()) | | E0: INVOKESTATIC ProjectData.getGlobalProjectData () | method-call(ProjectData ProjectData.getGlobalProjectData()) | LDC "Object" We can see the problem in that final method-call. The target for the exception handler seen earlier (E0) is within the method-call shadow. What to do?
resolved fixed
5f97d46
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2008-05-07T15:31:18Z
2008-05-07T03:13:20Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
} } private void matchGetInstruction(LazyMethodGen mg, InstructionHandle ih, BcelShadow enclosingShadow, List shadowAccumulator) { FieldInstruction fi = (FieldInstruction) ih.getInstruction(); Member field = BcelWorld.makeFieldJoinPointSignature(clazz, fi); if (field.getName().startsWith(NameMangler.PREFIX)) return; ResolvedMember resolvedField = field.resolve(world); if (resolvedField == null) { return; } else if (resolvedField.isSynthetic()) { return; } else { BcelShadow bs = BcelShadow.makeFieldGet(world,resolvedField,mg,ih,enclosingShadow); String cname = fi.getClassName(cpg); if (!resolvedField.getDeclaringType().getName().equals(cname)) { bs.setActualTargetType(cname); } match(bs, shadowAccumulator); } } /** * For some named resolved type, this method looks for a member with a particular name - * it should only be used when you truly believe there is only one member with that * name in the type as it returns the first one it finds. */
230,817
Bug 230817 LazyMethodGen.remap() NullPointerException
This has been reported a few times by different users, but has always proved tough to diagnose. The typical stack trace is something like: java.lang.NullPointerException org.aspectj.weaver.bcel.LazyMethodGen.remap(LazyMethodGen.java:1237) org.aspectj.weaver.bcel.LazyMethodGen.addExceptionHandlers(LazyMethodGen.java:1132) org.aspectj.weaver.bcel.LazyMethodGen.packBody(LazyMethodGen.java:1078) org.aspectj.weaver.bcel.LazyMethodGen.pack(LazyMethodGen.java:977) org.aspectj.weaver.bcel.LazyMethodGen.getMethod(LazyMethodGen.java:484) org.aspectj.weaver.bcel.LazyClassGen.writeBack(LazyClassGen.java:512) org.aspectj.weaver.bcel.LazyClassGen.getJavaClassBytesIncludingReweavable(LazyClassGen.java:652) org.aspectj.weaver.bcel.BcelWeaver.getClassFilesFor(BcelWeaver.java:1420) org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1390) And that is an exception on this line in remap() ih = ih.getNext(); called from the addExceptionHandlers() line: gen.addExceptionHandler( remap(r.getRealStart(), map), remap(r.getRealEnd(), map), remap(r.getHandler(), map), (r.getCatchType() == null) ? null : (ObjectType) BcelWorld.makeBcelType(r.getCatchType())); During weaving, an instruction list is augmented with extra entries representing where shadows start and end (method-call, method-execution, handler, etc). When weaving is complete we want to remove these temporary elements and use the remaining instructions to produce the method bytecode. Now sometimes these temporary entries are targeted by other elements (line number tags, local variable tags and exception handlers usually). During packing we use remap() to reposition the locations so they move off of temporary placeholders and onto real instructions that will make it out into the bytecode. What the above exception tells us is that we started walking over temporary placeholder entries, but before we came to a real instruction, we ran out of instructions! This cannot happen, and indicates something went seriously wrong, we should always encounter an instruction when remapping off a temporary element. After some digging it is actually the remap() call for the handler (not the start or end) that leads to the problem. The handler represents where to jump to in the code when an exception of the specified type occurs between the instructions pointed at by start and end. I sent a debug build to a user encountering this problem (I could not recreate it) and in that I was looking at where in fact the handler was pointing before we called remap(). I learned that when this problem occurs, the handler is not pointing to anywhere in the method currently being processed (not good). In a second debug build I tried to ascertain who was setting these handlers to point to nowhere. This debug never triggered, no-one was setting them to point to nowhere... I happened to notice whilst going through the instructions in the debug output that cobertura was being used, a coverage toolkit that works by doing bytecode manipulation to insert calls out to a library. AspectJ was being called after cobertura and I asked the user to try the steps the other way round - it worked fine. Indicating cobertura was doing something to the bytecode that gave us problems. After much messing about, I recreated it by applying around advice to within(*) to all the classes in rt.jar (I just used that as a very large standalone jar file I could weave into). I learned that Cobertura creates catch blocks that look a little different to what javac and other compilers create. The typical bytecode sequence a compiler produces for a catch block starts with a STORE instruction, to store the exception being caught (whether the body of the catch block uses it or not). But the cobertura catch blocks started with an INVOKESTATIC instruction, a call out to another method. What does this mean? It means the same instruction has two shadows, a 'handler' shadow and a 'method-call' shadow - and it turns out this is what causes our problem. If around advice is applied to the call join point and it cannot be inlined then the body of the call shadow (the call itself) is pulled out into a new method. Because the handler was the same instruction, this meant the handler *was also being pulled out* into the new method, leaving behind an exception handler that jumped to an invalid location (in fact it 'jumped' to an instruction in a different method!). So the reason I never saw the handler location being set incorrectly is that it was set correctly up front, but then dragged out with the method-call shadow into the wrong place. In bytecode terms it looks like this: method-execution() | ICONST_0 | ISTORE_2 | SIPUSH -1 | ISTORE_3 | catch java.lang.Exception (1806389629) -> E0 | | method-call(ProjectData ProjectData.getGlobalProjectData()) | | | INVOKESTATIC ProjectData.getGlobalProjectData () | | method-call(ProjectData getGlobalProjectData()) | | LDC "SomeString" | | method-call(ClassData getOrCreateClassData(java.lang.String)) | | | INVOKEVIRTUAL ProjectData.getOrCreateClassData (LString;) | | method-call(ClassData ProjectData.getOrCreateClassData(String)) | | SIPUSH 106 | | method-call(void ClassData.touch(int)) | | | INVOKEVIRTUAL ClassData.touch (I)V | | method-call(void ClassData.touch(int)) | | ALOAD_1 | | method-call(Object Expression.getValue()) | | | INVOKEVIRTUAL Expression.getValue () | | method-call(Object Expression.getValue()) | catch java.lang.Exception (1806389629) -> E0 | ARETURN | method-call(nProjectData ProjectData.getGlobalProjectData()) | | E0: INVOKESTATIC ProjectData.getGlobalProjectData () | method-call(ProjectData ProjectData.getGlobalProjectData()) | LDC "Object" We can see the problem in that final method-call. The target for the exception handler seen earlier (E0) is within the method-call shadow. What to do?
resolved fixed
5f97d46
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2008-05-07T15:31:18Z
2008-05-07T03:13:20Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
private ResolvedMember findResolvedMemberNamed(ResolvedType type,String methodName) { ResolvedMember[] allMethods = type.getDeclaredMethods(); for (int i = 0; i < allMethods.length; i++) { ResolvedMember member = allMethods[i]; if (member.getName().equals(methodName)) return member; } return null; } /** * For a given resolvedmember, this will discover the real annotations for it. * <b>Should only be used when the resolvedmember is the contents of an effective signature * attribute, as thats the only time when the annotations aren't stored directly in the * resolvedMember</b> * @param rm the sig we want it to pretend to be 'int A.m()' or somesuch ITD like thing * @param declaredSig the real sig 'blah.ajc$xxx' */ private void fixAnnotationsForResolvedMember(ResolvedMember rm,ResolvedMember declaredSig) { try { UnresolvedType memberHostType = declaredSig.getDeclaringType(); ResolvedType[] annotations = (ResolvedType[])mapToAnnotations.get(rm); String methodName = declaredSig.getName(); if (annotations == null) { if (rm.getKind()==Member.FIELD) { if (methodName.startsWith("ajc$inlineAccessField")) { ResolvedMember resolvedDooberry = world.resolve(rm); annotations = resolvedDooberry.getAnnotationTypes(); } else { ResolvedMember realthing = AjcMemberMaker.interFieldInitializer(rm,memberHostType);
230,817
Bug 230817 LazyMethodGen.remap() NullPointerException
This has been reported a few times by different users, but has always proved tough to diagnose. The typical stack trace is something like: java.lang.NullPointerException org.aspectj.weaver.bcel.LazyMethodGen.remap(LazyMethodGen.java:1237) org.aspectj.weaver.bcel.LazyMethodGen.addExceptionHandlers(LazyMethodGen.java:1132) org.aspectj.weaver.bcel.LazyMethodGen.packBody(LazyMethodGen.java:1078) org.aspectj.weaver.bcel.LazyMethodGen.pack(LazyMethodGen.java:977) org.aspectj.weaver.bcel.LazyMethodGen.getMethod(LazyMethodGen.java:484) org.aspectj.weaver.bcel.LazyClassGen.writeBack(LazyClassGen.java:512) org.aspectj.weaver.bcel.LazyClassGen.getJavaClassBytesIncludingReweavable(LazyClassGen.java:652) org.aspectj.weaver.bcel.BcelWeaver.getClassFilesFor(BcelWeaver.java:1420) org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1390) And that is an exception on this line in remap() ih = ih.getNext(); called from the addExceptionHandlers() line: gen.addExceptionHandler( remap(r.getRealStart(), map), remap(r.getRealEnd(), map), remap(r.getHandler(), map), (r.getCatchType() == null) ? null : (ObjectType) BcelWorld.makeBcelType(r.getCatchType())); During weaving, an instruction list is augmented with extra entries representing where shadows start and end (method-call, method-execution, handler, etc). When weaving is complete we want to remove these temporary elements and use the remaining instructions to produce the method bytecode. Now sometimes these temporary entries are targeted by other elements (line number tags, local variable tags and exception handlers usually). During packing we use remap() to reposition the locations so they move off of temporary placeholders and onto real instructions that will make it out into the bytecode. What the above exception tells us is that we started walking over temporary placeholder entries, but before we came to a real instruction, we ran out of instructions! This cannot happen, and indicates something went seriously wrong, we should always encounter an instruction when remapping off a temporary element. After some digging it is actually the remap() call for the handler (not the start or end) that leads to the problem. The handler represents where to jump to in the code when an exception of the specified type occurs between the instructions pointed at by start and end. I sent a debug build to a user encountering this problem (I could not recreate it) and in that I was looking at where in fact the handler was pointing before we called remap(). I learned that when this problem occurs, the handler is not pointing to anywhere in the method currently being processed (not good). In a second debug build I tried to ascertain who was setting these handlers to point to nowhere. This debug never triggered, no-one was setting them to point to nowhere... I happened to notice whilst going through the instructions in the debug output that cobertura was being used, a coverage toolkit that works by doing bytecode manipulation to insert calls out to a library. AspectJ was being called after cobertura and I asked the user to try the steps the other way round - it worked fine. Indicating cobertura was doing something to the bytecode that gave us problems. After much messing about, I recreated it by applying around advice to within(*) to all the classes in rt.jar (I just used that as a very large standalone jar file I could weave into). I learned that Cobertura creates catch blocks that look a little different to what javac and other compilers create. The typical bytecode sequence a compiler produces for a catch block starts with a STORE instruction, to store the exception being caught (whether the body of the catch block uses it or not). But the cobertura catch blocks started with an INVOKESTATIC instruction, a call out to another method. What does this mean? It means the same instruction has two shadows, a 'handler' shadow and a 'method-call' shadow - and it turns out this is what causes our problem. If around advice is applied to the call join point and it cannot be inlined then the body of the call shadow (the call itself) is pulled out into a new method. Because the handler was the same instruction, this meant the handler *was also being pulled out* into the new method, leaving behind an exception handler that jumped to an invalid location (in fact it 'jumped' to an instruction in a different method!). So the reason I never saw the handler location being set incorrectly is that it was set correctly up front, but then dragged out with the method-call shadow into the wrong place. In bytecode terms it looks like this: method-execution() | ICONST_0 | ISTORE_2 | SIPUSH -1 | ISTORE_3 | catch java.lang.Exception (1806389629) -> E0 | | method-call(ProjectData ProjectData.getGlobalProjectData()) | | | INVOKESTATIC ProjectData.getGlobalProjectData () | | method-call(ProjectData getGlobalProjectData()) | | LDC "SomeString" | | method-call(ClassData getOrCreateClassData(java.lang.String)) | | | INVOKEVIRTUAL ProjectData.getOrCreateClassData (LString;) | | method-call(ClassData ProjectData.getOrCreateClassData(String)) | | SIPUSH 106 | | method-call(void ClassData.touch(int)) | | | INVOKEVIRTUAL ClassData.touch (I)V | | method-call(void ClassData.touch(int)) | | ALOAD_1 | | method-call(Object Expression.getValue()) | | | INVOKEVIRTUAL Expression.getValue () | | method-call(Object Expression.getValue()) | catch java.lang.Exception (1806389629) -> E0 | ARETURN | method-call(nProjectData ProjectData.getGlobalProjectData()) | | E0: INVOKESTATIC ProjectData.getGlobalProjectData () | method-call(ProjectData ProjectData.getGlobalProjectData()) | LDC "Object" We can see the problem in that final method-call. The target for the exception handler seen earlier (E0) is within the method-call shadow. What to do?
resolved fixed
5f97d46
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2008-05-07T15:31:18Z
2008-05-07T03:13:20Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
ResolvedMember resolvedDooberry = world.resolve(realthing); annotations = resolvedDooberry.getAnnotationTypes(); } } else if (rm.getKind()==Member.METHOD && !rm.isAbstract()) { if (methodName.startsWith("ajc$inlineAccessMethod") || methodName.startsWith("ajc$superDispatch")) { ResolvedMember resolvedDooberry = world.resolve(declaredSig); annotations = resolvedDooberry.getAnnotationTypes(); } else { ResolvedMember realthing = AjcMemberMaker.interMethodDispatcher(rm.resolve(world),memberHostType).resolve(world); ResolvedMember theRealMember = findResolvedMemberNamed(memberHostType.resolve(world),realthing.getName()); if (theRealMember == null) { throw new UnsupportedOperationException("Known limitation in M4 - can't find ITD members when type variable is used as an argument and has upper bound specified"); } annotations = theRealMember.getAnnotationTypes(); } } else if (rm.getKind()==Member.CONSTRUCTOR) { ResolvedMember realThing = AjcMemberMaker.postIntroducedConstructor(memberHostType.resolve(world),rm.getDeclaringType(),rm.getParameterTypes()); ResolvedMember resolvedDooberry = world.resolve(realThing); if (resolvedDooberry == null) { throw new UnsupportedOperationException("Known limitation in M4 - can't find ITD members when type variable is used as an argument and has upper bound specified"); } annotations = resolvedDooberry.getAnnotationTypes(); } if (annotations == null) annotations = new ResolvedType[0]; mapToAnnotations.put(rm,annotations); }
230,817
Bug 230817 LazyMethodGen.remap() NullPointerException
This has been reported a few times by different users, but has always proved tough to diagnose. The typical stack trace is something like: java.lang.NullPointerException org.aspectj.weaver.bcel.LazyMethodGen.remap(LazyMethodGen.java:1237) org.aspectj.weaver.bcel.LazyMethodGen.addExceptionHandlers(LazyMethodGen.java:1132) org.aspectj.weaver.bcel.LazyMethodGen.packBody(LazyMethodGen.java:1078) org.aspectj.weaver.bcel.LazyMethodGen.pack(LazyMethodGen.java:977) org.aspectj.weaver.bcel.LazyMethodGen.getMethod(LazyMethodGen.java:484) org.aspectj.weaver.bcel.LazyClassGen.writeBack(LazyClassGen.java:512) org.aspectj.weaver.bcel.LazyClassGen.getJavaClassBytesIncludingReweavable(LazyClassGen.java:652) org.aspectj.weaver.bcel.BcelWeaver.getClassFilesFor(BcelWeaver.java:1420) org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1390) And that is an exception on this line in remap() ih = ih.getNext(); called from the addExceptionHandlers() line: gen.addExceptionHandler( remap(r.getRealStart(), map), remap(r.getRealEnd(), map), remap(r.getHandler(), map), (r.getCatchType() == null) ? null : (ObjectType) BcelWorld.makeBcelType(r.getCatchType())); During weaving, an instruction list is augmented with extra entries representing where shadows start and end (method-call, method-execution, handler, etc). When weaving is complete we want to remove these temporary elements and use the remaining instructions to produce the method bytecode. Now sometimes these temporary entries are targeted by other elements (line number tags, local variable tags and exception handlers usually). During packing we use remap() to reposition the locations so they move off of temporary placeholders and onto real instructions that will make it out into the bytecode. What the above exception tells us is that we started walking over temporary placeholder entries, but before we came to a real instruction, we ran out of instructions! This cannot happen, and indicates something went seriously wrong, we should always encounter an instruction when remapping off a temporary element. After some digging it is actually the remap() call for the handler (not the start or end) that leads to the problem. The handler represents where to jump to in the code when an exception of the specified type occurs between the instructions pointed at by start and end. I sent a debug build to a user encountering this problem (I could not recreate it) and in that I was looking at where in fact the handler was pointing before we called remap(). I learned that when this problem occurs, the handler is not pointing to anywhere in the method currently being processed (not good). In a second debug build I tried to ascertain who was setting these handlers to point to nowhere. This debug never triggered, no-one was setting them to point to nowhere... I happened to notice whilst going through the instructions in the debug output that cobertura was being used, a coverage toolkit that works by doing bytecode manipulation to insert calls out to a library. AspectJ was being called after cobertura and I asked the user to try the steps the other way round - it worked fine. Indicating cobertura was doing something to the bytecode that gave us problems. After much messing about, I recreated it by applying around advice to within(*) to all the classes in rt.jar (I just used that as a very large standalone jar file I could weave into). I learned that Cobertura creates catch blocks that look a little different to what javac and other compilers create. The typical bytecode sequence a compiler produces for a catch block starts with a STORE instruction, to store the exception being caught (whether the body of the catch block uses it or not). But the cobertura catch blocks started with an INVOKESTATIC instruction, a call out to another method. What does this mean? It means the same instruction has two shadows, a 'handler' shadow and a 'method-call' shadow - and it turns out this is what causes our problem. If around advice is applied to the call join point and it cannot be inlined then the body of the call shadow (the call itself) is pulled out into a new method. Because the handler was the same instruction, this meant the handler *was also being pulled out* into the new method, leaving behind an exception handler that jumped to an invalid location (in fact it 'jumped' to an instruction in a different method!). So the reason I never saw the handler location being set incorrectly is that it was set correctly up front, but then dragged out with the method-call shadow into the wrong place. In bytecode terms it looks like this: method-execution() | ICONST_0 | ISTORE_2 | SIPUSH -1 | ISTORE_3 | catch java.lang.Exception (1806389629) -> E0 | | method-call(ProjectData ProjectData.getGlobalProjectData()) | | | INVOKESTATIC ProjectData.getGlobalProjectData () | | method-call(ProjectData getGlobalProjectData()) | | LDC "SomeString" | | method-call(ClassData getOrCreateClassData(java.lang.String)) | | | INVOKEVIRTUAL ProjectData.getOrCreateClassData (LString;) | | method-call(ClassData ProjectData.getOrCreateClassData(String)) | | SIPUSH 106 | | method-call(void ClassData.touch(int)) | | | INVOKEVIRTUAL ClassData.touch (I)V | | method-call(void ClassData.touch(int)) | | ALOAD_1 | | method-call(Object Expression.getValue()) | | | INVOKEVIRTUAL Expression.getValue () | | method-call(Object Expression.getValue()) | catch java.lang.Exception (1806389629) -> E0 | ARETURN | method-call(nProjectData ProjectData.getGlobalProjectData()) | | E0: INVOKESTATIC ProjectData.getGlobalProjectData () | method-call(ProjectData ProjectData.getGlobalProjectData()) | LDC "Object" We can see the problem in that final method-call. The target for the exception handler seen earlier (E0) is within the method-call shadow. What to do?
resolved fixed
5f97d46
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2008-05-07T15:31:18Z
2008-05-07T03:13:20Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
rm.setAnnotationTypes(annotations); } catch (UnsupportedOperationException ex) { throw ex; } catch (Throwable t) { throw new BCException("Unexpectedly went bang when searching for annotations on "+rm,t); } } private void matchInvokeInstruction(LazyMethodGen mg, InstructionHandle ih, InvokeInstruction invoke, BcelShadow enclosingShadow, List shadowAccumulator) { String methodName = invoke.getName(cpg); if (methodName.startsWith(NameMangler.PREFIX)) { Member jpSig = world.makeJoinPointSignatureForMethodInvocation(clazz, invoke); ResolvedMember declaredSig = jpSig.resolve(world); if (declaredSig == null) return; if (declaredSig.getKind() == Member.FIELD) { Shadow.Kind kind; if (jpSig.getReturnType().equals(ResolvedType.VOID)) { kind = Shadow.FieldSet; } else { kind = Shadow.FieldGet; }
230,817
Bug 230817 LazyMethodGen.remap() NullPointerException
This has been reported a few times by different users, but has always proved tough to diagnose. The typical stack trace is something like: java.lang.NullPointerException org.aspectj.weaver.bcel.LazyMethodGen.remap(LazyMethodGen.java:1237) org.aspectj.weaver.bcel.LazyMethodGen.addExceptionHandlers(LazyMethodGen.java:1132) org.aspectj.weaver.bcel.LazyMethodGen.packBody(LazyMethodGen.java:1078) org.aspectj.weaver.bcel.LazyMethodGen.pack(LazyMethodGen.java:977) org.aspectj.weaver.bcel.LazyMethodGen.getMethod(LazyMethodGen.java:484) org.aspectj.weaver.bcel.LazyClassGen.writeBack(LazyClassGen.java:512) org.aspectj.weaver.bcel.LazyClassGen.getJavaClassBytesIncludingReweavable(LazyClassGen.java:652) org.aspectj.weaver.bcel.BcelWeaver.getClassFilesFor(BcelWeaver.java:1420) org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1390) And that is an exception on this line in remap() ih = ih.getNext(); called from the addExceptionHandlers() line: gen.addExceptionHandler( remap(r.getRealStart(), map), remap(r.getRealEnd(), map), remap(r.getHandler(), map), (r.getCatchType() == null) ? null : (ObjectType) BcelWorld.makeBcelType(r.getCatchType())); During weaving, an instruction list is augmented with extra entries representing where shadows start and end (method-call, method-execution, handler, etc). When weaving is complete we want to remove these temporary elements and use the remaining instructions to produce the method bytecode. Now sometimes these temporary entries are targeted by other elements (line number tags, local variable tags and exception handlers usually). During packing we use remap() to reposition the locations so they move off of temporary placeholders and onto real instructions that will make it out into the bytecode. What the above exception tells us is that we started walking over temporary placeholder entries, but before we came to a real instruction, we ran out of instructions! This cannot happen, and indicates something went seriously wrong, we should always encounter an instruction when remapping off a temporary element. After some digging it is actually the remap() call for the handler (not the start or end) that leads to the problem. The handler represents where to jump to in the code when an exception of the specified type occurs between the instructions pointed at by start and end. I sent a debug build to a user encountering this problem (I could not recreate it) and in that I was looking at where in fact the handler was pointing before we called remap(). I learned that when this problem occurs, the handler is not pointing to anywhere in the method currently being processed (not good). In a second debug build I tried to ascertain who was setting these handlers to point to nowhere. This debug never triggered, no-one was setting them to point to nowhere... I happened to notice whilst going through the instructions in the debug output that cobertura was being used, a coverage toolkit that works by doing bytecode manipulation to insert calls out to a library. AspectJ was being called after cobertura and I asked the user to try the steps the other way round - it worked fine. Indicating cobertura was doing something to the bytecode that gave us problems. After much messing about, I recreated it by applying around advice to within(*) to all the classes in rt.jar (I just used that as a very large standalone jar file I could weave into). I learned that Cobertura creates catch blocks that look a little different to what javac and other compilers create. The typical bytecode sequence a compiler produces for a catch block starts with a STORE instruction, to store the exception being caught (whether the body of the catch block uses it or not). But the cobertura catch blocks started with an INVOKESTATIC instruction, a call out to another method. What does this mean? It means the same instruction has two shadows, a 'handler' shadow and a 'method-call' shadow - and it turns out this is what causes our problem. If around advice is applied to the call join point and it cannot be inlined then the body of the call shadow (the call itself) is pulled out into a new method. Because the handler was the same instruction, this meant the handler *was also being pulled out* into the new method, leaving behind an exception handler that jumped to an invalid location (in fact it 'jumped' to an instruction in a different method!). So the reason I never saw the handler location being set incorrectly is that it was set correctly up front, but then dragged out with the method-call shadow into the wrong place. In bytecode terms it looks like this: method-execution() | ICONST_0 | ISTORE_2 | SIPUSH -1 | ISTORE_3 | catch java.lang.Exception (1806389629) -> E0 | | method-call(ProjectData ProjectData.getGlobalProjectData()) | | | INVOKESTATIC ProjectData.getGlobalProjectData () | | method-call(ProjectData getGlobalProjectData()) | | LDC "SomeString" | | method-call(ClassData getOrCreateClassData(java.lang.String)) | | | INVOKEVIRTUAL ProjectData.getOrCreateClassData (LString;) | | method-call(ClassData ProjectData.getOrCreateClassData(String)) | | SIPUSH 106 | | method-call(void ClassData.touch(int)) | | | INVOKEVIRTUAL ClassData.touch (I)V | | method-call(void ClassData.touch(int)) | | ALOAD_1 | | method-call(Object Expression.getValue()) | | | INVOKEVIRTUAL Expression.getValue () | | method-call(Object Expression.getValue()) | catch java.lang.Exception (1806389629) -> E0 | ARETURN | method-call(nProjectData ProjectData.getGlobalProjectData()) | | E0: INVOKESTATIC ProjectData.getGlobalProjectData () | method-call(ProjectData ProjectData.getGlobalProjectData()) | LDC "Object" We can see the problem in that final method-call. The target for the exception handler seen earlier (E0) is within the method-call shadow. What to do?
resolved fixed
5f97d46
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2008-05-07T15:31:18Z
2008-05-07T03:13:20Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
if (canMatch(Shadow.FieldGet) || canMatch(Shadow.FieldSet)) match(BcelShadow.makeShadowForMethodCall(world, mg, ih, enclosingShadow, kind, declaredSig), shadowAccumulator); } else { AjAttribute.EffectiveSignatureAttribute effectiveSig = declaredSig.getEffectiveSignature(); if (effectiveSig == null) return; if (effectiveSig.isWeaveBody()) return; ResolvedMember rm = effectiveSig.getEffectiveSignature(); fixAnnotationsForResolvedMember(rm,declaredSig); if (canMatch(effectiveSig.getShadowKind())) match(BcelShadow.makeShadowForMethodCall(world, mg, ih, enclosingShadow, effectiveSig.getShadowKind(), rm), shadowAccumulator); } } else { if (canMatch(Shadow.MethodCall)) match( BcelShadow.makeMethodCall(world, mg, ih, enclosingShadow), shadowAccumulator); } } private static boolean checkedXsetForLowLevelContextCapturing = false;
230,817
Bug 230817 LazyMethodGen.remap() NullPointerException
This has been reported a few times by different users, but has always proved tough to diagnose. The typical stack trace is something like: java.lang.NullPointerException org.aspectj.weaver.bcel.LazyMethodGen.remap(LazyMethodGen.java:1237) org.aspectj.weaver.bcel.LazyMethodGen.addExceptionHandlers(LazyMethodGen.java:1132) org.aspectj.weaver.bcel.LazyMethodGen.packBody(LazyMethodGen.java:1078) org.aspectj.weaver.bcel.LazyMethodGen.pack(LazyMethodGen.java:977) org.aspectj.weaver.bcel.LazyMethodGen.getMethod(LazyMethodGen.java:484) org.aspectj.weaver.bcel.LazyClassGen.writeBack(LazyClassGen.java:512) org.aspectj.weaver.bcel.LazyClassGen.getJavaClassBytesIncludingReweavable(LazyClassGen.java:652) org.aspectj.weaver.bcel.BcelWeaver.getClassFilesFor(BcelWeaver.java:1420) org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1390) And that is an exception on this line in remap() ih = ih.getNext(); called from the addExceptionHandlers() line: gen.addExceptionHandler( remap(r.getRealStart(), map), remap(r.getRealEnd(), map), remap(r.getHandler(), map), (r.getCatchType() == null) ? null : (ObjectType) BcelWorld.makeBcelType(r.getCatchType())); During weaving, an instruction list is augmented with extra entries representing where shadows start and end (method-call, method-execution, handler, etc). When weaving is complete we want to remove these temporary elements and use the remaining instructions to produce the method bytecode. Now sometimes these temporary entries are targeted by other elements (line number tags, local variable tags and exception handlers usually). During packing we use remap() to reposition the locations so they move off of temporary placeholders and onto real instructions that will make it out into the bytecode. What the above exception tells us is that we started walking over temporary placeholder entries, but before we came to a real instruction, we ran out of instructions! This cannot happen, and indicates something went seriously wrong, we should always encounter an instruction when remapping off a temporary element. After some digging it is actually the remap() call for the handler (not the start or end) that leads to the problem. The handler represents where to jump to in the code when an exception of the specified type occurs between the instructions pointed at by start and end. I sent a debug build to a user encountering this problem (I could not recreate it) and in that I was looking at where in fact the handler was pointing before we called remap(). I learned that when this problem occurs, the handler is not pointing to anywhere in the method currently being processed (not good). In a second debug build I tried to ascertain who was setting these handlers to point to nowhere. This debug never triggered, no-one was setting them to point to nowhere... I happened to notice whilst going through the instructions in the debug output that cobertura was being used, a coverage toolkit that works by doing bytecode manipulation to insert calls out to a library. AspectJ was being called after cobertura and I asked the user to try the steps the other way round - it worked fine. Indicating cobertura was doing something to the bytecode that gave us problems. After much messing about, I recreated it by applying around advice to within(*) to all the classes in rt.jar (I just used that as a very large standalone jar file I could weave into). I learned that Cobertura creates catch blocks that look a little different to what javac and other compilers create. The typical bytecode sequence a compiler produces for a catch block starts with a STORE instruction, to store the exception being caught (whether the body of the catch block uses it or not). But the cobertura catch blocks started with an INVOKESTATIC instruction, a call out to another method. What does this mean? It means the same instruction has two shadows, a 'handler' shadow and a 'method-call' shadow - and it turns out this is what causes our problem. If around advice is applied to the call join point and it cannot be inlined then the body of the call shadow (the call itself) is pulled out into a new method. Because the handler was the same instruction, this meant the handler *was also being pulled out* into the new method, leaving behind an exception handler that jumped to an invalid location (in fact it 'jumped' to an instruction in a different method!). So the reason I never saw the handler location being set incorrectly is that it was set correctly up front, but then dragged out with the method-call shadow into the wrong place. In bytecode terms it looks like this: method-execution() | ICONST_0 | ISTORE_2 | SIPUSH -1 | ISTORE_3 | catch java.lang.Exception (1806389629) -> E0 | | method-call(ProjectData ProjectData.getGlobalProjectData()) | | | INVOKESTATIC ProjectData.getGlobalProjectData () | | method-call(ProjectData getGlobalProjectData()) | | LDC "SomeString" | | method-call(ClassData getOrCreateClassData(java.lang.String)) | | | INVOKEVIRTUAL ProjectData.getOrCreateClassData (LString;) | | method-call(ClassData ProjectData.getOrCreateClassData(String)) | | SIPUSH 106 | | method-call(void ClassData.touch(int)) | | | INVOKEVIRTUAL ClassData.touch (I)V | | method-call(void ClassData.touch(int)) | | ALOAD_1 | | method-call(Object Expression.getValue()) | | | INVOKEVIRTUAL Expression.getValue () | | method-call(Object Expression.getValue()) | catch java.lang.Exception (1806389629) -> E0 | ARETURN | method-call(nProjectData ProjectData.getGlobalProjectData()) | | E0: INVOKESTATIC ProjectData.getGlobalProjectData () | method-call(ProjectData ProjectData.getGlobalProjectData()) | LDC "Object" We can see the problem in that final method-call. The target for the exception handler seen earlier (E0) is within the method-call shadow. What to do?
resolved fixed
5f97d46
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2008-05-07T15:31:18Z
2008-05-07T03:13:20Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
private static boolean captureLowLevelContext = false; private boolean match(BcelShadow shadow, List shadowAccumulator) { if (captureLowLevelContext) { ContextToken shadowMatchToken = CompilationAndWeavingContext.enteringPhase(CompilationAndWeavingContext.MATCHING_SHADOW, shadow); boolean isMatched = false; for (Iterator i = shadowMungers.iterator(); i.hasNext(); ) { ShadowMunger munger = (ShadowMunger)i.next(); ContextToken mungerMatchToken = CompilationAndWeavingContext.enteringPhase(CompilationAndWeavingContext.MATCHING_POINTCUT, munger.getPointcut()); if (munger.match(shadow, world)) { WeaverMetrics.recordMatchResult(true); shadow.addMunger(munger); isMatched = true; if (shadow.getKind() == Shadow.StaticInitialization) { clazz.warnOnAddedStaticInitializer(shadow,munger.getSourceLocation()); } } else { WeaverMetrics.recordMatchResult(false); } CompilationAndWeavingContext.leavingPhase(mungerMatchToken); } if (isMatched) shadowAccumulator.add(shadow); CompilationAndWeavingContext.leavingPhase(shadowMatchToken); return isMatched; } else { boolean isMatched = false; for (Iterator i = shadowMungers.iterator(); i.hasNext(); ) { ShadowMunger munger = (ShadowMunger)i.next();
230,817
Bug 230817 LazyMethodGen.remap() NullPointerException
This has been reported a few times by different users, but has always proved tough to diagnose. The typical stack trace is something like: java.lang.NullPointerException org.aspectj.weaver.bcel.LazyMethodGen.remap(LazyMethodGen.java:1237) org.aspectj.weaver.bcel.LazyMethodGen.addExceptionHandlers(LazyMethodGen.java:1132) org.aspectj.weaver.bcel.LazyMethodGen.packBody(LazyMethodGen.java:1078) org.aspectj.weaver.bcel.LazyMethodGen.pack(LazyMethodGen.java:977) org.aspectj.weaver.bcel.LazyMethodGen.getMethod(LazyMethodGen.java:484) org.aspectj.weaver.bcel.LazyClassGen.writeBack(LazyClassGen.java:512) org.aspectj.weaver.bcel.LazyClassGen.getJavaClassBytesIncludingReweavable(LazyClassGen.java:652) org.aspectj.weaver.bcel.BcelWeaver.getClassFilesFor(BcelWeaver.java:1420) org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1390) And that is an exception on this line in remap() ih = ih.getNext(); called from the addExceptionHandlers() line: gen.addExceptionHandler( remap(r.getRealStart(), map), remap(r.getRealEnd(), map), remap(r.getHandler(), map), (r.getCatchType() == null) ? null : (ObjectType) BcelWorld.makeBcelType(r.getCatchType())); During weaving, an instruction list is augmented with extra entries representing where shadows start and end (method-call, method-execution, handler, etc). When weaving is complete we want to remove these temporary elements and use the remaining instructions to produce the method bytecode. Now sometimes these temporary entries are targeted by other elements (line number tags, local variable tags and exception handlers usually). During packing we use remap() to reposition the locations so they move off of temporary placeholders and onto real instructions that will make it out into the bytecode. What the above exception tells us is that we started walking over temporary placeholder entries, but before we came to a real instruction, we ran out of instructions! This cannot happen, and indicates something went seriously wrong, we should always encounter an instruction when remapping off a temporary element. After some digging it is actually the remap() call for the handler (not the start or end) that leads to the problem. The handler represents where to jump to in the code when an exception of the specified type occurs between the instructions pointed at by start and end. I sent a debug build to a user encountering this problem (I could not recreate it) and in that I was looking at where in fact the handler was pointing before we called remap(). I learned that when this problem occurs, the handler is not pointing to anywhere in the method currently being processed (not good). In a second debug build I tried to ascertain who was setting these handlers to point to nowhere. This debug never triggered, no-one was setting them to point to nowhere... I happened to notice whilst going through the instructions in the debug output that cobertura was being used, a coverage toolkit that works by doing bytecode manipulation to insert calls out to a library. AspectJ was being called after cobertura and I asked the user to try the steps the other way round - it worked fine. Indicating cobertura was doing something to the bytecode that gave us problems. After much messing about, I recreated it by applying around advice to within(*) to all the classes in rt.jar (I just used that as a very large standalone jar file I could weave into). I learned that Cobertura creates catch blocks that look a little different to what javac and other compilers create. The typical bytecode sequence a compiler produces for a catch block starts with a STORE instruction, to store the exception being caught (whether the body of the catch block uses it or not). But the cobertura catch blocks started with an INVOKESTATIC instruction, a call out to another method. What does this mean? It means the same instruction has two shadows, a 'handler' shadow and a 'method-call' shadow - and it turns out this is what causes our problem. If around advice is applied to the call join point and it cannot be inlined then the body of the call shadow (the call itself) is pulled out into a new method. Because the handler was the same instruction, this meant the handler *was also being pulled out* into the new method, leaving behind an exception handler that jumped to an invalid location (in fact it 'jumped' to an instruction in a different method!). So the reason I never saw the handler location being set incorrectly is that it was set correctly up front, but then dragged out with the method-call shadow into the wrong place. In bytecode terms it looks like this: method-execution() | ICONST_0 | ISTORE_2 | SIPUSH -1 | ISTORE_3 | catch java.lang.Exception (1806389629) -> E0 | | method-call(ProjectData ProjectData.getGlobalProjectData()) | | | INVOKESTATIC ProjectData.getGlobalProjectData () | | method-call(ProjectData getGlobalProjectData()) | | LDC "SomeString" | | method-call(ClassData getOrCreateClassData(java.lang.String)) | | | INVOKEVIRTUAL ProjectData.getOrCreateClassData (LString;) | | method-call(ClassData ProjectData.getOrCreateClassData(String)) | | SIPUSH 106 | | method-call(void ClassData.touch(int)) | | | INVOKEVIRTUAL ClassData.touch (I)V | | method-call(void ClassData.touch(int)) | | ALOAD_1 | | method-call(Object Expression.getValue()) | | | INVOKEVIRTUAL Expression.getValue () | | method-call(Object Expression.getValue()) | catch java.lang.Exception (1806389629) -> E0 | ARETURN | method-call(nProjectData ProjectData.getGlobalProjectData()) | | E0: INVOKESTATIC ProjectData.getGlobalProjectData () | method-call(ProjectData ProjectData.getGlobalProjectData()) | LDC "Object" We can see the problem in that final method-call. The target for the exception handler seen earlier (E0) is within the method-call shadow. What to do?
resolved fixed
5f97d46
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2008-05-07T15:31:18Z
2008-05-07T03:13:20Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
if (munger.match(shadow, world)) { shadow.addMunger(munger); isMatched = true; if (shadow.getKind() == Shadow.StaticInitialization) { clazz.warnOnAddedStaticInitializer(shadow,munger.getSourceLocation()); } } } if (isMatched) shadowAccumulator.add(shadow); return isMatched; } } private void implement(LazyMethodGen mg) { List shadows = mg.matchedShadows; if (shadows == null) return; for (Iterator i = shadows.iterator(); i.hasNext(); ) { BcelShadow shadow = (BcelShadow)i.next(); ContextToken tok = CompilationAndWeavingContext.enteringPhase(CompilationAndWeavingContext.IMPLEMENTING_ON_SHADOW,shadow); shadow.implement(); CompilationAndWeavingContext.leavingPhase(tok); } int ii = mg.getMaxLocals();
230,817
Bug 230817 LazyMethodGen.remap() NullPointerException
This has been reported a few times by different users, but has always proved tough to diagnose. The typical stack trace is something like: java.lang.NullPointerException org.aspectj.weaver.bcel.LazyMethodGen.remap(LazyMethodGen.java:1237) org.aspectj.weaver.bcel.LazyMethodGen.addExceptionHandlers(LazyMethodGen.java:1132) org.aspectj.weaver.bcel.LazyMethodGen.packBody(LazyMethodGen.java:1078) org.aspectj.weaver.bcel.LazyMethodGen.pack(LazyMethodGen.java:977) org.aspectj.weaver.bcel.LazyMethodGen.getMethod(LazyMethodGen.java:484) org.aspectj.weaver.bcel.LazyClassGen.writeBack(LazyClassGen.java:512) org.aspectj.weaver.bcel.LazyClassGen.getJavaClassBytesIncludingReweavable(LazyClassGen.java:652) org.aspectj.weaver.bcel.BcelWeaver.getClassFilesFor(BcelWeaver.java:1420) org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1390) And that is an exception on this line in remap() ih = ih.getNext(); called from the addExceptionHandlers() line: gen.addExceptionHandler( remap(r.getRealStart(), map), remap(r.getRealEnd(), map), remap(r.getHandler(), map), (r.getCatchType() == null) ? null : (ObjectType) BcelWorld.makeBcelType(r.getCatchType())); During weaving, an instruction list is augmented with extra entries representing where shadows start and end (method-call, method-execution, handler, etc). When weaving is complete we want to remove these temporary elements and use the remaining instructions to produce the method bytecode. Now sometimes these temporary entries are targeted by other elements (line number tags, local variable tags and exception handlers usually). During packing we use remap() to reposition the locations so they move off of temporary placeholders and onto real instructions that will make it out into the bytecode. What the above exception tells us is that we started walking over temporary placeholder entries, but before we came to a real instruction, we ran out of instructions! This cannot happen, and indicates something went seriously wrong, we should always encounter an instruction when remapping off a temporary element. After some digging it is actually the remap() call for the handler (not the start or end) that leads to the problem. The handler represents where to jump to in the code when an exception of the specified type occurs between the instructions pointed at by start and end. I sent a debug build to a user encountering this problem (I could not recreate it) and in that I was looking at where in fact the handler was pointing before we called remap(). I learned that when this problem occurs, the handler is not pointing to anywhere in the method currently being processed (not good). In a second debug build I tried to ascertain who was setting these handlers to point to nowhere. This debug never triggered, no-one was setting them to point to nowhere... I happened to notice whilst going through the instructions in the debug output that cobertura was being used, a coverage toolkit that works by doing bytecode manipulation to insert calls out to a library. AspectJ was being called after cobertura and I asked the user to try the steps the other way round - it worked fine. Indicating cobertura was doing something to the bytecode that gave us problems. After much messing about, I recreated it by applying around advice to within(*) to all the classes in rt.jar (I just used that as a very large standalone jar file I could weave into). I learned that Cobertura creates catch blocks that look a little different to what javac and other compilers create. The typical bytecode sequence a compiler produces for a catch block starts with a STORE instruction, to store the exception being caught (whether the body of the catch block uses it or not). But the cobertura catch blocks started with an INVOKESTATIC instruction, a call out to another method. What does this mean? It means the same instruction has two shadows, a 'handler' shadow and a 'method-call' shadow - and it turns out this is what causes our problem. If around advice is applied to the call join point and it cannot be inlined then the body of the call shadow (the call itself) is pulled out into a new method. Because the handler was the same instruction, this meant the handler *was also being pulled out* into the new method, leaving behind an exception handler that jumped to an invalid location (in fact it 'jumped' to an instruction in a different method!). So the reason I never saw the handler location being set incorrectly is that it was set correctly up front, but then dragged out with the method-call shadow into the wrong place. In bytecode terms it looks like this: method-execution() | ICONST_0 | ISTORE_2 | SIPUSH -1 | ISTORE_3 | catch java.lang.Exception (1806389629) -> E0 | | method-call(ProjectData ProjectData.getGlobalProjectData()) | | | INVOKESTATIC ProjectData.getGlobalProjectData () | | method-call(ProjectData getGlobalProjectData()) | | LDC "SomeString" | | method-call(ClassData getOrCreateClassData(java.lang.String)) | | | INVOKEVIRTUAL ProjectData.getOrCreateClassData (LString;) | | method-call(ClassData ProjectData.getOrCreateClassData(String)) | | SIPUSH 106 | | method-call(void ClassData.touch(int)) | | | INVOKEVIRTUAL ClassData.touch (I)V | | method-call(void ClassData.touch(int)) | | ALOAD_1 | | method-call(Object Expression.getValue()) | | | INVOKEVIRTUAL Expression.getValue () | | method-call(Object Expression.getValue()) | catch java.lang.Exception (1806389629) -> E0 | ARETURN | method-call(nProjectData ProjectData.getGlobalProjectData()) | | E0: INVOKESTATIC ProjectData.getGlobalProjectData () | method-call(ProjectData ProjectData.getGlobalProjectData()) | LDC "Object" We can see the problem in that final method-call. The target for the exception handler seen earlier (E0) is within the method-call shadow. What to do?
resolved fixed
5f97d46
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2008-05-07T15:31:18Z
2008-05-07T03:13:20Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
mg.matchedShadows = null; } public LazyClassGen getLazyClassGen() { return clazz; } public List getShadowMungers() { return shadowMungers; } public BcelWorld getWorld() { return world; } public static void setReweavableMode(boolean mode) { inReweavableMode = mode; } public static boolean getReweavableMode() { return inReweavableMode; } public String toString() { return "BcelClassWeaver instance for : "+clazz; } }
230,817
Bug 230817 LazyMethodGen.remap() NullPointerException
This has been reported a few times by different users, but has always proved tough to diagnose. The typical stack trace is something like: java.lang.NullPointerException org.aspectj.weaver.bcel.LazyMethodGen.remap(LazyMethodGen.java:1237) org.aspectj.weaver.bcel.LazyMethodGen.addExceptionHandlers(LazyMethodGen.java:1132) org.aspectj.weaver.bcel.LazyMethodGen.packBody(LazyMethodGen.java:1078) org.aspectj.weaver.bcel.LazyMethodGen.pack(LazyMethodGen.java:977) org.aspectj.weaver.bcel.LazyMethodGen.getMethod(LazyMethodGen.java:484) org.aspectj.weaver.bcel.LazyClassGen.writeBack(LazyClassGen.java:512) org.aspectj.weaver.bcel.LazyClassGen.getJavaClassBytesIncludingReweavable(LazyClassGen.java:652) org.aspectj.weaver.bcel.BcelWeaver.getClassFilesFor(BcelWeaver.java:1420) org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1390) And that is an exception on this line in remap() ih = ih.getNext(); called from the addExceptionHandlers() line: gen.addExceptionHandler( remap(r.getRealStart(), map), remap(r.getRealEnd(), map), remap(r.getHandler(), map), (r.getCatchType() == null) ? null : (ObjectType) BcelWorld.makeBcelType(r.getCatchType())); During weaving, an instruction list is augmented with extra entries representing where shadows start and end (method-call, method-execution, handler, etc). When weaving is complete we want to remove these temporary elements and use the remaining instructions to produce the method bytecode. Now sometimes these temporary entries are targeted by other elements (line number tags, local variable tags and exception handlers usually). During packing we use remap() to reposition the locations so they move off of temporary placeholders and onto real instructions that will make it out into the bytecode. What the above exception tells us is that we started walking over temporary placeholder entries, but before we came to a real instruction, we ran out of instructions! This cannot happen, and indicates something went seriously wrong, we should always encounter an instruction when remapping off a temporary element. After some digging it is actually the remap() call for the handler (not the start or end) that leads to the problem. The handler represents where to jump to in the code when an exception of the specified type occurs between the instructions pointed at by start and end. I sent a debug build to a user encountering this problem (I could not recreate it) and in that I was looking at where in fact the handler was pointing before we called remap(). I learned that when this problem occurs, the handler is not pointing to anywhere in the method currently being processed (not good). In a second debug build I tried to ascertain who was setting these handlers to point to nowhere. This debug never triggered, no-one was setting them to point to nowhere... I happened to notice whilst going through the instructions in the debug output that cobertura was being used, a coverage toolkit that works by doing bytecode manipulation to insert calls out to a library. AspectJ was being called after cobertura and I asked the user to try the steps the other way round - it worked fine. Indicating cobertura was doing something to the bytecode that gave us problems. After much messing about, I recreated it by applying around advice to within(*) to all the classes in rt.jar (I just used that as a very large standalone jar file I could weave into). I learned that Cobertura creates catch blocks that look a little different to what javac and other compilers create. The typical bytecode sequence a compiler produces for a catch block starts with a STORE instruction, to store the exception being caught (whether the body of the catch block uses it or not). But the cobertura catch blocks started with an INVOKESTATIC instruction, a call out to another method. What does this mean? It means the same instruction has two shadows, a 'handler' shadow and a 'method-call' shadow - and it turns out this is what causes our problem. If around advice is applied to the call join point and it cannot be inlined then the body of the call shadow (the call itself) is pulled out into a new method. Because the handler was the same instruction, this meant the handler *was also being pulled out* into the new method, leaving behind an exception handler that jumped to an invalid location (in fact it 'jumped' to an instruction in a different method!). So the reason I never saw the handler location being set incorrectly is that it was set correctly up front, but then dragged out with the method-call shadow into the wrong place. In bytecode terms it looks like this: method-execution() | ICONST_0 | ISTORE_2 | SIPUSH -1 | ISTORE_3 | catch java.lang.Exception (1806389629) -> E0 | | method-call(ProjectData ProjectData.getGlobalProjectData()) | | | INVOKESTATIC ProjectData.getGlobalProjectData () | | method-call(ProjectData getGlobalProjectData()) | | LDC "SomeString" | | method-call(ClassData getOrCreateClassData(java.lang.String)) | | | INVOKEVIRTUAL ProjectData.getOrCreateClassData (LString;) | | method-call(ClassData ProjectData.getOrCreateClassData(String)) | | SIPUSH 106 | | method-call(void ClassData.touch(int)) | | | INVOKEVIRTUAL ClassData.touch (I)V | | method-call(void ClassData.touch(int)) | | ALOAD_1 | | method-call(Object Expression.getValue()) | | | INVOKEVIRTUAL Expression.getValue () | | method-call(Object Expression.getValue()) | catch java.lang.Exception (1806389629) -> E0 | ARETURN | method-call(nProjectData ProjectData.getGlobalProjectData()) | | E0: INVOKESTATIC ProjectData.getGlobalProjectData () | method-call(ProjectData ProjectData.getGlobalProjectData()) | LDC "Object" We can see the problem in that final method-call. The target for the exception handler seen earlier (E0) is within the method-call shadow. What to do?
resolved fixed
5f97d46
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2008-05-07T15:31:18Z
2008-05-07T03:13:20Z
weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java
/* ******************************************************************* * Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC). * All rights reserved. * This program and the accompanying materials are made available * under the terms of the Eclipse Public License v1.0 * which accompanies this distribution and is available at * http:www.eclipse.org/legal/epl-v10.html * * Contributors: * PARC initial implementation * ******************************************************************/ package org.aspectj.weaver.bcel; import java.io.ByteArrayOutputStream; import java.io.PrintStream; import java.lang.reflect.Modifier; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.LinkedList; import java.util.List; import java.util.ListIterator; import java.util.Map;
230,817
Bug 230817 LazyMethodGen.remap() NullPointerException
This has been reported a few times by different users, but has always proved tough to diagnose. The typical stack trace is something like: java.lang.NullPointerException org.aspectj.weaver.bcel.LazyMethodGen.remap(LazyMethodGen.java:1237) org.aspectj.weaver.bcel.LazyMethodGen.addExceptionHandlers(LazyMethodGen.java:1132) org.aspectj.weaver.bcel.LazyMethodGen.packBody(LazyMethodGen.java:1078) org.aspectj.weaver.bcel.LazyMethodGen.pack(LazyMethodGen.java:977) org.aspectj.weaver.bcel.LazyMethodGen.getMethod(LazyMethodGen.java:484) org.aspectj.weaver.bcel.LazyClassGen.writeBack(LazyClassGen.java:512) org.aspectj.weaver.bcel.LazyClassGen.getJavaClassBytesIncludingReweavable(LazyClassGen.java:652) org.aspectj.weaver.bcel.BcelWeaver.getClassFilesFor(BcelWeaver.java:1420) org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1390) And that is an exception on this line in remap() ih = ih.getNext(); called from the addExceptionHandlers() line: gen.addExceptionHandler( remap(r.getRealStart(), map), remap(r.getRealEnd(), map), remap(r.getHandler(), map), (r.getCatchType() == null) ? null : (ObjectType) BcelWorld.makeBcelType(r.getCatchType())); During weaving, an instruction list is augmented with extra entries representing where shadows start and end (method-call, method-execution, handler, etc). When weaving is complete we want to remove these temporary elements and use the remaining instructions to produce the method bytecode. Now sometimes these temporary entries are targeted by other elements (line number tags, local variable tags and exception handlers usually). During packing we use remap() to reposition the locations so they move off of temporary placeholders and onto real instructions that will make it out into the bytecode. What the above exception tells us is that we started walking over temporary placeholder entries, but before we came to a real instruction, we ran out of instructions! This cannot happen, and indicates something went seriously wrong, we should always encounter an instruction when remapping off a temporary element. After some digging it is actually the remap() call for the handler (not the start or end) that leads to the problem. The handler represents where to jump to in the code when an exception of the specified type occurs between the instructions pointed at by start and end. I sent a debug build to a user encountering this problem (I could not recreate it) and in that I was looking at where in fact the handler was pointing before we called remap(). I learned that when this problem occurs, the handler is not pointing to anywhere in the method currently being processed (not good). In a second debug build I tried to ascertain who was setting these handlers to point to nowhere. This debug never triggered, no-one was setting them to point to nowhere... I happened to notice whilst going through the instructions in the debug output that cobertura was being used, a coverage toolkit that works by doing bytecode manipulation to insert calls out to a library. AspectJ was being called after cobertura and I asked the user to try the steps the other way round - it worked fine. Indicating cobertura was doing something to the bytecode that gave us problems. After much messing about, I recreated it by applying around advice to within(*) to all the classes in rt.jar (I just used that as a very large standalone jar file I could weave into). I learned that Cobertura creates catch blocks that look a little different to what javac and other compilers create. The typical bytecode sequence a compiler produces for a catch block starts with a STORE instruction, to store the exception being caught (whether the body of the catch block uses it or not). But the cobertura catch blocks started with an INVOKESTATIC instruction, a call out to another method. What does this mean? It means the same instruction has two shadows, a 'handler' shadow and a 'method-call' shadow - and it turns out this is what causes our problem. If around advice is applied to the call join point and it cannot be inlined then the body of the call shadow (the call itself) is pulled out into a new method. Because the handler was the same instruction, this meant the handler *was also being pulled out* into the new method, leaving behind an exception handler that jumped to an invalid location (in fact it 'jumped' to an instruction in a different method!). So the reason I never saw the handler location being set incorrectly is that it was set correctly up front, but then dragged out with the method-call shadow into the wrong place. In bytecode terms it looks like this: method-execution() | ICONST_0 | ISTORE_2 | SIPUSH -1 | ISTORE_3 | catch java.lang.Exception (1806389629) -> E0 | | method-call(ProjectData ProjectData.getGlobalProjectData()) | | | INVOKESTATIC ProjectData.getGlobalProjectData () | | method-call(ProjectData getGlobalProjectData()) | | LDC "SomeString" | | method-call(ClassData getOrCreateClassData(java.lang.String)) | | | INVOKEVIRTUAL ProjectData.getOrCreateClassData (LString;) | | method-call(ClassData ProjectData.getOrCreateClassData(String)) | | SIPUSH 106 | | method-call(void ClassData.touch(int)) | | | INVOKEVIRTUAL ClassData.touch (I)V | | method-call(void ClassData.touch(int)) | | ALOAD_1 | | method-call(Object Expression.getValue()) | | | INVOKEVIRTUAL Expression.getValue () | | method-call(Object Expression.getValue()) | catch java.lang.Exception (1806389629) -> E0 | ARETURN | method-call(nProjectData ProjectData.getGlobalProjectData()) | | E0: INVOKESTATIC ProjectData.getGlobalProjectData () | method-call(ProjectData ProjectData.getGlobalProjectData()) | LDC "Object" We can see the problem in that final method-call. The target for the exception handler seen earlier (E0) is within the method-call shadow. What to do?
resolved fixed
5f97d46
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2008-05-07T15:31:18Z
2008-05-07T03:13:20Z
weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java
import java.util.Properties; import java.util.Set; import java.util.Stack; import org.aspectj.apache.bcel.Constants; import org.aspectj.apache.bcel.classfile.Attribute; import org.aspectj.apache.bcel.classfile.ConstantPool; import org.aspectj.apache.bcel.classfile.Method; import org.aspectj.apache.bcel.classfile.Synthetic; import org.aspectj.apache.bcel.classfile.annotation.Annotation; import org.aspectj.apache.bcel.generic.BranchHandle; import org.aspectj.apache.bcel.generic.BranchInstruction; import org.aspectj.apache.bcel.generic.CPInstruction; import org.aspectj.apache.bcel.generic.ClassGenException; import org.aspectj.apache.bcel.generic.CodeExceptionGen; import org.aspectj.apache.bcel.generic.ConstantPoolGen; import org.aspectj.apache.bcel.generic.Instruction; import org.aspectj.apache.bcel.generic.InstructionHandle; import org.aspectj.apache.bcel.generic.InstructionList; import org.aspectj.apache.bcel.generic.InstructionTargeter; import org.aspectj.apache.bcel.generic.LineNumberGen; import org.aspectj.apache.bcel.generic.LineNumberTag; import org.aspectj.apache.bcel.generic.LocalVariableGen; import org.aspectj.apache.bcel.generic.LocalVariableInstruction; import org.aspectj.apache.bcel.generic.LocalVariableTag; import org.aspectj.apache.bcel.generic.MethodGen; import org.aspectj.apache.bcel.generic.ObjectType; import org.aspectj.apache.bcel.generic.Select; import org.aspectj.apache.bcel.generic.Tag; import org.aspectj.apache.bcel.generic.Type; import org.aspectj.apache.bcel.generic.annotation.AnnotationGen;
230,817
Bug 230817 LazyMethodGen.remap() NullPointerException
This has been reported a few times by different users, but has always proved tough to diagnose. The typical stack trace is something like: java.lang.NullPointerException org.aspectj.weaver.bcel.LazyMethodGen.remap(LazyMethodGen.java:1237) org.aspectj.weaver.bcel.LazyMethodGen.addExceptionHandlers(LazyMethodGen.java:1132) org.aspectj.weaver.bcel.LazyMethodGen.packBody(LazyMethodGen.java:1078) org.aspectj.weaver.bcel.LazyMethodGen.pack(LazyMethodGen.java:977) org.aspectj.weaver.bcel.LazyMethodGen.getMethod(LazyMethodGen.java:484) org.aspectj.weaver.bcel.LazyClassGen.writeBack(LazyClassGen.java:512) org.aspectj.weaver.bcel.LazyClassGen.getJavaClassBytesIncludingReweavable(LazyClassGen.java:652) org.aspectj.weaver.bcel.BcelWeaver.getClassFilesFor(BcelWeaver.java:1420) org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1390) And that is an exception on this line in remap() ih = ih.getNext(); called from the addExceptionHandlers() line: gen.addExceptionHandler( remap(r.getRealStart(), map), remap(r.getRealEnd(), map), remap(r.getHandler(), map), (r.getCatchType() == null) ? null : (ObjectType) BcelWorld.makeBcelType(r.getCatchType())); During weaving, an instruction list is augmented with extra entries representing where shadows start and end (method-call, method-execution, handler, etc). When weaving is complete we want to remove these temporary elements and use the remaining instructions to produce the method bytecode. Now sometimes these temporary entries are targeted by other elements (line number tags, local variable tags and exception handlers usually). During packing we use remap() to reposition the locations so they move off of temporary placeholders and onto real instructions that will make it out into the bytecode. What the above exception tells us is that we started walking over temporary placeholder entries, but before we came to a real instruction, we ran out of instructions! This cannot happen, and indicates something went seriously wrong, we should always encounter an instruction when remapping off a temporary element. After some digging it is actually the remap() call for the handler (not the start or end) that leads to the problem. The handler represents where to jump to in the code when an exception of the specified type occurs between the instructions pointed at by start and end. I sent a debug build to a user encountering this problem (I could not recreate it) and in that I was looking at where in fact the handler was pointing before we called remap(). I learned that when this problem occurs, the handler is not pointing to anywhere in the method currently being processed (not good). In a second debug build I tried to ascertain who was setting these handlers to point to nowhere. This debug never triggered, no-one was setting them to point to nowhere... I happened to notice whilst going through the instructions in the debug output that cobertura was being used, a coverage toolkit that works by doing bytecode manipulation to insert calls out to a library. AspectJ was being called after cobertura and I asked the user to try the steps the other way round - it worked fine. Indicating cobertura was doing something to the bytecode that gave us problems. After much messing about, I recreated it by applying around advice to within(*) to all the classes in rt.jar (I just used that as a very large standalone jar file I could weave into). I learned that Cobertura creates catch blocks that look a little different to what javac and other compilers create. The typical bytecode sequence a compiler produces for a catch block starts with a STORE instruction, to store the exception being caught (whether the body of the catch block uses it or not). But the cobertura catch blocks started with an INVOKESTATIC instruction, a call out to another method. What does this mean? It means the same instruction has two shadows, a 'handler' shadow and a 'method-call' shadow - and it turns out this is what causes our problem. If around advice is applied to the call join point and it cannot be inlined then the body of the call shadow (the call itself) is pulled out into a new method. Because the handler was the same instruction, this meant the handler *was also being pulled out* into the new method, leaving behind an exception handler that jumped to an invalid location (in fact it 'jumped' to an instruction in a different method!). So the reason I never saw the handler location being set incorrectly is that it was set correctly up front, but then dragged out with the method-call shadow into the wrong place. In bytecode terms it looks like this: method-execution() | ICONST_0 | ISTORE_2 | SIPUSH -1 | ISTORE_3 | catch java.lang.Exception (1806389629) -> E0 | | method-call(ProjectData ProjectData.getGlobalProjectData()) | | | INVOKESTATIC ProjectData.getGlobalProjectData () | | method-call(ProjectData getGlobalProjectData()) | | LDC "SomeString" | | method-call(ClassData getOrCreateClassData(java.lang.String)) | | | INVOKEVIRTUAL ProjectData.getOrCreateClassData (LString;) | | method-call(ClassData ProjectData.getOrCreateClassData(String)) | | SIPUSH 106 | | method-call(void ClassData.touch(int)) | | | INVOKEVIRTUAL ClassData.touch (I)V | | method-call(void ClassData.touch(int)) | | ALOAD_1 | | method-call(Object Expression.getValue()) | | | INVOKEVIRTUAL Expression.getValue () | | method-call(Object Expression.getValue()) | catch java.lang.Exception (1806389629) -> E0 | ARETURN | method-call(nProjectData ProjectData.getGlobalProjectData()) | | E0: INVOKESTATIC ProjectData.getGlobalProjectData () | method-call(ProjectData ProjectData.getGlobalProjectData()) | LDC "Object" We can see the problem in that final method-call. The target for the exception handler seen earlier (E0) is within the method-call shadow. What to do?
resolved fixed
5f97d46
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2008-05-07T15:31:18Z
2008-05-07T03:13:20Z
weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java
import org.aspectj.bridge.IMessage; import org.aspectj.bridge.ISourceLocation; import org.aspectj.bridge.MessageUtil; import org.aspectj.weaver.AjAttribute; import org.aspectj.weaver.AnnotationX; import org.aspectj.weaver.BCException; import org.aspectj.weaver.ISourceContext; import org.aspectj.weaver.MemberImpl; import org.aspectj.weaver.NameMangler; import org.aspectj.weaver.ResolvedMember; import org.aspectj.weaver.ResolvedType; import org.aspectj.weaver.Shadow; import org.aspectj.weaver.UnresolvedType; import org.aspectj.weaver.WeaverMessages; import org.aspectj.weaver.AjAttribute.WeaverVersionInfo; import org.aspectj.weaver.tools.Traceable; /** * A LazyMethodGen should be treated as a MethodGen. It's our way of abstracting over the * low-level Method objects. It converts through {@link MethodGen} to create * and to serialize, but that's it. * * <p> At any rate, there are two ways to create LazyMethodGens. * One is from a method, which * does work through MethodGen to do the correct thing. * The other is the creation of a completely empty * LazyMethodGen, and it is used when we're constructing code from scratch. * * <p> We stay away from targeters for rangey things like Shadows and Exceptions. */ public final class LazyMethodGen implements Traceable {
230,817
Bug 230817 LazyMethodGen.remap() NullPointerException
This has been reported a few times by different users, but has always proved tough to diagnose. The typical stack trace is something like: java.lang.NullPointerException org.aspectj.weaver.bcel.LazyMethodGen.remap(LazyMethodGen.java:1237) org.aspectj.weaver.bcel.LazyMethodGen.addExceptionHandlers(LazyMethodGen.java:1132) org.aspectj.weaver.bcel.LazyMethodGen.packBody(LazyMethodGen.java:1078) org.aspectj.weaver.bcel.LazyMethodGen.pack(LazyMethodGen.java:977) org.aspectj.weaver.bcel.LazyMethodGen.getMethod(LazyMethodGen.java:484) org.aspectj.weaver.bcel.LazyClassGen.writeBack(LazyClassGen.java:512) org.aspectj.weaver.bcel.LazyClassGen.getJavaClassBytesIncludingReweavable(LazyClassGen.java:652) org.aspectj.weaver.bcel.BcelWeaver.getClassFilesFor(BcelWeaver.java:1420) org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1390) And that is an exception on this line in remap() ih = ih.getNext(); called from the addExceptionHandlers() line: gen.addExceptionHandler( remap(r.getRealStart(), map), remap(r.getRealEnd(), map), remap(r.getHandler(), map), (r.getCatchType() == null) ? null : (ObjectType) BcelWorld.makeBcelType(r.getCatchType())); During weaving, an instruction list is augmented with extra entries representing where shadows start and end (method-call, method-execution, handler, etc). When weaving is complete we want to remove these temporary elements and use the remaining instructions to produce the method bytecode. Now sometimes these temporary entries are targeted by other elements (line number tags, local variable tags and exception handlers usually). During packing we use remap() to reposition the locations so they move off of temporary placeholders and onto real instructions that will make it out into the bytecode. What the above exception tells us is that we started walking over temporary placeholder entries, but before we came to a real instruction, we ran out of instructions! This cannot happen, and indicates something went seriously wrong, we should always encounter an instruction when remapping off a temporary element. After some digging it is actually the remap() call for the handler (not the start or end) that leads to the problem. The handler represents where to jump to in the code when an exception of the specified type occurs between the instructions pointed at by start and end. I sent a debug build to a user encountering this problem (I could not recreate it) and in that I was looking at where in fact the handler was pointing before we called remap(). I learned that when this problem occurs, the handler is not pointing to anywhere in the method currently being processed (not good). In a second debug build I tried to ascertain who was setting these handlers to point to nowhere. This debug never triggered, no-one was setting them to point to nowhere... I happened to notice whilst going through the instructions in the debug output that cobertura was being used, a coverage toolkit that works by doing bytecode manipulation to insert calls out to a library. AspectJ was being called after cobertura and I asked the user to try the steps the other way round - it worked fine. Indicating cobertura was doing something to the bytecode that gave us problems. After much messing about, I recreated it by applying around advice to within(*) to all the classes in rt.jar (I just used that as a very large standalone jar file I could weave into). I learned that Cobertura creates catch blocks that look a little different to what javac and other compilers create. The typical bytecode sequence a compiler produces for a catch block starts with a STORE instruction, to store the exception being caught (whether the body of the catch block uses it or not). But the cobertura catch blocks started with an INVOKESTATIC instruction, a call out to another method. What does this mean? It means the same instruction has two shadows, a 'handler' shadow and a 'method-call' shadow - and it turns out this is what causes our problem. If around advice is applied to the call join point and it cannot be inlined then the body of the call shadow (the call itself) is pulled out into a new method. Because the handler was the same instruction, this meant the handler *was also being pulled out* into the new method, leaving behind an exception handler that jumped to an invalid location (in fact it 'jumped' to an instruction in a different method!). So the reason I never saw the handler location being set incorrectly is that it was set correctly up front, but then dragged out with the method-call shadow into the wrong place. In bytecode terms it looks like this: method-execution() | ICONST_0 | ISTORE_2 | SIPUSH -1 | ISTORE_3 | catch java.lang.Exception (1806389629) -> E0 | | method-call(ProjectData ProjectData.getGlobalProjectData()) | | | INVOKESTATIC ProjectData.getGlobalProjectData () | | method-call(ProjectData getGlobalProjectData()) | | LDC "SomeString" | | method-call(ClassData getOrCreateClassData(java.lang.String)) | | | INVOKEVIRTUAL ProjectData.getOrCreateClassData (LString;) | | method-call(ClassData ProjectData.getOrCreateClassData(String)) | | SIPUSH 106 | | method-call(void ClassData.touch(int)) | | | INVOKEVIRTUAL ClassData.touch (I)V | | method-call(void ClassData.touch(int)) | | ALOAD_1 | | method-call(Object Expression.getValue()) | | | INVOKEVIRTUAL Expression.getValue () | | method-call(Object Expression.getValue()) | catch java.lang.Exception (1806389629) -> E0 | ARETURN | method-call(nProjectData ProjectData.getGlobalProjectData()) | | E0: INVOKESTATIC ProjectData.getGlobalProjectData () | method-call(ProjectData ProjectData.getGlobalProjectData()) | LDC "Object" We can see the problem in that final method-call. The target for the exception handler seen earlier (E0) is within the method-call shadow. What to do?
resolved fixed
5f97d46
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2008-05-07T15:31:18Z
2008-05-07T03:13:20Z
weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java
private static final int ACC_SYNTHETIC = 0x1000; private int accessFlags; private Type returnType; private final String name; private Type[] argumentTypes; private String[] declaredExceptions; private InstructionList body; private Attribute[] attributes; private List newAnnotations; private final LazyClassGen enclosingClass; private BcelMethod memberView; private AjAttribute.EffectiveSignatureAttribute effectiveSignature; int highestLineNumber = 0; /* * This option specifies whether we let the BCEL classes create LineNumberGens and LocalVariableGens * or if we make it create LineNumberTags and LocalVariableTags. Up until 1.5.1 we always created * Gens - then on return from the MethodGen ctor we took them apart, reprocessed them all and * created Tags. (see unpackLocals/unpackLineNumbers). As we have our own copy of Bcel, why not create * the right thing straightaway? So setting this to true will call the MethodGen ctor() in such * a way that it creates Tags - removing the need for unpackLocals/unpackLineNumbers - HOWEVER see * the ensureAllLineNumberSetup() method for some other relevant info. *
230,817
Bug 230817 LazyMethodGen.remap() NullPointerException
This has been reported a few times by different users, but has always proved tough to diagnose. The typical stack trace is something like: java.lang.NullPointerException org.aspectj.weaver.bcel.LazyMethodGen.remap(LazyMethodGen.java:1237) org.aspectj.weaver.bcel.LazyMethodGen.addExceptionHandlers(LazyMethodGen.java:1132) org.aspectj.weaver.bcel.LazyMethodGen.packBody(LazyMethodGen.java:1078) org.aspectj.weaver.bcel.LazyMethodGen.pack(LazyMethodGen.java:977) org.aspectj.weaver.bcel.LazyMethodGen.getMethod(LazyMethodGen.java:484) org.aspectj.weaver.bcel.LazyClassGen.writeBack(LazyClassGen.java:512) org.aspectj.weaver.bcel.LazyClassGen.getJavaClassBytesIncludingReweavable(LazyClassGen.java:652) org.aspectj.weaver.bcel.BcelWeaver.getClassFilesFor(BcelWeaver.java:1420) org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1390) And that is an exception on this line in remap() ih = ih.getNext(); called from the addExceptionHandlers() line: gen.addExceptionHandler( remap(r.getRealStart(), map), remap(r.getRealEnd(), map), remap(r.getHandler(), map), (r.getCatchType() == null) ? null : (ObjectType) BcelWorld.makeBcelType(r.getCatchType())); During weaving, an instruction list is augmented with extra entries representing where shadows start and end (method-call, method-execution, handler, etc). When weaving is complete we want to remove these temporary elements and use the remaining instructions to produce the method bytecode. Now sometimes these temporary entries are targeted by other elements (line number tags, local variable tags and exception handlers usually). During packing we use remap() to reposition the locations so they move off of temporary placeholders and onto real instructions that will make it out into the bytecode. What the above exception tells us is that we started walking over temporary placeholder entries, but before we came to a real instruction, we ran out of instructions! This cannot happen, and indicates something went seriously wrong, we should always encounter an instruction when remapping off a temporary element. After some digging it is actually the remap() call for the handler (not the start or end) that leads to the problem. The handler represents where to jump to in the code when an exception of the specified type occurs between the instructions pointed at by start and end. I sent a debug build to a user encountering this problem (I could not recreate it) and in that I was looking at where in fact the handler was pointing before we called remap(). I learned that when this problem occurs, the handler is not pointing to anywhere in the method currently being processed (not good). In a second debug build I tried to ascertain who was setting these handlers to point to nowhere. This debug never triggered, no-one was setting them to point to nowhere... I happened to notice whilst going through the instructions in the debug output that cobertura was being used, a coverage toolkit that works by doing bytecode manipulation to insert calls out to a library. AspectJ was being called after cobertura and I asked the user to try the steps the other way round - it worked fine. Indicating cobertura was doing something to the bytecode that gave us problems. After much messing about, I recreated it by applying around advice to within(*) to all the classes in rt.jar (I just used that as a very large standalone jar file I could weave into). I learned that Cobertura creates catch blocks that look a little different to what javac and other compilers create. The typical bytecode sequence a compiler produces for a catch block starts with a STORE instruction, to store the exception being caught (whether the body of the catch block uses it or not). But the cobertura catch blocks started with an INVOKESTATIC instruction, a call out to another method. What does this mean? It means the same instruction has two shadows, a 'handler' shadow and a 'method-call' shadow - and it turns out this is what causes our problem. If around advice is applied to the call join point and it cannot be inlined then the body of the call shadow (the call itself) is pulled out into a new method. Because the handler was the same instruction, this meant the handler *was also being pulled out* into the new method, leaving behind an exception handler that jumped to an invalid location (in fact it 'jumped' to an instruction in a different method!). So the reason I never saw the handler location being set incorrectly is that it was set correctly up front, but then dragged out with the method-call shadow into the wrong place. In bytecode terms it looks like this: method-execution() | ICONST_0 | ISTORE_2 | SIPUSH -1 | ISTORE_3 | catch java.lang.Exception (1806389629) -> E0 | | method-call(ProjectData ProjectData.getGlobalProjectData()) | | | INVOKESTATIC ProjectData.getGlobalProjectData () | | method-call(ProjectData getGlobalProjectData()) | | LDC "SomeString" | | method-call(ClassData getOrCreateClassData(java.lang.String)) | | | INVOKEVIRTUAL ProjectData.getOrCreateClassData (LString;) | | method-call(ClassData ProjectData.getOrCreateClassData(String)) | | SIPUSH 106 | | method-call(void ClassData.touch(int)) | | | INVOKEVIRTUAL ClassData.touch (I)V | | method-call(void ClassData.touch(int)) | | ALOAD_1 | | method-call(Object Expression.getValue()) | | | INVOKEVIRTUAL Expression.getValue () | | method-call(Object Expression.getValue()) | catch java.lang.Exception (1806389629) -> E0 | ARETURN | method-call(nProjectData ProjectData.getGlobalProjectData()) | | E0: INVOKESTATIC ProjectData.getGlobalProjectData () | method-call(ProjectData ProjectData.getGlobalProjectData()) | LDC "Object" We can see the problem in that final method-call. The target for the exception handler seen earlier (E0) is within the method-call shadow. What to do?
resolved fixed
5f97d46
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2008-05-07T15:31:18Z
2008-05-07T03:13:20Z
weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java
* Whats the difference between a Tag and a Gen? A Tag is more lightweight, it doesn't know which * instructions it targets, it relies on the instructions targetting *it* - this reduces the amount * of targeter manipulation we have to do. * * Because this *could* go wrong - it passes all our tests, but you never know, the option: * -Xset:optimizeWithTags=false * will turn it *OFF* */ public static boolean avoidUseOfBcelGenObjects = true; public static boolean checkedXsetOption = false; /** This is nonnull if this method is the result of an "inlining". We currently * copy methods into other classes for around advice. We add this field so * we can get JSR45 information correct. If/when we do _actual_ inlining, * we'll need to subtype LineNumberTag to have external line numbers. */ String fromFilename = null; private int maxLocals; private boolean canInline = true; private boolean isSynthetic = false; /** * only used by {@link BcelClassWeaver} */ List matchedShadows; List matchedShadowTests;
230,817
Bug 230817 LazyMethodGen.remap() NullPointerException
This has been reported a few times by different users, but has always proved tough to diagnose. The typical stack trace is something like: java.lang.NullPointerException org.aspectj.weaver.bcel.LazyMethodGen.remap(LazyMethodGen.java:1237) org.aspectj.weaver.bcel.LazyMethodGen.addExceptionHandlers(LazyMethodGen.java:1132) org.aspectj.weaver.bcel.LazyMethodGen.packBody(LazyMethodGen.java:1078) org.aspectj.weaver.bcel.LazyMethodGen.pack(LazyMethodGen.java:977) org.aspectj.weaver.bcel.LazyMethodGen.getMethod(LazyMethodGen.java:484) org.aspectj.weaver.bcel.LazyClassGen.writeBack(LazyClassGen.java:512) org.aspectj.weaver.bcel.LazyClassGen.getJavaClassBytesIncludingReweavable(LazyClassGen.java:652) org.aspectj.weaver.bcel.BcelWeaver.getClassFilesFor(BcelWeaver.java:1420) org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1390) And that is an exception on this line in remap() ih = ih.getNext(); called from the addExceptionHandlers() line: gen.addExceptionHandler( remap(r.getRealStart(), map), remap(r.getRealEnd(), map), remap(r.getHandler(), map), (r.getCatchType() == null) ? null : (ObjectType) BcelWorld.makeBcelType(r.getCatchType())); During weaving, an instruction list is augmented with extra entries representing where shadows start and end (method-call, method-execution, handler, etc). When weaving is complete we want to remove these temporary elements and use the remaining instructions to produce the method bytecode. Now sometimes these temporary entries are targeted by other elements (line number tags, local variable tags and exception handlers usually). During packing we use remap() to reposition the locations so they move off of temporary placeholders and onto real instructions that will make it out into the bytecode. What the above exception tells us is that we started walking over temporary placeholder entries, but before we came to a real instruction, we ran out of instructions! This cannot happen, and indicates something went seriously wrong, we should always encounter an instruction when remapping off a temporary element. After some digging it is actually the remap() call for the handler (not the start or end) that leads to the problem. The handler represents where to jump to in the code when an exception of the specified type occurs between the instructions pointed at by start and end. I sent a debug build to a user encountering this problem (I could not recreate it) and in that I was looking at where in fact the handler was pointing before we called remap(). I learned that when this problem occurs, the handler is not pointing to anywhere in the method currently being processed (not good). In a second debug build I tried to ascertain who was setting these handlers to point to nowhere. This debug never triggered, no-one was setting them to point to nowhere... I happened to notice whilst going through the instructions in the debug output that cobertura was being used, a coverage toolkit that works by doing bytecode manipulation to insert calls out to a library. AspectJ was being called after cobertura and I asked the user to try the steps the other way round - it worked fine. Indicating cobertura was doing something to the bytecode that gave us problems. After much messing about, I recreated it by applying around advice to within(*) to all the classes in rt.jar (I just used that as a very large standalone jar file I could weave into). I learned that Cobertura creates catch blocks that look a little different to what javac and other compilers create. The typical bytecode sequence a compiler produces for a catch block starts with a STORE instruction, to store the exception being caught (whether the body of the catch block uses it or not). But the cobertura catch blocks started with an INVOKESTATIC instruction, a call out to another method. What does this mean? It means the same instruction has two shadows, a 'handler' shadow and a 'method-call' shadow - and it turns out this is what causes our problem. If around advice is applied to the call join point and it cannot be inlined then the body of the call shadow (the call itself) is pulled out into a new method. Because the handler was the same instruction, this meant the handler *was also being pulled out* into the new method, leaving behind an exception handler that jumped to an invalid location (in fact it 'jumped' to an instruction in a different method!). So the reason I never saw the handler location being set incorrectly is that it was set correctly up front, but then dragged out with the method-call shadow into the wrong place. In bytecode terms it looks like this: method-execution() | ICONST_0 | ISTORE_2 | SIPUSH -1 | ISTORE_3 | catch java.lang.Exception (1806389629) -> E0 | | method-call(ProjectData ProjectData.getGlobalProjectData()) | | | INVOKESTATIC ProjectData.getGlobalProjectData () | | method-call(ProjectData getGlobalProjectData()) | | LDC "SomeString" | | method-call(ClassData getOrCreateClassData(java.lang.String)) | | | INVOKEVIRTUAL ProjectData.getOrCreateClassData (LString;) | | method-call(ClassData ProjectData.getOrCreateClassData(String)) | | SIPUSH 106 | | method-call(void ClassData.touch(int)) | | | INVOKEVIRTUAL ClassData.touch (I)V | | method-call(void ClassData.touch(int)) | | ALOAD_1 | | method-call(Object Expression.getValue()) | | | INVOKEVIRTUAL Expression.getValue () | | method-call(Object Expression.getValue()) | catch java.lang.Exception (1806389629) -> E0 | ARETURN | method-call(nProjectData ProjectData.getGlobalProjectData()) | | E0: INVOKESTATIC ProjectData.getGlobalProjectData () | method-call(ProjectData ProjectData.getGlobalProjectData()) | LDC "Object" We can see the problem in that final method-call. The target for the exception handler seen earlier (E0) is within the method-call shadow. What to do?
resolved fixed
5f97d46
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2008-05-07T15:31:18Z
2008-05-07T03:13:20Z
weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java
public ResolvedType definingType = null; public LazyMethodGen( int accessFlags, Type returnType, String name, Type[] paramTypes, String[] declaredExceptions, LazyClassGen enclosingClass) { this.memberView = null; this.accessFlags = accessFlags; this.returnType = returnType; this.name = name; this.argumentTypes = paramTypes; this.declaredExceptions = declaredExceptions; if (!Modifier.isAbstract(accessFlags)) { body = new InstructionList(); setMaxLocals(calculateMaxLocals()); } else { body = null; } this.attributes = new Attribute[0]; this.enclosingClass = enclosingClass; assertGoodBody();
230,817
Bug 230817 LazyMethodGen.remap() NullPointerException
This has been reported a few times by different users, but has always proved tough to diagnose. The typical stack trace is something like: java.lang.NullPointerException org.aspectj.weaver.bcel.LazyMethodGen.remap(LazyMethodGen.java:1237) org.aspectj.weaver.bcel.LazyMethodGen.addExceptionHandlers(LazyMethodGen.java:1132) org.aspectj.weaver.bcel.LazyMethodGen.packBody(LazyMethodGen.java:1078) org.aspectj.weaver.bcel.LazyMethodGen.pack(LazyMethodGen.java:977) org.aspectj.weaver.bcel.LazyMethodGen.getMethod(LazyMethodGen.java:484) org.aspectj.weaver.bcel.LazyClassGen.writeBack(LazyClassGen.java:512) org.aspectj.weaver.bcel.LazyClassGen.getJavaClassBytesIncludingReweavable(LazyClassGen.java:652) org.aspectj.weaver.bcel.BcelWeaver.getClassFilesFor(BcelWeaver.java:1420) org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1390) And that is an exception on this line in remap() ih = ih.getNext(); called from the addExceptionHandlers() line: gen.addExceptionHandler( remap(r.getRealStart(), map), remap(r.getRealEnd(), map), remap(r.getHandler(), map), (r.getCatchType() == null) ? null : (ObjectType) BcelWorld.makeBcelType(r.getCatchType())); During weaving, an instruction list is augmented with extra entries representing where shadows start and end (method-call, method-execution, handler, etc). When weaving is complete we want to remove these temporary elements and use the remaining instructions to produce the method bytecode. Now sometimes these temporary entries are targeted by other elements (line number tags, local variable tags and exception handlers usually). During packing we use remap() to reposition the locations so they move off of temporary placeholders and onto real instructions that will make it out into the bytecode. What the above exception tells us is that we started walking over temporary placeholder entries, but before we came to a real instruction, we ran out of instructions! This cannot happen, and indicates something went seriously wrong, we should always encounter an instruction when remapping off a temporary element. After some digging it is actually the remap() call for the handler (not the start or end) that leads to the problem. The handler represents where to jump to in the code when an exception of the specified type occurs between the instructions pointed at by start and end. I sent a debug build to a user encountering this problem (I could not recreate it) and in that I was looking at where in fact the handler was pointing before we called remap(). I learned that when this problem occurs, the handler is not pointing to anywhere in the method currently being processed (not good). In a second debug build I tried to ascertain who was setting these handlers to point to nowhere. This debug never triggered, no-one was setting them to point to nowhere... I happened to notice whilst going through the instructions in the debug output that cobertura was being used, a coverage toolkit that works by doing bytecode manipulation to insert calls out to a library. AspectJ was being called after cobertura and I asked the user to try the steps the other way round - it worked fine. Indicating cobertura was doing something to the bytecode that gave us problems. After much messing about, I recreated it by applying around advice to within(*) to all the classes in rt.jar (I just used that as a very large standalone jar file I could weave into). I learned that Cobertura creates catch blocks that look a little different to what javac and other compilers create. The typical bytecode sequence a compiler produces for a catch block starts with a STORE instruction, to store the exception being caught (whether the body of the catch block uses it or not). But the cobertura catch blocks started with an INVOKESTATIC instruction, a call out to another method. What does this mean? It means the same instruction has two shadows, a 'handler' shadow and a 'method-call' shadow - and it turns out this is what causes our problem. If around advice is applied to the call join point and it cannot be inlined then the body of the call shadow (the call itself) is pulled out into a new method. Because the handler was the same instruction, this meant the handler *was also being pulled out* into the new method, leaving behind an exception handler that jumped to an invalid location (in fact it 'jumped' to an instruction in a different method!). So the reason I never saw the handler location being set incorrectly is that it was set correctly up front, but then dragged out with the method-call shadow into the wrong place. In bytecode terms it looks like this: method-execution() | ICONST_0 | ISTORE_2 | SIPUSH -1 | ISTORE_3 | catch java.lang.Exception (1806389629) -> E0 | | method-call(ProjectData ProjectData.getGlobalProjectData()) | | | INVOKESTATIC ProjectData.getGlobalProjectData () | | method-call(ProjectData getGlobalProjectData()) | | LDC "SomeString" | | method-call(ClassData getOrCreateClassData(java.lang.String)) | | | INVOKEVIRTUAL ProjectData.getOrCreateClassData (LString;) | | method-call(ClassData ProjectData.getOrCreateClassData(String)) | | SIPUSH 106 | | method-call(void ClassData.touch(int)) | | | INVOKEVIRTUAL ClassData.touch (I)V | | method-call(void ClassData.touch(int)) | | ALOAD_1 | | method-call(Object Expression.getValue()) | | | INVOKEVIRTUAL Expression.getValue () | | method-call(Object Expression.getValue()) | catch java.lang.Exception (1806389629) -> E0 | ARETURN | method-call(nProjectData ProjectData.getGlobalProjectData()) | | E0: INVOKESTATIC ProjectData.getGlobalProjectData () | method-call(ProjectData ProjectData.getGlobalProjectData()) | LDC "Object" We can see the problem in that final method-call. The target for the exception handler seen earlier (E0) is within the method-call shadow. What to do?
resolved fixed
5f97d46
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2008-05-07T15:31:18Z
2008-05-07T03:13:20Z
weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java
if (memberView != null && isAdviceMethod()) { if (enclosingClass.getType().isAnnotationStyleAspect()) { this.canInline = false; } } } private int calculateMaxLocals() { int ret = 0; if (!Modifier.isStatic(accessFlags)) ret++; for (int i = 0, len = argumentTypes.length; i < len; i++) { ret += argumentTypes[i].getSize(); } return ret; } private Method savedMethod = null; public LazyMethodGen(Method m, LazyClassGen enclosingClass) { savedMethod = m; this.enclosingClass = enclosingClass; if (!(m.isAbstract() || m.isNative()) && m.getCode() == null) { throw new RuntimeException("bad non-abstract method with no code: " + m + " on " + enclosingClass); } if ((m.isAbstract() || m.isNative()) && m.getCode() != null) { throw new RuntimeException("bad abstract method with code: " + m + " on " + enclosingClass);
230,817
Bug 230817 LazyMethodGen.remap() NullPointerException
This has been reported a few times by different users, but has always proved tough to diagnose. The typical stack trace is something like: java.lang.NullPointerException org.aspectj.weaver.bcel.LazyMethodGen.remap(LazyMethodGen.java:1237) org.aspectj.weaver.bcel.LazyMethodGen.addExceptionHandlers(LazyMethodGen.java:1132) org.aspectj.weaver.bcel.LazyMethodGen.packBody(LazyMethodGen.java:1078) org.aspectj.weaver.bcel.LazyMethodGen.pack(LazyMethodGen.java:977) org.aspectj.weaver.bcel.LazyMethodGen.getMethod(LazyMethodGen.java:484) org.aspectj.weaver.bcel.LazyClassGen.writeBack(LazyClassGen.java:512) org.aspectj.weaver.bcel.LazyClassGen.getJavaClassBytesIncludingReweavable(LazyClassGen.java:652) org.aspectj.weaver.bcel.BcelWeaver.getClassFilesFor(BcelWeaver.java:1420) org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1390) And that is an exception on this line in remap() ih = ih.getNext(); called from the addExceptionHandlers() line: gen.addExceptionHandler( remap(r.getRealStart(), map), remap(r.getRealEnd(), map), remap(r.getHandler(), map), (r.getCatchType() == null) ? null : (ObjectType) BcelWorld.makeBcelType(r.getCatchType())); During weaving, an instruction list is augmented with extra entries representing where shadows start and end (method-call, method-execution, handler, etc). When weaving is complete we want to remove these temporary elements and use the remaining instructions to produce the method bytecode. Now sometimes these temporary entries are targeted by other elements (line number tags, local variable tags and exception handlers usually). During packing we use remap() to reposition the locations so they move off of temporary placeholders and onto real instructions that will make it out into the bytecode. What the above exception tells us is that we started walking over temporary placeholder entries, but before we came to a real instruction, we ran out of instructions! This cannot happen, and indicates something went seriously wrong, we should always encounter an instruction when remapping off a temporary element. After some digging it is actually the remap() call for the handler (not the start or end) that leads to the problem. The handler represents where to jump to in the code when an exception of the specified type occurs between the instructions pointed at by start and end. I sent a debug build to a user encountering this problem (I could not recreate it) and in that I was looking at where in fact the handler was pointing before we called remap(). I learned that when this problem occurs, the handler is not pointing to anywhere in the method currently being processed (not good). In a second debug build I tried to ascertain who was setting these handlers to point to nowhere. This debug never triggered, no-one was setting them to point to nowhere... I happened to notice whilst going through the instructions in the debug output that cobertura was being used, a coverage toolkit that works by doing bytecode manipulation to insert calls out to a library. AspectJ was being called after cobertura and I asked the user to try the steps the other way round - it worked fine. Indicating cobertura was doing something to the bytecode that gave us problems. After much messing about, I recreated it by applying around advice to within(*) to all the classes in rt.jar (I just used that as a very large standalone jar file I could weave into). I learned that Cobertura creates catch blocks that look a little different to what javac and other compilers create. The typical bytecode sequence a compiler produces for a catch block starts with a STORE instruction, to store the exception being caught (whether the body of the catch block uses it or not). But the cobertura catch blocks started with an INVOKESTATIC instruction, a call out to another method. What does this mean? It means the same instruction has two shadows, a 'handler' shadow and a 'method-call' shadow - and it turns out this is what causes our problem. If around advice is applied to the call join point and it cannot be inlined then the body of the call shadow (the call itself) is pulled out into a new method. Because the handler was the same instruction, this meant the handler *was also being pulled out* into the new method, leaving behind an exception handler that jumped to an invalid location (in fact it 'jumped' to an instruction in a different method!). So the reason I never saw the handler location being set incorrectly is that it was set correctly up front, but then dragged out with the method-call shadow into the wrong place. In bytecode terms it looks like this: method-execution() | ICONST_0 | ISTORE_2 | SIPUSH -1 | ISTORE_3 | catch java.lang.Exception (1806389629) -> E0 | | method-call(ProjectData ProjectData.getGlobalProjectData()) | | | INVOKESTATIC ProjectData.getGlobalProjectData () | | method-call(ProjectData getGlobalProjectData()) | | LDC "SomeString" | | method-call(ClassData getOrCreateClassData(java.lang.String)) | | | INVOKEVIRTUAL ProjectData.getOrCreateClassData (LString;) | | method-call(ClassData ProjectData.getOrCreateClassData(String)) | | SIPUSH 106 | | method-call(void ClassData.touch(int)) | | | INVOKEVIRTUAL ClassData.touch (I)V | | method-call(void ClassData.touch(int)) | | ALOAD_1 | | method-call(Object Expression.getValue()) | | | INVOKEVIRTUAL Expression.getValue () | | method-call(Object Expression.getValue()) | catch java.lang.Exception (1806389629) -> E0 | ARETURN | method-call(nProjectData ProjectData.getGlobalProjectData()) | | E0: INVOKESTATIC ProjectData.getGlobalProjectData () | method-call(ProjectData ProjectData.getGlobalProjectData()) | LDC "Object" We can see the problem in that final method-call. The target for the exception handler seen earlier (E0) is within the method-call shadow. What to do?
resolved fixed
5f97d46
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2008-05-07T15:31:18Z
2008-05-07T03:13:20Z
weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java
} this.memberView = new BcelMethod(enclosingClass.getBcelObjectType(), m); this.accessFlags = m.getAccessFlags(); this.name = m.getName(); if (memberView != null && isAdviceMethod()) { if (enclosingClass.getType().isAnnotationStyleAspect()) { this.canInline = false; } } } public boolean hasDeclaredLineNumberInfo() { return (memberView != null && memberView.hasDeclarationLineNumberInfo()); } public int getDeclarationLineNumber() { if (hasDeclaredLineNumberInfo()) { return memberView.getDeclarationLineNumber(); } else { return -1; } }
230,817
Bug 230817 LazyMethodGen.remap() NullPointerException
This has been reported a few times by different users, but has always proved tough to diagnose. The typical stack trace is something like: java.lang.NullPointerException org.aspectj.weaver.bcel.LazyMethodGen.remap(LazyMethodGen.java:1237) org.aspectj.weaver.bcel.LazyMethodGen.addExceptionHandlers(LazyMethodGen.java:1132) org.aspectj.weaver.bcel.LazyMethodGen.packBody(LazyMethodGen.java:1078) org.aspectj.weaver.bcel.LazyMethodGen.pack(LazyMethodGen.java:977) org.aspectj.weaver.bcel.LazyMethodGen.getMethod(LazyMethodGen.java:484) org.aspectj.weaver.bcel.LazyClassGen.writeBack(LazyClassGen.java:512) org.aspectj.weaver.bcel.LazyClassGen.getJavaClassBytesIncludingReweavable(LazyClassGen.java:652) org.aspectj.weaver.bcel.BcelWeaver.getClassFilesFor(BcelWeaver.java:1420) org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1390) And that is an exception on this line in remap() ih = ih.getNext(); called from the addExceptionHandlers() line: gen.addExceptionHandler( remap(r.getRealStart(), map), remap(r.getRealEnd(), map), remap(r.getHandler(), map), (r.getCatchType() == null) ? null : (ObjectType) BcelWorld.makeBcelType(r.getCatchType())); During weaving, an instruction list is augmented with extra entries representing where shadows start and end (method-call, method-execution, handler, etc). When weaving is complete we want to remove these temporary elements and use the remaining instructions to produce the method bytecode. Now sometimes these temporary entries are targeted by other elements (line number tags, local variable tags and exception handlers usually). During packing we use remap() to reposition the locations so they move off of temporary placeholders and onto real instructions that will make it out into the bytecode. What the above exception tells us is that we started walking over temporary placeholder entries, but before we came to a real instruction, we ran out of instructions! This cannot happen, and indicates something went seriously wrong, we should always encounter an instruction when remapping off a temporary element. After some digging it is actually the remap() call for the handler (not the start or end) that leads to the problem. The handler represents where to jump to in the code when an exception of the specified type occurs between the instructions pointed at by start and end. I sent a debug build to a user encountering this problem (I could not recreate it) and in that I was looking at where in fact the handler was pointing before we called remap(). I learned that when this problem occurs, the handler is not pointing to anywhere in the method currently being processed (not good). In a second debug build I tried to ascertain who was setting these handlers to point to nowhere. This debug never triggered, no-one was setting them to point to nowhere... I happened to notice whilst going through the instructions in the debug output that cobertura was being used, a coverage toolkit that works by doing bytecode manipulation to insert calls out to a library. AspectJ was being called after cobertura and I asked the user to try the steps the other way round - it worked fine. Indicating cobertura was doing something to the bytecode that gave us problems. After much messing about, I recreated it by applying around advice to within(*) to all the classes in rt.jar (I just used that as a very large standalone jar file I could weave into). I learned that Cobertura creates catch blocks that look a little different to what javac and other compilers create. The typical bytecode sequence a compiler produces for a catch block starts with a STORE instruction, to store the exception being caught (whether the body of the catch block uses it or not). But the cobertura catch blocks started with an INVOKESTATIC instruction, a call out to another method. What does this mean? It means the same instruction has two shadows, a 'handler' shadow and a 'method-call' shadow - and it turns out this is what causes our problem. If around advice is applied to the call join point and it cannot be inlined then the body of the call shadow (the call itself) is pulled out into a new method. Because the handler was the same instruction, this meant the handler *was also being pulled out* into the new method, leaving behind an exception handler that jumped to an invalid location (in fact it 'jumped' to an instruction in a different method!). So the reason I never saw the handler location being set incorrectly is that it was set correctly up front, but then dragged out with the method-call shadow into the wrong place. In bytecode terms it looks like this: method-execution() | ICONST_0 | ISTORE_2 | SIPUSH -1 | ISTORE_3 | catch java.lang.Exception (1806389629) -> E0 | | method-call(ProjectData ProjectData.getGlobalProjectData()) | | | INVOKESTATIC ProjectData.getGlobalProjectData () | | method-call(ProjectData getGlobalProjectData()) | | LDC "SomeString" | | method-call(ClassData getOrCreateClassData(java.lang.String)) | | | INVOKEVIRTUAL ProjectData.getOrCreateClassData (LString;) | | method-call(ClassData ProjectData.getOrCreateClassData(String)) | | SIPUSH 106 | | method-call(void ClassData.touch(int)) | | | INVOKEVIRTUAL ClassData.touch (I)V | | method-call(void ClassData.touch(int)) | | ALOAD_1 | | method-call(Object Expression.getValue()) | | | INVOKEVIRTUAL Expression.getValue () | | method-call(Object Expression.getValue()) | catch java.lang.Exception (1806389629) -> E0 | ARETURN | method-call(nProjectData ProjectData.getGlobalProjectData()) | | E0: INVOKESTATIC ProjectData.getGlobalProjectData () | method-call(ProjectData ProjectData.getGlobalProjectData()) | LDC "Object" We can see the problem in that final method-call. The target for the exception handler seen earlier (E0) is within the method-call shadow. What to do?
resolved fixed
5f97d46
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2008-05-07T15:31:18Z
2008-05-07T03:13:20Z
weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java
public int getDeclarationOffset() { if (hasDeclaredLineNumberInfo()) { return memberView.getDeclarationOffset(); } else { return 0; } } public void addAnnotation(AnnotationX ax) { initialize(); if (memberView==null) { if (newAnnotations==null) newAnnotations = new ArrayList(); newAnnotations.add(ax); } else { memberView.addAnnotation(ax); } } public boolean hasAnnotation(UnresolvedType annotationTypeX) { initialize(); if (memberView==null) { if (newAnnotations!=null) { for (Iterator iter = newAnnotations.iterator(); iter.hasNext();) { AnnotationX element = (AnnotationX) iter.next(); if (element.getBcelAnnotation().getTypeName().equals(annotationTypeX.getName())) return true; } } memberView = new BcelMethod(getEnclosingClass().getBcelObjectType(), getMethod());
230,817
Bug 230817 LazyMethodGen.remap() NullPointerException
This has been reported a few times by different users, but has always proved tough to diagnose. The typical stack trace is something like: java.lang.NullPointerException org.aspectj.weaver.bcel.LazyMethodGen.remap(LazyMethodGen.java:1237) org.aspectj.weaver.bcel.LazyMethodGen.addExceptionHandlers(LazyMethodGen.java:1132) org.aspectj.weaver.bcel.LazyMethodGen.packBody(LazyMethodGen.java:1078) org.aspectj.weaver.bcel.LazyMethodGen.pack(LazyMethodGen.java:977) org.aspectj.weaver.bcel.LazyMethodGen.getMethod(LazyMethodGen.java:484) org.aspectj.weaver.bcel.LazyClassGen.writeBack(LazyClassGen.java:512) org.aspectj.weaver.bcel.LazyClassGen.getJavaClassBytesIncludingReweavable(LazyClassGen.java:652) org.aspectj.weaver.bcel.BcelWeaver.getClassFilesFor(BcelWeaver.java:1420) org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1390) And that is an exception on this line in remap() ih = ih.getNext(); called from the addExceptionHandlers() line: gen.addExceptionHandler( remap(r.getRealStart(), map), remap(r.getRealEnd(), map), remap(r.getHandler(), map), (r.getCatchType() == null) ? null : (ObjectType) BcelWorld.makeBcelType(r.getCatchType())); During weaving, an instruction list is augmented with extra entries representing where shadows start and end (method-call, method-execution, handler, etc). When weaving is complete we want to remove these temporary elements and use the remaining instructions to produce the method bytecode. Now sometimes these temporary entries are targeted by other elements (line number tags, local variable tags and exception handlers usually). During packing we use remap() to reposition the locations so they move off of temporary placeholders and onto real instructions that will make it out into the bytecode. What the above exception tells us is that we started walking over temporary placeholder entries, but before we came to a real instruction, we ran out of instructions! This cannot happen, and indicates something went seriously wrong, we should always encounter an instruction when remapping off a temporary element. After some digging it is actually the remap() call for the handler (not the start or end) that leads to the problem. The handler represents where to jump to in the code when an exception of the specified type occurs between the instructions pointed at by start and end. I sent a debug build to a user encountering this problem (I could not recreate it) and in that I was looking at where in fact the handler was pointing before we called remap(). I learned that when this problem occurs, the handler is not pointing to anywhere in the method currently being processed (not good). In a second debug build I tried to ascertain who was setting these handlers to point to nowhere. This debug never triggered, no-one was setting them to point to nowhere... I happened to notice whilst going through the instructions in the debug output that cobertura was being used, a coverage toolkit that works by doing bytecode manipulation to insert calls out to a library. AspectJ was being called after cobertura and I asked the user to try the steps the other way round - it worked fine. Indicating cobertura was doing something to the bytecode that gave us problems. After much messing about, I recreated it by applying around advice to within(*) to all the classes in rt.jar (I just used that as a very large standalone jar file I could weave into). I learned that Cobertura creates catch blocks that look a little different to what javac and other compilers create. The typical bytecode sequence a compiler produces for a catch block starts with a STORE instruction, to store the exception being caught (whether the body of the catch block uses it or not). But the cobertura catch blocks started with an INVOKESTATIC instruction, a call out to another method. What does this mean? It means the same instruction has two shadows, a 'handler' shadow and a 'method-call' shadow - and it turns out this is what causes our problem. If around advice is applied to the call join point and it cannot be inlined then the body of the call shadow (the call itself) is pulled out into a new method. Because the handler was the same instruction, this meant the handler *was also being pulled out* into the new method, leaving behind an exception handler that jumped to an invalid location (in fact it 'jumped' to an instruction in a different method!). So the reason I never saw the handler location being set incorrectly is that it was set correctly up front, but then dragged out with the method-call shadow into the wrong place. In bytecode terms it looks like this: method-execution() | ICONST_0 | ISTORE_2 | SIPUSH -1 | ISTORE_3 | catch java.lang.Exception (1806389629) -> E0 | | method-call(ProjectData ProjectData.getGlobalProjectData()) | | | INVOKESTATIC ProjectData.getGlobalProjectData () | | method-call(ProjectData getGlobalProjectData()) | | LDC "SomeString" | | method-call(ClassData getOrCreateClassData(java.lang.String)) | | | INVOKEVIRTUAL ProjectData.getOrCreateClassData (LString;) | | method-call(ClassData ProjectData.getOrCreateClassData(String)) | | SIPUSH 106 | | method-call(void ClassData.touch(int)) | | | INVOKEVIRTUAL ClassData.touch (I)V | | method-call(void ClassData.touch(int)) | | ALOAD_1 | | method-call(Object Expression.getValue()) | | | INVOKEVIRTUAL Expression.getValue () | | method-call(Object Expression.getValue()) | catch java.lang.Exception (1806389629) -> E0 | ARETURN | method-call(nProjectData ProjectData.getGlobalProjectData()) | | E0: INVOKESTATIC ProjectData.getGlobalProjectData () | method-call(ProjectData ProjectData.getGlobalProjectData()) | LDC "Object" We can see the problem in that final method-call. The target for the exception handler seen earlier (E0) is within the method-call shadow. What to do?
resolved fixed
5f97d46
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2008-05-07T15:31:18Z
2008-05-07T03:13:20Z
weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java
return memberView.hasAnnotation(annotationTypeX); } return memberView.hasAnnotation(annotationTypeX); } private void initialize() { if (returnType != null) return; if (!checkedXsetOption) { Properties p = enclosingClass.getWorld().getExtraConfiguration(); if (p!=null) { String s = p.getProperty("optimizeWithTags","true"); avoidUseOfBcelGenObjects = s.equalsIgnoreCase("true"); if (!avoidUseOfBcelGenObjects) enclosingClass.getWorld().getMessageHandler().handleMessage(MessageUtil.info("[optimizeWithTags=false] Disabling optimization to use Tags rather than Gens")); } checkedXsetOption=true; } MethodGen gen = new MethodGen(savedMethod, enclosingClass.getName(), enclosingClass.getConstantPoolGen(),avoidUseOfBcelGenObjects); this.returnType = gen.getReturnType(); this.argumentTypes = gen.getArgumentTypes(); this.declaredExceptions = gen.getExceptions(); this.attributes = gen.getAttributes(); this.maxLocals = gen.getMaxLocals();
230,817
Bug 230817 LazyMethodGen.remap() NullPointerException
This has been reported a few times by different users, but has always proved tough to diagnose. The typical stack trace is something like: java.lang.NullPointerException org.aspectj.weaver.bcel.LazyMethodGen.remap(LazyMethodGen.java:1237) org.aspectj.weaver.bcel.LazyMethodGen.addExceptionHandlers(LazyMethodGen.java:1132) org.aspectj.weaver.bcel.LazyMethodGen.packBody(LazyMethodGen.java:1078) org.aspectj.weaver.bcel.LazyMethodGen.pack(LazyMethodGen.java:977) org.aspectj.weaver.bcel.LazyMethodGen.getMethod(LazyMethodGen.java:484) org.aspectj.weaver.bcel.LazyClassGen.writeBack(LazyClassGen.java:512) org.aspectj.weaver.bcel.LazyClassGen.getJavaClassBytesIncludingReweavable(LazyClassGen.java:652) org.aspectj.weaver.bcel.BcelWeaver.getClassFilesFor(BcelWeaver.java:1420) org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1390) And that is an exception on this line in remap() ih = ih.getNext(); called from the addExceptionHandlers() line: gen.addExceptionHandler( remap(r.getRealStart(), map), remap(r.getRealEnd(), map), remap(r.getHandler(), map), (r.getCatchType() == null) ? null : (ObjectType) BcelWorld.makeBcelType(r.getCatchType())); During weaving, an instruction list is augmented with extra entries representing where shadows start and end (method-call, method-execution, handler, etc). When weaving is complete we want to remove these temporary elements and use the remaining instructions to produce the method bytecode. Now sometimes these temporary entries are targeted by other elements (line number tags, local variable tags and exception handlers usually). During packing we use remap() to reposition the locations so they move off of temporary placeholders and onto real instructions that will make it out into the bytecode. What the above exception tells us is that we started walking over temporary placeholder entries, but before we came to a real instruction, we ran out of instructions! This cannot happen, and indicates something went seriously wrong, we should always encounter an instruction when remapping off a temporary element. After some digging it is actually the remap() call for the handler (not the start or end) that leads to the problem. The handler represents where to jump to in the code when an exception of the specified type occurs between the instructions pointed at by start and end. I sent a debug build to a user encountering this problem (I could not recreate it) and in that I was looking at where in fact the handler was pointing before we called remap(). I learned that when this problem occurs, the handler is not pointing to anywhere in the method currently being processed (not good). In a second debug build I tried to ascertain who was setting these handlers to point to nowhere. This debug never triggered, no-one was setting them to point to nowhere... I happened to notice whilst going through the instructions in the debug output that cobertura was being used, a coverage toolkit that works by doing bytecode manipulation to insert calls out to a library. AspectJ was being called after cobertura and I asked the user to try the steps the other way round - it worked fine. Indicating cobertura was doing something to the bytecode that gave us problems. After much messing about, I recreated it by applying around advice to within(*) to all the classes in rt.jar (I just used that as a very large standalone jar file I could weave into). I learned that Cobertura creates catch blocks that look a little different to what javac and other compilers create. The typical bytecode sequence a compiler produces for a catch block starts with a STORE instruction, to store the exception being caught (whether the body of the catch block uses it or not). But the cobertura catch blocks started with an INVOKESTATIC instruction, a call out to another method. What does this mean? It means the same instruction has two shadows, a 'handler' shadow and a 'method-call' shadow - and it turns out this is what causes our problem. If around advice is applied to the call join point and it cannot be inlined then the body of the call shadow (the call itself) is pulled out into a new method. Because the handler was the same instruction, this meant the handler *was also being pulled out* into the new method, leaving behind an exception handler that jumped to an invalid location (in fact it 'jumped' to an instruction in a different method!). So the reason I never saw the handler location being set incorrectly is that it was set correctly up front, but then dragged out with the method-call shadow into the wrong place. In bytecode terms it looks like this: method-execution() | ICONST_0 | ISTORE_2 | SIPUSH -1 | ISTORE_3 | catch java.lang.Exception (1806389629) -> E0 | | method-call(ProjectData ProjectData.getGlobalProjectData()) | | | INVOKESTATIC ProjectData.getGlobalProjectData () | | method-call(ProjectData getGlobalProjectData()) | | LDC "SomeString" | | method-call(ClassData getOrCreateClassData(java.lang.String)) | | | INVOKEVIRTUAL ProjectData.getOrCreateClassData (LString;) | | method-call(ClassData ProjectData.getOrCreateClassData(String)) | | SIPUSH 106 | | method-call(void ClassData.touch(int)) | | | INVOKEVIRTUAL ClassData.touch (I)V | | method-call(void ClassData.touch(int)) | | ALOAD_1 | | method-call(Object Expression.getValue()) | | | INVOKEVIRTUAL Expression.getValue () | | method-call(Object Expression.getValue()) | catch java.lang.Exception (1806389629) -> E0 | ARETURN | method-call(nProjectData ProjectData.getGlobalProjectData()) | | E0: INVOKESTATIC ProjectData.getGlobalProjectData () | method-call(ProjectData ProjectData.getGlobalProjectData()) | LDC "Object" We can see the problem in that final method-call. The target for the exception handler seen earlier (E0) is within the method-call shadow. What to do?
resolved fixed
5f97d46
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2008-05-07T15:31:18Z
2008-05-07T03:13:20Z
weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java
if (gen.isAbstract() || gen.isNative()) { body = null; } else { body = gen.getInstructionList(); unpackHandlers(gen); if (avoidUseOfBcelGenObjects) { ensureAllLineNumberSetup(gen); highestLineNumber = gen.getHighestlinenumber(); } else { unpackLineNumbers(gen); unpackLocals(gen); } } assertGoodBody(); } private void unpackHandlers(MethodGen gen) { CodeExceptionGen[] exns = gen.getExceptionHandlers();
230,817
Bug 230817 LazyMethodGen.remap() NullPointerException
This has been reported a few times by different users, but has always proved tough to diagnose. The typical stack trace is something like: java.lang.NullPointerException org.aspectj.weaver.bcel.LazyMethodGen.remap(LazyMethodGen.java:1237) org.aspectj.weaver.bcel.LazyMethodGen.addExceptionHandlers(LazyMethodGen.java:1132) org.aspectj.weaver.bcel.LazyMethodGen.packBody(LazyMethodGen.java:1078) org.aspectj.weaver.bcel.LazyMethodGen.pack(LazyMethodGen.java:977) org.aspectj.weaver.bcel.LazyMethodGen.getMethod(LazyMethodGen.java:484) org.aspectj.weaver.bcel.LazyClassGen.writeBack(LazyClassGen.java:512) org.aspectj.weaver.bcel.LazyClassGen.getJavaClassBytesIncludingReweavable(LazyClassGen.java:652) org.aspectj.weaver.bcel.BcelWeaver.getClassFilesFor(BcelWeaver.java:1420) org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1390) And that is an exception on this line in remap() ih = ih.getNext(); called from the addExceptionHandlers() line: gen.addExceptionHandler( remap(r.getRealStart(), map), remap(r.getRealEnd(), map), remap(r.getHandler(), map), (r.getCatchType() == null) ? null : (ObjectType) BcelWorld.makeBcelType(r.getCatchType())); During weaving, an instruction list is augmented with extra entries representing where shadows start and end (method-call, method-execution, handler, etc). When weaving is complete we want to remove these temporary elements and use the remaining instructions to produce the method bytecode. Now sometimes these temporary entries are targeted by other elements (line number tags, local variable tags and exception handlers usually). During packing we use remap() to reposition the locations so they move off of temporary placeholders and onto real instructions that will make it out into the bytecode. What the above exception tells us is that we started walking over temporary placeholder entries, but before we came to a real instruction, we ran out of instructions! This cannot happen, and indicates something went seriously wrong, we should always encounter an instruction when remapping off a temporary element. After some digging it is actually the remap() call for the handler (not the start or end) that leads to the problem. The handler represents where to jump to in the code when an exception of the specified type occurs between the instructions pointed at by start and end. I sent a debug build to a user encountering this problem (I could not recreate it) and in that I was looking at where in fact the handler was pointing before we called remap(). I learned that when this problem occurs, the handler is not pointing to anywhere in the method currently being processed (not good). In a second debug build I tried to ascertain who was setting these handlers to point to nowhere. This debug never triggered, no-one was setting them to point to nowhere... I happened to notice whilst going through the instructions in the debug output that cobertura was being used, a coverage toolkit that works by doing bytecode manipulation to insert calls out to a library. AspectJ was being called after cobertura and I asked the user to try the steps the other way round - it worked fine. Indicating cobertura was doing something to the bytecode that gave us problems. After much messing about, I recreated it by applying around advice to within(*) to all the classes in rt.jar (I just used that as a very large standalone jar file I could weave into). I learned that Cobertura creates catch blocks that look a little different to what javac and other compilers create. The typical bytecode sequence a compiler produces for a catch block starts with a STORE instruction, to store the exception being caught (whether the body of the catch block uses it or not). But the cobertura catch blocks started with an INVOKESTATIC instruction, a call out to another method. What does this mean? It means the same instruction has two shadows, a 'handler' shadow and a 'method-call' shadow - and it turns out this is what causes our problem. If around advice is applied to the call join point and it cannot be inlined then the body of the call shadow (the call itself) is pulled out into a new method. Because the handler was the same instruction, this meant the handler *was also being pulled out* into the new method, leaving behind an exception handler that jumped to an invalid location (in fact it 'jumped' to an instruction in a different method!). So the reason I never saw the handler location being set incorrectly is that it was set correctly up front, but then dragged out with the method-call shadow into the wrong place. In bytecode terms it looks like this: method-execution() | ICONST_0 | ISTORE_2 | SIPUSH -1 | ISTORE_3 | catch java.lang.Exception (1806389629) -> E0 | | method-call(ProjectData ProjectData.getGlobalProjectData()) | | | INVOKESTATIC ProjectData.getGlobalProjectData () | | method-call(ProjectData getGlobalProjectData()) | | LDC "SomeString" | | method-call(ClassData getOrCreateClassData(java.lang.String)) | | | INVOKEVIRTUAL ProjectData.getOrCreateClassData (LString;) | | method-call(ClassData ProjectData.getOrCreateClassData(String)) | | SIPUSH 106 | | method-call(void ClassData.touch(int)) | | | INVOKEVIRTUAL ClassData.touch (I)V | | method-call(void ClassData.touch(int)) | | ALOAD_1 | | method-call(Object Expression.getValue()) | | | INVOKEVIRTUAL Expression.getValue () | | method-call(Object Expression.getValue()) | catch java.lang.Exception (1806389629) -> E0 | ARETURN | method-call(nProjectData ProjectData.getGlobalProjectData()) | | E0: INVOKESTATIC ProjectData.getGlobalProjectData () | method-call(ProjectData ProjectData.getGlobalProjectData()) | LDC "Object" We can see the problem in that final method-call. The target for the exception handler seen earlier (E0) is within the method-call shadow. What to do?
resolved fixed
5f97d46
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2008-05-07T15:31:18Z
2008-05-07T03:13:20Z
weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java
if (exns != null) { int len = exns.length; int priority = len - 1; for (int i = 0; i < len; i++, priority--) { CodeExceptionGen exn = exns[i]; InstructionHandle start = Range.genStart( body, getOutermostExceptionStart(exn.getStartPC())); InstructionHandle end = Range.genEnd(body, getOutermostExceptionEnd(exn.getEndPC())); ExceptionRange er = new ExceptionRange( body, exn.getCatchType() == null ? null : BcelWorld.fromBcel(exn.getCatchType()), priority); er.associateWithTargets(start, end, exn.getHandlerPC()); exn.setStartPC(null); exn.setEndPC(null); exn.setHandlerPC(null); } gen.removeExceptionHandlers(); } } private InstructionHandle getOutermostExceptionStart(InstructionHandle ih) { while (true) {
230,817
Bug 230817 LazyMethodGen.remap() NullPointerException
This has been reported a few times by different users, but has always proved tough to diagnose. The typical stack trace is something like: java.lang.NullPointerException org.aspectj.weaver.bcel.LazyMethodGen.remap(LazyMethodGen.java:1237) org.aspectj.weaver.bcel.LazyMethodGen.addExceptionHandlers(LazyMethodGen.java:1132) org.aspectj.weaver.bcel.LazyMethodGen.packBody(LazyMethodGen.java:1078) org.aspectj.weaver.bcel.LazyMethodGen.pack(LazyMethodGen.java:977) org.aspectj.weaver.bcel.LazyMethodGen.getMethod(LazyMethodGen.java:484) org.aspectj.weaver.bcel.LazyClassGen.writeBack(LazyClassGen.java:512) org.aspectj.weaver.bcel.LazyClassGen.getJavaClassBytesIncludingReweavable(LazyClassGen.java:652) org.aspectj.weaver.bcel.BcelWeaver.getClassFilesFor(BcelWeaver.java:1420) org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1390) And that is an exception on this line in remap() ih = ih.getNext(); called from the addExceptionHandlers() line: gen.addExceptionHandler( remap(r.getRealStart(), map), remap(r.getRealEnd(), map), remap(r.getHandler(), map), (r.getCatchType() == null) ? null : (ObjectType) BcelWorld.makeBcelType(r.getCatchType())); During weaving, an instruction list is augmented with extra entries representing where shadows start and end (method-call, method-execution, handler, etc). When weaving is complete we want to remove these temporary elements and use the remaining instructions to produce the method bytecode. Now sometimes these temporary entries are targeted by other elements (line number tags, local variable tags and exception handlers usually). During packing we use remap() to reposition the locations so they move off of temporary placeholders and onto real instructions that will make it out into the bytecode. What the above exception tells us is that we started walking over temporary placeholder entries, but before we came to a real instruction, we ran out of instructions! This cannot happen, and indicates something went seriously wrong, we should always encounter an instruction when remapping off a temporary element. After some digging it is actually the remap() call for the handler (not the start or end) that leads to the problem. The handler represents where to jump to in the code when an exception of the specified type occurs between the instructions pointed at by start and end. I sent a debug build to a user encountering this problem (I could not recreate it) and in that I was looking at where in fact the handler was pointing before we called remap(). I learned that when this problem occurs, the handler is not pointing to anywhere in the method currently being processed (not good). In a second debug build I tried to ascertain who was setting these handlers to point to nowhere. This debug never triggered, no-one was setting them to point to nowhere... I happened to notice whilst going through the instructions in the debug output that cobertura was being used, a coverage toolkit that works by doing bytecode manipulation to insert calls out to a library. AspectJ was being called after cobertura and I asked the user to try the steps the other way round - it worked fine. Indicating cobertura was doing something to the bytecode that gave us problems. After much messing about, I recreated it by applying around advice to within(*) to all the classes in rt.jar (I just used that as a very large standalone jar file I could weave into). I learned that Cobertura creates catch blocks that look a little different to what javac and other compilers create. The typical bytecode sequence a compiler produces for a catch block starts with a STORE instruction, to store the exception being caught (whether the body of the catch block uses it or not). But the cobertura catch blocks started with an INVOKESTATIC instruction, a call out to another method. What does this mean? It means the same instruction has two shadows, a 'handler' shadow and a 'method-call' shadow - and it turns out this is what causes our problem. If around advice is applied to the call join point and it cannot be inlined then the body of the call shadow (the call itself) is pulled out into a new method. Because the handler was the same instruction, this meant the handler *was also being pulled out* into the new method, leaving behind an exception handler that jumped to an invalid location (in fact it 'jumped' to an instruction in a different method!). So the reason I never saw the handler location being set incorrectly is that it was set correctly up front, but then dragged out with the method-call shadow into the wrong place. In bytecode terms it looks like this: method-execution() | ICONST_0 | ISTORE_2 | SIPUSH -1 | ISTORE_3 | catch java.lang.Exception (1806389629) -> E0 | | method-call(ProjectData ProjectData.getGlobalProjectData()) | | | INVOKESTATIC ProjectData.getGlobalProjectData () | | method-call(ProjectData getGlobalProjectData()) | | LDC "SomeString" | | method-call(ClassData getOrCreateClassData(java.lang.String)) | | | INVOKEVIRTUAL ProjectData.getOrCreateClassData (LString;) | | method-call(ClassData ProjectData.getOrCreateClassData(String)) | | SIPUSH 106 | | method-call(void ClassData.touch(int)) | | | INVOKEVIRTUAL ClassData.touch (I)V | | method-call(void ClassData.touch(int)) | | ALOAD_1 | | method-call(Object Expression.getValue()) | | | INVOKEVIRTUAL Expression.getValue () | | method-call(Object Expression.getValue()) | catch java.lang.Exception (1806389629) -> E0 | ARETURN | method-call(nProjectData ProjectData.getGlobalProjectData()) | | E0: INVOKESTATIC ProjectData.getGlobalProjectData () | method-call(ProjectData ProjectData.getGlobalProjectData()) | LDC "Object" We can see the problem in that final method-call. The target for the exception handler seen earlier (E0) is within the method-call shadow. What to do?
resolved fixed
5f97d46
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2008-05-07T15:31:18Z
2008-05-07T03:13:20Z
weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java
if (ExceptionRange.isExceptionStart(ih.getPrev())) { ih = ih.getPrev(); } else { return ih; } } } private InstructionHandle getOutermostExceptionEnd(InstructionHandle ih) { while (true) { if (ExceptionRange.isExceptionEnd(ih.getNext())) { ih = ih.getNext(); } else { return ih; } } } private void unpackLineNumbers(MethodGen gen) { LineNumberTag lr = null; for (InstructionHandle ih = body.getStart(); ih != null; ih = ih.getNext()) { InstructionTargeter[] targeters = ih.getTargeters(); if (targeters != null) { for (int i = targeters.length - 1; i >= 0; i--) { InstructionTargeter targeter = targeters[i]; if (targeter instanceof LineNumberGen) { LineNumberGen lng = (LineNumberGen) targeter; lng.updateTarget(ih, null); int lineNumber = lng.getSourceLine(); if (highestLineNumber < lineNumber) highestLineNumber = lineNumber; lr = new LineNumberTag(lineNumber); }
230,817
Bug 230817 LazyMethodGen.remap() NullPointerException
This has been reported a few times by different users, but has always proved tough to diagnose. The typical stack trace is something like: java.lang.NullPointerException org.aspectj.weaver.bcel.LazyMethodGen.remap(LazyMethodGen.java:1237) org.aspectj.weaver.bcel.LazyMethodGen.addExceptionHandlers(LazyMethodGen.java:1132) org.aspectj.weaver.bcel.LazyMethodGen.packBody(LazyMethodGen.java:1078) org.aspectj.weaver.bcel.LazyMethodGen.pack(LazyMethodGen.java:977) org.aspectj.weaver.bcel.LazyMethodGen.getMethod(LazyMethodGen.java:484) org.aspectj.weaver.bcel.LazyClassGen.writeBack(LazyClassGen.java:512) org.aspectj.weaver.bcel.LazyClassGen.getJavaClassBytesIncludingReweavable(LazyClassGen.java:652) org.aspectj.weaver.bcel.BcelWeaver.getClassFilesFor(BcelWeaver.java:1420) org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1390) And that is an exception on this line in remap() ih = ih.getNext(); called from the addExceptionHandlers() line: gen.addExceptionHandler( remap(r.getRealStart(), map), remap(r.getRealEnd(), map), remap(r.getHandler(), map), (r.getCatchType() == null) ? null : (ObjectType) BcelWorld.makeBcelType(r.getCatchType())); During weaving, an instruction list is augmented with extra entries representing where shadows start and end (method-call, method-execution, handler, etc). When weaving is complete we want to remove these temporary elements and use the remaining instructions to produce the method bytecode. Now sometimes these temporary entries are targeted by other elements (line number tags, local variable tags and exception handlers usually). During packing we use remap() to reposition the locations so they move off of temporary placeholders and onto real instructions that will make it out into the bytecode. What the above exception tells us is that we started walking over temporary placeholder entries, but before we came to a real instruction, we ran out of instructions! This cannot happen, and indicates something went seriously wrong, we should always encounter an instruction when remapping off a temporary element. After some digging it is actually the remap() call for the handler (not the start or end) that leads to the problem. The handler represents where to jump to in the code when an exception of the specified type occurs between the instructions pointed at by start and end. I sent a debug build to a user encountering this problem (I could not recreate it) and in that I was looking at where in fact the handler was pointing before we called remap(). I learned that when this problem occurs, the handler is not pointing to anywhere in the method currently being processed (not good). In a second debug build I tried to ascertain who was setting these handlers to point to nowhere. This debug never triggered, no-one was setting them to point to nowhere... I happened to notice whilst going through the instructions in the debug output that cobertura was being used, a coverage toolkit that works by doing bytecode manipulation to insert calls out to a library. AspectJ was being called after cobertura and I asked the user to try the steps the other way round - it worked fine. Indicating cobertura was doing something to the bytecode that gave us problems. After much messing about, I recreated it by applying around advice to within(*) to all the classes in rt.jar (I just used that as a very large standalone jar file I could weave into). I learned that Cobertura creates catch blocks that look a little different to what javac and other compilers create. The typical bytecode sequence a compiler produces for a catch block starts with a STORE instruction, to store the exception being caught (whether the body of the catch block uses it or not). But the cobertura catch blocks started with an INVOKESTATIC instruction, a call out to another method. What does this mean? It means the same instruction has two shadows, a 'handler' shadow and a 'method-call' shadow - and it turns out this is what causes our problem. If around advice is applied to the call join point and it cannot be inlined then the body of the call shadow (the call itself) is pulled out into a new method. Because the handler was the same instruction, this meant the handler *was also being pulled out* into the new method, leaving behind an exception handler that jumped to an invalid location (in fact it 'jumped' to an instruction in a different method!). So the reason I never saw the handler location being set incorrectly is that it was set correctly up front, but then dragged out with the method-call shadow into the wrong place. In bytecode terms it looks like this: method-execution() | ICONST_0 | ISTORE_2 | SIPUSH -1 | ISTORE_3 | catch java.lang.Exception (1806389629) -> E0 | | method-call(ProjectData ProjectData.getGlobalProjectData()) | | | INVOKESTATIC ProjectData.getGlobalProjectData () | | method-call(ProjectData getGlobalProjectData()) | | LDC "SomeString" | | method-call(ClassData getOrCreateClassData(java.lang.String)) | | | INVOKEVIRTUAL ProjectData.getOrCreateClassData (LString;) | | method-call(ClassData ProjectData.getOrCreateClassData(String)) | | SIPUSH 106 | | method-call(void ClassData.touch(int)) | | | INVOKEVIRTUAL ClassData.touch (I)V | | method-call(void ClassData.touch(int)) | | ALOAD_1 | | method-call(Object Expression.getValue()) | | | INVOKEVIRTUAL Expression.getValue () | | method-call(Object Expression.getValue()) | catch java.lang.Exception (1806389629) -> E0 | ARETURN | method-call(nProjectData ProjectData.getGlobalProjectData()) | | E0: INVOKESTATIC ProjectData.getGlobalProjectData () | method-call(ProjectData ProjectData.getGlobalProjectData()) | LDC "Object" We can see the problem in that final method-call. The target for the exception handler seen earlier (E0) is within the method-call shadow. What to do?
resolved fixed
5f97d46
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2008-05-07T15:31:18Z
2008-05-07T03:13:20Z
weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java
} } if (lr != null) { ih.addTargeter(lr); } } gen.removeLineNumbers(); } /** * On entry to this method we have a method whose instruction stream contains a few instructions * that have line numbers assigned to them (LineNumberTags). The aim is to ensure every instruction * has the right line number. This is necessary because some of them may be extracted out into other * methods - and it'd be useful for them to maintain the source line number for debugging. */ private void ensureAllLineNumberSetup(MethodGen gen) { LineNumberTag lr = null; boolean skip = false; for (InstructionHandle ih = body.getStart(); ih != null; ih = ih.getNext()) { InstructionTargeter[] targeters = ih.getTargeters(); skip = false; if (targeters != null) { for (int i = targeters.length - 1; i >= 0; i--) { InstructionTargeter targeter = targeters[i]; if (targeter instanceof LineNumberTag) { lr = (LineNumberTag) targeter; skip=true; } } } if (lr != null && !skip) {
230,817
Bug 230817 LazyMethodGen.remap() NullPointerException
This has been reported a few times by different users, but has always proved tough to diagnose. The typical stack trace is something like: java.lang.NullPointerException org.aspectj.weaver.bcel.LazyMethodGen.remap(LazyMethodGen.java:1237) org.aspectj.weaver.bcel.LazyMethodGen.addExceptionHandlers(LazyMethodGen.java:1132) org.aspectj.weaver.bcel.LazyMethodGen.packBody(LazyMethodGen.java:1078) org.aspectj.weaver.bcel.LazyMethodGen.pack(LazyMethodGen.java:977) org.aspectj.weaver.bcel.LazyMethodGen.getMethod(LazyMethodGen.java:484) org.aspectj.weaver.bcel.LazyClassGen.writeBack(LazyClassGen.java:512) org.aspectj.weaver.bcel.LazyClassGen.getJavaClassBytesIncludingReweavable(LazyClassGen.java:652) org.aspectj.weaver.bcel.BcelWeaver.getClassFilesFor(BcelWeaver.java:1420) org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1390) And that is an exception on this line in remap() ih = ih.getNext(); called from the addExceptionHandlers() line: gen.addExceptionHandler( remap(r.getRealStart(), map), remap(r.getRealEnd(), map), remap(r.getHandler(), map), (r.getCatchType() == null) ? null : (ObjectType) BcelWorld.makeBcelType(r.getCatchType())); During weaving, an instruction list is augmented with extra entries representing where shadows start and end (method-call, method-execution, handler, etc). When weaving is complete we want to remove these temporary elements and use the remaining instructions to produce the method bytecode. Now sometimes these temporary entries are targeted by other elements (line number tags, local variable tags and exception handlers usually). During packing we use remap() to reposition the locations so they move off of temporary placeholders and onto real instructions that will make it out into the bytecode. What the above exception tells us is that we started walking over temporary placeholder entries, but before we came to a real instruction, we ran out of instructions! This cannot happen, and indicates something went seriously wrong, we should always encounter an instruction when remapping off a temporary element. After some digging it is actually the remap() call for the handler (not the start or end) that leads to the problem. The handler represents where to jump to in the code when an exception of the specified type occurs between the instructions pointed at by start and end. I sent a debug build to a user encountering this problem (I could not recreate it) and in that I was looking at where in fact the handler was pointing before we called remap(). I learned that when this problem occurs, the handler is not pointing to anywhere in the method currently being processed (not good). In a second debug build I tried to ascertain who was setting these handlers to point to nowhere. This debug never triggered, no-one was setting them to point to nowhere... I happened to notice whilst going through the instructions in the debug output that cobertura was being used, a coverage toolkit that works by doing bytecode manipulation to insert calls out to a library. AspectJ was being called after cobertura and I asked the user to try the steps the other way round - it worked fine. Indicating cobertura was doing something to the bytecode that gave us problems. After much messing about, I recreated it by applying around advice to within(*) to all the classes in rt.jar (I just used that as a very large standalone jar file I could weave into). I learned that Cobertura creates catch blocks that look a little different to what javac and other compilers create. The typical bytecode sequence a compiler produces for a catch block starts with a STORE instruction, to store the exception being caught (whether the body of the catch block uses it or not). But the cobertura catch blocks started with an INVOKESTATIC instruction, a call out to another method. What does this mean? It means the same instruction has two shadows, a 'handler' shadow and a 'method-call' shadow - and it turns out this is what causes our problem. If around advice is applied to the call join point and it cannot be inlined then the body of the call shadow (the call itself) is pulled out into a new method. Because the handler was the same instruction, this meant the handler *was also being pulled out* into the new method, leaving behind an exception handler that jumped to an invalid location (in fact it 'jumped' to an instruction in a different method!). So the reason I never saw the handler location being set incorrectly is that it was set correctly up front, but then dragged out with the method-call shadow into the wrong place. In bytecode terms it looks like this: method-execution() | ICONST_0 | ISTORE_2 | SIPUSH -1 | ISTORE_3 | catch java.lang.Exception (1806389629) -> E0 | | method-call(ProjectData ProjectData.getGlobalProjectData()) | | | INVOKESTATIC ProjectData.getGlobalProjectData () | | method-call(ProjectData getGlobalProjectData()) | | LDC "SomeString" | | method-call(ClassData getOrCreateClassData(java.lang.String)) | | | INVOKEVIRTUAL ProjectData.getOrCreateClassData (LString;) | | method-call(ClassData ProjectData.getOrCreateClassData(String)) | | SIPUSH 106 | | method-call(void ClassData.touch(int)) | | | INVOKEVIRTUAL ClassData.touch (I)V | | method-call(void ClassData.touch(int)) | | ALOAD_1 | | method-call(Object Expression.getValue()) | | | INVOKEVIRTUAL Expression.getValue () | | method-call(Object Expression.getValue()) | catch java.lang.Exception (1806389629) -> E0 | ARETURN | method-call(nProjectData ProjectData.getGlobalProjectData()) | | E0: INVOKESTATIC ProjectData.getGlobalProjectData () | method-call(ProjectData ProjectData.getGlobalProjectData()) | LDC "Object" We can see the problem in that final method-call. The target for the exception handler seen earlier (E0) is within the method-call shadow. What to do?
resolved fixed
5f97d46
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2008-05-07T15:31:18Z
2008-05-07T03:13:20Z
weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java
ih.addTargeter(lr); } } } private void unpackLocals(MethodGen gen) { Set locals = new HashSet(); for (InstructionHandle ih = body.getStart(); ih != null; ih = ih.getNext()) { InstructionTargeter[] targeters = ih.getTargeters(); List ends = new ArrayList(0); if (targeters != null) { for (int i = targeters.length - 1; i >= 0; i--) { InstructionTargeter targeter = targeters[i]; if (targeter instanceof LocalVariableGen) { LocalVariableGen lng = (LocalVariableGen) targeter; LocalVariableTag lr = new LocalVariableTag(lng.getType().getSignature(), lng.getName(), lng.getIndex(), lng.getStart().getPosition()); if (lng.getStart() == ih) { locals.add(lr); } else { ends.add(lr); } } } } for (Iterator i = locals.iterator(); i.hasNext(); ) { ih.addTargeter((LocalVariableTag) i.next()); } locals.removeAll(ends); } gen.removeLocalVariables(); }
230,817
Bug 230817 LazyMethodGen.remap() NullPointerException
This has been reported a few times by different users, but has always proved tough to diagnose. The typical stack trace is something like: java.lang.NullPointerException org.aspectj.weaver.bcel.LazyMethodGen.remap(LazyMethodGen.java:1237) org.aspectj.weaver.bcel.LazyMethodGen.addExceptionHandlers(LazyMethodGen.java:1132) org.aspectj.weaver.bcel.LazyMethodGen.packBody(LazyMethodGen.java:1078) org.aspectj.weaver.bcel.LazyMethodGen.pack(LazyMethodGen.java:977) org.aspectj.weaver.bcel.LazyMethodGen.getMethod(LazyMethodGen.java:484) org.aspectj.weaver.bcel.LazyClassGen.writeBack(LazyClassGen.java:512) org.aspectj.weaver.bcel.LazyClassGen.getJavaClassBytesIncludingReweavable(LazyClassGen.java:652) org.aspectj.weaver.bcel.BcelWeaver.getClassFilesFor(BcelWeaver.java:1420) org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1390) And that is an exception on this line in remap() ih = ih.getNext(); called from the addExceptionHandlers() line: gen.addExceptionHandler( remap(r.getRealStart(), map), remap(r.getRealEnd(), map), remap(r.getHandler(), map), (r.getCatchType() == null) ? null : (ObjectType) BcelWorld.makeBcelType(r.getCatchType())); During weaving, an instruction list is augmented with extra entries representing where shadows start and end (method-call, method-execution, handler, etc). When weaving is complete we want to remove these temporary elements and use the remaining instructions to produce the method bytecode. Now sometimes these temporary entries are targeted by other elements (line number tags, local variable tags and exception handlers usually). During packing we use remap() to reposition the locations so they move off of temporary placeholders and onto real instructions that will make it out into the bytecode. What the above exception tells us is that we started walking over temporary placeholder entries, but before we came to a real instruction, we ran out of instructions! This cannot happen, and indicates something went seriously wrong, we should always encounter an instruction when remapping off a temporary element. After some digging it is actually the remap() call for the handler (not the start or end) that leads to the problem. The handler represents where to jump to in the code when an exception of the specified type occurs between the instructions pointed at by start and end. I sent a debug build to a user encountering this problem (I could not recreate it) and in that I was looking at where in fact the handler was pointing before we called remap(). I learned that when this problem occurs, the handler is not pointing to anywhere in the method currently being processed (not good). In a second debug build I tried to ascertain who was setting these handlers to point to nowhere. This debug never triggered, no-one was setting them to point to nowhere... I happened to notice whilst going through the instructions in the debug output that cobertura was being used, a coverage toolkit that works by doing bytecode manipulation to insert calls out to a library. AspectJ was being called after cobertura and I asked the user to try the steps the other way round - it worked fine. Indicating cobertura was doing something to the bytecode that gave us problems. After much messing about, I recreated it by applying around advice to within(*) to all the classes in rt.jar (I just used that as a very large standalone jar file I could weave into). I learned that Cobertura creates catch blocks that look a little different to what javac and other compilers create. The typical bytecode sequence a compiler produces for a catch block starts with a STORE instruction, to store the exception being caught (whether the body of the catch block uses it or not). But the cobertura catch blocks started with an INVOKESTATIC instruction, a call out to another method. What does this mean? It means the same instruction has two shadows, a 'handler' shadow and a 'method-call' shadow - and it turns out this is what causes our problem. If around advice is applied to the call join point and it cannot be inlined then the body of the call shadow (the call itself) is pulled out into a new method. Because the handler was the same instruction, this meant the handler *was also being pulled out* into the new method, leaving behind an exception handler that jumped to an invalid location (in fact it 'jumped' to an instruction in a different method!). So the reason I never saw the handler location being set incorrectly is that it was set correctly up front, but then dragged out with the method-call shadow into the wrong place. In bytecode terms it looks like this: method-execution() | ICONST_0 | ISTORE_2 | SIPUSH -1 | ISTORE_3 | catch java.lang.Exception (1806389629) -> E0 | | method-call(ProjectData ProjectData.getGlobalProjectData()) | | | INVOKESTATIC ProjectData.getGlobalProjectData () | | method-call(ProjectData getGlobalProjectData()) | | LDC "SomeString" | | method-call(ClassData getOrCreateClassData(java.lang.String)) | | | INVOKEVIRTUAL ProjectData.getOrCreateClassData (LString;) | | method-call(ClassData ProjectData.getOrCreateClassData(String)) | | SIPUSH 106 | | method-call(void ClassData.touch(int)) | | | INVOKEVIRTUAL ClassData.touch (I)V | | method-call(void ClassData.touch(int)) | | ALOAD_1 | | method-call(Object Expression.getValue()) | | | INVOKEVIRTUAL Expression.getValue () | | method-call(Object Expression.getValue()) | catch java.lang.Exception (1806389629) -> E0 | ARETURN | method-call(nProjectData ProjectData.getGlobalProjectData()) | | E0: INVOKESTATIC ProjectData.getGlobalProjectData () | method-call(ProjectData ProjectData.getGlobalProjectData()) | LDC "Object" We can see the problem in that final method-call. The target for the exception handler seen earlier (E0) is within the method-call shadow. What to do?
resolved fixed
5f97d46
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2008-05-07T15:31:18Z
2008-05-07T03:13:20Z
weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java
public int allocateLocal(Type type) { return allocateLocal(type.getSize()); } public int allocateLocal(int slots) { int max = getMaxLocals(); setMaxLocals(max + slots); return max; } public Method getMethod() { if (savedMethod != null) return savedMethod; try { MethodGen gen = pack(); return gen.getMethod(); } catch (ClassGenException e) { enclosingClass.getBcelObjectType().getResolvedTypeX().getWorld().showMessage( IMessage.ERROR, WeaverMessages.format(WeaverMessages.PROBLEM_GENERATING_METHOD, this.getClassName(), this.getName(), e.getMessage()), this.getMemberView() == null ? null : this.getMemberView().getSourceLocation(), null); body = null; MethodGen gen = pack(); return gen.getMethod(); } }
230,817
Bug 230817 LazyMethodGen.remap() NullPointerException
This has been reported a few times by different users, but has always proved tough to diagnose. The typical stack trace is something like: java.lang.NullPointerException org.aspectj.weaver.bcel.LazyMethodGen.remap(LazyMethodGen.java:1237) org.aspectj.weaver.bcel.LazyMethodGen.addExceptionHandlers(LazyMethodGen.java:1132) org.aspectj.weaver.bcel.LazyMethodGen.packBody(LazyMethodGen.java:1078) org.aspectj.weaver.bcel.LazyMethodGen.pack(LazyMethodGen.java:977) org.aspectj.weaver.bcel.LazyMethodGen.getMethod(LazyMethodGen.java:484) org.aspectj.weaver.bcel.LazyClassGen.writeBack(LazyClassGen.java:512) org.aspectj.weaver.bcel.LazyClassGen.getJavaClassBytesIncludingReweavable(LazyClassGen.java:652) org.aspectj.weaver.bcel.BcelWeaver.getClassFilesFor(BcelWeaver.java:1420) org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1390) And that is an exception on this line in remap() ih = ih.getNext(); called from the addExceptionHandlers() line: gen.addExceptionHandler( remap(r.getRealStart(), map), remap(r.getRealEnd(), map), remap(r.getHandler(), map), (r.getCatchType() == null) ? null : (ObjectType) BcelWorld.makeBcelType(r.getCatchType())); During weaving, an instruction list is augmented with extra entries representing where shadows start and end (method-call, method-execution, handler, etc). When weaving is complete we want to remove these temporary elements and use the remaining instructions to produce the method bytecode. Now sometimes these temporary entries are targeted by other elements (line number tags, local variable tags and exception handlers usually). During packing we use remap() to reposition the locations so they move off of temporary placeholders and onto real instructions that will make it out into the bytecode. What the above exception tells us is that we started walking over temporary placeholder entries, but before we came to a real instruction, we ran out of instructions! This cannot happen, and indicates something went seriously wrong, we should always encounter an instruction when remapping off a temporary element. After some digging it is actually the remap() call for the handler (not the start or end) that leads to the problem. The handler represents where to jump to in the code when an exception of the specified type occurs between the instructions pointed at by start and end. I sent a debug build to a user encountering this problem (I could not recreate it) and in that I was looking at where in fact the handler was pointing before we called remap(). I learned that when this problem occurs, the handler is not pointing to anywhere in the method currently being processed (not good). In a second debug build I tried to ascertain who was setting these handlers to point to nowhere. This debug never triggered, no-one was setting them to point to nowhere... I happened to notice whilst going through the instructions in the debug output that cobertura was being used, a coverage toolkit that works by doing bytecode manipulation to insert calls out to a library. AspectJ was being called after cobertura and I asked the user to try the steps the other way round - it worked fine. Indicating cobertura was doing something to the bytecode that gave us problems. After much messing about, I recreated it by applying around advice to within(*) to all the classes in rt.jar (I just used that as a very large standalone jar file I could weave into). I learned that Cobertura creates catch blocks that look a little different to what javac and other compilers create. The typical bytecode sequence a compiler produces for a catch block starts with a STORE instruction, to store the exception being caught (whether the body of the catch block uses it or not). But the cobertura catch blocks started with an INVOKESTATIC instruction, a call out to another method. What does this mean? It means the same instruction has two shadows, a 'handler' shadow and a 'method-call' shadow - and it turns out this is what causes our problem. If around advice is applied to the call join point and it cannot be inlined then the body of the call shadow (the call itself) is pulled out into a new method. Because the handler was the same instruction, this meant the handler *was also being pulled out* into the new method, leaving behind an exception handler that jumped to an invalid location (in fact it 'jumped' to an instruction in a different method!). So the reason I never saw the handler location being set incorrectly is that it was set correctly up front, but then dragged out with the method-call shadow into the wrong place. In bytecode terms it looks like this: method-execution() | ICONST_0 | ISTORE_2 | SIPUSH -1 | ISTORE_3 | catch java.lang.Exception (1806389629) -> E0 | | method-call(ProjectData ProjectData.getGlobalProjectData()) | | | INVOKESTATIC ProjectData.getGlobalProjectData () | | method-call(ProjectData getGlobalProjectData()) | | LDC "SomeString" | | method-call(ClassData getOrCreateClassData(java.lang.String)) | | | INVOKEVIRTUAL ProjectData.getOrCreateClassData (LString;) | | method-call(ClassData ProjectData.getOrCreateClassData(String)) | | SIPUSH 106 | | method-call(void ClassData.touch(int)) | | | INVOKEVIRTUAL ClassData.touch (I)V | | method-call(void ClassData.touch(int)) | | ALOAD_1 | | method-call(Object Expression.getValue()) | | | INVOKEVIRTUAL Expression.getValue () | | method-call(Object Expression.getValue()) | catch java.lang.Exception (1806389629) -> E0 | ARETURN | method-call(nProjectData ProjectData.getGlobalProjectData()) | | E0: INVOKESTATIC ProjectData.getGlobalProjectData () | method-call(ProjectData ProjectData.getGlobalProjectData()) | LDC "Object" We can see the problem in that final method-call. The target for the exception handler seen earlier (E0) is within the method-call shadow. What to do?
resolved fixed
5f97d46
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2008-05-07T15:31:18Z
2008-05-07T03:13:20Z
weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java
public void markAsChanged() { initialize(); savedMethod = null; } public String toString() { WeaverVersionInfo weaverVersion = enclosingClass.getBcelObjectType().getWeaverVersionAttribute(); return toLongString(weaverVersion); } public String toShortString() { String access = org.aspectj.apache.bcel.classfile.Utility.accessToString(getAccessFlags()); StringBuffer buf = new StringBuffer(); if (!access.equals("")) { buf.append(access); buf.append(" "); } buf.append( org.aspectj.apache.bcel.classfile.Utility.signatureToString( getReturnType().getSignature(), true)); buf.append(" "); buf.append(getName()); buf.append("("); { int len = argumentTypes.length; if (len > 0) {
230,817
Bug 230817 LazyMethodGen.remap() NullPointerException
This has been reported a few times by different users, but has always proved tough to diagnose. The typical stack trace is something like: java.lang.NullPointerException org.aspectj.weaver.bcel.LazyMethodGen.remap(LazyMethodGen.java:1237) org.aspectj.weaver.bcel.LazyMethodGen.addExceptionHandlers(LazyMethodGen.java:1132) org.aspectj.weaver.bcel.LazyMethodGen.packBody(LazyMethodGen.java:1078) org.aspectj.weaver.bcel.LazyMethodGen.pack(LazyMethodGen.java:977) org.aspectj.weaver.bcel.LazyMethodGen.getMethod(LazyMethodGen.java:484) org.aspectj.weaver.bcel.LazyClassGen.writeBack(LazyClassGen.java:512) org.aspectj.weaver.bcel.LazyClassGen.getJavaClassBytesIncludingReweavable(LazyClassGen.java:652) org.aspectj.weaver.bcel.BcelWeaver.getClassFilesFor(BcelWeaver.java:1420) org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1390) And that is an exception on this line in remap() ih = ih.getNext(); called from the addExceptionHandlers() line: gen.addExceptionHandler( remap(r.getRealStart(), map), remap(r.getRealEnd(), map), remap(r.getHandler(), map), (r.getCatchType() == null) ? null : (ObjectType) BcelWorld.makeBcelType(r.getCatchType())); During weaving, an instruction list is augmented with extra entries representing where shadows start and end (method-call, method-execution, handler, etc). When weaving is complete we want to remove these temporary elements and use the remaining instructions to produce the method bytecode. Now sometimes these temporary entries are targeted by other elements (line number tags, local variable tags and exception handlers usually). During packing we use remap() to reposition the locations so they move off of temporary placeholders and onto real instructions that will make it out into the bytecode. What the above exception tells us is that we started walking over temporary placeholder entries, but before we came to a real instruction, we ran out of instructions! This cannot happen, and indicates something went seriously wrong, we should always encounter an instruction when remapping off a temporary element. After some digging it is actually the remap() call for the handler (not the start or end) that leads to the problem. The handler represents where to jump to in the code when an exception of the specified type occurs between the instructions pointed at by start and end. I sent a debug build to a user encountering this problem (I could not recreate it) and in that I was looking at where in fact the handler was pointing before we called remap(). I learned that when this problem occurs, the handler is not pointing to anywhere in the method currently being processed (not good). In a second debug build I tried to ascertain who was setting these handlers to point to nowhere. This debug never triggered, no-one was setting them to point to nowhere... I happened to notice whilst going through the instructions in the debug output that cobertura was being used, a coverage toolkit that works by doing bytecode manipulation to insert calls out to a library. AspectJ was being called after cobertura and I asked the user to try the steps the other way round - it worked fine. Indicating cobertura was doing something to the bytecode that gave us problems. After much messing about, I recreated it by applying around advice to within(*) to all the classes in rt.jar (I just used that as a very large standalone jar file I could weave into). I learned that Cobertura creates catch blocks that look a little different to what javac and other compilers create. The typical bytecode sequence a compiler produces for a catch block starts with a STORE instruction, to store the exception being caught (whether the body of the catch block uses it or not). But the cobertura catch blocks started with an INVOKESTATIC instruction, a call out to another method. What does this mean? It means the same instruction has two shadows, a 'handler' shadow and a 'method-call' shadow - and it turns out this is what causes our problem. If around advice is applied to the call join point and it cannot be inlined then the body of the call shadow (the call itself) is pulled out into a new method. Because the handler was the same instruction, this meant the handler *was also being pulled out* into the new method, leaving behind an exception handler that jumped to an invalid location (in fact it 'jumped' to an instruction in a different method!). So the reason I never saw the handler location being set incorrectly is that it was set correctly up front, but then dragged out with the method-call shadow into the wrong place. In bytecode terms it looks like this: method-execution() | ICONST_0 | ISTORE_2 | SIPUSH -1 | ISTORE_3 | catch java.lang.Exception (1806389629) -> E0 | | method-call(ProjectData ProjectData.getGlobalProjectData()) | | | INVOKESTATIC ProjectData.getGlobalProjectData () | | method-call(ProjectData getGlobalProjectData()) | | LDC "SomeString" | | method-call(ClassData getOrCreateClassData(java.lang.String)) | | | INVOKEVIRTUAL ProjectData.getOrCreateClassData (LString;) | | method-call(ClassData ProjectData.getOrCreateClassData(String)) | | SIPUSH 106 | | method-call(void ClassData.touch(int)) | | | INVOKEVIRTUAL ClassData.touch (I)V | | method-call(void ClassData.touch(int)) | | ALOAD_1 | | method-call(Object Expression.getValue()) | | | INVOKEVIRTUAL Expression.getValue () | | method-call(Object Expression.getValue()) | catch java.lang.Exception (1806389629) -> E0 | ARETURN | method-call(nProjectData ProjectData.getGlobalProjectData()) | | E0: INVOKESTATIC ProjectData.getGlobalProjectData () | method-call(ProjectData ProjectData.getGlobalProjectData()) | LDC "Object" We can see the problem in that final method-call. The target for the exception handler seen earlier (E0) is within the method-call shadow. What to do?
resolved fixed
5f97d46
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2008-05-07T15:31:18Z
2008-05-07T03:13:20Z
weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java
buf.append( org.aspectj.apache.bcel.classfile.Utility.signatureToString( argumentTypes[0].getSignature(), true)); for (int i = 1; i < argumentTypes.length; i++) { buf.append(", "); buf.append( org.aspectj.apache.bcel.classfile.Utility.signatureToString( argumentTypes[i].getSignature(), true)); } } } buf.append(")"); { int len = declaredExceptions != null ? declaredExceptions.length : 0; if (len > 0) { buf.append(" throws "); buf.append(declaredExceptions[0]); for (int i = 1; i < declaredExceptions.length; i++) { buf.append(", "); buf.append(declaredExceptions[i]); } } } return buf.toString(); } public String toLongString(WeaverVersionInfo weaverVersion) { ByteArrayOutputStream s = new ByteArrayOutputStream();
230,817
Bug 230817 LazyMethodGen.remap() NullPointerException
This has been reported a few times by different users, but has always proved tough to diagnose. The typical stack trace is something like: java.lang.NullPointerException org.aspectj.weaver.bcel.LazyMethodGen.remap(LazyMethodGen.java:1237) org.aspectj.weaver.bcel.LazyMethodGen.addExceptionHandlers(LazyMethodGen.java:1132) org.aspectj.weaver.bcel.LazyMethodGen.packBody(LazyMethodGen.java:1078) org.aspectj.weaver.bcel.LazyMethodGen.pack(LazyMethodGen.java:977) org.aspectj.weaver.bcel.LazyMethodGen.getMethod(LazyMethodGen.java:484) org.aspectj.weaver.bcel.LazyClassGen.writeBack(LazyClassGen.java:512) org.aspectj.weaver.bcel.LazyClassGen.getJavaClassBytesIncludingReweavable(LazyClassGen.java:652) org.aspectj.weaver.bcel.BcelWeaver.getClassFilesFor(BcelWeaver.java:1420) org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1390) And that is an exception on this line in remap() ih = ih.getNext(); called from the addExceptionHandlers() line: gen.addExceptionHandler( remap(r.getRealStart(), map), remap(r.getRealEnd(), map), remap(r.getHandler(), map), (r.getCatchType() == null) ? null : (ObjectType) BcelWorld.makeBcelType(r.getCatchType())); During weaving, an instruction list is augmented with extra entries representing where shadows start and end (method-call, method-execution, handler, etc). When weaving is complete we want to remove these temporary elements and use the remaining instructions to produce the method bytecode. Now sometimes these temporary entries are targeted by other elements (line number tags, local variable tags and exception handlers usually). During packing we use remap() to reposition the locations so they move off of temporary placeholders and onto real instructions that will make it out into the bytecode. What the above exception tells us is that we started walking over temporary placeholder entries, but before we came to a real instruction, we ran out of instructions! This cannot happen, and indicates something went seriously wrong, we should always encounter an instruction when remapping off a temporary element. After some digging it is actually the remap() call for the handler (not the start or end) that leads to the problem. The handler represents where to jump to in the code when an exception of the specified type occurs between the instructions pointed at by start and end. I sent a debug build to a user encountering this problem (I could not recreate it) and in that I was looking at where in fact the handler was pointing before we called remap(). I learned that when this problem occurs, the handler is not pointing to anywhere in the method currently being processed (not good). In a second debug build I tried to ascertain who was setting these handlers to point to nowhere. This debug never triggered, no-one was setting them to point to nowhere... I happened to notice whilst going through the instructions in the debug output that cobertura was being used, a coverage toolkit that works by doing bytecode manipulation to insert calls out to a library. AspectJ was being called after cobertura and I asked the user to try the steps the other way round - it worked fine. Indicating cobertura was doing something to the bytecode that gave us problems. After much messing about, I recreated it by applying around advice to within(*) to all the classes in rt.jar (I just used that as a very large standalone jar file I could weave into). I learned that Cobertura creates catch blocks that look a little different to what javac and other compilers create. The typical bytecode sequence a compiler produces for a catch block starts with a STORE instruction, to store the exception being caught (whether the body of the catch block uses it or not). But the cobertura catch blocks started with an INVOKESTATIC instruction, a call out to another method. What does this mean? It means the same instruction has two shadows, a 'handler' shadow and a 'method-call' shadow - and it turns out this is what causes our problem. If around advice is applied to the call join point and it cannot be inlined then the body of the call shadow (the call itself) is pulled out into a new method. Because the handler was the same instruction, this meant the handler *was also being pulled out* into the new method, leaving behind an exception handler that jumped to an invalid location (in fact it 'jumped' to an instruction in a different method!). So the reason I never saw the handler location being set incorrectly is that it was set correctly up front, but then dragged out with the method-call shadow into the wrong place. In bytecode terms it looks like this: method-execution() | ICONST_0 | ISTORE_2 | SIPUSH -1 | ISTORE_3 | catch java.lang.Exception (1806389629) -> E0 | | method-call(ProjectData ProjectData.getGlobalProjectData()) | | | INVOKESTATIC ProjectData.getGlobalProjectData () | | method-call(ProjectData getGlobalProjectData()) | | LDC "SomeString" | | method-call(ClassData getOrCreateClassData(java.lang.String)) | | | INVOKEVIRTUAL ProjectData.getOrCreateClassData (LString;) | | method-call(ClassData ProjectData.getOrCreateClassData(String)) | | SIPUSH 106 | | method-call(void ClassData.touch(int)) | | | INVOKEVIRTUAL ClassData.touch (I)V | | method-call(void ClassData.touch(int)) | | ALOAD_1 | | method-call(Object Expression.getValue()) | | | INVOKEVIRTUAL Expression.getValue () | | method-call(Object Expression.getValue()) | catch java.lang.Exception (1806389629) -> E0 | ARETURN | method-call(nProjectData ProjectData.getGlobalProjectData()) | | E0: INVOKESTATIC ProjectData.getGlobalProjectData () | method-call(ProjectData ProjectData.getGlobalProjectData()) | LDC "Object" We can see the problem in that final method-call. The target for the exception handler seen earlier (E0) is within the method-call shadow. What to do?
resolved fixed
5f97d46
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2008-05-07T15:31:18Z
2008-05-07T03:13:20Z
weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java
print(new PrintStream(s),weaverVersion); return new String(s.toByteArray()); } public void print(WeaverVersionInfo weaverVersion) { print(System.out,weaverVersion); } public void print(PrintStream out, WeaverVersionInfo weaverVersion) { out.print(" " + toShortString()); printAspectAttributes(out,weaverVersion); InstructionList body = getBody(); if (body == null) { out.println(";"); return; } out.println(":"); new BodyPrinter(out).run(); out.println(" end " + toShortString()); } private void printAspectAttributes(PrintStream out, WeaverVersionInfo weaverVersion) { ISourceContext context = null; if (enclosingClass != null && enclosingClass.getType() != null) { context = enclosingClass.getType().getSourceContext(); } List as = BcelAttributes.readAjAttributes(getClassName(),attributes, context,null,weaverVersion); if (! as.isEmpty()) { out.println(" " + as.get(0)); } } private class BodyPrinter {
230,817
Bug 230817 LazyMethodGen.remap() NullPointerException
This has been reported a few times by different users, but has always proved tough to diagnose. The typical stack trace is something like: java.lang.NullPointerException org.aspectj.weaver.bcel.LazyMethodGen.remap(LazyMethodGen.java:1237) org.aspectj.weaver.bcel.LazyMethodGen.addExceptionHandlers(LazyMethodGen.java:1132) org.aspectj.weaver.bcel.LazyMethodGen.packBody(LazyMethodGen.java:1078) org.aspectj.weaver.bcel.LazyMethodGen.pack(LazyMethodGen.java:977) org.aspectj.weaver.bcel.LazyMethodGen.getMethod(LazyMethodGen.java:484) org.aspectj.weaver.bcel.LazyClassGen.writeBack(LazyClassGen.java:512) org.aspectj.weaver.bcel.LazyClassGen.getJavaClassBytesIncludingReweavable(LazyClassGen.java:652) org.aspectj.weaver.bcel.BcelWeaver.getClassFilesFor(BcelWeaver.java:1420) org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1390) And that is an exception on this line in remap() ih = ih.getNext(); called from the addExceptionHandlers() line: gen.addExceptionHandler( remap(r.getRealStart(), map), remap(r.getRealEnd(), map), remap(r.getHandler(), map), (r.getCatchType() == null) ? null : (ObjectType) BcelWorld.makeBcelType(r.getCatchType())); During weaving, an instruction list is augmented with extra entries representing where shadows start and end (method-call, method-execution, handler, etc). When weaving is complete we want to remove these temporary elements and use the remaining instructions to produce the method bytecode. Now sometimes these temporary entries are targeted by other elements (line number tags, local variable tags and exception handlers usually). During packing we use remap() to reposition the locations so they move off of temporary placeholders and onto real instructions that will make it out into the bytecode. What the above exception tells us is that we started walking over temporary placeholder entries, but before we came to a real instruction, we ran out of instructions! This cannot happen, and indicates something went seriously wrong, we should always encounter an instruction when remapping off a temporary element. After some digging it is actually the remap() call for the handler (not the start or end) that leads to the problem. The handler represents where to jump to in the code when an exception of the specified type occurs between the instructions pointed at by start and end. I sent a debug build to a user encountering this problem (I could not recreate it) and in that I was looking at where in fact the handler was pointing before we called remap(). I learned that when this problem occurs, the handler is not pointing to anywhere in the method currently being processed (not good). In a second debug build I tried to ascertain who was setting these handlers to point to nowhere. This debug never triggered, no-one was setting them to point to nowhere... I happened to notice whilst going through the instructions in the debug output that cobertura was being used, a coverage toolkit that works by doing bytecode manipulation to insert calls out to a library. AspectJ was being called after cobertura and I asked the user to try the steps the other way round - it worked fine. Indicating cobertura was doing something to the bytecode that gave us problems. After much messing about, I recreated it by applying around advice to within(*) to all the classes in rt.jar (I just used that as a very large standalone jar file I could weave into). I learned that Cobertura creates catch blocks that look a little different to what javac and other compilers create. The typical bytecode sequence a compiler produces for a catch block starts with a STORE instruction, to store the exception being caught (whether the body of the catch block uses it or not). But the cobertura catch blocks started with an INVOKESTATIC instruction, a call out to another method. What does this mean? It means the same instruction has two shadows, a 'handler' shadow and a 'method-call' shadow - and it turns out this is what causes our problem. If around advice is applied to the call join point and it cannot be inlined then the body of the call shadow (the call itself) is pulled out into a new method. Because the handler was the same instruction, this meant the handler *was also being pulled out* into the new method, leaving behind an exception handler that jumped to an invalid location (in fact it 'jumped' to an instruction in a different method!). So the reason I never saw the handler location being set incorrectly is that it was set correctly up front, but then dragged out with the method-call shadow into the wrong place. In bytecode terms it looks like this: method-execution() | ICONST_0 | ISTORE_2 | SIPUSH -1 | ISTORE_3 | catch java.lang.Exception (1806389629) -> E0 | | method-call(ProjectData ProjectData.getGlobalProjectData()) | | | INVOKESTATIC ProjectData.getGlobalProjectData () | | method-call(ProjectData getGlobalProjectData()) | | LDC "SomeString" | | method-call(ClassData getOrCreateClassData(java.lang.String)) | | | INVOKEVIRTUAL ProjectData.getOrCreateClassData (LString;) | | method-call(ClassData ProjectData.getOrCreateClassData(String)) | | SIPUSH 106 | | method-call(void ClassData.touch(int)) | | | INVOKEVIRTUAL ClassData.touch (I)V | | method-call(void ClassData.touch(int)) | | ALOAD_1 | | method-call(Object Expression.getValue()) | | | INVOKEVIRTUAL Expression.getValue () | | method-call(Object Expression.getValue()) | catch java.lang.Exception (1806389629) -> E0 | ARETURN | method-call(nProjectData ProjectData.getGlobalProjectData()) | | E0: INVOKESTATIC ProjectData.getGlobalProjectData () | method-call(ProjectData ProjectData.getGlobalProjectData()) | LDC "Object" We can see the problem in that final method-call. The target for the exception handler seen earlier (E0) is within the method-call shadow. What to do?
resolved fixed
5f97d46
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2008-05-07T15:31:18Z
2008-05-07T03:13:20Z
weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java
Map prefixMap = new HashMap(); Map suffixMap = new HashMap(); Map labelMap = new HashMap(); InstructionList body; PrintStream out; ConstantPool pool; List ranges; BodyPrinter(PrintStream out) { this.pool = enclosingClass.getConstantPoolGen().getConstantPool(); this.body = getBody(); this.out = out; } void run() { killNops(); assignLabels(); print(); } void assignLabels() { LinkedList exnTable = new LinkedList(); String pendingLabel = null; int lcounter = 0;
230,817
Bug 230817 LazyMethodGen.remap() NullPointerException
This has been reported a few times by different users, but has always proved tough to diagnose. The typical stack trace is something like: java.lang.NullPointerException org.aspectj.weaver.bcel.LazyMethodGen.remap(LazyMethodGen.java:1237) org.aspectj.weaver.bcel.LazyMethodGen.addExceptionHandlers(LazyMethodGen.java:1132) org.aspectj.weaver.bcel.LazyMethodGen.packBody(LazyMethodGen.java:1078) org.aspectj.weaver.bcel.LazyMethodGen.pack(LazyMethodGen.java:977) org.aspectj.weaver.bcel.LazyMethodGen.getMethod(LazyMethodGen.java:484) org.aspectj.weaver.bcel.LazyClassGen.writeBack(LazyClassGen.java:512) org.aspectj.weaver.bcel.LazyClassGen.getJavaClassBytesIncludingReweavable(LazyClassGen.java:652) org.aspectj.weaver.bcel.BcelWeaver.getClassFilesFor(BcelWeaver.java:1420) org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1390) And that is an exception on this line in remap() ih = ih.getNext(); called from the addExceptionHandlers() line: gen.addExceptionHandler( remap(r.getRealStart(), map), remap(r.getRealEnd(), map), remap(r.getHandler(), map), (r.getCatchType() == null) ? null : (ObjectType) BcelWorld.makeBcelType(r.getCatchType())); During weaving, an instruction list is augmented with extra entries representing where shadows start and end (method-call, method-execution, handler, etc). When weaving is complete we want to remove these temporary elements and use the remaining instructions to produce the method bytecode. Now sometimes these temporary entries are targeted by other elements (line number tags, local variable tags and exception handlers usually). During packing we use remap() to reposition the locations so they move off of temporary placeholders and onto real instructions that will make it out into the bytecode. What the above exception tells us is that we started walking over temporary placeholder entries, but before we came to a real instruction, we ran out of instructions! This cannot happen, and indicates something went seriously wrong, we should always encounter an instruction when remapping off a temporary element. After some digging it is actually the remap() call for the handler (not the start or end) that leads to the problem. The handler represents where to jump to in the code when an exception of the specified type occurs between the instructions pointed at by start and end. I sent a debug build to a user encountering this problem (I could not recreate it) and in that I was looking at where in fact the handler was pointing before we called remap(). I learned that when this problem occurs, the handler is not pointing to anywhere in the method currently being processed (not good). In a second debug build I tried to ascertain who was setting these handlers to point to nowhere. This debug never triggered, no-one was setting them to point to nowhere... I happened to notice whilst going through the instructions in the debug output that cobertura was being used, a coverage toolkit that works by doing bytecode manipulation to insert calls out to a library. AspectJ was being called after cobertura and I asked the user to try the steps the other way round - it worked fine. Indicating cobertura was doing something to the bytecode that gave us problems. After much messing about, I recreated it by applying around advice to within(*) to all the classes in rt.jar (I just used that as a very large standalone jar file I could weave into). I learned that Cobertura creates catch blocks that look a little different to what javac and other compilers create. The typical bytecode sequence a compiler produces for a catch block starts with a STORE instruction, to store the exception being caught (whether the body of the catch block uses it or not). But the cobertura catch blocks started with an INVOKESTATIC instruction, a call out to another method. What does this mean? It means the same instruction has two shadows, a 'handler' shadow and a 'method-call' shadow - and it turns out this is what causes our problem. If around advice is applied to the call join point and it cannot be inlined then the body of the call shadow (the call itself) is pulled out into a new method. Because the handler was the same instruction, this meant the handler *was also being pulled out* into the new method, leaving behind an exception handler that jumped to an invalid location (in fact it 'jumped' to an instruction in a different method!). So the reason I never saw the handler location being set incorrectly is that it was set correctly up front, but then dragged out with the method-call shadow into the wrong place. In bytecode terms it looks like this: method-execution() | ICONST_0 | ISTORE_2 | SIPUSH -1 | ISTORE_3 | catch java.lang.Exception (1806389629) -> E0 | | method-call(ProjectData ProjectData.getGlobalProjectData()) | | | INVOKESTATIC ProjectData.getGlobalProjectData () | | method-call(ProjectData getGlobalProjectData()) | | LDC "SomeString" | | method-call(ClassData getOrCreateClassData(java.lang.String)) | | | INVOKEVIRTUAL ProjectData.getOrCreateClassData (LString;) | | method-call(ClassData ProjectData.getOrCreateClassData(String)) | | SIPUSH 106 | | method-call(void ClassData.touch(int)) | | | INVOKEVIRTUAL ClassData.touch (I)V | | method-call(void ClassData.touch(int)) | | ALOAD_1 | | method-call(Object Expression.getValue()) | | | INVOKEVIRTUAL Expression.getValue () | | method-call(Object Expression.getValue()) | catch java.lang.Exception (1806389629) -> E0 | ARETURN | method-call(nProjectData ProjectData.getGlobalProjectData()) | | E0: INVOKESTATIC ProjectData.getGlobalProjectData () | method-call(ProjectData ProjectData.getGlobalProjectData()) | LDC "Object" We can see the problem in that final method-call. The target for the exception handler seen earlier (E0) is within the method-call shadow. What to do?
resolved fixed
5f97d46
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2008-05-07T15:31:18Z
2008-05-07T03:13:20Z
weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java
for (InstructionHandle ih = body.getStart(); ih != null; ih = ih.getNext()) { InstructionTargeter[] targeters = ih.getTargeters(); if (targeters != null) { for (int i = targeters.length - 1; i >= 0; i--) { InstructionTargeter t = targeters[i]; if (t instanceof ExceptionRange) { ExceptionRange r = (ExceptionRange) t; if (r.getStart() == ih) { insertHandler(r, exnTable); } } else if (t instanceof BranchInstruction) { if (pendingLabel == null) { pendingLabel = "L" + lcounter++; } } else { } } } if (pendingLabel != null) { labelMap.put(ih, pendingLabel); if (! Range.isRangeHandle(ih)) { pendingLabel = null; } } } int ecounter = 0; for (Iterator i = exnTable.iterator(); i.hasNext();) { ExceptionRange er = (ExceptionRange) i.next();
230,817
Bug 230817 LazyMethodGen.remap() NullPointerException
This has been reported a few times by different users, but has always proved tough to diagnose. The typical stack trace is something like: java.lang.NullPointerException org.aspectj.weaver.bcel.LazyMethodGen.remap(LazyMethodGen.java:1237) org.aspectj.weaver.bcel.LazyMethodGen.addExceptionHandlers(LazyMethodGen.java:1132) org.aspectj.weaver.bcel.LazyMethodGen.packBody(LazyMethodGen.java:1078) org.aspectj.weaver.bcel.LazyMethodGen.pack(LazyMethodGen.java:977) org.aspectj.weaver.bcel.LazyMethodGen.getMethod(LazyMethodGen.java:484) org.aspectj.weaver.bcel.LazyClassGen.writeBack(LazyClassGen.java:512) org.aspectj.weaver.bcel.LazyClassGen.getJavaClassBytesIncludingReweavable(LazyClassGen.java:652) org.aspectj.weaver.bcel.BcelWeaver.getClassFilesFor(BcelWeaver.java:1420) org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1390) And that is an exception on this line in remap() ih = ih.getNext(); called from the addExceptionHandlers() line: gen.addExceptionHandler( remap(r.getRealStart(), map), remap(r.getRealEnd(), map), remap(r.getHandler(), map), (r.getCatchType() == null) ? null : (ObjectType) BcelWorld.makeBcelType(r.getCatchType())); During weaving, an instruction list is augmented with extra entries representing where shadows start and end (method-call, method-execution, handler, etc). When weaving is complete we want to remove these temporary elements and use the remaining instructions to produce the method bytecode. Now sometimes these temporary entries are targeted by other elements (line number tags, local variable tags and exception handlers usually). During packing we use remap() to reposition the locations so they move off of temporary placeholders and onto real instructions that will make it out into the bytecode. What the above exception tells us is that we started walking over temporary placeholder entries, but before we came to a real instruction, we ran out of instructions! This cannot happen, and indicates something went seriously wrong, we should always encounter an instruction when remapping off a temporary element. After some digging it is actually the remap() call for the handler (not the start or end) that leads to the problem. The handler represents where to jump to in the code when an exception of the specified type occurs between the instructions pointed at by start and end. I sent a debug build to a user encountering this problem (I could not recreate it) and in that I was looking at where in fact the handler was pointing before we called remap(). I learned that when this problem occurs, the handler is not pointing to anywhere in the method currently being processed (not good). In a second debug build I tried to ascertain who was setting these handlers to point to nowhere. This debug never triggered, no-one was setting them to point to nowhere... I happened to notice whilst going through the instructions in the debug output that cobertura was being used, a coverage toolkit that works by doing bytecode manipulation to insert calls out to a library. AspectJ was being called after cobertura and I asked the user to try the steps the other way round - it worked fine. Indicating cobertura was doing something to the bytecode that gave us problems. After much messing about, I recreated it by applying around advice to within(*) to all the classes in rt.jar (I just used that as a very large standalone jar file I could weave into). I learned that Cobertura creates catch blocks that look a little different to what javac and other compilers create. The typical bytecode sequence a compiler produces for a catch block starts with a STORE instruction, to store the exception being caught (whether the body of the catch block uses it or not). But the cobertura catch blocks started with an INVOKESTATIC instruction, a call out to another method. What does this mean? It means the same instruction has two shadows, a 'handler' shadow and a 'method-call' shadow - and it turns out this is what causes our problem. If around advice is applied to the call join point and it cannot be inlined then the body of the call shadow (the call itself) is pulled out into a new method. Because the handler was the same instruction, this meant the handler *was also being pulled out* into the new method, leaving behind an exception handler that jumped to an invalid location (in fact it 'jumped' to an instruction in a different method!). So the reason I never saw the handler location being set incorrectly is that it was set correctly up front, but then dragged out with the method-call shadow into the wrong place. In bytecode terms it looks like this: method-execution() | ICONST_0 | ISTORE_2 | SIPUSH -1 | ISTORE_3 | catch java.lang.Exception (1806389629) -> E0 | | method-call(ProjectData ProjectData.getGlobalProjectData()) | | | INVOKESTATIC ProjectData.getGlobalProjectData () | | method-call(ProjectData getGlobalProjectData()) | | LDC "SomeString" | | method-call(ClassData getOrCreateClassData(java.lang.String)) | | | INVOKEVIRTUAL ProjectData.getOrCreateClassData (LString;) | | method-call(ClassData ProjectData.getOrCreateClassData(String)) | | SIPUSH 106 | | method-call(void ClassData.touch(int)) | | | INVOKEVIRTUAL ClassData.touch (I)V | | method-call(void ClassData.touch(int)) | | ALOAD_1 | | method-call(Object Expression.getValue()) | | | INVOKEVIRTUAL Expression.getValue () | | method-call(Object Expression.getValue()) | catch java.lang.Exception (1806389629) -> E0 | ARETURN | method-call(nProjectData ProjectData.getGlobalProjectData()) | | E0: INVOKESTATIC ProjectData.getGlobalProjectData () | method-call(ProjectData ProjectData.getGlobalProjectData()) | LDC "Object" We can see the problem in that final method-call. The target for the exception handler seen earlier (E0) is within the method-call shadow. What to do?
resolved fixed
5f97d46
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2008-05-07T15:31:18Z
2008-05-07T03:13:20Z
weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java
String exceptionLabel = "E" + ecounter++; labelMap.put(Range.getRealStart(er.getHandler()), exceptionLabel); labelMap.put(er.getHandler(), exceptionLabel); } } printing void print() { int depth = 0; int currLine = -1; bodyPrint: for (InstructionHandle ih = body.getStart(); ih != null; ih = ih.getNext()) { if (Range.isRangeHandle(ih)) { Range r = Range.getRange(ih); for (InstructionHandle xx = r.getStart(); Range.isRangeHandle(xx); xx = xx.getNext()) { if (xx == r.getEnd()) continue bodyPrint; } if (r.getStart() == ih) { printRangeString(r, depth++); } else { if (r.getEnd() != ih) throw new RuntimeException("bad"); printRangeString(r, --depth); } } else { printInstruction(ih, depth); int line = getLineNumber(ih, currLine); if (line != currLine) { currLine = line;
230,817
Bug 230817 LazyMethodGen.remap() NullPointerException
This has been reported a few times by different users, but has always proved tough to diagnose. The typical stack trace is something like: java.lang.NullPointerException org.aspectj.weaver.bcel.LazyMethodGen.remap(LazyMethodGen.java:1237) org.aspectj.weaver.bcel.LazyMethodGen.addExceptionHandlers(LazyMethodGen.java:1132) org.aspectj.weaver.bcel.LazyMethodGen.packBody(LazyMethodGen.java:1078) org.aspectj.weaver.bcel.LazyMethodGen.pack(LazyMethodGen.java:977) org.aspectj.weaver.bcel.LazyMethodGen.getMethod(LazyMethodGen.java:484) org.aspectj.weaver.bcel.LazyClassGen.writeBack(LazyClassGen.java:512) org.aspectj.weaver.bcel.LazyClassGen.getJavaClassBytesIncludingReweavable(LazyClassGen.java:652) org.aspectj.weaver.bcel.BcelWeaver.getClassFilesFor(BcelWeaver.java:1420) org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1390) And that is an exception on this line in remap() ih = ih.getNext(); called from the addExceptionHandlers() line: gen.addExceptionHandler( remap(r.getRealStart(), map), remap(r.getRealEnd(), map), remap(r.getHandler(), map), (r.getCatchType() == null) ? null : (ObjectType) BcelWorld.makeBcelType(r.getCatchType())); During weaving, an instruction list is augmented with extra entries representing where shadows start and end (method-call, method-execution, handler, etc). When weaving is complete we want to remove these temporary elements and use the remaining instructions to produce the method bytecode. Now sometimes these temporary entries are targeted by other elements (line number tags, local variable tags and exception handlers usually). During packing we use remap() to reposition the locations so they move off of temporary placeholders and onto real instructions that will make it out into the bytecode. What the above exception tells us is that we started walking over temporary placeholder entries, but before we came to a real instruction, we ran out of instructions! This cannot happen, and indicates something went seriously wrong, we should always encounter an instruction when remapping off a temporary element. After some digging it is actually the remap() call for the handler (not the start or end) that leads to the problem. The handler represents where to jump to in the code when an exception of the specified type occurs between the instructions pointed at by start and end. I sent a debug build to a user encountering this problem (I could not recreate it) and in that I was looking at where in fact the handler was pointing before we called remap(). I learned that when this problem occurs, the handler is not pointing to anywhere in the method currently being processed (not good). In a second debug build I tried to ascertain who was setting these handlers to point to nowhere. This debug never triggered, no-one was setting them to point to nowhere... I happened to notice whilst going through the instructions in the debug output that cobertura was being used, a coverage toolkit that works by doing bytecode manipulation to insert calls out to a library. AspectJ was being called after cobertura and I asked the user to try the steps the other way round - it worked fine. Indicating cobertura was doing something to the bytecode that gave us problems. After much messing about, I recreated it by applying around advice to within(*) to all the classes in rt.jar (I just used that as a very large standalone jar file I could weave into). I learned that Cobertura creates catch blocks that look a little different to what javac and other compilers create. The typical bytecode sequence a compiler produces for a catch block starts with a STORE instruction, to store the exception being caught (whether the body of the catch block uses it or not). But the cobertura catch blocks started with an INVOKESTATIC instruction, a call out to another method. What does this mean? It means the same instruction has two shadows, a 'handler' shadow and a 'method-call' shadow - and it turns out this is what causes our problem. If around advice is applied to the call join point and it cannot be inlined then the body of the call shadow (the call itself) is pulled out into a new method. Because the handler was the same instruction, this meant the handler *was also being pulled out* into the new method, leaving behind an exception handler that jumped to an invalid location (in fact it 'jumped' to an instruction in a different method!). So the reason I never saw the handler location being set incorrectly is that it was set correctly up front, but then dragged out with the method-call shadow into the wrong place. In bytecode terms it looks like this: method-execution() | ICONST_0 | ISTORE_2 | SIPUSH -1 | ISTORE_3 | catch java.lang.Exception (1806389629) -> E0 | | method-call(ProjectData ProjectData.getGlobalProjectData()) | | | INVOKESTATIC ProjectData.getGlobalProjectData () | | method-call(ProjectData getGlobalProjectData()) | | LDC "SomeString" | | method-call(ClassData getOrCreateClassData(java.lang.String)) | | | INVOKEVIRTUAL ProjectData.getOrCreateClassData (LString;) | | method-call(ClassData ProjectData.getOrCreateClassData(String)) | | SIPUSH 106 | | method-call(void ClassData.touch(int)) | | | INVOKEVIRTUAL ClassData.touch (I)V | | method-call(void ClassData.touch(int)) | | ALOAD_1 | | method-call(Object Expression.getValue()) | | | INVOKEVIRTUAL Expression.getValue () | | method-call(Object Expression.getValue()) | catch java.lang.Exception (1806389629) -> E0 | ARETURN | method-call(nProjectData ProjectData.getGlobalProjectData()) | | E0: INVOKESTATIC ProjectData.getGlobalProjectData () | method-call(ProjectData ProjectData.getGlobalProjectData()) | LDC "Object" We can see the problem in that final method-call. The target for the exception handler seen earlier (E0) is within the method-call shadow. What to do?
resolved fixed
5f97d46
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2008-05-07T15:31:18Z
2008-05-07T03:13:20Z
weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java
out.println(" (line " + line + ")"); } else { out.println(); } } } } void printRangeString(Range r, int depth) { printDepth(depth); out.println(getRangeString(r, labelMap)); } String getRangeString(Range r, Map labelMap) { if (r instanceof ExceptionRange) { ExceptionRange er = (ExceptionRange) r; return er.toString() + " -> " + labelMap.get(er.getHandler()); } else { return r.toString(); } } void printDepth(int depth) { pad(BODY_INDENT); while (depth > 0) { out.print("| "); depth--; } }
230,817
Bug 230817 LazyMethodGen.remap() NullPointerException
This has been reported a few times by different users, but has always proved tough to diagnose. The typical stack trace is something like: java.lang.NullPointerException org.aspectj.weaver.bcel.LazyMethodGen.remap(LazyMethodGen.java:1237) org.aspectj.weaver.bcel.LazyMethodGen.addExceptionHandlers(LazyMethodGen.java:1132) org.aspectj.weaver.bcel.LazyMethodGen.packBody(LazyMethodGen.java:1078) org.aspectj.weaver.bcel.LazyMethodGen.pack(LazyMethodGen.java:977) org.aspectj.weaver.bcel.LazyMethodGen.getMethod(LazyMethodGen.java:484) org.aspectj.weaver.bcel.LazyClassGen.writeBack(LazyClassGen.java:512) org.aspectj.weaver.bcel.LazyClassGen.getJavaClassBytesIncludingReweavable(LazyClassGen.java:652) org.aspectj.weaver.bcel.BcelWeaver.getClassFilesFor(BcelWeaver.java:1420) org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1390) And that is an exception on this line in remap() ih = ih.getNext(); called from the addExceptionHandlers() line: gen.addExceptionHandler( remap(r.getRealStart(), map), remap(r.getRealEnd(), map), remap(r.getHandler(), map), (r.getCatchType() == null) ? null : (ObjectType) BcelWorld.makeBcelType(r.getCatchType())); During weaving, an instruction list is augmented with extra entries representing where shadows start and end (method-call, method-execution, handler, etc). When weaving is complete we want to remove these temporary elements and use the remaining instructions to produce the method bytecode. Now sometimes these temporary entries are targeted by other elements (line number tags, local variable tags and exception handlers usually). During packing we use remap() to reposition the locations so they move off of temporary placeholders and onto real instructions that will make it out into the bytecode. What the above exception tells us is that we started walking over temporary placeholder entries, but before we came to a real instruction, we ran out of instructions! This cannot happen, and indicates something went seriously wrong, we should always encounter an instruction when remapping off a temporary element. After some digging it is actually the remap() call for the handler (not the start or end) that leads to the problem. The handler represents where to jump to in the code when an exception of the specified type occurs between the instructions pointed at by start and end. I sent a debug build to a user encountering this problem (I could not recreate it) and in that I was looking at where in fact the handler was pointing before we called remap(). I learned that when this problem occurs, the handler is not pointing to anywhere in the method currently being processed (not good). In a second debug build I tried to ascertain who was setting these handlers to point to nowhere. This debug never triggered, no-one was setting them to point to nowhere... I happened to notice whilst going through the instructions in the debug output that cobertura was being used, a coverage toolkit that works by doing bytecode manipulation to insert calls out to a library. AspectJ was being called after cobertura and I asked the user to try the steps the other way round - it worked fine. Indicating cobertura was doing something to the bytecode that gave us problems. After much messing about, I recreated it by applying around advice to within(*) to all the classes in rt.jar (I just used that as a very large standalone jar file I could weave into). I learned that Cobertura creates catch blocks that look a little different to what javac and other compilers create. The typical bytecode sequence a compiler produces for a catch block starts with a STORE instruction, to store the exception being caught (whether the body of the catch block uses it or not). But the cobertura catch blocks started with an INVOKESTATIC instruction, a call out to another method. What does this mean? It means the same instruction has two shadows, a 'handler' shadow and a 'method-call' shadow - and it turns out this is what causes our problem. If around advice is applied to the call join point and it cannot be inlined then the body of the call shadow (the call itself) is pulled out into a new method. Because the handler was the same instruction, this meant the handler *was also being pulled out* into the new method, leaving behind an exception handler that jumped to an invalid location (in fact it 'jumped' to an instruction in a different method!). So the reason I never saw the handler location being set incorrectly is that it was set correctly up front, but then dragged out with the method-call shadow into the wrong place. In bytecode terms it looks like this: method-execution() | ICONST_0 | ISTORE_2 | SIPUSH -1 | ISTORE_3 | catch java.lang.Exception (1806389629) -> E0 | | method-call(ProjectData ProjectData.getGlobalProjectData()) | | | INVOKESTATIC ProjectData.getGlobalProjectData () | | method-call(ProjectData getGlobalProjectData()) | | LDC "SomeString" | | method-call(ClassData getOrCreateClassData(java.lang.String)) | | | INVOKEVIRTUAL ProjectData.getOrCreateClassData (LString;) | | method-call(ClassData ProjectData.getOrCreateClassData(String)) | | SIPUSH 106 | | method-call(void ClassData.touch(int)) | | | INVOKEVIRTUAL ClassData.touch (I)V | | method-call(void ClassData.touch(int)) | | ALOAD_1 | | method-call(Object Expression.getValue()) | | | INVOKEVIRTUAL Expression.getValue () | | method-call(Object Expression.getValue()) | catch java.lang.Exception (1806389629) -> E0 | ARETURN | method-call(nProjectData ProjectData.getGlobalProjectData()) | | E0: INVOKESTATIC ProjectData.getGlobalProjectData () | method-call(ProjectData ProjectData.getGlobalProjectData()) | LDC "Object" We can see the problem in that final method-call. The target for the exception handler seen earlier (E0) is within the method-call shadow. What to do?
resolved fixed
5f97d46
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2008-05-07T15:31:18Z
2008-05-07T03:13:20Z
weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java
void printLabel(String s, int depth) { int space = Math.max(CODE_INDENT - depth * 2, 0); if (s == null) { pad(space); } else { space = Math.max(space - (s.length() + 2), 0); pad(space); out.print(s); out.print(": "); } } void printInstruction(InstructionHandle h, int depth) { printDepth(depth); printLabel((String) labelMap.get(h), depth); Instruction inst = h.getInstruction(); if (inst instanceof CPInstruction) { CPInstruction cpinst = (CPInstruction) inst; out.print(Constants.OPCODE_NAMES[cpinst.getOpcode()].toUpperCase()); out.print(" "); out.print(pool.constantToString(pool.getConstant(cpinst.getIndex()))); } else if (inst instanceof Select) { Select sinst = (Select) inst; out.println(Constants.OPCODE_NAMES[sinst.getOpcode()].toUpperCase()); int[] matches = sinst.getMatchs(); InstructionHandle[] targets = sinst.getTargets(); InstructionHandle defaultTarget = sinst.getTarget(); for (int i = 0, len = matches.length; i < len; i++) { printDepth(depth); printLabel(null, depth);
230,817
Bug 230817 LazyMethodGen.remap() NullPointerException
This has been reported a few times by different users, but has always proved tough to diagnose. The typical stack trace is something like: java.lang.NullPointerException org.aspectj.weaver.bcel.LazyMethodGen.remap(LazyMethodGen.java:1237) org.aspectj.weaver.bcel.LazyMethodGen.addExceptionHandlers(LazyMethodGen.java:1132) org.aspectj.weaver.bcel.LazyMethodGen.packBody(LazyMethodGen.java:1078) org.aspectj.weaver.bcel.LazyMethodGen.pack(LazyMethodGen.java:977) org.aspectj.weaver.bcel.LazyMethodGen.getMethod(LazyMethodGen.java:484) org.aspectj.weaver.bcel.LazyClassGen.writeBack(LazyClassGen.java:512) org.aspectj.weaver.bcel.LazyClassGen.getJavaClassBytesIncludingReweavable(LazyClassGen.java:652) org.aspectj.weaver.bcel.BcelWeaver.getClassFilesFor(BcelWeaver.java:1420) org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1390) And that is an exception on this line in remap() ih = ih.getNext(); called from the addExceptionHandlers() line: gen.addExceptionHandler( remap(r.getRealStart(), map), remap(r.getRealEnd(), map), remap(r.getHandler(), map), (r.getCatchType() == null) ? null : (ObjectType) BcelWorld.makeBcelType(r.getCatchType())); During weaving, an instruction list is augmented with extra entries representing where shadows start and end (method-call, method-execution, handler, etc). When weaving is complete we want to remove these temporary elements and use the remaining instructions to produce the method bytecode. Now sometimes these temporary entries are targeted by other elements (line number tags, local variable tags and exception handlers usually). During packing we use remap() to reposition the locations so they move off of temporary placeholders and onto real instructions that will make it out into the bytecode. What the above exception tells us is that we started walking over temporary placeholder entries, but before we came to a real instruction, we ran out of instructions! This cannot happen, and indicates something went seriously wrong, we should always encounter an instruction when remapping off a temporary element. After some digging it is actually the remap() call for the handler (not the start or end) that leads to the problem. The handler represents where to jump to in the code when an exception of the specified type occurs between the instructions pointed at by start and end. I sent a debug build to a user encountering this problem (I could not recreate it) and in that I was looking at where in fact the handler was pointing before we called remap(). I learned that when this problem occurs, the handler is not pointing to anywhere in the method currently being processed (not good). In a second debug build I tried to ascertain who was setting these handlers to point to nowhere. This debug never triggered, no-one was setting them to point to nowhere... I happened to notice whilst going through the instructions in the debug output that cobertura was being used, a coverage toolkit that works by doing bytecode manipulation to insert calls out to a library. AspectJ was being called after cobertura and I asked the user to try the steps the other way round - it worked fine. Indicating cobertura was doing something to the bytecode that gave us problems. After much messing about, I recreated it by applying around advice to within(*) to all the classes in rt.jar (I just used that as a very large standalone jar file I could weave into). I learned that Cobertura creates catch blocks that look a little different to what javac and other compilers create. The typical bytecode sequence a compiler produces for a catch block starts with a STORE instruction, to store the exception being caught (whether the body of the catch block uses it or not). But the cobertura catch blocks started with an INVOKESTATIC instruction, a call out to another method. What does this mean? It means the same instruction has two shadows, a 'handler' shadow and a 'method-call' shadow - and it turns out this is what causes our problem. If around advice is applied to the call join point and it cannot be inlined then the body of the call shadow (the call itself) is pulled out into a new method. Because the handler was the same instruction, this meant the handler *was also being pulled out* into the new method, leaving behind an exception handler that jumped to an invalid location (in fact it 'jumped' to an instruction in a different method!). So the reason I never saw the handler location being set incorrectly is that it was set correctly up front, but then dragged out with the method-call shadow into the wrong place. In bytecode terms it looks like this: method-execution() | ICONST_0 | ISTORE_2 | SIPUSH -1 | ISTORE_3 | catch java.lang.Exception (1806389629) -> E0 | | method-call(ProjectData ProjectData.getGlobalProjectData()) | | | INVOKESTATIC ProjectData.getGlobalProjectData () | | method-call(ProjectData getGlobalProjectData()) | | LDC "SomeString" | | method-call(ClassData getOrCreateClassData(java.lang.String)) | | | INVOKEVIRTUAL ProjectData.getOrCreateClassData (LString;) | | method-call(ClassData ProjectData.getOrCreateClassData(String)) | | SIPUSH 106 | | method-call(void ClassData.touch(int)) | | | INVOKEVIRTUAL ClassData.touch (I)V | | method-call(void ClassData.touch(int)) | | ALOAD_1 | | method-call(Object Expression.getValue()) | | | INVOKEVIRTUAL Expression.getValue () | | method-call(Object Expression.getValue()) | catch java.lang.Exception (1806389629) -> E0 | ARETURN | method-call(nProjectData ProjectData.getGlobalProjectData()) | | E0: INVOKESTATIC ProjectData.getGlobalProjectData () | method-call(ProjectData ProjectData.getGlobalProjectData()) | LDC "Object" We can see the problem in that final method-call. The target for the exception handler seen earlier (E0) is within the method-call shadow. What to do?
resolved fixed
5f97d46
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2008-05-07T15:31:18Z
2008-05-07T03:13:20Z
weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java
out.print(" "); out.print(matches[i]); out.print(": \t"); out.println(labelMap.get(targets[i])); } printDepth(depth); printLabel(null, depth); out.print(" "); out.print("default: \t"); out.print(labelMap.get(defaultTarget)); } else if (inst instanceof BranchInstruction) { BranchInstruction brinst = (BranchInstruction) inst; out.print(Constants.OPCODE_NAMES[brinst.getOpcode()].toUpperCase()); out.print(" "); out.print(labelMap.get(brinst.getTarget())); } else if (inst instanceof LocalVariableInstruction) { LocalVariableInstruction lvinst = (LocalVariableInstruction) inst; out.print(inst.toString(false).toUpperCase()); int index = lvinst.getIndex(); LocalVariableTag tag = getLocalVariableTag(h, index); if (tag != null) { out.print(" "); out.print(tag.getType()); out.print(" "); out.print(tag.getName()); } } else { out.print(inst.toString(false).toUpperCase()); } }
230,817
Bug 230817 LazyMethodGen.remap() NullPointerException
This has been reported a few times by different users, but has always proved tough to diagnose. The typical stack trace is something like: java.lang.NullPointerException org.aspectj.weaver.bcel.LazyMethodGen.remap(LazyMethodGen.java:1237) org.aspectj.weaver.bcel.LazyMethodGen.addExceptionHandlers(LazyMethodGen.java:1132) org.aspectj.weaver.bcel.LazyMethodGen.packBody(LazyMethodGen.java:1078) org.aspectj.weaver.bcel.LazyMethodGen.pack(LazyMethodGen.java:977) org.aspectj.weaver.bcel.LazyMethodGen.getMethod(LazyMethodGen.java:484) org.aspectj.weaver.bcel.LazyClassGen.writeBack(LazyClassGen.java:512) org.aspectj.weaver.bcel.LazyClassGen.getJavaClassBytesIncludingReweavable(LazyClassGen.java:652) org.aspectj.weaver.bcel.BcelWeaver.getClassFilesFor(BcelWeaver.java:1420) org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1390) And that is an exception on this line in remap() ih = ih.getNext(); called from the addExceptionHandlers() line: gen.addExceptionHandler( remap(r.getRealStart(), map), remap(r.getRealEnd(), map), remap(r.getHandler(), map), (r.getCatchType() == null) ? null : (ObjectType) BcelWorld.makeBcelType(r.getCatchType())); During weaving, an instruction list is augmented with extra entries representing where shadows start and end (method-call, method-execution, handler, etc). When weaving is complete we want to remove these temporary elements and use the remaining instructions to produce the method bytecode. Now sometimes these temporary entries are targeted by other elements (line number tags, local variable tags and exception handlers usually). During packing we use remap() to reposition the locations so they move off of temporary placeholders and onto real instructions that will make it out into the bytecode. What the above exception tells us is that we started walking over temporary placeholder entries, but before we came to a real instruction, we ran out of instructions! This cannot happen, and indicates something went seriously wrong, we should always encounter an instruction when remapping off a temporary element. After some digging it is actually the remap() call for the handler (not the start or end) that leads to the problem. The handler represents where to jump to in the code when an exception of the specified type occurs between the instructions pointed at by start and end. I sent a debug build to a user encountering this problem (I could not recreate it) and in that I was looking at where in fact the handler was pointing before we called remap(). I learned that when this problem occurs, the handler is not pointing to anywhere in the method currently being processed (not good). In a second debug build I tried to ascertain who was setting these handlers to point to nowhere. This debug never triggered, no-one was setting them to point to nowhere... I happened to notice whilst going through the instructions in the debug output that cobertura was being used, a coverage toolkit that works by doing bytecode manipulation to insert calls out to a library. AspectJ was being called after cobertura and I asked the user to try the steps the other way round - it worked fine. Indicating cobertura was doing something to the bytecode that gave us problems. After much messing about, I recreated it by applying around advice to within(*) to all the classes in rt.jar (I just used that as a very large standalone jar file I could weave into). I learned that Cobertura creates catch blocks that look a little different to what javac and other compilers create. The typical bytecode sequence a compiler produces for a catch block starts with a STORE instruction, to store the exception being caught (whether the body of the catch block uses it or not). But the cobertura catch blocks started with an INVOKESTATIC instruction, a call out to another method. What does this mean? It means the same instruction has two shadows, a 'handler' shadow and a 'method-call' shadow - and it turns out this is what causes our problem. If around advice is applied to the call join point and it cannot be inlined then the body of the call shadow (the call itself) is pulled out into a new method. Because the handler was the same instruction, this meant the handler *was also being pulled out* into the new method, leaving behind an exception handler that jumped to an invalid location (in fact it 'jumped' to an instruction in a different method!). So the reason I never saw the handler location being set incorrectly is that it was set correctly up front, but then dragged out with the method-call shadow into the wrong place. In bytecode terms it looks like this: method-execution() | ICONST_0 | ISTORE_2 | SIPUSH -1 | ISTORE_3 | catch java.lang.Exception (1806389629) -> E0 | | method-call(ProjectData ProjectData.getGlobalProjectData()) | | | INVOKESTATIC ProjectData.getGlobalProjectData () | | method-call(ProjectData getGlobalProjectData()) | | LDC "SomeString" | | method-call(ClassData getOrCreateClassData(java.lang.String)) | | | INVOKEVIRTUAL ProjectData.getOrCreateClassData (LString;) | | method-call(ClassData ProjectData.getOrCreateClassData(String)) | | SIPUSH 106 | | method-call(void ClassData.touch(int)) | | | INVOKEVIRTUAL ClassData.touch (I)V | | method-call(void ClassData.touch(int)) | | ALOAD_1 | | method-call(Object Expression.getValue()) | | | INVOKEVIRTUAL Expression.getValue () | | method-call(Object Expression.getValue()) | catch java.lang.Exception (1806389629) -> E0 | ARETURN | method-call(nProjectData ProjectData.getGlobalProjectData()) | | E0: INVOKESTATIC ProjectData.getGlobalProjectData () | method-call(ProjectData ProjectData.getGlobalProjectData()) | LDC "Object" We can see the problem in that final method-call. The target for the exception handler seen earlier (E0) is within the method-call shadow. What to do?
resolved fixed
5f97d46
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2008-05-07T15:31:18Z
2008-05-07T03:13:20Z
weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java
static final int BODY_INDENT = 4; static final int CODE_INDENT = 16; void pad(int size) { for (int i = 0; i < size; i++) { out.print(" "); } } } static LocalVariableTag getLocalVariableTag( InstructionHandle ih, int index) { InstructionTargeter[] targeters = ih.getTargeters(); if (targeters == null) return null; for (int i = targeters.length - 1; i >= 0; i--) { InstructionTargeter t = targeters[i]; if (t instanceof LocalVariableTag) { LocalVariableTag lvt = (LocalVariableTag) t; if (lvt.getSlot() == index) return lvt; } } return null; } static int getLineNumber( InstructionHandle ih, int prevLine) { InstructionTargeter[] targeters = ih.getTargeters(); if (targeters == null) return prevLine;
230,817
Bug 230817 LazyMethodGen.remap() NullPointerException
This has been reported a few times by different users, but has always proved tough to diagnose. The typical stack trace is something like: java.lang.NullPointerException org.aspectj.weaver.bcel.LazyMethodGen.remap(LazyMethodGen.java:1237) org.aspectj.weaver.bcel.LazyMethodGen.addExceptionHandlers(LazyMethodGen.java:1132) org.aspectj.weaver.bcel.LazyMethodGen.packBody(LazyMethodGen.java:1078) org.aspectj.weaver.bcel.LazyMethodGen.pack(LazyMethodGen.java:977) org.aspectj.weaver.bcel.LazyMethodGen.getMethod(LazyMethodGen.java:484) org.aspectj.weaver.bcel.LazyClassGen.writeBack(LazyClassGen.java:512) org.aspectj.weaver.bcel.LazyClassGen.getJavaClassBytesIncludingReweavable(LazyClassGen.java:652) org.aspectj.weaver.bcel.BcelWeaver.getClassFilesFor(BcelWeaver.java:1420) org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1390) And that is an exception on this line in remap() ih = ih.getNext(); called from the addExceptionHandlers() line: gen.addExceptionHandler( remap(r.getRealStart(), map), remap(r.getRealEnd(), map), remap(r.getHandler(), map), (r.getCatchType() == null) ? null : (ObjectType) BcelWorld.makeBcelType(r.getCatchType())); During weaving, an instruction list is augmented with extra entries representing where shadows start and end (method-call, method-execution, handler, etc). When weaving is complete we want to remove these temporary elements and use the remaining instructions to produce the method bytecode. Now sometimes these temporary entries are targeted by other elements (line number tags, local variable tags and exception handlers usually). During packing we use remap() to reposition the locations so they move off of temporary placeholders and onto real instructions that will make it out into the bytecode. What the above exception tells us is that we started walking over temporary placeholder entries, but before we came to a real instruction, we ran out of instructions! This cannot happen, and indicates something went seriously wrong, we should always encounter an instruction when remapping off a temporary element. After some digging it is actually the remap() call for the handler (not the start or end) that leads to the problem. The handler represents where to jump to in the code when an exception of the specified type occurs between the instructions pointed at by start and end. I sent a debug build to a user encountering this problem (I could not recreate it) and in that I was looking at where in fact the handler was pointing before we called remap(). I learned that when this problem occurs, the handler is not pointing to anywhere in the method currently being processed (not good). In a second debug build I tried to ascertain who was setting these handlers to point to nowhere. This debug never triggered, no-one was setting them to point to nowhere... I happened to notice whilst going through the instructions in the debug output that cobertura was being used, a coverage toolkit that works by doing bytecode manipulation to insert calls out to a library. AspectJ was being called after cobertura and I asked the user to try the steps the other way round - it worked fine. Indicating cobertura was doing something to the bytecode that gave us problems. After much messing about, I recreated it by applying around advice to within(*) to all the classes in rt.jar (I just used that as a very large standalone jar file I could weave into). I learned that Cobertura creates catch blocks that look a little different to what javac and other compilers create. The typical bytecode sequence a compiler produces for a catch block starts with a STORE instruction, to store the exception being caught (whether the body of the catch block uses it or not). But the cobertura catch blocks started with an INVOKESTATIC instruction, a call out to another method. What does this mean? It means the same instruction has two shadows, a 'handler' shadow and a 'method-call' shadow - and it turns out this is what causes our problem. If around advice is applied to the call join point and it cannot be inlined then the body of the call shadow (the call itself) is pulled out into a new method. Because the handler was the same instruction, this meant the handler *was also being pulled out* into the new method, leaving behind an exception handler that jumped to an invalid location (in fact it 'jumped' to an instruction in a different method!). So the reason I never saw the handler location being set incorrectly is that it was set correctly up front, but then dragged out with the method-call shadow into the wrong place. In bytecode terms it looks like this: method-execution() | ICONST_0 | ISTORE_2 | SIPUSH -1 | ISTORE_3 | catch java.lang.Exception (1806389629) -> E0 | | method-call(ProjectData ProjectData.getGlobalProjectData()) | | | INVOKESTATIC ProjectData.getGlobalProjectData () | | method-call(ProjectData getGlobalProjectData()) | | LDC "SomeString" | | method-call(ClassData getOrCreateClassData(java.lang.String)) | | | INVOKEVIRTUAL ProjectData.getOrCreateClassData (LString;) | | method-call(ClassData ProjectData.getOrCreateClassData(String)) | | SIPUSH 106 | | method-call(void ClassData.touch(int)) | | | INVOKEVIRTUAL ClassData.touch (I)V | | method-call(void ClassData.touch(int)) | | ALOAD_1 | | method-call(Object Expression.getValue()) | | | INVOKEVIRTUAL Expression.getValue () | | method-call(Object Expression.getValue()) | catch java.lang.Exception (1806389629) -> E0 | ARETURN | method-call(nProjectData ProjectData.getGlobalProjectData()) | | E0: INVOKESTATIC ProjectData.getGlobalProjectData () | method-call(ProjectData ProjectData.getGlobalProjectData()) | LDC "Object" We can see the problem in that final method-call. The target for the exception handler seen earlier (E0) is within the method-call shadow. What to do?
resolved fixed
5f97d46
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2008-05-07T15:31:18Z
2008-05-07T03:13:20Z
weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java
for (int i = targeters.length - 1; i >= 0; i--) { InstructionTargeter t = targeters[i]; if (t instanceof LineNumberTag) { return ((LineNumberTag)t).getLineNumber(); } } return prevLine; } public boolean isStatic() { return Modifier.isStatic(getAccessFlags()); } public boolean isAbstract() { return Modifier.isAbstract(getAccessFlags()); } public boolean isBridgeMethod() { return (getAccessFlags() & Constants.ACC_BRIDGE) != 0; } public void addExceptionHandler( InstructionHandle start, InstructionHandle end, InstructionHandle handlerStart, ObjectType catchType, boolean highPriority) { InstructionHandle start1 = Range.genStart(body, start); InstructionHandle end1 = Range.genEnd(body, end);
230,817
Bug 230817 LazyMethodGen.remap() NullPointerException
This has been reported a few times by different users, but has always proved tough to diagnose. The typical stack trace is something like: java.lang.NullPointerException org.aspectj.weaver.bcel.LazyMethodGen.remap(LazyMethodGen.java:1237) org.aspectj.weaver.bcel.LazyMethodGen.addExceptionHandlers(LazyMethodGen.java:1132) org.aspectj.weaver.bcel.LazyMethodGen.packBody(LazyMethodGen.java:1078) org.aspectj.weaver.bcel.LazyMethodGen.pack(LazyMethodGen.java:977) org.aspectj.weaver.bcel.LazyMethodGen.getMethod(LazyMethodGen.java:484) org.aspectj.weaver.bcel.LazyClassGen.writeBack(LazyClassGen.java:512) org.aspectj.weaver.bcel.LazyClassGen.getJavaClassBytesIncludingReweavable(LazyClassGen.java:652) org.aspectj.weaver.bcel.BcelWeaver.getClassFilesFor(BcelWeaver.java:1420) org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1390) And that is an exception on this line in remap() ih = ih.getNext(); called from the addExceptionHandlers() line: gen.addExceptionHandler( remap(r.getRealStart(), map), remap(r.getRealEnd(), map), remap(r.getHandler(), map), (r.getCatchType() == null) ? null : (ObjectType) BcelWorld.makeBcelType(r.getCatchType())); During weaving, an instruction list is augmented with extra entries representing where shadows start and end (method-call, method-execution, handler, etc). When weaving is complete we want to remove these temporary elements and use the remaining instructions to produce the method bytecode. Now sometimes these temporary entries are targeted by other elements (line number tags, local variable tags and exception handlers usually). During packing we use remap() to reposition the locations so they move off of temporary placeholders and onto real instructions that will make it out into the bytecode. What the above exception tells us is that we started walking over temporary placeholder entries, but before we came to a real instruction, we ran out of instructions! This cannot happen, and indicates something went seriously wrong, we should always encounter an instruction when remapping off a temporary element. After some digging it is actually the remap() call for the handler (not the start or end) that leads to the problem. The handler represents where to jump to in the code when an exception of the specified type occurs between the instructions pointed at by start and end. I sent a debug build to a user encountering this problem (I could not recreate it) and in that I was looking at where in fact the handler was pointing before we called remap(). I learned that when this problem occurs, the handler is not pointing to anywhere in the method currently being processed (not good). In a second debug build I tried to ascertain who was setting these handlers to point to nowhere. This debug never triggered, no-one was setting them to point to nowhere... I happened to notice whilst going through the instructions in the debug output that cobertura was being used, a coverage toolkit that works by doing bytecode manipulation to insert calls out to a library. AspectJ was being called after cobertura and I asked the user to try the steps the other way round - it worked fine. Indicating cobertura was doing something to the bytecode that gave us problems. After much messing about, I recreated it by applying around advice to within(*) to all the classes in rt.jar (I just used that as a very large standalone jar file I could weave into). I learned that Cobertura creates catch blocks that look a little different to what javac and other compilers create. The typical bytecode sequence a compiler produces for a catch block starts with a STORE instruction, to store the exception being caught (whether the body of the catch block uses it or not). But the cobertura catch blocks started with an INVOKESTATIC instruction, a call out to another method. What does this mean? It means the same instruction has two shadows, a 'handler' shadow and a 'method-call' shadow - and it turns out this is what causes our problem. If around advice is applied to the call join point and it cannot be inlined then the body of the call shadow (the call itself) is pulled out into a new method. Because the handler was the same instruction, this meant the handler *was also being pulled out* into the new method, leaving behind an exception handler that jumped to an invalid location (in fact it 'jumped' to an instruction in a different method!). So the reason I never saw the handler location being set incorrectly is that it was set correctly up front, but then dragged out with the method-call shadow into the wrong place. In bytecode terms it looks like this: method-execution() | ICONST_0 | ISTORE_2 | SIPUSH -1 | ISTORE_3 | catch java.lang.Exception (1806389629) -> E0 | | method-call(ProjectData ProjectData.getGlobalProjectData()) | | | INVOKESTATIC ProjectData.getGlobalProjectData () | | method-call(ProjectData getGlobalProjectData()) | | LDC "SomeString" | | method-call(ClassData getOrCreateClassData(java.lang.String)) | | | INVOKEVIRTUAL ProjectData.getOrCreateClassData (LString;) | | method-call(ClassData ProjectData.getOrCreateClassData(String)) | | SIPUSH 106 | | method-call(void ClassData.touch(int)) | | | INVOKEVIRTUAL ClassData.touch (I)V | | method-call(void ClassData.touch(int)) | | ALOAD_1 | | method-call(Object Expression.getValue()) | | | INVOKEVIRTUAL Expression.getValue () | | method-call(Object Expression.getValue()) | catch java.lang.Exception (1806389629) -> E0 | ARETURN | method-call(nProjectData ProjectData.getGlobalProjectData()) | | E0: INVOKESTATIC ProjectData.getGlobalProjectData () | method-call(ProjectData ProjectData.getGlobalProjectData()) | LDC "Object" We can see the problem in that final method-call. The target for the exception handler seen earlier (E0) is within the method-call shadow. What to do?
resolved fixed
5f97d46
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2008-05-07T15:31:18Z
2008-05-07T03:13:20Z
weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java
ExceptionRange er = new ExceptionRange(body, (catchType==null?null:BcelWorld.fromBcel(catchType)), highPriority); er.associateWithTargets(start1, end1, handlerStart); } public int getAccessFlags() { return accessFlags; } public int getAccessFlagsWithoutSynchronized() { if (isSynchronized()) return accessFlags - Modifier.SYNCHRONIZED; return accessFlags; } public boolean isSynchronized() { return (accessFlags & Modifier.SYNCHRONIZED)!=0; } public void setAccessFlags(int newFlags) { this.accessFlags = newFlags; } public Type[] getArgumentTypes() { initialize(); return argumentTypes; } public LazyClassGen getEnclosingClass() { return enclosingClass; } public int getMaxLocals() { return maxLocals; }
230,817
Bug 230817 LazyMethodGen.remap() NullPointerException
This has been reported a few times by different users, but has always proved tough to diagnose. The typical stack trace is something like: java.lang.NullPointerException org.aspectj.weaver.bcel.LazyMethodGen.remap(LazyMethodGen.java:1237) org.aspectj.weaver.bcel.LazyMethodGen.addExceptionHandlers(LazyMethodGen.java:1132) org.aspectj.weaver.bcel.LazyMethodGen.packBody(LazyMethodGen.java:1078) org.aspectj.weaver.bcel.LazyMethodGen.pack(LazyMethodGen.java:977) org.aspectj.weaver.bcel.LazyMethodGen.getMethod(LazyMethodGen.java:484) org.aspectj.weaver.bcel.LazyClassGen.writeBack(LazyClassGen.java:512) org.aspectj.weaver.bcel.LazyClassGen.getJavaClassBytesIncludingReweavable(LazyClassGen.java:652) org.aspectj.weaver.bcel.BcelWeaver.getClassFilesFor(BcelWeaver.java:1420) org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1390) And that is an exception on this line in remap() ih = ih.getNext(); called from the addExceptionHandlers() line: gen.addExceptionHandler( remap(r.getRealStart(), map), remap(r.getRealEnd(), map), remap(r.getHandler(), map), (r.getCatchType() == null) ? null : (ObjectType) BcelWorld.makeBcelType(r.getCatchType())); During weaving, an instruction list is augmented with extra entries representing where shadows start and end (method-call, method-execution, handler, etc). When weaving is complete we want to remove these temporary elements and use the remaining instructions to produce the method bytecode. Now sometimes these temporary entries are targeted by other elements (line number tags, local variable tags and exception handlers usually). During packing we use remap() to reposition the locations so they move off of temporary placeholders and onto real instructions that will make it out into the bytecode. What the above exception tells us is that we started walking over temporary placeholder entries, but before we came to a real instruction, we ran out of instructions! This cannot happen, and indicates something went seriously wrong, we should always encounter an instruction when remapping off a temporary element. After some digging it is actually the remap() call for the handler (not the start or end) that leads to the problem. The handler represents where to jump to in the code when an exception of the specified type occurs between the instructions pointed at by start and end. I sent a debug build to a user encountering this problem (I could not recreate it) and in that I was looking at where in fact the handler was pointing before we called remap(). I learned that when this problem occurs, the handler is not pointing to anywhere in the method currently being processed (not good). In a second debug build I tried to ascertain who was setting these handlers to point to nowhere. This debug never triggered, no-one was setting them to point to nowhere... I happened to notice whilst going through the instructions in the debug output that cobertura was being used, a coverage toolkit that works by doing bytecode manipulation to insert calls out to a library. AspectJ was being called after cobertura and I asked the user to try the steps the other way round - it worked fine. Indicating cobertura was doing something to the bytecode that gave us problems. After much messing about, I recreated it by applying around advice to within(*) to all the classes in rt.jar (I just used that as a very large standalone jar file I could weave into). I learned that Cobertura creates catch blocks that look a little different to what javac and other compilers create. The typical bytecode sequence a compiler produces for a catch block starts with a STORE instruction, to store the exception being caught (whether the body of the catch block uses it or not). But the cobertura catch blocks started with an INVOKESTATIC instruction, a call out to another method. What does this mean? It means the same instruction has two shadows, a 'handler' shadow and a 'method-call' shadow - and it turns out this is what causes our problem. If around advice is applied to the call join point and it cannot be inlined then the body of the call shadow (the call itself) is pulled out into a new method. Because the handler was the same instruction, this meant the handler *was also being pulled out* into the new method, leaving behind an exception handler that jumped to an invalid location (in fact it 'jumped' to an instruction in a different method!). So the reason I never saw the handler location being set incorrectly is that it was set correctly up front, but then dragged out with the method-call shadow into the wrong place. In bytecode terms it looks like this: method-execution() | ICONST_0 | ISTORE_2 | SIPUSH -1 | ISTORE_3 | catch java.lang.Exception (1806389629) -> E0 | | method-call(ProjectData ProjectData.getGlobalProjectData()) | | | INVOKESTATIC ProjectData.getGlobalProjectData () | | method-call(ProjectData getGlobalProjectData()) | | LDC "SomeString" | | method-call(ClassData getOrCreateClassData(java.lang.String)) | | | INVOKEVIRTUAL ProjectData.getOrCreateClassData (LString;) | | method-call(ClassData ProjectData.getOrCreateClassData(String)) | | SIPUSH 106 | | method-call(void ClassData.touch(int)) | | | INVOKEVIRTUAL ClassData.touch (I)V | | method-call(void ClassData.touch(int)) | | ALOAD_1 | | method-call(Object Expression.getValue()) | | | INVOKEVIRTUAL Expression.getValue () | | method-call(Object Expression.getValue()) | catch java.lang.Exception (1806389629) -> E0 | ARETURN | method-call(nProjectData ProjectData.getGlobalProjectData()) | | E0: INVOKESTATIC ProjectData.getGlobalProjectData () | method-call(ProjectData ProjectData.getGlobalProjectData()) | LDC "Object" We can see the problem in that final method-call. The target for the exception handler seen earlier (E0) is within the method-call shadow. What to do?
resolved fixed
5f97d46
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2008-05-07T15:31:18Z
2008-05-07T03:13:20Z
weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java
public String getName() { return name; } public String getGenericReturnTypeSignature() { if (memberView == null) { return getReturnType().getSignature(); } else { return memberView.getGenericReturnType().getSignature(); } } public Type getReturnType() { initialize(); return returnType; } public void setMaxLocals(int maxLocals) { this.maxLocals = maxLocals; } public InstructionList getBody() { markAsChanged(); return body; } public boolean hasBody() { if (savedMethod != null) return savedMethod.getCode() != null; return body != null; } public Attribute[] getAttributes() { return attributes;
230,817
Bug 230817 LazyMethodGen.remap() NullPointerException
This has been reported a few times by different users, but has always proved tough to diagnose. The typical stack trace is something like: java.lang.NullPointerException org.aspectj.weaver.bcel.LazyMethodGen.remap(LazyMethodGen.java:1237) org.aspectj.weaver.bcel.LazyMethodGen.addExceptionHandlers(LazyMethodGen.java:1132) org.aspectj.weaver.bcel.LazyMethodGen.packBody(LazyMethodGen.java:1078) org.aspectj.weaver.bcel.LazyMethodGen.pack(LazyMethodGen.java:977) org.aspectj.weaver.bcel.LazyMethodGen.getMethod(LazyMethodGen.java:484) org.aspectj.weaver.bcel.LazyClassGen.writeBack(LazyClassGen.java:512) org.aspectj.weaver.bcel.LazyClassGen.getJavaClassBytesIncludingReweavable(LazyClassGen.java:652) org.aspectj.weaver.bcel.BcelWeaver.getClassFilesFor(BcelWeaver.java:1420) org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1390) And that is an exception on this line in remap() ih = ih.getNext(); called from the addExceptionHandlers() line: gen.addExceptionHandler( remap(r.getRealStart(), map), remap(r.getRealEnd(), map), remap(r.getHandler(), map), (r.getCatchType() == null) ? null : (ObjectType) BcelWorld.makeBcelType(r.getCatchType())); During weaving, an instruction list is augmented with extra entries representing where shadows start and end (method-call, method-execution, handler, etc). When weaving is complete we want to remove these temporary elements and use the remaining instructions to produce the method bytecode. Now sometimes these temporary entries are targeted by other elements (line number tags, local variable tags and exception handlers usually). During packing we use remap() to reposition the locations so they move off of temporary placeholders and onto real instructions that will make it out into the bytecode. What the above exception tells us is that we started walking over temporary placeholder entries, but before we came to a real instruction, we ran out of instructions! This cannot happen, and indicates something went seriously wrong, we should always encounter an instruction when remapping off a temporary element. After some digging it is actually the remap() call for the handler (not the start or end) that leads to the problem. The handler represents where to jump to in the code when an exception of the specified type occurs between the instructions pointed at by start and end. I sent a debug build to a user encountering this problem (I could not recreate it) and in that I was looking at where in fact the handler was pointing before we called remap(). I learned that when this problem occurs, the handler is not pointing to anywhere in the method currently being processed (not good). In a second debug build I tried to ascertain who was setting these handlers to point to nowhere. This debug never triggered, no-one was setting them to point to nowhere... I happened to notice whilst going through the instructions in the debug output that cobertura was being used, a coverage toolkit that works by doing bytecode manipulation to insert calls out to a library. AspectJ was being called after cobertura and I asked the user to try the steps the other way round - it worked fine. Indicating cobertura was doing something to the bytecode that gave us problems. After much messing about, I recreated it by applying around advice to within(*) to all the classes in rt.jar (I just used that as a very large standalone jar file I could weave into). I learned that Cobertura creates catch blocks that look a little different to what javac and other compilers create. The typical bytecode sequence a compiler produces for a catch block starts with a STORE instruction, to store the exception being caught (whether the body of the catch block uses it or not). But the cobertura catch blocks started with an INVOKESTATIC instruction, a call out to another method. What does this mean? It means the same instruction has two shadows, a 'handler' shadow and a 'method-call' shadow - and it turns out this is what causes our problem. If around advice is applied to the call join point and it cannot be inlined then the body of the call shadow (the call itself) is pulled out into a new method. Because the handler was the same instruction, this meant the handler *was also being pulled out* into the new method, leaving behind an exception handler that jumped to an invalid location (in fact it 'jumped' to an instruction in a different method!). So the reason I never saw the handler location being set incorrectly is that it was set correctly up front, but then dragged out with the method-call shadow into the wrong place. In bytecode terms it looks like this: method-execution() | ICONST_0 | ISTORE_2 | SIPUSH -1 | ISTORE_3 | catch java.lang.Exception (1806389629) -> E0 | | method-call(ProjectData ProjectData.getGlobalProjectData()) | | | INVOKESTATIC ProjectData.getGlobalProjectData () | | method-call(ProjectData getGlobalProjectData()) | | LDC "SomeString" | | method-call(ClassData getOrCreateClassData(java.lang.String)) | | | INVOKEVIRTUAL ProjectData.getOrCreateClassData (LString;) | | method-call(ClassData ProjectData.getOrCreateClassData(String)) | | SIPUSH 106 | | method-call(void ClassData.touch(int)) | | | INVOKEVIRTUAL ClassData.touch (I)V | | method-call(void ClassData.touch(int)) | | ALOAD_1 | | method-call(Object Expression.getValue()) | | | INVOKEVIRTUAL Expression.getValue () | | method-call(Object Expression.getValue()) | catch java.lang.Exception (1806389629) -> E0 | ARETURN | method-call(nProjectData ProjectData.getGlobalProjectData()) | | E0: INVOKESTATIC ProjectData.getGlobalProjectData () | method-call(ProjectData ProjectData.getGlobalProjectData()) | LDC "Object" We can see the problem in that final method-call. The target for the exception handler seen earlier (E0) is within the method-call shadow. What to do?
resolved fixed
5f97d46
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2008-05-07T15:31:18Z
2008-05-07T03:13:20Z
weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java
} public String[] getDeclaredExceptions() { return declaredExceptions; } public String getClassName() { return enclosingClass.getName(); } ---- packing! public MethodGen pack() { forceSyntheticForAjcMagicMembers(); killNops(); int flags = getAccessFlags(); if (enclosingClass.getWorld().isJoinpointSynchronizationEnabled() && enclosingClass.getWorld().areSynchronizationPointcutsInUse()) { flags = getAccessFlagsWithoutSynchronized(); } MethodGen gen = new MethodGen( flags, getReturnType(), getArgumentTypes(), null, getName(), getEnclosingClass().getName(), new InstructionList(), getEnclosingClass().getConstantPoolGen());
230,817
Bug 230817 LazyMethodGen.remap() NullPointerException
This has been reported a few times by different users, but has always proved tough to diagnose. The typical stack trace is something like: java.lang.NullPointerException org.aspectj.weaver.bcel.LazyMethodGen.remap(LazyMethodGen.java:1237) org.aspectj.weaver.bcel.LazyMethodGen.addExceptionHandlers(LazyMethodGen.java:1132) org.aspectj.weaver.bcel.LazyMethodGen.packBody(LazyMethodGen.java:1078) org.aspectj.weaver.bcel.LazyMethodGen.pack(LazyMethodGen.java:977) org.aspectj.weaver.bcel.LazyMethodGen.getMethod(LazyMethodGen.java:484) org.aspectj.weaver.bcel.LazyClassGen.writeBack(LazyClassGen.java:512) org.aspectj.weaver.bcel.LazyClassGen.getJavaClassBytesIncludingReweavable(LazyClassGen.java:652) org.aspectj.weaver.bcel.BcelWeaver.getClassFilesFor(BcelWeaver.java:1420) org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1390) And that is an exception on this line in remap() ih = ih.getNext(); called from the addExceptionHandlers() line: gen.addExceptionHandler( remap(r.getRealStart(), map), remap(r.getRealEnd(), map), remap(r.getHandler(), map), (r.getCatchType() == null) ? null : (ObjectType) BcelWorld.makeBcelType(r.getCatchType())); During weaving, an instruction list is augmented with extra entries representing where shadows start and end (method-call, method-execution, handler, etc). When weaving is complete we want to remove these temporary elements and use the remaining instructions to produce the method bytecode. Now sometimes these temporary entries are targeted by other elements (line number tags, local variable tags and exception handlers usually). During packing we use remap() to reposition the locations so they move off of temporary placeholders and onto real instructions that will make it out into the bytecode. What the above exception tells us is that we started walking over temporary placeholder entries, but before we came to a real instruction, we ran out of instructions! This cannot happen, and indicates something went seriously wrong, we should always encounter an instruction when remapping off a temporary element. After some digging it is actually the remap() call for the handler (not the start or end) that leads to the problem. The handler represents where to jump to in the code when an exception of the specified type occurs between the instructions pointed at by start and end. I sent a debug build to a user encountering this problem (I could not recreate it) and in that I was looking at where in fact the handler was pointing before we called remap(). I learned that when this problem occurs, the handler is not pointing to anywhere in the method currently being processed (not good). In a second debug build I tried to ascertain who was setting these handlers to point to nowhere. This debug never triggered, no-one was setting them to point to nowhere... I happened to notice whilst going through the instructions in the debug output that cobertura was being used, a coverage toolkit that works by doing bytecode manipulation to insert calls out to a library. AspectJ was being called after cobertura and I asked the user to try the steps the other way round - it worked fine. Indicating cobertura was doing something to the bytecode that gave us problems. After much messing about, I recreated it by applying around advice to within(*) to all the classes in rt.jar (I just used that as a very large standalone jar file I could weave into). I learned that Cobertura creates catch blocks that look a little different to what javac and other compilers create. The typical bytecode sequence a compiler produces for a catch block starts with a STORE instruction, to store the exception being caught (whether the body of the catch block uses it or not). But the cobertura catch blocks started with an INVOKESTATIC instruction, a call out to another method. What does this mean? It means the same instruction has two shadows, a 'handler' shadow and a 'method-call' shadow - and it turns out this is what causes our problem. If around advice is applied to the call join point and it cannot be inlined then the body of the call shadow (the call itself) is pulled out into a new method. Because the handler was the same instruction, this meant the handler *was also being pulled out* into the new method, leaving behind an exception handler that jumped to an invalid location (in fact it 'jumped' to an instruction in a different method!). So the reason I never saw the handler location being set incorrectly is that it was set correctly up front, but then dragged out with the method-call shadow into the wrong place. In bytecode terms it looks like this: method-execution() | ICONST_0 | ISTORE_2 | SIPUSH -1 | ISTORE_3 | catch java.lang.Exception (1806389629) -> E0 | | method-call(ProjectData ProjectData.getGlobalProjectData()) | | | INVOKESTATIC ProjectData.getGlobalProjectData () | | method-call(ProjectData getGlobalProjectData()) | | LDC "SomeString" | | method-call(ClassData getOrCreateClassData(java.lang.String)) | | | INVOKEVIRTUAL ProjectData.getOrCreateClassData (LString;) | | method-call(ClassData ProjectData.getOrCreateClassData(String)) | | SIPUSH 106 | | method-call(void ClassData.touch(int)) | | | INVOKEVIRTUAL ClassData.touch (I)V | | method-call(void ClassData.touch(int)) | | ALOAD_1 | | method-call(Object Expression.getValue()) | | | INVOKEVIRTUAL Expression.getValue () | | method-call(Object Expression.getValue()) | catch java.lang.Exception (1806389629) -> E0 | ARETURN | method-call(nProjectData ProjectData.getGlobalProjectData()) | | E0: INVOKESTATIC ProjectData.getGlobalProjectData () | method-call(ProjectData ProjectData.getGlobalProjectData()) | LDC "Object" We can see the problem in that final method-call. The target for the exception handler seen earlier (E0) is within the method-call shadow. What to do?
resolved fixed
5f97d46
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2008-05-07T15:31:18Z
2008-05-07T03:13:20Z
weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java
for (int i = 0, len = declaredExceptions.length; i < len; i++) { gen.addException(declaredExceptions[i]); } for (int i = 0, len = attributes.length; i < len; i++) { gen.addAttribute(attributes[i]); } if (newAnnotations!=null) { for (Iterator iter = newAnnotations.iterator(); iter.hasNext();) { AnnotationX element = (AnnotationX) iter.next(); gen.addAnnotation(new AnnotationGen(element.getBcelAnnotation(),gen.getConstantPool(),true)); } } if (memberView!=null && memberView.getAnnotations()!=null && memberView.getAnnotations().length!=0) { AnnotationX[] ans = memberView.getAnnotations(); for (int i = 0, len = ans.length; i < len; i++) { Annotation a= ans[i].getBcelAnnotation(); gen.addAnnotation(new AnnotationGen(a,gen.getConstantPool(),true)); } } if (isSynthetic) { if (enclosingClass.getWorld().isInJava5Mode()) { gen.setModifiers(gen.getModifiers() | ACC_SYNTHETIC); } ConstantPoolGen cpg = gen.getConstantPool(); int index = cpg.addUtf8("Synthetic");
230,817
Bug 230817 LazyMethodGen.remap() NullPointerException
This has been reported a few times by different users, but has always proved tough to diagnose. The typical stack trace is something like: java.lang.NullPointerException org.aspectj.weaver.bcel.LazyMethodGen.remap(LazyMethodGen.java:1237) org.aspectj.weaver.bcel.LazyMethodGen.addExceptionHandlers(LazyMethodGen.java:1132) org.aspectj.weaver.bcel.LazyMethodGen.packBody(LazyMethodGen.java:1078) org.aspectj.weaver.bcel.LazyMethodGen.pack(LazyMethodGen.java:977) org.aspectj.weaver.bcel.LazyMethodGen.getMethod(LazyMethodGen.java:484) org.aspectj.weaver.bcel.LazyClassGen.writeBack(LazyClassGen.java:512) org.aspectj.weaver.bcel.LazyClassGen.getJavaClassBytesIncludingReweavable(LazyClassGen.java:652) org.aspectj.weaver.bcel.BcelWeaver.getClassFilesFor(BcelWeaver.java:1420) org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1390) And that is an exception on this line in remap() ih = ih.getNext(); called from the addExceptionHandlers() line: gen.addExceptionHandler( remap(r.getRealStart(), map), remap(r.getRealEnd(), map), remap(r.getHandler(), map), (r.getCatchType() == null) ? null : (ObjectType) BcelWorld.makeBcelType(r.getCatchType())); During weaving, an instruction list is augmented with extra entries representing where shadows start and end (method-call, method-execution, handler, etc). When weaving is complete we want to remove these temporary elements and use the remaining instructions to produce the method bytecode. Now sometimes these temporary entries are targeted by other elements (line number tags, local variable tags and exception handlers usually). During packing we use remap() to reposition the locations so they move off of temporary placeholders and onto real instructions that will make it out into the bytecode. What the above exception tells us is that we started walking over temporary placeholder entries, but before we came to a real instruction, we ran out of instructions! This cannot happen, and indicates something went seriously wrong, we should always encounter an instruction when remapping off a temporary element. After some digging it is actually the remap() call for the handler (not the start or end) that leads to the problem. The handler represents where to jump to in the code when an exception of the specified type occurs between the instructions pointed at by start and end. I sent a debug build to a user encountering this problem (I could not recreate it) and in that I was looking at where in fact the handler was pointing before we called remap(). I learned that when this problem occurs, the handler is not pointing to anywhere in the method currently being processed (not good). In a second debug build I tried to ascertain who was setting these handlers to point to nowhere. This debug never triggered, no-one was setting them to point to nowhere... I happened to notice whilst going through the instructions in the debug output that cobertura was being used, a coverage toolkit that works by doing bytecode manipulation to insert calls out to a library. AspectJ was being called after cobertura and I asked the user to try the steps the other way round - it worked fine. Indicating cobertura was doing something to the bytecode that gave us problems. After much messing about, I recreated it by applying around advice to within(*) to all the classes in rt.jar (I just used that as a very large standalone jar file I could weave into). I learned that Cobertura creates catch blocks that look a little different to what javac and other compilers create. The typical bytecode sequence a compiler produces for a catch block starts with a STORE instruction, to store the exception being caught (whether the body of the catch block uses it or not). But the cobertura catch blocks started with an INVOKESTATIC instruction, a call out to another method. What does this mean? It means the same instruction has two shadows, a 'handler' shadow and a 'method-call' shadow - and it turns out this is what causes our problem. If around advice is applied to the call join point and it cannot be inlined then the body of the call shadow (the call itself) is pulled out into a new method. Because the handler was the same instruction, this meant the handler *was also being pulled out* into the new method, leaving behind an exception handler that jumped to an invalid location (in fact it 'jumped' to an instruction in a different method!). So the reason I never saw the handler location being set incorrectly is that it was set correctly up front, but then dragged out with the method-call shadow into the wrong place. In bytecode terms it looks like this: method-execution() | ICONST_0 | ISTORE_2 | SIPUSH -1 | ISTORE_3 | catch java.lang.Exception (1806389629) -> E0 | | method-call(ProjectData ProjectData.getGlobalProjectData()) | | | INVOKESTATIC ProjectData.getGlobalProjectData () | | method-call(ProjectData getGlobalProjectData()) | | LDC "SomeString" | | method-call(ClassData getOrCreateClassData(java.lang.String)) | | | INVOKEVIRTUAL ProjectData.getOrCreateClassData (LString;) | | method-call(ClassData ProjectData.getOrCreateClassData(String)) | | SIPUSH 106 | | method-call(void ClassData.touch(int)) | | | INVOKEVIRTUAL ClassData.touch (I)V | | method-call(void ClassData.touch(int)) | | ALOAD_1 | | method-call(Object Expression.getValue()) | | | INVOKEVIRTUAL Expression.getValue () | | method-call(Object Expression.getValue()) | catch java.lang.Exception (1806389629) -> E0 | ARETURN | method-call(nProjectData ProjectData.getGlobalProjectData()) | | E0: INVOKESTATIC ProjectData.getGlobalProjectData () | method-call(ProjectData ProjectData.getGlobalProjectData()) | LDC "Object" We can see the problem in that final method-call. The target for the exception handler seen earlier (E0) is within the method-call shadow. What to do?
resolved fixed
5f97d46
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2008-05-07T15:31:18Z
2008-05-07T03:13:20Z
weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java
gen.addAttribute(new Synthetic(index, 0, new byte[0], cpg.getConstantPool())); } if (hasBody()) { packBody(gen); gen.setMaxLocals(); gen.setMaxStack(); } else { gen.setInstructionList(null); } return gen; } private void forceSyntheticForAjcMagicMembers() { if (NameMangler.isSyntheticMethod(getName(), inAspect())) { makeSynthetic(); } } private boolean inAspect() { BcelObjectType objectType = enclosingClass.getBcelObjectType(); return (objectType == null ? false : objectType.isAspect()); } public void makeSynthetic() { isSynthetic = true; } private static class LVPosition { InstructionHandle start = null; InstructionHandle end = null;
230,817
Bug 230817 LazyMethodGen.remap() NullPointerException
This has been reported a few times by different users, but has always proved tough to diagnose. The typical stack trace is something like: java.lang.NullPointerException org.aspectj.weaver.bcel.LazyMethodGen.remap(LazyMethodGen.java:1237) org.aspectj.weaver.bcel.LazyMethodGen.addExceptionHandlers(LazyMethodGen.java:1132) org.aspectj.weaver.bcel.LazyMethodGen.packBody(LazyMethodGen.java:1078) org.aspectj.weaver.bcel.LazyMethodGen.pack(LazyMethodGen.java:977) org.aspectj.weaver.bcel.LazyMethodGen.getMethod(LazyMethodGen.java:484) org.aspectj.weaver.bcel.LazyClassGen.writeBack(LazyClassGen.java:512) org.aspectj.weaver.bcel.LazyClassGen.getJavaClassBytesIncludingReweavable(LazyClassGen.java:652) org.aspectj.weaver.bcel.BcelWeaver.getClassFilesFor(BcelWeaver.java:1420) org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1390) And that is an exception on this line in remap() ih = ih.getNext(); called from the addExceptionHandlers() line: gen.addExceptionHandler( remap(r.getRealStart(), map), remap(r.getRealEnd(), map), remap(r.getHandler(), map), (r.getCatchType() == null) ? null : (ObjectType) BcelWorld.makeBcelType(r.getCatchType())); During weaving, an instruction list is augmented with extra entries representing where shadows start and end (method-call, method-execution, handler, etc). When weaving is complete we want to remove these temporary elements and use the remaining instructions to produce the method bytecode. Now sometimes these temporary entries are targeted by other elements (line number tags, local variable tags and exception handlers usually). During packing we use remap() to reposition the locations so they move off of temporary placeholders and onto real instructions that will make it out into the bytecode. What the above exception tells us is that we started walking over temporary placeholder entries, but before we came to a real instruction, we ran out of instructions! This cannot happen, and indicates something went seriously wrong, we should always encounter an instruction when remapping off a temporary element. After some digging it is actually the remap() call for the handler (not the start or end) that leads to the problem. The handler represents where to jump to in the code when an exception of the specified type occurs between the instructions pointed at by start and end. I sent a debug build to a user encountering this problem (I could not recreate it) and in that I was looking at where in fact the handler was pointing before we called remap(). I learned that when this problem occurs, the handler is not pointing to anywhere in the method currently being processed (not good). In a second debug build I tried to ascertain who was setting these handlers to point to nowhere. This debug never triggered, no-one was setting them to point to nowhere... I happened to notice whilst going through the instructions in the debug output that cobertura was being used, a coverage toolkit that works by doing bytecode manipulation to insert calls out to a library. AspectJ was being called after cobertura and I asked the user to try the steps the other way round - it worked fine. Indicating cobertura was doing something to the bytecode that gave us problems. After much messing about, I recreated it by applying around advice to within(*) to all the classes in rt.jar (I just used that as a very large standalone jar file I could weave into). I learned that Cobertura creates catch blocks that look a little different to what javac and other compilers create. The typical bytecode sequence a compiler produces for a catch block starts with a STORE instruction, to store the exception being caught (whether the body of the catch block uses it or not). But the cobertura catch blocks started with an INVOKESTATIC instruction, a call out to another method. What does this mean? It means the same instruction has two shadows, a 'handler' shadow and a 'method-call' shadow - and it turns out this is what causes our problem. If around advice is applied to the call join point and it cannot be inlined then the body of the call shadow (the call itself) is pulled out into a new method. Because the handler was the same instruction, this meant the handler *was also being pulled out* into the new method, leaving behind an exception handler that jumped to an invalid location (in fact it 'jumped' to an instruction in a different method!). So the reason I never saw the handler location being set incorrectly is that it was set correctly up front, but then dragged out with the method-call shadow into the wrong place. In bytecode terms it looks like this: method-execution() | ICONST_0 | ISTORE_2 | SIPUSH -1 | ISTORE_3 | catch java.lang.Exception (1806389629) -> E0 | | method-call(ProjectData ProjectData.getGlobalProjectData()) | | | INVOKESTATIC ProjectData.getGlobalProjectData () | | method-call(ProjectData getGlobalProjectData()) | | LDC "SomeString" | | method-call(ClassData getOrCreateClassData(java.lang.String)) | | | INVOKEVIRTUAL ProjectData.getOrCreateClassData (LString;) | | method-call(ClassData ProjectData.getOrCreateClassData(String)) | | SIPUSH 106 | | method-call(void ClassData.touch(int)) | | | INVOKEVIRTUAL ClassData.touch (I)V | | method-call(void ClassData.touch(int)) | | ALOAD_1 | | method-call(Object Expression.getValue()) | | | INVOKEVIRTUAL Expression.getValue () | | method-call(Object Expression.getValue()) | catch java.lang.Exception (1806389629) -> E0 | ARETURN | method-call(nProjectData ProjectData.getGlobalProjectData()) | | E0: INVOKESTATIC ProjectData.getGlobalProjectData () | method-call(ProjectData ProjectData.getGlobalProjectData()) | LDC "Object" We can see the problem in that final method-call. The target for the exception handler seen earlier (E0) is within the method-call shadow. What to do?
resolved fixed
5f97d46
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2008-05-07T15:31:18Z
2008-05-07T03:13:20Z
weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java
} /** fill the newly created method gen with our body, * inspired by InstructionList.copy() */ public void packBody(MethodGen gen) { InstructionList fresh = gen.getInstructionList(); Map map = copyAllInstructionsExceptRangeInstructionsInto(fresh); /* Update branch targets and insert various attributes. * Insert our exceptionHandlers * into a sorted list, so they can be added in order later. */ InstructionHandle oldInstructionHandle = getBody().getStart(); InstructionHandle newInstructionHandle = fresh.getStart(); LinkedList exceptionList = new LinkedList(); Map localVariables = new HashMap(); int currLine = -1; int lineNumberOffset = (fromFilename == null) ? 0: getEnclosingClass().getSourceDebugExtensionOffset(fromFilename); while (oldInstructionHandle != null) { if (map.get(oldInstructionHandle) == null) { handleRangeInstruction(oldInstructionHandle, exceptionList); oldInstructionHandle = oldInstructionHandle.getNext(); } else {
230,817
Bug 230817 LazyMethodGen.remap() NullPointerException
This has been reported a few times by different users, but has always proved tough to diagnose. The typical stack trace is something like: java.lang.NullPointerException org.aspectj.weaver.bcel.LazyMethodGen.remap(LazyMethodGen.java:1237) org.aspectj.weaver.bcel.LazyMethodGen.addExceptionHandlers(LazyMethodGen.java:1132) org.aspectj.weaver.bcel.LazyMethodGen.packBody(LazyMethodGen.java:1078) org.aspectj.weaver.bcel.LazyMethodGen.pack(LazyMethodGen.java:977) org.aspectj.weaver.bcel.LazyMethodGen.getMethod(LazyMethodGen.java:484) org.aspectj.weaver.bcel.LazyClassGen.writeBack(LazyClassGen.java:512) org.aspectj.weaver.bcel.LazyClassGen.getJavaClassBytesIncludingReweavable(LazyClassGen.java:652) org.aspectj.weaver.bcel.BcelWeaver.getClassFilesFor(BcelWeaver.java:1420) org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1390) And that is an exception on this line in remap() ih = ih.getNext(); called from the addExceptionHandlers() line: gen.addExceptionHandler( remap(r.getRealStart(), map), remap(r.getRealEnd(), map), remap(r.getHandler(), map), (r.getCatchType() == null) ? null : (ObjectType) BcelWorld.makeBcelType(r.getCatchType())); During weaving, an instruction list is augmented with extra entries representing where shadows start and end (method-call, method-execution, handler, etc). When weaving is complete we want to remove these temporary elements and use the remaining instructions to produce the method bytecode. Now sometimes these temporary entries are targeted by other elements (line number tags, local variable tags and exception handlers usually). During packing we use remap() to reposition the locations so they move off of temporary placeholders and onto real instructions that will make it out into the bytecode. What the above exception tells us is that we started walking over temporary placeholder entries, but before we came to a real instruction, we ran out of instructions! This cannot happen, and indicates something went seriously wrong, we should always encounter an instruction when remapping off a temporary element. After some digging it is actually the remap() call for the handler (not the start or end) that leads to the problem. The handler represents where to jump to in the code when an exception of the specified type occurs between the instructions pointed at by start and end. I sent a debug build to a user encountering this problem (I could not recreate it) and in that I was looking at where in fact the handler was pointing before we called remap(). I learned that when this problem occurs, the handler is not pointing to anywhere in the method currently being processed (not good). In a second debug build I tried to ascertain who was setting these handlers to point to nowhere. This debug never triggered, no-one was setting them to point to nowhere... I happened to notice whilst going through the instructions in the debug output that cobertura was being used, a coverage toolkit that works by doing bytecode manipulation to insert calls out to a library. AspectJ was being called after cobertura and I asked the user to try the steps the other way round - it worked fine. Indicating cobertura was doing something to the bytecode that gave us problems. After much messing about, I recreated it by applying around advice to within(*) to all the classes in rt.jar (I just used that as a very large standalone jar file I could weave into). I learned that Cobertura creates catch blocks that look a little different to what javac and other compilers create. The typical bytecode sequence a compiler produces for a catch block starts with a STORE instruction, to store the exception being caught (whether the body of the catch block uses it or not). But the cobertura catch blocks started with an INVOKESTATIC instruction, a call out to another method. What does this mean? It means the same instruction has two shadows, a 'handler' shadow and a 'method-call' shadow - and it turns out this is what causes our problem. If around advice is applied to the call join point and it cannot be inlined then the body of the call shadow (the call itself) is pulled out into a new method. Because the handler was the same instruction, this meant the handler *was also being pulled out* into the new method, leaving behind an exception handler that jumped to an invalid location (in fact it 'jumped' to an instruction in a different method!). So the reason I never saw the handler location being set incorrectly is that it was set correctly up front, but then dragged out with the method-call shadow into the wrong place. In bytecode terms it looks like this: method-execution() | ICONST_0 | ISTORE_2 | SIPUSH -1 | ISTORE_3 | catch java.lang.Exception (1806389629) -> E0 | | method-call(ProjectData ProjectData.getGlobalProjectData()) | | | INVOKESTATIC ProjectData.getGlobalProjectData () | | method-call(ProjectData getGlobalProjectData()) | | LDC "SomeString" | | method-call(ClassData getOrCreateClassData(java.lang.String)) | | | INVOKEVIRTUAL ProjectData.getOrCreateClassData (LString;) | | method-call(ClassData ProjectData.getOrCreateClassData(String)) | | SIPUSH 106 | | method-call(void ClassData.touch(int)) | | | INVOKEVIRTUAL ClassData.touch (I)V | | method-call(void ClassData.touch(int)) | | ALOAD_1 | | method-call(Object Expression.getValue()) | | | INVOKEVIRTUAL Expression.getValue () | | method-call(Object Expression.getValue()) | catch java.lang.Exception (1806389629) -> E0 | ARETURN | method-call(nProjectData ProjectData.getGlobalProjectData()) | | E0: INVOKESTATIC ProjectData.getGlobalProjectData () | method-call(ProjectData ProjectData.getGlobalProjectData()) | LDC "Object" We can see the problem in that final method-call. The target for the exception handler seen earlier (E0) is within the method-call shadow. What to do?
resolved fixed
5f97d46
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2008-05-07T15:31:18Z
2008-05-07T03:13:20Z
weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java
Instruction oldInstruction = oldInstructionHandle.getInstruction(); Instruction newInstruction = newInstructionHandle.getInstruction(); if (oldInstruction instanceof BranchInstruction) { handleBranchInstruction(map, oldInstruction, newInstruction); } InstructionTargeter[] targeters = oldInstructionHandle.getTargeters(); if (targeters != null) { for (int k = targeters.length - 1; k >= 0; k--) { InstructionTargeter targeter = targeters[k]; if (targeter instanceof LineNumberTag) { int line = ((LineNumberTag)targeter).getLineNumber(); if (line != currLine) { gen.addLineNumber(newInstructionHandle, line + lineNumberOffset); currLine = line; } } else if (targeter instanceof LocalVariableTag) { LocalVariableTag lvt = (LocalVariableTag) targeter; LVPosition p = (LVPosition)localVariables.get(lvt); if (p==null) { LVPosition newp = new LVPosition(); newp.start=newp.end=newInstructionHandle; localVariables.put(lvt,newp); } else { p.end = newInstructionHandle;
230,817
Bug 230817 LazyMethodGen.remap() NullPointerException
This has been reported a few times by different users, but has always proved tough to diagnose. The typical stack trace is something like: java.lang.NullPointerException org.aspectj.weaver.bcel.LazyMethodGen.remap(LazyMethodGen.java:1237) org.aspectj.weaver.bcel.LazyMethodGen.addExceptionHandlers(LazyMethodGen.java:1132) org.aspectj.weaver.bcel.LazyMethodGen.packBody(LazyMethodGen.java:1078) org.aspectj.weaver.bcel.LazyMethodGen.pack(LazyMethodGen.java:977) org.aspectj.weaver.bcel.LazyMethodGen.getMethod(LazyMethodGen.java:484) org.aspectj.weaver.bcel.LazyClassGen.writeBack(LazyClassGen.java:512) org.aspectj.weaver.bcel.LazyClassGen.getJavaClassBytesIncludingReweavable(LazyClassGen.java:652) org.aspectj.weaver.bcel.BcelWeaver.getClassFilesFor(BcelWeaver.java:1420) org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1390) And that is an exception on this line in remap() ih = ih.getNext(); called from the addExceptionHandlers() line: gen.addExceptionHandler( remap(r.getRealStart(), map), remap(r.getRealEnd(), map), remap(r.getHandler(), map), (r.getCatchType() == null) ? null : (ObjectType) BcelWorld.makeBcelType(r.getCatchType())); During weaving, an instruction list is augmented with extra entries representing where shadows start and end (method-call, method-execution, handler, etc). When weaving is complete we want to remove these temporary elements and use the remaining instructions to produce the method bytecode. Now sometimes these temporary entries are targeted by other elements (line number tags, local variable tags and exception handlers usually). During packing we use remap() to reposition the locations so they move off of temporary placeholders and onto real instructions that will make it out into the bytecode. What the above exception tells us is that we started walking over temporary placeholder entries, but before we came to a real instruction, we ran out of instructions! This cannot happen, and indicates something went seriously wrong, we should always encounter an instruction when remapping off a temporary element. After some digging it is actually the remap() call for the handler (not the start or end) that leads to the problem. The handler represents where to jump to in the code when an exception of the specified type occurs between the instructions pointed at by start and end. I sent a debug build to a user encountering this problem (I could not recreate it) and in that I was looking at where in fact the handler was pointing before we called remap(). I learned that when this problem occurs, the handler is not pointing to anywhere in the method currently being processed (not good). In a second debug build I tried to ascertain who was setting these handlers to point to nowhere. This debug never triggered, no-one was setting them to point to nowhere... I happened to notice whilst going through the instructions in the debug output that cobertura was being used, a coverage toolkit that works by doing bytecode manipulation to insert calls out to a library. AspectJ was being called after cobertura and I asked the user to try the steps the other way round - it worked fine. Indicating cobertura was doing something to the bytecode that gave us problems. After much messing about, I recreated it by applying around advice to within(*) to all the classes in rt.jar (I just used that as a very large standalone jar file I could weave into). I learned that Cobertura creates catch blocks that look a little different to what javac and other compilers create. The typical bytecode sequence a compiler produces for a catch block starts with a STORE instruction, to store the exception being caught (whether the body of the catch block uses it or not). But the cobertura catch blocks started with an INVOKESTATIC instruction, a call out to another method. What does this mean? It means the same instruction has two shadows, a 'handler' shadow and a 'method-call' shadow - and it turns out this is what causes our problem. If around advice is applied to the call join point and it cannot be inlined then the body of the call shadow (the call itself) is pulled out into a new method. Because the handler was the same instruction, this meant the handler *was also being pulled out* into the new method, leaving behind an exception handler that jumped to an invalid location (in fact it 'jumped' to an instruction in a different method!). So the reason I never saw the handler location being set incorrectly is that it was set correctly up front, but then dragged out with the method-call shadow into the wrong place. In bytecode terms it looks like this: method-execution() | ICONST_0 | ISTORE_2 | SIPUSH -1 | ISTORE_3 | catch java.lang.Exception (1806389629) -> E0 | | method-call(ProjectData ProjectData.getGlobalProjectData()) | | | INVOKESTATIC ProjectData.getGlobalProjectData () | | method-call(ProjectData getGlobalProjectData()) | | LDC "SomeString" | | method-call(ClassData getOrCreateClassData(java.lang.String)) | | | INVOKEVIRTUAL ProjectData.getOrCreateClassData (LString;) | | method-call(ClassData ProjectData.getOrCreateClassData(String)) | | SIPUSH 106 | | method-call(void ClassData.touch(int)) | | | INVOKEVIRTUAL ClassData.touch (I)V | | method-call(void ClassData.touch(int)) | | ALOAD_1 | | method-call(Object Expression.getValue()) | | | INVOKEVIRTUAL Expression.getValue () | | method-call(Object Expression.getValue()) | catch java.lang.Exception (1806389629) -> E0 | ARETURN | method-call(nProjectData ProjectData.getGlobalProjectData()) | | E0: INVOKESTATIC ProjectData.getGlobalProjectData () | method-call(ProjectData ProjectData.getGlobalProjectData()) | LDC "Object" We can see the problem in that final method-call. The target for the exception handler seen earlier (E0) is within the method-call shadow. What to do?
resolved fixed
5f97d46
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2008-05-07T15:31:18Z
2008-05-07T03:13:20Z
weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java
} } } } now continue oldInstructionHandle = oldInstructionHandle.getNext(); newInstructionHandle = newInstructionHandle.getNext(); } } addExceptionHandlers(gen, map, exceptionList); addLocalVariables(gen,localVariables); if (gen.getLineNumbers().length==0) { gen.addLineNumber(gen.getInstructionList().getStart(),1); } } private void addLocalVariables(MethodGen gen, Map localVariables) { gen.removeLocalVariables();
230,817
Bug 230817 LazyMethodGen.remap() NullPointerException
This has been reported a few times by different users, but has always proved tough to diagnose. The typical stack trace is something like: java.lang.NullPointerException org.aspectj.weaver.bcel.LazyMethodGen.remap(LazyMethodGen.java:1237) org.aspectj.weaver.bcel.LazyMethodGen.addExceptionHandlers(LazyMethodGen.java:1132) org.aspectj.weaver.bcel.LazyMethodGen.packBody(LazyMethodGen.java:1078) org.aspectj.weaver.bcel.LazyMethodGen.pack(LazyMethodGen.java:977) org.aspectj.weaver.bcel.LazyMethodGen.getMethod(LazyMethodGen.java:484) org.aspectj.weaver.bcel.LazyClassGen.writeBack(LazyClassGen.java:512) org.aspectj.weaver.bcel.LazyClassGen.getJavaClassBytesIncludingReweavable(LazyClassGen.java:652) org.aspectj.weaver.bcel.BcelWeaver.getClassFilesFor(BcelWeaver.java:1420) org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1390) And that is an exception on this line in remap() ih = ih.getNext(); called from the addExceptionHandlers() line: gen.addExceptionHandler( remap(r.getRealStart(), map), remap(r.getRealEnd(), map), remap(r.getHandler(), map), (r.getCatchType() == null) ? null : (ObjectType) BcelWorld.makeBcelType(r.getCatchType())); During weaving, an instruction list is augmented with extra entries representing where shadows start and end (method-call, method-execution, handler, etc). When weaving is complete we want to remove these temporary elements and use the remaining instructions to produce the method bytecode. Now sometimes these temporary entries are targeted by other elements (line number tags, local variable tags and exception handlers usually). During packing we use remap() to reposition the locations so they move off of temporary placeholders and onto real instructions that will make it out into the bytecode. What the above exception tells us is that we started walking over temporary placeholder entries, but before we came to a real instruction, we ran out of instructions! This cannot happen, and indicates something went seriously wrong, we should always encounter an instruction when remapping off a temporary element. After some digging it is actually the remap() call for the handler (not the start or end) that leads to the problem. The handler represents where to jump to in the code when an exception of the specified type occurs between the instructions pointed at by start and end. I sent a debug build to a user encountering this problem (I could not recreate it) and in that I was looking at where in fact the handler was pointing before we called remap(). I learned that when this problem occurs, the handler is not pointing to anywhere in the method currently being processed (not good). In a second debug build I tried to ascertain who was setting these handlers to point to nowhere. This debug never triggered, no-one was setting them to point to nowhere... I happened to notice whilst going through the instructions in the debug output that cobertura was being used, a coverage toolkit that works by doing bytecode manipulation to insert calls out to a library. AspectJ was being called after cobertura and I asked the user to try the steps the other way round - it worked fine. Indicating cobertura was doing something to the bytecode that gave us problems. After much messing about, I recreated it by applying around advice to within(*) to all the classes in rt.jar (I just used that as a very large standalone jar file I could weave into). I learned that Cobertura creates catch blocks that look a little different to what javac and other compilers create. The typical bytecode sequence a compiler produces for a catch block starts with a STORE instruction, to store the exception being caught (whether the body of the catch block uses it or not). But the cobertura catch blocks started with an INVOKESTATIC instruction, a call out to another method. What does this mean? It means the same instruction has two shadows, a 'handler' shadow and a 'method-call' shadow - and it turns out this is what causes our problem. If around advice is applied to the call join point and it cannot be inlined then the body of the call shadow (the call itself) is pulled out into a new method. Because the handler was the same instruction, this meant the handler *was also being pulled out* into the new method, leaving behind an exception handler that jumped to an invalid location (in fact it 'jumped' to an instruction in a different method!). So the reason I never saw the handler location being set incorrectly is that it was set correctly up front, but then dragged out with the method-call shadow into the wrong place. In bytecode terms it looks like this: method-execution() | ICONST_0 | ISTORE_2 | SIPUSH -1 | ISTORE_3 | catch java.lang.Exception (1806389629) -> E0 | | method-call(ProjectData ProjectData.getGlobalProjectData()) | | | INVOKESTATIC ProjectData.getGlobalProjectData () | | method-call(ProjectData getGlobalProjectData()) | | LDC "SomeString" | | method-call(ClassData getOrCreateClassData(java.lang.String)) | | | INVOKEVIRTUAL ProjectData.getOrCreateClassData (LString;) | | method-call(ClassData ProjectData.getOrCreateClassData(String)) | | SIPUSH 106 | | method-call(void ClassData.touch(int)) | | | INVOKEVIRTUAL ClassData.touch (I)V | | method-call(void ClassData.touch(int)) | | ALOAD_1 | | method-call(Object Expression.getValue()) | | | INVOKEVIRTUAL Expression.getValue () | | method-call(Object Expression.getValue()) | catch java.lang.Exception (1806389629) -> E0 | ARETURN | method-call(nProjectData ProjectData.getGlobalProjectData()) | | E0: INVOKESTATIC ProjectData.getGlobalProjectData () | method-call(ProjectData ProjectData.getGlobalProjectData()) | LDC "Object" We can see the problem in that final method-call. The target for the exception handler seen earlier (E0) is within the method-call shadow. What to do?
resolved fixed
5f97d46
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2008-05-07T15:31:18Z
2008-05-07T03:13:20Z
weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java
Map duplicatedLocalMap = new HashMap(); for (Iterator iter = localVariables.keySet().iterator(); iter.hasNext(); ) { LocalVariableTag tag = (LocalVariableTag) iter.next(); LVPosition lvpos = (LVPosition)localVariables.get(tag); InstructionHandle start = lvpos.start; Set slots = (Set) duplicatedLocalMap.get(start); if (slots == null) { slots = new HashSet(); duplicatedLocalMap.put(start, slots); } else if (slots.contains(new Integer(tag.getSlot()))) { continue; } slots.add(new Integer(tag.getSlot())); Type t = tag.getRealType(); if (t==null) { t = BcelWorld.makeBcelType(UnresolvedType.forSignature(tag.getType())); } gen.addLocalVariable( tag.getName(), t, tag.getSlot(),(InstructionHandle) start,(InstructionHandle) lvpos.end); } } private void addExceptionHandlers(MethodGen gen, Map map, LinkedList exnList) { for (Iterator iter = exnList.iterator(); iter.hasNext();) {
230,817
Bug 230817 LazyMethodGen.remap() NullPointerException
This has been reported a few times by different users, but has always proved tough to diagnose. The typical stack trace is something like: java.lang.NullPointerException org.aspectj.weaver.bcel.LazyMethodGen.remap(LazyMethodGen.java:1237) org.aspectj.weaver.bcel.LazyMethodGen.addExceptionHandlers(LazyMethodGen.java:1132) org.aspectj.weaver.bcel.LazyMethodGen.packBody(LazyMethodGen.java:1078) org.aspectj.weaver.bcel.LazyMethodGen.pack(LazyMethodGen.java:977) org.aspectj.weaver.bcel.LazyMethodGen.getMethod(LazyMethodGen.java:484) org.aspectj.weaver.bcel.LazyClassGen.writeBack(LazyClassGen.java:512) org.aspectj.weaver.bcel.LazyClassGen.getJavaClassBytesIncludingReweavable(LazyClassGen.java:652) org.aspectj.weaver.bcel.BcelWeaver.getClassFilesFor(BcelWeaver.java:1420) org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1390) And that is an exception on this line in remap() ih = ih.getNext(); called from the addExceptionHandlers() line: gen.addExceptionHandler( remap(r.getRealStart(), map), remap(r.getRealEnd(), map), remap(r.getHandler(), map), (r.getCatchType() == null) ? null : (ObjectType) BcelWorld.makeBcelType(r.getCatchType())); During weaving, an instruction list is augmented with extra entries representing where shadows start and end (method-call, method-execution, handler, etc). When weaving is complete we want to remove these temporary elements and use the remaining instructions to produce the method bytecode. Now sometimes these temporary entries are targeted by other elements (line number tags, local variable tags and exception handlers usually). During packing we use remap() to reposition the locations so they move off of temporary placeholders and onto real instructions that will make it out into the bytecode. What the above exception tells us is that we started walking over temporary placeholder entries, but before we came to a real instruction, we ran out of instructions! This cannot happen, and indicates something went seriously wrong, we should always encounter an instruction when remapping off a temporary element. After some digging it is actually the remap() call for the handler (not the start or end) that leads to the problem. The handler represents where to jump to in the code when an exception of the specified type occurs between the instructions pointed at by start and end. I sent a debug build to a user encountering this problem (I could not recreate it) and in that I was looking at where in fact the handler was pointing before we called remap(). I learned that when this problem occurs, the handler is not pointing to anywhere in the method currently being processed (not good). In a second debug build I tried to ascertain who was setting these handlers to point to nowhere. This debug never triggered, no-one was setting them to point to nowhere... I happened to notice whilst going through the instructions in the debug output that cobertura was being used, a coverage toolkit that works by doing bytecode manipulation to insert calls out to a library. AspectJ was being called after cobertura and I asked the user to try the steps the other way round - it worked fine. Indicating cobertura was doing something to the bytecode that gave us problems. After much messing about, I recreated it by applying around advice to within(*) to all the classes in rt.jar (I just used that as a very large standalone jar file I could weave into). I learned that Cobertura creates catch blocks that look a little different to what javac and other compilers create. The typical bytecode sequence a compiler produces for a catch block starts with a STORE instruction, to store the exception being caught (whether the body of the catch block uses it or not). But the cobertura catch blocks started with an INVOKESTATIC instruction, a call out to another method. What does this mean? It means the same instruction has two shadows, a 'handler' shadow and a 'method-call' shadow - and it turns out this is what causes our problem. If around advice is applied to the call join point and it cannot be inlined then the body of the call shadow (the call itself) is pulled out into a new method. Because the handler was the same instruction, this meant the handler *was also being pulled out* into the new method, leaving behind an exception handler that jumped to an invalid location (in fact it 'jumped' to an instruction in a different method!). So the reason I never saw the handler location being set incorrectly is that it was set correctly up front, but then dragged out with the method-call shadow into the wrong place. In bytecode terms it looks like this: method-execution() | ICONST_0 | ISTORE_2 | SIPUSH -1 | ISTORE_3 | catch java.lang.Exception (1806389629) -> E0 | | method-call(ProjectData ProjectData.getGlobalProjectData()) | | | INVOKESTATIC ProjectData.getGlobalProjectData () | | method-call(ProjectData getGlobalProjectData()) | | LDC "SomeString" | | method-call(ClassData getOrCreateClassData(java.lang.String)) | | | INVOKEVIRTUAL ProjectData.getOrCreateClassData (LString;) | | method-call(ClassData ProjectData.getOrCreateClassData(String)) | | SIPUSH 106 | | method-call(void ClassData.touch(int)) | | | INVOKEVIRTUAL ClassData.touch (I)V | | method-call(void ClassData.touch(int)) | | ALOAD_1 | | method-call(Object Expression.getValue()) | | | INVOKEVIRTUAL Expression.getValue () | | method-call(Object Expression.getValue()) | catch java.lang.Exception (1806389629) -> E0 | ARETURN | method-call(nProjectData ProjectData.getGlobalProjectData()) | | E0: INVOKESTATIC ProjectData.getGlobalProjectData () | method-call(ProjectData ProjectData.getGlobalProjectData()) | LDC "Object" We can see the problem in that final method-call. The target for the exception handler seen earlier (E0) is within the method-call shadow. What to do?
resolved fixed
5f97d46
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2008-05-07T15:31:18Z
2008-05-07T03:13:20Z
weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java
ExceptionRange r = (ExceptionRange) iter.next(); if (r.isEmpty()) continue; gen.addExceptionHandler( remap(r.getRealStart(), map), remap(r.getRealEnd(), map), remap(r.getHandler(), map), (r.getCatchType() == null) ? null : (ObjectType) BcelWorld.makeBcelType(r.getCatchType())); } } private void handleBranchInstruction(Map map, Instruction oldInstruction, Instruction newInstruction) { BranchInstruction oldBranchInstruction = (BranchInstruction) oldInstruction; BranchInstruction newBranchInstruction = (BranchInstruction) newInstruction; InstructionHandle oldTarget = oldBranchInstruction.getTarget(); old target try { newBranchInstruction.setTarget(remap(oldTarget, map)); } if (oldBranchInstruction instanceof Select) { InstructionHandle[] oldTargets = ((Select) oldBranchInstruction).getTargets(); InstructionHandle[] newTargets = ((Select) newBranchInstruction).getTargets(); for (int k = oldTargets.length - 1; k >= 0; k--) { newTargets[k] = remap(oldTargets[k], map); newTargets[k].addTargeter(newBranchInstruction);
230,817
Bug 230817 LazyMethodGen.remap() NullPointerException
This has been reported a few times by different users, but has always proved tough to diagnose. The typical stack trace is something like: java.lang.NullPointerException org.aspectj.weaver.bcel.LazyMethodGen.remap(LazyMethodGen.java:1237) org.aspectj.weaver.bcel.LazyMethodGen.addExceptionHandlers(LazyMethodGen.java:1132) org.aspectj.weaver.bcel.LazyMethodGen.packBody(LazyMethodGen.java:1078) org.aspectj.weaver.bcel.LazyMethodGen.pack(LazyMethodGen.java:977) org.aspectj.weaver.bcel.LazyMethodGen.getMethod(LazyMethodGen.java:484) org.aspectj.weaver.bcel.LazyClassGen.writeBack(LazyClassGen.java:512) org.aspectj.weaver.bcel.LazyClassGen.getJavaClassBytesIncludingReweavable(LazyClassGen.java:652) org.aspectj.weaver.bcel.BcelWeaver.getClassFilesFor(BcelWeaver.java:1420) org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1390) And that is an exception on this line in remap() ih = ih.getNext(); called from the addExceptionHandlers() line: gen.addExceptionHandler( remap(r.getRealStart(), map), remap(r.getRealEnd(), map), remap(r.getHandler(), map), (r.getCatchType() == null) ? null : (ObjectType) BcelWorld.makeBcelType(r.getCatchType())); During weaving, an instruction list is augmented with extra entries representing where shadows start and end (method-call, method-execution, handler, etc). When weaving is complete we want to remove these temporary elements and use the remaining instructions to produce the method bytecode. Now sometimes these temporary entries are targeted by other elements (line number tags, local variable tags and exception handlers usually). During packing we use remap() to reposition the locations so they move off of temporary placeholders and onto real instructions that will make it out into the bytecode. What the above exception tells us is that we started walking over temporary placeholder entries, but before we came to a real instruction, we ran out of instructions! This cannot happen, and indicates something went seriously wrong, we should always encounter an instruction when remapping off a temporary element. After some digging it is actually the remap() call for the handler (not the start or end) that leads to the problem. The handler represents where to jump to in the code when an exception of the specified type occurs between the instructions pointed at by start and end. I sent a debug build to a user encountering this problem (I could not recreate it) and in that I was looking at where in fact the handler was pointing before we called remap(). I learned that when this problem occurs, the handler is not pointing to anywhere in the method currently being processed (not good). In a second debug build I tried to ascertain who was setting these handlers to point to nowhere. This debug never triggered, no-one was setting them to point to nowhere... I happened to notice whilst going through the instructions in the debug output that cobertura was being used, a coverage toolkit that works by doing bytecode manipulation to insert calls out to a library. AspectJ was being called after cobertura and I asked the user to try the steps the other way round - it worked fine. Indicating cobertura was doing something to the bytecode that gave us problems. After much messing about, I recreated it by applying around advice to within(*) to all the classes in rt.jar (I just used that as a very large standalone jar file I could weave into). I learned that Cobertura creates catch blocks that look a little different to what javac and other compilers create. The typical bytecode sequence a compiler produces for a catch block starts with a STORE instruction, to store the exception being caught (whether the body of the catch block uses it or not). But the cobertura catch blocks started with an INVOKESTATIC instruction, a call out to another method. What does this mean? It means the same instruction has two shadows, a 'handler' shadow and a 'method-call' shadow - and it turns out this is what causes our problem. If around advice is applied to the call join point and it cannot be inlined then the body of the call shadow (the call itself) is pulled out into a new method. Because the handler was the same instruction, this meant the handler *was also being pulled out* into the new method, leaving behind an exception handler that jumped to an invalid location (in fact it 'jumped' to an instruction in a different method!). So the reason I never saw the handler location being set incorrectly is that it was set correctly up front, but then dragged out with the method-call shadow into the wrong place. In bytecode terms it looks like this: method-execution() | ICONST_0 | ISTORE_2 | SIPUSH -1 | ISTORE_3 | catch java.lang.Exception (1806389629) -> E0 | | method-call(ProjectData ProjectData.getGlobalProjectData()) | | | INVOKESTATIC ProjectData.getGlobalProjectData () | | method-call(ProjectData getGlobalProjectData()) | | LDC "SomeString" | | method-call(ClassData getOrCreateClassData(java.lang.String)) | | | INVOKEVIRTUAL ProjectData.getOrCreateClassData (LString;) | | method-call(ClassData ProjectData.getOrCreateClassData(String)) | | SIPUSH 106 | | method-call(void ClassData.touch(int)) | | | INVOKEVIRTUAL ClassData.touch (I)V | | method-call(void ClassData.touch(int)) | | ALOAD_1 | | method-call(Object Expression.getValue()) | | | INVOKEVIRTUAL Expression.getValue () | | method-call(Object Expression.getValue()) | catch java.lang.Exception (1806389629) -> E0 | ARETURN | method-call(nProjectData ProjectData.getGlobalProjectData()) | | E0: INVOKESTATIC ProjectData.getGlobalProjectData () | method-call(ProjectData ProjectData.getGlobalProjectData()) | LDC "Object" We can see the problem in that final method-call. The target for the exception handler seen earlier (E0) is within the method-call shadow. What to do?
resolved fixed
5f97d46
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2008-05-07T15:31:18Z
2008-05-07T03:13:20Z
weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java
} } } private void handleRangeInstruction(InstructionHandle ih, LinkedList exnList) { Range r = Range.getRange(ih); if (r instanceof ExceptionRange) { ExceptionRange er = (ExceptionRange) r; if (er.getStart() == ih) { if (!er.isEmpty()){ insertHandler(er, exnList); } } } else { } } /* Make copies of all instructions, append them to the new list * and associate old instruction references with the new ones, i.e., * a 1:1 mapping. */ private Map copyAllInstructionsExceptRangeInstructionsInto(InstructionList intoList) { HashMap map = new HashMap(); for (InstructionHandle ih = getBody().getStart(); ih != null; ih = ih.getNext()) { if (Range.isRangeHandle(ih)) { continue; }
230,817
Bug 230817 LazyMethodGen.remap() NullPointerException
This has been reported a few times by different users, but has always proved tough to diagnose. The typical stack trace is something like: java.lang.NullPointerException org.aspectj.weaver.bcel.LazyMethodGen.remap(LazyMethodGen.java:1237) org.aspectj.weaver.bcel.LazyMethodGen.addExceptionHandlers(LazyMethodGen.java:1132) org.aspectj.weaver.bcel.LazyMethodGen.packBody(LazyMethodGen.java:1078) org.aspectj.weaver.bcel.LazyMethodGen.pack(LazyMethodGen.java:977) org.aspectj.weaver.bcel.LazyMethodGen.getMethod(LazyMethodGen.java:484) org.aspectj.weaver.bcel.LazyClassGen.writeBack(LazyClassGen.java:512) org.aspectj.weaver.bcel.LazyClassGen.getJavaClassBytesIncludingReweavable(LazyClassGen.java:652) org.aspectj.weaver.bcel.BcelWeaver.getClassFilesFor(BcelWeaver.java:1420) org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1390) And that is an exception on this line in remap() ih = ih.getNext(); called from the addExceptionHandlers() line: gen.addExceptionHandler( remap(r.getRealStart(), map), remap(r.getRealEnd(), map), remap(r.getHandler(), map), (r.getCatchType() == null) ? null : (ObjectType) BcelWorld.makeBcelType(r.getCatchType())); During weaving, an instruction list is augmented with extra entries representing where shadows start and end (method-call, method-execution, handler, etc). When weaving is complete we want to remove these temporary elements and use the remaining instructions to produce the method bytecode. Now sometimes these temporary entries are targeted by other elements (line number tags, local variable tags and exception handlers usually). During packing we use remap() to reposition the locations so they move off of temporary placeholders and onto real instructions that will make it out into the bytecode. What the above exception tells us is that we started walking over temporary placeholder entries, but before we came to a real instruction, we ran out of instructions! This cannot happen, and indicates something went seriously wrong, we should always encounter an instruction when remapping off a temporary element. After some digging it is actually the remap() call for the handler (not the start or end) that leads to the problem. The handler represents where to jump to in the code when an exception of the specified type occurs between the instructions pointed at by start and end. I sent a debug build to a user encountering this problem (I could not recreate it) and in that I was looking at where in fact the handler was pointing before we called remap(). I learned that when this problem occurs, the handler is not pointing to anywhere in the method currently being processed (not good). In a second debug build I tried to ascertain who was setting these handlers to point to nowhere. This debug never triggered, no-one was setting them to point to nowhere... I happened to notice whilst going through the instructions in the debug output that cobertura was being used, a coverage toolkit that works by doing bytecode manipulation to insert calls out to a library. AspectJ was being called after cobertura and I asked the user to try the steps the other way round - it worked fine. Indicating cobertura was doing something to the bytecode that gave us problems. After much messing about, I recreated it by applying around advice to within(*) to all the classes in rt.jar (I just used that as a very large standalone jar file I could weave into). I learned that Cobertura creates catch blocks that look a little different to what javac and other compilers create. The typical bytecode sequence a compiler produces for a catch block starts with a STORE instruction, to store the exception being caught (whether the body of the catch block uses it or not). But the cobertura catch blocks started with an INVOKESTATIC instruction, a call out to another method. What does this mean? It means the same instruction has two shadows, a 'handler' shadow and a 'method-call' shadow - and it turns out this is what causes our problem. If around advice is applied to the call join point and it cannot be inlined then the body of the call shadow (the call itself) is pulled out into a new method. Because the handler was the same instruction, this meant the handler *was also being pulled out* into the new method, leaving behind an exception handler that jumped to an invalid location (in fact it 'jumped' to an instruction in a different method!). So the reason I never saw the handler location being set incorrectly is that it was set correctly up front, but then dragged out with the method-call shadow into the wrong place. In bytecode terms it looks like this: method-execution() | ICONST_0 | ISTORE_2 | SIPUSH -1 | ISTORE_3 | catch java.lang.Exception (1806389629) -> E0 | | method-call(ProjectData ProjectData.getGlobalProjectData()) | | | INVOKESTATIC ProjectData.getGlobalProjectData () | | method-call(ProjectData getGlobalProjectData()) | | LDC "SomeString" | | method-call(ClassData getOrCreateClassData(java.lang.String)) | | | INVOKEVIRTUAL ProjectData.getOrCreateClassData (LString;) | | method-call(ClassData ProjectData.getOrCreateClassData(String)) | | SIPUSH 106 | | method-call(void ClassData.touch(int)) | | | INVOKEVIRTUAL ClassData.touch (I)V | | method-call(void ClassData.touch(int)) | | ALOAD_1 | | method-call(Object Expression.getValue()) | | | INVOKEVIRTUAL Expression.getValue () | | method-call(Object Expression.getValue()) | catch java.lang.Exception (1806389629) -> E0 | ARETURN | method-call(nProjectData ProjectData.getGlobalProjectData()) | | E0: INVOKESTATIC ProjectData.getGlobalProjectData () | method-call(ProjectData ProjectData.getGlobalProjectData()) | LDC "Object" We can see the problem in that final method-call. The target for the exception handler seen earlier (E0) is within the method-call shadow. What to do?
resolved fixed
5f97d46
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2008-05-07T15:31:18Z
2008-05-07T03:13:20Z
weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java
Instruction i = ih.getInstruction(); Instruction c = Utility.copyInstruction(i); if (c instanceof BranchInstruction) map.put(ih, intoList.append((BranchInstruction) c)); else map.put(ih, intoList.append(c)); } return map; } /** This procedure should not currently be used. */ } } try { } } curr = next; } } private static InstructionHandle remap(InstructionHandle ih, Map map) { while (true) { Object ret = map.get(ih); if (ret == null) { ih = ih.getNext(); } else { return (InstructionHandle) ret; } } }
230,817
Bug 230817 LazyMethodGen.remap() NullPointerException
This has been reported a few times by different users, but has always proved tough to diagnose. The typical stack trace is something like: java.lang.NullPointerException org.aspectj.weaver.bcel.LazyMethodGen.remap(LazyMethodGen.java:1237) org.aspectj.weaver.bcel.LazyMethodGen.addExceptionHandlers(LazyMethodGen.java:1132) org.aspectj.weaver.bcel.LazyMethodGen.packBody(LazyMethodGen.java:1078) org.aspectj.weaver.bcel.LazyMethodGen.pack(LazyMethodGen.java:977) org.aspectj.weaver.bcel.LazyMethodGen.getMethod(LazyMethodGen.java:484) org.aspectj.weaver.bcel.LazyClassGen.writeBack(LazyClassGen.java:512) org.aspectj.weaver.bcel.LazyClassGen.getJavaClassBytesIncludingReweavable(LazyClassGen.java:652) org.aspectj.weaver.bcel.BcelWeaver.getClassFilesFor(BcelWeaver.java:1420) org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1390) And that is an exception on this line in remap() ih = ih.getNext(); called from the addExceptionHandlers() line: gen.addExceptionHandler( remap(r.getRealStart(), map), remap(r.getRealEnd(), map), remap(r.getHandler(), map), (r.getCatchType() == null) ? null : (ObjectType) BcelWorld.makeBcelType(r.getCatchType())); During weaving, an instruction list is augmented with extra entries representing where shadows start and end (method-call, method-execution, handler, etc). When weaving is complete we want to remove these temporary elements and use the remaining instructions to produce the method bytecode. Now sometimes these temporary entries are targeted by other elements (line number tags, local variable tags and exception handlers usually). During packing we use remap() to reposition the locations so they move off of temporary placeholders and onto real instructions that will make it out into the bytecode. What the above exception tells us is that we started walking over temporary placeholder entries, but before we came to a real instruction, we ran out of instructions! This cannot happen, and indicates something went seriously wrong, we should always encounter an instruction when remapping off a temporary element. After some digging it is actually the remap() call for the handler (not the start or end) that leads to the problem. The handler represents where to jump to in the code when an exception of the specified type occurs between the instructions pointed at by start and end. I sent a debug build to a user encountering this problem (I could not recreate it) and in that I was looking at where in fact the handler was pointing before we called remap(). I learned that when this problem occurs, the handler is not pointing to anywhere in the method currently being processed (not good). In a second debug build I tried to ascertain who was setting these handlers to point to nowhere. This debug never triggered, no-one was setting them to point to nowhere... I happened to notice whilst going through the instructions in the debug output that cobertura was being used, a coverage toolkit that works by doing bytecode manipulation to insert calls out to a library. AspectJ was being called after cobertura and I asked the user to try the steps the other way round - it worked fine. Indicating cobertura was doing something to the bytecode that gave us problems. After much messing about, I recreated it by applying around advice to within(*) to all the classes in rt.jar (I just used that as a very large standalone jar file I could weave into). I learned that Cobertura creates catch blocks that look a little different to what javac and other compilers create. The typical bytecode sequence a compiler produces for a catch block starts with a STORE instruction, to store the exception being caught (whether the body of the catch block uses it or not). But the cobertura catch blocks started with an INVOKESTATIC instruction, a call out to another method. What does this mean? It means the same instruction has two shadows, a 'handler' shadow and a 'method-call' shadow - and it turns out this is what causes our problem. If around advice is applied to the call join point and it cannot be inlined then the body of the call shadow (the call itself) is pulled out into a new method. Because the handler was the same instruction, this meant the handler *was also being pulled out* into the new method, leaving behind an exception handler that jumped to an invalid location (in fact it 'jumped' to an instruction in a different method!). So the reason I never saw the handler location being set incorrectly is that it was set correctly up front, but then dragged out with the method-call shadow into the wrong place. In bytecode terms it looks like this: method-execution() | ICONST_0 | ISTORE_2 | SIPUSH -1 | ISTORE_3 | catch java.lang.Exception (1806389629) -> E0 | | method-call(ProjectData ProjectData.getGlobalProjectData()) | | | INVOKESTATIC ProjectData.getGlobalProjectData () | | method-call(ProjectData getGlobalProjectData()) | | LDC "SomeString" | | method-call(ClassData getOrCreateClassData(java.lang.String)) | | | INVOKEVIRTUAL ProjectData.getOrCreateClassData (LString;) | | method-call(ClassData ProjectData.getOrCreateClassData(String)) | | SIPUSH 106 | | method-call(void ClassData.touch(int)) | | | INVOKEVIRTUAL ClassData.touch (I)V | | method-call(void ClassData.touch(int)) | | ALOAD_1 | | method-call(Object Expression.getValue()) | | | INVOKEVIRTUAL Expression.getValue () | | method-call(Object Expression.getValue()) | catch java.lang.Exception (1806389629) -> E0 | ARETURN | method-call(nProjectData ProjectData.getGlobalProjectData()) | | E0: INVOKESTATIC ProjectData.getGlobalProjectData () | method-call(ProjectData ProjectData.getGlobalProjectData()) | LDC "Object" We can see the problem in that final method-call. The target for the exception handler seen earlier (E0) is within the method-call shadow. What to do?
resolved fixed
5f97d46
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2008-05-07T15:31:18Z
2008-05-07T03:13:20Z
weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java
static void insertHandler(ExceptionRange fresh, LinkedList l) { for (ListIterator iter = l.listIterator(); iter.hasNext();) { ExceptionRange r = (ExceptionRange) iter.next(); if (fresh.getPriority() >= r.getPriority()) { iter.previous(); iter.add(fresh); return;
230,817
Bug 230817 LazyMethodGen.remap() NullPointerException
This has been reported a few times by different users, but has always proved tough to diagnose. The typical stack trace is something like: java.lang.NullPointerException org.aspectj.weaver.bcel.LazyMethodGen.remap(LazyMethodGen.java:1237) org.aspectj.weaver.bcel.LazyMethodGen.addExceptionHandlers(LazyMethodGen.java:1132) org.aspectj.weaver.bcel.LazyMethodGen.packBody(LazyMethodGen.java:1078) org.aspectj.weaver.bcel.LazyMethodGen.pack(LazyMethodGen.java:977) org.aspectj.weaver.bcel.LazyMethodGen.getMethod(LazyMethodGen.java:484) org.aspectj.weaver.bcel.LazyClassGen.writeBack(LazyClassGen.java:512) org.aspectj.weaver.bcel.LazyClassGen.getJavaClassBytesIncludingReweavable(LazyClassGen.java:652) org.aspectj.weaver.bcel.BcelWeaver.getClassFilesFor(BcelWeaver.java:1420) org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1390) And that is an exception on this line in remap() ih = ih.getNext(); called from the addExceptionHandlers() line: gen.addExceptionHandler( remap(r.getRealStart(), map), remap(r.getRealEnd(), map), remap(r.getHandler(), map), (r.getCatchType() == null) ? null : (ObjectType) BcelWorld.makeBcelType(r.getCatchType())); During weaving, an instruction list is augmented with extra entries representing where shadows start and end (method-call, method-execution, handler, etc). When weaving is complete we want to remove these temporary elements and use the remaining instructions to produce the method bytecode. Now sometimes these temporary entries are targeted by other elements (line number tags, local variable tags and exception handlers usually). During packing we use remap() to reposition the locations so they move off of temporary placeholders and onto real instructions that will make it out into the bytecode. What the above exception tells us is that we started walking over temporary placeholder entries, but before we came to a real instruction, we ran out of instructions! This cannot happen, and indicates something went seriously wrong, we should always encounter an instruction when remapping off a temporary element. After some digging it is actually the remap() call for the handler (not the start or end) that leads to the problem. The handler represents where to jump to in the code when an exception of the specified type occurs between the instructions pointed at by start and end. I sent a debug build to a user encountering this problem (I could not recreate it) and in that I was looking at where in fact the handler was pointing before we called remap(). I learned that when this problem occurs, the handler is not pointing to anywhere in the method currently being processed (not good). In a second debug build I tried to ascertain who was setting these handlers to point to nowhere. This debug never triggered, no-one was setting them to point to nowhere... I happened to notice whilst going through the instructions in the debug output that cobertura was being used, a coverage toolkit that works by doing bytecode manipulation to insert calls out to a library. AspectJ was being called after cobertura and I asked the user to try the steps the other way round - it worked fine. Indicating cobertura was doing something to the bytecode that gave us problems. After much messing about, I recreated it by applying around advice to within(*) to all the classes in rt.jar (I just used that as a very large standalone jar file I could weave into). I learned that Cobertura creates catch blocks that look a little different to what javac and other compilers create. The typical bytecode sequence a compiler produces for a catch block starts with a STORE instruction, to store the exception being caught (whether the body of the catch block uses it or not). But the cobertura catch blocks started with an INVOKESTATIC instruction, a call out to another method. What does this mean? It means the same instruction has two shadows, a 'handler' shadow and a 'method-call' shadow - and it turns out this is what causes our problem. If around advice is applied to the call join point and it cannot be inlined then the body of the call shadow (the call itself) is pulled out into a new method. Because the handler was the same instruction, this meant the handler *was also being pulled out* into the new method, leaving behind an exception handler that jumped to an invalid location (in fact it 'jumped' to an instruction in a different method!). So the reason I never saw the handler location being set incorrectly is that it was set correctly up front, but then dragged out with the method-call shadow into the wrong place. In bytecode terms it looks like this: method-execution() | ICONST_0 | ISTORE_2 | SIPUSH -1 | ISTORE_3 | catch java.lang.Exception (1806389629) -> E0 | | method-call(ProjectData ProjectData.getGlobalProjectData()) | | | INVOKESTATIC ProjectData.getGlobalProjectData () | | method-call(ProjectData getGlobalProjectData()) | | LDC "SomeString" | | method-call(ClassData getOrCreateClassData(java.lang.String)) | | | INVOKEVIRTUAL ProjectData.getOrCreateClassData (LString;) | | method-call(ClassData ProjectData.getOrCreateClassData(String)) | | SIPUSH 106 | | method-call(void ClassData.touch(int)) | | | INVOKEVIRTUAL ClassData.touch (I)V | | method-call(void ClassData.touch(int)) | | ALOAD_1 | | method-call(Object Expression.getValue()) | | | INVOKEVIRTUAL Expression.getValue () | | method-call(Object Expression.getValue()) | catch java.lang.Exception (1806389629) -> E0 | ARETURN | method-call(nProjectData ProjectData.getGlobalProjectData()) | | E0: INVOKESTATIC ProjectData.getGlobalProjectData () | method-call(ProjectData ProjectData.getGlobalProjectData()) | LDC "Object" We can see the problem in that final method-call. The target for the exception handler seen earlier (E0) is within the method-call shadow. What to do?
resolved fixed
5f97d46
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2008-05-07T15:31:18Z
2008-05-07T03:13:20Z
weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java
} } l.add(fresh); } public boolean isPrivate() { return Modifier.isPrivate(getAccessFlags()); } public boolean isProtected() { return Modifier.isProtected(getAccessFlags()); } public boolean isDefault() { return !(isProtected() || isPrivate() || isPublic()); } public boolean isPublic() { return Modifier.isPublic(getAccessFlags()); } ---- /** A good body is a body with the following properties: * * <ul> * <li> For each branch instruction S in body, target T of S is in body. * <li> For each branch instruction S in body, target T of S has S as a targeter. * <li> For each instruction T in body, for each branch instruction S that is a * targeter of T, S is in body. * <li> For each non-range-handle instruction T in body, for each instruction S * that is a targeter of T, S is * either a branch instruction, an exception range or a tag
230,817
Bug 230817 LazyMethodGen.remap() NullPointerException
This has been reported a few times by different users, but has always proved tough to diagnose. The typical stack trace is something like: java.lang.NullPointerException org.aspectj.weaver.bcel.LazyMethodGen.remap(LazyMethodGen.java:1237) org.aspectj.weaver.bcel.LazyMethodGen.addExceptionHandlers(LazyMethodGen.java:1132) org.aspectj.weaver.bcel.LazyMethodGen.packBody(LazyMethodGen.java:1078) org.aspectj.weaver.bcel.LazyMethodGen.pack(LazyMethodGen.java:977) org.aspectj.weaver.bcel.LazyMethodGen.getMethod(LazyMethodGen.java:484) org.aspectj.weaver.bcel.LazyClassGen.writeBack(LazyClassGen.java:512) org.aspectj.weaver.bcel.LazyClassGen.getJavaClassBytesIncludingReweavable(LazyClassGen.java:652) org.aspectj.weaver.bcel.BcelWeaver.getClassFilesFor(BcelWeaver.java:1420) org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1390) And that is an exception on this line in remap() ih = ih.getNext(); called from the addExceptionHandlers() line: gen.addExceptionHandler( remap(r.getRealStart(), map), remap(r.getRealEnd(), map), remap(r.getHandler(), map), (r.getCatchType() == null) ? null : (ObjectType) BcelWorld.makeBcelType(r.getCatchType())); During weaving, an instruction list is augmented with extra entries representing where shadows start and end (method-call, method-execution, handler, etc). When weaving is complete we want to remove these temporary elements and use the remaining instructions to produce the method bytecode. Now sometimes these temporary entries are targeted by other elements (line number tags, local variable tags and exception handlers usually). During packing we use remap() to reposition the locations so they move off of temporary placeholders and onto real instructions that will make it out into the bytecode. What the above exception tells us is that we started walking over temporary placeholder entries, but before we came to a real instruction, we ran out of instructions! This cannot happen, and indicates something went seriously wrong, we should always encounter an instruction when remapping off a temporary element. After some digging it is actually the remap() call for the handler (not the start or end) that leads to the problem. The handler represents where to jump to in the code when an exception of the specified type occurs between the instructions pointed at by start and end. I sent a debug build to a user encountering this problem (I could not recreate it) and in that I was looking at where in fact the handler was pointing before we called remap(). I learned that when this problem occurs, the handler is not pointing to anywhere in the method currently being processed (not good). In a second debug build I tried to ascertain who was setting these handlers to point to nowhere. This debug never triggered, no-one was setting them to point to nowhere... I happened to notice whilst going through the instructions in the debug output that cobertura was being used, a coverage toolkit that works by doing bytecode manipulation to insert calls out to a library. AspectJ was being called after cobertura and I asked the user to try the steps the other way round - it worked fine. Indicating cobertura was doing something to the bytecode that gave us problems. After much messing about, I recreated it by applying around advice to within(*) to all the classes in rt.jar (I just used that as a very large standalone jar file I could weave into). I learned that Cobertura creates catch blocks that look a little different to what javac and other compilers create. The typical bytecode sequence a compiler produces for a catch block starts with a STORE instruction, to store the exception being caught (whether the body of the catch block uses it or not). But the cobertura catch blocks started with an INVOKESTATIC instruction, a call out to another method. What does this mean? It means the same instruction has two shadows, a 'handler' shadow and a 'method-call' shadow - and it turns out this is what causes our problem. If around advice is applied to the call join point and it cannot be inlined then the body of the call shadow (the call itself) is pulled out into a new method. Because the handler was the same instruction, this meant the handler *was also being pulled out* into the new method, leaving behind an exception handler that jumped to an invalid location (in fact it 'jumped' to an instruction in a different method!). So the reason I never saw the handler location being set incorrectly is that it was set correctly up front, but then dragged out with the method-call shadow into the wrong place. In bytecode terms it looks like this: method-execution() | ICONST_0 | ISTORE_2 | SIPUSH -1 | ISTORE_3 | catch java.lang.Exception (1806389629) -> E0 | | method-call(ProjectData ProjectData.getGlobalProjectData()) | | | INVOKESTATIC ProjectData.getGlobalProjectData () | | method-call(ProjectData getGlobalProjectData()) | | LDC "SomeString" | | method-call(ClassData getOrCreateClassData(java.lang.String)) | | | INVOKEVIRTUAL ProjectData.getOrCreateClassData (LString;) | | method-call(ClassData ProjectData.getOrCreateClassData(String)) | | SIPUSH 106 | | method-call(void ClassData.touch(int)) | | | INVOKEVIRTUAL ClassData.touch (I)V | | method-call(void ClassData.touch(int)) | | ALOAD_1 | | method-call(Object Expression.getValue()) | | | INVOKEVIRTUAL Expression.getValue () | | method-call(Object Expression.getValue()) | catch java.lang.Exception (1806389629) -> E0 | ARETURN | method-call(nProjectData ProjectData.getGlobalProjectData()) | | E0: INVOKESTATIC ProjectData.getGlobalProjectData () | method-call(ProjectData ProjectData.getGlobalProjectData()) | LDC "Object" We can see the problem in that final method-call. The target for the exception handler seen earlier (E0) is within the method-call shadow. What to do?
resolved fixed
5f97d46
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2008-05-07T15:31:18Z
2008-05-07T03:13:20Z
weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java
* <li> For each range-handle instruction T in body, there is exactly one targeter S * that is a range. * <li> For each range-handle instruction T in body, the range R targeting T is in body. * <li> For each instruction T in body, for each exception range R targeting T, R is * in body. * <li> For each exception range R in body, let T := R.handler. T is in body, and R is one * of T's targeters * <li> All ranges are properly nested: For all ranges Q and R, if Q.start preceeds * R.start, then R.end preceeds Q.end. * </ul> * * Where the shorthand "R is in body" means "R.start is in body, R.end is in body, and * any InstructionHandle stored in a field of R (such as an exception handle) is in body". */ public void assertGoodBody() { if (true) return; assertGoodBody(getBody(), toString()); } public static void assertGoodBody(InstructionList il, String from) { if (true) return; if (il == null) return; Set body = new HashSet(); Stack ranges = new Stack(); for (InstructionHandle ih = il.getStart(); ih != null; ih = ih.getNext()) { body.add(ih); if (ih.getInstruction() instanceof BranchInstruction) { body.add(ih.getInstruction()); }
230,817
Bug 230817 LazyMethodGen.remap() NullPointerException
This has been reported a few times by different users, but has always proved tough to diagnose. The typical stack trace is something like: java.lang.NullPointerException org.aspectj.weaver.bcel.LazyMethodGen.remap(LazyMethodGen.java:1237) org.aspectj.weaver.bcel.LazyMethodGen.addExceptionHandlers(LazyMethodGen.java:1132) org.aspectj.weaver.bcel.LazyMethodGen.packBody(LazyMethodGen.java:1078) org.aspectj.weaver.bcel.LazyMethodGen.pack(LazyMethodGen.java:977) org.aspectj.weaver.bcel.LazyMethodGen.getMethod(LazyMethodGen.java:484) org.aspectj.weaver.bcel.LazyClassGen.writeBack(LazyClassGen.java:512) org.aspectj.weaver.bcel.LazyClassGen.getJavaClassBytesIncludingReweavable(LazyClassGen.java:652) org.aspectj.weaver.bcel.BcelWeaver.getClassFilesFor(BcelWeaver.java:1420) org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1390) And that is an exception on this line in remap() ih = ih.getNext(); called from the addExceptionHandlers() line: gen.addExceptionHandler( remap(r.getRealStart(), map), remap(r.getRealEnd(), map), remap(r.getHandler(), map), (r.getCatchType() == null) ? null : (ObjectType) BcelWorld.makeBcelType(r.getCatchType())); During weaving, an instruction list is augmented with extra entries representing where shadows start and end (method-call, method-execution, handler, etc). When weaving is complete we want to remove these temporary elements and use the remaining instructions to produce the method bytecode. Now sometimes these temporary entries are targeted by other elements (line number tags, local variable tags and exception handlers usually). During packing we use remap() to reposition the locations so they move off of temporary placeholders and onto real instructions that will make it out into the bytecode. What the above exception tells us is that we started walking over temporary placeholder entries, but before we came to a real instruction, we ran out of instructions! This cannot happen, and indicates something went seriously wrong, we should always encounter an instruction when remapping off a temporary element. After some digging it is actually the remap() call for the handler (not the start or end) that leads to the problem. The handler represents where to jump to in the code when an exception of the specified type occurs between the instructions pointed at by start and end. I sent a debug build to a user encountering this problem (I could not recreate it) and in that I was looking at where in fact the handler was pointing before we called remap(). I learned that when this problem occurs, the handler is not pointing to anywhere in the method currently being processed (not good). In a second debug build I tried to ascertain who was setting these handlers to point to nowhere. This debug never triggered, no-one was setting them to point to nowhere... I happened to notice whilst going through the instructions in the debug output that cobertura was being used, a coverage toolkit that works by doing bytecode manipulation to insert calls out to a library. AspectJ was being called after cobertura and I asked the user to try the steps the other way round - it worked fine. Indicating cobertura was doing something to the bytecode that gave us problems. After much messing about, I recreated it by applying around advice to within(*) to all the classes in rt.jar (I just used that as a very large standalone jar file I could weave into). I learned that Cobertura creates catch blocks that look a little different to what javac and other compilers create. The typical bytecode sequence a compiler produces for a catch block starts with a STORE instruction, to store the exception being caught (whether the body of the catch block uses it or not). But the cobertura catch blocks started with an INVOKESTATIC instruction, a call out to another method. What does this mean? It means the same instruction has two shadows, a 'handler' shadow and a 'method-call' shadow - and it turns out this is what causes our problem. If around advice is applied to the call join point and it cannot be inlined then the body of the call shadow (the call itself) is pulled out into a new method. Because the handler was the same instruction, this meant the handler *was also being pulled out* into the new method, leaving behind an exception handler that jumped to an invalid location (in fact it 'jumped' to an instruction in a different method!). So the reason I never saw the handler location being set incorrectly is that it was set correctly up front, but then dragged out with the method-call shadow into the wrong place. In bytecode terms it looks like this: method-execution() | ICONST_0 | ISTORE_2 | SIPUSH -1 | ISTORE_3 | catch java.lang.Exception (1806389629) -> E0 | | method-call(ProjectData ProjectData.getGlobalProjectData()) | | | INVOKESTATIC ProjectData.getGlobalProjectData () | | method-call(ProjectData getGlobalProjectData()) | | LDC "SomeString" | | method-call(ClassData getOrCreateClassData(java.lang.String)) | | | INVOKEVIRTUAL ProjectData.getOrCreateClassData (LString;) | | method-call(ClassData ProjectData.getOrCreateClassData(String)) | | SIPUSH 106 | | method-call(void ClassData.touch(int)) | | | INVOKEVIRTUAL ClassData.touch (I)V | | method-call(void ClassData.touch(int)) | | ALOAD_1 | | method-call(Object Expression.getValue()) | | | INVOKEVIRTUAL Expression.getValue () | | method-call(Object Expression.getValue()) | catch java.lang.Exception (1806389629) -> E0 | ARETURN | method-call(nProjectData ProjectData.getGlobalProjectData()) | | E0: INVOKESTATIC ProjectData.getGlobalProjectData () | method-call(ProjectData ProjectData.getGlobalProjectData()) | LDC "Object" We can see the problem in that final method-call. The target for the exception handler seen earlier (E0) is within the method-call shadow. What to do?
resolved fixed
5f97d46
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2008-05-07T15:31:18Z
2008-05-07T03:13:20Z
weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java
} for (InstructionHandle ih = il.getStart(); ih != null; ih = ih.getNext()) { assertGoodHandle(ih, body, ranges, from); InstructionTargeter[] ts = ih.getTargeters(); if (ts != null) { for (int i = ts.length - 1; i >= 0; i--) { assertGoodTargeter(ts[i], ih, body, from); } } } } private static void assertGoodHandle(InstructionHandle ih, Set body, Stack ranges, String from) { Instruction inst = ih.getInstruction(); if ((inst instanceof BranchInstruction) ^ (ih instanceof BranchHandle)) { throw new BCException("bad instruction/handle pair in " + from); } if (Range.isRangeHandle(ih)) { assertGoodRangeHandle(ih, body, ranges, from); } else if (inst instanceof BranchInstruction) { assertGoodBranchInstruction((BranchHandle) ih, (BranchInstruction) inst, body, ranges, from); } } private static void assertGoodBranchInstruction( BranchHandle ih, BranchInstruction inst, Set body, Stack ranges, String from) {
230,817
Bug 230817 LazyMethodGen.remap() NullPointerException
This has been reported a few times by different users, but has always proved tough to diagnose. The typical stack trace is something like: java.lang.NullPointerException org.aspectj.weaver.bcel.LazyMethodGen.remap(LazyMethodGen.java:1237) org.aspectj.weaver.bcel.LazyMethodGen.addExceptionHandlers(LazyMethodGen.java:1132) org.aspectj.weaver.bcel.LazyMethodGen.packBody(LazyMethodGen.java:1078) org.aspectj.weaver.bcel.LazyMethodGen.pack(LazyMethodGen.java:977) org.aspectj.weaver.bcel.LazyMethodGen.getMethod(LazyMethodGen.java:484) org.aspectj.weaver.bcel.LazyClassGen.writeBack(LazyClassGen.java:512) org.aspectj.weaver.bcel.LazyClassGen.getJavaClassBytesIncludingReweavable(LazyClassGen.java:652) org.aspectj.weaver.bcel.BcelWeaver.getClassFilesFor(BcelWeaver.java:1420) org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1390) And that is an exception on this line in remap() ih = ih.getNext(); called from the addExceptionHandlers() line: gen.addExceptionHandler( remap(r.getRealStart(), map), remap(r.getRealEnd(), map), remap(r.getHandler(), map), (r.getCatchType() == null) ? null : (ObjectType) BcelWorld.makeBcelType(r.getCatchType())); During weaving, an instruction list is augmented with extra entries representing where shadows start and end (method-call, method-execution, handler, etc). When weaving is complete we want to remove these temporary elements and use the remaining instructions to produce the method bytecode. Now sometimes these temporary entries are targeted by other elements (line number tags, local variable tags and exception handlers usually). During packing we use remap() to reposition the locations so they move off of temporary placeholders and onto real instructions that will make it out into the bytecode. What the above exception tells us is that we started walking over temporary placeholder entries, but before we came to a real instruction, we ran out of instructions! This cannot happen, and indicates something went seriously wrong, we should always encounter an instruction when remapping off a temporary element. After some digging it is actually the remap() call for the handler (not the start or end) that leads to the problem. The handler represents where to jump to in the code when an exception of the specified type occurs between the instructions pointed at by start and end. I sent a debug build to a user encountering this problem (I could not recreate it) and in that I was looking at where in fact the handler was pointing before we called remap(). I learned that when this problem occurs, the handler is not pointing to anywhere in the method currently being processed (not good). In a second debug build I tried to ascertain who was setting these handlers to point to nowhere. This debug never triggered, no-one was setting them to point to nowhere... I happened to notice whilst going through the instructions in the debug output that cobertura was being used, a coverage toolkit that works by doing bytecode manipulation to insert calls out to a library. AspectJ was being called after cobertura and I asked the user to try the steps the other way round - it worked fine. Indicating cobertura was doing something to the bytecode that gave us problems. After much messing about, I recreated it by applying around advice to within(*) to all the classes in rt.jar (I just used that as a very large standalone jar file I could weave into). I learned that Cobertura creates catch blocks that look a little different to what javac and other compilers create. The typical bytecode sequence a compiler produces for a catch block starts with a STORE instruction, to store the exception being caught (whether the body of the catch block uses it or not). But the cobertura catch blocks started with an INVOKESTATIC instruction, a call out to another method. What does this mean? It means the same instruction has two shadows, a 'handler' shadow and a 'method-call' shadow - and it turns out this is what causes our problem. If around advice is applied to the call join point and it cannot be inlined then the body of the call shadow (the call itself) is pulled out into a new method. Because the handler was the same instruction, this meant the handler *was also being pulled out* into the new method, leaving behind an exception handler that jumped to an invalid location (in fact it 'jumped' to an instruction in a different method!). So the reason I never saw the handler location being set incorrectly is that it was set correctly up front, but then dragged out with the method-call shadow into the wrong place. In bytecode terms it looks like this: method-execution() | ICONST_0 | ISTORE_2 | SIPUSH -1 | ISTORE_3 | catch java.lang.Exception (1806389629) -> E0 | | method-call(ProjectData ProjectData.getGlobalProjectData()) | | | INVOKESTATIC ProjectData.getGlobalProjectData () | | method-call(ProjectData getGlobalProjectData()) | | LDC "SomeString" | | method-call(ClassData getOrCreateClassData(java.lang.String)) | | | INVOKEVIRTUAL ProjectData.getOrCreateClassData (LString;) | | method-call(ClassData ProjectData.getOrCreateClassData(String)) | | SIPUSH 106 | | method-call(void ClassData.touch(int)) | | | INVOKEVIRTUAL ClassData.touch (I)V | | method-call(void ClassData.touch(int)) | | ALOAD_1 | | method-call(Object Expression.getValue()) | | | INVOKEVIRTUAL Expression.getValue () | | method-call(Object Expression.getValue()) | catch java.lang.Exception (1806389629) -> E0 | ARETURN | method-call(nProjectData ProjectData.getGlobalProjectData()) | | E0: INVOKESTATIC ProjectData.getGlobalProjectData () | method-call(ProjectData ProjectData.getGlobalProjectData()) | LDC "Object" We can see the problem in that final method-call. The target for the exception handler seen earlier (E0) is within the method-call shadow. What to do?
resolved fixed
5f97d46
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2008-05-07T15:31:18Z
2008-05-07T03:13:20Z
weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java
if (ih.getTarget() != inst.getTarget()) { throw new BCException("bad branch instruction/handle pair in " + from); } InstructionHandle target = ih.getTarget(); assertInBody(target, body, from); assertTargetedBy(target, inst, from); if (inst instanceof Select) { Select sel = (Select) inst; InstructionHandle[] itargets = sel.getTargets(); for (int k = itargets.length - 1; k >= 0; k--) { assertInBody(itargets[k], body, from); assertTargetedBy(itargets[k], inst, from); } } } private static void assertInBody(Object ih, Set body, String from) { if (! body.contains(ih)) throw new BCException("thing not in body in " + from); } private static void assertGoodRangeHandle(InstructionHandle ih, Set body, Stack ranges, String from) { Range r = getRangeAndAssertExactlyOne(ih, from); assertGoodRange(r, body, from); if (r.getStart() == ih) { ranges.push(r); } else if (r.getEnd() == ih) { if (ranges.peek() != r) throw new BCException("bad range inclusion in " + from); ranges.pop(); } }
230,817
Bug 230817 LazyMethodGen.remap() NullPointerException
This has been reported a few times by different users, but has always proved tough to diagnose. The typical stack trace is something like: java.lang.NullPointerException org.aspectj.weaver.bcel.LazyMethodGen.remap(LazyMethodGen.java:1237) org.aspectj.weaver.bcel.LazyMethodGen.addExceptionHandlers(LazyMethodGen.java:1132) org.aspectj.weaver.bcel.LazyMethodGen.packBody(LazyMethodGen.java:1078) org.aspectj.weaver.bcel.LazyMethodGen.pack(LazyMethodGen.java:977) org.aspectj.weaver.bcel.LazyMethodGen.getMethod(LazyMethodGen.java:484) org.aspectj.weaver.bcel.LazyClassGen.writeBack(LazyClassGen.java:512) org.aspectj.weaver.bcel.LazyClassGen.getJavaClassBytesIncludingReweavable(LazyClassGen.java:652) org.aspectj.weaver.bcel.BcelWeaver.getClassFilesFor(BcelWeaver.java:1420) org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1390) And that is an exception on this line in remap() ih = ih.getNext(); called from the addExceptionHandlers() line: gen.addExceptionHandler( remap(r.getRealStart(), map), remap(r.getRealEnd(), map), remap(r.getHandler(), map), (r.getCatchType() == null) ? null : (ObjectType) BcelWorld.makeBcelType(r.getCatchType())); During weaving, an instruction list is augmented with extra entries representing where shadows start and end (method-call, method-execution, handler, etc). When weaving is complete we want to remove these temporary elements and use the remaining instructions to produce the method bytecode. Now sometimes these temporary entries are targeted by other elements (line number tags, local variable tags and exception handlers usually). During packing we use remap() to reposition the locations so they move off of temporary placeholders and onto real instructions that will make it out into the bytecode. What the above exception tells us is that we started walking over temporary placeholder entries, but before we came to a real instruction, we ran out of instructions! This cannot happen, and indicates something went seriously wrong, we should always encounter an instruction when remapping off a temporary element. After some digging it is actually the remap() call for the handler (not the start or end) that leads to the problem. The handler represents where to jump to in the code when an exception of the specified type occurs between the instructions pointed at by start and end. I sent a debug build to a user encountering this problem (I could not recreate it) and in that I was looking at where in fact the handler was pointing before we called remap(). I learned that when this problem occurs, the handler is not pointing to anywhere in the method currently being processed (not good). In a second debug build I tried to ascertain who was setting these handlers to point to nowhere. This debug never triggered, no-one was setting them to point to nowhere... I happened to notice whilst going through the instructions in the debug output that cobertura was being used, a coverage toolkit that works by doing bytecode manipulation to insert calls out to a library. AspectJ was being called after cobertura and I asked the user to try the steps the other way round - it worked fine. Indicating cobertura was doing something to the bytecode that gave us problems. After much messing about, I recreated it by applying around advice to within(*) to all the classes in rt.jar (I just used that as a very large standalone jar file I could weave into). I learned that Cobertura creates catch blocks that look a little different to what javac and other compilers create. The typical bytecode sequence a compiler produces for a catch block starts with a STORE instruction, to store the exception being caught (whether the body of the catch block uses it or not). But the cobertura catch blocks started with an INVOKESTATIC instruction, a call out to another method. What does this mean? It means the same instruction has two shadows, a 'handler' shadow and a 'method-call' shadow - and it turns out this is what causes our problem. If around advice is applied to the call join point and it cannot be inlined then the body of the call shadow (the call itself) is pulled out into a new method. Because the handler was the same instruction, this meant the handler *was also being pulled out* into the new method, leaving behind an exception handler that jumped to an invalid location (in fact it 'jumped' to an instruction in a different method!). So the reason I never saw the handler location being set incorrectly is that it was set correctly up front, but then dragged out with the method-call shadow into the wrong place. In bytecode terms it looks like this: method-execution() | ICONST_0 | ISTORE_2 | SIPUSH -1 | ISTORE_3 | catch java.lang.Exception (1806389629) -> E0 | | method-call(ProjectData ProjectData.getGlobalProjectData()) | | | INVOKESTATIC ProjectData.getGlobalProjectData () | | method-call(ProjectData getGlobalProjectData()) | | LDC "SomeString" | | method-call(ClassData getOrCreateClassData(java.lang.String)) | | | INVOKEVIRTUAL ProjectData.getOrCreateClassData (LString;) | | method-call(ClassData ProjectData.getOrCreateClassData(String)) | | SIPUSH 106 | | method-call(void ClassData.touch(int)) | | | INVOKEVIRTUAL ClassData.touch (I)V | | method-call(void ClassData.touch(int)) | | ALOAD_1 | | method-call(Object Expression.getValue()) | | | INVOKEVIRTUAL Expression.getValue () | | method-call(Object Expression.getValue()) | catch java.lang.Exception (1806389629) -> E0 | ARETURN | method-call(nProjectData ProjectData.getGlobalProjectData()) | | E0: INVOKESTATIC ProjectData.getGlobalProjectData () | method-call(ProjectData ProjectData.getGlobalProjectData()) | LDC "Object" We can see the problem in that final method-call. The target for the exception handler seen earlier (E0) is within the method-call shadow. What to do?
resolved fixed
5f97d46
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2008-05-07T15:31:18Z
2008-05-07T03:13:20Z
weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java
private static void assertGoodRange(Range r, Set body, String from) { assertInBody(r.getStart(), body, from); assertRangeHandle(r.getStart(), from); assertTargetedBy(r.getStart(), r, from); assertInBody(r.getEnd(), body, from); assertRangeHandle(r.getEnd(), from); assertTargetedBy(r.getEnd(), r, from); if (r instanceof ExceptionRange) { ExceptionRange er = (ExceptionRange) r; assertInBody(er.getHandler(), body, from); assertTargetedBy(er.getHandler(), r, from); } } private static void assertRangeHandle(InstructionHandle ih, String from) { if (! Range.isRangeHandle(ih)) throw new BCException("bad range handle " + ih + " in " + from); } private static void assertTargetedBy( InstructionHandle target, InstructionTargeter targeter, String from) { InstructionTargeter[] ts = target.getTargeters(); if (ts == null) throw new BCException("bad targeting relationship in " + from); for (int i = ts.length - 1; i >= 0; i--) { if (ts[i] == targeter) return; } throw new RuntimeException("bad targeting relationship in " + from); }
230,817
Bug 230817 LazyMethodGen.remap() NullPointerException
This has been reported a few times by different users, but has always proved tough to diagnose. The typical stack trace is something like: java.lang.NullPointerException org.aspectj.weaver.bcel.LazyMethodGen.remap(LazyMethodGen.java:1237) org.aspectj.weaver.bcel.LazyMethodGen.addExceptionHandlers(LazyMethodGen.java:1132) org.aspectj.weaver.bcel.LazyMethodGen.packBody(LazyMethodGen.java:1078) org.aspectj.weaver.bcel.LazyMethodGen.pack(LazyMethodGen.java:977) org.aspectj.weaver.bcel.LazyMethodGen.getMethod(LazyMethodGen.java:484) org.aspectj.weaver.bcel.LazyClassGen.writeBack(LazyClassGen.java:512) org.aspectj.weaver.bcel.LazyClassGen.getJavaClassBytesIncludingReweavable(LazyClassGen.java:652) org.aspectj.weaver.bcel.BcelWeaver.getClassFilesFor(BcelWeaver.java:1420) org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1390) And that is an exception on this line in remap() ih = ih.getNext(); called from the addExceptionHandlers() line: gen.addExceptionHandler( remap(r.getRealStart(), map), remap(r.getRealEnd(), map), remap(r.getHandler(), map), (r.getCatchType() == null) ? null : (ObjectType) BcelWorld.makeBcelType(r.getCatchType())); During weaving, an instruction list is augmented with extra entries representing where shadows start and end (method-call, method-execution, handler, etc). When weaving is complete we want to remove these temporary elements and use the remaining instructions to produce the method bytecode. Now sometimes these temporary entries are targeted by other elements (line number tags, local variable tags and exception handlers usually). During packing we use remap() to reposition the locations so they move off of temporary placeholders and onto real instructions that will make it out into the bytecode. What the above exception tells us is that we started walking over temporary placeholder entries, but before we came to a real instruction, we ran out of instructions! This cannot happen, and indicates something went seriously wrong, we should always encounter an instruction when remapping off a temporary element. After some digging it is actually the remap() call for the handler (not the start or end) that leads to the problem. The handler represents where to jump to in the code when an exception of the specified type occurs between the instructions pointed at by start and end. I sent a debug build to a user encountering this problem (I could not recreate it) and in that I was looking at where in fact the handler was pointing before we called remap(). I learned that when this problem occurs, the handler is not pointing to anywhere in the method currently being processed (not good). In a second debug build I tried to ascertain who was setting these handlers to point to nowhere. This debug never triggered, no-one was setting them to point to nowhere... I happened to notice whilst going through the instructions in the debug output that cobertura was being used, a coverage toolkit that works by doing bytecode manipulation to insert calls out to a library. AspectJ was being called after cobertura and I asked the user to try the steps the other way round - it worked fine. Indicating cobertura was doing something to the bytecode that gave us problems. After much messing about, I recreated it by applying around advice to within(*) to all the classes in rt.jar (I just used that as a very large standalone jar file I could weave into). I learned that Cobertura creates catch blocks that look a little different to what javac and other compilers create. The typical bytecode sequence a compiler produces for a catch block starts with a STORE instruction, to store the exception being caught (whether the body of the catch block uses it or not). But the cobertura catch blocks started with an INVOKESTATIC instruction, a call out to another method. What does this mean? It means the same instruction has two shadows, a 'handler' shadow and a 'method-call' shadow - and it turns out this is what causes our problem. If around advice is applied to the call join point and it cannot be inlined then the body of the call shadow (the call itself) is pulled out into a new method. Because the handler was the same instruction, this meant the handler *was also being pulled out* into the new method, leaving behind an exception handler that jumped to an invalid location (in fact it 'jumped' to an instruction in a different method!). So the reason I never saw the handler location being set incorrectly is that it was set correctly up front, but then dragged out with the method-call shadow into the wrong place. In bytecode terms it looks like this: method-execution() | ICONST_0 | ISTORE_2 | SIPUSH -1 | ISTORE_3 | catch java.lang.Exception (1806389629) -> E0 | | method-call(ProjectData ProjectData.getGlobalProjectData()) | | | INVOKESTATIC ProjectData.getGlobalProjectData () | | method-call(ProjectData getGlobalProjectData()) | | LDC "SomeString" | | method-call(ClassData getOrCreateClassData(java.lang.String)) | | | INVOKEVIRTUAL ProjectData.getOrCreateClassData (LString;) | | method-call(ClassData ProjectData.getOrCreateClassData(String)) | | SIPUSH 106 | | method-call(void ClassData.touch(int)) | | | INVOKEVIRTUAL ClassData.touch (I)V | | method-call(void ClassData.touch(int)) | | ALOAD_1 | | method-call(Object Expression.getValue()) | | | INVOKEVIRTUAL Expression.getValue () | | method-call(Object Expression.getValue()) | catch java.lang.Exception (1806389629) -> E0 | ARETURN | method-call(nProjectData ProjectData.getGlobalProjectData()) | | E0: INVOKESTATIC ProjectData.getGlobalProjectData () | method-call(ProjectData ProjectData.getGlobalProjectData()) | LDC "Object" We can see the problem in that final method-call. The target for the exception handler seen earlier (E0) is within the method-call shadow. What to do?
resolved fixed
5f97d46
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2008-05-07T15:31:18Z
2008-05-07T03:13:20Z
weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java
private static void assertTargets(InstructionTargeter targeter, InstructionHandle target, String from) { if (targeter instanceof Range) { Range r = (Range) targeter; if (r.getStart() == target || r.getEnd() == target) return; if (r instanceof ExceptionRange) { if (((ExceptionRange)r).getHandler() == target) return; } } else if (targeter instanceof BranchInstruction) { BranchInstruction bi = (BranchInstruction) targeter; if (bi.getTarget() == target) return; if (targeter instanceof Select) { Select sel = (Select) targeter; InstructionHandle[] itargets = sel.getTargets(); for (int k = itargets.length - 1; k >= 0; k--) { if (itargets[k] == target) return; } } } else if (targeter instanceof Tag) { return; } throw new BCException(targeter + " doesn't target " + target + " in " + from ); } private static Range getRangeAndAssertExactlyOne(InstructionHandle ih, String from) { Range ret = null; InstructionTargeter[] ts = ih.getTargeters(); if (ts == null) throw new BCException("range handle with no range in " + from); for (int i = ts.length - 1; i >= 0; i--) { if (ts[i] instanceof Range) { if (ret != null) throw new BCException("range handle with multiple ranges in " + from); ret = (Range) ts[i];
230,817
Bug 230817 LazyMethodGen.remap() NullPointerException
This has been reported a few times by different users, but has always proved tough to diagnose. The typical stack trace is something like: java.lang.NullPointerException org.aspectj.weaver.bcel.LazyMethodGen.remap(LazyMethodGen.java:1237) org.aspectj.weaver.bcel.LazyMethodGen.addExceptionHandlers(LazyMethodGen.java:1132) org.aspectj.weaver.bcel.LazyMethodGen.packBody(LazyMethodGen.java:1078) org.aspectj.weaver.bcel.LazyMethodGen.pack(LazyMethodGen.java:977) org.aspectj.weaver.bcel.LazyMethodGen.getMethod(LazyMethodGen.java:484) org.aspectj.weaver.bcel.LazyClassGen.writeBack(LazyClassGen.java:512) org.aspectj.weaver.bcel.LazyClassGen.getJavaClassBytesIncludingReweavable(LazyClassGen.java:652) org.aspectj.weaver.bcel.BcelWeaver.getClassFilesFor(BcelWeaver.java:1420) org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1390) And that is an exception on this line in remap() ih = ih.getNext(); called from the addExceptionHandlers() line: gen.addExceptionHandler( remap(r.getRealStart(), map), remap(r.getRealEnd(), map), remap(r.getHandler(), map), (r.getCatchType() == null) ? null : (ObjectType) BcelWorld.makeBcelType(r.getCatchType())); During weaving, an instruction list is augmented with extra entries representing where shadows start and end (method-call, method-execution, handler, etc). When weaving is complete we want to remove these temporary elements and use the remaining instructions to produce the method bytecode. Now sometimes these temporary entries are targeted by other elements (line number tags, local variable tags and exception handlers usually). During packing we use remap() to reposition the locations so they move off of temporary placeholders and onto real instructions that will make it out into the bytecode. What the above exception tells us is that we started walking over temporary placeholder entries, but before we came to a real instruction, we ran out of instructions! This cannot happen, and indicates something went seriously wrong, we should always encounter an instruction when remapping off a temporary element. After some digging it is actually the remap() call for the handler (not the start or end) that leads to the problem. The handler represents where to jump to in the code when an exception of the specified type occurs between the instructions pointed at by start and end. I sent a debug build to a user encountering this problem (I could not recreate it) and in that I was looking at where in fact the handler was pointing before we called remap(). I learned that when this problem occurs, the handler is not pointing to anywhere in the method currently being processed (not good). In a second debug build I tried to ascertain who was setting these handlers to point to nowhere. This debug never triggered, no-one was setting them to point to nowhere... I happened to notice whilst going through the instructions in the debug output that cobertura was being used, a coverage toolkit that works by doing bytecode manipulation to insert calls out to a library. AspectJ was being called after cobertura and I asked the user to try the steps the other way round - it worked fine. Indicating cobertura was doing something to the bytecode that gave us problems. After much messing about, I recreated it by applying around advice to within(*) to all the classes in rt.jar (I just used that as a very large standalone jar file I could weave into). I learned that Cobertura creates catch blocks that look a little different to what javac and other compilers create. The typical bytecode sequence a compiler produces for a catch block starts with a STORE instruction, to store the exception being caught (whether the body of the catch block uses it or not). But the cobertura catch blocks started with an INVOKESTATIC instruction, a call out to another method. What does this mean? It means the same instruction has two shadows, a 'handler' shadow and a 'method-call' shadow - and it turns out this is what causes our problem. If around advice is applied to the call join point and it cannot be inlined then the body of the call shadow (the call itself) is pulled out into a new method. Because the handler was the same instruction, this meant the handler *was also being pulled out* into the new method, leaving behind an exception handler that jumped to an invalid location (in fact it 'jumped' to an instruction in a different method!). So the reason I never saw the handler location being set incorrectly is that it was set correctly up front, but then dragged out with the method-call shadow into the wrong place. In bytecode terms it looks like this: method-execution() | ICONST_0 | ISTORE_2 | SIPUSH -1 | ISTORE_3 | catch java.lang.Exception (1806389629) -> E0 | | method-call(ProjectData ProjectData.getGlobalProjectData()) | | | INVOKESTATIC ProjectData.getGlobalProjectData () | | method-call(ProjectData getGlobalProjectData()) | | LDC "SomeString" | | method-call(ClassData getOrCreateClassData(java.lang.String)) | | | INVOKEVIRTUAL ProjectData.getOrCreateClassData (LString;) | | method-call(ClassData ProjectData.getOrCreateClassData(String)) | | SIPUSH 106 | | method-call(void ClassData.touch(int)) | | | INVOKEVIRTUAL ClassData.touch (I)V | | method-call(void ClassData.touch(int)) | | ALOAD_1 | | method-call(Object Expression.getValue()) | | | INVOKEVIRTUAL Expression.getValue () | | method-call(Object Expression.getValue()) | catch java.lang.Exception (1806389629) -> E0 | ARETURN | method-call(nProjectData ProjectData.getGlobalProjectData()) | | E0: INVOKESTATIC ProjectData.getGlobalProjectData () | method-call(ProjectData ProjectData.getGlobalProjectData()) | LDC "Object" We can see the problem in that final method-call. The target for the exception handler seen earlier (E0) is within the method-call shadow. What to do?
resolved fixed
5f97d46
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2008-05-07T15:31:18Z
2008-05-07T03:13:20Z
weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java
} } if (ret == null) throw new BCException("range handle with no range in " + from); return ret; } private static void assertGoodTargeter( InstructionTargeter t, InstructionHandle ih, Set body, String from) { assertTargets(t, ih, from); if (t instanceof Range) { assertGoodRange((Range) t, body, from); } else if (t instanceof BranchInstruction) { assertInBody(t, body, from); } } ---- boolean isAdviceMethod() { return memberView.getAssociatedShadowMunger() != null; } boolean isAjSynthetic() { if (memberView == null) return true; return memberView.isAjSynthetic(); }
230,817
Bug 230817 LazyMethodGen.remap() NullPointerException
This has been reported a few times by different users, but has always proved tough to diagnose. The typical stack trace is something like: java.lang.NullPointerException org.aspectj.weaver.bcel.LazyMethodGen.remap(LazyMethodGen.java:1237) org.aspectj.weaver.bcel.LazyMethodGen.addExceptionHandlers(LazyMethodGen.java:1132) org.aspectj.weaver.bcel.LazyMethodGen.packBody(LazyMethodGen.java:1078) org.aspectj.weaver.bcel.LazyMethodGen.pack(LazyMethodGen.java:977) org.aspectj.weaver.bcel.LazyMethodGen.getMethod(LazyMethodGen.java:484) org.aspectj.weaver.bcel.LazyClassGen.writeBack(LazyClassGen.java:512) org.aspectj.weaver.bcel.LazyClassGen.getJavaClassBytesIncludingReweavable(LazyClassGen.java:652) org.aspectj.weaver.bcel.BcelWeaver.getClassFilesFor(BcelWeaver.java:1420) org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1390) And that is an exception on this line in remap() ih = ih.getNext(); called from the addExceptionHandlers() line: gen.addExceptionHandler( remap(r.getRealStart(), map), remap(r.getRealEnd(), map), remap(r.getHandler(), map), (r.getCatchType() == null) ? null : (ObjectType) BcelWorld.makeBcelType(r.getCatchType())); During weaving, an instruction list is augmented with extra entries representing where shadows start and end (method-call, method-execution, handler, etc). When weaving is complete we want to remove these temporary elements and use the remaining instructions to produce the method bytecode. Now sometimes these temporary entries are targeted by other elements (line number tags, local variable tags and exception handlers usually). During packing we use remap() to reposition the locations so they move off of temporary placeholders and onto real instructions that will make it out into the bytecode. What the above exception tells us is that we started walking over temporary placeholder entries, but before we came to a real instruction, we ran out of instructions! This cannot happen, and indicates something went seriously wrong, we should always encounter an instruction when remapping off a temporary element. After some digging it is actually the remap() call for the handler (not the start or end) that leads to the problem. The handler represents where to jump to in the code when an exception of the specified type occurs between the instructions pointed at by start and end. I sent a debug build to a user encountering this problem (I could not recreate it) and in that I was looking at where in fact the handler was pointing before we called remap(). I learned that when this problem occurs, the handler is not pointing to anywhere in the method currently being processed (not good). In a second debug build I tried to ascertain who was setting these handlers to point to nowhere. This debug never triggered, no-one was setting them to point to nowhere... I happened to notice whilst going through the instructions in the debug output that cobertura was being used, a coverage toolkit that works by doing bytecode manipulation to insert calls out to a library. AspectJ was being called after cobertura and I asked the user to try the steps the other way round - it worked fine. Indicating cobertura was doing something to the bytecode that gave us problems. After much messing about, I recreated it by applying around advice to within(*) to all the classes in rt.jar (I just used that as a very large standalone jar file I could weave into). I learned that Cobertura creates catch blocks that look a little different to what javac and other compilers create. The typical bytecode sequence a compiler produces for a catch block starts with a STORE instruction, to store the exception being caught (whether the body of the catch block uses it or not). But the cobertura catch blocks started with an INVOKESTATIC instruction, a call out to another method. What does this mean? It means the same instruction has two shadows, a 'handler' shadow and a 'method-call' shadow - and it turns out this is what causes our problem. If around advice is applied to the call join point and it cannot be inlined then the body of the call shadow (the call itself) is pulled out into a new method. Because the handler was the same instruction, this meant the handler *was also being pulled out* into the new method, leaving behind an exception handler that jumped to an invalid location (in fact it 'jumped' to an instruction in a different method!). So the reason I never saw the handler location being set incorrectly is that it was set correctly up front, but then dragged out with the method-call shadow into the wrong place. In bytecode terms it looks like this: method-execution() | ICONST_0 | ISTORE_2 | SIPUSH -1 | ISTORE_3 | catch java.lang.Exception (1806389629) -> E0 | | method-call(ProjectData ProjectData.getGlobalProjectData()) | | | INVOKESTATIC ProjectData.getGlobalProjectData () | | method-call(ProjectData getGlobalProjectData()) | | LDC "SomeString" | | method-call(ClassData getOrCreateClassData(java.lang.String)) | | | INVOKEVIRTUAL ProjectData.getOrCreateClassData (LString;) | | method-call(ClassData ProjectData.getOrCreateClassData(String)) | | SIPUSH 106 | | method-call(void ClassData.touch(int)) | | | INVOKEVIRTUAL ClassData.touch (I)V | | method-call(void ClassData.touch(int)) | | ALOAD_1 | | method-call(Object Expression.getValue()) | | | INVOKEVIRTUAL Expression.getValue () | | method-call(Object Expression.getValue()) | catch java.lang.Exception (1806389629) -> E0 | ARETURN | method-call(nProjectData ProjectData.getGlobalProjectData()) | | E0: INVOKESTATIC ProjectData.getGlobalProjectData () | method-call(ProjectData ProjectData.getGlobalProjectData()) | LDC "Object" We can see the problem in that final method-call. The target for the exception handler seen earlier (E0) is within the method-call shadow. What to do?
resolved fixed
5f97d46
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2008-05-07T15:31:18Z
2008-05-07T03:13:20Z
weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java
boolean isSynthetic() { if (memberView == null) return false; return memberView.isSynthetic(); } public ISourceLocation getSourceLocation() { if (memberView!=null) return memberView.getSourceLocation(); return null; } public AjAttribute.EffectiveSignatureAttribute getEffectiveSignature() { if (effectiveSignature != null) return effectiveSignature; return memberView.getEffectiveSignature(); } public void setEffectiveSignature(ResolvedMember member, Shadow.Kind kind, boolean shouldWeave) { this.effectiveSignature = new AjAttribute.EffectiveSignatureAttribute(member,kind,shouldWeave); } public String getSignature() { if (memberView!=null) return memberView.getSignature(); return MemberImpl.typesToSignature(BcelWorld.fromBcel(getReturnType()), BcelWorld.fromBcel(getArgumentTypes()),false); } public String getParameterSignature() { if (memberView!=null) return memberView.getParameterSignature();
230,817
Bug 230817 LazyMethodGen.remap() NullPointerException
This has been reported a few times by different users, but has always proved tough to diagnose. The typical stack trace is something like: java.lang.NullPointerException org.aspectj.weaver.bcel.LazyMethodGen.remap(LazyMethodGen.java:1237) org.aspectj.weaver.bcel.LazyMethodGen.addExceptionHandlers(LazyMethodGen.java:1132) org.aspectj.weaver.bcel.LazyMethodGen.packBody(LazyMethodGen.java:1078) org.aspectj.weaver.bcel.LazyMethodGen.pack(LazyMethodGen.java:977) org.aspectj.weaver.bcel.LazyMethodGen.getMethod(LazyMethodGen.java:484) org.aspectj.weaver.bcel.LazyClassGen.writeBack(LazyClassGen.java:512) org.aspectj.weaver.bcel.LazyClassGen.getJavaClassBytesIncludingReweavable(LazyClassGen.java:652) org.aspectj.weaver.bcel.BcelWeaver.getClassFilesFor(BcelWeaver.java:1420) org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1390) And that is an exception on this line in remap() ih = ih.getNext(); called from the addExceptionHandlers() line: gen.addExceptionHandler( remap(r.getRealStart(), map), remap(r.getRealEnd(), map), remap(r.getHandler(), map), (r.getCatchType() == null) ? null : (ObjectType) BcelWorld.makeBcelType(r.getCatchType())); During weaving, an instruction list is augmented with extra entries representing where shadows start and end (method-call, method-execution, handler, etc). When weaving is complete we want to remove these temporary elements and use the remaining instructions to produce the method bytecode. Now sometimes these temporary entries are targeted by other elements (line number tags, local variable tags and exception handlers usually). During packing we use remap() to reposition the locations so they move off of temporary placeholders and onto real instructions that will make it out into the bytecode. What the above exception tells us is that we started walking over temporary placeholder entries, but before we came to a real instruction, we ran out of instructions! This cannot happen, and indicates something went seriously wrong, we should always encounter an instruction when remapping off a temporary element. After some digging it is actually the remap() call for the handler (not the start or end) that leads to the problem. The handler represents where to jump to in the code when an exception of the specified type occurs between the instructions pointed at by start and end. I sent a debug build to a user encountering this problem (I could not recreate it) and in that I was looking at where in fact the handler was pointing before we called remap(). I learned that when this problem occurs, the handler is not pointing to anywhere in the method currently being processed (not good). In a second debug build I tried to ascertain who was setting these handlers to point to nowhere. This debug never triggered, no-one was setting them to point to nowhere... I happened to notice whilst going through the instructions in the debug output that cobertura was being used, a coverage toolkit that works by doing bytecode manipulation to insert calls out to a library. AspectJ was being called after cobertura and I asked the user to try the steps the other way round - it worked fine. Indicating cobertura was doing something to the bytecode that gave us problems. After much messing about, I recreated it by applying around advice to within(*) to all the classes in rt.jar (I just used that as a very large standalone jar file I could weave into). I learned that Cobertura creates catch blocks that look a little different to what javac and other compilers create. The typical bytecode sequence a compiler produces for a catch block starts with a STORE instruction, to store the exception being caught (whether the body of the catch block uses it or not). But the cobertura catch blocks started with an INVOKESTATIC instruction, a call out to another method. What does this mean? It means the same instruction has two shadows, a 'handler' shadow and a 'method-call' shadow - and it turns out this is what causes our problem. If around advice is applied to the call join point and it cannot be inlined then the body of the call shadow (the call itself) is pulled out into a new method. Because the handler was the same instruction, this meant the handler *was also being pulled out* into the new method, leaving behind an exception handler that jumped to an invalid location (in fact it 'jumped' to an instruction in a different method!). So the reason I never saw the handler location being set incorrectly is that it was set correctly up front, but then dragged out with the method-call shadow into the wrong place. In bytecode terms it looks like this: method-execution() | ICONST_0 | ISTORE_2 | SIPUSH -1 | ISTORE_3 | catch java.lang.Exception (1806389629) -> E0 | | method-call(ProjectData ProjectData.getGlobalProjectData()) | | | INVOKESTATIC ProjectData.getGlobalProjectData () | | method-call(ProjectData getGlobalProjectData()) | | LDC "SomeString" | | method-call(ClassData getOrCreateClassData(java.lang.String)) | | | INVOKEVIRTUAL ProjectData.getOrCreateClassData (LString;) | | method-call(ClassData ProjectData.getOrCreateClassData(String)) | | SIPUSH 106 | | method-call(void ClassData.touch(int)) | | | INVOKEVIRTUAL ClassData.touch (I)V | | method-call(void ClassData.touch(int)) | | ALOAD_1 | | method-call(Object Expression.getValue()) | | | INVOKEVIRTUAL Expression.getValue () | | method-call(Object Expression.getValue()) | catch java.lang.Exception (1806389629) -> E0 | ARETURN | method-call(nProjectData ProjectData.getGlobalProjectData()) | | E0: INVOKESTATIC ProjectData.getGlobalProjectData () | method-call(ProjectData ProjectData.getGlobalProjectData()) | LDC "Object" We can see the problem in that final method-call. The target for the exception handler seen earlier (E0) is within the method-call shadow. What to do?
resolved fixed
5f97d46
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2008-05-07T15:31:18Z
2008-05-07T03:13:20Z
weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java
return MemberImpl.typesToSignature(BcelWorld.fromBcel(getArgumentTypes())); } public BcelMethod getMemberView() { return memberView; } public void forcePublic() { markAsChanged(); accessFlags = Utility.makePublic(accessFlags); } public boolean getCanInline() { return canInline; } public void setCanInline(boolean canInline) { this.canInline = canInline; } /** * Adds an attribute to the method * @param attr */ public void addAttribute(Attribute attr) { Attribute[] newAttributes = new Attribute[attributes.length + 1]; System.arraycopy(attributes, 0, newAttributes, 0, attributes.length); newAttributes[attributes.length] = attr; attributes = newAttributes; } public String toTraceString() { return toShortString(); } }
209,372
Bug 209372 Compile error: IllegalArgumentException thrown: negative line: -1
If line numbers have not been added to the generated class files the following exception is thrown: java.lang.IllegalArgumentException at org.aspectj.bridge.SourceLocation.validLine(SourceLocation.java:41) at org.aspectj.bridge.SourceLocation.<init>(SourceLocation.java:96) at org.aspectj.bridge.SourceLocation.<init>(SourceLocation.java:85) at org.aspectj.bridge.SourceLocation.<init>(SourceLocation.java:70) at org.aspectj.ajdt.internal.core.builder.EclipseSourceContext.makeSourceLocation(EclipseSourceContext.java:57) at org.aspectj.we ... reUtility.java:155) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55) Compile error: IllegalArgumentException thrown: negative line: -1 An easy way to reproduce the problem is to uncheck the corresponding checkbox in the Classfile Generation section of the Java Compiler options in Eclipse. A full build is performed during which an AspectJ Internal Compiler Error is thrown. My Eclipse feature version is org.eclipse.ajdt_1.5.0.200706070619.
resolved fixed
d3c3e32
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2008-05-07T22:08:01Z
2007-11-09T20:26:40Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/EclipseAdapterUtils.java
/* ******************************************************************* * Copyright (c) 1999-2001 Xerox Corporation, * 2002 Palo Alto Research Center, Incorporated (PARC). * All rights reserved. * This program and the accompanying materials are made available * under the terms of the Eclipse Public License v1.0 * which accompanies this distribution and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * PARC initial implementation * ******************************************************************/ package org.aspectj.ajdt.internal.core.builder; import java.io.File; import org.aspectj.bridge.IMessage; import org.aspectj.bridge.ISourceLocation; import org.aspectj.bridge.Message; import org.aspectj.bridge.SourceLocation; import org.aspectj.org.eclipse.jdt.core.compiler.IProblem; import org.aspectj.org.eclipse.jdt.internal.compiler.env.ICompilationUnit; import org.aspectj.weaver.LintMessage; import org.aspectj.weaver.World; public class EclipseAdapterUtils {
209,372
Bug 209372 Compile error: IllegalArgumentException thrown: negative line: -1
If line numbers have not been added to the generated class files the following exception is thrown: java.lang.IllegalArgumentException at org.aspectj.bridge.SourceLocation.validLine(SourceLocation.java:41) at org.aspectj.bridge.SourceLocation.<init>(SourceLocation.java:96) at org.aspectj.bridge.SourceLocation.<init>(SourceLocation.java:85) at org.aspectj.bridge.SourceLocation.<init>(SourceLocation.java:70) at org.aspectj.ajdt.internal.core.builder.EclipseSourceContext.makeSourceLocation(EclipseSourceContext.java:57) at org.aspectj.we ... reUtility.java:155) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55) Compile error: IllegalArgumentException thrown: negative line: -1 An easy way to reproduce the problem is to uncheck the corresponding checkbox in the Classfile Generation section of the Java Compiler options in Eclipse. A full build is performed during which an AspectJ Internal Compiler Error is thrown. My Eclipse feature version is org.eclipse.ajdt_1.5.0.200706070619.
resolved fixed
d3c3e32
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2008-05-07T22:08:01Z
2007-11-09T20:26:40Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/EclipseAdapterUtils.java
public static String makeLocationContext(ICompilationUnit compilationUnit, IProblem problem) { int startPosition = problem.getSourceStart(); int endPosition = problem.getSourceEnd(); if ((startPosition > endPosition) || ((startPosition <= 0) && (endPosition <= 0)) || compilationUnit==null) return "(no source information available)"; final char SPACE = '\u0020'; final char MARK = '^'; final char TAB = '\t'; char[] source = compilationUnit.getContents(); int begin = startPosition >= source.length ? source.length - 1 : startPosition; if (begin==-1)
209,372
Bug 209372 Compile error: IllegalArgumentException thrown: negative line: -1
If line numbers have not been added to the generated class files the following exception is thrown: java.lang.IllegalArgumentException at org.aspectj.bridge.SourceLocation.validLine(SourceLocation.java:41) at org.aspectj.bridge.SourceLocation.<init>(SourceLocation.java:96) at org.aspectj.bridge.SourceLocation.<init>(SourceLocation.java:85) at org.aspectj.bridge.SourceLocation.<init>(SourceLocation.java:70) at org.aspectj.ajdt.internal.core.builder.EclipseSourceContext.makeSourceLocation(EclipseSourceContext.java:57) at org.aspectj.we ... reUtility.java:155) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55) Compile error: IllegalArgumentException thrown: negative line: -1 An easy way to reproduce the problem is to uncheck the corresponding checkbox in the Classfile Generation section of the Java Compiler options in Eclipse. A full build is performed during which an AspectJ Internal Compiler Error is thrown. My Eclipse feature version is org.eclipse.ajdt_1.5.0.200706070619.
resolved fixed
d3c3e32
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2008-05-07T22:08:01Z
2007-11-09T20:26:40Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/EclipseAdapterUtils.java
return "(no source information available)"; int relativeStart = 0; int end = endPosition >= source.length ? source.length - 1 : endPosition; int relativeEnd = 0; label : for (relativeStart = 0;; relativeStart++) { if (begin == 0) break label; if ((source[begin - 1] == '\n') || (source[begin - 1] == '\r')) break label; begin--; } label : for (relativeEnd = 0;; relativeEnd++) { if ((end + 1) >= source.length) break label; if ((source[end + 1] == '\r') || (source[end + 1] == '\n')) { break label; } end++; } char[] extract = new char[end - begin + 1]; System.arraycopy(source, begin, extract, 0, extract.length); char c; int trimLeftIndex = 0; while ( (((c = extract[trimLeftIndex++]) == TAB) || (c == SPACE)) && trimLeftIndex<extract.length ) { }; if (trimLeftIndex>=extract.length) return new String(extract)+"\n"; System.arraycopy( extract, trimLeftIndex - 1,
209,372
Bug 209372 Compile error: IllegalArgumentException thrown: negative line: -1
If line numbers have not been added to the generated class files the following exception is thrown: java.lang.IllegalArgumentException at org.aspectj.bridge.SourceLocation.validLine(SourceLocation.java:41) at org.aspectj.bridge.SourceLocation.<init>(SourceLocation.java:96) at org.aspectj.bridge.SourceLocation.<init>(SourceLocation.java:85) at org.aspectj.bridge.SourceLocation.<init>(SourceLocation.java:70) at org.aspectj.ajdt.internal.core.builder.EclipseSourceContext.makeSourceLocation(EclipseSourceContext.java:57) at org.aspectj.we ... reUtility.java:155) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55) Compile error: IllegalArgumentException thrown: negative line: -1 An easy way to reproduce the problem is to uncheck the corresponding checkbox in the Classfile Generation section of the Java Compiler options in Eclipse. A full build is performed during which an AspectJ Internal Compiler Error is thrown. My Eclipse feature version is org.eclipse.ajdt_1.5.0.200706070619.
resolved fixed
d3c3e32
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2008-05-07T22:08:01Z
2007-11-09T20:26:40Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/EclipseAdapterUtils.java
extract = new char[extract.length - trimLeftIndex + 1], 0, extract.length); relativeStart -= trimLeftIndex; int pos = 0; char[] underneath = new char[extract.length]; for (int i = 0; i <= relativeStart; i++) { if (extract[i] == TAB) { underneath[pos++] = TAB; } else { underneath[pos++] = SPACE; } } for (int i = startPosition + trimLeftIndex; i <= (endPosition >= source.length ? source.length - 1 : endPosition); i++) underneath[pos++] = MARK; System.arraycopy(underneath, 0, underneath = new char[pos], 0, pos); return new String(extract) + "\n" + new String(underneath); } /** * Extract source location file, start and end lines, and context. * Column is not extracted correctly. * @return ISourceLocation with correct file and lines but not column. */ public static ISourceLocation makeSourceLocation(ICompilationUnit unit, IProblem problem) {
209,372
Bug 209372 Compile error: IllegalArgumentException thrown: negative line: -1
If line numbers have not been added to the generated class files the following exception is thrown: java.lang.IllegalArgumentException at org.aspectj.bridge.SourceLocation.validLine(SourceLocation.java:41) at org.aspectj.bridge.SourceLocation.<init>(SourceLocation.java:96) at org.aspectj.bridge.SourceLocation.<init>(SourceLocation.java:85) at org.aspectj.bridge.SourceLocation.<init>(SourceLocation.java:70) at org.aspectj.ajdt.internal.core.builder.EclipseSourceContext.makeSourceLocation(EclipseSourceContext.java:57) at org.aspectj.we ... reUtility.java:155) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55) Compile error: IllegalArgumentException thrown: negative line: -1 An easy way to reproduce the problem is to uncheck the corresponding checkbox in the Classfile Generation section of the Java Compiler options in Eclipse. A full build is performed during which an AspectJ Internal Compiler Error is thrown. My Eclipse feature version is org.eclipse.ajdt_1.5.0.200706070619.
resolved fixed
d3c3e32
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2008-05-07T22:08:01Z
2007-11-09T20:26:40Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/EclipseAdapterUtils.java
int line = problem.getSourceLineNumber(); File file = new File(new String(problem.getOriginatingFileName())); String context = makeLocationContext(unit, problem); return new SourceLocation(file, line, line, 0, context); } /** * Extract message text and source location, including context. * @param world */ public static IMessage makeMessage(ICompilationUnit unit, IProblem problem, World world) { ISourceLocation sourceLocation = makeSourceLocation(unit, problem); IProblem[] seeAlso = problem.seeAlso(); ISourceLocation[] seeAlsoLocations = new ISourceLocation[seeAlso.length]; for (int i = 0; i < seeAlso.length; i++) { seeAlsoLocations[i] = new SourceLocation(new File(new String(seeAlso[i].getOriginatingFileName())), seeAlso[i].getSourceLineNumber()); } String extraDetails = problem.getSupplementaryMessageInfo(); boolean declared = false; boolean isLintMessage = false; String lintkey = null; if (extraDetails!=null && extraDetails.endsWith("[deow=true]")) { declared = true; extraDetails = extraDetails.substring(0,extraDetails.length()-"[deow=true]".length());
209,372
Bug 209372 Compile error: IllegalArgumentException thrown: negative line: -1
If line numbers have not been added to the generated class files the following exception is thrown: java.lang.IllegalArgumentException at org.aspectj.bridge.SourceLocation.validLine(SourceLocation.java:41) at org.aspectj.bridge.SourceLocation.<init>(SourceLocation.java:96) at org.aspectj.bridge.SourceLocation.<init>(SourceLocation.java:85) at org.aspectj.bridge.SourceLocation.<init>(SourceLocation.java:70) at org.aspectj.ajdt.internal.core.builder.EclipseSourceContext.makeSourceLocation(EclipseSourceContext.java:57) at org.aspectj.we ... reUtility.java:155) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55) Compile error: IllegalArgumentException thrown: negative line: -1 An easy way to reproduce the problem is to uncheck the corresponding checkbox in the Classfile Generation section of the Java Compiler options in Eclipse. A full build is performed during which an AspectJ Internal Compiler Error is thrown. My Eclipse feature version is org.eclipse.ajdt_1.5.0.200706070619.
resolved fixed
d3c3e32
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2008-05-07T22:08:01Z
2007-11-09T20:26:40Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/EclipseAdapterUtils.java
} if (extraDetails!=null && extraDetails.indexOf("[Xlint:")!=-1) { isLintMessage = true; lintkey = extraDetails.substring(extraDetails.indexOf("[Xlint:")); lintkey = lintkey.substring("[Xlint:".length()); lintkey = lintkey.substring(0,lintkey.indexOf("]")); } IMessage.Kind kind; if (problem.getID()==IProblem.Task) { kind=IMessage.TASKTAG; } else { if (problem.isError()) { kind = IMessage.ERROR; } else { kind = IMessage.WARNING; } } IMessage msg = null; if (isLintMessage) { msg = new LintMessage( problem.getMessage(), extraDetails, world.getLint().fromKey(lintkey), kind, sourceLocation, null, seeAlsoLocations, declared, problem.getID(), problem.getSourceStart(),problem.getSourceEnd());
209,372
Bug 209372 Compile error: IllegalArgumentException thrown: negative line: -1
If line numbers have not been added to the generated class files the following exception is thrown: java.lang.IllegalArgumentException at org.aspectj.bridge.SourceLocation.validLine(SourceLocation.java:41) at org.aspectj.bridge.SourceLocation.<init>(SourceLocation.java:96) at org.aspectj.bridge.SourceLocation.<init>(SourceLocation.java:85) at org.aspectj.bridge.SourceLocation.<init>(SourceLocation.java:70) at org.aspectj.ajdt.internal.core.builder.EclipseSourceContext.makeSourceLocation(EclipseSourceContext.java:57) at org.aspectj.we ... reUtility.java:155) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55) Compile error: IllegalArgumentException thrown: negative line: -1 An easy way to reproduce the problem is to uncheck the corresponding checkbox in the Classfile Generation section of the Java Compiler options in Eclipse. A full build is performed during which an AspectJ Internal Compiler Error is thrown. My Eclipse feature version is org.eclipse.ajdt_1.5.0.200706070619.
resolved fixed
d3c3e32
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2008-05-07T22:08:01Z
2007-11-09T20:26:40Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/EclipseAdapterUtils.java
} else { msg = new Message(problem.getMessage(), extraDetails, kind, sourceLocation, null, seeAlsoLocations, declared, problem.getID(), problem.getSourceStart(),problem.getSourceEnd()); } return msg; } public static IMessage makeErrorMessage(ICompilationUnit unit, String text, Exception ex) { ISourceLocation loc = new SourceLocation(new File(new String(unit.getFileName())), 0,0,0,""); IMessage msg = new Message(text,IMessage.ERROR,ex,loc); return msg; } public static IMessage makeErrorMessage(String srcFile, String text, Exception ex) { ISourceLocation loc = new SourceLocation(new File(srcFile), 0,0,0,""); IMessage msg = new Message(text,IMessage.ERROR,ex,loc); return msg; } private EclipseAdapterUtils() { } }
231,467
Bug 231467 Cant Compile new Statement for the Generic Class
[aspectj:iajc] error at (no source information available) [aspectj:iajc] C:\Development\PI\JavaSrc\com\centricsoftware\pi\service\expression\FuncNewMatrix.java:0::0 Internal compiler error [aspectj:iajc] java.lang.ArrayIndexOutOfBoundsException: 1 [aspectj:iajc] at org.aspectj.weaver.ResolvedType.getMemberParameterizationMap(ResolvedType.java:744) [aspectj:iajc] at org.aspectj.weaver.ReferenceType.getDeclaredInterfaces(ReferenceType.java:411) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.getDirectSupertypes(ResolvedType.java:68) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.collectInterTypeMungers(ResolvedType.java:1206) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.collectInterTypeMungers(ResolvedType.java:1211) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.collectInterTypeMungers(ResolvedType.java:1211) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.getInterTypeMungersIncludingSupers(ResolvedType.java:1185) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.checkInterTypeMungers(ResolvedType.java:1255) [aspectj:iajc] at org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment.weaveInterTypeDeclarations(AjLookupEnvironment.java:646) [aspectj:iajc] at org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment.weaveInterTypeDeclarations(AjLookupEnvironment.java:522) [aspectj:iajc] at org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment.createBinaryTypeFrom(AjLookupEnvironment.java:1105) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.createBinaryTypeFrom(LookupEnvironment.java:599) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.accept(Compiler.java:276) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.askForType(LookupEnvironment.java:113) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.UnresolvedReferenceBinding.resolve(UnresolvedReferenceBinding.java:49) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.resolveType(BinaryTypeBinding.java:99) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.getMemberType(BinaryTypeBinding.java:755) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.Scope.findMemberType(Scope.java:986) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.Scope.getMemberType(Scope.java:2116) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference.findNextTypeBinding(QualifiedTypeReference.java:43) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference.getTypeBinding(QualifiedTypeReference.java:77) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeReference.resolveType(TypeReference.java:142) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.AllocationExpression.resolveType(AllocationExpression.java:258) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.LocalDeclaration.resolve(LocalDeclaration.java:196) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolveStatements(AbstractMethodDeclaration.java:433) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.MethodDeclaration.resolveStatements(MethodDeclaration.java:196) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolve(AbstractMethodDeclaration.java:404) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1109) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1188) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.resolve(CompilationUnitDeclaration.java:366) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.process(Compiler.java:625) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:392) [aspectj:iajc] at org.aspectj.ajdt.internal.core.builder.AjBuildManager.performCompilation(AjBuildManager.java:990) [aspectj:iajc] at org.aspectj.ajdt.internal.core.builder.AjBuildManager.doBuild(AjBuildManager.java:264) [aspectj:iajc] at org.aspectj.ajdt.internal.core.builder.AjBuildManager.batchBuild(AjBuildManager.java:180) [aspectj:iajc] at org.aspectj.ajdt.ajc.AjdtCommand.doCommand(AjdtCommand.java:112) [aspectj:iajc] at org.aspectj.ajdt.ajc.AjdtCommand.runCommand(AjdtCommand.java:60) [aspectj:iajc] at org.aspectj.tools.ajc.Main.run(Main.java:378) [aspectj:iajc] at org.aspectj.tools.ajc.Main.runMain(Main.java:253) [aspectj:iajc] at org.aspectj.tools.ant.taskdefs.AjcTask.executeInSameVM(AjcTask.java:1303) [aspectj:iajc] at org.aspectj.tools.ant.taskdefs.AjcTask.execute(AjcTask.java:1101) [aspectj:iajc] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288) [aspectj:iajc] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [aspectj:iajc] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [aspectj:iajc] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [aspectj:iajc] at java.lang.reflect.Method.invoke(Method.java:585) [aspectj:iajc] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105) [aspectj:iajc] at org.apache.tools.ant.Task.perform(Task.java:348) [aspectj:iajc] at org.apache.tools.ant.Target.execute(Target.java:357) [aspectj:iajc] at org.apache.tools.ant.Target.performTasks(Target.java:385) [aspectj:iajc] at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329) [aspectj:iajc] at org.apache.tools.ant.Project.executeTarget(Project.java:1298) [aspectj:iajc] at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41) [aspectj:iajc] at org.eclipse.ant.internal.ui.antsupport.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32) [aspectj:iajc] at org.apache.tools.ant.Project.executeTargets(Project.java:1181) [aspectj:iajc] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:423) [aspectj:iajc] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:137) [aspectj:iajc] abort ABORT -- (ArrayIndexOutOfBoundsException) 1 [aspectj:iajc] 1 [aspectj:iajc] java.lang.ArrayIndexOutOfBoundsException: 1 [aspectj:iajc] at org.aspectj.weaver.ResolvedType.getMemberParameterizationMap(ResolvedType.java:744) [aspectj:iajc] at org.aspectj.weaver.ReferenceType.getDeclaredInterfaces(ReferenceType.java:411) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.getDirectSupertypes(ResolvedType.java:68) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.collectInterTypeMungers(ResolvedType.java:1206) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.collectInterTypeMungers(ResolvedType.java:1211) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.collectInterTypeMungers(ResolvedType.java:1211) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.getInterTypeMungersIncludingSupers(ResolvedType.java:1185) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.checkInterTypeMungers(ResolvedType.java:1255) [aspectj:iajc] at org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment.weaveInterTypeDeclarations(AjLookupEnvironment.java:646) [aspectj:iajc] at org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment.weaveInterTypeDeclarations(AjLookupEnvironment.java:522) [aspectj:iajc] at org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment.createBinaryTypeFrom(AjLookupEnvironment.java:1105) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.createBinaryTypeFrom(LookupEnvironment.java:599) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.accept(Compiler.java:276) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.askForType(LookupEnvironment.java:113) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.UnresolvedReferenceBinding.resolve(UnresolvedReferenceBinding.java:49) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.resolveType(BinaryTypeBinding.java:99) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.getMemberType(BinaryTypeBinding.java:755) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.Scope.findMemberType(Scope.java:986) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.Scope.getMemberType(Scope.java:2116) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference.findNextTypeBinding(QualifiedTypeReference.java:43) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference.getTypeBinding(QualifiedTypeReference.java:77) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeReference.resolveType(TypeReference.java:142) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.AllocationExpression.resolveType(AllocationExpression.java:258) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.LocalDeclaration.resolve(LocalDeclaration.java:196) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolveStatements(AbstractMethodDeclaration.java:433) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.MethodDeclaration.resolveStatements(MethodDeclaration.java:196) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolve(AbstractMethodDeclaration.java:404) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1109) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1188) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.resolve(CompilationUnitDeclaration.java:366) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.process(Compiler.java:625) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:392) [aspectj:iajc] at org.aspectj.ajdt.internal.core.builder.AjBuildManager.performCompilation(AjBuildManager.java:990) [aspectj:iajc] at org.aspectj.ajdt.internal.core.builder.AjBuildManager.doBuild(AjBuildManager.java:264) [aspectj:iajc] at org.aspectj.ajdt.internal.core.builder.AjBuildManager.batchBuild(AjBuildManager.java:180) [aspectj:iajc] at org.aspectj.ajdt.ajc.AjdtCommand.doCommand(AjdtCommand.java:112) [aspectj:iajc] at org.aspectj.ajdt.ajc.AjdtCommand.runCommand(AjdtCommand.java:60) [aspectj:iajc] at org.aspectj.tools.ajc.Main.run(Main.java:378) [aspectj:iajc] at org.aspectj.tools.ajc.Main.runMain(Main.java:253) [aspectj:iajc] at org.aspectj.tools.ant.taskdefs.AjcTask.executeInSameVM(AjcTask.java:1303) [aspectj:iajc] at org.aspectj.tools.ant.taskdefs.AjcTask.execute(AjcTask.java:1101) [aspectj:iajc] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288) [aspectj:iajc] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [aspectj:iajc] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [aspectj:iajc] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [aspectj:iajc] at java.lang.reflect.Method.invoke(Method.java:585) [aspectj:iajc] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105) [aspectj:iajc] at org.apache.tools.ant.Task.perform(Task.java:348) [aspectj:iajc] at org.apache.tools.ant.Target.execute(Target.java:357) [aspectj:iajc] at org.apache.tools.ant.Target.performTasks(Target.java:385) [aspectj:iajc] at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329) [aspectj:iajc] at org.apache.tools.ant.Project.executeTarget(Project.java:1298) [aspectj:iajc] at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41) [aspectj:iajc] at org.eclipse.ant.internal.ui.antsupport.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32) [aspectj:iajc] at org.apache.tools.ant.Project.executeTargets(Project.java:1181) [aspectj:iajc] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:423) [aspectj:iajc] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:137) [aspectj:iajc] May 11, 2008 9:35:06 AM org.aspectj.weaver.tools.Jdk14Trace info [aspectj:iajc] INFO: Dumping to C:\Development\PI\Projects\PI-ServiceCommon\.\ajcore.20080511.093506.214.txt [aspectj:iajc] MessageHolder: (92 info) (1 error) (1 abort) [aspectj:iajc] [error 0]: error at (no source information available) [aspectj:iajc] C:\Development\PI\JavaSrc\com\centricsoftware\pi\service\expression\FuncNewMatrix.java:0::0 Internal compiler error [aspectj:iajc] java.lang.ArrayIndexOutOfBoundsException: 1 [aspectj:iajc] at org.aspectj.weaver.ResolvedType.getMemberParameterizationMap(ResolvedType.java:744) [aspectj:iajc] at org.aspectj.weaver.ReferenceType.getDeclaredInterfaces(ReferenceType.java:411) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.getDirectSupertypes(ResolvedType.java:68) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.collectInterTypeMungers(ResolvedType.java:1206) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.collectInterTypeMungers(ResolvedType.java:1211) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.collectInterTypeMungers(ResolvedType.java:1211) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.getInterTypeMungersIncludingSupers(ResolvedType.java:1185) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.checkInterTypeMungers(ResolvedType.java:1255) [aspectj:iajc] at org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment.weaveInterTypeDeclarations(AjLookupEnvironment.java:646) [aspectj:iajc] at org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment.weaveInterTypeDeclarations(AjLookupEnvironment.java:522) [aspectj:iajc] at org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment.createBinaryTypeFrom(AjLookupEnvironment.java:1105) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.createBinaryTypeFrom(LookupEnvironment.java:599) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.accept(Compiler.java:276) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.askForType(LookupEnvironment.java:113) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.UnresolvedReferenceBinding.resolve(UnresolvedReferenceBinding.java:49) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.resolveType(BinaryTypeBinding.java:99) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.getMemberType(BinaryTypeBinding.java:755) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.Scope.findMemberType(Scope.java:986) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.Scope.getMemberType(Scope.java:2116) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference.findNextTypeBinding(QualifiedTypeReference.java:43) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference.getTypeBinding(QualifiedTypeReference.java:77) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeReference.resolveType(TypeReference.java:142) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.AllocationExpression.resolveType(AllocationExpression.java:258) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.LocalDeclaration.resolve(LocalDeclaration.java:196) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolveStatements(AbstractMethodDeclaration.java:433) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.MethodDeclaration.resolveStatements(MethodDeclaration.java:196) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolve(AbstractMethodDeclaration.java:404) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1109) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1188) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.resolve(CompilationUnitDeclaration.java:366) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.process(Compiler.java:625) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:392) [aspectj:iajc] at org.aspectj.ajdt.internal.core.builder.AjBuildManager.performCompilation(AjBuildManager.java:990) [aspectj:iajc] at org.aspectj.ajdt.internal.core.builder.AjBuildManager.doBuild(AjBuildManager.java:264) [aspectj:iajc] at org.aspectj.ajdt.internal.core.builder.AjBuildManager.batchBuild(AjBuildManager.java:180) [aspectj:iajc] at org.aspectj.ajdt.ajc.AjdtCommand.doCommand(AjdtCommand.java:112) [aspectj:iajc] at org.aspectj.ajdt.ajc.AjdtCommand.runCommand(AjdtCommand.java:60) [aspectj:iajc] at org.aspectj.tools.ajc.Main.run(Main.java:378) [aspectj:iajc] at org.aspectj.tools.ajc.Main.runMain(Main.java:253) [aspectj:iajc] at org.aspectj.tools.ant.taskdefs.AjcTask.executeInSameVM(AjcTask.java:1303) [aspectj:iajc] at org.aspectj.tools.ant.taskdefs.AjcTask.execute(AjcTask.java:1101) [aspectj:iajc] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288) [aspectj:iajc] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [aspectj:iajc] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [aspectj:iajc] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [aspectj:iajc] at java.lang.reflect.Method.invoke(Method.java:585) [aspectj:iajc] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105) [aspectj:iajc] at org.apache.tools.ant.Task.perform(Task.java:348) [aspectj:iajc] at org.apache.tools.ant.Target.execute(Target.java:357) [aspectj:iajc] at org.apache.tools.ant.Target.performTasks(Target.java:385) [aspectj:iajc] at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329) [aspectj:iajc] at org.apache.tools.ant.Project.executeTarget(Project.java:1298) [aspectj:iajc] at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41) [aspectj:iajc] at org.eclipse.ant.internal.ui.antsupport.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32) [aspectj:iajc] at org.apache.tools.ant.Project.executeTargets(Project.java:1181) [aspectj:iajc] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:423) [aspectj:iajc] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:137)
resolved fixed
a8739e3
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2008-05-13T19:54:27Z
2008-05-11T15:33:20Z
weaver/src/org/aspectj/weaver/TypeFactory.java
/* ******************************************************************* * Copyright (c) 2005 Contributors. * All rights reserved. * This program and the accompanying materials are made available * under the terms of the Eclipse Public License v1.0 * which accompanies this distribution and is available at * http://eclipse.org/legal/epl-v10.html * * Contributors: * Adrian Colyer Initial implementation * ******************************************************************/ package org.aspectj.weaver; import java.util.ArrayList; import java.util.List; import org.aspectj.weaver.UnresolvedType.TypeKind; /** * @author colyer * */ public class TypeFactory { /** * Create a parameterized version of a generic type. * @param aGenericType * @param someTypeParameters note, in the case of an inner type of a parameterized type, * this parameter may legitimately be null
231,467
Bug 231467 Cant Compile new Statement for the Generic Class
[aspectj:iajc] error at (no source information available) [aspectj:iajc] C:\Development\PI\JavaSrc\com\centricsoftware\pi\service\expression\FuncNewMatrix.java:0::0 Internal compiler error [aspectj:iajc] java.lang.ArrayIndexOutOfBoundsException: 1 [aspectj:iajc] at org.aspectj.weaver.ResolvedType.getMemberParameterizationMap(ResolvedType.java:744) [aspectj:iajc] at org.aspectj.weaver.ReferenceType.getDeclaredInterfaces(ReferenceType.java:411) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.getDirectSupertypes(ResolvedType.java:68) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.collectInterTypeMungers(ResolvedType.java:1206) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.collectInterTypeMungers(ResolvedType.java:1211) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.collectInterTypeMungers(ResolvedType.java:1211) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.getInterTypeMungersIncludingSupers(ResolvedType.java:1185) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.checkInterTypeMungers(ResolvedType.java:1255) [aspectj:iajc] at org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment.weaveInterTypeDeclarations(AjLookupEnvironment.java:646) [aspectj:iajc] at org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment.weaveInterTypeDeclarations(AjLookupEnvironment.java:522) [aspectj:iajc] at org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment.createBinaryTypeFrom(AjLookupEnvironment.java:1105) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.createBinaryTypeFrom(LookupEnvironment.java:599) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.accept(Compiler.java:276) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.askForType(LookupEnvironment.java:113) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.UnresolvedReferenceBinding.resolve(UnresolvedReferenceBinding.java:49) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.resolveType(BinaryTypeBinding.java:99) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.getMemberType(BinaryTypeBinding.java:755) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.Scope.findMemberType(Scope.java:986) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.Scope.getMemberType(Scope.java:2116) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference.findNextTypeBinding(QualifiedTypeReference.java:43) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference.getTypeBinding(QualifiedTypeReference.java:77) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeReference.resolveType(TypeReference.java:142) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.AllocationExpression.resolveType(AllocationExpression.java:258) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.LocalDeclaration.resolve(LocalDeclaration.java:196) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolveStatements(AbstractMethodDeclaration.java:433) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.MethodDeclaration.resolveStatements(MethodDeclaration.java:196) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolve(AbstractMethodDeclaration.java:404) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1109) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1188) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.resolve(CompilationUnitDeclaration.java:366) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.process(Compiler.java:625) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:392) [aspectj:iajc] at org.aspectj.ajdt.internal.core.builder.AjBuildManager.performCompilation(AjBuildManager.java:990) [aspectj:iajc] at org.aspectj.ajdt.internal.core.builder.AjBuildManager.doBuild(AjBuildManager.java:264) [aspectj:iajc] at org.aspectj.ajdt.internal.core.builder.AjBuildManager.batchBuild(AjBuildManager.java:180) [aspectj:iajc] at org.aspectj.ajdt.ajc.AjdtCommand.doCommand(AjdtCommand.java:112) [aspectj:iajc] at org.aspectj.ajdt.ajc.AjdtCommand.runCommand(AjdtCommand.java:60) [aspectj:iajc] at org.aspectj.tools.ajc.Main.run(Main.java:378) [aspectj:iajc] at org.aspectj.tools.ajc.Main.runMain(Main.java:253) [aspectj:iajc] at org.aspectj.tools.ant.taskdefs.AjcTask.executeInSameVM(AjcTask.java:1303) [aspectj:iajc] at org.aspectj.tools.ant.taskdefs.AjcTask.execute(AjcTask.java:1101) [aspectj:iajc] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288) [aspectj:iajc] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [aspectj:iajc] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [aspectj:iajc] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [aspectj:iajc] at java.lang.reflect.Method.invoke(Method.java:585) [aspectj:iajc] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105) [aspectj:iajc] at org.apache.tools.ant.Task.perform(Task.java:348) [aspectj:iajc] at org.apache.tools.ant.Target.execute(Target.java:357) [aspectj:iajc] at org.apache.tools.ant.Target.performTasks(Target.java:385) [aspectj:iajc] at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329) [aspectj:iajc] at org.apache.tools.ant.Project.executeTarget(Project.java:1298) [aspectj:iajc] at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41) [aspectj:iajc] at org.eclipse.ant.internal.ui.antsupport.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32) [aspectj:iajc] at org.apache.tools.ant.Project.executeTargets(Project.java:1181) [aspectj:iajc] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:423) [aspectj:iajc] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:137) [aspectj:iajc] abort ABORT -- (ArrayIndexOutOfBoundsException) 1 [aspectj:iajc] 1 [aspectj:iajc] java.lang.ArrayIndexOutOfBoundsException: 1 [aspectj:iajc] at org.aspectj.weaver.ResolvedType.getMemberParameterizationMap(ResolvedType.java:744) [aspectj:iajc] at org.aspectj.weaver.ReferenceType.getDeclaredInterfaces(ReferenceType.java:411) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.getDirectSupertypes(ResolvedType.java:68) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.collectInterTypeMungers(ResolvedType.java:1206) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.collectInterTypeMungers(ResolvedType.java:1211) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.collectInterTypeMungers(ResolvedType.java:1211) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.getInterTypeMungersIncludingSupers(ResolvedType.java:1185) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.checkInterTypeMungers(ResolvedType.java:1255) [aspectj:iajc] at org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment.weaveInterTypeDeclarations(AjLookupEnvironment.java:646) [aspectj:iajc] at org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment.weaveInterTypeDeclarations(AjLookupEnvironment.java:522) [aspectj:iajc] at org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment.createBinaryTypeFrom(AjLookupEnvironment.java:1105) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.createBinaryTypeFrom(LookupEnvironment.java:599) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.accept(Compiler.java:276) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.askForType(LookupEnvironment.java:113) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.UnresolvedReferenceBinding.resolve(UnresolvedReferenceBinding.java:49) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.resolveType(BinaryTypeBinding.java:99) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.getMemberType(BinaryTypeBinding.java:755) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.Scope.findMemberType(Scope.java:986) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.Scope.getMemberType(Scope.java:2116) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference.findNextTypeBinding(QualifiedTypeReference.java:43) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference.getTypeBinding(QualifiedTypeReference.java:77) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeReference.resolveType(TypeReference.java:142) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.AllocationExpression.resolveType(AllocationExpression.java:258) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.LocalDeclaration.resolve(LocalDeclaration.java:196) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolveStatements(AbstractMethodDeclaration.java:433) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.MethodDeclaration.resolveStatements(MethodDeclaration.java:196) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolve(AbstractMethodDeclaration.java:404) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1109) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1188) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.resolve(CompilationUnitDeclaration.java:366) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.process(Compiler.java:625) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:392) [aspectj:iajc] at org.aspectj.ajdt.internal.core.builder.AjBuildManager.performCompilation(AjBuildManager.java:990) [aspectj:iajc] at org.aspectj.ajdt.internal.core.builder.AjBuildManager.doBuild(AjBuildManager.java:264) [aspectj:iajc] at org.aspectj.ajdt.internal.core.builder.AjBuildManager.batchBuild(AjBuildManager.java:180) [aspectj:iajc] at org.aspectj.ajdt.ajc.AjdtCommand.doCommand(AjdtCommand.java:112) [aspectj:iajc] at org.aspectj.ajdt.ajc.AjdtCommand.runCommand(AjdtCommand.java:60) [aspectj:iajc] at org.aspectj.tools.ajc.Main.run(Main.java:378) [aspectj:iajc] at org.aspectj.tools.ajc.Main.runMain(Main.java:253) [aspectj:iajc] at org.aspectj.tools.ant.taskdefs.AjcTask.executeInSameVM(AjcTask.java:1303) [aspectj:iajc] at org.aspectj.tools.ant.taskdefs.AjcTask.execute(AjcTask.java:1101) [aspectj:iajc] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288) [aspectj:iajc] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [aspectj:iajc] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [aspectj:iajc] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [aspectj:iajc] at java.lang.reflect.Method.invoke(Method.java:585) [aspectj:iajc] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105) [aspectj:iajc] at org.apache.tools.ant.Task.perform(Task.java:348) [aspectj:iajc] at org.apache.tools.ant.Target.execute(Target.java:357) [aspectj:iajc] at org.apache.tools.ant.Target.performTasks(Target.java:385) [aspectj:iajc] at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329) [aspectj:iajc] at org.apache.tools.ant.Project.executeTarget(Project.java:1298) [aspectj:iajc] at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41) [aspectj:iajc] at org.eclipse.ant.internal.ui.antsupport.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32) [aspectj:iajc] at org.apache.tools.ant.Project.executeTargets(Project.java:1181) [aspectj:iajc] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:423) [aspectj:iajc] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:137) [aspectj:iajc] May 11, 2008 9:35:06 AM org.aspectj.weaver.tools.Jdk14Trace info [aspectj:iajc] INFO: Dumping to C:\Development\PI\Projects\PI-ServiceCommon\.\ajcore.20080511.093506.214.txt [aspectj:iajc] MessageHolder: (92 info) (1 error) (1 abort) [aspectj:iajc] [error 0]: error at (no source information available) [aspectj:iajc] C:\Development\PI\JavaSrc\com\centricsoftware\pi\service\expression\FuncNewMatrix.java:0::0 Internal compiler error [aspectj:iajc] java.lang.ArrayIndexOutOfBoundsException: 1 [aspectj:iajc] at org.aspectj.weaver.ResolvedType.getMemberParameterizationMap(ResolvedType.java:744) [aspectj:iajc] at org.aspectj.weaver.ReferenceType.getDeclaredInterfaces(ReferenceType.java:411) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.getDirectSupertypes(ResolvedType.java:68) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.collectInterTypeMungers(ResolvedType.java:1206) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.collectInterTypeMungers(ResolvedType.java:1211) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.collectInterTypeMungers(ResolvedType.java:1211) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.getInterTypeMungersIncludingSupers(ResolvedType.java:1185) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.checkInterTypeMungers(ResolvedType.java:1255) [aspectj:iajc] at org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment.weaveInterTypeDeclarations(AjLookupEnvironment.java:646) [aspectj:iajc] at org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment.weaveInterTypeDeclarations(AjLookupEnvironment.java:522) [aspectj:iajc] at org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment.createBinaryTypeFrom(AjLookupEnvironment.java:1105) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.createBinaryTypeFrom(LookupEnvironment.java:599) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.accept(Compiler.java:276) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.askForType(LookupEnvironment.java:113) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.UnresolvedReferenceBinding.resolve(UnresolvedReferenceBinding.java:49) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.resolveType(BinaryTypeBinding.java:99) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.getMemberType(BinaryTypeBinding.java:755) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.Scope.findMemberType(Scope.java:986) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.Scope.getMemberType(Scope.java:2116) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference.findNextTypeBinding(QualifiedTypeReference.java:43) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference.getTypeBinding(QualifiedTypeReference.java:77) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeReference.resolveType(TypeReference.java:142) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.AllocationExpression.resolveType(AllocationExpression.java:258) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.LocalDeclaration.resolve(LocalDeclaration.java:196) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolveStatements(AbstractMethodDeclaration.java:433) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.MethodDeclaration.resolveStatements(MethodDeclaration.java:196) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolve(AbstractMethodDeclaration.java:404) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1109) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1188) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.resolve(CompilationUnitDeclaration.java:366) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.process(Compiler.java:625) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:392) [aspectj:iajc] at org.aspectj.ajdt.internal.core.builder.AjBuildManager.performCompilation(AjBuildManager.java:990) [aspectj:iajc] at org.aspectj.ajdt.internal.core.builder.AjBuildManager.doBuild(AjBuildManager.java:264) [aspectj:iajc] at org.aspectj.ajdt.internal.core.builder.AjBuildManager.batchBuild(AjBuildManager.java:180) [aspectj:iajc] at org.aspectj.ajdt.ajc.AjdtCommand.doCommand(AjdtCommand.java:112) [aspectj:iajc] at org.aspectj.ajdt.ajc.AjdtCommand.runCommand(AjdtCommand.java:60) [aspectj:iajc] at org.aspectj.tools.ajc.Main.run(Main.java:378) [aspectj:iajc] at org.aspectj.tools.ajc.Main.runMain(Main.java:253) [aspectj:iajc] at org.aspectj.tools.ant.taskdefs.AjcTask.executeInSameVM(AjcTask.java:1303) [aspectj:iajc] at org.aspectj.tools.ant.taskdefs.AjcTask.execute(AjcTask.java:1101) [aspectj:iajc] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288) [aspectj:iajc] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [aspectj:iajc] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [aspectj:iajc] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [aspectj:iajc] at java.lang.reflect.Method.invoke(Method.java:585) [aspectj:iajc] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105) [aspectj:iajc] at org.apache.tools.ant.Task.perform(Task.java:348) [aspectj:iajc] at org.apache.tools.ant.Target.execute(Target.java:357) [aspectj:iajc] at org.apache.tools.ant.Target.performTasks(Target.java:385) [aspectj:iajc] at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329) [aspectj:iajc] at org.apache.tools.ant.Project.executeTarget(Project.java:1298) [aspectj:iajc] at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41) [aspectj:iajc] at org.eclipse.ant.internal.ui.antsupport.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32) [aspectj:iajc] at org.apache.tools.ant.Project.executeTargets(Project.java:1181) [aspectj:iajc] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:423) [aspectj:iajc] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:137)
resolved fixed
a8739e3
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2008-05-13T19:54:27Z
2008-05-11T15:33:20Z
weaver/src/org/aspectj/weaver/TypeFactory.java
* @param inAWorld * @return */ public static ReferenceType createParameterizedType( ResolvedType aBaseType, UnresolvedType[] someTypeParameters, World inAWorld ) { ResolvedType baseType = aBaseType; if (!aBaseType.isGenericType()) { if (someTypeParameters != null && someTypeParameters.length>0) { if (!aBaseType.isRawType()) throw new IllegalStateException("Expecting raw type, not: "+aBaseType); baseType = baseType.getGenericType(); if (baseType == null) throw new IllegalStateException("Raw type does not have generic type set"); } } ResolvedType[] resolvedParameters = inAWorld.resolve(someTypeParameters); ReferenceType pType = new ReferenceType(baseType,resolvedParameters,inAWorld); return (ReferenceType) pType.resolve(inAWorld); } /** * Create an *unresolved* parameterized version of a generic type. */ public static UnresolvedType createUnresolvedParameterizedType(String sig,String erasuresig,UnresolvedType[] arguments) { return new UnresolvedType(sig,erasuresig,arguments); } public static ReferenceType createRawType( ResolvedType aBaseType,
231,467
Bug 231467 Cant Compile new Statement for the Generic Class
[aspectj:iajc] error at (no source information available) [aspectj:iajc] C:\Development\PI\JavaSrc\com\centricsoftware\pi\service\expression\FuncNewMatrix.java:0::0 Internal compiler error [aspectj:iajc] java.lang.ArrayIndexOutOfBoundsException: 1 [aspectj:iajc] at org.aspectj.weaver.ResolvedType.getMemberParameterizationMap(ResolvedType.java:744) [aspectj:iajc] at org.aspectj.weaver.ReferenceType.getDeclaredInterfaces(ReferenceType.java:411) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.getDirectSupertypes(ResolvedType.java:68) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.collectInterTypeMungers(ResolvedType.java:1206) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.collectInterTypeMungers(ResolvedType.java:1211) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.collectInterTypeMungers(ResolvedType.java:1211) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.getInterTypeMungersIncludingSupers(ResolvedType.java:1185) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.checkInterTypeMungers(ResolvedType.java:1255) [aspectj:iajc] at org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment.weaveInterTypeDeclarations(AjLookupEnvironment.java:646) [aspectj:iajc] at org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment.weaveInterTypeDeclarations(AjLookupEnvironment.java:522) [aspectj:iajc] at org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment.createBinaryTypeFrom(AjLookupEnvironment.java:1105) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.createBinaryTypeFrom(LookupEnvironment.java:599) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.accept(Compiler.java:276) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.askForType(LookupEnvironment.java:113) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.UnresolvedReferenceBinding.resolve(UnresolvedReferenceBinding.java:49) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.resolveType(BinaryTypeBinding.java:99) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.getMemberType(BinaryTypeBinding.java:755) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.Scope.findMemberType(Scope.java:986) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.Scope.getMemberType(Scope.java:2116) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference.findNextTypeBinding(QualifiedTypeReference.java:43) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference.getTypeBinding(QualifiedTypeReference.java:77) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeReference.resolveType(TypeReference.java:142) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.AllocationExpression.resolveType(AllocationExpression.java:258) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.LocalDeclaration.resolve(LocalDeclaration.java:196) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolveStatements(AbstractMethodDeclaration.java:433) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.MethodDeclaration.resolveStatements(MethodDeclaration.java:196) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolve(AbstractMethodDeclaration.java:404) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1109) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1188) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.resolve(CompilationUnitDeclaration.java:366) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.process(Compiler.java:625) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:392) [aspectj:iajc] at org.aspectj.ajdt.internal.core.builder.AjBuildManager.performCompilation(AjBuildManager.java:990) [aspectj:iajc] at org.aspectj.ajdt.internal.core.builder.AjBuildManager.doBuild(AjBuildManager.java:264) [aspectj:iajc] at org.aspectj.ajdt.internal.core.builder.AjBuildManager.batchBuild(AjBuildManager.java:180) [aspectj:iajc] at org.aspectj.ajdt.ajc.AjdtCommand.doCommand(AjdtCommand.java:112) [aspectj:iajc] at org.aspectj.ajdt.ajc.AjdtCommand.runCommand(AjdtCommand.java:60) [aspectj:iajc] at org.aspectj.tools.ajc.Main.run(Main.java:378) [aspectj:iajc] at org.aspectj.tools.ajc.Main.runMain(Main.java:253) [aspectj:iajc] at org.aspectj.tools.ant.taskdefs.AjcTask.executeInSameVM(AjcTask.java:1303) [aspectj:iajc] at org.aspectj.tools.ant.taskdefs.AjcTask.execute(AjcTask.java:1101) [aspectj:iajc] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288) [aspectj:iajc] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [aspectj:iajc] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [aspectj:iajc] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [aspectj:iajc] at java.lang.reflect.Method.invoke(Method.java:585) [aspectj:iajc] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105) [aspectj:iajc] at org.apache.tools.ant.Task.perform(Task.java:348) [aspectj:iajc] at org.apache.tools.ant.Target.execute(Target.java:357) [aspectj:iajc] at org.apache.tools.ant.Target.performTasks(Target.java:385) [aspectj:iajc] at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329) [aspectj:iajc] at org.apache.tools.ant.Project.executeTarget(Project.java:1298) [aspectj:iajc] at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41) [aspectj:iajc] at org.eclipse.ant.internal.ui.antsupport.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32) [aspectj:iajc] at org.apache.tools.ant.Project.executeTargets(Project.java:1181) [aspectj:iajc] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:423) [aspectj:iajc] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:137) [aspectj:iajc] abort ABORT -- (ArrayIndexOutOfBoundsException) 1 [aspectj:iajc] 1 [aspectj:iajc] java.lang.ArrayIndexOutOfBoundsException: 1 [aspectj:iajc] at org.aspectj.weaver.ResolvedType.getMemberParameterizationMap(ResolvedType.java:744) [aspectj:iajc] at org.aspectj.weaver.ReferenceType.getDeclaredInterfaces(ReferenceType.java:411) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.getDirectSupertypes(ResolvedType.java:68) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.collectInterTypeMungers(ResolvedType.java:1206) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.collectInterTypeMungers(ResolvedType.java:1211) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.collectInterTypeMungers(ResolvedType.java:1211) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.getInterTypeMungersIncludingSupers(ResolvedType.java:1185) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.checkInterTypeMungers(ResolvedType.java:1255) [aspectj:iajc] at org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment.weaveInterTypeDeclarations(AjLookupEnvironment.java:646) [aspectj:iajc] at org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment.weaveInterTypeDeclarations(AjLookupEnvironment.java:522) [aspectj:iajc] at org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment.createBinaryTypeFrom(AjLookupEnvironment.java:1105) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.createBinaryTypeFrom(LookupEnvironment.java:599) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.accept(Compiler.java:276) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.askForType(LookupEnvironment.java:113) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.UnresolvedReferenceBinding.resolve(UnresolvedReferenceBinding.java:49) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.resolveType(BinaryTypeBinding.java:99) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.getMemberType(BinaryTypeBinding.java:755) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.Scope.findMemberType(Scope.java:986) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.Scope.getMemberType(Scope.java:2116) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference.findNextTypeBinding(QualifiedTypeReference.java:43) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference.getTypeBinding(QualifiedTypeReference.java:77) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeReference.resolveType(TypeReference.java:142) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.AllocationExpression.resolveType(AllocationExpression.java:258) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.LocalDeclaration.resolve(LocalDeclaration.java:196) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolveStatements(AbstractMethodDeclaration.java:433) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.MethodDeclaration.resolveStatements(MethodDeclaration.java:196) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolve(AbstractMethodDeclaration.java:404) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1109) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1188) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.resolve(CompilationUnitDeclaration.java:366) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.process(Compiler.java:625) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:392) [aspectj:iajc] at org.aspectj.ajdt.internal.core.builder.AjBuildManager.performCompilation(AjBuildManager.java:990) [aspectj:iajc] at org.aspectj.ajdt.internal.core.builder.AjBuildManager.doBuild(AjBuildManager.java:264) [aspectj:iajc] at org.aspectj.ajdt.internal.core.builder.AjBuildManager.batchBuild(AjBuildManager.java:180) [aspectj:iajc] at org.aspectj.ajdt.ajc.AjdtCommand.doCommand(AjdtCommand.java:112) [aspectj:iajc] at org.aspectj.ajdt.ajc.AjdtCommand.runCommand(AjdtCommand.java:60) [aspectj:iajc] at org.aspectj.tools.ajc.Main.run(Main.java:378) [aspectj:iajc] at org.aspectj.tools.ajc.Main.runMain(Main.java:253) [aspectj:iajc] at org.aspectj.tools.ant.taskdefs.AjcTask.executeInSameVM(AjcTask.java:1303) [aspectj:iajc] at org.aspectj.tools.ant.taskdefs.AjcTask.execute(AjcTask.java:1101) [aspectj:iajc] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288) [aspectj:iajc] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [aspectj:iajc] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [aspectj:iajc] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [aspectj:iajc] at java.lang.reflect.Method.invoke(Method.java:585) [aspectj:iajc] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105) [aspectj:iajc] at org.apache.tools.ant.Task.perform(Task.java:348) [aspectj:iajc] at org.apache.tools.ant.Target.execute(Target.java:357) [aspectj:iajc] at org.apache.tools.ant.Target.performTasks(Target.java:385) [aspectj:iajc] at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329) [aspectj:iajc] at org.apache.tools.ant.Project.executeTarget(Project.java:1298) [aspectj:iajc] at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41) [aspectj:iajc] at org.eclipse.ant.internal.ui.antsupport.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32) [aspectj:iajc] at org.apache.tools.ant.Project.executeTargets(Project.java:1181) [aspectj:iajc] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:423) [aspectj:iajc] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:137) [aspectj:iajc] May 11, 2008 9:35:06 AM org.aspectj.weaver.tools.Jdk14Trace info [aspectj:iajc] INFO: Dumping to C:\Development\PI\Projects\PI-ServiceCommon\.\ajcore.20080511.093506.214.txt [aspectj:iajc] MessageHolder: (92 info) (1 error) (1 abort) [aspectj:iajc] [error 0]: error at (no source information available) [aspectj:iajc] C:\Development\PI\JavaSrc\com\centricsoftware\pi\service\expression\FuncNewMatrix.java:0::0 Internal compiler error [aspectj:iajc] java.lang.ArrayIndexOutOfBoundsException: 1 [aspectj:iajc] at org.aspectj.weaver.ResolvedType.getMemberParameterizationMap(ResolvedType.java:744) [aspectj:iajc] at org.aspectj.weaver.ReferenceType.getDeclaredInterfaces(ReferenceType.java:411) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.getDirectSupertypes(ResolvedType.java:68) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.collectInterTypeMungers(ResolvedType.java:1206) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.collectInterTypeMungers(ResolvedType.java:1211) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.collectInterTypeMungers(ResolvedType.java:1211) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.getInterTypeMungersIncludingSupers(ResolvedType.java:1185) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.checkInterTypeMungers(ResolvedType.java:1255) [aspectj:iajc] at org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment.weaveInterTypeDeclarations(AjLookupEnvironment.java:646) [aspectj:iajc] at org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment.weaveInterTypeDeclarations(AjLookupEnvironment.java:522) [aspectj:iajc] at org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment.createBinaryTypeFrom(AjLookupEnvironment.java:1105) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.createBinaryTypeFrom(LookupEnvironment.java:599) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.accept(Compiler.java:276) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.askForType(LookupEnvironment.java:113) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.UnresolvedReferenceBinding.resolve(UnresolvedReferenceBinding.java:49) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.resolveType(BinaryTypeBinding.java:99) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.getMemberType(BinaryTypeBinding.java:755) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.Scope.findMemberType(Scope.java:986) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.Scope.getMemberType(Scope.java:2116) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference.findNextTypeBinding(QualifiedTypeReference.java:43) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference.getTypeBinding(QualifiedTypeReference.java:77) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeReference.resolveType(TypeReference.java:142) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.AllocationExpression.resolveType(AllocationExpression.java:258) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.LocalDeclaration.resolve(LocalDeclaration.java:196) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolveStatements(AbstractMethodDeclaration.java:433) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.MethodDeclaration.resolveStatements(MethodDeclaration.java:196) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolve(AbstractMethodDeclaration.java:404) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1109) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1188) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.resolve(CompilationUnitDeclaration.java:366) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.process(Compiler.java:625) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:392) [aspectj:iajc] at org.aspectj.ajdt.internal.core.builder.AjBuildManager.performCompilation(AjBuildManager.java:990) [aspectj:iajc] at org.aspectj.ajdt.internal.core.builder.AjBuildManager.doBuild(AjBuildManager.java:264) [aspectj:iajc] at org.aspectj.ajdt.internal.core.builder.AjBuildManager.batchBuild(AjBuildManager.java:180) [aspectj:iajc] at org.aspectj.ajdt.ajc.AjdtCommand.doCommand(AjdtCommand.java:112) [aspectj:iajc] at org.aspectj.ajdt.ajc.AjdtCommand.runCommand(AjdtCommand.java:60) [aspectj:iajc] at org.aspectj.tools.ajc.Main.run(Main.java:378) [aspectj:iajc] at org.aspectj.tools.ajc.Main.runMain(Main.java:253) [aspectj:iajc] at org.aspectj.tools.ant.taskdefs.AjcTask.executeInSameVM(AjcTask.java:1303) [aspectj:iajc] at org.aspectj.tools.ant.taskdefs.AjcTask.execute(AjcTask.java:1101) [aspectj:iajc] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288) [aspectj:iajc] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [aspectj:iajc] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [aspectj:iajc] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [aspectj:iajc] at java.lang.reflect.Method.invoke(Method.java:585) [aspectj:iajc] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105) [aspectj:iajc] at org.apache.tools.ant.Task.perform(Task.java:348) [aspectj:iajc] at org.apache.tools.ant.Target.execute(Target.java:357) [aspectj:iajc] at org.apache.tools.ant.Target.performTasks(Target.java:385) [aspectj:iajc] at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329) [aspectj:iajc] at org.apache.tools.ant.Project.executeTarget(Project.java:1298) [aspectj:iajc] at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41) [aspectj:iajc] at org.eclipse.ant.internal.ui.antsupport.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32) [aspectj:iajc] at org.apache.tools.ant.Project.executeTargets(Project.java:1181) [aspectj:iajc] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:423) [aspectj:iajc] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:137)
resolved fixed
a8739e3
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2008-05-13T19:54:27Z
2008-05-11T15:33:20Z
weaver/src/org/aspectj/weaver/TypeFactory.java
World inAWorld ) { if (aBaseType.isRawType()) return (ReferenceType) aBaseType; if (!aBaseType.isGenericType()) { if (!aBaseType.isRawType()) throw new IllegalStateException("Expecting generic type"); } ReferenceType rType = new ReferenceType(aBaseType,inAWorld); return (ReferenceType) rType.resolve(inAWorld); } /** * Creates a sensible unresolvedtype from some signature, for example: * signature = LIGuard<TT;>; * bound = toString=IGuard<T> sig=PIGuard<TT;>; sigErasure=LIGuard; kind=parameterized */ private static UnresolvedType convertSigToType(String aSignature) { UnresolvedType bound = null; int startOfParams = aSignature.indexOf('<'); if (startOfParams==-1) { bound = UnresolvedType.forSignature(aSignature); } else { int endOfParams = aSignature.lastIndexOf('>'); String signatureErasure = "L" + aSignature.substring(1,startOfParams) + ";"; UnresolvedType[] typeParams = createTypeParams(aSignature.substring(startOfParams +1, endOfParams)); bound = new UnresolvedType("P"+aSignature.substring(1),signatureErasure,typeParams); } return bound; }
231,467
Bug 231467 Cant Compile new Statement for the Generic Class
[aspectj:iajc] error at (no source information available) [aspectj:iajc] C:\Development\PI\JavaSrc\com\centricsoftware\pi\service\expression\FuncNewMatrix.java:0::0 Internal compiler error [aspectj:iajc] java.lang.ArrayIndexOutOfBoundsException: 1 [aspectj:iajc] at org.aspectj.weaver.ResolvedType.getMemberParameterizationMap(ResolvedType.java:744) [aspectj:iajc] at org.aspectj.weaver.ReferenceType.getDeclaredInterfaces(ReferenceType.java:411) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.getDirectSupertypes(ResolvedType.java:68) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.collectInterTypeMungers(ResolvedType.java:1206) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.collectInterTypeMungers(ResolvedType.java:1211) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.collectInterTypeMungers(ResolvedType.java:1211) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.getInterTypeMungersIncludingSupers(ResolvedType.java:1185) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.checkInterTypeMungers(ResolvedType.java:1255) [aspectj:iajc] at org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment.weaveInterTypeDeclarations(AjLookupEnvironment.java:646) [aspectj:iajc] at org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment.weaveInterTypeDeclarations(AjLookupEnvironment.java:522) [aspectj:iajc] at org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment.createBinaryTypeFrom(AjLookupEnvironment.java:1105) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.createBinaryTypeFrom(LookupEnvironment.java:599) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.accept(Compiler.java:276) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.askForType(LookupEnvironment.java:113) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.UnresolvedReferenceBinding.resolve(UnresolvedReferenceBinding.java:49) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.resolveType(BinaryTypeBinding.java:99) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.getMemberType(BinaryTypeBinding.java:755) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.Scope.findMemberType(Scope.java:986) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.Scope.getMemberType(Scope.java:2116) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference.findNextTypeBinding(QualifiedTypeReference.java:43) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference.getTypeBinding(QualifiedTypeReference.java:77) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeReference.resolveType(TypeReference.java:142) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.AllocationExpression.resolveType(AllocationExpression.java:258) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.LocalDeclaration.resolve(LocalDeclaration.java:196) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolveStatements(AbstractMethodDeclaration.java:433) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.MethodDeclaration.resolveStatements(MethodDeclaration.java:196) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolve(AbstractMethodDeclaration.java:404) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1109) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1188) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.resolve(CompilationUnitDeclaration.java:366) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.process(Compiler.java:625) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:392) [aspectj:iajc] at org.aspectj.ajdt.internal.core.builder.AjBuildManager.performCompilation(AjBuildManager.java:990) [aspectj:iajc] at org.aspectj.ajdt.internal.core.builder.AjBuildManager.doBuild(AjBuildManager.java:264) [aspectj:iajc] at org.aspectj.ajdt.internal.core.builder.AjBuildManager.batchBuild(AjBuildManager.java:180) [aspectj:iajc] at org.aspectj.ajdt.ajc.AjdtCommand.doCommand(AjdtCommand.java:112) [aspectj:iajc] at org.aspectj.ajdt.ajc.AjdtCommand.runCommand(AjdtCommand.java:60) [aspectj:iajc] at org.aspectj.tools.ajc.Main.run(Main.java:378) [aspectj:iajc] at org.aspectj.tools.ajc.Main.runMain(Main.java:253) [aspectj:iajc] at org.aspectj.tools.ant.taskdefs.AjcTask.executeInSameVM(AjcTask.java:1303) [aspectj:iajc] at org.aspectj.tools.ant.taskdefs.AjcTask.execute(AjcTask.java:1101) [aspectj:iajc] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288) [aspectj:iajc] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [aspectj:iajc] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [aspectj:iajc] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [aspectj:iajc] at java.lang.reflect.Method.invoke(Method.java:585) [aspectj:iajc] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105) [aspectj:iajc] at org.apache.tools.ant.Task.perform(Task.java:348) [aspectj:iajc] at org.apache.tools.ant.Target.execute(Target.java:357) [aspectj:iajc] at org.apache.tools.ant.Target.performTasks(Target.java:385) [aspectj:iajc] at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329) [aspectj:iajc] at org.apache.tools.ant.Project.executeTarget(Project.java:1298) [aspectj:iajc] at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41) [aspectj:iajc] at org.eclipse.ant.internal.ui.antsupport.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32) [aspectj:iajc] at org.apache.tools.ant.Project.executeTargets(Project.java:1181) [aspectj:iajc] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:423) [aspectj:iajc] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:137) [aspectj:iajc] abort ABORT -- (ArrayIndexOutOfBoundsException) 1 [aspectj:iajc] 1 [aspectj:iajc] java.lang.ArrayIndexOutOfBoundsException: 1 [aspectj:iajc] at org.aspectj.weaver.ResolvedType.getMemberParameterizationMap(ResolvedType.java:744) [aspectj:iajc] at org.aspectj.weaver.ReferenceType.getDeclaredInterfaces(ReferenceType.java:411) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.getDirectSupertypes(ResolvedType.java:68) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.collectInterTypeMungers(ResolvedType.java:1206) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.collectInterTypeMungers(ResolvedType.java:1211) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.collectInterTypeMungers(ResolvedType.java:1211) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.getInterTypeMungersIncludingSupers(ResolvedType.java:1185) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.checkInterTypeMungers(ResolvedType.java:1255) [aspectj:iajc] at org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment.weaveInterTypeDeclarations(AjLookupEnvironment.java:646) [aspectj:iajc] at org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment.weaveInterTypeDeclarations(AjLookupEnvironment.java:522) [aspectj:iajc] at org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment.createBinaryTypeFrom(AjLookupEnvironment.java:1105) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.createBinaryTypeFrom(LookupEnvironment.java:599) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.accept(Compiler.java:276) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.askForType(LookupEnvironment.java:113) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.UnresolvedReferenceBinding.resolve(UnresolvedReferenceBinding.java:49) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.resolveType(BinaryTypeBinding.java:99) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.getMemberType(BinaryTypeBinding.java:755) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.Scope.findMemberType(Scope.java:986) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.Scope.getMemberType(Scope.java:2116) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference.findNextTypeBinding(QualifiedTypeReference.java:43) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference.getTypeBinding(QualifiedTypeReference.java:77) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeReference.resolveType(TypeReference.java:142) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.AllocationExpression.resolveType(AllocationExpression.java:258) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.LocalDeclaration.resolve(LocalDeclaration.java:196) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolveStatements(AbstractMethodDeclaration.java:433) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.MethodDeclaration.resolveStatements(MethodDeclaration.java:196) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolve(AbstractMethodDeclaration.java:404) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1109) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1188) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.resolve(CompilationUnitDeclaration.java:366) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.process(Compiler.java:625) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:392) [aspectj:iajc] at org.aspectj.ajdt.internal.core.builder.AjBuildManager.performCompilation(AjBuildManager.java:990) [aspectj:iajc] at org.aspectj.ajdt.internal.core.builder.AjBuildManager.doBuild(AjBuildManager.java:264) [aspectj:iajc] at org.aspectj.ajdt.internal.core.builder.AjBuildManager.batchBuild(AjBuildManager.java:180) [aspectj:iajc] at org.aspectj.ajdt.ajc.AjdtCommand.doCommand(AjdtCommand.java:112) [aspectj:iajc] at org.aspectj.ajdt.ajc.AjdtCommand.runCommand(AjdtCommand.java:60) [aspectj:iajc] at org.aspectj.tools.ajc.Main.run(Main.java:378) [aspectj:iajc] at org.aspectj.tools.ajc.Main.runMain(Main.java:253) [aspectj:iajc] at org.aspectj.tools.ant.taskdefs.AjcTask.executeInSameVM(AjcTask.java:1303) [aspectj:iajc] at org.aspectj.tools.ant.taskdefs.AjcTask.execute(AjcTask.java:1101) [aspectj:iajc] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288) [aspectj:iajc] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [aspectj:iajc] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [aspectj:iajc] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [aspectj:iajc] at java.lang.reflect.Method.invoke(Method.java:585) [aspectj:iajc] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105) [aspectj:iajc] at org.apache.tools.ant.Task.perform(Task.java:348) [aspectj:iajc] at org.apache.tools.ant.Target.execute(Target.java:357) [aspectj:iajc] at org.apache.tools.ant.Target.performTasks(Target.java:385) [aspectj:iajc] at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329) [aspectj:iajc] at org.apache.tools.ant.Project.executeTarget(Project.java:1298) [aspectj:iajc] at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41) [aspectj:iajc] at org.eclipse.ant.internal.ui.antsupport.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32) [aspectj:iajc] at org.apache.tools.ant.Project.executeTargets(Project.java:1181) [aspectj:iajc] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:423) [aspectj:iajc] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:137) [aspectj:iajc] May 11, 2008 9:35:06 AM org.aspectj.weaver.tools.Jdk14Trace info [aspectj:iajc] INFO: Dumping to C:\Development\PI\Projects\PI-ServiceCommon\.\ajcore.20080511.093506.214.txt [aspectj:iajc] MessageHolder: (92 info) (1 error) (1 abort) [aspectj:iajc] [error 0]: error at (no source information available) [aspectj:iajc] C:\Development\PI\JavaSrc\com\centricsoftware\pi\service\expression\FuncNewMatrix.java:0::0 Internal compiler error [aspectj:iajc] java.lang.ArrayIndexOutOfBoundsException: 1 [aspectj:iajc] at org.aspectj.weaver.ResolvedType.getMemberParameterizationMap(ResolvedType.java:744) [aspectj:iajc] at org.aspectj.weaver.ReferenceType.getDeclaredInterfaces(ReferenceType.java:411) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.getDirectSupertypes(ResolvedType.java:68) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.collectInterTypeMungers(ResolvedType.java:1206) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.collectInterTypeMungers(ResolvedType.java:1211) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.collectInterTypeMungers(ResolvedType.java:1211) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.getInterTypeMungersIncludingSupers(ResolvedType.java:1185) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.checkInterTypeMungers(ResolvedType.java:1255) [aspectj:iajc] at org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment.weaveInterTypeDeclarations(AjLookupEnvironment.java:646) [aspectj:iajc] at org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment.weaveInterTypeDeclarations(AjLookupEnvironment.java:522) [aspectj:iajc] at org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment.createBinaryTypeFrom(AjLookupEnvironment.java:1105) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.createBinaryTypeFrom(LookupEnvironment.java:599) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.accept(Compiler.java:276) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.askForType(LookupEnvironment.java:113) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.UnresolvedReferenceBinding.resolve(UnresolvedReferenceBinding.java:49) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.resolveType(BinaryTypeBinding.java:99) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.getMemberType(BinaryTypeBinding.java:755) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.Scope.findMemberType(Scope.java:986) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.Scope.getMemberType(Scope.java:2116) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference.findNextTypeBinding(QualifiedTypeReference.java:43) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference.getTypeBinding(QualifiedTypeReference.java:77) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeReference.resolveType(TypeReference.java:142) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.AllocationExpression.resolveType(AllocationExpression.java:258) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.LocalDeclaration.resolve(LocalDeclaration.java:196) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolveStatements(AbstractMethodDeclaration.java:433) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.MethodDeclaration.resolveStatements(MethodDeclaration.java:196) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolve(AbstractMethodDeclaration.java:404) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1109) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1188) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.resolve(CompilationUnitDeclaration.java:366) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.process(Compiler.java:625) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:392) [aspectj:iajc] at org.aspectj.ajdt.internal.core.builder.AjBuildManager.performCompilation(AjBuildManager.java:990) [aspectj:iajc] at org.aspectj.ajdt.internal.core.builder.AjBuildManager.doBuild(AjBuildManager.java:264) [aspectj:iajc] at org.aspectj.ajdt.internal.core.builder.AjBuildManager.batchBuild(AjBuildManager.java:180) [aspectj:iajc] at org.aspectj.ajdt.ajc.AjdtCommand.doCommand(AjdtCommand.java:112) [aspectj:iajc] at org.aspectj.ajdt.ajc.AjdtCommand.runCommand(AjdtCommand.java:60) [aspectj:iajc] at org.aspectj.tools.ajc.Main.run(Main.java:378) [aspectj:iajc] at org.aspectj.tools.ajc.Main.runMain(Main.java:253) [aspectj:iajc] at org.aspectj.tools.ant.taskdefs.AjcTask.executeInSameVM(AjcTask.java:1303) [aspectj:iajc] at org.aspectj.tools.ant.taskdefs.AjcTask.execute(AjcTask.java:1101) [aspectj:iajc] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288) [aspectj:iajc] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [aspectj:iajc] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [aspectj:iajc] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [aspectj:iajc] at java.lang.reflect.Method.invoke(Method.java:585) [aspectj:iajc] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105) [aspectj:iajc] at org.apache.tools.ant.Task.perform(Task.java:348) [aspectj:iajc] at org.apache.tools.ant.Target.execute(Target.java:357) [aspectj:iajc] at org.apache.tools.ant.Target.performTasks(Target.java:385) [aspectj:iajc] at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329) [aspectj:iajc] at org.apache.tools.ant.Project.executeTarget(Project.java:1298) [aspectj:iajc] at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41) [aspectj:iajc] at org.eclipse.ant.internal.ui.antsupport.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32) [aspectj:iajc] at org.apache.tools.ant.Project.executeTargets(Project.java:1181) [aspectj:iajc] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:423) [aspectj:iajc] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:137)
resolved fixed
a8739e3
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2008-05-13T19:54:27Z
2008-05-11T15:33:20Z
weaver/src/org/aspectj/weaver/TypeFactory.java
/** * Used by UnresolvedType.read, creates a type from a full signature. * @param signature * @return */ public static UnresolvedType createTypeFromSignature(String signature) { if (signature.equals(ResolvedType.MISSING_NAME)) return ResolvedType.MISSING; char firstChar = signature.charAt(0); if (firstChar=='P') { int startOfParams = signature.indexOf('<'); if (startOfParams==-1) { String signatureErasure = "L" + signature.substring(1); UnresolvedType[] typeParams = new UnresolvedType[0]; return new UnresolvedType(signature,signatureErasure,typeParams); } else { int endOfParams = locateMatchingEndBracket(signature,startOfParams); StringBuffer erasureSig = new StringBuffer(signature); while (startOfParams!=-1) { erasureSig.delete(startOfParams,endOfParams+1); startOfParams = locateFirstBracket(erasureSig); if (startOfParams!=-1) endOfParams = locateMatchingEndBracket(erasureSig,startOfParams); } String signatureErasure = "L" + erasureSig.toString().substring(1);
231,467
Bug 231467 Cant Compile new Statement for the Generic Class
[aspectj:iajc] error at (no source information available) [aspectj:iajc] C:\Development\PI\JavaSrc\com\centricsoftware\pi\service\expression\FuncNewMatrix.java:0::0 Internal compiler error [aspectj:iajc] java.lang.ArrayIndexOutOfBoundsException: 1 [aspectj:iajc] at org.aspectj.weaver.ResolvedType.getMemberParameterizationMap(ResolvedType.java:744) [aspectj:iajc] at org.aspectj.weaver.ReferenceType.getDeclaredInterfaces(ReferenceType.java:411) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.getDirectSupertypes(ResolvedType.java:68) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.collectInterTypeMungers(ResolvedType.java:1206) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.collectInterTypeMungers(ResolvedType.java:1211) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.collectInterTypeMungers(ResolvedType.java:1211) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.getInterTypeMungersIncludingSupers(ResolvedType.java:1185) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.checkInterTypeMungers(ResolvedType.java:1255) [aspectj:iajc] at org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment.weaveInterTypeDeclarations(AjLookupEnvironment.java:646) [aspectj:iajc] at org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment.weaveInterTypeDeclarations(AjLookupEnvironment.java:522) [aspectj:iajc] at org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment.createBinaryTypeFrom(AjLookupEnvironment.java:1105) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.createBinaryTypeFrom(LookupEnvironment.java:599) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.accept(Compiler.java:276) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.askForType(LookupEnvironment.java:113) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.UnresolvedReferenceBinding.resolve(UnresolvedReferenceBinding.java:49) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.resolveType(BinaryTypeBinding.java:99) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.getMemberType(BinaryTypeBinding.java:755) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.Scope.findMemberType(Scope.java:986) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.Scope.getMemberType(Scope.java:2116) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference.findNextTypeBinding(QualifiedTypeReference.java:43) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference.getTypeBinding(QualifiedTypeReference.java:77) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeReference.resolveType(TypeReference.java:142) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.AllocationExpression.resolveType(AllocationExpression.java:258) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.LocalDeclaration.resolve(LocalDeclaration.java:196) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolveStatements(AbstractMethodDeclaration.java:433) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.MethodDeclaration.resolveStatements(MethodDeclaration.java:196) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolve(AbstractMethodDeclaration.java:404) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1109) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1188) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.resolve(CompilationUnitDeclaration.java:366) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.process(Compiler.java:625) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:392) [aspectj:iajc] at org.aspectj.ajdt.internal.core.builder.AjBuildManager.performCompilation(AjBuildManager.java:990) [aspectj:iajc] at org.aspectj.ajdt.internal.core.builder.AjBuildManager.doBuild(AjBuildManager.java:264) [aspectj:iajc] at org.aspectj.ajdt.internal.core.builder.AjBuildManager.batchBuild(AjBuildManager.java:180) [aspectj:iajc] at org.aspectj.ajdt.ajc.AjdtCommand.doCommand(AjdtCommand.java:112) [aspectj:iajc] at org.aspectj.ajdt.ajc.AjdtCommand.runCommand(AjdtCommand.java:60) [aspectj:iajc] at org.aspectj.tools.ajc.Main.run(Main.java:378) [aspectj:iajc] at org.aspectj.tools.ajc.Main.runMain(Main.java:253) [aspectj:iajc] at org.aspectj.tools.ant.taskdefs.AjcTask.executeInSameVM(AjcTask.java:1303) [aspectj:iajc] at org.aspectj.tools.ant.taskdefs.AjcTask.execute(AjcTask.java:1101) [aspectj:iajc] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288) [aspectj:iajc] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [aspectj:iajc] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [aspectj:iajc] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [aspectj:iajc] at java.lang.reflect.Method.invoke(Method.java:585) [aspectj:iajc] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105) [aspectj:iajc] at org.apache.tools.ant.Task.perform(Task.java:348) [aspectj:iajc] at org.apache.tools.ant.Target.execute(Target.java:357) [aspectj:iajc] at org.apache.tools.ant.Target.performTasks(Target.java:385) [aspectj:iajc] at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329) [aspectj:iajc] at org.apache.tools.ant.Project.executeTarget(Project.java:1298) [aspectj:iajc] at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41) [aspectj:iajc] at org.eclipse.ant.internal.ui.antsupport.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32) [aspectj:iajc] at org.apache.tools.ant.Project.executeTargets(Project.java:1181) [aspectj:iajc] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:423) [aspectj:iajc] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:137) [aspectj:iajc] abort ABORT -- (ArrayIndexOutOfBoundsException) 1 [aspectj:iajc] 1 [aspectj:iajc] java.lang.ArrayIndexOutOfBoundsException: 1 [aspectj:iajc] at org.aspectj.weaver.ResolvedType.getMemberParameterizationMap(ResolvedType.java:744) [aspectj:iajc] at org.aspectj.weaver.ReferenceType.getDeclaredInterfaces(ReferenceType.java:411) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.getDirectSupertypes(ResolvedType.java:68) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.collectInterTypeMungers(ResolvedType.java:1206) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.collectInterTypeMungers(ResolvedType.java:1211) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.collectInterTypeMungers(ResolvedType.java:1211) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.getInterTypeMungersIncludingSupers(ResolvedType.java:1185) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.checkInterTypeMungers(ResolvedType.java:1255) [aspectj:iajc] at org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment.weaveInterTypeDeclarations(AjLookupEnvironment.java:646) [aspectj:iajc] at org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment.weaveInterTypeDeclarations(AjLookupEnvironment.java:522) [aspectj:iajc] at org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment.createBinaryTypeFrom(AjLookupEnvironment.java:1105) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.createBinaryTypeFrom(LookupEnvironment.java:599) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.accept(Compiler.java:276) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.askForType(LookupEnvironment.java:113) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.UnresolvedReferenceBinding.resolve(UnresolvedReferenceBinding.java:49) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.resolveType(BinaryTypeBinding.java:99) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.getMemberType(BinaryTypeBinding.java:755) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.Scope.findMemberType(Scope.java:986) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.Scope.getMemberType(Scope.java:2116) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference.findNextTypeBinding(QualifiedTypeReference.java:43) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference.getTypeBinding(QualifiedTypeReference.java:77) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeReference.resolveType(TypeReference.java:142) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.AllocationExpression.resolveType(AllocationExpression.java:258) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.LocalDeclaration.resolve(LocalDeclaration.java:196) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolveStatements(AbstractMethodDeclaration.java:433) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.MethodDeclaration.resolveStatements(MethodDeclaration.java:196) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolve(AbstractMethodDeclaration.java:404) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1109) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1188) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.resolve(CompilationUnitDeclaration.java:366) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.process(Compiler.java:625) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:392) [aspectj:iajc] at org.aspectj.ajdt.internal.core.builder.AjBuildManager.performCompilation(AjBuildManager.java:990) [aspectj:iajc] at org.aspectj.ajdt.internal.core.builder.AjBuildManager.doBuild(AjBuildManager.java:264) [aspectj:iajc] at org.aspectj.ajdt.internal.core.builder.AjBuildManager.batchBuild(AjBuildManager.java:180) [aspectj:iajc] at org.aspectj.ajdt.ajc.AjdtCommand.doCommand(AjdtCommand.java:112) [aspectj:iajc] at org.aspectj.ajdt.ajc.AjdtCommand.runCommand(AjdtCommand.java:60) [aspectj:iajc] at org.aspectj.tools.ajc.Main.run(Main.java:378) [aspectj:iajc] at org.aspectj.tools.ajc.Main.runMain(Main.java:253) [aspectj:iajc] at org.aspectj.tools.ant.taskdefs.AjcTask.executeInSameVM(AjcTask.java:1303) [aspectj:iajc] at org.aspectj.tools.ant.taskdefs.AjcTask.execute(AjcTask.java:1101) [aspectj:iajc] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288) [aspectj:iajc] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [aspectj:iajc] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [aspectj:iajc] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [aspectj:iajc] at java.lang.reflect.Method.invoke(Method.java:585) [aspectj:iajc] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105) [aspectj:iajc] at org.apache.tools.ant.Task.perform(Task.java:348) [aspectj:iajc] at org.apache.tools.ant.Target.execute(Target.java:357) [aspectj:iajc] at org.apache.tools.ant.Target.performTasks(Target.java:385) [aspectj:iajc] at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329) [aspectj:iajc] at org.apache.tools.ant.Project.executeTarget(Project.java:1298) [aspectj:iajc] at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41) [aspectj:iajc] at org.eclipse.ant.internal.ui.antsupport.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32) [aspectj:iajc] at org.apache.tools.ant.Project.executeTargets(Project.java:1181) [aspectj:iajc] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:423) [aspectj:iajc] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:137) [aspectj:iajc] May 11, 2008 9:35:06 AM org.aspectj.weaver.tools.Jdk14Trace info [aspectj:iajc] INFO: Dumping to C:\Development\PI\Projects\PI-ServiceCommon\.\ajcore.20080511.093506.214.txt [aspectj:iajc] MessageHolder: (92 info) (1 error) (1 abort) [aspectj:iajc] [error 0]: error at (no source information available) [aspectj:iajc] C:\Development\PI\JavaSrc\com\centricsoftware\pi\service\expression\FuncNewMatrix.java:0::0 Internal compiler error [aspectj:iajc] java.lang.ArrayIndexOutOfBoundsException: 1 [aspectj:iajc] at org.aspectj.weaver.ResolvedType.getMemberParameterizationMap(ResolvedType.java:744) [aspectj:iajc] at org.aspectj.weaver.ReferenceType.getDeclaredInterfaces(ReferenceType.java:411) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.getDirectSupertypes(ResolvedType.java:68) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.collectInterTypeMungers(ResolvedType.java:1206) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.collectInterTypeMungers(ResolvedType.java:1211) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.collectInterTypeMungers(ResolvedType.java:1211) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.getInterTypeMungersIncludingSupers(ResolvedType.java:1185) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.checkInterTypeMungers(ResolvedType.java:1255) [aspectj:iajc] at org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment.weaveInterTypeDeclarations(AjLookupEnvironment.java:646) [aspectj:iajc] at org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment.weaveInterTypeDeclarations(AjLookupEnvironment.java:522) [aspectj:iajc] at org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment.createBinaryTypeFrom(AjLookupEnvironment.java:1105) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.createBinaryTypeFrom(LookupEnvironment.java:599) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.accept(Compiler.java:276) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.askForType(LookupEnvironment.java:113) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.UnresolvedReferenceBinding.resolve(UnresolvedReferenceBinding.java:49) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.resolveType(BinaryTypeBinding.java:99) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.getMemberType(BinaryTypeBinding.java:755) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.Scope.findMemberType(Scope.java:986) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.Scope.getMemberType(Scope.java:2116) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference.findNextTypeBinding(QualifiedTypeReference.java:43) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference.getTypeBinding(QualifiedTypeReference.java:77) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeReference.resolveType(TypeReference.java:142) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.AllocationExpression.resolveType(AllocationExpression.java:258) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.LocalDeclaration.resolve(LocalDeclaration.java:196) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolveStatements(AbstractMethodDeclaration.java:433) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.MethodDeclaration.resolveStatements(MethodDeclaration.java:196) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolve(AbstractMethodDeclaration.java:404) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1109) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1188) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.resolve(CompilationUnitDeclaration.java:366) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.process(Compiler.java:625) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:392) [aspectj:iajc] at org.aspectj.ajdt.internal.core.builder.AjBuildManager.performCompilation(AjBuildManager.java:990) [aspectj:iajc] at org.aspectj.ajdt.internal.core.builder.AjBuildManager.doBuild(AjBuildManager.java:264) [aspectj:iajc] at org.aspectj.ajdt.internal.core.builder.AjBuildManager.batchBuild(AjBuildManager.java:180) [aspectj:iajc] at org.aspectj.ajdt.ajc.AjdtCommand.doCommand(AjdtCommand.java:112) [aspectj:iajc] at org.aspectj.ajdt.ajc.AjdtCommand.runCommand(AjdtCommand.java:60) [aspectj:iajc] at org.aspectj.tools.ajc.Main.run(Main.java:378) [aspectj:iajc] at org.aspectj.tools.ajc.Main.runMain(Main.java:253) [aspectj:iajc] at org.aspectj.tools.ant.taskdefs.AjcTask.executeInSameVM(AjcTask.java:1303) [aspectj:iajc] at org.aspectj.tools.ant.taskdefs.AjcTask.execute(AjcTask.java:1101) [aspectj:iajc] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288) [aspectj:iajc] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [aspectj:iajc] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [aspectj:iajc] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [aspectj:iajc] at java.lang.reflect.Method.invoke(Method.java:585) [aspectj:iajc] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105) [aspectj:iajc] at org.apache.tools.ant.Task.perform(Task.java:348) [aspectj:iajc] at org.apache.tools.ant.Target.execute(Target.java:357) [aspectj:iajc] at org.apache.tools.ant.Target.performTasks(Target.java:385) [aspectj:iajc] at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329) [aspectj:iajc] at org.apache.tools.ant.Project.executeTarget(Project.java:1298) [aspectj:iajc] at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41) [aspectj:iajc] at org.eclipse.ant.internal.ui.antsupport.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32) [aspectj:iajc] at org.apache.tools.ant.Project.executeTargets(Project.java:1181) [aspectj:iajc] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:423) [aspectj:iajc] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:137)
resolved fixed
a8739e3
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2008-05-13T19:54:27Z
2008-05-11T15:33:20Z
weaver/src/org/aspectj/weaver/TypeFactory.java
String lastType = null; int nestedTypePosition = signature.indexOf("$", endOfParams); if (nestedTypePosition!=-1) lastType = signature.substring(nestedTypePosition+1); else lastType = new String(signature); startOfParams = lastType.indexOf("<"); endOfParams = locateMatchingEndBracket(lastType,startOfParams); UnresolvedType[] typeParams = UnresolvedType.NONE; if (startOfParams!=-1) { typeParams = createTypeParams(lastType.substring(startOfParams +1, endOfParams)); } return new UnresolvedType(signature,signatureErasure,typeParams); } } else if (signature.equals("?")){ UnresolvedType ret = UnresolvedType.SOMETHING; ret.typeKind = TypeKind.WILDCARD; return ret; } else if(firstChar=='+') { UnresolvedType ret = new UnresolvedType(signature); ret.typeKind = TypeKind.WILDCARD; ret.setUpperBound(convertSigToType(signature.substring(1))); return ret; } else if (firstChar=='-') { UnresolvedType ret = new UnresolvedType(signature);
231,467
Bug 231467 Cant Compile new Statement for the Generic Class
[aspectj:iajc] error at (no source information available) [aspectj:iajc] C:\Development\PI\JavaSrc\com\centricsoftware\pi\service\expression\FuncNewMatrix.java:0::0 Internal compiler error [aspectj:iajc] java.lang.ArrayIndexOutOfBoundsException: 1 [aspectj:iajc] at org.aspectj.weaver.ResolvedType.getMemberParameterizationMap(ResolvedType.java:744) [aspectj:iajc] at org.aspectj.weaver.ReferenceType.getDeclaredInterfaces(ReferenceType.java:411) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.getDirectSupertypes(ResolvedType.java:68) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.collectInterTypeMungers(ResolvedType.java:1206) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.collectInterTypeMungers(ResolvedType.java:1211) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.collectInterTypeMungers(ResolvedType.java:1211) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.getInterTypeMungersIncludingSupers(ResolvedType.java:1185) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.checkInterTypeMungers(ResolvedType.java:1255) [aspectj:iajc] at org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment.weaveInterTypeDeclarations(AjLookupEnvironment.java:646) [aspectj:iajc] at org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment.weaveInterTypeDeclarations(AjLookupEnvironment.java:522) [aspectj:iajc] at org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment.createBinaryTypeFrom(AjLookupEnvironment.java:1105) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.createBinaryTypeFrom(LookupEnvironment.java:599) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.accept(Compiler.java:276) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.askForType(LookupEnvironment.java:113) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.UnresolvedReferenceBinding.resolve(UnresolvedReferenceBinding.java:49) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.resolveType(BinaryTypeBinding.java:99) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.getMemberType(BinaryTypeBinding.java:755) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.Scope.findMemberType(Scope.java:986) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.Scope.getMemberType(Scope.java:2116) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference.findNextTypeBinding(QualifiedTypeReference.java:43) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference.getTypeBinding(QualifiedTypeReference.java:77) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeReference.resolveType(TypeReference.java:142) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.AllocationExpression.resolveType(AllocationExpression.java:258) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.LocalDeclaration.resolve(LocalDeclaration.java:196) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolveStatements(AbstractMethodDeclaration.java:433) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.MethodDeclaration.resolveStatements(MethodDeclaration.java:196) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolve(AbstractMethodDeclaration.java:404) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1109) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1188) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.resolve(CompilationUnitDeclaration.java:366) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.process(Compiler.java:625) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:392) [aspectj:iajc] at org.aspectj.ajdt.internal.core.builder.AjBuildManager.performCompilation(AjBuildManager.java:990) [aspectj:iajc] at org.aspectj.ajdt.internal.core.builder.AjBuildManager.doBuild(AjBuildManager.java:264) [aspectj:iajc] at org.aspectj.ajdt.internal.core.builder.AjBuildManager.batchBuild(AjBuildManager.java:180) [aspectj:iajc] at org.aspectj.ajdt.ajc.AjdtCommand.doCommand(AjdtCommand.java:112) [aspectj:iajc] at org.aspectj.ajdt.ajc.AjdtCommand.runCommand(AjdtCommand.java:60) [aspectj:iajc] at org.aspectj.tools.ajc.Main.run(Main.java:378) [aspectj:iajc] at org.aspectj.tools.ajc.Main.runMain(Main.java:253) [aspectj:iajc] at org.aspectj.tools.ant.taskdefs.AjcTask.executeInSameVM(AjcTask.java:1303) [aspectj:iajc] at org.aspectj.tools.ant.taskdefs.AjcTask.execute(AjcTask.java:1101) [aspectj:iajc] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288) [aspectj:iajc] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [aspectj:iajc] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [aspectj:iajc] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [aspectj:iajc] at java.lang.reflect.Method.invoke(Method.java:585) [aspectj:iajc] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105) [aspectj:iajc] at org.apache.tools.ant.Task.perform(Task.java:348) [aspectj:iajc] at org.apache.tools.ant.Target.execute(Target.java:357) [aspectj:iajc] at org.apache.tools.ant.Target.performTasks(Target.java:385) [aspectj:iajc] at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329) [aspectj:iajc] at org.apache.tools.ant.Project.executeTarget(Project.java:1298) [aspectj:iajc] at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41) [aspectj:iajc] at org.eclipse.ant.internal.ui.antsupport.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32) [aspectj:iajc] at org.apache.tools.ant.Project.executeTargets(Project.java:1181) [aspectj:iajc] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:423) [aspectj:iajc] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:137) [aspectj:iajc] abort ABORT -- (ArrayIndexOutOfBoundsException) 1 [aspectj:iajc] 1 [aspectj:iajc] java.lang.ArrayIndexOutOfBoundsException: 1 [aspectj:iajc] at org.aspectj.weaver.ResolvedType.getMemberParameterizationMap(ResolvedType.java:744) [aspectj:iajc] at org.aspectj.weaver.ReferenceType.getDeclaredInterfaces(ReferenceType.java:411) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.getDirectSupertypes(ResolvedType.java:68) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.collectInterTypeMungers(ResolvedType.java:1206) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.collectInterTypeMungers(ResolvedType.java:1211) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.collectInterTypeMungers(ResolvedType.java:1211) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.getInterTypeMungersIncludingSupers(ResolvedType.java:1185) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.checkInterTypeMungers(ResolvedType.java:1255) [aspectj:iajc] at org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment.weaveInterTypeDeclarations(AjLookupEnvironment.java:646) [aspectj:iajc] at org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment.weaveInterTypeDeclarations(AjLookupEnvironment.java:522) [aspectj:iajc] at org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment.createBinaryTypeFrom(AjLookupEnvironment.java:1105) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.createBinaryTypeFrom(LookupEnvironment.java:599) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.accept(Compiler.java:276) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.askForType(LookupEnvironment.java:113) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.UnresolvedReferenceBinding.resolve(UnresolvedReferenceBinding.java:49) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.resolveType(BinaryTypeBinding.java:99) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.getMemberType(BinaryTypeBinding.java:755) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.Scope.findMemberType(Scope.java:986) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.Scope.getMemberType(Scope.java:2116) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference.findNextTypeBinding(QualifiedTypeReference.java:43) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference.getTypeBinding(QualifiedTypeReference.java:77) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeReference.resolveType(TypeReference.java:142) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.AllocationExpression.resolveType(AllocationExpression.java:258) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.LocalDeclaration.resolve(LocalDeclaration.java:196) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolveStatements(AbstractMethodDeclaration.java:433) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.MethodDeclaration.resolveStatements(MethodDeclaration.java:196) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolve(AbstractMethodDeclaration.java:404) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1109) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1188) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.resolve(CompilationUnitDeclaration.java:366) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.process(Compiler.java:625) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:392) [aspectj:iajc] at org.aspectj.ajdt.internal.core.builder.AjBuildManager.performCompilation(AjBuildManager.java:990) [aspectj:iajc] at org.aspectj.ajdt.internal.core.builder.AjBuildManager.doBuild(AjBuildManager.java:264) [aspectj:iajc] at org.aspectj.ajdt.internal.core.builder.AjBuildManager.batchBuild(AjBuildManager.java:180) [aspectj:iajc] at org.aspectj.ajdt.ajc.AjdtCommand.doCommand(AjdtCommand.java:112) [aspectj:iajc] at org.aspectj.ajdt.ajc.AjdtCommand.runCommand(AjdtCommand.java:60) [aspectj:iajc] at org.aspectj.tools.ajc.Main.run(Main.java:378) [aspectj:iajc] at org.aspectj.tools.ajc.Main.runMain(Main.java:253) [aspectj:iajc] at org.aspectj.tools.ant.taskdefs.AjcTask.executeInSameVM(AjcTask.java:1303) [aspectj:iajc] at org.aspectj.tools.ant.taskdefs.AjcTask.execute(AjcTask.java:1101) [aspectj:iajc] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288) [aspectj:iajc] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [aspectj:iajc] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [aspectj:iajc] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [aspectj:iajc] at java.lang.reflect.Method.invoke(Method.java:585) [aspectj:iajc] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105) [aspectj:iajc] at org.apache.tools.ant.Task.perform(Task.java:348) [aspectj:iajc] at org.apache.tools.ant.Target.execute(Target.java:357) [aspectj:iajc] at org.apache.tools.ant.Target.performTasks(Target.java:385) [aspectj:iajc] at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329) [aspectj:iajc] at org.apache.tools.ant.Project.executeTarget(Project.java:1298) [aspectj:iajc] at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41) [aspectj:iajc] at org.eclipse.ant.internal.ui.antsupport.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32) [aspectj:iajc] at org.apache.tools.ant.Project.executeTargets(Project.java:1181) [aspectj:iajc] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:423) [aspectj:iajc] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:137) [aspectj:iajc] May 11, 2008 9:35:06 AM org.aspectj.weaver.tools.Jdk14Trace info [aspectj:iajc] INFO: Dumping to C:\Development\PI\Projects\PI-ServiceCommon\.\ajcore.20080511.093506.214.txt [aspectj:iajc] MessageHolder: (92 info) (1 error) (1 abort) [aspectj:iajc] [error 0]: error at (no source information available) [aspectj:iajc] C:\Development\PI\JavaSrc\com\centricsoftware\pi\service\expression\FuncNewMatrix.java:0::0 Internal compiler error [aspectj:iajc] java.lang.ArrayIndexOutOfBoundsException: 1 [aspectj:iajc] at org.aspectj.weaver.ResolvedType.getMemberParameterizationMap(ResolvedType.java:744) [aspectj:iajc] at org.aspectj.weaver.ReferenceType.getDeclaredInterfaces(ReferenceType.java:411) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.getDirectSupertypes(ResolvedType.java:68) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.collectInterTypeMungers(ResolvedType.java:1206) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.collectInterTypeMungers(ResolvedType.java:1211) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.collectInterTypeMungers(ResolvedType.java:1211) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.getInterTypeMungersIncludingSupers(ResolvedType.java:1185) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.checkInterTypeMungers(ResolvedType.java:1255) [aspectj:iajc] at org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment.weaveInterTypeDeclarations(AjLookupEnvironment.java:646) [aspectj:iajc] at org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment.weaveInterTypeDeclarations(AjLookupEnvironment.java:522) [aspectj:iajc] at org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment.createBinaryTypeFrom(AjLookupEnvironment.java:1105) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.createBinaryTypeFrom(LookupEnvironment.java:599) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.accept(Compiler.java:276) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.askForType(LookupEnvironment.java:113) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.UnresolvedReferenceBinding.resolve(UnresolvedReferenceBinding.java:49) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.resolveType(BinaryTypeBinding.java:99) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.getMemberType(BinaryTypeBinding.java:755) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.Scope.findMemberType(Scope.java:986) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.Scope.getMemberType(Scope.java:2116) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference.findNextTypeBinding(QualifiedTypeReference.java:43) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference.getTypeBinding(QualifiedTypeReference.java:77) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeReference.resolveType(TypeReference.java:142) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.AllocationExpression.resolveType(AllocationExpression.java:258) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.LocalDeclaration.resolve(LocalDeclaration.java:196) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolveStatements(AbstractMethodDeclaration.java:433) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.MethodDeclaration.resolveStatements(MethodDeclaration.java:196) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolve(AbstractMethodDeclaration.java:404) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1109) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1188) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.resolve(CompilationUnitDeclaration.java:366) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.process(Compiler.java:625) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:392) [aspectj:iajc] at org.aspectj.ajdt.internal.core.builder.AjBuildManager.performCompilation(AjBuildManager.java:990) [aspectj:iajc] at org.aspectj.ajdt.internal.core.builder.AjBuildManager.doBuild(AjBuildManager.java:264) [aspectj:iajc] at org.aspectj.ajdt.internal.core.builder.AjBuildManager.batchBuild(AjBuildManager.java:180) [aspectj:iajc] at org.aspectj.ajdt.ajc.AjdtCommand.doCommand(AjdtCommand.java:112) [aspectj:iajc] at org.aspectj.ajdt.ajc.AjdtCommand.runCommand(AjdtCommand.java:60) [aspectj:iajc] at org.aspectj.tools.ajc.Main.run(Main.java:378) [aspectj:iajc] at org.aspectj.tools.ajc.Main.runMain(Main.java:253) [aspectj:iajc] at org.aspectj.tools.ant.taskdefs.AjcTask.executeInSameVM(AjcTask.java:1303) [aspectj:iajc] at org.aspectj.tools.ant.taskdefs.AjcTask.execute(AjcTask.java:1101) [aspectj:iajc] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288) [aspectj:iajc] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [aspectj:iajc] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [aspectj:iajc] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [aspectj:iajc] at java.lang.reflect.Method.invoke(Method.java:585) [aspectj:iajc] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105) [aspectj:iajc] at org.apache.tools.ant.Task.perform(Task.java:348) [aspectj:iajc] at org.apache.tools.ant.Target.execute(Target.java:357) [aspectj:iajc] at org.apache.tools.ant.Target.performTasks(Target.java:385) [aspectj:iajc] at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329) [aspectj:iajc] at org.apache.tools.ant.Project.executeTarget(Project.java:1298) [aspectj:iajc] at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41) [aspectj:iajc] at org.eclipse.ant.internal.ui.antsupport.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32) [aspectj:iajc] at org.apache.tools.ant.Project.executeTargets(Project.java:1181) [aspectj:iajc] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:423) [aspectj:iajc] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:137)
resolved fixed
a8739e3
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2008-05-13T19:54:27Z
2008-05-11T15:33:20Z
weaver/src/org/aspectj/weaver/TypeFactory.java
ret.typeKind = TypeKind.WILDCARD; ret.setLowerBound(convertSigToType(signature.substring(1))); return ret; } else if (firstChar=='T') { String typeVariableName = signature.substring(1); if (typeVariableName.endsWith(";")) { typeVariableName = typeVariableName.substring(0, typeVariableName.length() -1); } return new UnresolvedTypeVariableReferenceType(new TypeVariable(typeVariableName)); } else if (firstChar=='[') { int dims = 0; while (signature.charAt(dims)=='[') dims++; UnresolvedType componentType = createTypeFromSignature(signature.substring(dims)); return new UnresolvedType(signature, signature.substring(0,dims)+componentType.getErasureSignature()); } else if (signature.length()==1) { switch (firstChar) { case 'V': return ResolvedType.VOID; case 'Z': return ResolvedType.BOOLEAN; case 'B': return ResolvedType.BYTE; case 'C': return ResolvedType.CHAR; case 'D': return ResolvedType.DOUBLE; case 'F': return ResolvedType.FLOAT; case 'I': return ResolvedType.INT; case 'J': return ResolvedType.LONG; case 'S': return ResolvedType.SHORT; } } return new UnresolvedType(signature); }
231,467
Bug 231467 Cant Compile new Statement for the Generic Class
[aspectj:iajc] error at (no source information available) [aspectj:iajc] C:\Development\PI\JavaSrc\com\centricsoftware\pi\service\expression\FuncNewMatrix.java:0::0 Internal compiler error [aspectj:iajc] java.lang.ArrayIndexOutOfBoundsException: 1 [aspectj:iajc] at org.aspectj.weaver.ResolvedType.getMemberParameterizationMap(ResolvedType.java:744) [aspectj:iajc] at org.aspectj.weaver.ReferenceType.getDeclaredInterfaces(ReferenceType.java:411) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.getDirectSupertypes(ResolvedType.java:68) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.collectInterTypeMungers(ResolvedType.java:1206) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.collectInterTypeMungers(ResolvedType.java:1211) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.collectInterTypeMungers(ResolvedType.java:1211) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.getInterTypeMungersIncludingSupers(ResolvedType.java:1185) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.checkInterTypeMungers(ResolvedType.java:1255) [aspectj:iajc] at org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment.weaveInterTypeDeclarations(AjLookupEnvironment.java:646) [aspectj:iajc] at org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment.weaveInterTypeDeclarations(AjLookupEnvironment.java:522) [aspectj:iajc] at org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment.createBinaryTypeFrom(AjLookupEnvironment.java:1105) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.createBinaryTypeFrom(LookupEnvironment.java:599) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.accept(Compiler.java:276) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.askForType(LookupEnvironment.java:113) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.UnresolvedReferenceBinding.resolve(UnresolvedReferenceBinding.java:49) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.resolveType(BinaryTypeBinding.java:99) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.getMemberType(BinaryTypeBinding.java:755) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.Scope.findMemberType(Scope.java:986) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.Scope.getMemberType(Scope.java:2116) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference.findNextTypeBinding(QualifiedTypeReference.java:43) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference.getTypeBinding(QualifiedTypeReference.java:77) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeReference.resolveType(TypeReference.java:142) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.AllocationExpression.resolveType(AllocationExpression.java:258) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.LocalDeclaration.resolve(LocalDeclaration.java:196) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolveStatements(AbstractMethodDeclaration.java:433) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.MethodDeclaration.resolveStatements(MethodDeclaration.java:196) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolve(AbstractMethodDeclaration.java:404) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1109) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1188) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.resolve(CompilationUnitDeclaration.java:366) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.process(Compiler.java:625) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:392) [aspectj:iajc] at org.aspectj.ajdt.internal.core.builder.AjBuildManager.performCompilation(AjBuildManager.java:990) [aspectj:iajc] at org.aspectj.ajdt.internal.core.builder.AjBuildManager.doBuild(AjBuildManager.java:264) [aspectj:iajc] at org.aspectj.ajdt.internal.core.builder.AjBuildManager.batchBuild(AjBuildManager.java:180) [aspectj:iajc] at org.aspectj.ajdt.ajc.AjdtCommand.doCommand(AjdtCommand.java:112) [aspectj:iajc] at org.aspectj.ajdt.ajc.AjdtCommand.runCommand(AjdtCommand.java:60) [aspectj:iajc] at org.aspectj.tools.ajc.Main.run(Main.java:378) [aspectj:iajc] at org.aspectj.tools.ajc.Main.runMain(Main.java:253) [aspectj:iajc] at org.aspectj.tools.ant.taskdefs.AjcTask.executeInSameVM(AjcTask.java:1303) [aspectj:iajc] at org.aspectj.tools.ant.taskdefs.AjcTask.execute(AjcTask.java:1101) [aspectj:iajc] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288) [aspectj:iajc] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [aspectj:iajc] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [aspectj:iajc] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [aspectj:iajc] at java.lang.reflect.Method.invoke(Method.java:585) [aspectj:iajc] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105) [aspectj:iajc] at org.apache.tools.ant.Task.perform(Task.java:348) [aspectj:iajc] at org.apache.tools.ant.Target.execute(Target.java:357) [aspectj:iajc] at org.apache.tools.ant.Target.performTasks(Target.java:385) [aspectj:iajc] at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329) [aspectj:iajc] at org.apache.tools.ant.Project.executeTarget(Project.java:1298) [aspectj:iajc] at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41) [aspectj:iajc] at org.eclipse.ant.internal.ui.antsupport.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32) [aspectj:iajc] at org.apache.tools.ant.Project.executeTargets(Project.java:1181) [aspectj:iajc] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:423) [aspectj:iajc] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:137) [aspectj:iajc] abort ABORT -- (ArrayIndexOutOfBoundsException) 1 [aspectj:iajc] 1 [aspectj:iajc] java.lang.ArrayIndexOutOfBoundsException: 1 [aspectj:iajc] at org.aspectj.weaver.ResolvedType.getMemberParameterizationMap(ResolvedType.java:744) [aspectj:iajc] at org.aspectj.weaver.ReferenceType.getDeclaredInterfaces(ReferenceType.java:411) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.getDirectSupertypes(ResolvedType.java:68) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.collectInterTypeMungers(ResolvedType.java:1206) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.collectInterTypeMungers(ResolvedType.java:1211) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.collectInterTypeMungers(ResolvedType.java:1211) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.getInterTypeMungersIncludingSupers(ResolvedType.java:1185) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.checkInterTypeMungers(ResolvedType.java:1255) [aspectj:iajc] at org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment.weaveInterTypeDeclarations(AjLookupEnvironment.java:646) [aspectj:iajc] at org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment.weaveInterTypeDeclarations(AjLookupEnvironment.java:522) [aspectj:iajc] at org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment.createBinaryTypeFrom(AjLookupEnvironment.java:1105) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.createBinaryTypeFrom(LookupEnvironment.java:599) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.accept(Compiler.java:276) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.askForType(LookupEnvironment.java:113) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.UnresolvedReferenceBinding.resolve(UnresolvedReferenceBinding.java:49) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.resolveType(BinaryTypeBinding.java:99) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.getMemberType(BinaryTypeBinding.java:755) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.Scope.findMemberType(Scope.java:986) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.Scope.getMemberType(Scope.java:2116) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference.findNextTypeBinding(QualifiedTypeReference.java:43) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference.getTypeBinding(QualifiedTypeReference.java:77) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeReference.resolveType(TypeReference.java:142) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.AllocationExpression.resolveType(AllocationExpression.java:258) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.LocalDeclaration.resolve(LocalDeclaration.java:196) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolveStatements(AbstractMethodDeclaration.java:433) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.MethodDeclaration.resolveStatements(MethodDeclaration.java:196) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolve(AbstractMethodDeclaration.java:404) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1109) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1188) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.resolve(CompilationUnitDeclaration.java:366) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.process(Compiler.java:625) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:392) [aspectj:iajc] at org.aspectj.ajdt.internal.core.builder.AjBuildManager.performCompilation(AjBuildManager.java:990) [aspectj:iajc] at org.aspectj.ajdt.internal.core.builder.AjBuildManager.doBuild(AjBuildManager.java:264) [aspectj:iajc] at org.aspectj.ajdt.internal.core.builder.AjBuildManager.batchBuild(AjBuildManager.java:180) [aspectj:iajc] at org.aspectj.ajdt.ajc.AjdtCommand.doCommand(AjdtCommand.java:112) [aspectj:iajc] at org.aspectj.ajdt.ajc.AjdtCommand.runCommand(AjdtCommand.java:60) [aspectj:iajc] at org.aspectj.tools.ajc.Main.run(Main.java:378) [aspectj:iajc] at org.aspectj.tools.ajc.Main.runMain(Main.java:253) [aspectj:iajc] at org.aspectj.tools.ant.taskdefs.AjcTask.executeInSameVM(AjcTask.java:1303) [aspectj:iajc] at org.aspectj.tools.ant.taskdefs.AjcTask.execute(AjcTask.java:1101) [aspectj:iajc] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288) [aspectj:iajc] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [aspectj:iajc] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [aspectj:iajc] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [aspectj:iajc] at java.lang.reflect.Method.invoke(Method.java:585) [aspectj:iajc] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105) [aspectj:iajc] at org.apache.tools.ant.Task.perform(Task.java:348) [aspectj:iajc] at org.apache.tools.ant.Target.execute(Target.java:357) [aspectj:iajc] at org.apache.tools.ant.Target.performTasks(Target.java:385) [aspectj:iajc] at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329) [aspectj:iajc] at org.apache.tools.ant.Project.executeTarget(Project.java:1298) [aspectj:iajc] at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41) [aspectj:iajc] at org.eclipse.ant.internal.ui.antsupport.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32) [aspectj:iajc] at org.apache.tools.ant.Project.executeTargets(Project.java:1181) [aspectj:iajc] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:423) [aspectj:iajc] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:137) [aspectj:iajc] May 11, 2008 9:35:06 AM org.aspectj.weaver.tools.Jdk14Trace info [aspectj:iajc] INFO: Dumping to C:\Development\PI\Projects\PI-ServiceCommon\.\ajcore.20080511.093506.214.txt [aspectj:iajc] MessageHolder: (92 info) (1 error) (1 abort) [aspectj:iajc] [error 0]: error at (no source information available) [aspectj:iajc] C:\Development\PI\JavaSrc\com\centricsoftware\pi\service\expression\FuncNewMatrix.java:0::0 Internal compiler error [aspectj:iajc] java.lang.ArrayIndexOutOfBoundsException: 1 [aspectj:iajc] at org.aspectj.weaver.ResolvedType.getMemberParameterizationMap(ResolvedType.java:744) [aspectj:iajc] at org.aspectj.weaver.ReferenceType.getDeclaredInterfaces(ReferenceType.java:411) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.getDirectSupertypes(ResolvedType.java:68) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.collectInterTypeMungers(ResolvedType.java:1206) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.collectInterTypeMungers(ResolvedType.java:1211) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.collectInterTypeMungers(ResolvedType.java:1211) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.getInterTypeMungersIncludingSupers(ResolvedType.java:1185) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.checkInterTypeMungers(ResolvedType.java:1255) [aspectj:iajc] at org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment.weaveInterTypeDeclarations(AjLookupEnvironment.java:646) [aspectj:iajc] at org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment.weaveInterTypeDeclarations(AjLookupEnvironment.java:522) [aspectj:iajc] at org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment.createBinaryTypeFrom(AjLookupEnvironment.java:1105) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.createBinaryTypeFrom(LookupEnvironment.java:599) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.accept(Compiler.java:276) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.askForType(LookupEnvironment.java:113) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.UnresolvedReferenceBinding.resolve(UnresolvedReferenceBinding.java:49) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.resolveType(BinaryTypeBinding.java:99) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.getMemberType(BinaryTypeBinding.java:755) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.Scope.findMemberType(Scope.java:986) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.Scope.getMemberType(Scope.java:2116) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference.findNextTypeBinding(QualifiedTypeReference.java:43) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference.getTypeBinding(QualifiedTypeReference.java:77) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeReference.resolveType(TypeReference.java:142) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.AllocationExpression.resolveType(AllocationExpression.java:258) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.LocalDeclaration.resolve(LocalDeclaration.java:196) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolveStatements(AbstractMethodDeclaration.java:433) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.MethodDeclaration.resolveStatements(MethodDeclaration.java:196) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolve(AbstractMethodDeclaration.java:404) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1109) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1188) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.resolve(CompilationUnitDeclaration.java:366) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.process(Compiler.java:625) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:392) [aspectj:iajc] at org.aspectj.ajdt.internal.core.builder.AjBuildManager.performCompilation(AjBuildManager.java:990) [aspectj:iajc] at org.aspectj.ajdt.internal.core.builder.AjBuildManager.doBuild(AjBuildManager.java:264) [aspectj:iajc] at org.aspectj.ajdt.internal.core.builder.AjBuildManager.batchBuild(AjBuildManager.java:180) [aspectj:iajc] at org.aspectj.ajdt.ajc.AjdtCommand.doCommand(AjdtCommand.java:112) [aspectj:iajc] at org.aspectj.ajdt.ajc.AjdtCommand.runCommand(AjdtCommand.java:60) [aspectj:iajc] at org.aspectj.tools.ajc.Main.run(Main.java:378) [aspectj:iajc] at org.aspectj.tools.ajc.Main.runMain(Main.java:253) [aspectj:iajc] at org.aspectj.tools.ant.taskdefs.AjcTask.executeInSameVM(AjcTask.java:1303) [aspectj:iajc] at org.aspectj.tools.ant.taskdefs.AjcTask.execute(AjcTask.java:1101) [aspectj:iajc] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288) [aspectj:iajc] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [aspectj:iajc] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [aspectj:iajc] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [aspectj:iajc] at java.lang.reflect.Method.invoke(Method.java:585) [aspectj:iajc] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105) [aspectj:iajc] at org.apache.tools.ant.Task.perform(Task.java:348) [aspectj:iajc] at org.apache.tools.ant.Target.execute(Target.java:357) [aspectj:iajc] at org.apache.tools.ant.Target.performTasks(Target.java:385) [aspectj:iajc] at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329) [aspectj:iajc] at org.apache.tools.ant.Project.executeTarget(Project.java:1298) [aspectj:iajc] at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41) [aspectj:iajc] at org.eclipse.ant.internal.ui.antsupport.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32) [aspectj:iajc] at org.apache.tools.ant.Project.executeTargets(Project.java:1181) [aspectj:iajc] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:423) [aspectj:iajc] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:137)
resolved fixed
a8739e3
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2008-05-13T19:54:27Z
2008-05-11T15:33:20Z
weaver/src/org/aspectj/weaver/TypeFactory.java
private static int locateMatchingEndBracket(String signature, int startOfParams) { if (startOfParams==-1) return -1; int count =1; int idx = startOfParams; while (count>0 && idx<signature.length()) { idx++; if (signature.charAt(idx)=='<') count++; if (signature.charAt(idx)=='>') count--; } return idx; } private static int locateMatchingEndBracket(StringBuffer signature, int startOfParams) { if (startOfParams==-1) return -1; int count =1; int idx = startOfParams; while (count>0 && idx<signature.length()) { idx++; if (signature.charAt(idx)=='<') count++; if (signature.charAt(idx)=='>') count--; } return idx; } private static int locateFirstBracket(StringBuffer signature) { int idx = 0; while (idx<signature.length()) { if (signature.charAt(idx)=='<') return idx; idx++; }
231,467
Bug 231467 Cant Compile new Statement for the Generic Class
[aspectj:iajc] error at (no source information available) [aspectj:iajc] C:\Development\PI\JavaSrc\com\centricsoftware\pi\service\expression\FuncNewMatrix.java:0::0 Internal compiler error [aspectj:iajc] java.lang.ArrayIndexOutOfBoundsException: 1 [aspectj:iajc] at org.aspectj.weaver.ResolvedType.getMemberParameterizationMap(ResolvedType.java:744) [aspectj:iajc] at org.aspectj.weaver.ReferenceType.getDeclaredInterfaces(ReferenceType.java:411) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.getDirectSupertypes(ResolvedType.java:68) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.collectInterTypeMungers(ResolvedType.java:1206) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.collectInterTypeMungers(ResolvedType.java:1211) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.collectInterTypeMungers(ResolvedType.java:1211) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.getInterTypeMungersIncludingSupers(ResolvedType.java:1185) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.checkInterTypeMungers(ResolvedType.java:1255) [aspectj:iajc] at org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment.weaveInterTypeDeclarations(AjLookupEnvironment.java:646) [aspectj:iajc] at org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment.weaveInterTypeDeclarations(AjLookupEnvironment.java:522) [aspectj:iajc] at org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment.createBinaryTypeFrom(AjLookupEnvironment.java:1105) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.createBinaryTypeFrom(LookupEnvironment.java:599) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.accept(Compiler.java:276) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.askForType(LookupEnvironment.java:113) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.UnresolvedReferenceBinding.resolve(UnresolvedReferenceBinding.java:49) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.resolveType(BinaryTypeBinding.java:99) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.getMemberType(BinaryTypeBinding.java:755) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.Scope.findMemberType(Scope.java:986) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.Scope.getMemberType(Scope.java:2116) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference.findNextTypeBinding(QualifiedTypeReference.java:43) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference.getTypeBinding(QualifiedTypeReference.java:77) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeReference.resolveType(TypeReference.java:142) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.AllocationExpression.resolveType(AllocationExpression.java:258) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.LocalDeclaration.resolve(LocalDeclaration.java:196) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolveStatements(AbstractMethodDeclaration.java:433) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.MethodDeclaration.resolveStatements(MethodDeclaration.java:196) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolve(AbstractMethodDeclaration.java:404) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1109) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1188) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.resolve(CompilationUnitDeclaration.java:366) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.process(Compiler.java:625) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:392) [aspectj:iajc] at org.aspectj.ajdt.internal.core.builder.AjBuildManager.performCompilation(AjBuildManager.java:990) [aspectj:iajc] at org.aspectj.ajdt.internal.core.builder.AjBuildManager.doBuild(AjBuildManager.java:264) [aspectj:iajc] at org.aspectj.ajdt.internal.core.builder.AjBuildManager.batchBuild(AjBuildManager.java:180) [aspectj:iajc] at org.aspectj.ajdt.ajc.AjdtCommand.doCommand(AjdtCommand.java:112) [aspectj:iajc] at org.aspectj.ajdt.ajc.AjdtCommand.runCommand(AjdtCommand.java:60) [aspectj:iajc] at org.aspectj.tools.ajc.Main.run(Main.java:378) [aspectj:iajc] at org.aspectj.tools.ajc.Main.runMain(Main.java:253) [aspectj:iajc] at org.aspectj.tools.ant.taskdefs.AjcTask.executeInSameVM(AjcTask.java:1303) [aspectj:iajc] at org.aspectj.tools.ant.taskdefs.AjcTask.execute(AjcTask.java:1101) [aspectj:iajc] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288) [aspectj:iajc] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [aspectj:iajc] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [aspectj:iajc] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [aspectj:iajc] at java.lang.reflect.Method.invoke(Method.java:585) [aspectj:iajc] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105) [aspectj:iajc] at org.apache.tools.ant.Task.perform(Task.java:348) [aspectj:iajc] at org.apache.tools.ant.Target.execute(Target.java:357) [aspectj:iajc] at org.apache.tools.ant.Target.performTasks(Target.java:385) [aspectj:iajc] at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329) [aspectj:iajc] at org.apache.tools.ant.Project.executeTarget(Project.java:1298) [aspectj:iajc] at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41) [aspectj:iajc] at org.eclipse.ant.internal.ui.antsupport.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32) [aspectj:iajc] at org.apache.tools.ant.Project.executeTargets(Project.java:1181) [aspectj:iajc] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:423) [aspectj:iajc] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:137) [aspectj:iajc] abort ABORT -- (ArrayIndexOutOfBoundsException) 1 [aspectj:iajc] 1 [aspectj:iajc] java.lang.ArrayIndexOutOfBoundsException: 1 [aspectj:iajc] at org.aspectj.weaver.ResolvedType.getMemberParameterizationMap(ResolvedType.java:744) [aspectj:iajc] at org.aspectj.weaver.ReferenceType.getDeclaredInterfaces(ReferenceType.java:411) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.getDirectSupertypes(ResolvedType.java:68) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.collectInterTypeMungers(ResolvedType.java:1206) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.collectInterTypeMungers(ResolvedType.java:1211) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.collectInterTypeMungers(ResolvedType.java:1211) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.getInterTypeMungersIncludingSupers(ResolvedType.java:1185) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.checkInterTypeMungers(ResolvedType.java:1255) [aspectj:iajc] at org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment.weaveInterTypeDeclarations(AjLookupEnvironment.java:646) [aspectj:iajc] at org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment.weaveInterTypeDeclarations(AjLookupEnvironment.java:522) [aspectj:iajc] at org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment.createBinaryTypeFrom(AjLookupEnvironment.java:1105) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.createBinaryTypeFrom(LookupEnvironment.java:599) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.accept(Compiler.java:276) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.askForType(LookupEnvironment.java:113) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.UnresolvedReferenceBinding.resolve(UnresolvedReferenceBinding.java:49) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.resolveType(BinaryTypeBinding.java:99) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.getMemberType(BinaryTypeBinding.java:755) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.Scope.findMemberType(Scope.java:986) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.Scope.getMemberType(Scope.java:2116) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference.findNextTypeBinding(QualifiedTypeReference.java:43) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference.getTypeBinding(QualifiedTypeReference.java:77) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeReference.resolveType(TypeReference.java:142) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.AllocationExpression.resolveType(AllocationExpression.java:258) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.LocalDeclaration.resolve(LocalDeclaration.java:196) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolveStatements(AbstractMethodDeclaration.java:433) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.MethodDeclaration.resolveStatements(MethodDeclaration.java:196) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolve(AbstractMethodDeclaration.java:404) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1109) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1188) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.resolve(CompilationUnitDeclaration.java:366) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.process(Compiler.java:625) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:392) [aspectj:iajc] at org.aspectj.ajdt.internal.core.builder.AjBuildManager.performCompilation(AjBuildManager.java:990) [aspectj:iajc] at org.aspectj.ajdt.internal.core.builder.AjBuildManager.doBuild(AjBuildManager.java:264) [aspectj:iajc] at org.aspectj.ajdt.internal.core.builder.AjBuildManager.batchBuild(AjBuildManager.java:180) [aspectj:iajc] at org.aspectj.ajdt.ajc.AjdtCommand.doCommand(AjdtCommand.java:112) [aspectj:iajc] at org.aspectj.ajdt.ajc.AjdtCommand.runCommand(AjdtCommand.java:60) [aspectj:iajc] at org.aspectj.tools.ajc.Main.run(Main.java:378) [aspectj:iajc] at org.aspectj.tools.ajc.Main.runMain(Main.java:253) [aspectj:iajc] at org.aspectj.tools.ant.taskdefs.AjcTask.executeInSameVM(AjcTask.java:1303) [aspectj:iajc] at org.aspectj.tools.ant.taskdefs.AjcTask.execute(AjcTask.java:1101) [aspectj:iajc] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288) [aspectj:iajc] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [aspectj:iajc] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [aspectj:iajc] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [aspectj:iajc] at java.lang.reflect.Method.invoke(Method.java:585) [aspectj:iajc] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105) [aspectj:iajc] at org.apache.tools.ant.Task.perform(Task.java:348) [aspectj:iajc] at org.apache.tools.ant.Target.execute(Target.java:357) [aspectj:iajc] at org.apache.tools.ant.Target.performTasks(Target.java:385) [aspectj:iajc] at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329) [aspectj:iajc] at org.apache.tools.ant.Project.executeTarget(Project.java:1298) [aspectj:iajc] at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41) [aspectj:iajc] at org.eclipse.ant.internal.ui.antsupport.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32) [aspectj:iajc] at org.apache.tools.ant.Project.executeTargets(Project.java:1181) [aspectj:iajc] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:423) [aspectj:iajc] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:137) [aspectj:iajc] May 11, 2008 9:35:06 AM org.aspectj.weaver.tools.Jdk14Trace info [aspectj:iajc] INFO: Dumping to C:\Development\PI\Projects\PI-ServiceCommon\.\ajcore.20080511.093506.214.txt [aspectj:iajc] MessageHolder: (92 info) (1 error) (1 abort) [aspectj:iajc] [error 0]: error at (no source information available) [aspectj:iajc] C:\Development\PI\JavaSrc\com\centricsoftware\pi\service\expression\FuncNewMatrix.java:0::0 Internal compiler error [aspectj:iajc] java.lang.ArrayIndexOutOfBoundsException: 1 [aspectj:iajc] at org.aspectj.weaver.ResolvedType.getMemberParameterizationMap(ResolvedType.java:744) [aspectj:iajc] at org.aspectj.weaver.ReferenceType.getDeclaredInterfaces(ReferenceType.java:411) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.getDirectSupertypes(ResolvedType.java:68) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.collectInterTypeMungers(ResolvedType.java:1206) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.collectInterTypeMungers(ResolvedType.java:1211) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.collectInterTypeMungers(ResolvedType.java:1211) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.getInterTypeMungersIncludingSupers(ResolvedType.java:1185) [aspectj:iajc] at org.aspectj.weaver.ResolvedType.checkInterTypeMungers(ResolvedType.java:1255) [aspectj:iajc] at org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment.weaveInterTypeDeclarations(AjLookupEnvironment.java:646) [aspectj:iajc] at org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment.weaveInterTypeDeclarations(AjLookupEnvironment.java:522) [aspectj:iajc] at org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment.createBinaryTypeFrom(AjLookupEnvironment.java:1105) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.createBinaryTypeFrom(LookupEnvironment.java:599) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.accept(Compiler.java:276) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.askForType(LookupEnvironment.java:113) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.UnresolvedReferenceBinding.resolve(UnresolvedReferenceBinding.java:49) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.resolveType(BinaryTypeBinding.java:99) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.getMemberType(BinaryTypeBinding.java:755) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.Scope.findMemberType(Scope.java:986) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.Scope.getMemberType(Scope.java:2116) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference.findNextTypeBinding(QualifiedTypeReference.java:43) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference.getTypeBinding(QualifiedTypeReference.java:77) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeReference.resolveType(TypeReference.java:142) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.AllocationExpression.resolveType(AllocationExpression.java:258) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.LocalDeclaration.resolve(LocalDeclaration.java:196) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolveStatements(AbstractMethodDeclaration.java:433) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.MethodDeclaration.resolveStatements(MethodDeclaration.java:196) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolve(AbstractMethodDeclaration.java:404) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1109) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1188) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.resolve(CompilationUnitDeclaration.java:366) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.process(Compiler.java:625) [aspectj:iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:392) [aspectj:iajc] at org.aspectj.ajdt.internal.core.builder.AjBuildManager.performCompilation(AjBuildManager.java:990) [aspectj:iajc] at org.aspectj.ajdt.internal.core.builder.AjBuildManager.doBuild(AjBuildManager.java:264) [aspectj:iajc] at org.aspectj.ajdt.internal.core.builder.AjBuildManager.batchBuild(AjBuildManager.java:180) [aspectj:iajc] at org.aspectj.ajdt.ajc.AjdtCommand.doCommand(AjdtCommand.java:112) [aspectj:iajc] at org.aspectj.ajdt.ajc.AjdtCommand.runCommand(AjdtCommand.java:60) [aspectj:iajc] at org.aspectj.tools.ajc.Main.run(Main.java:378) [aspectj:iajc] at org.aspectj.tools.ajc.Main.runMain(Main.java:253) [aspectj:iajc] at org.aspectj.tools.ant.taskdefs.AjcTask.executeInSameVM(AjcTask.java:1303) [aspectj:iajc] at org.aspectj.tools.ant.taskdefs.AjcTask.execute(AjcTask.java:1101) [aspectj:iajc] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288) [aspectj:iajc] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [aspectj:iajc] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [aspectj:iajc] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [aspectj:iajc] at java.lang.reflect.Method.invoke(Method.java:585) [aspectj:iajc] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105) [aspectj:iajc] at org.apache.tools.ant.Task.perform(Task.java:348) [aspectj:iajc] at org.apache.tools.ant.Target.execute(Target.java:357) [aspectj:iajc] at org.apache.tools.ant.Target.performTasks(Target.java:385) [aspectj:iajc] at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329) [aspectj:iajc] at org.apache.tools.ant.Project.executeTarget(Project.java:1298) [aspectj:iajc] at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41) [aspectj:iajc] at org.eclipse.ant.internal.ui.antsupport.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32) [aspectj:iajc] at org.apache.tools.ant.Project.executeTargets(Project.java:1181) [aspectj:iajc] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:423) [aspectj:iajc] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:137)
resolved fixed
a8739e3
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2008-05-13T19:54:27Z
2008-05-11T15:33:20Z
weaver/src/org/aspectj/weaver/TypeFactory.java
return -1; } private static UnresolvedType[] createTypeParams(String typeParameterSpecification) { String remainingToProcess = typeParameterSpecification; List types = new ArrayList(); while(!remainingToProcess.equals("")) { int endOfSig = 0; int anglies = 0; boolean sigFound = false; for (endOfSig = 0; (endOfSig < remainingToProcess.length()) && !sigFound; endOfSig++) { char thisChar = remainingToProcess.charAt(endOfSig); switch(thisChar) { case '<' : anglies++; break; case '>' : anglies--; break; case ';' : if (anglies == 0) { sigFound = true; break; } } } types.add(createTypeFromSignature(remainingToProcess.substring(0,endOfSig))); remainingToProcess = remainingToProcess.substring(endOfSig); } UnresolvedType[] typeParams = new UnresolvedType[types.size()]; types.toArray(typeParams); return typeParams; } }
232,712
Bug 232712 ClassFormatError during LTW using annotation approach
The following exception is obtained when using the annotation approach and load-time weaving: [AppClassLoader@1f12c4e] info AspectJ Weaver Version 1.5.4 built on Thursday Dec 20, 2007 at 13:44:10 GMT [AppClassLoader@1f12c4e] info register classloader sun.misc.Launcher$AppClassLoader@1f12c4e [AppClassLoader@1f12c4e] info using configuration /H:/temp/aspectj_bug/scratch/classes/scratch/aop/annotationbug/aspect/aop-bug.xml [AppClassLoader@1f12c4e] info register aspect scratch.aop.annotationbug.aspect.BugAspect doSomething() Exception in thread "main" java.lang.ClassFormatError: Code attribute in native or abstract methods in class file scratch/aop/annotationbug/extra/SubClass at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:620) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124) at java.net.URLClassLoader.defineClass(URLClassLoader.java:260) at java.net.URLClassLoader.access$000(URLClassLoader.java:56) at java.net.URLClassLoader$1.run(URLClassLoader.java:195) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276) at java.lang.ClassLoader.loadClass(ClassLoader.java:251) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319) at scratch.aop.annotationbug.extra.BugOther.getSubClass(BugOther.java:22) at scratch.aop.annotationbug.main.BugMain.somethingElse(BugMain.java:36) at scratch.aop.annotationbug.main.BugMain.doSomething(BugMain.java:30) at scratch.aop.annotationbug.main.BugMain.execute(BugMain.java:24) at scratch.aop.annotationbug.main.BugDriver.doExecute(BugDriver.java:27) at scratch.aop.annotationbug.main.BugDriver.main(BugDriver.java:21) The same advice logic does not result in a ClassFormatError when using the Aspect approach, it only appears using the annotation approach. Unfortunately we have not been able to track down exactly why the above Error occurs but have attached a test case that manifests it. To run simply use the runtime configuration on the BugDriver main(): -Dorg.aspectj.weaver.loadtime.configuration="scratch/aop/annotationbug/aspect/aop-bug.xml" Along with the AspectJ Load-Time Weaver Agent. The above occurs with both AspectJ 1.5.4 and AspectJ 1.6.0. Interestingly when using the aspectj 1.6.0 weaver, the AppClassLoader log still indicates "1.5.4".
resolved fixed
f014275
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2008-05-20T18:30:38Z
2008-05-18T22:33:20Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
/* ******************************************************************* * Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC). * All rights reserved. * This program and the accompanying materials are made available * under the terms of the Eclipse Public License v1.0 * which accompanies this distribution and is available at * http:www.eclipse.org/legal/epl-v10.html * * Contributors: * PARC initial implementation
232,712
Bug 232712 ClassFormatError during LTW using annotation approach
The following exception is obtained when using the annotation approach and load-time weaving: [AppClassLoader@1f12c4e] info AspectJ Weaver Version 1.5.4 built on Thursday Dec 20, 2007 at 13:44:10 GMT [AppClassLoader@1f12c4e] info register classloader sun.misc.Launcher$AppClassLoader@1f12c4e [AppClassLoader@1f12c4e] info using configuration /H:/temp/aspectj_bug/scratch/classes/scratch/aop/annotationbug/aspect/aop-bug.xml [AppClassLoader@1f12c4e] info register aspect scratch.aop.annotationbug.aspect.BugAspect doSomething() Exception in thread "main" java.lang.ClassFormatError: Code attribute in native or abstract methods in class file scratch/aop/annotationbug/extra/SubClass at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:620) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124) at java.net.URLClassLoader.defineClass(URLClassLoader.java:260) at java.net.URLClassLoader.access$000(URLClassLoader.java:56) at java.net.URLClassLoader$1.run(URLClassLoader.java:195) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276) at java.lang.ClassLoader.loadClass(ClassLoader.java:251) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319) at scratch.aop.annotationbug.extra.BugOther.getSubClass(BugOther.java:22) at scratch.aop.annotationbug.main.BugMain.somethingElse(BugMain.java:36) at scratch.aop.annotationbug.main.BugMain.doSomething(BugMain.java:30) at scratch.aop.annotationbug.main.BugMain.execute(BugMain.java:24) at scratch.aop.annotationbug.main.BugDriver.doExecute(BugDriver.java:27) at scratch.aop.annotationbug.main.BugDriver.main(BugDriver.java:21) The same advice logic does not result in a ClassFormatError when using the Aspect approach, it only appears using the annotation approach. Unfortunately we have not been able to track down exactly why the above Error occurs but have attached a test case that manifests it. To run simply use the runtime configuration on the BugDriver main(): -Dorg.aspectj.weaver.loadtime.configuration="scratch/aop/annotationbug/aspect/aop-bug.xml" Along with the AspectJ Load-Time Weaver Agent. The above occurs with both AspectJ 1.5.4 and AspectJ 1.6.0. Interestingly when using the aspectj 1.6.0 weaver, the AppClassLoader log still indicates "1.5.4".
resolved fixed
f014275
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2008-05-20T18:30:38Z
2008-05-18T22:33:20Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
* ******************************************************************/ package org.aspectj.weaver.bcel; import java.lang.reflect.Modifier; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Properties; import java.util.Set; import org.aspectj.apache.bcel.Constants; import org.aspectj.apache.bcel.classfile.Field; import org.aspectj.apache.bcel.classfile.Method; import org.aspectj.apache.bcel.classfile.annotation.Annotation; import org.aspectj.apache.bcel.generic.ANEWARRAY; import org.aspectj.apache.bcel.generic.BranchInstruction; import org.aspectj.apache.bcel.generic.CPInstruction; import org.aspectj.apache.bcel.generic.ConstantPoolGen; import org.aspectj.apache.bcel.generic.FieldGen; import org.aspectj.apache.bcel.generic.FieldInstruction; import org.aspectj.apache.bcel.generic.GOTO; import org.aspectj.apache.bcel.generic.GOTO_W; import org.aspectj.apache.bcel.generic.INVOKESPECIAL; import org.aspectj.apache.bcel.generic.IndexedInstruction; import org.aspectj.apache.bcel.generic.Instruction; import org.aspectj.apache.bcel.generic.InstructionConstants;
232,712
Bug 232712 ClassFormatError during LTW using annotation approach
The following exception is obtained when using the annotation approach and load-time weaving: [AppClassLoader@1f12c4e] info AspectJ Weaver Version 1.5.4 built on Thursday Dec 20, 2007 at 13:44:10 GMT [AppClassLoader@1f12c4e] info register classloader sun.misc.Launcher$AppClassLoader@1f12c4e [AppClassLoader@1f12c4e] info using configuration /H:/temp/aspectj_bug/scratch/classes/scratch/aop/annotationbug/aspect/aop-bug.xml [AppClassLoader@1f12c4e] info register aspect scratch.aop.annotationbug.aspect.BugAspect doSomething() Exception in thread "main" java.lang.ClassFormatError: Code attribute in native or abstract methods in class file scratch/aop/annotationbug/extra/SubClass at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:620) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124) at java.net.URLClassLoader.defineClass(URLClassLoader.java:260) at java.net.URLClassLoader.access$000(URLClassLoader.java:56) at java.net.URLClassLoader$1.run(URLClassLoader.java:195) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276) at java.lang.ClassLoader.loadClass(ClassLoader.java:251) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319) at scratch.aop.annotationbug.extra.BugOther.getSubClass(BugOther.java:22) at scratch.aop.annotationbug.main.BugMain.somethingElse(BugMain.java:36) at scratch.aop.annotationbug.main.BugMain.doSomething(BugMain.java:30) at scratch.aop.annotationbug.main.BugMain.execute(BugMain.java:24) at scratch.aop.annotationbug.main.BugDriver.doExecute(BugDriver.java:27) at scratch.aop.annotationbug.main.BugDriver.main(BugDriver.java:21) The same advice logic does not result in a ClassFormatError when using the Aspect approach, it only appears using the annotation approach. Unfortunately we have not been able to track down exactly why the above Error occurs but have attached a test case that manifests it. To run simply use the runtime configuration on the BugDriver main(): -Dorg.aspectj.weaver.loadtime.configuration="scratch/aop/annotationbug/aspect/aop-bug.xml" Along with the AspectJ Load-Time Weaver Agent. The above occurs with both AspectJ 1.5.4 and AspectJ 1.6.0. Interestingly when using the aspectj 1.6.0 weaver, the AppClassLoader log still indicates "1.5.4".
resolved fixed
f014275
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2008-05-20T18:30:38Z
2008-05-18T22:33:20Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
import org.aspectj.apache.bcel.generic.InstructionFactory; import org.aspectj.apache.bcel.generic.InstructionHandle; import org.aspectj.apache.bcel.generic.InstructionList; import org.aspectj.apache.bcel.generic.InstructionTargeter; import org.aspectj.apache.bcel.generic.InvokeInstruction; import org.aspectj.apache.bcel.generic.LineNumberTag; import org.aspectj.apache.bcel.generic.LocalVariableInstruction; import org.aspectj.apache.bcel.generic.LocalVariableTag; import org.aspectj.apache.bcel.generic.MONITORENTER; import org.aspectj.apache.bcel.generic.MONITOREXIT; import org.aspectj.apache.bcel.generic.MULTIANEWARRAY; import org.aspectj.apache.bcel.generic.MethodGen; import org.aspectj.apache.bcel.generic.NEW; import org.aspectj.apache.bcel.generic.NEWARRAY; import org.aspectj.apache.bcel.generic.ObjectType; import org.aspectj.apache.bcel.generic.PUTFIELD; import org.aspectj.apache.bcel.generic.PUTSTATIC; import org.aspectj.apache.bcel.generic.RET; import org.aspectj.apache.bcel.generic.ReturnInstruction; import org.aspectj.apache.bcel.generic.Select; import org.aspectj.apache.bcel.generic.StoreInstruction; import org.aspectj.apache.bcel.generic.Tag; import org.aspectj.apache.bcel.generic.Type; import org.aspectj.apache.bcel.generic.annotation.AnnotationGen; import org.aspectj.bridge.IMessage; import org.aspectj.bridge.ISourceLocation; import org.aspectj.bridge.Message; import org.aspectj.bridge.MessageUtil; import org.aspectj.bridge.WeaveMessage; import org.aspectj.bridge.context.CompilationAndWeavingContext;
232,712
Bug 232712 ClassFormatError during LTW using annotation approach
The following exception is obtained when using the annotation approach and load-time weaving: [AppClassLoader@1f12c4e] info AspectJ Weaver Version 1.5.4 built on Thursday Dec 20, 2007 at 13:44:10 GMT [AppClassLoader@1f12c4e] info register classloader sun.misc.Launcher$AppClassLoader@1f12c4e [AppClassLoader@1f12c4e] info using configuration /H:/temp/aspectj_bug/scratch/classes/scratch/aop/annotationbug/aspect/aop-bug.xml [AppClassLoader@1f12c4e] info register aspect scratch.aop.annotationbug.aspect.BugAspect doSomething() Exception in thread "main" java.lang.ClassFormatError: Code attribute in native or abstract methods in class file scratch/aop/annotationbug/extra/SubClass at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:620) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124) at java.net.URLClassLoader.defineClass(URLClassLoader.java:260) at java.net.URLClassLoader.access$000(URLClassLoader.java:56) at java.net.URLClassLoader$1.run(URLClassLoader.java:195) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276) at java.lang.ClassLoader.loadClass(ClassLoader.java:251) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319) at scratch.aop.annotationbug.extra.BugOther.getSubClass(BugOther.java:22) at scratch.aop.annotationbug.main.BugMain.somethingElse(BugMain.java:36) at scratch.aop.annotationbug.main.BugMain.doSomething(BugMain.java:30) at scratch.aop.annotationbug.main.BugMain.execute(BugMain.java:24) at scratch.aop.annotationbug.main.BugDriver.doExecute(BugDriver.java:27) at scratch.aop.annotationbug.main.BugDriver.main(BugDriver.java:21) The same advice logic does not result in a ClassFormatError when using the Aspect approach, it only appears using the annotation approach. Unfortunately we have not been able to track down exactly why the above Error occurs but have attached a test case that manifests it. To run simply use the runtime configuration on the BugDriver main(): -Dorg.aspectj.weaver.loadtime.configuration="scratch/aop/annotationbug/aspect/aop-bug.xml" Along with the AspectJ Load-Time Weaver Agent. The above occurs with both AspectJ 1.5.4 and AspectJ 1.6.0. Interestingly when using the aspectj 1.6.0 weaver, the AppClassLoader log still indicates "1.5.4".
resolved fixed
f014275
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2008-05-20T18:30:38Z
2008-05-18T22:33:20Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
import org.aspectj.bridge.context.ContextToken; import org.aspectj.util.PartialOrder; import org.aspectj.weaver.AjAttribute; import org.aspectj.weaver.AjcMemberMaker; import org.aspectj.weaver.AsmRelationshipProvider; import org.aspectj.weaver.BCException; import org.aspectj.weaver.ConcreteTypeMunger; import org.aspectj.weaver.IClassWeaver; import org.aspectj.weaver.IntMap; import org.aspectj.weaver.Member; import org.aspectj.weaver.MissingResolvedTypeWithKnownSignature; import org.aspectj.weaver.NameMangler; import org.aspectj.weaver.NewConstructorTypeMunger; import org.aspectj.weaver.NewFieldTypeMunger; import org.aspectj.weaver.NewMethodTypeMunger; import org.aspectj.weaver.ResolvedMember; import org.aspectj.weaver.ResolvedMemberImpl; import org.aspectj.weaver.ResolvedType; import org.aspectj.weaver.ResolvedTypeMunger; import org.aspectj.weaver.Shadow; import org.aspectj.weaver.ShadowMunger; import org.aspectj.weaver.UnresolvedType; import org.aspectj.weaver.WeaverMessages; import org.aspectj.weaver.WeaverStateInfo; import org.aspectj.weaver.World; import org.aspectj.weaver.patterns.DeclareAnnotation; import org.aspectj.weaver.patterns.ExactTypePattern; import org.aspectj.weaver.tools.Trace; import org.aspectj.weaver.tools.TraceFactory; class BcelClassWeaver implements IClassWeaver {
232,712
Bug 232712 ClassFormatError during LTW using annotation approach
The following exception is obtained when using the annotation approach and load-time weaving: [AppClassLoader@1f12c4e] info AspectJ Weaver Version 1.5.4 built on Thursday Dec 20, 2007 at 13:44:10 GMT [AppClassLoader@1f12c4e] info register classloader sun.misc.Launcher$AppClassLoader@1f12c4e [AppClassLoader@1f12c4e] info using configuration /H:/temp/aspectj_bug/scratch/classes/scratch/aop/annotationbug/aspect/aop-bug.xml [AppClassLoader@1f12c4e] info register aspect scratch.aop.annotationbug.aspect.BugAspect doSomething() Exception in thread "main" java.lang.ClassFormatError: Code attribute in native or abstract methods in class file scratch/aop/annotationbug/extra/SubClass at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:620) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124) at java.net.URLClassLoader.defineClass(URLClassLoader.java:260) at java.net.URLClassLoader.access$000(URLClassLoader.java:56) at java.net.URLClassLoader$1.run(URLClassLoader.java:195) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276) at java.lang.ClassLoader.loadClass(ClassLoader.java:251) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319) at scratch.aop.annotationbug.extra.BugOther.getSubClass(BugOther.java:22) at scratch.aop.annotationbug.main.BugMain.somethingElse(BugMain.java:36) at scratch.aop.annotationbug.main.BugMain.doSomething(BugMain.java:30) at scratch.aop.annotationbug.main.BugMain.execute(BugMain.java:24) at scratch.aop.annotationbug.main.BugDriver.doExecute(BugDriver.java:27) at scratch.aop.annotationbug.main.BugDriver.main(BugDriver.java:21) The same advice logic does not result in a ClassFormatError when using the Aspect approach, it only appears using the annotation approach. Unfortunately we have not been able to track down exactly why the above Error occurs but have attached a test case that manifests it. To run simply use the runtime configuration on the BugDriver main(): -Dorg.aspectj.weaver.loadtime.configuration="scratch/aop/annotationbug/aspect/aop-bug.xml" Along with the AspectJ Load-Time Weaver Agent. The above occurs with both AspectJ 1.5.4 and AspectJ 1.6.0. Interestingly when using the aspectj 1.6.0 weaver, the AppClassLoader log still indicates "1.5.4".
resolved fixed
f014275
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2008-05-20T18:30:38Z
2008-05-18T22:33:20Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
private static Trace trace = TraceFactory.getTraceFactory().getTrace(BcelClassWeaver.class); /** * This is called from {@link BcelWeaver} to perform the per-class weaving process. */ public static boolean weave( BcelWorld world, LazyClassGen clazz, List shadowMungers, List typeMungers, List lateTypeMungers) { boolean b = new BcelClassWeaver(world, clazz, shadowMungers, typeMungers, lateTypeMungers).weave(); return b; } private final LazyClassGen clazz; private final List shadowMungers; private final List typeMungers;
232,712
Bug 232712 ClassFormatError during LTW using annotation approach
The following exception is obtained when using the annotation approach and load-time weaving: [AppClassLoader@1f12c4e] info AspectJ Weaver Version 1.5.4 built on Thursday Dec 20, 2007 at 13:44:10 GMT [AppClassLoader@1f12c4e] info register classloader sun.misc.Launcher$AppClassLoader@1f12c4e [AppClassLoader@1f12c4e] info using configuration /H:/temp/aspectj_bug/scratch/classes/scratch/aop/annotationbug/aspect/aop-bug.xml [AppClassLoader@1f12c4e] info register aspect scratch.aop.annotationbug.aspect.BugAspect doSomething() Exception in thread "main" java.lang.ClassFormatError: Code attribute in native or abstract methods in class file scratch/aop/annotationbug/extra/SubClass at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:620) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124) at java.net.URLClassLoader.defineClass(URLClassLoader.java:260) at java.net.URLClassLoader.access$000(URLClassLoader.java:56) at java.net.URLClassLoader$1.run(URLClassLoader.java:195) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276) at java.lang.ClassLoader.loadClass(ClassLoader.java:251) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319) at scratch.aop.annotationbug.extra.BugOther.getSubClass(BugOther.java:22) at scratch.aop.annotationbug.main.BugMain.somethingElse(BugMain.java:36) at scratch.aop.annotationbug.main.BugMain.doSomething(BugMain.java:30) at scratch.aop.annotationbug.main.BugMain.execute(BugMain.java:24) at scratch.aop.annotationbug.main.BugDriver.doExecute(BugDriver.java:27) at scratch.aop.annotationbug.main.BugDriver.main(BugDriver.java:21) The same advice logic does not result in a ClassFormatError when using the Aspect approach, it only appears using the annotation approach. Unfortunately we have not been able to track down exactly why the above Error occurs but have attached a test case that manifests it. To run simply use the runtime configuration on the BugDriver main(): -Dorg.aspectj.weaver.loadtime.configuration="scratch/aop/annotationbug/aspect/aop-bug.xml" Along with the AspectJ Load-Time Weaver Agent. The above occurs with both AspectJ 1.5.4 and AspectJ 1.6.0. Interestingly when using the aspectj 1.6.0 weaver, the AppClassLoader log still indicates "1.5.4".
resolved fixed
f014275
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2008-05-20T18:30:38Z
2008-05-18T22:33:20Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
private final List lateTypeMungers; private final BcelObjectType ty; private final BcelWorld world; private final ConstantPoolGen cpg; private final InstructionFactory fact; private final List addedLazyMethodGens = new ArrayList(); private final Set addedDispatchTargets = new HashSet(); private static boolean inReweavableMode = false; private List addedSuperInitializersAsList = null; private final Map addedSuperInitializers = new HashMap(); private List addedThisInitializers = new ArrayList(); private List addedClassInitializers = new ArrayList(); private Map mapToAnnotations = new HashMap(); private BcelShadow clinitShadow = null; /** * This holds the initialization and pre-initialization shadows for this class * that were actually matched by mungers (if no match, then we don't even create the * shadows really). */ private final List initializationShadows = new ArrayList(1); private BcelClassWeaver(
232,712
Bug 232712 ClassFormatError during LTW using annotation approach
The following exception is obtained when using the annotation approach and load-time weaving: [AppClassLoader@1f12c4e] info AspectJ Weaver Version 1.5.4 built on Thursday Dec 20, 2007 at 13:44:10 GMT [AppClassLoader@1f12c4e] info register classloader sun.misc.Launcher$AppClassLoader@1f12c4e [AppClassLoader@1f12c4e] info using configuration /H:/temp/aspectj_bug/scratch/classes/scratch/aop/annotationbug/aspect/aop-bug.xml [AppClassLoader@1f12c4e] info register aspect scratch.aop.annotationbug.aspect.BugAspect doSomething() Exception in thread "main" java.lang.ClassFormatError: Code attribute in native or abstract methods in class file scratch/aop/annotationbug/extra/SubClass at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:620) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124) at java.net.URLClassLoader.defineClass(URLClassLoader.java:260) at java.net.URLClassLoader.access$000(URLClassLoader.java:56) at java.net.URLClassLoader$1.run(URLClassLoader.java:195) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276) at java.lang.ClassLoader.loadClass(ClassLoader.java:251) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319) at scratch.aop.annotationbug.extra.BugOther.getSubClass(BugOther.java:22) at scratch.aop.annotationbug.main.BugMain.somethingElse(BugMain.java:36) at scratch.aop.annotationbug.main.BugMain.doSomething(BugMain.java:30) at scratch.aop.annotationbug.main.BugMain.execute(BugMain.java:24) at scratch.aop.annotationbug.main.BugDriver.doExecute(BugDriver.java:27) at scratch.aop.annotationbug.main.BugDriver.main(BugDriver.java:21) The same advice logic does not result in a ClassFormatError when using the Aspect approach, it only appears using the annotation approach. Unfortunately we have not been able to track down exactly why the above Error occurs but have attached a test case that manifests it. To run simply use the runtime configuration on the BugDriver main(): -Dorg.aspectj.weaver.loadtime.configuration="scratch/aop/annotationbug/aspect/aop-bug.xml" Along with the AspectJ Load-Time Weaver Agent. The above occurs with both AspectJ 1.5.4 and AspectJ 1.6.0. Interestingly when using the aspectj 1.6.0 weaver, the AppClassLoader log still indicates "1.5.4".
resolved fixed
f014275
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2008-05-20T18:30:38Z
2008-05-18T22:33:20Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
BcelWorld world, LazyClassGen clazz, List shadowMungers, List typeMungers, List lateTypeMungers) { super(); this.world = world; this.clazz = clazz; this.shadowMungers = shadowMungers; this.typeMungers = typeMungers; this.lateTypeMungers = lateTypeMungers; this.ty = clazz.getBcelObjectType(); this.cpg = clazz.getConstantPoolGen(); this.fact = clazz.getFactory(); fastMatchShadowMungers(shadowMungers); initializeSuperInitializerMap(ty.getResolvedTypeX()); if (!checkedXsetForLowLevelContextCapturing) { Properties p = world.getExtraConfiguration(); if (p!=null) { String s = p.getProperty(World.xsetCAPTURE_ALL_CONTEXT,"false"); captureLowLevelContext = s.equalsIgnoreCase("true"); if (captureLowLevelContext) world.getMessageHandler().handleMessage(MessageUtil.info("["+World.xsetCAPTURE_ALL_CONTEXT+"=true] Enabling collection of low level context for debug/crash messages")); } checkedXsetForLowLevelContextCapturing=true; }
232,712
Bug 232712 ClassFormatError during LTW using annotation approach
The following exception is obtained when using the annotation approach and load-time weaving: [AppClassLoader@1f12c4e] info AspectJ Weaver Version 1.5.4 built on Thursday Dec 20, 2007 at 13:44:10 GMT [AppClassLoader@1f12c4e] info register classloader sun.misc.Launcher$AppClassLoader@1f12c4e [AppClassLoader@1f12c4e] info using configuration /H:/temp/aspectj_bug/scratch/classes/scratch/aop/annotationbug/aspect/aop-bug.xml [AppClassLoader@1f12c4e] info register aspect scratch.aop.annotationbug.aspect.BugAspect doSomething() Exception in thread "main" java.lang.ClassFormatError: Code attribute in native or abstract methods in class file scratch/aop/annotationbug/extra/SubClass at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:620) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124) at java.net.URLClassLoader.defineClass(URLClassLoader.java:260) at java.net.URLClassLoader.access$000(URLClassLoader.java:56) at java.net.URLClassLoader$1.run(URLClassLoader.java:195) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276) at java.lang.ClassLoader.loadClass(ClassLoader.java:251) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319) at scratch.aop.annotationbug.extra.BugOther.getSubClass(BugOther.java:22) at scratch.aop.annotationbug.main.BugMain.somethingElse(BugMain.java:36) at scratch.aop.annotationbug.main.BugMain.doSomething(BugMain.java:30) at scratch.aop.annotationbug.main.BugMain.execute(BugMain.java:24) at scratch.aop.annotationbug.main.BugDriver.doExecute(BugDriver.java:27) at scratch.aop.annotationbug.main.BugDriver.main(BugDriver.java:21) The same advice logic does not result in a ClassFormatError when using the Aspect approach, it only appears using the annotation approach. Unfortunately we have not been able to track down exactly why the above Error occurs but have attached a test case that manifests it. To run simply use the runtime configuration on the BugDriver main(): -Dorg.aspectj.weaver.loadtime.configuration="scratch/aop/annotationbug/aspect/aop-bug.xml" Along with the AspectJ Load-Time Weaver Agent. The above occurs with both AspectJ 1.5.4 and AspectJ 1.6.0. Interestingly when using the aspectj 1.6.0 weaver, the AppClassLoader log still indicates "1.5.4".
resolved fixed
f014275
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2008-05-20T18:30:38Z
2008-05-18T22:33:20Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
} private List[] perKindShadowMungers; private boolean canMatchBodyShadows = false; private boolean canMatchInitialization = false; private void fastMatchShadowMungers(List shadowMungers) { perKindShadowMungers = new List[Shadow.MAX_SHADOW_KIND + 1]; for (int i = 0; i < perKindShadowMungers.length; i++) { perKindShadowMungers[i] = new ArrayList(0); } for (Iterator iter = shadowMungers.iterator(); iter.hasNext();) { ShadowMunger munger = (ShadowMunger) iter.next(); int couldMatchKinds = munger.getPointcut().couldMatchKinds(); for (int i = 0; i < Shadow.SHADOW_KINDS.length; i++) { Shadow.Kind kind = Shadow.SHADOW_KINDS[i]; if (kind.isSet(couldMatchKinds)) perKindShadowMungers[kind.getKey()].add(munger); } } if (!perKindShadowMungers[Shadow.Initialization.getKey()].isEmpty()) canMatchInitialization = true; for (int i = 0; i < Shadow.SHADOW_KINDS.length; i++) { Shadow.Kind kind = Shadow.SHADOW_KINDS[i]; if (!kind.isEnclosingKind() && !perKindShadowMungers[i+1].isEmpty()) {
232,712
Bug 232712 ClassFormatError during LTW using annotation approach
The following exception is obtained when using the annotation approach and load-time weaving: [AppClassLoader@1f12c4e] info AspectJ Weaver Version 1.5.4 built on Thursday Dec 20, 2007 at 13:44:10 GMT [AppClassLoader@1f12c4e] info register classloader sun.misc.Launcher$AppClassLoader@1f12c4e [AppClassLoader@1f12c4e] info using configuration /H:/temp/aspectj_bug/scratch/classes/scratch/aop/annotationbug/aspect/aop-bug.xml [AppClassLoader@1f12c4e] info register aspect scratch.aop.annotationbug.aspect.BugAspect doSomething() Exception in thread "main" java.lang.ClassFormatError: Code attribute in native or abstract methods in class file scratch/aop/annotationbug/extra/SubClass at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:620) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124) at java.net.URLClassLoader.defineClass(URLClassLoader.java:260) at java.net.URLClassLoader.access$000(URLClassLoader.java:56) at java.net.URLClassLoader$1.run(URLClassLoader.java:195) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276) at java.lang.ClassLoader.loadClass(ClassLoader.java:251) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319) at scratch.aop.annotationbug.extra.BugOther.getSubClass(BugOther.java:22) at scratch.aop.annotationbug.main.BugMain.somethingElse(BugMain.java:36) at scratch.aop.annotationbug.main.BugMain.doSomething(BugMain.java:30) at scratch.aop.annotationbug.main.BugMain.execute(BugMain.java:24) at scratch.aop.annotationbug.main.BugDriver.doExecute(BugDriver.java:27) at scratch.aop.annotationbug.main.BugDriver.main(BugDriver.java:21) The same advice logic does not result in a ClassFormatError when using the Aspect approach, it only appears using the annotation approach. Unfortunately we have not been able to track down exactly why the above Error occurs but have attached a test case that manifests it. To run simply use the runtime configuration on the BugDriver main(): -Dorg.aspectj.weaver.loadtime.configuration="scratch/aop/annotationbug/aspect/aop-bug.xml" Along with the AspectJ Load-Time Weaver Agent. The above occurs with both AspectJ 1.5.4 and AspectJ 1.6.0. Interestingly when using the aspectj 1.6.0 weaver, the AppClassLoader log still indicates "1.5.4".
resolved fixed
f014275
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2008-05-20T18:30:38Z
2008-05-18T22:33:20Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
canMatchBodyShadows = true; } if (perKindShadowMungers[i+1].isEmpty()) { perKindShadowMungers[i+1] = null; } } } private boolean canMatch(Shadow.Kind kind) { return perKindShadowMungers[kind.getKey()] != null; } } private void initializeSuperInitializerMap(ResolvedType child) { ResolvedType[] superInterfaces = child.getDeclaredInterfaces(); for (int i=0, len=superInterfaces.length; i < len; i++) { if (ty.getResolvedTypeX().isTopmostImplementor(superInterfaces[i])) { if (addSuperInitializer(superInterfaces[i])) { initializeSuperInitializerMap(superInterfaces[i]); } } } } private boolean addSuperInitializer(ResolvedType onType) { if (onType.isRawType() || onType.isParameterizedType()) onType = onType.getGenericType(); IfaceInitList l = (IfaceInitList) addedSuperInitializers.get(onType); if (l != null) return false; l = new IfaceInitList(onType); addedSuperInitializers.put(onType, l); return true;
232,712
Bug 232712 ClassFormatError during LTW using annotation approach
The following exception is obtained when using the annotation approach and load-time weaving: [AppClassLoader@1f12c4e] info AspectJ Weaver Version 1.5.4 built on Thursday Dec 20, 2007 at 13:44:10 GMT [AppClassLoader@1f12c4e] info register classloader sun.misc.Launcher$AppClassLoader@1f12c4e [AppClassLoader@1f12c4e] info using configuration /H:/temp/aspectj_bug/scratch/classes/scratch/aop/annotationbug/aspect/aop-bug.xml [AppClassLoader@1f12c4e] info register aspect scratch.aop.annotationbug.aspect.BugAspect doSomething() Exception in thread "main" java.lang.ClassFormatError: Code attribute in native or abstract methods in class file scratch/aop/annotationbug/extra/SubClass at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:620) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124) at java.net.URLClassLoader.defineClass(URLClassLoader.java:260) at java.net.URLClassLoader.access$000(URLClassLoader.java:56) at java.net.URLClassLoader$1.run(URLClassLoader.java:195) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276) at java.lang.ClassLoader.loadClass(ClassLoader.java:251) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319) at scratch.aop.annotationbug.extra.BugOther.getSubClass(BugOther.java:22) at scratch.aop.annotationbug.main.BugMain.somethingElse(BugMain.java:36) at scratch.aop.annotationbug.main.BugMain.doSomething(BugMain.java:30) at scratch.aop.annotationbug.main.BugMain.execute(BugMain.java:24) at scratch.aop.annotationbug.main.BugDriver.doExecute(BugDriver.java:27) at scratch.aop.annotationbug.main.BugDriver.main(BugDriver.java:21) The same advice logic does not result in a ClassFormatError when using the Aspect approach, it only appears using the annotation approach. Unfortunately we have not been able to track down exactly why the above Error occurs but have attached a test case that manifests it. To run simply use the runtime configuration on the BugDriver main(): -Dorg.aspectj.weaver.loadtime.configuration="scratch/aop/annotationbug/aspect/aop-bug.xml" Along with the AspectJ Load-Time Weaver Agent. The above occurs with both AspectJ 1.5.4 and AspectJ 1.6.0. Interestingly when using the aspectj 1.6.0 weaver, the AppClassLoader log still indicates "1.5.4".
resolved fixed
f014275
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2008-05-20T18:30:38Z
2008-05-18T22:33:20Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
} public void addInitializer(ConcreteTypeMunger cm) { NewFieldTypeMunger m = (NewFieldTypeMunger) cm.getMunger(); ResolvedType onType = m.getSignature().getDeclaringType().resolve(world); if (onType.isRawType()) onType = onType.getGenericType(); if (m.getSignature().isStatic()) { addedClassInitializers.add(cm); } else { if (onType == ty.getResolvedTypeX()) { addedThisInitializers.add(cm); } else { IfaceInitList l = (IfaceInitList) addedSuperInitializers.get(onType); l.list.add(cm); } } } private static class IfaceInitList implements PartialOrder.PartialComparable { final ResolvedType onType; List list = new ArrayList(); IfaceInitList(ResolvedType onType) { this.onType = onType; } public int compareTo(Object other) { IfaceInitList o = (IfaceInitList)other; if (onType.isAssignableFrom(o.onType)) return +1; else if (o.onType.isAssignableFrom(onType)) return -1; else return 0;
232,712
Bug 232712 ClassFormatError during LTW using annotation approach
The following exception is obtained when using the annotation approach and load-time weaving: [AppClassLoader@1f12c4e] info AspectJ Weaver Version 1.5.4 built on Thursday Dec 20, 2007 at 13:44:10 GMT [AppClassLoader@1f12c4e] info register classloader sun.misc.Launcher$AppClassLoader@1f12c4e [AppClassLoader@1f12c4e] info using configuration /H:/temp/aspectj_bug/scratch/classes/scratch/aop/annotationbug/aspect/aop-bug.xml [AppClassLoader@1f12c4e] info register aspect scratch.aop.annotationbug.aspect.BugAspect doSomething() Exception in thread "main" java.lang.ClassFormatError: Code attribute in native or abstract methods in class file scratch/aop/annotationbug/extra/SubClass at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:620) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124) at java.net.URLClassLoader.defineClass(URLClassLoader.java:260) at java.net.URLClassLoader.access$000(URLClassLoader.java:56) at java.net.URLClassLoader$1.run(URLClassLoader.java:195) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276) at java.lang.ClassLoader.loadClass(ClassLoader.java:251) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319) at scratch.aop.annotationbug.extra.BugOther.getSubClass(BugOther.java:22) at scratch.aop.annotationbug.main.BugMain.somethingElse(BugMain.java:36) at scratch.aop.annotationbug.main.BugMain.doSomething(BugMain.java:30) at scratch.aop.annotationbug.main.BugMain.execute(BugMain.java:24) at scratch.aop.annotationbug.main.BugDriver.doExecute(BugDriver.java:27) at scratch.aop.annotationbug.main.BugDriver.main(BugDriver.java:21) The same advice logic does not result in a ClassFormatError when using the Aspect approach, it only appears using the annotation approach. Unfortunately we have not been able to track down exactly why the above Error occurs but have attached a test case that manifests it. To run simply use the runtime configuration on the BugDriver main(): -Dorg.aspectj.weaver.loadtime.configuration="scratch/aop/annotationbug/aspect/aop-bug.xml" Along with the AspectJ Load-Time Weaver Agent. The above occurs with both AspectJ 1.5.4 and AspectJ 1.6.0. Interestingly when using the aspectj 1.6.0 weaver, the AppClassLoader log still indicates "1.5.4".
resolved fixed
f014275
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2008-05-20T18:30:38Z
2008-05-18T22:33:20Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
} public int fallbackCompareTo(Object other) { return 0; } } public boolean addDispatchTarget(ResolvedMember m) { return addedDispatchTargets.add(m); } public void addLazyMethodGen(LazyMethodGen gen) { addedLazyMethodGens.add(gen); } public void addOrReplaceLazyMethodGen(LazyMethodGen mg) { if (alreadyDefined(clazz, mg)) return; for (Iterator i = addedLazyMethodGens.iterator(); i.hasNext(); ) { LazyMethodGen existing = (LazyMethodGen)i.next(); if (signaturesMatch(mg, existing)) { if (existing.definingType == null) { return; } else if (mg.definingType.isAssignableFrom(existing.definingType)) { return; } else if (existing.definingType.isAssignableFrom(mg.definingType)) { i.remove();
232,712
Bug 232712 ClassFormatError during LTW using annotation approach
The following exception is obtained when using the annotation approach and load-time weaving: [AppClassLoader@1f12c4e] info AspectJ Weaver Version 1.5.4 built on Thursday Dec 20, 2007 at 13:44:10 GMT [AppClassLoader@1f12c4e] info register classloader sun.misc.Launcher$AppClassLoader@1f12c4e [AppClassLoader@1f12c4e] info using configuration /H:/temp/aspectj_bug/scratch/classes/scratch/aop/annotationbug/aspect/aop-bug.xml [AppClassLoader@1f12c4e] info register aspect scratch.aop.annotationbug.aspect.BugAspect doSomething() Exception in thread "main" java.lang.ClassFormatError: Code attribute in native or abstract methods in class file scratch/aop/annotationbug/extra/SubClass at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:620) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124) at java.net.URLClassLoader.defineClass(URLClassLoader.java:260) at java.net.URLClassLoader.access$000(URLClassLoader.java:56) at java.net.URLClassLoader$1.run(URLClassLoader.java:195) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276) at java.lang.ClassLoader.loadClass(ClassLoader.java:251) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319) at scratch.aop.annotationbug.extra.BugOther.getSubClass(BugOther.java:22) at scratch.aop.annotationbug.main.BugMain.somethingElse(BugMain.java:36) at scratch.aop.annotationbug.main.BugMain.doSomething(BugMain.java:30) at scratch.aop.annotationbug.main.BugMain.execute(BugMain.java:24) at scratch.aop.annotationbug.main.BugDriver.doExecute(BugDriver.java:27) at scratch.aop.annotationbug.main.BugDriver.main(BugDriver.java:21) The same advice logic does not result in a ClassFormatError when using the Aspect approach, it only appears using the annotation approach. Unfortunately we have not been able to track down exactly why the above Error occurs but have attached a test case that manifests it. To run simply use the runtime configuration on the BugDriver main(): -Dorg.aspectj.weaver.loadtime.configuration="scratch/aop/annotationbug/aspect/aop-bug.xml" Along with the AspectJ Load-Time Weaver Agent. The above occurs with both AspectJ 1.5.4 and AspectJ 1.6.0. Interestingly when using the aspectj 1.6.0 weaver, the AppClassLoader log still indicates "1.5.4".
resolved fixed
f014275
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2008-05-20T18:30:38Z
2008-05-18T22:33:20Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
addedLazyMethodGens.add(mg); return; } else { throw new BCException("conflict between: " + mg + " and " + existing); } } } addedLazyMethodGens.add(mg); } private boolean alreadyDefined(LazyClassGen clazz, LazyMethodGen mg) { for (Iterator i = clazz.getMethodGens().iterator(); i.hasNext(); ) { LazyMethodGen existing = (LazyMethodGen)i.next(); if (signaturesMatch(mg, existing)) { if (!mg.isAbstract() && existing.isAbstract()) { i.remove(); return false; } return true; } } return false; } private boolean signaturesMatch(LazyMethodGen mg, LazyMethodGen existing) { return mg.getName().equals(existing.getName()) && mg.getSignature().equals(existing.getSignature()); } protected static LazyMethodGen makeBridgeMethod(LazyClassGen gen, ResolvedMember member) {
232,712
Bug 232712 ClassFormatError during LTW using annotation approach
The following exception is obtained when using the annotation approach and load-time weaving: [AppClassLoader@1f12c4e] info AspectJ Weaver Version 1.5.4 built on Thursday Dec 20, 2007 at 13:44:10 GMT [AppClassLoader@1f12c4e] info register classloader sun.misc.Launcher$AppClassLoader@1f12c4e [AppClassLoader@1f12c4e] info using configuration /H:/temp/aspectj_bug/scratch/classes/scratch/aop/annotationbug/aspect/aop-bug.xml [AppClassLoader@1f12c4e] info register aspect scratch.aop.annotationbug.aspect.BugAspect doSomething() Exception in thread "main" java.lang.ClassFormatError: Code attribute in native or abstract methods in class file scratch/aop/annotationbug/extra/SubClass at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:620) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124) at java.net.URLClassLoader.defineClass(URLClassLoader.java:260) at java.net.URLClassLoader.access$000(URLClassLoader.java:56) at java.net.URLClassLoader$1.run(URLClassLoader.java:195) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276) at java.lang.ClassLoader.loadClass(ClassLoader.java:251) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319) at scratch.aop.annotationbug.extra.BugOther.getSubClass(BugOther.java:22) at scratch.aop.annotationbug.main.BugMain.somethingElse(BugMain.java:36) at scratch.aop.annotationbug.main.BugMain.doSomething(BugMain.java:30) at scratch.aop.annotationbug.main.BugMain.execute(BugMain.java:24) at scratch.aop.annotationbug.main.BugDriver.doExecute(BugDriver.java:27) at scratch.aop.annotationbug.main.BugDriver.main(BugDriver.java:21) The same advice logic does not result in a ClassFormatError when using the Aspect approach, it only appears using the annotation approach. Unfortunately we have not been able to track down exactly why the above Error occurs but have attached a test case that manifests it. To run simply use the runtime configuration on the BugDriver main(): -Dorg.aspectj.weaver.loadtime.configuration="scratch/aop/annotationbug/aspect/aop-bug.xml" Along with the AspectJ Load-Time Weaver Agent. The above occurs with both AspectJ 1.5.4 and AspectJ 1.6.0. Interestingly when using the aspectj 1.6.0 weaver, the AppClassLoader log still indicates "1.5.4".
resolved fixed
f014275
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2008-05-20T18:30:38Z
2008-05-18T22:33:20Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
int mods = member.getModifiers(); if (Modifier.isAbstract(mods)) mods = mods - Modifier.ABSTRACT; LazyMethodGen ret = new LazyMethodGen( mods, BcelWorld.makeBcelType(member.getReturnType()), member.getName(), BcelWorld.makeBcelTypes(member.getParameterTypes()), UnresolvedType.getNames(member.getExceptions()), gen); return ret; } /** * Create a single bridge method called 'theBridgeMethod' that bridges to 'whatToBridgeTo' */ private static void createBridgeMethod(BcelWorld world, LazyMethodGen whatToBridgeToMethodGen, LazyClassGen clazz,ResolvedMember theBridgeMethod) { InstructionList body; InstructionFactory fact; int pos = 0; ResolvedMember whatToBridgeTo = whatToBridgeToMethodGen.getMemberView(); if (whatToBridgeTo==null) { whatToBridgeTo = new ResolvedMemberImpl(Member.METHOD, whatToBridgeToMethodGen.getEnclosingClass().getType(),
232,712
Bug 232712 ClassFormatError during LTW using annotation approach
The following exception is obtained when using the annotation approach and load-time weaving: [AppClassLoader@1f12c4e] info AspectJ Weaver Version 1.5.4 built on Thursday Dec 20, 2007 at 13:44:10 GMT [AppClassLoader@1f12c4e] info register classloader sun.misc.Launcher$AppClassLoader@1f12c4e [AppClassLoader@1f12c4e] info using configuration /H:/temp/aspectj_bug/scratch/classes/scratch/aop/annotationbug/aspect/aop-bug.xml [AppClassLoader@1f12c4e] info register aspect scratch.aop.annotationbug.aspect.BugAspect doSomething() Exception in thread "main" java.lang.ClassFormatError: Code attribute in native or abstract methods in class file scratch/aop/annotationbug/extra/SubClass at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:620) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124) at java.net.URLClassLoader.defineClass(URLClassLoader.java:260) at java.net.URLClassLoader.access$000(URLClassLoader.java:56) at java.net.URLClassLoader$1.run(URLClassLoader.java:195) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276) at java.lang.ClassLoader.loadClass(ClassLoader.java:251) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319) at scratch.aop.annotationbug.extra.BugOther.getSubClass(BugOther.java:22) at scratch.aop.annotationbug.main.BugMain.somethingElse(BugMain.java:36) at scratch.aop.annotationbug.main.BugMain.doSomething(BugMain.java:30) at scratch.aop.annotationbug.main.BugMain.execute(BugMain.java:24) at scratch.aop.annotationbug.main.BugDriver.doExecute(BugDriver.java:27) at scratch.aop.annotationbug.main.BugDriver.main(BugDriver.java:21) The same advice logic does not result in a ClassFormatError when using the Aspect approach, it only appears using the annotation approach. Unfortunately we have not been able to track down exactly why the above Error occurs but have attached a test case that manifests it. To run simply use the runtime configuration on the BugDriver main(): -Dorg.aspectj.weaver.loadtime.configuration="scratch/aop/annotationbug/aspect/aop-bug.xml" Along with the AspectJ Load-Time Weaver Agent. The above occurs with both AspectJ 1.5.4 and AspectJ 1.6.0. Interestingly when using the aspectj 1.6.0 weaver, the AppClassLoader log still indicates "1.5.4".
resolved fixed
f014275
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2008-05-20T18:30:38Z
2008-05-18T22:33:20Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
whatToBridgeToMethodGen.getAccessFlags(), whatToBridgeToMethodGen.getName(), whatToBridgeToMethodGen.getSignature()); } LazyMethodGen bridgeMethod = makeBridgeMethod(clazz,theBridgeMethod); bridgeMethod.setAccessFlags(bridgeMethod.getAccessFlags() | 0x00000040 ); Type returnType = BcelWorld.makeBcelType(theBridgeMethod.getReturnType()); Type[] paramTypes = BcelWorld.makeBcelTypes(theBridgeMethod.getParameterTypes()); Type[] newParamTypes=whatToBridgeToMethodGen.getArgumentTypes(); body = bridgeMethod.getBody(); fact = clazz.getFactory(); if (!whatToBridgeToMethodGen.isStatic()) { body.append(InstructionFactory.createThis()); pos++; } for (int i = 0, len = paramTypes.length; i < len; i++) { Type paramType = paramTypes[i]; body.append(InstructionFactory.createLoad(paramType, pos)); if (!newParamTypes[i].equals(paramTypes[i])) { if (world.forDEBUG_bridgingCode) System.err.println("Bridging: Cast "+newParamTypes[i]+" from "+paramTypes[i]); body.append(fact.createCast(paramTypes[i],newParamTypes[i])); } pos+=paramType.getSize(); } body.append(Utility.createInvoke(fact, world,whatToBridgeTo)); body.append(InstructionFactory.createReturn(returnType)); clazz.addMethodGen(bridgeMethod); }
232,712
Bug 232712 ClassFormatError during LTW using annotation approach
The following exception is obtained when using the annotation approach and load-time weaving: [AppClassLoader@1f12c4e] info AspectJ Weaver Version 1.5.4 built on Thursday Dec 20, 2007 at 13:44:10 GMT [AppClassLoader@1f12c4e] info register classloader sun.misc.Launcher$AppClassLoader@1f12c4e [AppClassLoader@1f12c4e] info using configuration /H:/temp/aspectj_bug/scratch/classes/scratch/aop/annotationbug/aspect/aop-bug.xml [AppClassLoader@1f12c4e] info register aspect scratch.aop.annotationbug.aspect.BugAspect doSomething() Exception in thread "main" java.lang.ClassFormatError: Code attribute in native or abstract methods in class file scratch/aop/annotationbug/extra/SubClass at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:620) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124) at java.net.URLClassLoader.defineClass(URLClassLoader.java:260) at java.net.URLClassLoader.access$000(URLClassLoader.java:56) at java.net.URLClassLoader$1.run(URLClassLoader.java:195) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276) at java.lang.ClassLoader.loadClass(ClassLoader.java:251) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319) at scratch.aop.annotationbug.extra.BugOther.getSubClass(BugOther.java:22) at scratch.aop.annotationbug.main.BugMain.somethingElse(BugMain.java:36) at scratch.aop.annotationbug.main.BugMain.doSomething(BugMain.java:30) at scratch.aop.annotationbug.main.BugMain.execute(BugMain.java:24) at scratch.aop.annotationbug.main.BugDriver.doExecute(BugDriver.java:27) at scratch.aop.annotationbug.main.BugDriver.main(BugDriver.java:21) The same advice logic does not result in a ClassFormatError when using the Aspect approach, it only appears using the annotation approach. Unfortunately we have not been able to track down exactly why the above Error occurs but have attached a test case that manifests it. To run simply use the runtime configuration on the BugDriver main(): -Dorg.aspectj.weaver.loadtime.configuration="scratch/aop/annotationbug/aspect/aop-bug.xml" Along with the AspectJ Load-Time Weaver Agent. The above occurs with both AspectJ 1.5.4 and AspectJ 1.6.0. Interestingly when using the aspectj 1.6.0 weaver, the AppClassLoader log still indicates "1.5.4".
resolved fixed
f014275
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2008-05-20T18:30:38Z
2008-05-18T22:33:20Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
public boolean weave() { if (clazz.isWoven() && !clazz.isReweavable()) { world.showMessage(IMessage.ERROR, WeaverMessages.format(WeaverMessages.ALREADY_WOVEN,clazz.getType().getName()), ty.getSourceLocation(), null); return false; } Set aspectsAffectingType = null; if (inReweavableMode || clazz.getType().isAspect()) aspectsAffectingType = new HashSet(); boolean isChanged = false; if (clazz.getType().isAspect()) isChanged = true; for (Iterator i = typeMungers.iterator(); i.hasNext(); ) { Object o = i.next(); if ( !(o instanceof BcelTypeMunger) ) { continue; } BcelTypeMunger munger = (BcelTypeMunger)o; boolean typeMungerAffectedType = munger.munge(this); if (typeMungerAffectedType) { isChanged = true; if (inReweavableMode || clazz.getType().isAspect()) aspectsAffectingType.add(munger.getAspectType().getName()); } }
232,712
Bug 232712 ClassFormatError during LTW using annotation approach
The following exception is obtained when using the annotation approach and load-time weaving: [AppClassLoader@1f12c4e] info AspectJ Weaver Version 1.5.4 built on Thursday Dec 20, 2007 at 13:44:10 GMT [AppClassLoader@1f12c4e] info register classloader sun.misc.Launcher$AppClassLoader@1f12c4e [AppClassLoader@1f12c4e] info using configuration /H:/temp/aspectj_bug/scratch/classes/scratch/aop/annotationbug/aspect/aop-bug.xml [AppClassLoader@1f12c4e] info register aspect scratch.aop.annotationbug.aspect.BugAspect doSomething() Exception in thread "main" java.lang.ClassFormatError: Code attribute in native or abstract methods in class file scratch/aop/annotationbug/extra/SubClass at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:620) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124) at java.net.URLClassLoader.defineClass(URLClassLoader.java:260) at java.net.URLClassLoader.access$000(URLClassLoader.java:56) at java.net.URLClassLoader$1.run(URLClassLoader.java:195) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276) at java.lang.ClassLoader.loadClass(ClassLoader.java:251) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319) at scratch.aop.annotationbug.extra.BugOther.getSubClass(BugOther.java:22) at scratch.aop.annotationbug.main.BugMain.somethingElse(BugMain.java:36) at scratch.aop.annotationbug.main.BugMain.doSomething(BugMain.java:30) at scratch.aop.annotationbug.main.BugMain.execute(BugMain.java:24) at scratch.aop.annotationbug.main.BugDriver.doExecute(BugDriver.java:27) at scratch.aop.annotationbug.main.BugDriver.main(BugDriver.java:21) The same advice logic does not result in a ClassFormatError when using the Aspect approach, it only appears using the annotation approach. Unfortunately we have not been able to track down exactly why the above Error occurs but have attached a test case that manifests it. To run simply use the runtime configuration on the BugDriver main(): -Dorg.aspectj.weaver.loadtime.configuration="scratch/aop/annotationbug/aspect/aop-bug.xml" Along with the AspectJ Load-Time Weaver Agent. The above occurs with both AspectJ 1.5.4 and AspectJ 1.6.0. Interestingly when using the aspectj 1.6.0 weaver, the AppClassLoader log still indicates "1.5.4".
resolved fixed
f014275
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2008-05-20T18:30:38Z
2008-05-18T22:33:20Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
isChanged = weaveDeclareAtMethodCtor(clazz) || isChanged; isChanged = weaveDeclareAtField(clazz) || isChanged; addedSuperInitializersAsList = new ArrayList(addedSuperInitializers.values()); addedSuperInitializersAsList = PartialOrder.sort(addedSuperInitializersAsList); if (addedSuperInitializersAsList == null) { throw new BCException("circularity in inter-types"); } LazyMethodGen staticInit = clazz.getStaticInitializer(); staticInit.getBody().insert(genInitInstructions(addedClassInitializers, true)); List methodGens = new ArrayList(clazz.getMethodGens()); for (Iterator i = methodGens.iterator(); i.hasNext();) { LazyMethodGen mg = (LazyMethodGen)i.next(); if (! mg.hasBody()) continue; if (world.isJoinpointSynchronizationEnabled() && world.areSynchronizationPointcutsInUse() && mg.getMethod().isSynchronized()) { transformSynchronizedMethod(mg);
232,712
Bug 232712 ClassFormatError during LTW using annotation approach
The following exception is obtained when using the annotation approach and load-time weaving: [AppClassLoader@1f12c4e] info AspectJ Weaver Version 1.5.4 built on Thursday Dec 20, 2007 at 13:44:10 GMT [AppClassLoader@1f12c4e] info register classloader sun.misc.Launcher$AppClassLoader@1f12c4e [AppClassLoader@1f12c4e] info using configuration /H:/temp/aspectj_bug/scratch/classes/scratch/aop/annotationbug/aspect/aop-bug.xml [AppClassLoader@1f12c4e] info register aspect scratch.aop.annotationbug.aspect.BugAspect doSomething() Exception in thread "main" java.lang.ClassFormatError: Code attribute in native or abstract methods in class file scratch/aop/annotationbug/extra/SubClass at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:620) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124) at java.net.URLClassLoader.defineClass(URLClassLoader.java:260) at java.net.URLClassLoader.access$000(URLClassLoader.java:56) at java.net.URLClassLoader$1.run(URLClassLoader.java:195) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276) at java.lang.ClassLoader.loadClass(ClassLoader.java:251) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319) at scratch.aop.annotationbug.extra.BugOther.getSubClass(BugOther.java:22) at scratch.aop.annotationbug.main.BugMain.somethingElse(BugMain.java:36) at scratch.aop.annotationbug.main.BugMain.doSomething(BugMain.java:30) at scratch.aop.annotationbug.main.BugMain.execute(BugMain.java:24) at scratch.aop.annotationbug.main.BugDriver.doExecute(BugDriver.java:27) at scratch.aop.annotationbug.main.BugDriver.main(BugDriver.java:21) The same advice logic does not result in a ClassFormatError when using the Aspect approach, it only appears using the annotation approach. Unfortunately we have not been able to track down exactly why the above Error occurs but have attached a test case that manifests it. To run simply use the runtime configuration on the BugDriver main(): -Dorg.aspectj.weaver.loadtime.configuration="scratch/aop/annotationbug/aspect/aop-bug.xml" Along with the AspectJ Load-Time Weaver Agent. The above occurs with both AspectJ 1.5.4 and AspectJ 1.6.0. Interestingly when using the aspectj 1.6.0 weaver, the AppClassLoader log still indicates "1.5.4".
resolved fixed
f014275
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2008-05-20T18:30:38Z
2008-05-18T22:33:20Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
} boolean shadowMungerMatched = match(mg); if (shadowMungerMatched) { if (inReweavableMode || clazz.getType().isAspect()) aspectsAffectingType.addAll(findAspectsForMungers(mg)); isChanged = true; } } for (Iterator i = methodGens.iterator(); i.hasNext();) { LazyMethodGen mg = (LazyMethodGen)i.next(); if (! mg.hasBody()) continue; implement(mg); } if (!initializationShadows.isEmpty()) { while (inlineSelfConstructors(methodGens)); positionAndImplement(initializationShadows); } if (lateTypeMungers != null) { for (Iterator i = lateTypeMungers.iterator(); i.hasNext(); ) { BcelTypeMunger munger = (BcelTypeMunger)i.next(); if (munger.matches(clazz.getType())) { boolean typeMungerAffectedType = munger.munge(this);
232,712
Bug 232712 ClassFormatError during LTW using annotation approach
The following exception is obtained when using the annotation approach and load-time weaving: [AppClassLoader@1f12c4e] info AspectJ Weaver Version 1.5.4 built on Thursday Dec 20, 2007 at 13:44:10 GMT [AppClassLoader@1f12c4e] info register classloader sun.misc.Launcher$AppClassLoader@1f12c4e [AppClassLoader@1f12c4e] info using configuration /H:/temp/aspectj_bug/scratch/classes/scratch/aop/annotationbug/aspect/aop-bug.xml [AppClassLoader@1f12c4e] info register aspect scratch.aop.annotationbug.aspect.BugAspect doSomething() Exception in thread "main" java.lang.ClassFormatError: Code attribute in native or abstract methods in class file scratch/aop/annotationbug/extra/SubClass at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:620) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124) at java.net.URLClassLoader.defineClass(URLClassLoader.java:260) at java.net.URLClassLoader.access$000(URLClassLoader.java:56) at java.net.URLClassLoader$1.run(URLClassLoader.java:195) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276) at java.lang.ClassLoader.loadClass(ClassLoader.java:251) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319) at scratch.aop.annotationbug.extra.BugOther.getSubClass(BugOther.java:22) at scratch.aop.annotationbug.main.BugMain.somethingElse(BugMain.java:36) at scratch.aop.annotationbug.main.BugMain.doSomething(BugMain.java:30) at scratch.aop.annotationbug.main.BugMain.execute(BugMain.java:24) at scratch.aop.annotationbug.main.BugDriver.doExecute(BugDriver.java:27) at scratch.aop.annotationbug.main.BugDriver.main(BugDriver.java:21) The same advice logic does not result in a ClassFormatError when using the Aspect approach, it only appears using the annotation approach. Unfortunately we have not been able to track down exactly why the above Error occurs but have attached a test case that manifests it. To run simply use the runtime configuration on the BugDriver main(): -Dorg.aspectj.weaver.loadtime.configuration="scratch/aop/annotationbug/aspect/aop-bug.xml" Along with the AspectJ Load-Time Weaver Agent. The above occurs with both AspectJ 1.5.4 and AspectJ 1.6.0. Interestingly when using the aspectj 1.6.0 weaver, the AppClassLoader log still indicates "1.5.4".
resolved fixed
f014275
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2008-05-20T18:30:38Z
2008-05-18T22:33:20Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
if (typeMungerAffectedType) { isChanged = true; if (inReweavableMode || clazz.getType().isAspect()) aspectsAffectingType.add(munger.getAspectType().getName()); } } } } if (isChanged) { clazz.getOrCreateWeaverStateInfo(inReweavableMode); weaveInAddedMethods(); } if (inReweavableMode) { WeaverStateInfo wsi = clazz.getOrCreateWeaverStateInfo(true); wsi.addAspectsAffectingType(aspectsAffectingType); wsi.setUnwovenClassFileData(ty.getJavaClass().getBytes()); wsi.setReweavable(true); } else { clazz.getOrCreateWeaverStateInfo(false).setReweavable(false); } return isChanged; }
232,712
Bug 232712 ClassFormatError during LTW using annotation approach
The following exception is obtained when using the annotation approach and load-time weaving: [AppClassLoader@1f12c4e] info AspectJ Weaver Version 1.5.4 built on Thursday Dec 20, 2007 at 13:44:10 GMT [AppClassLoader@1f12c4e] info register classloader sun.misc.Launcher$AppClassLoader@1f12c4e [AppClassLoader@1f12c4e] info using configuration /H:/temp/aspectj_bug/scratch/classes/scratch/aop/annotationbug/aspect/aop-bug.xml [AppClassLoader@1f12c4e] info register aspect scratch.aop.annotationbug.aspect.BugAspect doSomething() Exception in thread "main" java.lang.ClassFormatError: Code attribute in native or abstract methods in class file scratch/aop/annotationbug/extra/SubClass at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:620) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124) at java.net.URLClassLoader.defineClass(URLClassLoader.java:260) at java.net.URLClassLoader.access$000(URLClassLoader.java:56) at java.net.URLClassLoader$1.run(URLClassLoader.java:195) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276) at java.lang.ClassLoader.loadClass(ClassLoader.java:251) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319) at scratch.aop.annotationbug.extra.BugOther.getSubClass(BugOther.java:22) at scratch.aop.annotationbug.main.BugMain.somethingElse(BugMain.java:36) at scratch.aop.annotationbug.main.BugMain.doSomething(BugMain.java:30) at scratch.aop.annotationbug.main.BugMain.execute(BugMain.java:24) at scratch.aop.annotationbug.main.BugDriver.doExecute(BugDriver.java:27) at scratch.aop.annotationbug.main.BugDriver.main(BugDriver.java:21) The same advice logic does not result in a ClassFormatError when using the Aspect approach, it only appears using the annotation approach. Unfortunately we have not been able to track down exactly why the above Error occurs but have attached a test case that manifests it. To run simply use the runtime configuration on the BugDriver main(): -Dorg.aspectj.weaver.loadtime.configuration="scratch/aop/annotationbug/aspect/aop-bug.xml" Along with the AspectJ Load-Time Weaver Agent. The above occurs with both AspectJ 1.5.4 and AspectJ 1.6.0. Interestingly when using the aspectj 1.6.0 weaver, the AppClassLoader log still indicates "1.5.4".
resolved fixed
f014275
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2008-05-20T18:30:38Z
2008-05-18T22:33:20Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
/** * Check if a particular method is overriding another - refactored into this helper so it * can be used from multiple places. */ private static ResolvedMember isOverriding(ResolvedType typeToCheck,ResolvedMember methodThatMightBeGettingOverridden,String mname,String mrettype,int mmods,boolean inSamePackage,UnresolvedType[] methodParamsArray) { if (methodThatMightBeGettingOverridden.isStatic()) return null; if (methodThatMightBeGettingOverridden.isPrivate()) return null; if (!methodThatMightBeGettingOverridden.getName().equals(mname)) return null; if (methodThatMightBeGettingOverridden.getParameterTypes().length!=methodParamsArray.length) return null; if (!isVisibilityOverride(mmods,methodThatMightBeGettingOverridden,inSamePackage)) return null; if (typeToCheck.getWorld().forDEBUG_bridgingCode) System.err.println(" Bridging:seriously considering this might be getting overridden '"+methodThatMightBeGettingOverridden+"'"); boolean sameParams = true; for (int p = 0;p<methodThatMightBeGettingOverridden.getParameterTypes().length;p++) { if (!methodThatMightBeGettingOverridden.getParameterTypes()[p].getErasureSignature().equals(methodParamsArray[p].getErasureSignature())) sameParams = false; }
232,712
Bug 232712 ClassFormatError during LTW using annotation approach
The following exception is obtained when using the annotation approach and load-time weaving: [AppClassLoader@1f12c4e] info AspectJ Weaver Version 1.5.4 built on Thursday Dec 20, 2007 at 13:44:10 GMT [AppClassLoader@1f12c4e] info register classloader sun.misc.Launcher$AppClassLoader@1f12c4e [AppClassLoader@1f12c4e] info using configuration /H:/temp/aspectj_bug/scratch/classes/scratch/aop/annotationbug/aspect/aop-bug.xml [AppClassLoader@1f12c4e] info register aspect scratch.aop.annotationbug.aspect.BugAspect doSomething() Exception in thread "main" java.lang.ClassFormatError: Code attribute in native or abstract methods in class file scratch/aop/annotationbug/extra/SubClass at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:620) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124) at java.net.URLClassLoader.defineClass(URLClassLoader.java:260) at java.net.URLClassLoader.access$000(URLClassLoader.java:56) at java.net.URLClassLoader$1.run(URLClassLoader.java:195) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276) at java.lang.ClassLoader.loadClass(ClassLoader.java:251) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319) at scratch.aop.annotationbug.extra.BugOther.getSubClass(BugOther.java:22) at scratch.aop.annotationbug.main.BugMain.somethingElse(BugMain.java:36) at scratch.aop.annotationbug.main.BugMain.doSomething(BugMain.java:30) at scratch.aop.annotationbug.main.BugMain.execute(BugMain.java:24) at scratch.aop.annotationbug.main.BugDriver.doExecute(BugDriver.java:27) at scratch.aop.annotationbug.main.BugDriver.main(BugDriver.java:21) The same advice logic does not result in a ClassFormatError when using the Aspect approach, it only appears using the annotation approach. Unfortunately we have not been able to track down exactly why the above Error occurs but have attached a test case that manifests it. To run simply use the runtime configuration on the BugDriver main(): -Dorg.aspectj.weaver.loadtime.configuration="scratch/aop/annotationbug/aspect/aop-bug.xml" Along with the AspectJ Load-Time Weaver Agent. The above occurs with both AspectJ 1.5.4 and AspectJ 1.6.0. Interestingly when using the aspectj 1.6.0 weaver, the AppClassLoader log still indicates "1.5.4".
resolved fixed
f014275
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2008-05-20T18:30:38Z
2008-05-18T22:33:20Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
if (sameParams) { if (typeToCheck.isParameterizedType()) { return methodThatMightBeGettingOverridden.getBackingGenericMember(); } else if (!methodThatMightBeGettingOverridden.getReturnType().getErasureSignature().equals(mrettype)) { ResolvedType superReturn = typeToCheck.getWorld().resolve(UnresolvedType.forSignature(methodThatMightBeGettingOverridden.getReturnType().getErasureSignature())); ResolvedType subReturn = typeToCheck.getWorld().resolve(UnresolvedType.forSignature(mrettype)); if (superReturn.isAssignableFrom(subReturn)) return methodThatMightBeGettingOverridden; } } return null; } /** * Looks at the visibility modifiers between two methods, and knows whether they are from classes in * the same package, and decides whether one overrides the other. * @return true if there is an overrides rather than a 'hides' relationship */ static boolean isVisibilityOverride(int methodMods, ResolvedMember inheritedMethod,boolean inSamePackage) { if (inheritedMethod.isStatic()) return false; if (methodMods == inheritedMethod.getModifiers()) return true; if (inheritedMethod.isPrivate()) return false; boolean isPackageVisible = !inheritedMethod.isPrivate() && !inheritedMethod.isProtected() && !inheritedMethod.isPublic(); if (isPackageVisible && !inSamePackage) return false;