Bug 113118 - ClassFormatException with tracing aspect
Summary: ClassFormatException with tracing aspect
Status: RESOLVED FIXED
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: DEVELOPMENT   Edit
Hardware: PC Windows XP
: P2 normal (vote)
Target Milestone: 1.5.0RC1   Edit
Assignee: Andrew Clement CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-10-19 14:01 EDT by Dean Wampler CLA
Modified: 2005-11-16 11:09 EST (History)
0 users

See Also:


Attachments
Eclipse log file with stack traces (316.31 KB, text/plain)
2005-10-19 15:58 EDT, Dean Wampler CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Dean Wampler CLA 2005-10-19 14:01:25 EDT
Build id: 20051017111807
AspectJ version: 1.5.0.200510141300

The following aspect resulted in the CFE:

public aspect CallTrace {
	/**
	 * A marker interface used to pick the classes to trace. Declare any class you
want to
	 * trace to implement this interface. The best way is using an aspect like the
one in
	 * the class comment block above.
	 */
	public static interface Traced {}
	
	/**
	 * A marker annoation, can be used instead of {@link Traced}.
	 */
	@Documented
	@Retention(RetentionPolicy.RUNTIME)
	@Target({ElementType.TYPE, ElementType.ANNOTATION_TYPE})
	public @interface TracedAnno {}
	
	private static Level level = Level.INFO;
	
	/**
	 * Set the global logging level used for reporting traced calls. Defaults to INFO.
	 * @param newLevel
	 */
	public static void setLevel (Level newLevel) {
		level = newLevel;
	}
	
	/**
	 * @return the Level used for writing traced output.
	 */
	public static Level getLevel () {
		return level;
	}
	
	private static Logger log = Logger.getLogger(Traced.class);
	private int nesting = 0;
	private static StringBuffer prefixStr = null;
	static {
		new StringBuffer(1024);
		for (int i=0; i<128; i++) { // stuff with "+".
			prefixStr.append("++++++++"); 
		}
	}
	public pointcut exclusions(): within(CallTrace) || within(*Tracer);
	
	// Distinguish between initialization JPs and other method calls, to work
	// around AJ limitation that around advice isn't supported for initializations.
	
	public pointcut traceIntfInit(): initialization(Traced+.new(..));
	public pointcut traceIntf(): call(* Traced+.*(..));
	
	public pointcut traceAnnoInit(): 
		initialization(com.adteractive..*.new(..)) && @target(TracedAnno);
	public pointcut traceAnno(): 
		 call(* com.adteractive..*.*(..)) && @target(TracedAnno);

	public pointcut traceInit(): !exclusions() && (traceIntfInit() || traceAnnoInit());
	public pointcut trace(): !exclusions() && (traceIntf() || traceAnno());
	
	before(): traceInit() {
		nesting++;
		String pre = prefixStr.substring(0,nesting);
		log.log (level, pre+"> "+thisJoinPointStaticPart);
	}
	
	after(): traceInit() {
		String pre = prefixStr.substring(0,nesting);
		log.log (level, pre+"< "+thisJoinPointStaticPart);
		nesting--;
	}
	
	Object around(): trace() {
		nesting++;
		String pre = prefixStr.substring(0,nesting);
		log.log (level, pre+"> "+thisJoinPointStaticPart);
		Object result = proceed();
		log.log (level, pre+"< "+thisJoinPointStaticPart);
		nesting--;
		return result;
	}
}

A separate aspect is used to "declare parent" or "declare @type" either the
marker interface or annotation, thereby adding tracing to the user-specified
classes. E.g.,

public aspect CallTraceTestTracer {
//	declare @type:   com.me.foo..*: @CallTrace.TracedAnno;
	declare parents: com.me.foo..* implements CallTrace.Traced;
}

The exception wasn't thrown in a previous version when I used just before advice
for both the "trace" and "traceInit" pointcuts. 

org.aspectj.apache.bcel.classfile.ClassFormatException
at org.aspectj.apache.bcel.classfile.Utility.typeOfSignature(Utility.java:1293)
at org.aspectj.apache.bcel.generic.Type.getTypeInternal(Type.java:166)
at org.aspectj.apache.bcel.generic.Type.getTypeInternal(Type.java:174)
at org.aspectj.apache.bcel.generic.Type.getType(Type.java:155)
at org.aspectj.weaver.bcel.BcelWorld.makeBcelType(BcelWorld.java:198)
at org.aspectj.weaver.bcel.BcelShadow.createMethodGen(BcelShadow.java:2999)
at org.aspectj.weaver.bcel.BcelShadow.extractMethod(BcelShadow.java:2826)
at org.aspectj.weaver.bcel.BcelShadow.weaveAroundInline(BcelShadow.java:2020)
at org.aspectj.weaver.bcel.BcelAdvice.implementOn(BcelAdvice.java:211)
at org.aspectj.weaver.Shadow.implementMungers(Shadow.java:514)
at org.aspectj.weaver.Shadow.implement(Shadow.java:391)
at org.aspectj.weaver.bcel.BcelClassWeaver.implement(BcelClassWeaver.java:1781)
at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:394)
at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:98)
at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1464)
at org.aspectj.weaver.bcel.BcelWeaver.weaveWithoutDump(BcelWeaver.java:1429)
at org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1203)
at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1039)
at
org.aspectj.ajdt.internal.compiler.AjCompilerAdapter.weave(AjCompilerAdapter.java:300)
at
org.aspectj.ajdt.internal.compiler.AjCompilerAdapter.afterCompiling(AjCompilerAdapter.java:178)
at
org.aspectj.ajdt.internal.compiler.CompilerAdapter.ajc$afterReturning$org_aspectj_ajdt_internal_compiler_CompilerAdapter$2$f9cc9ca0(CompilerAdapter.aj:70)
at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:367)
at org.aspectj.a

