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

Method.getAnnotations() changed its return value in JDK 8.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P3 P3
    • None
    • 8
    • core-libs

      FULL PRODUCT VERSION :
      Java(TM) SE Runtime Environment (build 1.8.0-ea-b117)

      ADDITIONAL OS VERSION INFORMATION :
      My test is running on the public CI-Server Travis: https://travis-ci.org/stefanbirkner/oraclejdk8-method-getannotations-bug/jobs/14898742

      A DESCRIPTION OF THE PROBLEM :
      I have two classes Super and Sub in the package foobar.

      class Super {
        @org.junit.Test
        public void methodOfSuper() {
        }
      }

      public class Sub extends Super {
      }

      It is important that the Super has package visibility. The call Sub.class.getMethod("methodOfSuper").getAnnotations() returns different values in JDK 7 and JDK 8. On JDK 7 it has no annotations while on JDK 8 it has one annotation (@Test).

      (This bug has been found to be the cause of a JUnit bug: https://github.com/junit-team/junit /issues/749 )

      REGRESSION. Last worked in version 7u45

      ADDITIONAL REGRESSION INFORMATION:
      Java(TM) SE Runtime Environment (build 1.7.0_45-b18)

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Clone the project https://github.com/stefanbirkner/oraclejdk8-method-getannotations-bug and run mvn test.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      mvn test should be successful.
      ACTUAL -
      mvn test fails.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      https://github.com/stefanbirkner/oraclejdk8-method-getannotations-bug
      ---------- END SOURCE ----------

            jfranck Joel Borggrén-Franck (Inactive)
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: