Missing increment of local counter variable
Liam Miller-Cushon
cushon at google.com
Fri Dec 29 22:12:50 UTC 2017
Thanks for pointing that out. It was an oversight, I filed
https://bugs.openjdk.java.net/browse/JDK-8194268.
I don't think it's a regression, though. That branch is only taken for
synthetic methods. They aren't visible during annotation processing, and
their parameter names don't appear in bytecode, so it shouldn't be possible
to observe the incorrect names.
If you saw this causing incorrect behaviour, can you share a complete
example?
On Fri, Dec 29, 2017 at 12:23 PM, Παύλος-Πέτρος Τουρνάρης <
p.tournaris at gmail.com> wrote:
> 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/d596e12f/attachment.html>
More information about the compiler-dev
mailing list