Wider range possible in LocalVariableTable ?
Neal Gafter
neal at gafter.com
Fri May 28 12:56:15 PDT 2010
Local variables n and next are not definitely assigned on line 98, so that
is why they are not visible to the debugger. Since local variables don't
have "default" values as fields do, they cannot be exposed until they are
definitely assigned.
If you want to make these variables visible to the debugger, you'll have to
give them an initial value in their declarations.
On Fri, May 28, 2010 at 10:57 AM, Ulf Zibis <Ulf.Zibis at gmx.de> wrote:
> <--- See following code: --->
>
> 93 private static void parsePrefixes1() {
> 94 List<UName> sorted = UName.list.sort();
> 95 UName current = sorted.get(0), next;
> 96 Prefix prefix;
> 97 for (int i=1, j=2, m=2, n, pfKey=0; i<sorted.size();
> current=next, m=n) {
> 98 n = matchingEntries(current, next = sorted.get(i++)); // n
> and next are not visible to the debugger here
> 99 System.out.println("i="+i);
> 100 if (n > 2 ||
> 101 n == 2 && i<sorted.size() &&
> 102 matchingEntries(current, sorted.get(i)) >= 2) {
> 103 if (pfKey == 0)
> 104 pfKey = Prefix.newKey(current, n);
> 105 current.replaceByPrefix(pfKey);
> 106 } else if (pfKey != 0) {
> 107 current.replaceByPrefix(pfKey);
> 108 pfKey = 0;
> 109 }
> 110 }
> 111 }
> <--------------->
>
> Variable "next" is defined since bytecode index 78 and "n" since index 83.
> Line 98 has index 61, therefore these variables are *not* defined yet.
>
> LineNumberTable:
> line 93: 0
> line 94: 7
> line 95: 27
> line 97: 38
> line 98: 61
> line 99: 83
> line 100: 109
> line 103: 151
> line 104: 156
> line 105: 164
> line 106: 173
> line 107: 178
> line 108: 184
> line 97: 187
> line 111: 196
> LocalVariableTable:
> Start Length Slot Name Signature
> 78 118 2 next Lbuild/tools/generatecharacter/CharacterNamesGenerator6$UName;
> 41 155 4 i I
> 44 152 5 j I
> 47 149 6 m I
> 83 113 7 n I
> 50 146 8 pfKey I
> 7 190 0 sorted Ljava/util/List;
> 38 159 1 current Lbuild/tools/generatecharacter/CharacterNamesGenerator6$UName;
>
>
> Is it possible to define variables n and next since bytecode index 61, so
> they would be visible for debugger on line 98 at least after 2nd entry in
> the for loop?
> Additionally I'm wondering, why variable m is defined since bytecode index
> 47, as it is never referenced later.
>
> Additionally please refer to this discussion:
> *Bug 186882* <http://netbeans.org/bugzilla/show_bug.cgi?id=186882> - [69cat]
> Valid variables not displayed
>
> Hoping for lively discussion,
>
> -Ulf
>
> <http://netbeans.org/bugzilla/show_bug.cgi?id=186882>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/compiler-dev/attachments/20100528/e9ed1bab/attachment.html
More information about the compiler-dev
mailing list