Bug 76355 - Utility.java:1024 from BcelWorld.java:155 org.apache.bcel.classfile.ClassFormatException: Invalid method signature: <missing>
Summary: Utility.java:1024 from BcelWorld.java:155 org.apache.bcel.classfile.ClassForm...
Status: RESOLVED DUPLICATE of bug 73504
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: 1.5.0M3   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 1.5.0 M4   Edit
Assignee: Adrian Colyer CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-10-15 10:07 EDT by Frederic Bages CLA
Modified: 2005-09-24 05:57 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Frederic Bages CLA 2004-10-15 10:07:16 EDT
When using AspectJ from Maven if there is a missing dependency (here 
JAXRPC-SPI) The AspectJ compiler crash when compiling an aspect. 
 
Aspect : 
 
public aspect KernelPerformanceLogger { 
 
 private static Log log = 
LogFactory.getLog( "KernelPerformanceLoggerAspect" ); 
 private static long startTime = 0; 
  
 pointcut myClass(): target(com.XXX.Kernel) && call(public * *(..)); 
  
    Object around() : myClass() {  
        long start = System.currentTimeMillis(); 
        try { 
            return proceed(); 
        } finally { 
            long end = System.currentTimeMillis(); 
            recordTime(start, end, thisJoinPointStaticPart.getSignature()); 
        } 
    }  
 
    private void recordTime( long start, long end, Signature sig ) { 
      
  long duration = end - start; 
   
  // Only apply if debug is enabled. 
  if ( log.isDebugEnabled() ) { 
    
   StringBuffer buffer = new StringBuffer( 50 ); 
   buffer.append( sig.toString() ) 
    .append( " took " ) 
    .append( duration ) 
    .append( " ms." ); 
   log.debug( buffer ); 
  } 
 } 
 
} 
 
Stack trace when compiler crash : 
 
 __  __ 
