src/share/classes/sun/text/bidi/BidiBase.java

Print this page

        

*** 3455,3501 **** * TextAttribute instances (or a fake Attribute type if * java.awt.font.TextAttribute is not present) */ static final AttributedCharacterIterator.Attribute RUN_DIRECTION = getTextAttribute("RUN_DIRECTION"); - static final Boolean RUN_DIRECTION_LTR = - (Boolean)getStaticField(clazz, "RUN_DIRECTION_LTR"); static final AttributedCharacterIterator.Attribute NUMERIC_SHAPING = getTextAttribute("NUMERIC_SHAPING"); static final AttributedCharacterIterator.Attribute BIDI_EMBEDDING = getTextAttribute("BIDI_EMBEDDING"); private static Class<?> getClass(String name) { try { return Class.forName(name, true, null); } catch (ClassNotFoundException e) { return null; } } private static Object getStaticField(Class<?> clazz, String name) { - if (clazz == null) { - // fake attribute - return new AttributedCharacterIterator.Attribute(name) { }; - } else { try { Field f = clazz.getField(name); return f.get(null); ! } catch (NoSuchFieldException x) { throw new AssertionError(x); - } catch (IllegalAccessException x) { - throw new AssertionError(x); } } - } private static AttributedCharacterIterator.Attribute getTextAttribute(String name) { return (AttributedCharacterIterator.Attribute)getStaticField(clazz, name); } } /** * A class that provides access to java.awt.font.NumericShaping without * creating a static dependency. */ --- 3455,3504 ---- * TextAttribute instances (or a fake Attribute type if * java.awt.font.TextAttribute is not present) */ static final AttributedCharacterIterator.Attribute RUN_DIRECTION = getTextAttribute("RUN_DIRECTION"); static final AttributedCharacterIterator.Attribute NUMERIC_SHAPING = getTextAttribute("NUMERIC_SHAPING"); static final AttributedCharacterIterator.Attribute BIDI_EMBEDDING = getTextAttribute("BIDI_EMBEDDING"); + /** + * TextAttribute.RUN_DIRECTION_LTR + */ + static final Boolean RUN_DIRECTION_LTR = (clazz == null) ? + Boolean.FALSE : (Boolean)getStaticField(clazz, "RUN_DIRECTION_LTR"); + + private static Class<?> getClass(String name) { try { return Class.forName(name, true, null); } catch (ClassNotFoundException e) { return null; } } private static Object getStaticField(Class<?> clazz, String name) { try { Field f = clazz.getField(name); return f.get(null); ! } catch (NoSuchFieldException | IllegalAccessException x) { throw new AssertionError(x); } } private static AttributedCharacterIterator.Attribute getTextAttribute(String name) { + if (clazz == null) { + // fake attribute + return new AttributedCharacterIterator.Attribute(name) { }; + } else { return (AttributedCharacterIterator.Attribute)getStaticField(clazz, name); } } + } /** * A class that provides access to java.awt.font.NumericShaping without * creating a static dependency. */