Bug 80780

Summary: IncompatibleClassChangeError for Annotations
Product: [Eclipse Project] JDT Reporter: Kasper Nielsen <news>
Component: CoreAssignee: Olivier Thomann <Olivier_Thomann>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 3.1   
Target Milestone: 3.1 M4   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Kasper Nielsen CLA 2004-12-12 15:20:00 EST
Following small program fails with 
Exception in thread "main" java.lang.IncompatibleClassChangeError
	at ....main(MyAnonTester.java:14)

--------------snippet--------
import java.lang.annotation.*;
import java.lang.reflect.Method;

public class MyAnonTester {
    public static void main(String[] args) {
        Object o = new MyAnonTester();
        for (Method m : o.getClass().getMethods()) {
            if (m.isAnnotationPresent(MyAnon.class)) {
                System.out.println(m.getAnnotation(MyAnon.class).c());
            }
        }
    }
    @MyAnon(c = MyAnonTester.class) 
    public void foo() {}

    @Retention(RetentionPolicy.RUNTIME) 
    public @interface MyAnon {
        Class c();
    }
}
Comment 1 Olivier Thomann CLA 2004-12-12 21:00:55 EST
I will investigate.
Comment 2 Olivier Thomann CLA 2004-12-12 22:34:09 EST
The problem came from the invocation of the annotation type member declaration.
It requires an invokeinterface bytecode and not an invokevirtual.

Fixed and released in HEAD.
Regression test added in AnnotationTest.test099()
Comment 3 Frederic Fusier CLA 2004-12-15 12:27:23 EST
erified for 3.1 M4 using build I200412142000.