Bug 41123 - Weaving failure when using injars
Summary: Weaving failure when using injars
Status: RESOLVED FIXED
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: 1.1.0   Edit
Hardware: PC Windows XP
: P2 critical (vote)
Target Milestone: 1.1.1   Edit
Assignee: Jim Hugunin CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-08-05 00:39 EDT by Ron Bodkin CLA
Modified: 2003-08-28 08:07 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 Ron Bodkin CLA 2003-08-05 00:39:51 EDT
Sample run that fails using injars:
C:\devel\test\libraryWeave>ajc ajee\testing\ExecutionMonitor.aj

C:\devel\test\libraryWeave>jar cf ajee.jar ajee\testing\*.class

C:\devel\test\libraryWeave>ajc -injars ajee.jar model\BusObj.java 
model\MonitorB
usObj.java
C:\devel\test\libraryWeave\model\BusObj.java:3 Class must implement the 
inherite
d abstract method ExecutionMonitor.MonitoredItem.ajc$interMethodDispatch2
$ajee_t
esting_ExecutionMonitor$record(String, String)
public class BusObj {
             ^^^^^^

1 error

It works in a single pass compilation:
C:\devel\test\libraryWeave>ajc ajee\testing\ExecutionMonitor.aj 
model\BusObj.jav
a model\MonitorBusObj.java

C:\devel\test\libraryWeave>

Sample source code:
package ajee.testing;

public aspect ExecutionMonitor {
    public interface MonitoredItem {}
    private void MonitoredItem.record(String eventType, String eventName) {}
}         
---
package model;

public class BusObj {

}
---
package model;

import ajee.testing.ExecutionMonitor;

public aspect MonitorBusObj {
    declare parents: BusObj implements ExecutionMonitor.MonitoredItem;
}
Comment 1 Ron Bodkin CLA 2003-08-05 00:49:12 EDT
I uncovered this bug in trying to track down the following compiler crash, 
which may or may not be related:
Kind	Status	Priority	Description	Resource	In Folder
	Location
Error			Internal compiler error
java.lang.NullPointerException
	at org.aspectj.weaver.patterns.CflowPointcut.concretize1
(CflowPointcut.java:126)
	at org.aspectj.weaver.patterns.ReferencePointcut.concretize1
(ReferencePointcut.java:270)
	at org.aspectj.weaver.patterns.AndPointcut.concretize1
(AndPointcut.java:88)
	at org.aspectj.weaver.patterns.AndPointcut.concretize1
(AndPointcut.java:88)
	at org.aspectj.weaver.patterns.AndPointcut.concretize1
(AndPointcut.java:88)
	at org.aspectj.weaver.patterns.ReferencePointcut.concretize1
(ReferencePointcut.java:270)
	at org.aspectj.weaver.patterns.AndPointcut.concretize1
(AndPointcut.java:88)
	at org.aspectj.weaver.patterns.Pointcut.concretize(Pointcut.java:127)
	at org.aspectj.weaver.patterns.Pointcut.concretize(Pointcut.java:120)
	at org.aspectj.weaver.Advice.concretize(Advice.java:216)
	at org.aspectj.weaver.CrosscuttingMembers.addShadowMunger
(CrosscuttingMembers.java:78)
	at org.aspectj.weaver.CrosscuttingMembers.addShadowMungers
(CrosscuttingMembers.java:72)
	at org.aspectj.weaver.ResolvedTypeX.collectCrosscuttingMembers
(ResolvedTypeX.java:328)
	at org.aspectj.weaver.CrosscuttingMembersSet.addOrReplaceAspect
(CrosscuttingMembersSet.java:50)
	at 
org.aspectj.ajdt.internal.compiler.ast.AspectDeclaration.buildInterTypeAndPerCl
ause(AspectDeclaration.java:747)
	at 
org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment.buildInterTypeAnd
PerClause(AjLookupEnvironment.java:120)
	at 
org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment.buildInterTypeAnd
PerClause(AjLookupEnvironment.java:136)
	at 
org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment.completeTypeBindi
ngs(AjLookupEnvironment.java:87)
	at org.eclipse.jdt.internal.compiler.Compiler.beginToCompile
(Compiler.java:310)
	at org.eclipse.jdt.internal.compiler.Compiler.compile
(Compiler.java:324)
	at 
org.aspectj.ajdt.internal.core.builder.AjBuildManager.performCompilation
(AjBuildManager.java:372)
	at org.aspectj.ajdt.internal.core.builder.AjBuildManager.doBuild
(AjBuildManager.java:133)
	at org.aspectj.ajdt.internal.core.builder.AjBuildManager.batchBuild
(AjBuildManager.java:78)
	at org.aspectj.ajde.internal.CompilerAdapter.compile
(CompilerAdapter.java:117)
	at org.aspectj.ajde.internal.AspectJBuildManager$CompilerThread.run
(AspectJBuildManager.java:164)
	ClaimForm.java
	ClaimsSample/src/com/newaspects/claimsSample/ui/controller	
Comment 2 Andrew Clement CLA 2003-08-07 04:41:57 EDT
I *think* the NPE that Ron mentions is a dup of another bug Jim fixed recently 
to do with concretizing advice too early when it was coming from a library.  I 
can recreate Rons initial bug with the currently available version of 1.1 - I'm 
going to retry it on a development build of 1.1.1.
Comment 3 Andrew Clement CLA 2003-08-07 10:41:47 EDT
Also fails in the same way if I change it to:

ajc -aspectpath ajee.jar model\BusObj.java model\MonitorBusObj.java

Or

set CLASSPATH=ajee.jar
ajc model\*.java

Does that mean the method:

ExecutionMonitor.MonitoredItem.ajc$interMethodDispatch2
$ajee_testing_ExecutionMonitor$record(String, String)

is not being made synthetic when it is written out?
Comment 4 Jim Hugunin CLA 2003-08-07 21:32:11 EDT
Andy was right on both counts.  Ron's original stack-trace issue has been
resolved.  This bug is caused by the weaver not putting the Synthetic attribute
on methods with mangled names, which can cause problems for code that extends
those classes/interfaces.

In addition to adding the Synthetic attribute, I also added several checks in
the eclipse compiler phase to produce errors when a class implements an
interface that has either non-abstract methods or non-static fields -- and the
aspect that produced those is not on the source or aspectpath.  Without this
error, it is easy for ajc to generate code that will have unimplemented method
exceptions thrown at runtime from the VM.
Comment 5 Adrian Colyer CLA 2003-08-28 08:07:08 EDT
updated target milestone field to 1.1.1