2

When I try to set variable access breakpoint in Eclipse Kepler (I didn't check other versions) on public static final constants Eclipse is creating normal breakpoint as shown below. Normal breakpoint on variable

Is it possible to debug access to public static final variables in Java on Eclipse Kepler?

  • And the normal breakpoint doesn't block access? – Sotirios Delimanolis Sep 27 '13 at 15:05
  • It doesn't. Whats more - variable breakpoint should look different and it should have a little tick sign on the bottom. – Tomasz Bielaszewski Sep 27 '13 at 15:06
  • Why do you need this kind of feature - debugging `String` creation doesn't seem to be that valuable? – home Sep 27 '13 at 15:11
  • I'm not debugging creation of this string. Breakpoint on variable usually allows to debug access to this var. – Tomasz Bielaszewski Sep 27 '13 at 15:12
  • 2
    @home - breakpoint on variable is called watchpoint. You can read about this here: http://www.eclipse-tips.com/tips/29-types-of-breakpoints-in-eclipse#Watchpoint – Tomasz Bielaszewski Sep 27 '13 at 15:14
  • 1
    @grizwold: I know about watchpoints. Your String probably gets inlined, so that you cannot hit the breakpoint: http://stackoverflow.com/questions/1406616/is-java-guaranteed-to-inline-string-constants-if-they-can-be-determined-at-compi – home Sep 28 '13 at 04:22

1 Answers1

0

There is a quite old known bug on eclipse about the impossibility to add watchpoints on final field, that should be fixed on the next release of eclipse (4.4). However, as home said in his comment, your string beeing a compile-time constant expression (see JLS7 4.12.4) it is likely to be inlined, and so even when this bug will get fixed, you wont be able to add a watch point on your field.