jdt.internal.core.builder.AjBuildManager.performCompilation(AjBuildManager.java:759)
at
org.aspectj.ajdt.internal.core.builder.AjBuildManager.doBuild(AjBuildManager.java:249)
at
org.aspectj.ajdt.internal.core.builder.AjBuildManager.incrementalBuild(AjBuildManager.java:158)
at org.aspectj.ajde.internal.CompilerAdapter.compile(CompilerAdapter.java:117)
at
org.aspectj.ajde.internal.AspectJBuildManager$CompilerThread.run(AspectJBuildManager.java:191)

trouble in: 
public class com.adteractive.framework.test.ConditionTestFilterTest extends
junit.framework.TestCase:
  com.adteractive.framework.ConditionTestFilter ctf
[Signature(Lcom/adteractive/framework/ConditionTestFilter<Lcom/adteractive/framework/test/InputStub;Lcom/adteractive/framework/test/OutputStub;>;)]
  static Class class$0
  private static final org.aspectj.lang.JoinPoint$StaticPart ajc$tjp_0
  public void <init>():
                    ALOAD_0     //
com.adteractive.framework.test.ConditionTestFilterTest this   (line 16)
                    INVOKESPECIAL junit.framework.TestCase.<init> ()V
    constructor-execution(void
com.adteractive.framework.test.ConditionTestFilterTest.<init>())
    |               ALOAD_0     //
com.adteractive.framework.test.ConditionTestFilterTest this   (line 17)
    |               ACONST_NULL
    |               PUTFIELD
com.adteractive.framework.test.ConditionTestFilterTest.ctf
Lcom/adteractive/framework/ConditionTestFilter;
    |               RETURN   (line 16)
    constructor-execution(void
com.adteractive.framework.test.ConditionTestFilterTest.<init>())
  end public void <init>()

  protected void setUp() throws java.lang.Exception   
org.aspectj.weaver.MethodDeclarationLineNumber: 23:543
:
    method-execution(void
com.adteractive.framework.test.ConditionTestFilterTest.setUp())
    |               ALOAD_0     //
com.adteractive.framework.test.ConditionTestFilterTest this   (line 24)
    |               INVOKESPECIAL junit.framework.TestCase.setUp ()V
    |               ALOAD_0     //
com.adteractive.framework.test.ConditionTestFilterTest this   (line 25)
    |               NEW com.adteractive.framework.test.ConditionTestFilterStub
    |               DUP
    |               LDC "ctf"
    |               ALOAD_0     //
com.adteractive.framework.test.ConditionTestFilterTest this
    |               ASTORE_1
    | method-call(com.adteractive.framework.Filter[]
com.adteractive.framework.test.ConditionTestFilterTest.makeBranches())
    | |             ALOAD_1
    | |             INVOKESPECIAL
