Skip to content

Getting a ClassCastException when trying to get class annotations #562

@amirabiri

Description

@amirabiri

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions