<i18n dev> 6898124: Bidi should not require AWT to be present

Alan Bateman Alan.Bateman at Sun.COM
Thu Nov 5 02:36:32 PST 2009


Masayoshi - would you mind reviewing this one?

The background is that a Bidi can be created from a paragraph that 
includes attributes of type java.awt.font.TextAttribute and 
java.awt.font.NumericShaping, thus creating a dependency on AWT. I'd 
like propose changing this code so that AWT is not required to be 
present. To keep the changes simple, I've changed the code to use 
reflection to load TextAttribute; if not present it uses "fake" 
attributes that will never equal the attributes provided by the 
application. From a performance point of view the downside is that there 
is a first-time cost to get the TextAttribute fields. On the upside, 
java.awt.font.NumericShaping will not loaded unless an instance is 
provided in the attributes (whereas today it may be loaded 
unnecessarily). It would be possible to also avoid loading 
java.awt.font.TextAttribute by checking the attribute names before 
comparing but this didn't seem to be worth it. Does this seem reasonable?

I've put the webrev here:
   http://cr.openjdk.java.net/~alanb/6898124/webrev.00/

The test coverage in test/java/text/Bidi seems to good and exercises 
these changes well.

Thanks,
Alan.


More information about the i18n-dev mailing list