com.adteractive.framework.test.ConditionTestFilterTest.makeBranches
()[Lcom/adteractive/framework/Filter;
    | method-call(com.adteractive.framework.Filter[]
com.adteractive.framework.test.ConditionTestFilterTest.makeBranches())
    |               INVOKESPECIAL
com.adteractive.framework.test.ConditionTestFilterStub.<init>
(Ljava/lang/String;[Lcom/adteractive/framework/Filter;)V
    |               PUTFIELD
com.adteractive.framework.test.ConditionTestFilterTest.ctf
Lcom/adteractive/framework/ConditionTestFilter;
    |               RETURN   (line 26)
    method-execution(void
com.adteractive.framework.test.ConditionTestFilterTest.setUp())
  end protected void setUp() throws java.lang.Exception

  public void testExecute()    org.aspectj.weaver.MethodDeclarationLineNumber:
31:754
:
    method-execution(void
com.adteractive.framework.test.ConditionTestFilterTest.testExecute())
    |               ALOAD_0     //
com.adteractive.framework.test.ConditionTestFilterTest this   (line 32)
    |               GETFIELD
com.adteractive.framework.test.ConditionTestFilterTest.ctf
Lcom/adteractive/framework/ConditionTestFilter;
    |               NEW com.adteractive.framework.test.InputStub
    |               DUP
    |               INVOKESPECIAL
com.adteractive.framework.test.InputStub.<init> ()V
    | method-call(com.adteractive.framework.Output
com.adteractive.framework.ConditionTestFilter.execute(com.adteractive.framework.Input))
    | |             INVOKEVIRTUAL
com.adteractive.framework.ConditionTestFilter.execute
(Lcom/adteractive/framework/Input;)Lcom/adteractive/framework/Output;
    | method-call(com.adteractive.framework.Output
com.adteractive.framework.ConditionTestFilter.execute(com.adteractive.framework.Input))
    |               CHECKCAST com.adteractive.framework.test.OutputStub
    |               ASTORE_1
    |               LDC "bf12"   (line 33)
    |               ALOAD_1     // com.adteractive.framework.test.OutputStub output
    | method-call(com.adteractive.framework.Status
com.adteractive.framework.test.OutputStub.getStatus())
    | |             INVOKEVIRTUAL
com.adteractive.framework.test.OutputStub.getStatus
()Lcom/adteractive/framework/Status;
    | method-call(com.adteractive.framework.Status
com.adteractive.framework.test.OutputStub.getStatus())
    | method-call(java.lang.String
com.adteractive.framework.Status.getAdditionalMessage())
    | |             INVOKEINTERFACE
com.adteractive.framework.Status.getAdditionalMessage ()Ljava/lang/String;
    | method-call(java.lang.String
com.adteractive.framework.Status.getAdditionalMessage())
    | method-call(void junit.framework.Assert.assertEquals(java.lang.String,
java.lang.String))
    | |             INVOKESTATIC
com.adteractive.framework.test.ConditionTestFilterTest.assertEquals
(Ljava/lang/String;Ljava/lang/String;)V
    | method-call(void junit.framework.Assert.assertEquals(java.lang.String,
java.lang.String))
    |               ALOAD_0     //
com.adteractive.framework.test.ConditionTestFilterTest this   (line 34)
    |               NEW com.adteractive.framework.test.ConditionTestFilterStub
    |               DUP
    |               INVOKESPECIAL
com.adteractive.framework.test.ConditionTestFilterStub.<init> ()V
    |               PUTFIELD
com.adteractive.framework.test.ConditionTestFilterTest.ctf
Lcom/adteractive/framework/ConditionTestFilter;
    |               ALOAD_0     //
com.adteractive.framework.test.ConditionTestFilterTest this   (line 35)
    |               GETFIELD
com.adteractive.framework.test.ConditionTestFilterTest.ctf
Lcom/adteractive/framework/ConditionTestFilter;
    |               NEW com.adteractive.framework.test.InputStub
    |               DUP
    |               INVOKESPECIAL
com.adteractive.framework.test.InputStub.<init> ()V
    | method-call(com.adteractive.framework.Output
com.adteractive.framework.ConditionTestFilter.execute(com.adteractive.framework.Input))
    | |             INVOKEVIRTUAL
com.adteractive.framework.ConditionTestFilter.execute
(Lcom/adteractive/framework/Input;)Lcom/adteractive/framework/Output;
    | method-call(com.adteractive.framework.Output
com.adteractive.framework.ConditionTestFilter.execute(com.adteractive.framework.Input))
    |               CHECKCAST com.adteractive.framework.test.OutputStub
    |               ASTORE_1     // com.adteractive.framework.test.OutputStub output
    |               ALOAD_1     // com.adteractive.framework.test.OutputStub
output   (line 36)
    | method-call(void junit.framework.Assert.assertNotNull(java.lang.Object))
    | |             INVOKESTATIC
com.adteractive.framework.test.ConditionTestFilterTest.assertNotNull
(Ljava/lang/Object;)V
    | method-call(void junit.framework.Assert.assertNotNull(java.lang.Object))
    |               RETURN   (line 37)
    method-execution(void
com.adteractive.framework.test.ConditionTestFilterTest.testExecute())
  end public void testExecute()

  public void testGetFilterBranches()   
org.aspectj.weaver.MethodDeclarationLineNumber: 42:1111
:
    method-execution(void
com.adteractive.framework.test.ConditionTestFilterTest.testGetFilterBranches())
    |               ALOAD_0     //
com.adteractive.framework.test.ConditionTestFilterTest this   (line 43)
    |               GETFIELD
com.adteractive.framework.test.ConditionTestFilterTest.ctf
Lcom/adteractive/framework/ConditionTestFilter;
    | method-call(com.adteractive.framework.Filter[]
com.adteractive.framework.ConditionTestFilter.getFilterBranches())
    | |             INVOKEVIRTUAL
com.adteractive.framework.ConditionTestFilter.getFilterBranches
()[Lcom/adteractive/framework/Filter;
    | method-call(com.adteractive.framework.Filter[]
com.adteractive.framework.ConditionTestFilter.getFilterBranches())
    | method-call(void junit.framework.Assert.assertNotNull(java.lang.Object))
    | |             INVOKESTATIC
com.adteractive.framework.test.ConditionTestFilterTest.assertNotNull
(Ljava/lang/Object;)V
    | method-call(void junit.framework.Assert.assertNotNull(java.lang.Object))
    |               ICONST_3   (line 44)
    |               ALOAD_0     //
com.adteractive.framework.test.ConditionTestFilterTest this
    |               GETFIELD
com.adteractive.framework.test.ConditionTestFilterTest.ctf
Lcom/adteractive/framework/ConditionTestFilter;
    | method-call(com.adteractive.framework.Filter[]
com.adteractive.framework.ConditionTestFilter.getFilterBranches())
    | |             INVOKEVIRTUAL
com.adteractive.framework.ConditionTestFilter.getFilterBranches
()[Lcom/adteractive/framework/Filter;
    | method-call(com.adteractive.framework.Filter[]
com.adteractive.framework.ConditionTestFilter.getFilterBranches())
    |               ARRAYLENGTH
    | method-call(void junit.framework.Assert.assertEquals(int, int))
    | |             INVOKESTATIC
com.adteractive.framework.test.ConditionTestFilterTest.assertEquals (II)V
    | method-call(void junit.framework.Assert.assertEquals(int, int))
    |               ALOAD_0     //
com.adteractive.framework.test.ConditionTestFilterTest this   (line 45)
    |               NEW com.adteractive.framework.test.ConditionTestFilterStub
    |               DUP
    |               INVOKESPECIAL
com.adteractive.framework.test.ConditionTestFilterStub.<init> ()V
    |               PUTFIELD
com.adteractive.framework.test.ConditionTestFilterTest.ctf
Lcom/adteractive/framework/ConditionTestFilter;
    |               ALOAD_0     //
com.adteractive.framework.test.ConditionTestFilterTest this   (line 46)
    |               GETFIELD
com.adteractive.framework.test.ConditionTestFilterTest.ctf
Lcom/adteractive/framework/ConditionTestFilter;
    | method-call(com.adteractive.framework.Filter[]
com.adteractive.framework.ConditionTestFilter.getFilterBranches())
    | |             INVOKEVIRTUAL
com.adteractive.framework.ConditionTestFilter.getFilterBranches
()[Lcom/adteractive/framework/Filter;
    | method-call(com.adteractive.framework.Filter[]
com.adteractive.framework.ConditionTestFilter.getFilterBranches())
    | method-call(void junit.framework.Assert.assertNull(java.lang.Object))
    | |             INVOKESTATIC
com.adteractive.framework.test.ConditionTestFilterTest.assertNull
(Ljava/lang/Object;)V
    | method-call(void junit.framework.Assert.assertNull(java.lang.Object))
    |               RETURN   (line 47)
    method-execution(void
com.adteractive.framework.test.ConditionTestFilterTest.testGetFilterBranches())
  end public void testGetFilterBranches()

  public void testSetFilterBranches()   
org.aspectj.weaver.MethodDeclarationLineNumber: 52:1441
:
    method-execution(void
com.adteractive.framework.test.ConditionTestFilterTest.testSetFilterBranches())
    |               ALOAD_0     //
com.adteractive.framework.test.ConditionTestFilterTest this   (line 53)
    | method-call(com.adteractive.framework.Filter[]
com.adteractive.framework.test.ConditionTestFilterTest.makeBranches())
    | |             INVOKESPECIAL
com.adteractive.framework.test.ConditionTestFilterTest.makeBranches
()[Lcom/adteractive/framework/Filter;
    | method-call(com.adteractive.framework.Filter[]
com.adteractive.framework.test.ConditionTestFilterTest.makeBranches())
    |               ASTORE_1
    |               ALOAD_0     //
com.adteractive.framework.test.ConditionTestFilterTest this   (line 54)
    |               GETFIELD
com.adteractive.framework.test.ConditionTestFilterTest.ctf
Lcom/adteractive/framework/ConditionTestFilter;
    |               ALOAD_1     // com.adteractive.framework.Filter[] branches
    | method-call(void
com.adteractive.framework.ConditionTestFilter.setFilterBranches(com.adteractive.framework.Filter[]))
    | |             INVOKEVIRTUAL
com.adteractive.framework.ConditionTestFilter.setFilterBranches
([Lcom/adteractive/framework/Filter;)V
    | method-call(void
com.adteractive.framework.ConditionTestFilter.setFilterBranches(com.adteractive.framework.Filter[]))
    |               ALOAD_0     //
com.adteractive.framework.test.ConditionTestFilterTest this   (line 55)
    |               GETFIELD
com.adteractive.framework.test.ConditionTestFilterTest.ctf
Lcom/adteractive/framework/ConditionTestFilter;
    | method-call(com.adteractive.framework.Filter[]
com.adteractive.framework.ConditionTestFilter.getFilterBranches())
    | |             INVOKEVIRTUAL
com.adteractive.framework.ConditionTestFilter.getFilterBranches
()[Lcom/adteractive/framework/Filter;
    | method-call(com.adteractive.framework.Filter[]
com.adteractive.framework.ConditionTestFilter.getFilterBranches())
    | method-call(void junit.framework.Assert.assertNotNull(java.lang.Object))
    | |             INVOKESTATIC
com.adteractive.framework.test.ConditionTestFilterTest.assertNotNull
(Ljava/lang/Object;)V
    | method-call(void junit.framework.Assert.assertNotNull(java.lang.Object))
    |               ICONST_3   (line 56)
    |               ALOAD_0     //
com.adteractive.framework.test.ConditionTestFilterTest this
    |               GETFIELD
com.adteractive.framework.test.ConditionTestFilterTest.ctf
Lcom/adteractive/framework/ConditionTestFilter;
    | method-call(com.adteractive.framework.Filter[]
com.adteractive.framework.ConditionTestFilter.getFilterBranches())
    | |             INVOKEVIRTUAL
com.adteractive.framework.ConditionTestFilter.getFilterBranches
()[Lcom/adteractive/framework/Filter;
    | method-call(com.adteractive.framework.Filter[]
com.adteractive.framework.ConditionTestFilter.getFilterBranches())
    |               ARRAYLENGTH
    | method-call(void junit.framework.Assert.assertEquals(int, int))
    | |             INVOKESTATIC
com.adteractive.framework.test.ConditionTestFilterTest.assertEquals (II)V
    | method-call(void junit.framework.Assert.assertEquals(int, int))
    |               ALOAD_0     //
com.adteractive.framework.test.ConditionTestFilterTest this   (line 57)
    |               GETFIELD
com.adteractive.framework.test.ConditionTestFilterTest.ctf
Lcom/adteractive/framework/ConditionTestFilter;
    |               ACONST_NULL
    | method-call(void
com.adteractive.framework.ConditionTestFilter.setFilterBranches(com.adteractive.framework.Filter[]))
    | |             INVOKEVIRTUAL
com.adteractive.framework.ConditionTestFilter.setFilterBranches
([Lcom/adteractive/framework/Filter;)V
    | method-call(void
com.adteractive.framework.ConditionTestFilter.setFilterBranches(com.adteractive.framework.Filter[]))
    |               ALOAD_0     //
com.adteractive.framework.test.ConditionTestFilterTest this   (line 58)
    |               GETFIELD
com.adteractive.framework.test.ConditionTestFilterTest.ctf
Lcom/adteractive/framework/ConditionTestFilter;
    | method-call(com.adteractive.framework.Filter[]
com.adteractive.framework.ConditionTestFilter.getFilterBranches())
    | |             INVOKEVIRTUAL
com.adteractive.framework.ConditionTestFilter.getFilterBranches
()[Lcom/adteractive/framework/Filter;
    | method-call(com.adteractive.framework.Filter[]
com.adteractive.framework.ConditionTestFilter.getFilterBranches())
    | method-call(void junit.framework.Assert.assertNull(java.lang.Object))
    | |             INVOKESTATIC
com.adteractive.framework.test.ConditionTestFilterTest.assertNull
(Ljava/lang/Object;)V
    | method-call(void junit.framework.Assert.assertNull(java.lang.Object))
    |               RETURN   (line 59)
    method-execution(void
com.adteractive.framework.test.ConditionTestFilterTest.testSetFilterBranches())
  end public void testSetFilterBranches()

  public void testConditionTestFilter()   
org.aspectj.weaver.MethodDeclarationLineNumber: 64:1847
:
    method-execution(void
com.adteractive.framework.test.ConditionTestFilterTest.testConditionTestFilter())
    |               ALOAD_0     //
com.adteractive.framework.test.ConditionTestFilterTest this   (line 65)
    |               NEW com.adteractive.framework.test.ConditionTestFilterStub
    |               DUP
    |               INVOKESPECIAL
com.adteractive.framework.test.ConditionTestFilterStub.<init> ()V
    |               PUTFIELD
com.adteractive.framework.test.ConditionTestFilterTest.ctf
Lcom/adteractive/framework/ConditionTestFilter;
    |               ALOAD_0     //
com.adteractive.framework.test.ConditionTestFilterTest this   (line 66)
    |               GETFIELD
com.adteractive.framework.test.ConditionTestFilterTest.ctf
Lcom/adteractive/framework/ConditionTestFilter;
    | method-call(com.adteractive.framework.Filter[]
com.adteractive.framework.ConditionTestFilter.getFilterBranches())
    | |             INVOKEVIRTUAL
com.adteractive.framework.ConditionTestFilter.getFilterBranches
()[Lcom/adteractive/framework/Filter;
    | method-call(com.adteractive.framework.Filter[]
com.adteractive.framework.ConditionTestFilter.getFilterBranches())
    | method-call(void junit.framework.Assert.assertNull(java.lang.Object))
    | |             INVOKESTATIC
com.adteractive.framework.test.ConditionTestFilterTest.assertNull
(Ljava/lang/Object;)V
    | method-call(void junit.framework.Assert.assertNull(java.lang.Object))
    |               LDC com.adteractive.framework.test.ConditionTestFilterStub 
 (line 67)
    | method-call(java.lang.String java.lang.Class.getSimpleName())
    | |             INVOKEVIRTUAL java.lang.Class.getSimpleName ()Ljava/lang/String;
    | method-call(java.lang.String java.lang.Class.getSimpleName())
    |               ALOAD_0     //
com.adteractive.framework.test.ConditionTestFilterTest this
    |               GETFIELD
com.adteractive.framework.test.ConditionTestFilterTest.ctf
Lcom/adteractive/framework/ConditionTestFilter;
    | method-call(java.lang.String com.adteractive.framework.FilterHelper.getName())
    | |             INVOKEVIRTUAL com.adteractive.framework.FilterHelper.getName
()Ljava/lang/String;
    | method-call(java.lang.String com.adteractive.framework.FilterHelper.getName())
    | method-call(void junit.framework.Assert.assertEquals(java.lang.String,
java.lang.String))
    | |             INVOKESTATIC
com.adteractive.framework.test.ConditionTestFilterTest.assertEquals
(Ljava/lang/String;Ljava/lang/String;)V
    | method-call(void junit.framework.Assert.assertEquals(java.lang.String,
java.lang.String))
    |               RETURN   (line 68)
    method-execution(void
com.adteractive.framework.test.ConditionTestFilterTest.testConditionTestFilter())
  end public void testConditionTestFilter()

  public void testConditionTestFilterString()   
org.aspectj.weaver.MethodDeclarationLineNumber: 73:2158
:
    method-execution(void
com.adteractive.framework.test.ConditionTestFilterTest.testConditionTestFilterString())
    |               ALOAD_0     //
com.adteractive.framework.test.ConditionTestFilterTest this   (line 74)
    |               NEW com.adteractive.framework.test.ConditionTestFilterStub
    |               DUP
    |               LDC "foo"
    |               INVOKESPECIAL
com.adteractive.framework.test.ConditionTestFilterStub.<init> (Ljava/lang/String;)V
    |               PUTFIELD
com.adteractive.framework.test.ConditionTestFilterTest.ctf
Lcom/adteractive/framework/ConditionTestFilter;
    |               ALOAD_0     //
com.adteractive.framework.test.ConditionTestFilterTest this   (line 75)
    |               GETFIELD
com.adteractive.framework.test.ConditionTestFilterTest.ctf
Lcom/adteractive/framework/ConditionTestFilter;
    | method-call(com.adteractive.framework.Filter[]
com.adteractive.framework.ConditionTestFilter.getFilterBranches())
    | |             INVOKEVIRTUAL
com.adteractive.framework.ConditionTestFilter.getFilterBranches
()[Lcom/adteractive/framework/Filter;
    | method-call(com.adteractive.framework.Filter[]
com.adteractive.framework.ConditionTestFilter.getFilterBranches())
    | method-call(void junit.framework.Assert.assertNull(java.lang.Object))
    | |             INVOKESTATIC
com.adteractive.framework.test.ConditionTestFilterTest.assertNull
(Ljava/lang/Object;)V
    | method-call(void junit.framework.Assert.assertNull(java.lang.Object))
    |               LDC "foo"   (line 76)
    |               ALOAD_0     //
com.adteractive.framework.test.ConditionTestFilterTest this
    |               GETFIELD
com.adteractive.framework.test.ConditionTestFilterTest.ctf
Lcom/adteractive/framework/ConditionTestFilter;
    | method-call(java.lang.String com.adteractive.framework.FilterHelper.getName())
    | |             INVOKEVIRTUAL com.adteractive.framework.FilterHelper.getName
()Ljava/lang/String;
    | method-call(java.lang.String com.adteractive.framework.FilterHelper.getName())
    | method-call(void junit.framework.Assert.assertEquals(java.lang.String,
java.lang.String))
    | |             INVOKESTATIC
com.adteractive.framework.test.ConditionTestFilterTest.assertEquals
(Ljava/lang/String;Ljava/lang/String;)V
    | method-call(void junit.framework.Assert.assertEquals(java.lang.String,
java.lang.String))
    |               RETURN   (line 77)
    method-execution(void
com.adteractive.framework.test.ConditionTestFilterTest.testConditionTestFilterString())
  end public void testConditionTestFilterString()

  public void testConditionTestFilterStringFilterOfIOArray()   
org.aspectj.weaver.MethodDeclarationLineNumber: 82:2456
:
    method-execution(void
com.adteractive.framework.test.ConditionTestFilterTest.testConditionTestFilterStringFilterOfIOArray())
    |               ALOAD_0     //
com.adteractive.framework.test.ConditionTestFilterTest this   (line 83)
    |               NEW com.adteractive.framework.test.ConditionTestFilterStub
    |               DUP
    |               LDC "foo"
    |               ALOAD_0     //
com.adteractive.framework.test.ConditionTestFilterTest this
    | method-call(com.adteractive.framework.Filter[]
com.adteractive.framework.test.ConditionTestFilterTest.makeBranches())
    | |             INVOKESPECIAL
com.adteractive.framework.test.ConditionTestFilterTest.makeBranches
()[Lcom/adteractive/framework/Filter;
    | method-call(com.adteractive.framework.Filter[]
com.adteractive.framework.test.ConditionTestFilterTest.makeBranches())
    |               INVOKESPECIAL
com.adteractive.framework.test.ConditionTestFilterStub.<init>
(Ljava/lang/String;[Lcom/adteractive/framework/Filter;)V
    |               PUTFIELD
com.adteractive.framework.test.ConditionTestFilterTest.ctf
Lcom/adteractive/framework/ConditionTestFilter;
    |               ALOAD_0     //
com.adteractive.framework.test.ConditionTestFilterTest this   (line 84)
    |               GETFIELD
com.adteractive.framework.test.ConditionTestFilterTest.ctf
Lcom/adteractive/framework/ConditionTestFilter;
    | method-call(com.adteractive.framework.Filter[]
com.adteractive.framework.ConditionTestFilter.getFilterBranches())
    | |             INVOKEVIRTUAL
com.adteractive.framework.ConditionTestFilter.getFilterBranches
()[Lcom/adteractive/framework/Filter;
    | method-call(com.adteractive.framework.Filter[]
com.adteractive.framework.ConditionTestFilter.getFilterBranches())
    | method-call(void junit.framework.Assert.assertNotNull(java.lang.Object))
    | |             INVOKESTATIC
com.adteractive.framework.test.ConditionTestFilterTest.assertNotNull
(Ljava/lang/Object;)V
    | method-call(void junit.framework.Assert.assertNotNull(java.lang.Object))
    |               ICONST_3   (line 85)
    |               ALOAD_0     //
com.adteractive.framework.test.ConditionTestFilterTest this
    |               GETFIELD
com.adteractive.framework.test.ConditionTestFilterTest.ctf
Lcom/adteractive/framework/ConditionTestFilter;
    | method-call(com.adteractive.framework.Filter[]
com.adteractive.framework.ConditionTestFilter.getFilterBranches())
    | |             INVOKEVIRTUAL
com.adteractive.framework.ConditionTestFilter.getFilterBranches
()[Lcom/adteractive/framework/Filter;
    | method-call(com.adteractive.framework.Filter[]
com.adteractive.framework.ConditionTestFilter.getFilterBranches())
    |               ARRAYLENGTH
    | method-call(void junit.framework.Assert.assertEquals(int, int))
    | |             INVOKESTATIC
com.adteractive.framework.test.ConditionTestFilterTest.assertEquals (II)V
    | method-call(void junit.framework.Assert.assertEquals(int, int))
    |               LDC "foo"   (line 86)
    |               ALOAD_0     //
com.adteractive.framework.test.ConditionTestFilterTest this
    |               GETFIELD
com.adteractive.framework.test.ConditionTestFilterTest.ctf
Lcom/adteractive/framework/ConditionTestFilter;
    | method-call(java.lang.String com.adteractive.framework.FilterHelper.getName())
    | |             INVOKEVIRTUAL com.adteractive.framework.FilterHelper.getName
()Ljava/lang/String;
    | method-call(java.lang.String com.adteractive.framework.FilterHelper.getName())
    | method-call(void junit.framework.Assert.assertEquals(java.lang.String,
java.lang.String))
    | |             INVOKESTATIC
com.adteractive.framework.test.ConditionTestFilterTest.assertEquals
(Ljava/lang/String;Ljava/lang/String;)V
    | method-call(void junit.framework.Assert.assertEquals(java.lang.String,
java.lang.String))
    |               RETURN   (line 87)
    method-execution(void
com.adteractive.framework.test.ConditionTestFilterTest.testConditionTestFilterStringFilterOfIOArray())
  end public void testConditionTestFilterStringFilterOfIOArray()

  private com.adteractive.framework.Filter[] makeBranches()   
org.aspectj.weaver.MethodDeclarationLineNumber: 89:2749
:
    method-execution(com.adteractive.framework.Filter[]
com.adteractive.framework.test.ConditionTestFilterTest.makeBranches())
    |               ICONST_3   (line 90)
    |               ANEWARRAY com.adteractive.framework.test.FilterHelperStub
    |               ASTORE_1
    |               ALOAD_1     // com.adteractive.framework.Filter[] branches 
 (line 91)
    |               ICONST_0
    |               NEW com.adteractive.framework.test.FilterHelperStub
    |               DUP
    |               LDC "bf1"
    |               INVOKESPECIAL
com.adteractive.framework.test.FilterHelperStub.<init> (Ljava/lang/String;)V
    |               AASTORE
    |               ALOAD_1     // com.adteractive.framework.Filter[] branches 
 (line 92)
    |               ICONST_1
    |               NEW com.adteractive.framework.test.FilterHelperStub
    |               DUP
    |               LDC "bf12"
    |               INVOKESPECIAL
com.adteractive.framework.test.FilterHelperStub.<init> (Ljava/lang/String;)V
    |               AASTORE
    |               ALOAD_1     // com.adteractive.framework.Filter[] branches 
 (line 93)
    |               ICONST_2
    |               NEW com.adteractive.framework.test.FilterHelperStub
    |               DUP
    |               LDC "bf"
    |               INVOKESPECIAL
com.adteractive.framework.test.FilterHelperStub.<init> (Ljava/lang/String;)V
    |               AASTORE
    |               ALOAD_1     // com.adteractive.framework.Filter[] branches 
 (line 94)
    |               ARETURN
    method-execution(com.adteractive.framework.Filter[]
com.adteractive.framework.test.ConditionTestFilterTest.makeBranches())
  end private com.adteractive.framework.Filter[] makeBranches()

end public class com.adteractive.framework.test.ConditionTestFilterTest

when implementing on shadow method-call(com.adteractive.framework.Filter[]
com.adteractive.framework.test.ConditionTestFilterTest.makeBranches())
when weaving type com.adteractive.framework.test.ConditionTestFilterTest
when weaving classes 
when weaving 
when incrementally building
BuildConfig[C:\cygwin\home\dwampler\work\workspace\.metadata\.plugins\org.eclipse.ajdt.core\adserver-service.generated.lst]
#Files=259
Comment 1 Andrew Clement CLA 2005-10-19 14:08:52 EDT
i'll take a look ...
Comment 2 Dean Wampler CLA 2005-10-19 14:12:58 EDT
Slight correction; the static initializer block should have as its first line:
prefixStr = new StringBuffer(1024);
It doesn't remove the bug, however. 

The weaving succeeds for some modules, but not all. Most Junit tests fail to run
when invoked ('An internal error occurred during "Launching"').
Comment 3 Dean Wampler CLA 2005-10-19 15:25:49 EDT
I simplified the pointcuts:

	public pointcut exclusions(): within(CallTrace) || within(*Tracer);
	
	public pointcut traceIntf(): 
		execution(* com.adteractive..Traced+.*(..)) || 
		execution(com.adteractive..Traced+.new(..));
	
	public pointcut traceAnno(): 
		execution(* @TracedAnno com.adteractive..*.*(..)) || 
		execution(@TracedAnno com.adteractive..*.new(..));

	public pointcut trace(): !exclusions() && (traceIntf() || traceAnno());
	
	Object around(): trace() {
		// same as before
	}

The exception dialog doesn't appear anymore, but I'm still having problems
getting some, but not all, junit tests to run. Unfortunately, the "failed to
launch" dialog provides no information. The log indicates an array index out of
bound exception (value = -1). The only connection to AJ is that this problem
didn't occur until I started using the aspect. I restarted eclipse, that wasn't
enough. What finally got the tests to work again, with the tracing aspect, was
to remove the AJ nature, rebuild, then add the AJ nature back and rebuild.
Comment 4 Andrew Clement CLA 2005-10-19 15:40:21 EDT
Hmm, looking at this code:

org.aspectj.apache.bcel.classfile.ClassFormatException
at org.aspectj.apache.bcel.classfile.Utility.typeOfSignature(Utility.java:1293)
at org.aspectj.apache.bcel.generic.Type.getTypeInternal(Type.java:166)
at org.aspectj.apache.bcel.generic.Type.getTypeInternal(Type.java:174)

it seems when the exception is thrown it should include the signature it was
having trouble with - I guess that got lost somewhere in the error reporting? 
In fact, here is the whole of 'typeOfSignature':

public static final byte typeOfSignature(String signature) throws
ClassFormatException {
    try {
      switch(signature.charAt(0)) {
          case 'B' : return Constants.T_BYTE;
          case 'C' : return Constants.T_CHAR;
          case 'D' : return Constants.T_DOUBLE;
	      case 'F' : return Constants.T_FLOAT;
	      case 'I' : return Constants.T_INT;
	      case 'J' : return Constants.T_LONG;
	      case 'L' : return Constants.T_REFERENCE;
	      case '[' : return Constants.T_ARRAY;
	      case 'V' : return Constants.T_VOID;
	      case 'Z' : return Constants.T_BOOLEAN;
	      case 'S' : return Constants.T_SHORT;
          default:  
	        throw new ClassFormatException("Invalid method signature: " +
signature); // << this is line 1293
      }
    } catch(StringIndexOutOfBoundsException e) {
      throw new ClassFormatException("Invalid method signature: " + signature);
    }
  }

We are probably leaking a 'P' signature out of the compile stage, P being like
'L' but its how we choose to identify parameterized types like
Pjava/util/List<Ljava/lang/String;>;

Wish I knew what the signature was...
Comment 5 Dean Wampler CLA 2005-10-19 15:58:00 EDT
Created attachment 28477 [details]
Eclipse log file with stack traces

This is the segment of the eclipse ".log" file that contains the "session" data
where the problem occurred.
Comment 6 Dean Wampler CLA 2005-10-19 15:59:42 EDT
Specifically, I think the signature you want is probably 

...
!STACK 0

org.aspectj.apache.bcel.classfile.ClassFormatException: Invalid method
signature: Pcom/adteractive/framework/Filter<TI;TO;>;
...

(Near the end of the file.) Filter is an interface. Curiously, it is not advised
by the aspect in question.
Comment 7 Andrew Clement CLA 2005-11-11 10:13:11 EST
Sorry i've taken so long to get to this Dean :(

However, I think I've fixed this.  I found a bug in the code that creates
generic signatures.  There are two ways to grab a signature for a type:

getSignature()

getSignatureForAttribute()

the first may return "PSomeType<LSomeOtherType;>;" whilse the second has to
return something in the standard Java form 'LSomeType<LSomeOtherType;>;" - we
were incorrectly using the first form when building the signature attribute for
a file.  

Is it easy for you to recreate Dean? So you can try my fix when its available?
Comment 8 Andrew Clement CLA 2005-11-12 13:55:19 EST
the latest dev build includes what I think might fix it...
Comment 9 Andrew Clement CLA 2005-11-16 11:09:55 EST
I'm closing this as I believe its fixed.  Dean, please reopen if you encounter
this again.