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

SymbolMetadata.setDeclarationAttributesWithCompletion causes AssertionError

XMLWordPrintable

    • x86_64
    • linux

      ADDITIONAL SYSTEM INFORMATION :
      Linux coder-VirtualBox 4.15.0-47-generic #50-Ubuntu SMP Wed Mar 13 10:44:52 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

      $ java -version
      openjdk version "1.8.0_191"
      OpenJDK Runtime Environment (build 1.8.0_191-8u191-b12-2ubuntu0.18.04.1-b12)
      OpenJDK 64-Bit Server VM (build 25.191-b12, mixed mode)


      A DESCRIPTION OF THE PROBLEM :
      I got java.lang.AssertionError when trying to compile two java source code.

      REGRESSION : Last worked in version 8u192

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Create two similar java files,: Put one in current working directory, and put other to "kps" subdirectory:

      /bin/echo -e '@javax.xml.bind.annotation.XmlSchema(namespace = "http://ws.kps/")\npackage kps.wsclient;\n'>package-info.java
      mkdir kps
      cp package-info.java kps

      Get a copy of log4j-core-2.11.2.jar (https://logging.apache.org/log4j/2.0/download.html) , and put it to the current work directory, and compile the source files with a command:

      /usr/bin/javac -classpath ./log4j-core-2.11.2.jar package-info.java kps/package-info.java



      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Some other error message than java.lang.AssertionError.
      ACTUAL -
      An exception has occurred in the compiler (1.8.0_191). Please file a bug against the Java compiler via the Java bug reporting page (http://bugreport.java.com) after checking the Bug Database (http://bugs.java.com) for duplicates. Include your program and the following diagnostic in your report. Thank you.
      java.lang.AssertionError
      at com.sun.tools.javac.util.Assert.error(Assert.java:126)
      at com.sun.tools.javac.util.Assert.check(Assert.java:45)
      at com.sun.tools.javac.code.SymbolMetadata.setDeclarationAttributesWithCompletion(SymbolMetadata.java:161)
      at com.sun.tools.javac.code.Symbol.setDeclarationAttributesWithCompletion(Symbol.java:215)
      at com.sun.tools.javac.comp.MemberEnter.actualEnterAnnotations(MemberEnter.java:952)
      at com.sun.tools.javac.comp.MemberEnter.access$600(MemberEnter.java:64)
      at com.sun.tools.javac.comp.MemberEnter$5.run(MemberEnter.java:876)
      at com.sun.tools.javac.comp.Annotate.flush(Annotate.java:143)
      at com.sun.tools.javac.comp.Annotate.enterDone(Annotate.java:129)
      at com.sun.tools.javac.comp.Enter.complete(Enter.java:512)
      at com.sun.tools.javac.comp.Enter.main(Enter.java:471)
      at com.sun.tools.javac.main.JavaCompiler.enterTrees(JavaCompiler.java:982)
      at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:857)
      at com.sun.tools.javac.main.Main.compile(Main.java:523)
      at com.sun.tools.javac.main.Main.compile(Main.java:381)
      at com.sun.tools.javac.main.Main.compile(Main.java:370)
      at com.sun.tools.javac.main.Main.compile(Main.java:361)
      at com.sun.tools.javac.Main.compile(Main.java:56)
      at com.sun.tools.javac.Main.main(Main.java:42)
       

      ---------- BEGIN SOURCE ----------
      "package-info.java" in current working directory contains two rows:

      @javax.xml.bind.annotation.XmlSchema(namespace = "http://ws.kps/")
      package kps.wsclient;

      "package-info.java" in "kps" subdirectory contains two rows:

      @javax.xml.bind.annotation.XmlSchema(namespace = "http://ws.kps/")
      package kps.wsclient;

      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Replace "./log4j-core-2.11.2.jar" in classpath with ".":, and compile source files by using command:

      /usr/bin/javac -classpath . package-info.java kps/package-info.java
      kps/package-info.java:2: warning: a package-info.java file has already been seen for package kps.wsclient
      package kps.wsclient;
                 ^
      kps/package-info.java:1: error: package kps.wsclient has already been annotated
      @javax.xml.bind.annotation.XmlSchema(namespace = "http://ws.kps/")


      FREQUENCY : always


            fmatte Fairoz Matte
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: