Bug 36778 - ClassFormatError due to empty interface supertype
Summary: ClassFormatError due to empty interface supertype
Status: RESOLVED FIXED
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows NT
: P2 major (vote)
Target Milestone: ---   Edit
Assignee: Jim Hugunin CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-04-22 19:12 EDT by Wes Isberg CLA
Modified: 2003-04-24 17:04 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 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.