Bug 155357 - Pointcuts in Interfaces Should be Implicitly Public
Summary: Pointcuts in Interfaces Should be Implicitly Public
Status: NEW
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: DEVELOPMENT   Edit
Hardware: PC Windows XP
: P5 minor (vote)
Target Milestone: ---   Edit
Assignee: aspectj inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-08-28 02:21 EDT by Ron Bodkin CLA
Modified: 2007-10-25 05:10 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ron Bodkin CLA 2006-08-28 02:21:55 EDT
This fails on ajc 1.5.2 and a similar program failed on recent dev builds. Work-around: make the pointcut explicitly public.

Failing Program:
package sub;

public interface Interface {
    pointcut foo() : execution(* foo());
}

package user;

import sub.Interface;

public aspect Caller {
    before() : Interface.foo() {}
}

>ajc sub\Interface.java user\Caller.java
C:\devel\scratch\interfacePcd\user\Caller.java:7 [error] pointcut declaration po
intcut sub.Interface.foo() is not accessible
before() : Interface.foo() {}
           ^^^^^^^^^^

1 error
Comment 1 Wes Isberg CLA 2007-02-16 04:33:54 EST
The programming guide notes that methods defined on interfaces need not be public, so I'm not sure why pointcuts must be.
--------------------------------
Any intertype declaration of an abstract method on an interface must be specified as public, you will get a compile time error message indicating this is a compiler limitation if you do not specify public. A non-abstract method declared on an interface can use any access modifier except protected. Note that this is different to normal Java rules where all members declared in an interface are implicitly public.
---------------------------------