Missing increment of local counter variable
Παύλος-Πέτρος Τουρνάρης
p.tournaris at gmail.com
Fri Dec 29 22:16:14 UTC 2017
Nope, just saw that on the diff. Have not actually found an incorrect
behaviour on an example!
Thanks for filing it!
On Sat, Dec 30, 2017 at 12:12 AM, Liam Miller-Cushon <cushon at google.com>
wrote:
> 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.ne
>> t/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/89f6aa26
>> fd6c/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/sr
>> c/jdk.compiler/share/classes/com/sun/tools/javac/code/Symbol.java#l1892
>>
>> Otherwise http://hg.openjdk.java.net/jdk/jdk/file/89f6aa26fd
>> 6c/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/>
>>
>>
>
--
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/20171230/60dac242/attachment-0001.html>
More information about the compiler-dev
mailing list