|  \/  |__ _Apache__ ___ 
| |\/| / _` \ V / -_) ' \  ~ intelligent projects ~ 
|_|  |_\__,_|\_/\___|_||_|  v. 1.0 
 
build:start: 
 
clean:clean: 
    [delete] Deleting directory XXX 
 
clean: 
 
war:init: 
 
java:prepare-filesystem: 
    [mkdir] Created dir: XXX/target/classes 
Weaving into: XXX-kernel 
Weaving into: XXX-shared 
Weaving into: XXX-ws-client 
warning couldn't find aspectjrt.jar on classpath, checked: 
 
trouble in: 
ABORT 
 
Exception thrown from AspectJ 1.2 
 
This might be logged as a bug already -- find current bugs at 
  http://bugs.eclipse.org/bugs/buglist.cgi?product=AspectJ&component=Compiler 
 
Bugs for exceptions thrown have titles File:line from the top stack, 
e.g., "SomeFile.java:243" 
 
If you don't find the exception below in a bug, please add a new bug 
at http://bugs.eclipse.org/bugs/enter_bug.cgi?product=AspectJ 
To make the bug a priority, please include a test program 
that can reproduce this exception. 
Invalid method signature: <missing> 
Invalid method signature: <missing> 
org.apache.bcel.classfile.ClassFormatException: Invalid method signature: 
<missing> 
        at org.apache.bcel.classfile.Utility.typeOfSignature(Utility.java:1024) 
        at org.apache.bcel.generic.Type.getType(Type.java:158) 
        at org.aspectj.weaver.bcel.BcelWorld.makeBcelType(BcelWorld.java:155) 
        at org.aspectj.weaver.bcel.BcelVar.createStore(BcelVar.java:47) 
        at 
org.aspectj.weaver.bcel.BcelShadow.initializeArgVars(BcelShadow.java:1082) 
        at 
org.aspectj.weaver.bcel.BcelShadow.initializeForAroundClosure(BcelShadow.java:1107) 
        at org.aspectj.weaver.bcel.BcelAdvice.specializeOn(BcelAdvice.java:74) 
        at 
org.aspectj.weaver.bcel.BcelShadow.prepareForMungers(BcelShadow.java:257) 
        at org.aspectj.weaver.Shadow.implement(Shadow.java:324) 
        at 
org.aspectj.weaver.bcel.BcelClassWeaver.implement(BcelClassWeaver.java:1145) 
        at 
org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:357) 
        at 
org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:80) 
        at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:724) 
        at 
org.aspectj.weaver.bcel.BcelWeaver.weaveWithoutDump(BcelWeaver.java:689) 
        at 
org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:615) 
        at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:563) 
        at 
org.aspectj.ajdt.internal.compiler.AjCompilerAdapter.weave(AjCompilerAdapter.java:239) 
        at 
org.aspectj.ajdt.internal.compiler.AjCompilerAdapter.afterCompiling(AjCompilerAdapter.java:114) 
        at 
org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:376) 
        at 
org.aspectj.ajdt.internal.core.builder.AjBuildManager.performCompilation(AjBuildManager.java:601) 
        at 
org.aspectj.ajdt.internal.core.builder.AjBuildManager.doBuild(AjBuildManager.java:160) 
        at 
org.aspectj.ajdt.internal.core.builder.AjBuildManager.batchBuild(AjBuildManager.java:94) 
        at org.aspectj.ajdt.ajc.AjdtCommand.doCommand(AjdtCommand.java:102) 
        at org.aspectj.ajdt.ajc.AjdtCommand.runCommand(AjdtCommand.java:53) 
        at org.aspectj.tools.ajc.Main.run(Main.java:280) 
        at org.aspectj.tools.ajc.Main.runMain(Main.java:217) 
        at 
org.aspectj.tools.ant.taskdefs.AjcTask.executeInSameVM(AjcTask.java:1157) 
        at org.aspectj.tools.ant.taskdefs.AjcTask.execute(AjcTask.java:954) 
        at org.apache.tools.ant.Task.perform(Task.java:341) 
        at org.apache.commons.jelly.tags.ant.AntTag.doTag(AntTag.java:232) 
        at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:279) 
        at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:135) 
        at org.apache.commons.jelly.impl.DynamicTag.doTag(DynamicTag.java:125) 
        at 
org.apache.commons.jelly.impl.StaticTagScript.run(StaticTagScript.java:145) 
        at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:135) 
        at org.apache.commons.jelly.TagSupport.invokeBody(TagSupport.java:233) 
        at org.apache.commons.jelly.tags.core.IfTag.doTag(IfTag.java:88) 
        at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:279) 
        at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:135) 
        at 
org.apache.maven.jelly.tags.werkz.MavenGoalTag.runBodyTag(MavenGoalTag.java:79) 
        at 
org.apache.maven.jelly.tags.werkz.MavenGoalTag$MavenGoalAction.performAction(MavenGoalTag.java:110) 
        at com.werken.werkz.Goal.fire(Goal.java:639) 
        at com.werken.werkz.Goal.attain(Goal.java:575) 
        at com.werken.werkz.Goal.attainPrecursors(Goal.java:488) 
        at com.werken.werkz.Goal.attain(Goal.java:573) 
        at com.werken.werkz.Goal.attainPrecursors(Goal.java:488) 
        at com.werken.werkz.Goal.attain(Goal.java:573) 
        at com.werken.werkz.WerkzProject.attainGoal(WerkzProject.java:193) 
        at 
org.apache.maven.jelly.tags.werkz.MavenAttainGoalTag.doTag(MavenAttainGoalTag.java:127) 
        at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:279) 
        at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:135) 
        at org.apache.commons.jelly.TagSupport.invokeBody(TagSupport.java:233) 
        at com.werken.werkz.jelly.PreGoalTag$1.firePreGoal(PreGoalTag.java:87) 
        at com.werken.werkz.Goal.firePreGoalCallbacks(Goal.java:691) 
        at com.werken.werkz.Goal.fire(Goal.java:616) 
        at com.werken.werkz.Goal.attain(Goal.java:575) 
        at com.werken.werkz.Goal.attainPrecursors(Goal.java:488) 
        at com.werken.werkz.Goal.attain(Goal.java:573) 
        at com.werken.werkz.Goal.attainPrecursors(Goal.java:488) 
        at com.werken.werkz.Goal.attain(Goal.java:573) 
        at com.werken.werkz.Goal.attainPrecursors(Goal.java:488) 
        at com.werken.werkz.Goal.attain(Goal.java:573) 
        at com.werken.werkz.Goal.attainPrecursors(Goal.java:488) 
        at com.werken.werkz.Goal.attain(Goal.java:573) 
        at com.werken.werkz.WerkzProject.attainGoal(WerkzProject.java:193) 
        at 
org.apache.maven.plugin.PluginManager.attainGoals(PluginManager.java:634) 
        at org.apache.maven.MavenSession.attainGoals(MavenSession.java:266) 
        at org.apache.maven.cli.App.doMain(App.java:486) 
        at org.apache.maven.cli.App.main(App.java:1215) 
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 
        at java.lang.reflect.Method.invoke(Method.java:324) 
        at com.werken.forehead.Forehead.run(Forehead.java:551) 
        at com.werken.forehead.Forehead.main(Forehead.java:581) 
 
 
java:compile: 
aspectj:init: 
 
aspectj:compile: 
    [iajc] Copied 1 empty directory to XXX/target/classes 
 
BUILD FAILED 
File...... XXX/.maven/cache/maven-aspectj-plugin-3.1.1/plugin.jelly 
Element... ant:iajc 
Line...... 58 
Column.... 46 
fail due to ClassFormatException "Invalid method signature: 
<missing>""ABORT" (1 exceptions) 
Total time: 13 seconds 
Finished at: Fri Oct 15 15:41:31 CEST 2004 
 
If we remove the aspect the error is : 
 
 
  \/  |__ _Apache__ ___ 
| |\/| / _` \ V / -_) ' \  ~ intelligent projects ~ 
|_|  |_\__,_|\_/\___|_||_|  v. 1.0 
 
