Bug 36778

Summary: ClassFormatError due to empty interface supertype
Product: [Tools] AspectJ Reporter: Wes Isberg <wes>
Component: CompilerAssignee: Jim Hugunin <jim-aj>
Status: RESOLVED FIXED QA Contact:
Severity: major    
Priority: P2    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows NT   
Whiteboard:

Description Wes Isberg CLA 2003-04-22 19:12:42 EDT
ClassFormatError when running something like the following (actual is in 
tests/new/EmptyInterface.java):

--------- EmptyInterface.java

public class EmptyInterface {

    public static void main(String[] args) {
        new C().go();
        // at least constructor and method execution
        if (2 > Log.hits) {
            System.err.println("fail: " + Log.log);
        }
    }
}

aspect Log {
    static int hits;
    static StringBuffer log = new StringBuffer();
    interface LoggedType {}
    declare parents: C implements LoggedType;
    void around() : within(LoggedType+) 
        && !initialization(new(..))
        && !preinitialization(new(..)) 
        {
        hits++;
        log.append(thisJoinPoint + ";");
    }
}

class C {
    void go() {}
}
Comment 1 Jim Hugunin CLA 2003-04-23 12:21:47 EDT
Raising the severity because this is a common idiom and raising the priority
because this has a test case in the suite.
Comment 2 Jim Hugunin CLA 2003-04-24 17:04:39 EDT
As in AspectJ-1.0, we still can't correctly implement around advice on the 
staticinitializer of an interface.  The bug in 1.1rc1 is that we were 
generating invalid bytecode rather than signalling the limitation.

This has been fixed in the tree, and the test expanded to check that non-
around advice works in this situation and that around advice will produce a 
compiler error.