Bug 66222 - NoSuchMethodError in BCEL
Summary: NoSuchMethodError in BCEL
Status: RESOLVED DUPLICATE of bug 61374
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: 1.2   Edit
Hardware: Macintosh Mac OS X - Carbon (unsup.)
: P3 normal (vote)
Target Milestone: 1.2.1   Edit
Assignee: Jim Hugunin CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-06-08 16:45 EDT by Ulf Dittmer CLA
Modified: 2004-10-21 04:31 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 Ulf Dittmer CLA 2004-06-08 16:45:32 EDT
The following error message and stack trace is generated when compiling the three files appended at 
the very end. This compiles fine in AspectJ 1.1.1. I don't think I have an older BCEL version in my 
classpath which might be causing this. The Java files are simplified as much as possible.
==========================================
trouble in: 
public class Point3D extends Point2D:
  float z
  private static final org.aspectj.lang.JoinPoint$StaticPart ajc$tjp_0
  public void <init>(float, float, float):
                    ALOAD_0     // Point3D this   (line 5)
                    FLOAD_1     // float arg0
                    FLOAD_2     // float _y
                    INVOKESPECIAL Point2D.<init> (FF)V
    constructor-execution(void Point3D.<init>(float, float, float))
    |               ALOAD_0     // Point3D this   (line 6)
    |               FLOAD_3     // float _z
    | field-set(float Point3D.z)
    | |             PUTFIELD Point3D.z F
    | field-set(float Point3D.z)
    |               RETURN   (line 7)
    constructor-execution(void Point3D.<init>(float, float, float))
  end public void <init>(float, float, float)

  public void move(float, float, float):
    method-execution(void Point3D.move(float, float, float))
    |               ALOAD_0     // Point3D this   (line 10)
    |               FLOAD_1     // float dx
    |               FLOAD_2     // float dy
    |               INVOKESPECIAL Point2D.move (FF)V
    |               ALOAD_0     // Point3D this   (line 11)
    |               DUP
    | field-get(float Point3D.z)
    | |             GETFIELD Point3D.z F
    | field-get(float Point3D.z)
    |               FLOAD_3     // float dz
    |               FADD
    | field-set(float Point3D.z)
    | |             PUTFIELD Point3D.z F
    | field-set(float Point3D.z)
    |               RETURN   (line 12)
    method-execution(void Point3D.move(float, float, float))
  end public void move(float, float, float)

  public static void main(String[]):
    method-execution(void Point3D.main(java.lang.String[]))
    |               NEW Point3D   (line 15)
    |               DUP
    |               FCONST_1
    |               FCONST_2
    |               LDC 3.0
    | constructor-call(void Point3D.<init>(float, float, float))
    | |             INVOKESPECIAL Point3D.<init> (FFF)V
    | constructor-call(void Point3D.<init>(float, float, float))
    |               ASTORE_1
    |               ALOAD_1     // Point3D p3D   (line 17)
    |               FCONST_1
    |               FCONST_1
    |               FCONST_1
    |               FSTORE_2
    |               FSTORE_3
    |               FSTORE 4
    |               ASTORE 5
    | method-call(void Point3D.move(float, float, float))
    | |             INVOKEVIRTUAL Point3D.move (FFF)V
    | method-call(void Point3D.move(float, float, float))
    |               RETURN   (line 18)
    method-execution(void Point3D.main(java.lang.String[]))
  end public static void main(String[])

end public class Point3D
/Users/ulf/Development/Java/Code/Misc/Point/bug/Point3D.java error
Internal compiler error
java.lang.NoSuchMethodError: org.apache.bcel.generic.InstructionFactory.createNewArray(Lorg/apache/
bcel/generic/Type;S)Lorg/apache/bcel/generic/Instruction;
        at org.aspectj.weaver.bcel.BcelShadow.makeArgsObjectArray(BcelShadow.java:1032)
        at org.aspectj.weaver.bcel.BcelShadow.createThisJoinPoint(BcelShadow.java:980)
        at org.aspectj.weaver.bcel.BcelShadow.initializeThisJoinPoint(BcelShadow.java:890)        at 
org.aspectj.weaver.bcel.BcelShadow.prepareForMungers(BcelShadow.java:260)
        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.ajc.Main.main(Main.java:79)

