Missing increment of local counter variable

Παύλος-Πέτρος Τουρνάρης p.tournaris at gmail.com
Fri Dec 29 17:23:09 UTC 2017


Hello everyone,

First time posting here :)

Stumbled upon a javac diff ->
http://hg.openjdk.java.net/jdk/jdk/rev/89f6aa26fd6c resolving
https://bugs.openjdk.java.net/browse/JDK-8177486 &
https://bugs.openjdk.java.net/browse/JDK-8007720 and noticed that the
previous implementation was using a local counter variable named `i` when
looping through the parameter types, in order to construct the parameter
name. The new implementation follows a similar path to construct the
parameter name, using the `i` local counter variable but it does not
increment it.

The method I am referring to is the `params()` in Symbol.java
http://hg.openjdk.java.net/jdk/jdk/file/89f6aa26fd6c/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symbol.java#l1883


and I think it should include an increment of `i` in line
http://hg.openjdk.java.net/jdk/jdk/file/89f6aa26fd6c/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symbol.java#l1892

Otherwise
http://hg.openjdk.java.net/jdk/jdk/file/89f6aa26fd6c/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symbol.java#l1889
on that line the `fromString("arg" + i)` will always be called with `i`
being 0 (zero).

Not sure If I can submit a patch, or how it works in general, but I was
suggested to report it in this list :)

Thank you for your time!

-- 
Pavlos-Petros Tournaris
Android Software Engineer @ Workable <http://workable.com/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/compiler-dev/attachments/20171229/42005b48/attachment.html>


More information about the compiler-dev mailing list