Bug 243192 - ClassGenException after upgrade from 1.6.0 to 1.6.1
Summary: ClassGenException after upgrade from 1.6.0 to 1.6.1
Status: RESOLVED FIXED
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: 1.6.1   Edit
Hardware: Macintosh Mac OS X - Carbon (unsup.)
: P3 normal (vote)
Target Milestone: 1.6.2   Edit
Assignee: aspectj inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-08-05 12:12 EDT by Tom Duffey CLA
Modified: 2008-08-19 11:44 EDT (History)
1 user (show)

See Also:


Attachments
ajcore file (732.73 KB, text/plain)
2008-08-05 12:12 EDT, Tom Duffey CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tom Duffey CLA 2008-08-05 12:12:46 EDT
Created attachment 109179 [details]
ajcore file

Upgraded to Spring 2.5.6 nightly build which includes AspectJ 1.6.1.  Now my project doesn't compile and this seems to be caused by the upgrade to AspectJ 1.6.1:

 [iajc] -- (ClassGenException) Do not attempt to modify the index for this constant instruction: aload_0[42](size1)
     [iajc] Do not attempt to modify the index for this constant instruction: aload_0[42](size1)
     [iajc] org.aspectj.apache.bcel.generic.ClassGenException: Do not attempt to modify the index for this constant instruction: aload_0[42](size1)
     [iajc] at org.aspectj.apache.bcel.generic.InstructionCLV.setIndex(InstructionCLV.java:19)
     [iajc] at org.aspectj.weaver.bcel.BcelClassWeaver.genInlineInstructions(BcelClassWeaver.java:1949)
     [iajc] at org.aspectj.weaver.bcel.BcelClassWeaver.inlineMethod(BcelClassWeaver.java:1429)
     [iajc] at org.aspectj.weaver.bcel.BcelClassWeaver.inlineSelfConstructors(BcelClassWeaver.java:1352)
     [iajc] at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:502)
     [iajc] at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:105)
     [iajc] at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1669)
     [iajc] at org.aspectj.weaver.bcel.BcelWeaver.weaveWithoutDump(BcelWeaver.java:1620)
     [iajc] at org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1393)
     [iajc] at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1213)
     [iajc] at org.aspectj.ajdt.internal.compiler.AjPipeliningCompilerAdapter.weaveQueuedEntries(AjPipeliningCompilerAdapter.java:454)
     [iajc] at org.aspectj.ajdt.internal.compiler.AjPipeliningCompilerAdapter.queueForWeaving(AjPipeliningCompilerAdapter.java:391)
     [iajc] at org.aspectj.ajdt.internal.compiler.AjPipeliningCompilerAdapter.afterProcessing(AjPipeliningCompilerAdapter.java:379)
     [iajc] at org.aspectj.ajdt.internal.compiler.CompilerAdapter.ajc$after$org_aspectj_ajdt_internal_compiler_CompilerAdapter$5$6b855184(CompilerAdapter.aj:98)
     [iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.process(Compiler.java:641)
     [iajc] at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:392)
     [iajc] at org.aspectj.ajdt.internal.core.builder.AjBuildManager.performCompilation(AjBuildManager.java:995)
     [iajc] at org.aspectj.ajdt.internal.core.builder.AjBuildManager.doBuild(AjBuildManager.java:269)
     [iajc] at org.aspectj.ajdt.internal.core.builder.AjBuildManager.batchBuild(AjBuildManager.java:184)
     [iajc] at org.aspectj.ajdt.ajc.AjdtCommand.doCommand(AjdtCommand.java:112)
     [iajc] at org.aspectj.ajdt.ajc.AjdtCommand.runCommand(AjdtCommand.java:60)
     [iajc] at org.aspectj.tools.ajc.Main.run(Main.java:382)
     [iajc] at org.aspectj.tools.ajc.Main.runMain(Main.java:254)
     [iajc] at org.aspectj.tools.ant.taskdefs.AjcTask.executeInSameVM(AjcTask.java:1307)
     [iajc] at org.aspectj.tools.ant.taskdefs.AjcTask.execute(AjcTask.java:1105)
     [iajc] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
     [iajc] at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
     [iajc] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
     [iajc] at java.lang.reflect.Method.invoke(Method.java:597)
     [iajc] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
     [iajc] at org.apache.tools.ant.Task.perform(Task.java:348)
     [iajc] at org.apache.tools.ant.Target.execute(Target.java:357)
     [iajc] at org.apache.tools.ant.Target.performTasks(Target.java:385)
     [iajc] at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
     [iajc] at org.apache.tools.ant.Project.executeTarget(Project.java:1298)
     [iajc] at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
     [iajc] at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
     [iajc] at org.apache.tools.ant.Main.runBuild(Main.java:698)
     [iajc] at org.apache.tools.ant.Main.startAnt(Main.java:199)
     [iajc] at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
     [iajc] at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
Comment 1 Andrew Clement CLA 2008-08-05 12:18:51 EDT
Juergen pinged me about this, I'll take a look. 
Comment 2 Andrew Clement CLA 2008-08-13 12:16:29 EDT
This is clearly due to the refactoring changes in 1.6.1 where the bytecode stuff had a major overhaul.  However, I don't think it is a new bug, I think it has surfaced because there are more checks in at weaving time now that bad code isn't produced - so previously we would have produced bad code that may or may not had failed at runtime, but now we catch we are about to produce bad code and the weaver stops in its tracks.
Comment 3 Andrew Clement CLA 2008-08-13 14:19:56 EDT
ok - I've fixed this and also introduced some enhancements to reduce creation of unnecessary garbage.  When the instructions were read in we were creating multiple instances of constant instructions (like ALOAD_0) where we could have shared the single instance already defined as a constant.  By changing the read logic this created a lot of constant instructions in the weaver that we then attempted to modify by changing the index to other than that fixed in the constant instruction.  So I introduced a new method, kind of 'setIndexToNewValueAndCreateMeANewInstructionIfINeedIt(int newIndex)' method.  This fixes the bug raised here and means we will share constant instructions whenever we can.

fix will be in next dev build.

Are you able to try out a dev build of AspectJ 1.6.2 or is that not possible in your configuration?

Comment 4 Tom Duffey CLA 2008-08-13 14:22:48 EDT
(In reply to comment #3)

> 
> fix will be in next dev build.
> 
> Are you able to try out a dev build of AspectJ 1.6.2 or is that not possible in
> your configuration?
> 

Yes, just point me to the dev build when it is ready and I'll give it a try.  Thanks for the help!
Comment 5 Andrew Clement CLA 2008-08-14 00:48:31 EDT
Hi Tom - this change is now in a dev build:

http://www.eclipse.org/downloads/download.php?file=/tools/aspectj/dev/aspectj-DEVELOPMENT-20080813202245.jar

I would appreciate any feedback if you find any time to give it a go.
Comment 6 Tom Duffey CLA 2008-08-19 10:54:22 EDT
(In reply to comment #5)
> Hi Tom - this change is now in a dev build:
> 
> http://www.eclipse.org/downloads/download.php?file=/tools/aspectj/dev/aspectj-DEVELOPMENT-20080813202245.jar
> 
> I would appreciate any feedback if you find any time to give it a go.

So far so good.  Project builds and has been running OK in testing.  Thank you!

Comment 7 Andrew Clement CLA 2008-08-19 11:44:28 EDT
thanks for trying it out and letting me know.