--- a/jdk/src/share/classes/sun/font/AttributeValues.java Fri Feb 07 13:03:09 2014 -0800
+++ b/jdk/src/share/classes/sun/font/AttributeValues.java Sat Feb 08 18:03:38 2014 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -410,7 +410,7 @@
}
public Hashtable<Object, Object> toSerializableHashtable() {
- Hashtable ht = new Hashtable();
+ Hashtable<Object, Object> ht = new Hashtable<>();
int hashkey = defined;
for (int m = defined, i = 0; m != 0; ++i) {
EAttribute ea = EAttribute.atts[i];
@@ -798,7 +798,7 @@
hl = (InputMethodHighlight)((Annotation)imHighlight).getValue();
}
- Map imStyles = hl.getStyle();
+ Map<TextAttribute, ?> imStyles = hl.getStyle();
if (imStyles == null) {
Toolkit tk = Toolkit.getDefaultToolkit();
imStyles = tk.mapInputMethodHighlight(hl);
@@ -812,6 +812,7 @@
return this;
}
+ @SuppressWarnings("unchecked")
public static AffineTransform getBaselineTransform(Map<?, ?> map) {
if (map != null) {
AttributeValues av = null;
@@ -828,6 +829,7 @@
return null;
}
+ @SuppressWarnings("unchecked")
public static AffineTransform getCharTransform(Map<?, ?> map) {
if (map != null) {
AttributeValues av = null;
--- a/jdk/src/share/classes/sun/font/CreatedFontTracker.java Fri Feb 07 13:03:09 2014 -0800
+++ b/jdk/src/share/classes/sun/font/CreatedFontTracker.java Sat Feb 08 18:03:38 2014 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -113,7 +113,7 @@
if (t == null) {
// Add a shutdown hook to remove the temp file.
java.security.AccessController.doPrivileged(
- new java.security.PrivilegedAction() {
+ new java.security.PrivilegedAction<Object>() {
public Object run() {
/* The thread must be a member of a thread group
* which will not get GCed before VM exit.
--- a/jdk/src/share/classes/sun/font/Decoration.java Fri Feb 07 13:03:09 2014 -0800
+++ b/jdk/src/share/classes/sun/font/Decoration.java Sat Feb 08 18:03:38 2014 -0800
@@ -46,6 +46,7 @@
import java.awt.geom.Line2D;
import java.awt.geom.Rectangle2D;
import java.awt.geom.GeneralPath;
+import java.text.AttributedCharacterIterator.Attribute;
import static sun.font.AttributeValues.*;
import static sun.font.EAttribute.*;
@@ -107,7 +108,7 @@
* Return a Decoration appropriate for the the given Map.
* @param attributes the Map used to determine the Decoration
*/
- public static Decoration getDecoration(Map attributes) {
+ public static Decoration getDecoration(Map<? extends Attribute, ?> attributes) {
if (attributes == null) {
return PLAIN;
}
--- a/jdk/src/share/classes/sun/font/FileFont.java Fri Feb 07 13:03:09 2014 -0800
+++ b/jdk/src/share/classes/sun/font/FileFont.java Sat Feb 08 18:03:38 2014 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -159,7 +159,7 @@
SunFontManager fm = SunFontManager.getInstance();
fm.deRegisterBadFont(this);
- for (Reference strikeRef : strikeCache.values()) {
+ for (Reference<FontStrike> strikeRef : strikeCache.values()) {
if (strikeRef != null) {
/* NB we know these are all FileFontStrike instances
* because the cache is on this FileFont
@@ -261,7 +261,7 @@
public void dispose() {
java.security.AccessController.doPrivileged(
- new java.security.PrivilegedAction() {
+ new java.security.PrivilegedAction<Object>() {
public Object run() {
if (fontFile != null) {
try {
--- a/jdk/src/share/classes/sun/font/Font2D.java Fri Feb 07 13:03:09 2014 -0800
+++ b/jdk/src/share/classes/sun/font/Font2D.java Sat Feb 08 18:03:38 2014 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -91,8 +91,8 @@
* the map will have fewer entries, and there's no need to try to
* make the Font2D part of the key.
*/
- protected ConcurrentHashMap<FontStrikeDesc, Reference>
- strikeCache = new ConcurrentHashMap<FontStrikeDesc, Reference>();
+ protected ConcurrentHashMap<FontStrikeDesc, Reference<FontStrike>>
+ strikeCache = new ConcurrentHashMap<>();
/* Store the last Strike in a Reference object.
* Similarly to the strike that was stored on a C++ font object,
@@ -105,7 +105,7 @@
* This pre-supposes that a FontStrike is a shareable object, which
* it should.
*/
- protected Reference lastFontStrike = new SoftReference(null);
+ protected Reference<FontStrike> lastFontStrike = new SoftReference<>(null);
/*
* POSSIBLE OPTIMISATION:
@@ -195,7 +195,7 @@
* strike.
*/
public FontStrike getStrike(Font font) {
- FontStrike strike = (FontStrike)lastFontStrike.get();
+ FontStrike strike = lastFontStrike.get();
if (strike != null) {
return strike;
} else {
@@ -307,17 +307,17 @@
* collected, then we create a new strike, put it in the map and
* set it to be the last strike.
*/
- FontStrike strike = (FontStrike)lastFontStrike.get();
+ FontStrike strike = lastFontStrike.get();
if (strike != null && desc.equals(strike.desc)) {
//strike.lastlookupTime = System.currentTimeMillis();
return strike;
} else {
- Reference strikeRef = strikeCache.get(desc);
+ Reference<FontStrike> strikeRef = strikeCache.get(desc);
if (strikeRef != null) {
- strike = (FontStrike)strikeRef.get();
+ strike = strikeRef.get();
if (strike != null) {
//strike.lastlookupTime = System.currentTimeMillis();
- lastFontStrike = new SoftReference(strike);
+ lastFontStrike = new SoftReference<>(strike);
StrikeCache.refStrike(strike);
return strike;
}
@@ -360,14 +360,14 @@
}
strikeCache.put(desc, strikeRef);
//strike.lastlookupTime = System.currentTimeMillis();
- lastFontStrike = new SoftReference(strike);
+ lastFontStrike = new SoftReference<>(strike);
StrikeCache.refStrike(strike);
return strike;
}
}
void removeFromCache(FontStrikeDesc desc) {
- Reference ref = strikeCache.get(desc);
+ Reference<FontStrike> ref = strikeCache.get(desc);
if (ref != null) {
Object o = ref.get();
if (o == null) {
--- a/jdk/src/share/classes/sun/font/FontDesignMetrics.java Fri Feb 07 13:03:09 2014 -0800
+++ b/jdk/src/share/classes/sun/font/FontDesignMetrics.java Sat Feb 08 18:03:38 2014 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -170,10 +170,10 @@
* Also we put the references on a queue so that if they do get nulled
* out we can clear the keys from the table.
*/
- private static class KeyReference extends SoftReference
+ private static class KeyReference extends SoftReference<Object>
implements DisposerRecord, Disposer.PollDisposable {
- static ReferenceQueue queue = Disposer.getQueue();
+ static ReferenceQueue<Object> queue = Disposer.getQueue();
Object key;
--- a/jdk/src/share/classes/sun/font/FontManagerFactory.java Fri Feb 07 13:03:09 2014 -0800
+++ b/jdk/src/share/classes/sun/font/FontManagerFactory.java Sat Feb 08 18:03:38 2014 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -71,7 +71,7 @@
return instance;
}
- AccessController.doPrivileged(new PrivilegedAction() {
+ AccessController.doPrivileged(new PrivilegedAction<Object>() {
public Object run() {
try {
@@ -79,7 +79,7 @@
System.getProperty("sun.font.fontmanager",
DEFAULT_CLASS);
ClassLoader cl = ClassLoader.getSystemClassLoader();
- Class fmClass = Class.forName(fmClassName, true, cl);
+ Class<?> fmClass = Class.forName(fmClassName, true, cl);
instance = (FontManager) fmClass.newInstance();
} catch (ClassNotFoundException |
InstantiationException |
--- a/jdk/src/share/classes/sun/font/FontManagerNativeLibrary.java Fri Feb 07 13:03:09 2014 -0800
+++ b/jdk/src/share/classes/sun/font/FontManagerNativeLibrary.java Sat Feb 08 18:03:38 2014 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -30,7 +30,7 @@
public class FontManagerNativeLibrary {
static {
java.security.AccessController.doPrivileged(
- new java.security.PrivilegedAction() {
+ new java.security.PrivilegedAction<Object>() {
public Object run() {
/* REMIND do we really have to load awt here? */
System.loadLibrary("awt");
--- a/jdk/src/share/classes/sun/font/FontResolver.java Fri Feb 07 13:03:09 2014 -0800
+++ b/jdk/src/share/classes/sun/font/FontResolver.java Sat Feb 08 18:03:38 2014 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -33,6 +33,7 @@
import java.awt.Font;
import java.awt.GraphicsEnvironment;
import java.awt.font.TextAttribute;
+import java.text.AttributedCharacterIterator;
import java.util.ArrayList;
import java.util.Map;
import sun.text.CodePointIterator;
@@ -222,7 +223,8 @@
* is Font.PLAIN
* @see #getFontIndex
*/
- public Font getFont(int index, Map attributes) {
+ public Font getFont(int index,
+ Map<? extends AttributedCharacterIterator.Attribute, ?> attributes) {
Font font = defaultFont;
if (index >= 2) {
--- a/jdk/src/share/classes/sun/font/FontScaler.java Fri Feb 07 13:03:09 2014 -0800
+++ b/jdk/src/share/classes/sun/font/FontScaler.java Sat Feb 08 18:03:38 2014 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -82,23 +82,24 @@
public abstract class FontScaler implements DisposerRecord {
private static FontScaler nullScaler = null;
- private static Constructor<FontScaler> scalerConstructor = null;
+ private static Constructor<? extends FontScaler> scalerConstructor = null;
//Find preferred font scaler
//
//NB: we can allow property based preferences
// (theoretically logic can be font type specific)
static {
- Class scalerClass = null;
- Class arglst[] = new Class[] {Font2D.class, int.class,
+ Class<? extends FontScaler> scalerClass = null;
+ Class<?>[] arglst = new Class<?>[] {Font2D.class, int.class,
boolean.class, int.class};
try {
- if (FontUtilities.isOpenJDK) {
- scalerClass = Class.forName("sun.font.FreetypeFontScaler");
- } else {
- scalerClass = Class.forName("sun.font.T2KFontScaler");
- }
+ @SuppressWarnings("unchecked")
+ Class<? extends FontScaler> tmp = (Class<? extends FontScaler>)
+ (FontUtilities.isOpenJDK ?
+ Class.forName("sun.font.FreetypeFontScaler") :
+ Class.forName("sun.font.T2KFontScaler"));
+ scalerClass = tmp;
} catch (ClassNotFoundException e) {
scalerClass = NullFontScaler.class;
}
--- a/jdk/src/share/classes/sun/font/FontUtilities.java Fri Feb 07 13:03:09 2014 -0800
+++ b/jdk/src/share/classes/sun/font/FontUtilities.java Sat Feb 08 18:03:38 2014 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -71,7 +71,7 @@
// This static initializer block figures out the OS constants.
static {
- AccessController.doPrivileged(new PrivilegedAction () {
+ AccessController.doPrivileged(new PrivilegedAction<Object>() {
public Object run() {
String osName = System.getProperty("os.name", "unknownOS");
isSolaris = osName.startsWith("SunOS");
@@ -391,7 +391,7 @@
*/
private static volatile
SoftReference<ConcurrentHashMap<PhysicalFont, CompositeFont>>
- compMapRef = new SoftReference(null);
+ compMapRef = new SoftReference<>(null);
public static FontUIResource getCompositeFontUIResource(Font font) {
@@ -421,7 +421,7 @@
ConcurrentHashMap<PhysicalFont, CompositeFont> compMap = compMapRef.get();
if (compMap == null) { // Its been collected.
compMap = new ConcurrentHashMap<PhysicalFont, CompositeFont>();
- compMapRef = new SoftReference(compMap);
+ compMapRef = new SoftReference<>(compMap);
}
CompositeFont compFont = compMap.get(physicalFont);
if (compFont == null) {
--- a/jdk/src/share/classes/sun/font/FreetypeFontScaler.java Fri Feb 07 13:03:09 2014 -0800
+++ b/jdk/src/share/classes/sun/font/FreetypeFontScaler.java Sat Feb 08 18:03:38 2014 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -50,7 +50,7 @@
initIDs(FreetypeFontScaler.class);
}
- private static native void initIDs(Class FFS);
+ private static native void initIDs(Class<?> FFS);
private void invalidateScaler() throws FontScalerException {
nativeScaler = 0;
@@ -69,7 +69,7 @@
indexInCollection,
supportsCJK,
filesize);
- this.font = new WeakReference(font);
+ this.font = new WeakReference<>(font);
}
synchronized StrikeMetrics getFontMetrics(long pScalerContext)
--- a/jdk/src/share/classes/sun/font/GlyphLayout.java Fri Feb 07 13:03:09 2014 -0800
+++ b/jdk/src/share/classes/sun/font/GlyphLayout.java Sat Feb 08 18:03:38 2014 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -92,7 +92,7 @@
private ScriptRun _scriptRuns; // iterator over script runs
private FontRunIterator _fontRuns; // iterator over physical fonts in a composite
private int _ercount;
- private ArrayList _erecords;
+ private ArrayList<EngineRecord> _erecords;
private Point2D.Float _pt;
private FontStrikeDesc _sd;
private float[] _mat;
@@ -457,7 +457,7 @@
// _sd.init(dtx, gtx, font.getStyle(), frc.isAntiAliased(), frc.usesFractionalMetrics());
_sd = txinfo.sd;
for (;ix != stop; ix += dir) {
- EngineRecord er = (EngineRecord)_erecords.get(ix);
+ EngineRecord er = _erecords.get(ix);
for (;;) {
try {
er.layout();
@@ -505,7 +505,7 @@
this._textRecord = new TextRecord();
this._scriptRuns = new ScriptRun();
this._fontRuns = new FontRunIterator();
- this._erecords = new ArrayList(10);
+ this._erecords = new ArrayList<>(10);
this._pt = new Point2D.Float();
this._sd = new FontStrikeDesc();
this._mat = new float[4];
@@ -523,7 +523,7 @@
er = new EngineRecord();
_erecords.add(er);
} else {
- er = (EngineRecord)_erecords.get(_ercount);
+ er = _erecords.get(_ercount);
}
er.init(start, limit, font, script, lang, gmask);
++_ercount;
--- a/jdk/src/share/classes/sun/font/StandardGlyphVector.java Fri Feb 07 13:03:09 2014 -0800
+++ b/jdk/src/share/classes/sun/font/StandardGlyphVector.java Sat Feb 08 18:03:38 2014 -0800
@@ -153,7 +153,7 @@
private AffineTransform invdtx; // inverse of dtx or null if dtx is identity
private AffineTransform frctx; // font render context transform, wish we could just share it
private Font2D font2D; // basic strike-independent stuff
- private SoftReference fsref; // font strike reference for glyphs with no per-glyph transform
+ private SoftReference<GlyphStrike> fsref; // font strike reference for glyphs with no per-glyph transform
/////////////////////////////
// Constructors and Factory methods
@@ -526,9 +526,9 @@
}
Shape[] lbcache;
- if (lbcacheRef == null || (lbcache = (Shape[])lbcacheRef.get()) == null) {
+ if (lbcacheRef == null || (lbcache = lbcacheRef.get()) == null) {
lbcache = new Shape[glyphs.length];
- lbcacheRef = new SoftReference(lbcache);
+ lbcacheRef = new SoftReference<>(lbcache);
}
Shape result = lbcache[ix];
@@ -568,7 +568,7 @@
return result;
}
- private SoftReference lbcacheRef;
+ private SoftReference<Shape[]> lbcacheRef;
public Shape getGlyphVisualBounds(int ix) {
if (ix < 0 || ix >= glyphs.length) {
@@ -576,9 +576,9 @@
}
Shape[] vbcache;
- if (vbcacheRef == null || (vbcache = (Shape[])vbcacheRef.get()) == null) {
+ if (vbcacheRef == null || (vbcache = vbcacheRef.get()) == null) {
vbcache = new Shape[glyphs.length];
- vbcacheRef = new SoftReference(vbcache);
+ vbcacheRef = new SoftReference<>(vbcache);
}
Shape result = vbcache[ix];
@@ -589,7 +589,7 @@
return result;
}
- private SoftReference vbcacheRef;
+ private SoftReference<Shape[]> vbcacheRef;
public Rectangle getGlyphPixelBounds(int index, FontRenderContext renderFRC, float x, float y) {
return getGlyphsPixelBounds(renderFRC, x, y, index, 1);
@@ -1230,14 +1230,14 @@
private void clearCaches(int ix) {
if (lbcacheRef != null) {
- Shape[] lbcache = (Shape[])lbcacheRef.get();
+ Shape[] lbcache = lbcacheRef.get();
if (lbcache != null) {
lbcache[ix] = null;
}
}
if (vbcacheRef != null) {
- Shape[] vbcache = (Shape[])vbcacheRef.get();
+ Shape[] vbcache = vbcacheRef.get();
if (vbcache != null) {
vbcache[ix] = null;
}
@@ -1357,11 +1357,11 @@
private GlyphStrike getDefaultStrike() {
GlyphStrike gs = null;
if (fsref != null) {
- gs = (GlyphStrike)fsref.get();
+ gs = fsref.get();
}
if (gs == null) {
gs = GlyphStrike.create(this, dtx, null);
- fsref = new SoftReference(gs);
+ fsref = new SoftReference<>(gs);
}
return gs;
}
@@ -1379,7 +1379,7 @@
StandardGlyphVector sgv; // reference back to glyph vector - yuck
int[] indices; // index into unique strikes
double[] transforms; // six doubles per unique transform, because AT is a pain to manipulate
- SoftReference strikesRef; // ref to unique strikes, one per transform
+ SoftReference<GlyphStrike[]> strikesRef; // ref to unique strikes, one per transform
boolean haveAllStrikes; // true if the strike array has been filled by getStrikes().
// used when first setting a transform
@@ -1653,12 +1653,12 @@
private GlyphStrike[] getStrikeArray() {
GlyphStrike[] strikes = null;
if (strikesRef != null) {
- strikes = (GlyphStrike[])strikesRef.get();
+ strikes = strikesRef.get();
}
if (strikes == null) {
haveAllStrikes = false;
strikes = new GlyphStrike[transformCount() + 1];
- strikesRef = new SoftReference(strikes);
+ strikesRef = new SoftReference<>(strikes);
}
return strikes;
--- a/jdk/src/share/classes/sun/font/StrikeCache.java Fri Feb 07 13:03:09 2014 -0800
+++ b/jdk/src/share/classes/sun/font/StrikeCache.java Sat Feb 08 18:03:38 2014 -0800
@@ -65,7 +65,7 @@
static final Unsafe unsafe = Unsafe.getUnsafe();
- static ReferenceQueue refQueue = Disposer.getQueue();
+ static ReferenceQueue<Object> refQueue = Disposer.getQueue();
static ArrayList<GlyphDisposedListener> disposeListeners = new ArrayList<GlyphDisposedListener>(1);
@@ -159,7 +159,7 @@
}
java.security.AccessController.doPrivileged(
- new java.security.PrivilegedAction() {
+ new java.security.PrivilegedAction<Object>() {
public Object run() {
/* Allow a client to override the reference type used to
@@ -378,11 +378,11 @@
}
}
- public static Reference getStrikeRef(FontStrike strike) {
+ public static Reference<FontStrike> getStrikeRef(FontStrike strike) {
return getStrikeRef(strike, cacheRefTypeWeak);
}
- public static Reference getStrikeRef(FontStrike strike, boolean weak) {
+ public static Reference<FontStrike> getStrikeRef(FontStrike strike, boolean weak) {
/* Some strikes may have no disposer as there's nothing
* for them to free, as they allocated no native resource
* eg, if they did not allocate resources because of a problem,
@@ -392,9 +392,9 @@
*/
if (strike.disposer == null) {
if (weak) {
- return new WeakReference(strike);
+ return new WeakReference<>(strike);
} else {
- return new SoftReference(strike);
+ return new SoftReference<>(strike);
}
}
@@ -410,7 +410,7 @@
}
static class SoftDisposerRef
- extends SoftReference implements DisposableStrike {
+ extends SoftReference<FontStrike> implements DisposableStrike {
private FontStrikeDisposer disposer;
@@ -418,15 +418,16 @@
return disposer;
}
+ @SuppressWarnings("unchecked")
SoftDisposerRef(FontStrike strike) {
super(strike, StrikeCache.refQueue);
disposer = strike.disposer;
- Disposer.addReference(this, disposer);
+ Disposer.addReference((Reference<Object>)(Reference)this, disposer);
}
}
static class WeakDisposerRef
- extends WeakReference implements DisposableStrike {
+ extends WeakReference<FontStrike> implements DisposableStrike {
private FontStrikeDisposer disposer;
@@ -434,10 +435,11 @@
return disposer;
}
+ @SuppressWarnings("unchecked")
WeakDisposerRef(FontStrike strike) {
super(strike, StrikeCache.refQueue);
disposer = strike.disposer;
- Disposer.addReference(this, disposer);
+ Disposer.addReference((Reference<Object>)(Reference)this, disposer);
}
}
--- a/jdk/src/share/classes/sun/font/SunFontManager.java Fri Feb 07 13:03:09 2014 -0800
+++ b/jdk/src/share/classes/sun/font/SunFontManager.java Sat Feb 08 18:03:38 2014 -0800
@@ -197,9 +197,9 @@
private static HashSet<String> missingFontFiles = null;
private String defaultFontName;
private String defaultFontFileName;
- protected HashSet registeredFontFiles = new HashSet();
-
- private ArrayList badFonts;
+ protected HashSet<String> registeredFontFiles = new HashSet<>();
+
+ private ArrayList<String> badFonts;
/* fontPath is the location of all fonts on the system, excluding the
* JRE's own font directory but including any path specified using the
* sun.java2d.fontpath property. Together with that property, it is
@@ -332,7 +332,7 @@
static {
java.security.AccessController.doPrivileged(
- new java.security.PrivilegedAction() {
+ new java.security.PrivilegedAction<Object>() {
public Object run() {
FontManagerNativeLibrary.load();
@@ -373,7 +373,7 @@
initJREFontMap();
java.security.AccessController.doPrivileged(
- new java.security.PrivilegedAction() {
+ new java.security.PrivilegedAction<Object>() {
public Object run() {
File badFontFile =
new File(jreFontDirName + File.separator +
@@ -381,7 +381,7 @@
if (badFontFile.exists()) {
FileInputStream fis = null;
try {
- badFonts = new ArrayList();
+ badFonts = new ArrayList<>();
fis = new FileInputStream(badFontFile);
InputStreamReader isr = new InputStreamReader(fis);
BufferedReader br = new BufferedReader(isr);
@@ -1227,9 +1227,9 @@
* and I don't know how to recover from there being absolutely
* no fonts anywhere on the system.
*/
- Iterator i = physicalFonts.values().iterator();
+ Iterator<PhysicalFont> i = physicalFonts.values().iterator();
if (i.hasNext()) {
- defaultPhysicalFont = (PhysicalFont)i.next();
+ defaultPhysicalFont = i.next();
} else {
throw new Error("Probable fatal error:No fonts found.");
}
@@ -1303,7 +1303,7 @@
} else {
filter = new TTorT1Filter();
}
- return (String[])AccessController.doPrivileged(new PrivilegedAction() {
+ return (String[])AccessController.doPrivileged(new PrivilegedAction<Object>() {
public Object run() {
if (pathDirs.length == 1) {
File dir = new File(pathDirs[0]);
@@ -1419,6 +1419,7 @@
* them "MS UI Gothic" has no JA name whereas the other two do.
* So not every font in these files is unmapped or new.
*/
+ @SuppressWarnings("unchecked")
HashMap<String,String> ffmapCopy =
(HashMap<String,String>)(fontToFileMap.clone());
for (String key : fontToFamilyNameMap.keySet()) {
@@ -1470,7 +1471,7 @@
String name = unmappedFontNames.get(i);
String familyName = fontToFamilyNameMap.get(name);
if (familyName != null) {
- ArrayList family = familyToFontListMap.get(familyName);
+ ArrayList<String> family = familyToFontListMap.get(familyName);
if (family != null) {
if (family.size() <= 1) {
familyToFontListMap.remove(familyName);
@@ -1896,7 +1897,7 @@
* to register those again, but we do want to register other registry
* installed fonts.
*/
- protected void registerOtherFontFiles(HashSet registeredFontFiles) {
+ protected void registerOtherFontFiles(HashSet<String> registeredFontFiles) {
if (getFullNameToFileMap().size() == 0) {
return;
}
@@ -2080,6 +2081,7 @@
* name.
*/
if (_usingPerAppContextComposites) {
+ @SuppressWarnings("unchecked")
ConcurrentHashMap<String, Font2D> altNameCache =
(ConcurrentHashMap<String, Font2D>)
AppContext.getAppContext().get(CompositeFont.class);
@@ -2304,10 +2306,15 @@
nameTable = createdByFullName;
} else {
AppContext appContext = AppContext.getAppContext();
- familyTable =
+ @SuppressWarnings("unchecked")
+ Hashtable<String,FontFamily> tmp1 =
(Hashtable<String,FontFamily>)appContext.get(regFamilyKey);
- nameTable =
+ familyTable = tmp1;
+
+ @SuppressWarnings("unchecked")
+ Hashtable<String, Font2D> tmp2 =
(Hashtable<String,Font2D>)appContext.get(regFullNameKey);
+ nameTable = tmp2;
}
family = familyTable.get(lowerCaseName);
@@ -2467,7 +2474,7 @@
} catch (FontFormatException e) {
if (isCopy) {
java.security.AccessController.doPrivileged(
- new java.security.PrivilegedAction() {
+ new java.security.PrivilegedAction<Object>() {
public Object run() {
if (_tracker != null) {
_tracker.subBytes((int)fFile.length());
@@ -2492,7 +2499,7 @@
final Runnable fileCloserRunnable = new Runnable() {
public void run() {
java.security.AccessController.doPrivileged(
- new java.security.PrivilegedAction() {
+ new java.security.PrivilegedAction<Object>() {
public Object run() {
for (int i=0;i<CHANNELPOOLSIZE;i++) {
@@ -2521,7 +2528,7 @@
}
};
java.security.AccessController.doPrivileged(
- new java.security.PrivilegedAction() {
+ new java.security.PrivilegedAction<Object>() {
public Object run() {
/* The thread must be a member of a thread group
* which will not get GCed before VM exit.
@@ -2627,15 +2634,17 @@
fullNameToFont.remove(oldFont.fullName.toLowerCase(Locale.ENGLISH));
FontFamily.remove(oldFont);
if (localeFullNamesToFont != null) {
- Map.Entry[] mapEntries = localeFullNamesToFont.entrySet().
- toArray(new Map.Entry[0]);
+ Map.Entry<?, ?>[] mapEntries = localeFullNamesToFont.entrySet().
+ toArray(new Map.Entry<?, ?>[0]);
/* Should I be replacing these, or just I just remove
* the names from the map?
*/
for (int i=0; i<mapEntries.length;i++) {
if (mapEntries[i].getValue() == oldFont) {
try {
- mapEntries[i].setValue(newFont);
+ @SuppressWarnings("unchecked")
+ Map.Entry<String, PhysicalFont> tmp = (Map.Entry<String, PhysicalFont>)mapEntries[i];
+ tmp.setValue(newFont);
} catch (Exception e) {
/* some maps don't support this operation.
* In this case just give up and remove the entry.
@@ -2864,7 +2873,7 @@
private static boolean maybeMultiAppContext() {
Boolean appletSM = (Boolean)
java.security.AccessController.doPrivileged(
- new java.security.PrivilegedAction() {
+ new java.security.PrivilegedAction<Object>() {
public Object run() {
SecurityManager sm = System.getSecurityManager();
return new Boolean
@@ -3055,10 +3064,15 @@
fontsAreRegistered = true;
} else {
AppContext appContext = AppContext.getAppContext();
- familyTable =
+ @SuppressWarnings("unchecked")
+ Hashtable<String,FontFamily> tmp1 =
(Hashtable<String,FontFamily>)appContext.get(regFamilyKey);
- fullNameTable =
+ familyTable = tmp1;
+ @SuppressWarnings("unchecked")
+ Hashtable<String,Font2D> tmp2 =
(Hashtable<String,Font2D>)appContext.get(regFullNameKey);
+ fullNameTable = tmp2;
+
if (familyTable == null) {
familyTable = new Hashtable<String,FontFamily>();
fullNameTable = new Hashtable<String,Font2D>();
@@ -3114,8 +3128,10 @@
familyTable = createdByFamilyName;
} else if (fontsAreRegisteredPerAppContext) {
AppContext appContext = AppContext.getAppContext();
- familyTable =
+ @SuppressWarnings("unchecked")
+ Hashtable<String,FontFamily> tmp =
(Hashtable<String,FontFamily>)appContext.get(regFamilyKey);
+ familyTable = tmp;
} else {
return null;
}
@@ -3142,8 +3158,10 @@
nameTable = createdByFullName;
} else if (fontsAreRegisteredPerAppContext) {
AppContext appContext = AppContext.getAppContext();
- nameTable =
+ @SuppressWarnings("unchecked")
+ Hashtable<String,Font2D> tmp =
(Hashtable<String,Font2D>)appContext.get(regFullNameKey);
+ nameTable = tmp;
} else {
return null;
}
@@ -3305,7 +3323,7 @@
initialiseDeferredFonts();
java.security.AccessController.doPrivileged(
- new java.security.PrivilegedAction() {
+ new java.security.PrivilegedAction<Object>() {
public Object run() {
if (fontPath == null) {
fontPath = getPlatformFontPath(noType1Font);
@@ -3440,7 +3458,7 @@
FontUtilities.getLogger().info("loadAllFontFiles() called");
}
java.security.AccessController.doPrivileged(
- new java.security.PrivilegedAction() {
+ new java.security.PrivilegedAction<Object>() {
public Object run() {
if (fontPath == null) {
fontPath = getPlatformFontPath(noType1Font);
@@ -3682,7 +3700,7 @@
public Font[] getAllInstalledFonts() {
if (allFonts == null) {
loadFonts();
- TreeMap fontMapNames = new TreeMap();
+ TreeMap<String, Font2D> fontMapNames = new TreeMap<>();
/* warning: the number of composite fonts could change dynamically
* if applications are allowed to create them. "allfonts" could
* then be stale.
@@ -3715,7 +3733,7 @@
Font[] fonts = new Font[fontNames.length];
for (int i=0; i < fontNames.length; i++) {
fonts[i] = new Font(fontNames[i], Font.PLAIN, 1);
- Font2D f2d = (Font2D)fontMapNames.get(fontNames[i]);
+ Font2D f2d = fontMapNames.get(fontNames[i]);
if (f2d != null) {
FontAccess.getFontAccess().setFont2D(fonts[i], f2d.handle);
}
@@ -3798,7 +3816,7 @@
public void register1dot0Fonts() {
java.security.AccessController.doPrivileged(
- new java.security.PrivilegedAction() {
+ new java.security.PrivilegedAction<Object>() {
public Object run() {
String type1Dir = "/usr/openwin/lib/X11/fonts/Type1";
registerFontsInDir(type1Dir, true, Font2D.TYPE1_RANK,
@@ -3840,7 +3858,7 @@
if (systemLocale == null) {
systemLocale = (Locale)
java.security.AccessController.doPrivileged(
- new java.security.PrivilegedAction() {
+ new java.security.PrivilegedAction<Object>() {
public Object run() {
/* On windows the system locale may be different than the
* user locale. This is an unsupported configuration, but
--- a/jdk/src/share/classes/sun/font/SunLayoutEngine.java Fri Feb 07 13:03:09 2014 -0800
+++ b/jdk/src/share/classes/sun/font/SunLayoutEngine.java Sat Feb 08 18:03:38 2014 -0800
@@ -129,13 +129,13 @@
// !!! don't need this unless we have more than one sun layout engine...
public LayoutEngine getEngine(LayoutEngineKey key) {
- ConcurrentHashMap cache = (ConcurrentHashMap)cacheref.get();
+ ConcurrentHashMap<LayoutEngineKey, LayoutEngine> cache = cacheref.get();
if (cache == null) {
- cache = new ConcurrentHashMap();
- cacheref = new SoftReference(cache);
+ cache = new ConcurrentHashMap<>();
+ cacheref = new SoftReference<>(cache);
}
- LayoutEngine e = (LayoutEngine)cache.get(key);
+ LayoutEngine e = cache.get(key);
if (e == null) {
LayoutEngineKey copy = key.copy();
e = new SunLayoutEngine(copy);
@@ -143,7 +143,8 @@
}
return e;
}
- private SoftReference cacheref = new SoftReference(null);
+ private SoftReference<ConcurrentHashMap<LayoutEngineKey, LayoutEngine>> cacheref =
+ new SoftReference<>(null);
private SunLayoutEngine(LayoutEngineKey key) {
this.key = key;
--- a/jdk/src/share/classes/sun/font/TrueTypeFont.java Fri Feb 07 13:03:09 2014 -0800
+++ b/jdk/src/share/classes/sun/font/TrueTypeFont.java Sat Feb 08 18:03:38 2014 -0800
@@ -290,7 +290,7 @@
try {
RandomAccessFile raf = (RandomAccessFile)
java.security.AccessController.doPrivileged(
- new java.security.PrivilegedAction() {
+ new java.security.PrivilegedAction<Object>() {
public Object run() {
try {
return new RandomAccessFile(platName, "r");
@@ -1546,7 +1546,7 @@
* during typical start-up and the information here is likely never
* needed.
*/
- protected void initAllNames(int requestedID, HashSet names) {
+ protected void initAllNames(int requestedID, HashSet<String> names) {
byte[] name = new byte[256];
ByteBuffer buffer = getTableBuffer(nameTag);
@@ -1584,23 +1584,23 @@
}
String[] getAllFamilyNames() {
- HashSet aSet = new HashSet();
+ HashSet<String> aSet = new HashSet<>();
try {
initAllNames(FAMILY_NAME_ID, aSet);
} catch (Exception e) {
/* In case of malformed font */
}
- return (String[])aSet.toArray(new String[0]);
+ return aSet.toArray(new String[0]);
}
String[] getAllFullNames() {
- HashSet aSet = new HashSet();
+ HashSet<String> aSet = new HashSet<>();
try {
initAllNames(FULL_NAME_ID, aSet);
} catch (Exception e) {
/* In case of malformed font */
}
- return (String[])aSet.toArray(new String[0]);
+ return aSet.toArray(new String[0]);
}
/* Used by the OpenType engine for mark positioning.
--- a/jdk/src/share/classes/sun/font/Type1Font.java Fri Feb 07 13:03:09 2014 -0800
+++ b/jdk/src/share/classes/sun/font/Type1Font.java Sat Feb 08 18:03:38 2014 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -86,7 +86,7 @@
public synchronized void dispose() {
java.security.AccessController.doPrivileged(
- new java.security.PrivilegedAction() {
+ new java.security.PrivilegedAction<Object>() {
public Object run() {
if (fileName != null) {
@@ -98,16 +98,16 @@
}
}
- WeakReference bufferRef = new WeakReference(null);
+ WeakReference<Object> bufferRef = new WeakReference<>(null);
private String psName = null;
- static private HashMap styleAbbreviationsMapping;
- static private HashSet styleNameTokes;
+ static private HashMap<String, String> styleAbbreviationsMapping;
+ static private HashSet<String> styleNameTokes;
static {
- styleAbbreviationsMapping = new HashMap();
- styleNameTokes = new HashSet();
+ styleAbbreviationsMapping = new HashMap<>();
+ styleNameTokes = new HashSet<>();
/* These abbreviation rules are taken from Appendix 1 of Adobe Technical Note #5088 */
/* NB: this list is not complete - we did not include abbreviations which contain
@@ -192,7 +192,7 @@
try {
RandomAccessFile raf = (RandomAccessFile)
java.security.AccessController.doPrivileged(
- new java.security.PrivilegedAction() {
+ new java.security.PrivilegedAction<Object>() {
public Object run() {
try {
return new RandomAccessFile(platName, "r");
@@ -205,7 +205,7 @@
fileSize = (int)fc.size();
mapBuf = fc.map(FileChannel.MapMode.READ_ONLY, 0, fileSize);
mapBuf.position(0);
- bufferRef = new WeakReference(mapBuf);
+ bufferRef = new WeakReference<>(mapBuf);
fc.close();
} catch (NullPointerException e) {
throw new FontFormatException(e.toString());
@@ -232,7 +232,7 @@
try {
raf = (RandomAccessFile)
java.security.AccessController.doPrivileged(
- new java.security.PrivilegedAction() {
+ new java.security.PrivilegedAction<Object>() {
public Object run() {
try {
return new RandomAccessFile(platName, "r");
@@ -474,7 +474,7 @@
private String expandAbbreviation(String abbr) {
if (styleAbbreviationsMapping.containsKey(abbr))
- return (String) styleAbbreviationsMapping.get(abbr);
+ return styleAbbreviationsMapping.get(abbr);
return abbr;
}
--- a/jdk/src/share/classes/sun/java2d/Disposer.java Fri Feb 07 13:03:09 2014 -0800
+++ b/jdk/src/share/classes/sun/java2d/Disposer.java Sat Feb 08 18:03:38 2014 -0800
@@ -47,8 +47,9 @@
* @see DisposerRecord
*/
public class Disposer implements Runnable {
- private static final ReferenceQueue queue = new ReferenceQueue();
- private static final Hashtable records = new Hashtable();
+ private static final ReferenceQueue<Object> queue = new ReferenceQueue<>();
+ private static final Hashtable<java.lang.ref.Reference<Object>, DisposerRecord> records =
+ new Hashtable<>();
private static Disposer disposerInstance;
public static final int WEAK = 0;
@@ -77,7 +78,7 @@
}
disposerInstance = new Disposer();
java.security.AccessController.doPrivileged(
- new java.security.PrivilegedAction() {
+ new java.security.PrivilegedAction<Object>() {
public Object run() {
/* The thread must be a member of a thread group
* which will not get GCed before VM exit.
@@ -135,11 +136,11 @@
if (target instanceof DisposerTarget) {
target = ((DisposerTarget)target).getDisposerReferent();
}
- java.lang.ref.Reference ref;
+ java.lang.ref.Reference<Object> ref;
if (refType == PHANTOM) {
- ref = new PhantomReference(target, queue);
+ ref = new PhantomReference<>(target, queue);
} else {
- ref = new WeakReference(target, queue);
+ ref = new WeakReference<>(target, queue);
}
records.put(ref, rec);
}
@@ -149,7 +150,7 @@
try {
Object obj = queue.remove();
((Reference)obj).clear();
- DisposerRecord rec = (DisposerRecord)records.remove(obj);
+ DisposerRecord rec = records.remove(obj);
rec.dispose();
obj = null;
rec = null;
@@ -214,7 +215,7 @@
&& freed < 10000 && deferred < 100) {
freed++;
((Reference)obj).clear();
- DisposerRecord rec = (DisposerRecord)records.remove(obj);
+ DisposerRecord rec = records.remove(obj);
if (rec instanceof PollDisposable) {
rec.dispose();
obj = null;
@@ -247,17 +248,18 @@
* so will clutter the records hashmap and no one will be cleaning up
* the reference queue.
*/
- public static void addReference(Reference ref, DisposerRecord rec) {
+ @SuppressWarnings("unchecked")
+ public static void addReference(Reference<Object> ref, DisposerRecord rec) {
records.put(ref, rec);
}
public static void addObjectRecord(Object obj, DisposerRecord rec) {
- records.put(new WeakReference(obj, queue) , rec);
+ records.put(new WeakReference<>(obj, queue) , rec);
}
/* This is intended for use in conjunction with addReference(..)
*/
- public static ReferenceQueue getQueue() {
+ public static ReferenceQueue<Object> getQueue() {
return queue;
}