build:start: 
 
clean:clean: 
    [delete] Deleting directory XXX/target 
 
clean: 
 
war:init: 
 
java:prepare-filesystem: 
    [mkdir] Created dir: XXX/target/classes 
Weaving into: XXX-kernel 
Weaving into: XXX-shared 
Weaving into: XXX-ws-client 
warning couldn't find aspectjrt.jar on classpath, checked: 
 
XXX/.maven/repository/XXX/jars/XXX-ws-client-0.1.jar error can't find type 
com.sun.xml.rpc.spi.runtime.StubBase 
(no source information available) 
 
 
java:compile: 
aspectj:init: 
 
aspectj:compile: 
    [iajc] Copied 1 empty directory to XXX/target/classes 
MessageHolder:  (1 warning)  (1 error) 
[error   0]: error at (no source information available) 
XXX/.maven/repository/XXX/jars/XXX-ws-client-0.1.jar:0 can't find type 
com.sun.xml.rpc.spi.runtime.StubBase 
 
BUILD FAILED 
File...... XXX/.maven/cache/maven-aspectj-plugin-3.1.1/plugin.jelly 
Element... ant:iajc 
Line...... 58 
Column.... 46 
1 errors 
Total time: 10 seconds 
Finished at: Fri Oct 15 15:40:30 CEST 2004 
 
If we add the dependency the build finish successfully.
Comment 1 Frederic Bages CLA 2004-10-15 10:24:47 EDT
In fact it seems that it's when i uncomment the following part of the aspect : 
 
    Object around() : myClass() {  
        long start = System.currentTimeMillis(); 
        try { 
            return proceed(); 
        } finally { 
            long end = System.currentTimeMillis(); 
            //recordTime(start, end, thisJoinPointStaticPart.getSignature()); 
        } 
    }  
 
Even with the dependency added the problem is still present. I use this aspect 
in another project but not to wave libraries. 
Comment 2 Frederic Bages CLA 2004-10-15 10:35:08 EDT
OK, there were some other libraries that were missing. My understanding of the 
problem is that if we try to wave libraries that have dependencies whitout 
adding these dependencies to Maven project.xml that crash the compiler. Now 
that i've added all the dependencies the aspect is being compiled correctly.  
Comment 3 Andrew Clement CLA 2004-10-15 11:21:35 EDT
Hi.  I hope to get to this bug soon (early next week?) - you shouldn't be able
to make the compiler crash.  Is there any way you can keep around the setup you
have that causes it to appear so I can try and fix it and let you see if my fix
works? (I imagine I'll have trouble trying to recreate it here).

let me know, thanks,
Andy.
Comment 4 Frederic Bages CLA 2004-10-15 11:48:22 EDT
I've made a backup to be able to test your patch if needed. It seems (not sure) 
to appear when weaving a webservice client library made with JSWDP 1.4 
(JAX-RPC) ... I'am on holiday next week so i won't be able to check my mail 
until October 25. 
 
Have a nice WE. 
 
Comment 5 Andrew Clement CLA 2005-03-23 08:51:09 EST
I'll do something about this before 1.5.0M3 !
Comment 6 Adrian Colyer CLA 2005-08-26 11:13:22 EDT
not sure where Andy got to on this, but we shouldn't lose sight of it in the
run-up to M4
Comment 7 Adrian Colyer CLA 2005-09-24 05:57:44 EDT
This is the same issue as bug 73504, for which I committed a fix this morning. The compiler is now much 
more tolerant of missing types (and the <missing> signature scenario should not be possible any more).

Fix will be available in next published AspectJ dev build (later on today).

*** This bug has been marked as a duplicate of 73504 ***