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

Error:java: Compilation failed: internal java compiler error

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: P4 P4
    • None
    • 14.0.1
    • tools
    • x86_64
    • windows_8

      A DESCRIPTION OF THE PROBLEM :
      Working on completing GUI assignment for school and suddenly had compiler problems.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Compiler error now happens even with older java programs that never had issues before. Happened since last update today.

      ACTUAL -
      Information:java: An exception has occurred in the compiler (14.0.1). 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, the following diagnostic, and the parameters passed to the Java compiler in your report. Thank you.
      Information:java: java.lang.ClassFormatError: Illegal UTF8 string in constant pool in class file com/sun/tools/javac/code/Type$ClassType$2
      Information:java: at java.base/java.lang.ClassLoader.defineClass2(Native Method)
      Information:java: at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1109)
      Information:java: at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:183)
      Information:java: at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:780)
      Information:java: at java.base/jdk.internal.loader.BuiltinClassLoader.findClassInModuleOrNull(BuiltinClassLoader.java:701)
      Information:java: at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:626)
      Information:java: at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:600)
      Information:java: at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
      Information:java: at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
      Information:java: at jdk.compiler/com.sun.tools.javac.code.Symbol$ClassSymbol.<init>(Symbol.java:1289)
      Information:java: at jdk.compiler/com.sun.tools.javac.code.Symbol$ModuleSymbol.create(Symbol.java:983)
      Information:java: at jdk.compiler/com.sun.tools.javac.code.Symtab.enterModule(Symtab.java:805)
      Information:java: at jdk.compiler/com.sun.tools.javac.code.Symtab$3.<init>(Symtab.java:401)
      Information:java: at jdk.compiler/com.sun.tools.javac.code.Symtab.<init>(Symtab.java:395)
      Information:java: at jdk.compiler/com.sun.tools.javac.code.Symtab.instance(Symtab.java:91)
      Information:java: at jdk.compiler/com.sun.tools.javac.comp.Attr.<init>(Attr.java:136)
      Information:java: at jdk.compiler/com.sun.tools.javac.comp.Attr.instance(Attr.java:127)
      Information:java: at jdk.compiler/com.sun.tools.javac.comp.Annotate.<init>(Annotate.java:109)
      Information:java: at jdk.compiler/com.sun.tools.javac.comp.Annotate.instance(Annotate.java:84)
      Information:java: at jdk.compiler/com.sun.tools.javac.jvm.ClassReader.<init>(ClassReader.java:253)
      Information:java: at jdk.compiler/com.sun.tools.javac.jvm.ClassReader.instance(ClassReader.java:246)
      Information:java: at jdk.compiler/com.sun.tools.javac.code.ClassFinder.<init>(ClassFinder.java:185)
      Information:java: at jdk.compiler/com.sun.tools.javac.code.ClassFinder.instance(ClassFinder.java:178)
      Information:java: at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.<init>(JavaCompiler.java:392)
      Information:java: at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.instance(JavaCompiler.java:115)
      Information:java: at jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment.<init>(JavacProcessingEnvironment.java:215)
      Information:java: at jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment.instance(JavacProcessingEnvironment.java:200)
      Information:java: at jdk.compiler/com.sun.tools.javac.api.BasicJavacTask.initPlugins(BasicJavacTask.java:216)
      Information:java: at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.prepareCompiler(JavacTaskImpl.java:199)
      Information:java: at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.lambda$doCall$0(JavacTaskImpl.java:101)
      Information:java: at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.handleExceptions(JavacTaskImpl.java:147)
      Information:java: at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.doCall(JavacTaskImpl.java:100)
      Information:java: at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.call(JavacTaskImpl.java:94)
      Information:java: at org.jetbrains.jps.javac.JavacMain.compile(JavacMain.java:207)
      Information:java: at org.jetbrains.jps.incremental.java.JavaBuilder.compileJava(JavaBuilder.java:493)
      Information:java: at org.jetbrains.jps.incremental.java.JavaBuilder.compile(JavaBuilder.java:345)
      Information:java: at org.jetbrains.jps.incremental.java.JavaBuilder.doBuild(JavaBuilder.java:270)
      Information:java: at org.jetbrains.jps.incremental.java.JavaBuilder.build(JavaBuilder.java:223)
      Information:java: at org.jetbrains.jps.incremental.IncProjectBuilder.runModuleLevelBuilders(IncProjectBuilder.java:1414)
      Information:java: at org.jetbrains.jps.incremental.IncProjectBuilder.runBuildersForChunk(IncProjectBuilder.java:1092)
      Information:java: at org.jetbrains.jps.incremental.IncProjectBuilder.buildTargetsChunk(IncProjectBuilder.java:1159)
      Information:java: at org.jetbrains.jps.incremental.IncProjectBuilder.buildChunkIfAffected(IncProjectBuilder.java:1053)
      Information:java: at org.jetbrains.jps.incremental.IncProjectBuilder.buildChunks(IncProjectBuilder.java:882)
      Information:java: at org.jetbrains.jps.incremental.IncProjectBuilder.runBuild(IncProjectBuilder.java:449)
      Information:java: at org.jetbrains.jps.incremental.IncProjectBuilder.build(IncProjectBuilder.java:190)
      Information:java: at org.jetbrains.jps.cmdline.BuildRunner.runBuild(BuildRunner.java:138)
      Information:java: at org.jetbrains.jps.cmdline.BuildSession.runBuild(BuildSession.java:297)
      Information:java: at org.jetbrains.jps.cmdline.BuildSession.run(BuildSession.java:130)
      Information:java: at org.jetbrains.jps.cmdline.BuildMain$MyMessageHandler.lambda$channelRead0$0(BuildMain.java:218)
      Information:java: at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
      Information:java: at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
      Information:java: at java.base/java.lang.Thread.run(Thread.java:832)
      Information:java: Errors occurred while compiling module 'Assignment 5 GUI'
      Information:javac 14.0.1 was used to compile java sources
      Information:2020-07-14 12:42 a.m. - Build completed with 1 error and 0 warnings in 2 s
      Error:java: Compilation failed: internal java compiler error

      ---------- BEGIN SOURCE ----------
      import javafx.application.Application;
      import javafx.scene.Scene;
      import javafx.scene.control.Button;
      import javafx.scene.control.Label;
      import javafx.scene.control.TextField;
      import javafx.scene.text.Font;
      import javafx.event.ActionEvent;
      import javafx.scene.layout.Pane;
      import javafx.stage.Stage;
      import java.util.Random;


      public class MainMathGUI extends Application {
          // TODO: Instance Variables for View Components and Model
          TextField name, userAnswer;
          Label labelA, labelC, labelW, labelQuiz;
          Button submit;

          public int numRight = 0;
          public int numWrong = 0;

          Random randA = new Random();
          Random randB = new Random();
          int x = randA.nextInt(12) + 1;
          int y = randB.nextInt(12) + 1;

          // TODO: Private Event Handlers and Helper Methods
          //private void myHandler(ActionEvent e) {
          // String msg = "";
          //int n = Integer.parseInt(numFieldC.getText());
          // for (int i = 0; i < n; i++) {
          // msg += "Hello, " + name.getText() + "! ";
          // }
          // labela.setText(msg);


          public void calculate(ActionEvent event) {
              /**
               * Create an object.
               */
              MathAB multiply = new MathAB(1, 1);

                  multiply.setA(x);
                  multiply.setB(y);

                  int user = Integer.parseInt(userAnswer.getText());
                  multiply.setUserAnswer(user);


                  if (multiply.getScore() == true) { numRight++; }

                  else {numWrong ++;}

              }



          /**
           * This is where you create your components and the model and add event
           * handlers.
           *
           * @param stage The main stage
           * @throws Exception
           */
          @Override
          public void start(Stage stage) throws Exception {
              Pane root = new Pane();
              Scene scene = new Scene(root, 400, 300); // set the size here
              stage.setTitle("Multiplication Quiz"); // set the window title here
              stage.setScene(scene);

              // TODO: Add your GUI-building code here
              root.setStyle("-fx-background-color: lightblue;");
              // 1. Create the model
              // 2. Create the GUI components
              name = new TextField("Your Name Here");

              userAnswer = new TextField();
              userAnswer.setPrefSize(80,25);
              userAnswer.relocate(250, 165);
              userAnswer.setFont(new Font("Arial", 20));

              submit = new Button("Submit");

              labelA = new Label(" Welcome!");
              labelC = new Label ("Correct: " + numRight);
              labelW = new Label ("Wrong: " + numWrong);
              labelQuiz = new Label ("Question: " + x + " * " + y + " = ");

              // 3. Add components to the root
              root.getChildren().addAll(name,userAnswer,submit,labelA,labelC,labelW,labelQuiz);

              // 4. Configure the components (colors, fonts, size, location)

              labelA.setPrefWidth(600);
              labelA.setFont(new Font("System", 18));
              labelA.setStyle("-fx-background-color: lightblue;-fx-text-fill:darkblue;");

              name.relocate(20,35);

              labelC.relocate(280, 65);
              labelC.setStyle("-fx-text-fill:green;");
              labelC.setFont(new Font("System", 18));
              labelW.relocate(283, 95);
              labelW.setStyle("-fx-text-fill:red;");
              labelW.setFont(new Font("System", 18));

              labelQuiz.relocate(40, 175);
              labelQuiz.setFont(new Font("Arial", 24));

              submit.relocate(325,260);


              // 5. Add Event Handlers and do final setup
              submit.setOnAction(this::calculate);

              // 6. Show the stage
              stage.show();
          }



          /**
           * This is the main method to launch app
           *
           * @param args unused
           */
          public static void main(String[] args) {
              launch(args);
          }
      }


      public class MathAB {
          private int a;
          private int b;
          private int user;

          public MathAB (int a, int b) {
              this.a = a;
              this.b = b;
          }

          public void setA(int a) {
              this.a = a;
          }


          public void setB(int b) {
              this.b = b;
          }
          
          public void setUserAnswer(int user) {
              this.user = user;
          }

          public boolean getScore() {
              int answer = a * b;
              if (user == answer) //if user's answer is correct
              { return true;

              } else { //if user is wrong
                  return false;
              }
          }

          @Override
          public String toString() {
              return "A" + a + " * B " + b + " = ";
          }
      }

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

      FREQUENCY : always


            sswsharm swati sharma (Inactive)
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: