java.lang.AssertionError: typeSig ERROR

JDK Bug System | Webbug Group | 8 months ago
  1. 0

    Cryptic error message when the Findbugs jar is missing in the classpath

    GitHub | 8 months ago | ipkiss42
    java.lang.AssertionError: typeSig ERROR
  2. 0

    FULL PRODUCT VERSION : ADDITIONAL OS VERSION INFORMATION : Linux dev-dsk-teuliere-1a-i-eb43600c.eu-west-1.amazon.com 3.2.45-0.6.acc.624.45.283.amzn1acc.x86_64 #1 SMP Fri Nov 21 22:39:25 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux A DESCRIPTION OF THE PROBLEM : Javac fails with an AssertionError when compiling some special files and asks me to submit a bug report. Here is the exact output: -------------------------- An exception has occurred in the compiler (1.8.0_77). 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: typeSig ERROR at com.sun.tools.javac.code.Types$SignatureGenerator.assembleSig(Types.java:4796) at com.sun.tools.javac.jvm.ClassWriter$CWSignatureGenerator.assembleSig(ClassWriter.java:299) at com.sun.tools.javac.jvm.ClassWriter.typeSig(ClassWriter.java:342) at com.sun.tools.javac.jvm.ClassWriter.writeCompoundAttribute(ClassWriter.java:891) at com.sun.tools.javac.jvm.ClassWriter.writeJavaAnnotations(ClassWriter.java:759) at com.sun.tools.javac.jvm.ClassWriter.writeMemberAttrs(ClassWriter.java:628) at com.sun.tools.javac.jvm.ClassWriter.writeMethod(ClassWriter.java:1133) at com.sun.tools.javac.jvm.ClassWriter.writeMethods(ClassWriter.java:1603) at com.sun.tools.javac.jvm.ClassWriter.writeClassFile(ClassWriter.java:1693) at com.sun.tools.javac.jvm.ClassWriter.writeClass(ClassWriter.java:1621) at com.sun.tools.javac.main.JavaCompiler.genCode(JavaCompiler.java:746) at com.sun.tools.javac.main.JavaCompiler.generate(JavaCompiler.java:1572) at com.sun.tools.javac.main.JavaCompiler.generate(JavaCompiler.java:1536) at com.sun.tools.javac.main.JavaCompiler.compile2(JavaCompiler.java:901) at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:860) 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) -------------------------- I wrote a small shell script to generate some simple Java files (as small as I could make them) and to compile them, resulting in the error above. See the "Steps to reproduce" section below. STEPS TO FOLLOW TO REPRODUCE THE PROBLEM : The following shell script can be used to reproduce the issue (explanations follow): --------------------- #!/bin/sh # Where to reproduce the bug. Do not choose an existing directory! WORK_DIR=/tmp/javac-bug # Configure the paths here JAVA_HOME=/path/to/jdk1.8 FINDBUGS_JAR=/path/to/findbugs-3.0.0.jar # Secondary variables OUTPUT_DIR=$WORK_DIR/output IMPORTED_FILE=$WORK_DIR/tmp/Foo.java MAIN_FILE=$WORK_DIR/Bar.java rm -rf $WORK_DIR echo "Creating files" # Create imported file mkdir -p $WORK_DIR/tmp cat > $IMPORTED_FILE << EOF package tmp; @edu.umd.cs.findbugs.annotations.SuppressWarnings("Foo") public class Foo {} EOF # Create main file cat > $MAIN_FILE << EOF import tmp.Foo; public class Bar { public static class InnerBar { @edu.umd.cs.findbugs.annotations.SuppressWarnings("Bar") public void bar() {} } } EOF # Compile echo "Compiling $IMPORTED_FILE" mkdir -p "$OUTPUT_DIR" $JAVA_HOME/bin/javac -d "$OUTPUT_DIR" -classpath "$FINDBUGS_JAR" "$IMPORTED_FILE" echo "Compiling $MAIN_FILE" $JAVA_HOME/bin/javac -d "$OUTPUT_DIR" -classpath "$OUTPUT_DIR" "$MAIN_FILE" --------------------- The script does the following: * Set some variables (do not forget to update the first 4 variables to point to the appropriate location) * Delete the "work directory" (used to create temporary files) * Generate 2 simple classes (tmp.Foo and Bar) * Compile them Note that the first file is compiled with the FindBugs jar in its classpath, whereas the second one is compiled without. This seems to be crucial in order to reproduce the bug. EXPECTED VERSUS ACTUAL BEHAVIOR : EXPECTED - Instead of an internal error of the compiler, I expect either a successful compilation or a nice error message telling me what is wrong with my program :) ACTUAL - Full output: --------------------- Creating files Compiling /tmp/javac-bug/tmp/Foo.java Note: /tmp/javac-bug/tmp/Foo.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details. Compiling /tmp/javac-bug/Bar.java An exception has occurred in the compiler (1.8.0_77). 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: typeSig ERROR at com.sun.tools.javac.code.Types$SignatureGenerator.assembleSig(Types.java:4796) at com.sun.tools.javac.jvm.ClassWriter$CWSignatureGenerator.assembleSig(ClassWriter.java:299) at com.sun.tools.javac.jvm.ClassWriter.typeSig(ClassWriter.java:342) at com.sun.tools.javac.jvm.ClassWriter.writeCompoundAttribute(ClassWriter.java:891) at com.sun.tools.javac.jvm.ClassWriter.writeJavaAnnotations(ClassWriter.java:759) at com.sun.tools.javac.jvm.ClassWriter.writeMemberAttrs(ClassWriter.java:628) at com.sun.tools.javac.jvm.ClassWriter.writeMethod(ClassWriter.java:1133) at com.sun.tools.javac.jvm.ClassWriter.writeMethods(ClassWriter.java:1603) at com.sun.tools.javac.jvm.ClassWriter.writeClassFile(ClassWriter.java:1693) at com.sun.tools.javac.jvm.ClassWriter.writeClass(ClassWriter.java:1621) at com.sun.tools.javac.main.JavaCompiler.genCode(JavaCompiler.java:746) at com.sun.tools.javac.main.JavaCompiler.generate(JavaCompiler.java:1572) at com.sun.tools.javac.main.JavaCompiler.generate(JavaCompiler.java:1536) at com.sun.tools.javac.main.JavaCompiler.compile2(JavaCompiler.java:901) at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:860) 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) --------------------- ERROR MESSAGES/STACK TRACES THAT OCCUR : java.lang.AssertionError: typeSig ERROR at com.sun.tools.javac.code.Types$SignatureGenerator.assembleSig(Types.java:4796) at com.sun.tools.javac.jvm.ClassWriter$CWSignatureGenerator.assembleSig(ClassWriter.java:299) at com.sun.tools.javac.jvm.ClassWriter.typeSig(ClassWriter.java:342) at com.sun.tools.javac.jvm.ClassWriter.writeCompoundAttribute(ClassWriter.java:891) at com.sun.tools.javac.jvm.ClassWriter.writeJavaAnnotations(ClassWriter.java:759) at com.sun.tools.javac.jvm.ClassWriter.writeMemberAttrs(ClassWriter.java:628) at com.sun.tools.javac.jvm.ClassWriter.writeMethod(ClassWriter.java:1133) at com.sun.tools.javac.jvm.ClassWriter.writeMethods(ClassWriter.java:1603) at com.sun.tools.javac.jvm.ClassWriter.writeClassFile(ClassWriter.java:1693) at com.sun.tools.javac.jvm.ClassWriter.writeClass(ClassWriter.java:1621) at com.sun.tools.javac.main.JavaCompiler.genCode(JavaCompiler.java:746) at com.sun.tools.javac.main.JavaCompiler.generate(JavaCompiler.java:1572) at com.sun.tools.javac.main.JavaCompiler.generate(JavaCompiler.java:1536) at com.sun.tools.javac.main.JavaCompiler.compile2(JavaCompiler.java:901) at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:860) 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) No log file is created. REPRODUCIBILITY : This bug can be reproduced occasionally. ---------- BEGIN SOURCE ---------- The script above generates 2 classes: tmp/Foo.java: --------------------- package tmp; @edu.umd.cs.findbugs.annotations.SuppressWarnings("Foo") public class Foo {} --------------------- Bar.java: --------------------- import tmp.Foo; public class Bar { public static class InnerBar { @edu.umd.cs.findbugs.annotations.SuppressWarnings("Bar") public void bar() {} } } --------------------- Please refer to the script for the exact way to compile these files. ---------- END SOURCE ---------- CUSTOMER SUBMITTED WORKAROUND : When compiling the second class (Bar.java), adding the FindBugs jar in the classpath works. However, the stack trace does not give any clue as to what is happening (it took me hours to get to a minimal example like this one). Also, I stumbled into this bug in at least 2 different programs.

    JDK Bug System | 8 months ago | Webbug Group
    java.lang.AssertionError: typeSig ERROR
  3. 0

    is this a javac bug or some error in my code

    Stack Overflow | 5 years ago | Charbel
    java.lang.AssertionError: {rawtypes}
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    [JDK-8129589] Javac fails with assertion error when lambda types are not specified - Java Bug System

    java.net | 1 year ago
    java.lang.AssertionError: attribution shouldn't be happening here

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.AssertionError

      typeSig ERROR

      at com.sun.tools.javac.code.Types$SignatureGenerator.assembleSig()
    2. Java Tools
      Main.main
      1. com.sun.tools.javac.code.Types$SignatureGenerator.assembleSig(Types.java:4796)
      2. com.sun.tools.javac.jvm.ClassWriter$CWSignatureGenerator.assembleSig(ClassWriter.java:299)
      3. com.sun.tools.javac.jvm.ClassWriter.typeSig(ClassWriter.java:342)
      4. com.sun.tools.javac.jvm.ClassWriter.writeCompoundAttribute(ClassWriter.java:891)
      5. com.sun.tools.javac.jvm.ClassWriter.writeJavaAnnotations(ClassWriter.java:759)
      6. com.sun.tools.javac.jvm.ClassWriter.writeMemberAttrs(ClassWriter.java:628)
      7. com.sun.tools.javac.jvm.ClassWriter.writeMethod(ClassWriter.java:1133)
      8. com.sun.tools.javac.jvm.ClassWriter.writeMethods(ClassWriter.java:1603)
      9. com.sun.tools.javac.jvm.ClassWriter.writeClassFile(ClassWriter.java:1693)
      10. com.sun.tools.javac.jvm.ClassWriter.writeClass(ClassWriter.java:1621)
      11. com.sun.tools.javac.main.JavaCompiler.genCode(JavaCompiler.java:746)
      12. com.sun.tools.javac.main.JavaCompiler.generate(JavaCompiler.java:1572)
      13. com.sun.tools.javac.main.JavaCompiler.generate(JavaCompiler.java:1536)
      14. com.sun.tools.javac.main.JavaCompiler.compile2(JavaCompiler.java:901)
      15. com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:860)
      16. com.sun.tools.javac.main.Main.compile(Main.java:523)
      17. com.sun.tools.javac.main.Main.compile(Main.java:381)
      18. com.sun.tools.javac.main.Main.compile(Main.java:370)
      19. com.sun.tools.javac.main.Main.compile(Main.java:361)
      20. com.sun.tools.javac.Main.compile(Main.java:56)
      21. com.sun.tools.javac.Main.main(Main.java:42)
      21 frames