Bug 80780 - IncompatibleClassChangeError for Annotations
Summary: IncompatibleClassChangeError for Annotations
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.1 M4   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-12-12 15:20 EST by Kasper Nielsen CLA
Modified: 2004-12-15 12:27 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.