Bug 42740 - declare error fails on pointcuts composed from multiple classes
Summary: declare error fails on pointcuts composed from multiple classes
Status: RESOLVED FIXED
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: 1.1.0   Edit
Hardware: PC Windows XP
: P1 normal (vote)
Target Milestone: 1.1.1   Edit
Assignee: Jim Hugunin CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-09-08 22:47 EDT by Ron Bodkin CLA
Modified: 2003-09-09 20:39 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-09-08 22:47:35 EDT
This error occurs in both 1.1.0 and in the head of CVS as of 9/8/03. The 
compiler crash output from the CVS head version is at the end. It may be 
related to 42739, but they may be distinct problems.

Sample source:
/*
 * Created on Sep 8, 2003
 *
 * Copyright (c) 2003 New Aspects of Security. All Rights Reserved.
 */
aspect Library {
    public pointcut executionsThrowingChecked() : 
        execution(* *(..) throws (Exception+ && !RuntimeException));
}

public aspect SampleExceptionHandling {
    public pointcut scope() : within(org.atrack.model..*);
    
    public pointcut executionsThrowingChecked() : 
        Library.executionsThrowingChecked() && scope();

    declare error : executionsThrowingChecked(): 
        "no checked exceptions";
}

sample compile:
C:\eclipse\workspace\atrack>ajc src\SampleExceptionHandling.java
java.lang.Exception: Stack trace
        at java.lang.Thread.dumpStack(Thread.java:1071)
        at org.aspectj.weaver.patterns.ReferencePointcut.concretize1
(ReferencePo
intcut.java:215)
        at org.aspectj.weaver.patterns.AndPointcut.concretize1
(AndPointcut.java:
88)
        at org.aspectj.weaver.patterns.ReferencePointcut.concretize1
(ReferencePo
intcut.java:272)
        at org.aspectj.weaver.patterns.AndPointcut.concretize1
(AndPointcut.java:
88)
        at org.aspectj.weaver.patterns.ReferencePointcut.concretize1
(ReferencePo
intcut.java:272)
        at org.aspectj.weaver.patterns.Pointcut.concretize(Pointcut.java:127)
        at org.aspectj.weaver.patterns.Pointcut.concretize(Pointcut.java:120)
        at org.aspectj.weaver.Checker.concretize(Checker.java:37)
        at org.aspectj.weaver.CrosscuttingMembers.addShadowMunger
(CrosscuttingMe
mbers.java:78)
        at org.aspectj.weaver.CrosscuttingMembers.addDeclare
(CrosscuttingMembers
.java:102)
        at org.aspectj.weaver.CrosscuttingMembers.addDeclares
(CrosscuttingMember
s.java:92)
        at org.aspectj.weaver.ResolvedTypeX.collectCrosscuttingMembers
(ResolvedT
ypeX.java:332)
        at org.aspectj.weaver.CrosscuttingMembersSet.addOrReplaceAspect
(Crosscut
tingMembersSet.java:50)
        at 
org.aspectj.ajdt.internal.compiler.ast.AspectDeclaration.buildInterTy
peAndPerClause(AspectDeclaration.java:754)
        at 
org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment.buildIn
terTypeAndPerClause(AjLookupEnvironment.java:124)
        at 
org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment.complet
eTypeBindings(AjLookupEnvironment.java:91)
        at org.eclipse.jdt.internal.compiler.Compiler.beginToCompile
(Compiler.ja
va:310)
        at org.eclipse.jdt.internal.compiler.Compiler.compile
(Compiler.java:324)

        at 
org.aspectj.ajdt.internal.core.builder.AjBuildManager.performCompilat
ion(AjBuildManager.java:373)
        at org.aspectj.ajdt.internal.core.builder.AjBuildManager.doBuild
(AjBuild
Manager.java:125)
        at org.aspectj.ajdt.internal.core.builder.AjBuildManager.batchBuild
(AjBu
ildManager.java:70)
        at org.aspectj.ajdt.ajc.AjdtCommand.doCommand(AjdtCommand.java:99)
        at org.aspectj.ajdt.ajc.AjdtCommand.runCommand(AjdtCommand.java:53)
        at org.aspectj.tools.ajc.Main.run(Main.java:217)
        at org.aspectj.tools.ajc.Main.runMain(Main.java:155)
        at org.aspectj.tools.ajc.Main.main(Main.java:72)
C:\eclipse\workspace\atrack\src\SampleExceptionHandling.java:15 circular 
pointcu
t declaration involving: executionsThrowingChecked()

1 error
Comment 1 Ron Bodkin CLA 2003-09-08 22:50:57 EDT
If you change the pointcut in the library aspect to have a different name, 
then the compiler fails to see that pointcut at all:

C:\eclipse\workspace\atrack>ajc src\SampleExceptionHandling.java
C:\eclipse\workspace\atrack\src\SampleExceptionHandling.java:15 can't find 
point
cut 'execs' on SampleExceptionHandling

1 error

/*
 * Created on Sep 8, 2003
 *
 * Copyright (c) 2003 New Aspects of Security. All Rights Reserved.
 */
aspect Library {
    public pointcut execs() : 
        execution(* *(..) throws (Exception+ && !RuntimeException));
}

public aspect SampleExceptionHandling {
    public pointcut scope() : within(org.atrack.model..*);
    
    public pointcut executionsThrowingChecked() : 
        Library.execs() && scope();

    declare error : executionsThrowingChecked(): 
        "no checked exceptions";
}
Comment 2 Ron Bodkin CLA 2003-09-08 22:54:24 EDT
An even more minimal test case:

/*
 * Created on Sep 8, 2003
 *
 * Copyright (c) 2003 New Aspects of Security. All Rights Reserved.
 */
aspect Library {
    public pointcut execs(): within(*);
}

public aspect SampleExceptionHandling {
    public pointcut executionsThrowingChecked() : Library.execs();

    declare error : executionsThrowingChecked(): 
        "no checked exceptions";
}

output:
C:\eclipse\workspace\atrack>ajc src\SampleExceptionHandling.java
C:\eclipse\workspace\atrack\src\SampleExceptionHandling.java:11 can't find 
point
cut 'execs' on SampleExceptionHandling

1 error
Comment 3 Jim Hugunin CLA 2003-09-09 13:05:15 EDT
Hi Ron.  I'd like to include the test cases you've submitted here and for other
bug reports in the AspectJ test suite; however, I'm uncomfortable doing that
with the copyright all rights reserved notice that you've put on them.  Can you
please resubmit your test cases either with no copyright or with the full
eclipse CPL header?  Thanks.
Comment 4 Ron Bodkin CLA 2003-09-09 13:10:17 EDT
Contributing the sources per the CPL:

/** @author Ron Bodkin */
aspect Library {
    public pointcut executionsThrowingChecked() : 
        execution(* *(..) throws (Exception+ && !RuntimeException));
}

/** @author Ron Bodkin */
public aspect SampleExceptionHandling {
    public pointcut scope() : within(org.atrack.model..*);
    
    public pointcut executionsThrowingChecked() : 
        Library.executionsThrowingChecked() && scope();

    declare error : executionsThrowingChecked(): 
        "no checked exceptions";
}

---

/** @author Ron Bodkin */
aspect Library {
    public pointcut execs(): within(*);
}

/** @author Ron Bodkin */
public aspect SampleExceptionHandling {
    public pointcut executionsThrowingChecked() : Library.execs();

    declare error : executionsThrowingChecked(): 
        "no checked exceptions";
}

Comment 5 Jim Hugunin CLA 2003-09-09 20:36:31 EDT
the test provided below is now in the tree under bugs/declareBinding
this bug is also fixed in cvs head
Comment 6 Jim Hugunin CLA 2003-09-09 20:39:45 EDT
fixing target milestone