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

Javac crash when compiling code with --enable-preview

    Details

    • Subcomponent:
    • CPU:
      x86_64
    • OS:
      linux

      Description

      ADDITIONAL SYSTEM INFORMATION :
      Arch Linux x86_64
      Oracle JDK 15

      A DESCRIPTION OF THE PROBLEM :
      I migrated from Java 14 to Java 15 without changing any of my source code (both was used with --enable-preview option), and when trying to recompile my code this crash occurred

      java: java.lang.ClassCastException: class com.sun.tools.javac.util.SharedNameTable$NameImpl cannot be cast to class com.sun.tools.javac.code.Symbol$ClassSymbol (com.sun.tools.javac.util.SharedNameTable$NameImpl and com.sun.tools.javac.code.Symbol$ClassSymbol are in module jdk.compiler of loader 'app')
      java: at jdk.compiler/com.sun.tools.javac.jvm.PoolReader.getClass(PoolReader.java:95)
      java: at jdk.compiler/com.sun.tools.javac.jvm.ClassReader$27.read(ClassReader.java:1222)
      java: at jdk.compiler/com.sun.tools.javac.jvm.ClassReader.readAttrs(ClassReader.java:1358)
      java: at jdk.compiler/com.sun.tools.javac.jvm.ClassReader.readClassAttrs(ClassReader.java:1372)
      java: at jdk.compiler/com.sun.tools.javac.jvm.ClassReader.readClass(ClassReader.java:2496)
      java: at jdk.compiler/com.sun.tools.javac.jvm.ClassReader.readClassBuffer(ClassReader.java:2598)
      java: at jdk.compiler/com.sun.tools.javac.jvm.ClassReader.readClassFile(ClassReader.java:2612)
      java: at jdk.compiler/com.sun.tools.javac.code.ClassFinder.fillIn(ClassFinder.java:362)
      java: at jdk.compiler/com.sun.tools.javac.code.ClassFinder.complete(ClassFinder.java:292)
      java: at jdk.compiler/com.sun.tools.javac.code.Symbol.complete(Symbol.java:681)
      java: at jdk.compiler/com.sun.tools.javac.code.Symbol$ClassSymbol.complete(Symbol.java:1409)
      java: at jdk.compiler/com.sun.tools.javac.code.ClassFinder.loadClass(ClassFinder.java:435)
      java: at jdk.compiler/com.sun.tools.javac.comp.Resolve.loadClass(Resolve.java:2007)
      java: at jdk.compiler/com.sun.tools.javac.comp.Resolve.findIdentInPackageInternal(Resolve.java:2402)
      java: at jdk.compiler/com.sun.tools.javac.comp.Resolve.findIdentInPackage(Resolve.java:2390)
      java: at jdk.compiler/com.sun.tools.javac.comp.Attr.selectSym(Attr.java:4213)
      java: at jdk.compiler/com.sun.tools.javac.comp.Attr.visitSelect(Attr.java:4098)
      java: at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCFieldAccess.accept(JCTree.java:2285)
      java: at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:665)
      java: at jdk.compiler/com.sun.tools.javac.comp.Attr.attribType(Attr.java:731)
      java: at jdk.compiler/com.sun.tools.javac.comp.Attr.attribType(Attr.java:724)
      java: at jdk.compiler/com.sun.tools.javac.comp.TypeEnter$ImportsPhase.attribImportType(TypeEnter.java:445)
      java: at jdk.compiler/com.sun.tools.javac.comp.TypeEnter$ImportsPhase.doImport(TypeEnter.java:428)
      java: at jdk.compiler/com.sun.tools.javac.comp.TypeEnter$ImportsPhase.resolveImports(TypeEnter.java:368)
      java: at jdk.compiler/com.sun.tools.javac.comp.TypeEnter$ImportsPhase.runPhase(TypeEnter.java:325)
      java: at jdk.compiler/com.sun.tools.javac.comp.TypeEnter$Phase.doCompleteEnvs(TypeEnter.java:286)
      java: at jdk.compiler/com.sun.tools.javac.comp.TypeEnter$Phase.completeEnvs(TypeEnter.java:255)
      java: at jdk.compiler/com.sun.tools.javac.comp.TypeEnter.complete(TypeEnter.java:202)
      java: at jdk.compiler/com.sun.tools.javac.comp.Enter.complete(Enter.java:584)
      java: at jdk.compiler/com.sun.tools.javac.comp.Enter.main(Enter.java:561)
      java: at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.enterTrees(JavaCompiler.java:1069)
      java: at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:936)
      java: at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.lambda$doCall$0(JavacTaskImpl.java:104)
      java: at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.handleExceptions(JavacTaskImpl.java:147)
      java: at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.doCall(JavacTaskImpl.java:100)
      java: at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.call(JavacTaskImpl.java:94)
      java: at org.jetbrains.jps.javac.JavacMain.compile(JavacMain.java:207)
      java: at org.jetbrains.jps.incremental.java.JavaBuilder.compileJava(JavaBuilder.java:495)
      java: at org.jetbrains.jps.incremental.java.JavaBuilder.compile(JavaBuilder.java:347)
      java: at org.jetbrains.jps.incremental.java.JavaBuilder.doBuild(JavaBuilder.java:271)
      java: at org.jetbrains.jps.incremental.java.JavaBuilder.build(JavaBuilder.java:225)
      java: at org.jetbrains.jps.incremental.IncProjectBuilder.runModuleLevelBuilders(IncProjectBuilder.java:1426)
      java: at org.jetbrains.jps.incremental.IncProjectBuilder.runBuildersForChunk(IncProjectBuilder.java:1105)
      java: at org.jetbrains.jps.incremental.IncProjectBuilder.buildTargetsChunk(IncProjectBuilder.java:1172)
      java: at org.jetbrains.jps.incremental.IncProjectBuilder.buildChunkIfAffected(IncProjectBuilder.java:1066)
      java: at org.jetbrains.jps.incremental.IncProjectBuilder.access$1200(IncProjectBuilder.java:67)
      java: at org.jetbrains.jps.incremental.IncProjectBuilder$BuildParallelizer$1.run(IncProjectBuilder.java:1006)
      java: at com.intellij.util.concurrency.BoundedTaskExecutor.doRun(BoundedTaskExecutor.java:216)
      java: at com.intellij.util.concurrency.BoundedTaskExecutor.access$200(BoundedTaskExecutor.java:27)
      java: at com.intellij.util.concurrency.BoundedTaskExecutor$1.execute(BoundedTaskExecutor.java:195)
      java: at com.intellij.util.ConcurrencyUtil.runUnderThreadName(ConcurrencyUtil.java:208)
      java: at com.intellij.util.concurrency.BoundedTaskExecutor$1.run(BoundedTaskExecutor.java:184)
      java: at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
      java: at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)

      REGRESSION : Last worked in version 14.0.2

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Compile code with Java 15 compiler with --enable-preview option
      I don't know what code exactly causes this error

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Code compiles without compiler crash
      ACTUAL -
      Compiler crashes

      FREQUENCY : always


        Attachments

          Activity

            People

            • Assignee:
              adev ANUPAM DEV
              Reporter:
              webbuggrp Webbug Group
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: