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

check for cycles in type variables can provoke NPE

    Details

    • Subcomponent:
    • Resolved In Build:
      b04
    • CPU:
      x86_64
    • OS:
      generic

      Description

      ADDITIONAL SYSTEM INFORMATION :
      Linux Mint 18.3, 64-bit;
      Java 1.8.0_191, 10.0.2, 11, 12-ea (2019-03-19).

      A DESCRIPTION OF THE PROBLEM :
      Trying to compile the code attached throws an error from the Java compiler.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. Create a java file with the attached code
      2. Run "javac code.java"

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The corresponding class files get generated
      ACTUAL -
      The following error is thrown by javac:
      java.lang.NullPointerException
      at jdk.compiler/com.sun.tools.javac.code.Types.getBounds(Types.java:2677)
      at jdk.compiler/com.sun.tools.javac.comp.Check.checkNonCyclic1(Check.java:2292)
      at jdk.compiler/com.sun.tools.javac.comp.Check.checkNonCyclic1(Check.java:2293)
      at jdk.compiler/com.sun.tools.javac.comp.Check.checkNonCyclic(Check.java:2278)
      at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTypeVariables(Attr.java:815)
      at jdk.compiler/com.sun.tools.javac.comp.TypeEnter$HeaderPhase.runPhase(TypeEnter.java:835)
      at jdk.compiler/com.sun.tools.javac.comp.TypeEnter$Phase.doCompleteEnvs(TypeEnter.java:282)
      at jdk.compiler/com.sun.tools.javac.comp.TypeEnter$Phase.completeEnvs(TypeEnter.java:251)
      at jdk.compiler/com.sun.tools.javac.comp.TypeEnter$Phase.completeEnvs(TypeEnter.java:266)
      at jdk.compiler/com.sun.tools.javac.comp.TypeEnter$Phase.completeEnvs(TypeEnter.java:266)
      at jdk.compiler/com.sun.tools.javac.comp.TypeEnter.complete(TypeEnter.java:198)
      at jdk.compiler/com.sun.tools.javac.code.Symbol.complete(Symbol.java:642)
      at jdk.compiler/com.sun.tools.javac.code.Symbol$ClassSymbol.complete(Symbol.java:1326)
      at jdk.compiler/com.sun.tools.javac.code.Symbol$ClassSymbol.flags(Symbol.java:1259)
      at jdk.compiler/com.sun.tools.javac.comp.Resolve.isAccessible(Resolve.java:403)
      at jdk.compiler/com.sun.tools.javac.comp.Resolve.isAccessible(Resolve.java:387)
      at jdk.compiler/com.sun.tools.javac.comp.Resolve.findImmediateMemberType(Resolve.java:2169)
      at jdk.compiler/com.sun.tools.javac.comp.Resolve.findMemberType(Resolve.java:2224)
      at jdk.compiler/com.sun.tools.javac.comp.Resolve.findIdentInTypeInternal(Resolve.java:2420)
      at jdk.compiler/com.sun.tools.javac.comp.Resolve.findIdentInType(Resolve.java:2406)
      at jdk.compiler/com.sun.tools.javac.comp.Attr.selectSym(Attr.java:3932)
      at jdk.compiler/com.sun.tools.javac.comp.Attr.visitSelect(Attr.java:3802)
      at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCFieldAccess.accept(JCTree.java:2189)
      at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:664)
      at jdk.compiler/com.sun.tools.javac.comp.Attr.attribType(Attr.java:728)
      at jdk.compiler/com.sun.tools.javac.comp.Attr.attribType(Attr.java:721)
      at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTypeVariables(Attr.java:803)
      at jdk.compiler/com.sun.tools.javac.comp.TypeEnter$HeaderPhase.runPhase(TypeEnter.java:835)
      at jdk.compiler/com.sun.tools.javac.comp.TypeEnter$Phase.doCompleteEnvs(TypeEnter.java:282)
      at jdk.compiler/com.sun.tools.javac.comp.TypeEnter$Phase.completeEnvs(TypeEnter.java:251)
      at jdk.compiler/com.sun.tools.javac.comp.TypeEnter$Phase.completeEnvs(TypeEnter.java:266)
      at jdk.compiler/com.sun.tools.javac.comp.TypeEnter$Phase.completeEnvs(TypeEnter.java:266)
      at jdk.compiler/com.sun.tools.javac.comp.TypeEnter.complete(TypeEnter.java:198)
      at jdk.compiler/com.sun.tools.javac.code.Symbol.complete(Symbol.java:642)
      at jdk.compiler/com.sun.tools.javac.code.Symbol$ClassSymbol.complete(Symbol.java:1326)
      at jdk.compiler/com.sun.tools.javac.comp.Enter.complete(Enter.java:584)
      at jdk.compiler/com.sun.tools.javac.comp.Enter.main(Enter.java:561)
      at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.enterTrees(JavaCompiler.java:1066)
      at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:937)
      at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:311)
      at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:170)
      at jdk.compiler/com.sun.tools.javac.Main.compile(Main.java:57)
      at jdk.compiler/com.sun.tools.javac.Main.main(Main.java:43)


      ---------- BEGIN SOURCE ----------
      class O<A extends O.I, B> {
        class I<Bc extends B> { }
      }
      ---------- END SOURCE ----------

      FREQUENCY : always


        Attachments

          Activity

            People

            • Assignee:
              vromero Vicente Arturo Romero Zaldivar
              Reporter:
              webbuggrp Webbug Group
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: