Bug 152631 - Problem with decp on an aspect using cflow
Summary: Problem with decp on an aspect using cflow
Status: RESOLVED FIXED
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: DEVELOPMENT   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 1.5.3   Edit
Assignee: aspectj inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-08-02 13:26 EDT by Ron Bodkin CLA
Modified: 2006-08-09 02:53 EDT (History)
0 users

See Also:


Attachments
Self-contained AJDT project that reproduces the problem (225.07 KB, application/x-zip-compressed)
2006-08-02 14:06 EDT, Ron Bodkin CLA
no flags Details
Jar for classpath (10.19 KB, application/java-archive)
2006-08-03 12:23 EDT, Ron Bodkin CLA
no flags Details
Commons httpclient jar for classpath (273.22 KB, application/java-archive)
2006-08-03 12:25 EDT, Ron Bodkin CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ron Bodkin CLA 2006-08-02 13:26:23 EDT
This occurs in the AspectJ build in AJDT from August 1 but not from July 31:

java.lang.NullPointerException
at org.aspectj.weaver.bcel.BcelTypeMunger.enforceDecpRule1_abstractMethodsImplemented(BcelTypeMunger.java:250)
at org.aspectj.weaver.bcel.BcelTypeMunger.mungeNewParent(BcelTypeMunger.java:194)
at org.aspectj.weaver.bcel.BcelTypeMunger.munge(BcelTypeMunger.java:106)
at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:454)
at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:119)
at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1597)
at org.aspectj.weaver.bcel.BcelWeaver.weaveWithoutDump(BcelWeaver.java:1548)
at org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1328)
at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1124)
at org.aspectj.ajdt.internal.compiler.AjPipeliningCompilerAdapter.weaveQueuedEntries(AjPipeliningCompilerAdapter.java:451)
at org.aspectj.ajdt.internal.compiler.AjPipeliningCompilerAdapter.queueForWeaving(AjPipeliningCompilerAdapter.java:389)
at org.aspectj.ajdt.internal.compiler.AjPipeliningCompilerAdapter.afterProcessing(AjPipeliningCompilerAdapter.java:377)
at org.aspectj.ajdt.internal.compiler.CompilerAdapter.ajc$after$org_aspectj_ajdt_internal_compiler_CompilerAdapter$5$6b855184(CompilerAdapter.aj:98)
at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.process(Compiler.java:533)
at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:329)
at org.aspectj.ajdt.internal.core.builder.AjBuildManager.performCompilation(AjBuildManager.java:891)
at org.aspectj.ajdt.internal.core.builder.AjBuildManager.doBuild(AjBuildManager.java:246)
at org.aspectj.ajdt.internal.core.builder.AjBuildManager.batchBuild(AjBuildManager.java:165)
at org.aspectj.ajde.internal.CompilerAdapter.compile(CompilerAdapter.java:122)
at org.aspectj.ajde.internal.AspectJBuildManager$CompilerThread.run(AspectJBuildManager.java:191)

trouble in:public class glassbox.agent.ErrorContainmentTest$ErrorMockAspect extends java.lang.Object implements glassbox.agent.api.NotSerializable:
private static Throwable ajc$initFailureCause [Synthetic]
public static final glassbox.agent.ErrorContainmentTest$ErrorMockAspect ajc$perSingletonInstance [Synthetic]
static void <clinit>():
catch java.lang.Throwable -> E0
|               INVOKESTATIC glassbox.agent.ErrorContainmentTest$ErrorMockAspect.ajc$postClinit ()V   (line 60)
catch java.lang.Throwable -> E0
GOTO L0
E0: ASTORE_0
ALOAD_0
PUTSTATIC glassbox.agent.ErrorContainmentTest$ErrorMockAspect.ajc$initFailureCause Ljava/lang/Throwable;
L0: RETURN
end static void <clinit>()
void <init>():
ALOAD_0     // Lglassbox/agent/ErrorContainmentTest$ErrorMockAspect; this   (line 60)
INVOKESPECIAL java.lang.Object.<init> ()V
RETURN
end void <init>()
public void ajc$before$glassbox_agent_ErrorContainmentTest$ErrorMockAspect$1$9589fc()    AdviceAttribute(before, (scope() && call(* hook1())), 0, 1670)
:
NEW java.lang.RuntimeException   (line 64)
DUP
LDC "rte"
INVOKESPECIAL java.lang.RuntimeException.<init> (Ljava/lang/String;)V
ATHROW
end public void ajc$before$glassbox_agent_ErrorContainmentTest$ErrorMockAspect$1$9589fc()
public void ajc$before$glassbox_agent_ErrorContainmentTest$ErrorMockAspect$2$f75db3e2()    AdviceAttribute(before, execution(* glassbox.agent.ErrorContainmentTest.hook5()), 0, 1764)
:
NEW java.lang.RuntimeException   (line 67)
DUP
LDC "rte"
INVOKESPECIAL java.lang.RuntimeException.<init> (Ljava/lang/String;)V
ATHROW
end public void ajc$before$glassbox_agent_ErrorContainmentTest$ErrorMockAspect$2$f75db3e2()
public void ajc$around$glassbox_agent_ErrorContainmentTest$ErrorMockAspect$3$a3a17d(org.aspectj.runtime.internal.AroundClosure)    AdviceAttribute(around, (scope() && call(* hook2())), 1, 1913)
:
NEW java.lang.Error   (line 71)
DUP
LDC "foo"
INVOKESPECIAL java.lang.Error.<init> (Ljava/lang/String;)V
ATHROW
end public void ajc$around$glassbox_agent_ErrorContainmentTest$ErrorMockAspect$3$a3a17d(org.aspectj.runtime.internal.AroundClosure)
static void ajc$around$glassbox_agent_ErrorContainmentTest$ErrorMockAspect$3$a3a17dproceed(org.aspectj.runtime.internal.AroundClosure) throws java.lang.Throwable    org.aspectj.weaver.AjAttribute$AjSynthetic@19a01f9
:
ALOAD_0     // Lglassbox/agent/ErrorContainmentTest$ErrorMockAspect; this   (line 1)
ICONST_0
ANEWARRAY java.lang.Object
INVOKEVIRTUAL org.aspectj.runtime.internal.AroundClosure.run ([Ljava/lang/Object;)Ljava/lang/Object;
INVOKESTATIC org.aspectj.runtime.internal.Conversions.voidValue (Ljava/lang/Object;)Ljava/lang/Object;
RETURN
end static void ajc$around$glassbox_agent_ErrorContainmentTest$ErrorMockAspect$3$a3a17dproceed(org.aspectj.runtime.internal.AroundClosure) throws java.lang.Throwable
public void ajc$after$glassbox_agent_ErrorContainmentTest$ErrorMockAspect$4$bfd07f()    AdviceAttribute(after, (scope() && call(* hook4())), 0, 1991)
:
NEW org.aspectj.lang.SoftException   (line 74)
DUP
ACONST_NULL
INVOKESPECIAL org.aspectj.lang.SoftException.<init> (Ljava/lang/Throwable;)V
ATHROW
end public void ajc$after$glassbox_agent_ErrorContainmentTest$ErrorMockAspect$4$bfd07f()
public void ajc$before$glassbox_agent_ErrorContainmentTest$ErrorMockAspect$5$e5bddfdc()    AdviceAttribute(before, logErrorInTest(), 0, 2446)
:
GETSTATIC glassbox.agent.ErrorContainmentTest.logCount I   (line 84)
ICONST_1
IADD
PUTSTATIC glassbox.agent.ErrorContainmentTest.logCount I
RETURN   (line 85)
end public void ajc$before$glassbox_agent_ErrorContainmentTest$ErrorMockAspect$5$e5bddfdc()
public void ajc$before$glassbox_agent_ErrorContainmentTest$ErrorMockAspect$6$16ecfe62()    AdviceAttribute(before, (adviceexecution(* *) && (within(glassbox.util.logging.api.LogManagement) && (cflow(logError()) && cflow((execution(* testLoggingError(..)) && within(glassbox.agent.ErrorContainmentTest)))))), 0, 2506)
:
GETSTATIC java.lang.System.err Ljava/io/PrintStream;   (line 87)
LDC "match"
INVOKEVIRTUAL java.io.PrintStream.println (Ljava/lang/String;)V
RETURN   (line 88)
end public void ajc$before$glassbox_agent_ErrorContainmentTest$ErrorMockAspect$6$16ecfe62()
public void ajc$before$glassbox_agent_ErrorContainmentTest$ErrorMockAspect$7$e9ae8482()    AdviceAttribute(before, (adviceexecution(* *) && (within(glassbox.util.logging.api.LogManagement) && cflow((execution(* testLoggingError(..)) && within(glassbox.agent.ErrorContainmentTest))))), 0, 2721)
:
GETSTATIC java.lang.System.err Ljava/io/PrintStream;   (line 90)
LDC "match in test"
INVOKEVIRTUAL java.io.PrintStream.println (Ljava/lang/String;)V
RETURN   (line 91)
end public void ajc$before$glassbox_agent_ErrorContainmentTest$ErrorMockAspect$7$e9ae8482()
public void ajc$before$glassbox_agent_ErrorContainmentTest$ErrorMockAspect$8$c6ac5351()    AdviceAttribute(before, (adviceexecution(* *) && (within(glassbox.util.logging.api.LogManagement) && cflow(logError()))), 0, 2923)
:
GETSTATIC java.lang.System.err Ljava/io/PrintStream;   (line 93)
LDC "match in log"
INVOKEVIRTUAL java.io.PrintStream.println (Ljava/lang/String;)V
RETURN   (line 94)
end public void ajc$before$glassbox_agent_ErrorContainmentTest$ErrorMockAspect$8$c6ac5351()
public void ajc$before$glassbox_agent_ErrorContainmentTest$ErrorMockAspect$9$16ecfe62()    AdviceAttribute(before, (adviceexecution(* *) && (within(glassbox.util.logging.api.LogManagement) && (cflow(logError()) && cflow((execution(* testLoggingError(..)) && within(glassbox.agent.ErrorContainmentTest)))))), 0, 3069)
:
GETSTATIC glassbox.agent.ErrorContainmentTest.recursiveThrows I   (line 96)
ICONST_1
IADD
PUTSTATIC glassbox.agent.ErrorContainmentTest.recursiveThrows I
GETSTATIC glassbox.agent.ErrorContainmentTest.recursiveThrows I   (line 97)
ICONST_2
IF_ICMPGE L0
NEW java.lang.RuntimeException   (line 98)
DUP
LDC "recursive logging failure"
INVOKESPECIAL java.lang.RuntimeException.<init> (Ljava/lang/String;)V
ATHROW
L0: RETURN   (line 100)
end public void ajc$before$glassbox_agent_ErrorContainmentTest$ErrorMockAspect$9$16ecfe62()
public static glassbox.agent.ErrorContainmentTest$ErrorMockAspect aspectOf()    org.aspectj.weaver.AjAttribute$AjSynthetic@3cd8fe
:
GETSTATIC glassbox.agent.ErrorContainmentTest$ErrorMockAspect.ajc$perSingletonInstance Lglassbox/agent/ErrorContainmentTest$ErrorMockAspect;   (line 1)
IFNONNULL L0
NEW org.aspectj.lang.NoAspectBoundException
DUP
LDC "glassbox_agent_ErrorContainmentTest$ErrorMockAspect"
GETSTATIC glassbox.agent.ErrorContainmentTest$ErrorMockAspect.ajc$initFailureCause Ljava/lang/Throwable;
INVOKESPECIAL org.aspectj.lang.NoAspectBoundException.<init> (Ljava/lang/String;Ljava/lang/Throwable;)V
ATHROW
L0: GETSTATIC glassbox.agent.ErrorContainmentTest$ErrorMockAspect.ajc$perSingletonInstance Lglassbox/agent/ErrorContainmentTest$ErrorMockAspect;
ARETURN
end public static glassbox.agent.ErrorContainmentTest$ErrorMockAspect aspectOf()
public static boolean hasAspect()    org.aspectj.weaver.AjAttribute$AjSynthetic@1bd4f6
:
GETSTATIC glassbox.agent.ErrorContainmentTest$ErrorMockAspect.ajc$perSingletonInstance Lglassbox/agent/ErrorContainmentTest$ErrorMockAspect;   (line 1)
IFNULL L0
ICONST_1
IRETURN
L0: ICONST_0
IRETURN
end public static boolean hasAspect()
private static void ajc$postClinit()    org.aspectj.weaver.AjAttribute$AjSynthetic@1febf91
:
NEW glassbox.agent.ErrorContainmentTest$ErrorMockAspect   (line 1)
DUP
INVOKESPECIAL glassbox.agent.ErrorContainmentTest$ErrorMockAspect.<init> ()V
PUTSTATIC glassbox.agent.ErrorContainmentTest$ErrorMockAspect.ajc$perSingletonInstance Lglassbox/agent/ErrorContainmentTest$ErrorMockAspect;
RETURN
end private static void ajc$postClinit()
end public class glassbox.agent.ErrorContainmentTest$ErrorMockAspect
when type munging with (BcelTypeMunger ResolvedTypeMunger(Parent, null))
when weaving aspects
when weaving
when batch building BuildConfig[C:\devel\glassbox\.metadata\.plugins\org.eclipse.ajdt.core\glassboxMonitor.generated.lst] #Files=107

The source is:

public class ErrorContainmentTest extends TestCase {
...
	static aspect ErrorMockAspect implements NotSerializable {
...

I will try to narrow this down if the problem isn't obvious.
Comment 1 Ron Bodkin CLA 2006-08-02 14:06:07 EDT
Created attachment 47247 [details]
Self-contained AJDT project that reproduces the problem

This uses an already-built version of Glassbox built by a recent but earlier dev build. The failure depends on the effects of at least one other aspect.
Comment 2 Ron Bodkin CLA 2006-08-02 14:07:45 EDT
By the way, the previous dev build that works is actually from July 28.
Comment 3 Andrew Clement CLA 2006-08-02 14:14:24 EDT
i think i know what it'll be.
Comment 4 Andrew Clement CLA 2006-08-03 10:52:03 EDT
...but I would like to recreate it first.  Is that project really standalone?  I get all kinds of errors if I try and build it:

eg. "can't determine whether missing type javax.servlet.ServletContext is an instance of"

So I used the 5meg of jars we have had before from you and stuffed them on the classpath, now it fails with:

"can't determine whether missing type glassbox.bootstrap.log.BootstrapLog is an instance of glassbox.util.logging.api.LogOwner"

are you running with cant find type switched off?  Are you getting this on a full build or an incremental build?
Comment 5 Ron Bodkin CLA 2006-08-03 12:21:09 EDT
Hi Andy,

I think I didn't see the missing classpath entries because I ran into this error before I got that far. But I commented out the erroring out part and you are right: if you compile with -Xlint:ignore or turn off cantFindType switched off (although it looks like AJDT no longer lets you configure this) it should work unless you add the extra advice. 

I am uploading the glassboxBootstrap.jar that resolves some missing type references. The other jar that you will is the commons http client which I'll attach too. This is interesting because it isn't even on the build path of the project when compiling the jar but resolving this pointcut at weave time with the jar on the aspect path seems to require it:
    args(org.apache.commons.httpclient.HostConfiguration, httpMethod, ..)

This error happens with both full and incremental builds. 
Comment 6 Ron Bodkin CLA 2006-08-03 12:23:14 EDT
Created attachment 47339 [details]
Jar for classpath
Comment 7 Ron Bodkin CLA 2006-08-03 12:25:09 EDT
Created attachment 47341 [details]
Commons httpclient jar for classpath
Comment 8 Andrew Clement CLA 2006-08-04 06:25:34 EDT
A simple standalone testcase for the problem:

====
public aspect EMA {
    before() : cflow(execution(* *(..))) {}
}

aspect Goo {
  declare parents: EMA extends C;
  public void EMA.m() {}
}

abstract class C {
  abstract void m();
}
====

this occurs because of the declare parents targeting the aspect and the aspect has a cflow pointcut in it.  this fix is as expected, coping with null - but it was nice to verify that it is completely safe.  (Fails on 1.5.1a/1.5.2/HEAD)

testcase and fix committed ... and nothing to do with pipelining ;)
Comment 9 Andrew Clement CLA 2006-08-09 02:53:40 EDT
fix available.