ReadyTalk / avian

[INACTIVE] Avian is a lightweight virtual machine and class library designed to provide a useful subset of Java's features, suitable for building self-contained applications.
https://readytalk.github.io/avian/
Other
1.22k stars 172 forks source link

Getting a ClassCastException when trying to get class annotations #562

Open amirabiri opened 6 years ago

amirabiri commented 6 years ago

I'm getting a ClassCastException on a simple attempt to get annotations of a class.

I've attached a zip with code that reproduces the problem. The trigger is simple:

public static void main(String[] args) {
    for (Object ann : MyCommand.class.getAnnotations()) {
        System.out.println(ann.getClass().getName());
    }
}

Running with java works just fine, with avian I get a ClassCastException:

# java -cp build/classes/java/main org.abiri.Main
com.sun.proxy.$Proxy1

# avian -cp build/classes/java/main org.abiri.Main
java/lang/ClassCastException: [B cannot be cast to [Ljava.lang.Object;
  at java/lang/Class.countAnnotations (line 686)
  at java/lang/Class.getAnnotations (line 693)
  at org/abiri/Main.main (line 5)

running on a macOS with avian installed via homebrew, version 1.2.0.

avian-bug.zip