Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8007961

javax.lang.model tests for repeating annotations fail in getAnnotationsByType

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P2
    • Resolution: Fixed
    • Affects Version/s: 8
    • Fix Version/s: 8
    • Component/s: tools
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      b102
    • Verification:
      Verified

      Description

      The new method getAnnotationsByType(class<T>) added in Java SE 8 for the repeating Annotations feature, fail on several language model API tests.
      Some failures output are described below.

      1) Foo is repeatable with FooContainer as its containing annotation type and an @Foo annotation is placed on the subclass. Here @Foo(3) on B is deemed to "override" every @Foo annotation on A. But it does not.

      @Foo(1) @Foo(2) class A {}
      @Foo(3) class B extends A {}

      Expected value:
      B.class.getAnnotationsByType(Foo.class) = [@Foo(3)]
      Got output:
      B.class.getAnnotationsByType(Foo.class) = [@Foo(1), @Foo(2), @Foo(3)]

      2) Foo is repeatable with FooContainer as its containing annotation type. The contained @Foo annotations on class B override the uncontained @Foo(0) annotation on class A. But it does not.

      @Foo(0) class A {}
      @FooContainer({@Foo(1), @Foo(2)}) class B extends A {}

      Expected value:
      B.class.getAnnotationsByType(Foo.class) = [@Foo(1), @Foo(2)]
      Got output:
      B.class.getAnnotationsByType(Foo.class) = [@Foo(0), @Foo(1), @Foo(2)]

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                jfranck Joel Borggrén-Franck
                Reporter:
                mnunez Matherey Nunez (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: