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

Incorrect LOCALVARIABLE info

XMLWordPrintable

    • x86
    • windows_8

      FULL PRODUCT VERSION :
      java version "1.8.0_05"
      Java(TM) SE Runtime Environment (build 1.8.0_05-b13)
      Java HotSpot(TM) Client VM (build 25.5-b02, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Windows 8

      A DESCRIPTION OF THE PROBLEM :
      JDK 8 started to generate incorrect LOCALVARIABLE info, because of that debugger does not show local variables in some cases, see http://youtrack.jetbrains.com/issue/IDEA-126287


      REGRESSION. Last worked in version 7u51

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      compile and stop on a breakpoint in the provided source code


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      j is available as a local variable
      ACTUAL -
      not available

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      public class LocalVar {
          int workingColumn = 0;
          Matrix matrix = new Matrix();

          public static void main(String[] args) {
              LocalVar lv = new LocalVar();
              lv.foo();
          }

          private void foo() {

              Rational factor = null;

              int i,j,k;
              workingColumn = 0;
              for (i = 0; i < matrix.getHeight(); i++) {

                  int nnli = getXXX(i);
                  if (nnli != -1) {
                      matrix.swapLines(i, nnli);
                      divideXXX(workingColumn, i);

                      for (j = i+1; j < matrix.getHeight(); j++) {
                          System.out.println(j); // breakpoint here, j is not visible
                          factor = new Rational(matrix.getElementAtCoordinates
                                  (workingColumn, j));
                      }
                  }
              }
          }

          private void divideXXX(int workingColumn, int i) {

          }

          private int getXXX(int line) {
              return 5;
          }

          class Matrix {
              int getWidth() {
                  return 10;
              }

              int getHeight() {
                  return 10;
              }

              void swapLines(int a, int b) {

              }

              public int getElementAtCoordinates(int workingColumn, int j) {
                  return 2;
              }
          }

          class Rational {
              public Rational(int a) {
              }
          }
      }

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

      CUSTOMER SUBMITTED WORKAROUND :
      Use jdk 7, it generates correct LOCALVARIABLE info

            jlahoda Jan Lahoda
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: