Bug 42539 - throw derivative pointcuts not advised.
Summary: throw derivative pointcuts not advised.
Status: RESOLVED FIXED
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: 1.1.0   Edit
Hardware: PC Windows 2000
: P2 major (vote)
Target Milestone: 1.1.1   Edit
Assignee: Jim Hugunin CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-09-04 11:15 EDT by Keith Sader CLA
Modified: 2003-09-04 11:44 EDT (History)
0 users

See Also:


Attachments
A to be advised class (218 bytes, application/octet-stream)
2003-09-04 11:16 EDT, Keith Sader CLA
no flags Details
The offending aspect and pointcut (203 bytes, application/octet-stream)
2003-09-04 11:17 EDT, Keith Sader CLA
no flags Details
listing file for ajc (73 bytes, application/octet-stream)
2003-09-04 11:17 EDT, Keith Sader CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Keith Sader CLA 2003-09-04 11:15:58 EDT
Given the following point cut and advice:

public aspect ExceptionAspect
{
    pointcut exceptionThrower() : execution(public * ExceptionBugTest.*(..)
throws Exception+);

    declare warning : exceptionThrower() : "throws Exception+";
}

And the to be aspected code:

public class ExceptionBugTest
{

    class MyException extends Exception
    {
    }

    public void method1() throws Exception
    {
    }

    public void method2() throws MyException
    {
    }
}

listing file default.lst:
C:\temp\AJC Bug\ExceptionAspect.aj
C:\temp\AJC Bug\ExceptionBugTest.java


AJC does not advise ExceptionBugTest.method2().  The output from the compilation
is the following:
C:\temp\AJC Bug>ajc -argfile default.lst -classpath %ASPECTJ_HOME%\lib\aspectjrt.jar
C:\eclipse\workspace\AJC Bug\ExceptionBugTest.java:11 throws Exception+

From the aspect-j mailing list, contributed by Jim Hugunin:
<detail>The bug was caused because the code for ThrowsPattern mistakenly
used the internal protected method TypePattern.matchesExactly instead of the
external public method TypePattern.matchesStatically.  Because the classes were
in the same package, Java's accessibility rules allowed this.  It would be nice
if there was an easy way to specifiy that a method could only be accessed from
subtypes.</detail>
Comment 1 Keith Sader CLA 2003-09-04 11:16:53 EDT
Created attachment 5985 [details]
A to be advised class
Comment 2 Keith Sader CLA 2003-09-04 11:17:19 EDT
Created attachment 5986 [details]
The offending aspect and pointcut
Comment 3 Keith Sader CLA 2003-09-04 11:17:33 EDT
Created attachment 5987 [details]
listing file for ajc
Comment 4 Jim Hugunin CLA 2003-09-04 11:44:35 EDT
The test provided has been added to tests/bugs/throwsSignature.  This bug is now
fixed in the tree for the 1.1.1 release.  Thanks for the clear and easy to
reproduce bug report.