Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » Java Inspector ignores static imports (Problem with commands Display and Inspect during debugging.)
icon13.gif  Java Inspector ignores static imports [message #839915] Mon, 09 April 2012 08:07 Go to previous message
Thomas Guckenbiehl is currently offline Thomas Guckenbiehl
Messages: 3
Registered: April 2012
Junior Member
Hi,

I have a problem with debugging Java code with Eclipse Indigo 3.7 SR2. For demonstration purposes consider the following simple program:

package eu.guckenbiehl.test;

import eu.guckenbiehl.utils.MyConstants;

public class MyTest {
  public static void main(String[] args) {
      System.out.println(MyConstants.SOME_CONSTANT); // <-- Breakpoint here
      System.out.println("Done.");
  }
}


If I debug this program, I can stop at a breakpoint on the first line of main(). But if I then mark "MyConstants.SOME_CONSTANT" and try to evaluate it using the "Display" command in the context menu, I get the error "MyConstants cannot be resolved to a variable". The same happens if I use the Inspect command from the context menu.

However, if I go on with debugging and step over that line, the value of MyConstants.SOME_CONSTANT is printed to the console without any errors. Hence, the classpath of the debugger seems to be alright. Also, if I explicitly specify the package of MyConstants writing

System.out.println(eu.guckenbiehl.utils.MyConstants.SOME_CONSTANT);

the Display and Inspect commands work fine.

This happens whenever I try to apply Display and Inspect to expressions that refer to static variables or functions. If the expression refers only to variables or functions of instances, then Display and Inspect work as I expect. I also seem to remember, that in Eclipse 3.4 it was possible to display/inspect static expressions.

So, what am I missing? Do I have to set some particular option?

Thanks for any help,
Thomas


 
Read Message icon13.gif
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic:Howto Link all projects to same code formatter rules file
Next Topic:Addon's installed in firefox are not recognized by Eclipse during runtime.
Goto Forum:
  


Current Time: Fri May 24 05:40:02 EDT 2013

Powered by FUDForum. Page generated in 0.01899 seconds