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

Annotation of argument of enum constructor causes failure of compilation

    XMLWordPrintable

    Details

    • Subcomponent:
    • CPU:
      x86
    • OS:
      other

      Description

      FULL PRODUCT VERSION :
      java version "1.9.0-ea"
      Java(TM) SE Runtime Environment (build 1.9.0-ea-b46)
      Java HotSpot(TM) 64-Bit Server VM (build 1.9.0-ea-b46, mixed mode)

      A DESCRIPTION OF THE PROBLEM :
      For case:

      $ cat A.java

      @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.RUNTIME)
      public @interface A {
      }

      $ cat E.java
      public enum E {
        V("");

        private E(@A String p) {
        }
      }

      $ cat ETest.java

      public class ETest {
        E e;
      }

      Separate compilation of ETest.java fails:

      $ javac A.java E.java && javac ETest.java
      ETest.java:2: error: cannot access E
        E e;
        ^
        bad class file: ./E.class
          bad RuntimeInvisibleParameterAnnotations attribute: E(String)
          Please remove or make sure it appears in the correct subdirectory of the classpath.
      1 error

      Should be noted that no such problem, when compilation performed in a single step:

      $ javac A.java E.java ETest.java && echo "OK"
      OK


      REGRESSION. Last worked in version 7u71


      REPRODUCIBILITY :
      This bug can be reproduced always.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: