konsoletyper / teavm

Compiles Java bytecode to JavaScript, WebAssembly and C
https://teavm.org
Apache License 2.0
2.55k stars 260 forks source link

@Inherited annotation is ignored #883

Closed taylortails closed 4 months ago

taylortails commented 4 months ago

When using 0.9.2 I found that annotations marked as @Inherited did not behave correctly. The annotation was not retrieved as expected.

I believe this could be tested like this: tests/src/test/java/org/teavm/classlib/java/lang/ClassTest.java

  @Inherited
  @Retention(RetentionPolicy.RUNTIME)
  @interface OnSuper {
  }

  @OnSuper
  private static class E {
  }

  private static class F extends E {
  }

  @Test
  @SkipPlatform({TestPlatform.C, TestPlatform.WEBASSEMBLY, TestPlatform.WASI})
  public void annotationInherited() {
    assertNotNull(F.class.getAnnotation(OnSuper.class));
  }

I worked around this behaviour by assuming inheritance was not implemented.