<i18n dev> [OpenJDK 2D-Dev]  RFR: 8038092: Re-examine Bidi reflective dependency on java.awt.font
philip.race at oracle.com
Mon Jul 7 23:06:30 UTC 2014
This took some getting my head around.
First I had to find the first set of changes that broke the static
This in JDK 7 :-
date: Thu Nov 12 11:20:51 2009 +0000
summary: 6898124: Bidi should not require AWT to be present
and this in JDK 8 :-
date: Wed Mar 30 00:59:07 2011 +0100
summary: 7026507: Bidi initialization fails if AWT not present
The premise of the 'faking' there seems to be that unless you have the
java.awt.font package present, you can't have passed in these attributes to
begin with, so failing to 'match' them is all that is needed to do the
I am not sure that from here :-
static final Boolean RUN_DIRECTION_LTR = (clazz == null) ?
3469 Boolean.FALSE : (Boolean)getStaticField(clazz, "RUN_DIRECTION_LTR"
is really what you'd want - ie default to RTL text if you can't find the class
per the code here
paraLvl = (runDirection.equals(TextAttributeConstants.RUN_DIRECTION_LTR)) ?
2700 (byte)Bidi.DIRECTION_LEFT_TO_RIGHT : (byte)Bidi.DIRECTION_RIGH
although it doesn't matter since runDirection will always be null.
Still line 3469 should be re-examined.
As for the current change it has the same effect as far as I can tell, and
I am supposing it is needed since even public classes in the client
module are not available to the core module, even by reflection
but the trick of having the client code 'install' the accessors in
the core module gets around this ..
On 7/2/2014 9:32 AM, Naoto Sato wrote:
> Sending this to 2d-dev list as well, seeking for reviews for changes
> in the java.awt.font package.
> On 7/1/14, 5:42 PM, Naoto Sato wrote:
>> I further modified the fix:
>> - Made sure the SharedSecret is lazily evaluated.
>> - Added the missing JavaAWTFontAccessImpl file
>> - Added a test case
>> Please review.
>> On 7/1/14, 1:09 PM, Naoto Sato wrote:
>>> Thanks, Alan. Here is the revised webrev based on your suggestions:
>>> Please review.
>>> On 7/1/14, 6:58 AM, Alan Bateman wrote:
>>>> On 30/06/2014 18:35, Naoto Sato wrote:
>>>>> Please review the fix for the subject bug:
>>>>> The proposed change is located at:
>>>> Thanks for looking at this issue.
>>>> One part that doesn't look right is where Bidi is used before
>>>> TextAttribute or NumericShaper are initialized and then used later
>>>> one of these as an attribute. Normally with SharedSecrets then
>>>> ensureClassInitialized is to used to initialize a class that is
>>>> known to
>>>> register the secret but in this case then you can't do that because it
>>>> would create a dependency on java.awt. The simplest thing might be to
>>>> keep the Class.forName in both TextAttribtueConstants and
>>>> NumericShapings as that will ensure that those classes are initialized
>>>> (if they are present).
>>>> A minor comment is that there are probably a bunch of imports that can
>>>> be removed once the bulk of the core reflection usage goes away.
More information about the i18n-dev