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

[lworld] Javac crashes with assertion failure while handing withField when field involved is private and of inner type

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • repo-valhalla
    • repo-valhalla
    • tools
    • generic
    • generic

      The following program triggers an assertion failure in code generation:

      import java.util.List;
      import java.util.Objects;

      public class X {

          public static final __ByValue class V {
              private final int i;
              V() {
                  this.i = 0;
              }

              public static V make(int i) {
                  V v = __MakeDefault V();
                  v = __WithField(v.i, i);
                  return v;
              }
          }

          public static void main(String... args) throws Throwable {
              V v = __WithField(V.make(10).i, 20);
          }
      }

      java.lang.AssertionError
      at jdk.compiler/com.sun.tools.javac.util.Assert.error(Assert.java:155)
      at jdk.compiler/com.sun.tools.javac.util.Assert.check(Assert.java:46)
      at jdk.compiler/com.sun.tools.javac.jvm.Gen.visitWithField(Gen.java:1150)
      at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCWithField.accept(JCTree.java:1116)
      at jdk.compiler/com.sun.tools.javac.jvm.Gen.genExpr(Gen.java:819)
      at jdk.compiler/com.sun.tools.javac.jvm.Gen.visitVarDef(Gen.java:1095)
      at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCVariableDecl.accept(JCTree.java:960)
      at jdk.compiler/com.sun.tools.javac.jvm.Gen.genDef(Gen.java:597)
      at jdk.compiler/com.sun.tools.javac.jvm.Gen.genStat(Gen.java:632)
      at jdk.compiler/com.sun.tools.javac.jvm.Gen.genStat(Gen.java:618)
      at jdk.compiler/com.sun.tools.javac.jvm.Gen.genStats(Gen.java:669)
      ...

            sadayapalam Srikanth Adayapalam (Inactive)
            sadayapalam Srikanth Adayapalam (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: