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

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

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P2
    • 8
    • 8
    • tools
    • b102
    • 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

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

              Dates

                Created:
                Updated:
                Resolved: