Bug 72781 - [evaluation] Conditional breakpoint can't resolve local var
Summary: [evaluation] Conditional breakpoint can't resolve local var
Status: CLOSED WONTFIX
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Debug (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P4 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-Debug-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: readme
Depends on:
Blocks:
 
Reported: 2004-08-27 10:26 EDT by Darin Wright CLA
Modified: 2009-08-30 02:20 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Darin Wright CLA 2004-08-27 10:26:06 EDT
Using this class, put a conditional breakpoint on the "s = i" line with "s == 
3". An error appears saying "s" cannot be resolved.

public class S3 {

    public static void main(String[] args) {
        int s;
        for (int i = 0; i < 10; i++) {
            s = i;
        	System.out.println("i " + i);
        }
    }
    
}
Comment 1 Luc Bourlier CLA 2004-08-27 14:07:51 EDT
's' is not resolved because the local variable doesn't exist yet (was no
initialised). The local variable table indicate that the variable exists only
for line 7 and the 'increment' part of the loop (line 5).

The result of 'javap -l S3' is :

Compiled from "S3.java"
public class S3 extends java.lang.Object{
public S3();
  LineNumberTable:
   line 1: 0
  LocalVariableTable:
   Start  Length  Slot  Name   Signature
   0      5      0    this       LS3;
 
public static void main(java.lang.String[]);
  LineNumberTable:
   line 5: 0
   line 6: 5
   line 7: 7
   line 5: 29
   line 9: 38
  LocalVariableTable:
   Start  Length  Slot  Name   Signature
   0      39      0    args       [Ljava/lang/String;
   7      25      1    s       I
   2      36      2    i       I
 
}

I get the result if I compile the class with javac.

Moving to JDT/core (for comment, afaik, it's the right behavior).
Comment 2 Luc Bourlier CLA 2004-08-27 14:08:38 EDT
grmfff...

s/I get the result/I get the same result/
Comment 3 Olivier Thomann CLA 2004-08-27 14:24:46 EDT
I don't see what we can do. 's' is only visible once the istore has been done.
Before that the local has no value and therefore cannot appear in the local
variable table attribute.
Comment 4 Darin Wright CLA 2004-08-27 14:28:58 EDT
I guess this is just user error. However, the error message was misleading, 
since - i.e. "can't resolve 's'" just looks wrong when the variable is already 
declared. 

I'm going to move this back to debug, and mark as later. Perhaps we can 
provide a better error message in this case. But it's not critical.
Comment 5 Darin Wright CLA 2004-08-27 14:29:19 EDT
Deferred
Comment 6 Darin Wright CLA 2006-05-12 13:32:36 EDT
Nothing to fix.
Comment 7 Darin Wright CLA 2006-06-14 15:31:34 EDT
Closing
Comment 8 Denis Roy CLA 2009-08-30 02:20:31 EDT
As of now 'LATER' and 'REMIND' resolutions are no longer supported.
Please reopen this bug if it is still valid for you.