Unable to set a watchpoint on final variable [message #259036] |
Wed, 11 March 2009 12:39  |
Eclipse User |
|
|
|
Originally posted by: m.junk.com
Hi, there is a final variable I'd like to set a watchpoint for. This
variable is an ArrayList. The reference to the ArrayList will never
change, but the contents will. I don't see "Toggle watchpoint" anywhere.
Is it not possible to set a watchpoint on a final variable? Can I request
this feature?
|
|
|
|
|
Re: Unable to set a watchpoint on final variable [message #259072 is a reply to message #259064] |
Fri, 13 March 2009 12:48   |
Eclipse User |
|
|
|
Originally posted by: m.junk.com
Eric, I don't understand what you mean by setting a breakpoint when the
list changes. I would have to find all the places in the code when the
list changes, and that defeats the purpose of a watchpoint.
I realize that setting a watchpoint on a final variable seems
counter-intuitive, but the fact of the matter is, that's how Java works.
Most Java variables are references. When people want to "watch a
variable's changes", sometimes the reference itself changes, but most of
the time the reference stays the same and is merely accessed. Mauro
brings up a good point. If I could set a watchpoint for just when the
variable is accessed, that meet my goal.
I don't know how hard this would be, but my guess is that eclipse has the
logic "If a variable is final, don't allow watchpoints". If we could just
remove that logic, that would be great.
Thanks!
|
|
|
|
|
Re: Unable to set a watchpoint on final variable [message #259093 is a reply to message #259089] |
Mon, 16 March 2009 16:54  |
Eclipse User |
|
|
|
Originally posted by: m.junk.com
Name wrote:
> Mauro Molinari a écrit :
>> New User ha scritto:
>>> I don't know how hard this would be, but my guess is that eclipse has
>>> the logic "If a variable is final, don't allow watchpoints". If we
>>> could just remove that logic, that would be great.
>>
>> Is the code where you're trying to set the breakpoint on inside a JAR or
>> is it in your source classpath? In the first case, maybe the JAR is
>> compiled without enough debug information for the debugger to let you
>> set a watchpoint on final fields, which AFAIK could be inlined.
>>
>> This is just a guess.
> the bug 216098 is talking about final fields, but ask the question for
> final variables.
The code is in my source classpath. I'm able to set watchpoints on
variables in the same method that's aren't final.
|
|
|
Powered by
FUDForum. Page generated in 0.04607 seconds