(no source information available)
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.
org.apache.bcel.generic.InstructionFactory.createNewArray(Lorg/apache/bcel/generic/Type;S)Lorg/
apache/bcel/generic/Instruction;
org.apache.bcel.generic.InstructionFactory.createNewArray(Lorg/apache/bcel/generic/Type;S)Lorg/
apache/bcel/generic/Instruction;
java.lang.NoSuchMethodError: org.apache.bcel.generic.InstructionFactory.createNewArray(Lorg/apache/
bcel/generic/Type;S)Lorg/apache/bcel/generic/Instruction;
        at org.aspectj.weaver.bcel.BcelShadow.makeArgsObjectArray(BcelShadow.java:1032)
        at org.aspectj.weaver.bcel.BcelShadow.createThisJoinPoint(BcelShadow.java:980)
        at org.aspectj.weaver.bcel.BcelShadow.initializeThisJoinPoint(BcelShadow.java:890)        at 
org.aspectj.weaver.bcel.BcelShadow.prepareForMungers(BcelShadow.java:260)
        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.ajc.Main.main(Main.java:79)


1 fail|abort, 1 error

=============================================
aspect MoveAspect {

  pointcut move3D (Point3D p, float x, float y, float z):
    (call(void Point3D.move(float, float, float)) && args(x, y, z) && target(p)); 

  before (Point3D p, float x, float y, float z): move3D(p,x,y,z) {
    System.out.println("Entering: " + thisJoinPoint);
    System.out.println("Moving " + p + " by [" + x + ", " + y + ", " + z + "]");
  }
}
=============================================
public class Point2D {
	float	x,y;

	public Point2D (float _x, float _y) {
		x = _x;
		y = _y;
	}

	public void move (float dx, float dy) {
		x += dx;
		y += dy;
	}
}
=============================================
public class Point3D extends Point2D {
	float	z;

	public Point3D (float _x, float _y, float _z) {
		super(_x, _y);
		z = _z;
	}

	public void move (float dx, float dy, float dz) {
		super.move(dx, dy);
		z += dz;
	}

	public static void main (String argv[]) {
		Point3D p3D = new Point3D(1.0f, 2.0f, 3.0f);

		p3D.move(1.0f, 1.0f, 1.0f);
	}
}
Comment 1 Andrew Clement CLA 2004-06-09 03:18:43 EDT
We have found that some versions of Java have used a version of BCEL in their
implementation.  For example I have an IBM JVM that contains bcel classes -
however, it is only older JVMs that have this problem.  All recent JVMs that we
have tried do not have BCEL classes in them.  To confirm if you have this
problem, use the guidance I put in bug 59921 which I'll quote here:

---
You can check if this is the problem you are seeing by going to the 
command line, unsetting your classpath and running (with no aspectj stuff
anywhere on your classpath):

javap org.apache.bcel.generic.InstructionFactory

If that runs, you have a JVM that includes BCEL.  If the version of BCEL 
is 'old' then the return type of the createNewArray method in the javap output 
will be AllocationInstruction.

If this is happening to you, upgrade your JVM to a more recent version and it 
should be fixed - i.e. the javap command above should *fail*!  Whilst you have 
a JVM with that old version of BCEL in, aspectj will never be able to load its 
more recent versions of the bcel classes.
---
Comment 2 Ulf Dittmer CLA 2004-06-10 15:37:01 EDT
I have tested this, and I do not have an old version of BCEL in my classpath. java -version reports the 
following (this is on Mac OS 10.3.3):
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_03-117.1)
Java HotSpot(TM) Client VM (build 1.4.2-34, mixed mode)
Comment 3 Andrew Clement CLA 2004-07-26 03:35:11 EDT
Are you able to download a newer version of Java 1.4.2 and confirm this is still
a problem?  I've only seen this error when a version of BCEL was found that was
older than the variant in AspectJ.
Comment 4 Ulf Dittmer CLA 2004-07-26 15:39:55 EDT
Turns out my JVM doesn't have BCEL in it, but Xalan does, and it was part of my extensions. I had 
checked some usual suspects I thought might need BCEL, but Xalan hadn't occurred to me. Thanks for 
pointing me in the right direction, Andy. I'm resolving this bug to also be a duplicate of 61374.

*** This bug has been marked as a duplicate of 61374 ***
Comment 5 Adrian Colyer CLA 2004-10-21 04:31:08 EDT
Fix released as part of AspectJ 1.2.1