JDT Debug - How to watch non-public variables ? [message #1785057] |
Sun, 08 April 2018 20:50 |
Matthew Ambrose Messages: 3 Registered: March 2018 |
Junior Member |
|
|
I am not new to programming but I am just learning the Java language and Eclipse. I want to see how Java works internally for some of the various "standard" imported classes using Eclipse's debug facilities (JDT Debug). My setup (Oxygen w/ JDK SE8 on Windows 8.1) works fine as far as single stepping through the code but many of the imported Class variables are unable to be placed into a watchlist or expression monitor, which I think is because they are not defined as "public".
As an example: I want to learn how java.math.BigInteger works so I wrote a quick program which uses the pow() method. The program runs successfully, and when using debug mode I am able to track the flow fine as well. What I cannot seem to do is to see the values of the internal "default" (no access modifier) variables. Below are three such variables found in BigInteger.java (lines 2225-2231):
int powersOfTwo = partToSquare.getLowestSetBit();
long bitsToShift = (long)powersOfTwo * exponent;
if (bitsToShift > Integer.MAX_VALUE) {
reportOverflow();
}
int remainingBits;
Any suggestions on how to expose these variables to JDT Debug for learning purposes?
[Updated on: Mon, 09 April 2018 02:34] Report message to a moderator
|
|
|
Re: JDT Debug - How to watch non-public variables ? [message #1785078 is a reply to message #1785057] |
Mon, 09 April 2018 08:41 |
Sarika Sinha Messages: 131 Registered: February 2010 Location: Bangalore, India |
Senior Member |
|
|
For a normal user program, you can see these values by default. For JRE classes it depends, you can not see them for Java 8 but for Java 9 you can see the values.
Normally if all the debugging properties are available, the values should be available without any extra work.
Sarika Sinha
JDT Programmer
|
|
|
Powered by
FUDForum. Page generated in 0.02956 seconds