JDK-8025998 : Missing LV table in lambda bodies
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 8
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2013-10-07
  • Updated: 2015-01-15
  • Resolved: 2013-10-16
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 8
8 b113Fixed
Related Reports
Cloners :  
Relates :  
Description
When the compiler desugars a lambda body to a method, there is no local variable table generated in the classfile.  This prevents debuggers from being able to examine locals when stepping into lambdas.  

For example, for the following class:

class Foo1 {
    public static void x() { 
        int i = 0;
    }
}

there is an LVTable:

public static void x();
    descriptor: ()V
    flags: ACC_PUBLIC, ACC_STATIC
    Code:
      stack=1, locals=1, args_size=0
         0: iconst_0      
         1: istore_0      
         2: return        
      LineNumberTable:
        line 3: 0
        line 4: 2
      LocalVariableTable:
        Start  Length  Slot  Name   Signature
            2       1     0     i   I

but for 

class Foo2 {
    public static Runnable r = () -> { 
        int i = 0;
    };
}

there is no LVtable:

  private static void lambda$static$0();
    descriptor: ()V
    flags: ACC_PRIVATE, ACC_STATIC, ACC_SYNTHETIC
    Code:
      stack=1, locals=1, args_size=0
         0: iconst_0      
         1: istore_0      
         2: return        
      LineNumberTable:
        line 1: 0
        line 4: 2


Comments
Breaks debug build -- fix reverted -- see JDK-8026704
16-10-2013

The problem seems to be round about Gen 2886 @Override public void visitMethodDef(JCMethodDecl tree) { if ((tree.sym.flags() & (SYNTHETIC | GENERATEDCONSTR)) != 0) { return; } Lambda method bodies are synthetic so they don't get analyzed for an LVT.
09-10-2013