Bug 353467 - VerifyError: Expecting a stackmap frame
Summary: VerifyError: Expecting a stackmap frame
Status: RESOLVED FIXED
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: 1.6.11   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: 1.7.0   Edit
Assignee: aspectj inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-07-31 10:57 EDT by Mario Ivankovits CLA
Modified: 2012-03-07 16:37 EST (History)
4 users (show)

See Also:


Attachments
Project to reproduce the problem (8.66 MB, application/x-zip-compressed)
2011-07-31 11:04 EDT, Mario Ivankovits CLA
no flags Details
Class file failing to be loaded (24.01 KB, application/octet-stream)
2011-11-28 18:36 EST, Mike Youngstrom CLA
no flags Details
javap of ProjectController (154.72 KB, text/plain)
2011-11-28 18:38 EST, Mike Youngstrom CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mario Ivankovits CLA 2011-07-31 10:57:54 EDT
When using AspectJ to weave already Java 7 built class files, the following exception appears:

     [java] Caused by: java.lang.VerifyError: Expecting a stackmap frame at branch target 15 in method TestBean.myMethod(Ljava/lang/Object;)V at offset 4
     [java]     at java.lang.Class.forName0(Native Method)
     [java]     at java.lang.Class.forName(Class.java:264)


Steps to reproduce:
* Download the attached zip file
* ensure JAVA_HOME is set to your Java 7 JDK
* please update the jdk.home path in reproduce.properties also
* ant -f reproduce.xml run

This compiles the files using javac and weaves the class files.
I stripped out all the code not necessary, so, the compiled result will not do what their class names suggest ;-)

As a workaround one can use -XX:-UseSplitVerifier to activate the old verifier.
Comment 1 Mario Ivankovits CLA 2011-07-31 11:04:34 EDT
Created attachment 200632 [details]
Project to reproduce the problem
Comment 2 Mario Ivankovits CLA 2011-07-31 11:06:03 EDT
I hope you manage to find the problem.

Thanks for your help in advance!
Mario
Comment 3 Andrew Clement CLA 2011-10-03 18:56:45 EDT
believed fixed.  AspectJ now auto activates the previously optional setting to create stackmaps if the classes are Java7.  Please reopen if still an issue.
Comment 4 Mike Youngstrom CLA 2011-11-28 15:15:31 EST
Is this fix included in AJDT milestone released on 10/04?

http://download.eclipse.org/tools/ajdt/37/milestone/

After updating to that milestone I'm still seeing this error.
Comment 5 Andrew Clement CLA 2011-11-28 15:18:42 EST
Hi Mike - I would have thought it was but I'm not 100% sure I tried the changes out under AJDT, my testcases will have only tried it on the command line.  Are you able to try out a dev build?  If it still isn't working there we should reopen this.
Comment 6 Mike Youngstrom CLA 2011-11-28 15:48:22 EST
I updated to latest dev build here:

http://download.eclipse.org/tools/ajdt/37/dev/update/

I am getting the same error.  Perhaps I just have an odd corner case in my code?  If you cannot duplicate the issue with AJDT using your test case I'll see if I can create a test case.


Here is an example trace when Spring IDE attempts to load the class:

!MESSAGE Internal Error
!STACK 0
java.lang.VerifyError: Expecting a stackmap frame at branch target 151 in method org.lds.keystone.view.ProjectController.getLinks(Ljavax/servlet/http/HttpServletRequest;)Ljava/util/List; at offset 43
	at java.lang.Class.getDeclaredMethods0(Native Method)
	at java.lang.Class.privateGetDeclaredMethods(Class.java:2442)
	at java.lang.Class.getDeclaredMethods(Class.java:1808)
	at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:467)
	at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:451)
	at org.springframework.ide.eclipse.aop.core.internal.model.builder.AspectDefinitionMatcher.internalMatches(AspectDefinitionMatcher.java:272)
	at org.springframework.ide.eclipse.aop.core.internal.model.builder.AspectDefinitionMatcher.matches(AspectDefinitionMatcher.java:92)
	at org.springframework.ide.eclipse.aop.core.internal.model.builder.AopReferenceModelBuilderJob$1.doWithActiveProjectClassLoader(AopReferenceModelBuilderJob.java:251)
	at org.springframework.ide.eclipse.core.java.JdtUtils$DefaultProjectClassLoaderSupport.executeCallback(JdtUtils.java:889)
	at org.springframework.ide.eclipse.aop.core.internal.model.builder.AopReferenceModelBuilderJob.buildAopReferencesForBean(AopReferenceModelBuilderJob.java:207)
	at org.springframework.ide.eclipse.aop.core.internal.model.builder.AopReferenceModelBuilderJob.buildAopReferencesForBeans(AopReferenceModelBuilderJob.java:279)
	at org.springframework.ide.eclipse.aop.core.internal.model.builder.AopReferenceModelBuilderJob.buildAopReferencesForBeansConfig(AopReferenceModelBuilderJob.java:302)
	at org.springframework.ide.eclipse.aop.core.internal.model.builder.AopReferenceModelBuilderJob.buildAopReferencesFromBeansConfigSets(AopReferenceModelBuilderJob.java:401)
	at org.springframework.ide.eclipse.aop.core.internal.model.builder.AopReferenceModelBuilderJob.buildAopReferencesForFile(AopReferenceModelBuilderJob.java:359)
	at org.springframework.ide.eclipse.aop.core.internal.model.builder.AopReferenceModelBuilderJob.buildAopModel(AopReferenceModelBuilderJob.java:453)
	at org.springframework.ide.eclipse.aop.core.internal.model.builder.AopReferenceModelBuilderJob.run(AopReferenceModelBuilderJob.java:159)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Comment 7 Mike Youngstrom CLA 2011-11-28 15:51:30 EST
I am doing a Project->Clean so I don't believe it is trying to load some version of the class compiled with the old aspectj.
Comment 8 Andrew Clement CLA 2011-11-28 18:06:54 EST
You could manually check the class to determine if it had the stackmap frame in:

javap -private -verbose org.lds.keystone.view.ProjectController

and check if the method shows a StackMap on it (and that the version number of the class file, up near the top, is 51).

or - you could email me the class and I'll take a look.

This would enable us to determine if it had a bad stackmap (missing a frame) or no stackmap at all.
Comment 9 Mike Youngstrom CLA 2011-11-28 18:36:41 EST
Created attachment 207633 [details]
Class file failing to be loaded

Here is the class file that is failing to be loaded.
Comment 10 Mike Youngstrom CLA 2011-11-28 18:38:46 EST
Created attachment 207634 [details]
javap of ProjectController

The class file version is 51.

The org.aspectj.weaver.WeaverVersion is: 00 07 00 00 00 00 01 32 CC 21 E9 18

Is that correct?

I don't see any StackMap information in the file.
Comment 11 Andrew Clement CLA 2011-11-28 19:02:08 EST
let's reopen and I'll look at this when I get a sec
Comment 12 Andrew Clement CLA 2012-03-07 16:37:25 EST
Ok, I have gotten to the bottom of this.  It was due to the packaging process that puts AspectJ into AJDT. 

Another condition of building the stackmaps for Java7 verification is that the Asm classes are around to do so - if they aren't around the step is just skipped rather than throwing an error (this is a hangover from when during the stackmap gen was entirely optional).

By Asm classes I mean the jarjar'd variant AspectJ uses (prefix is 'aj.').  The current packaging process wasn't including these in AJDT. When I adjust the packaging step to ensure these are included in the weaver jar for AJDT, it all works.

Should be in an AJDT dev build later today (eclipse 3.7).