hg: amber/amber: more api notes
forax at univ-mlv.fr
Thu Jan 31 06:53:17 UTC 2019
one way to avoid detecting if the Locale change or not at runtime is to use a SwitchPoint when getting/setting the Locale (the Locale will becomes a constant until the next call to setLocale) and then reuse this SwitchPoint when creating the method handle chain depending on the format.
The code should also include a counter that count the number of setLocale calls because if setLocale is called too often, in term of perf it's better to avoid using a SwitchPoint in that case.
----- Mail original -----
> De: "Jim Laskey" <james.laskey at oracle.com>
> À: "Vicente Romero" <vicente.romero at oracle.com>, "Hannes Wallnöfer" <hannes.wallnoefer at oracle.com>
> Cc: "amber-dev" <amber-dev at openjdk.java.net>
> Envoyé: Jeudi 31 Janvier 2019 02:19:27
> Objet: Re: hg: amber/amber: more api notes
> In the BSM.
> There are certain basic format specifiers, such as %s, that are independent of
> locale and can bypass checks. Other formats, such as %f, back off short cuts
> (mh guardWithTest) and use Formatter with locale if the user changes the locale
> or the default locale.
> Hannes can elaborate.
> Sent from my iPhone
>> On Jan 30, 2019, at 8:56 PM, Vicente Romero <vicente.romero at oracle.com> wrote:
>> Hi Jim,
>>> On 1/30/19 4:22 AM, James Laskey wrote:
>>> Not quite true. We were very careful here. It depends on the runtime default
>>> locale. And, if the default locale changes then the MethodHandle code reverts
>>> to using the Formatter implementation.
>> I didn't understand this quite well, when you say: `if the default locale
>> changes`, I think that you are referring to a different locale between
>> compilation and execution time right? Where in the code is the fall-back to
>> Formatter's implementation?
>>> The apiNote for Objects.hash might be too detailed.
>>> — Jim
>>> Sent from my iPhone
>>>> On Jan 29, 2019, at 10:58 PM, vicente.romero at oracle.com wrote:
>>>> Changeset: 7393d04a0b90
>>>> Author: vromero
>>>> Date: 2019-01-29 20:52 -0500
>>>> URL: http://hg.openjdk.java.net/amber/amber/rev/7393d04a0b90
>>>> more api notes
>>>> ! src/java.base/share/classes/java/io/PrintStream.java
>>>> ! src/java.base/share/classes/java/io/PrintWriter.java
>>>> ! src/java.base/share/classes/java/lang/String.java
>>>> ! src/java.base/share/classes/java/lang/compiler/IntrinsicCandidate.java
>>>> ! src/java.base/share/classes/java/util/Objects.java
More information about the amber-dev