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

[lworld] javac should attribute instance initializers according to their final location relative to the super ctor invocation

XMLWordPrintable

      javac should issue an error for this code:

      value class StrictAndLambda {
          StrictAndLambda vil = null;
          Runnable r = () -> { System.err.println(vil); };

          public static void main(String... args) {}
      }

      instead it is being rejected by the verifier at execution time, the error should be the same as for code:

      value class StrictAndLambda {
          StrictAndLambda vil;
          Runnable r;

          StrictAndLambda() {
              vil = null;
              r = () -> { System.err.println(vil); };
              super();
          }

          public static void main(String... args) {}
      }

            vromero Vicente Arturo Romero Zaldivar
            vromero Vicente Arturo Romero Zaldivar
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: