Review request for JDK-8192970: Element getters/setters with fixed key fail to link properly
Attila Szegedi
szegedia at gmail.com
Mon Dec 4 12:40:41 UTC 2017
Please review JDK-8192970 "Element getters/setters with fixed key fail to link properly" at <http://cr.openjdk.java.net/~attila/8192970/webrev.jdk> for <https://bugs.openjdk.java.net/browse/JDK-8192970>
Note that this is unrelated to the previous refactoring (8191878), it is present even before that and also in JDK9, I’ll have to separately produce a backport fix for it. I discovered this while trying to expand the test coverage (and good thing that I did, too…)
The gist of the problem is that convertArgToNumber as it was before will fail with IndexOutOfBoundsException invoking parameterType(1) on method type for fixed-key getters, as they only have one parameter at index 0.
The fix is to move the logic into the Binder and use the methodType it manages, not the call site method type. This works because Binder always works with a method type as if the getter/setter were variable-key (it adds back the parameter type in its constructor if the operation is for a fixed key).
Thanks,
Attila.
More information about the nashorn-dev
mailing list