--- old/src/share/classes/java/awt/Menu.java 2014-04-18 11:25:44.039493892 -0700 +++ new/src/share/classes/java/awt/Menu.java 2014-04-18 11:25:43.909493898 -0700 @@ -66,7 +66,7 @@ AWTAccessor.setMenuAccessor( new AWTAccessor.MenuAccessor() { - public Vector getItems(Menu menu) { + public Vector getItems(Menu menu) { return menu.items; } }); @@ -78,7 +78,7 @@ * @serial * @see #countItems() */ - Vector items = new Vector<>(); + Vector items = new Vector<>(); /** * This field indicates whether the menu has the @@ -252,7 +252,7 @@ * be called on the toolkit thread. */ final MenuItem getItemImpl(int index) { - return (MenuItem)items.elementAt(index); + return items.elementAt(index); } /** @@ -544,7 +544,7 @@ // HeadlessException will be thrown from MenuComponent's readObject s.defaultReadObject(); for(int i = 0; i < items.size(); i++) { - MenuItem item = (MenuItem)items.elementAt(i); + MenuItem item = items.elementAt(i); item.parent = this; } } --- old/src/share/classes/sun/awt/AWTAccessor.java 2014-04-18 11:25:44.972827182 -0700 +++ new/src/share/classes/sun/awt/AWTAccessor.java 2014-04-18 11:25:44.839493856 -0700 @@ -620,7 +620,7 @@ /** * Returns menus */ - Vector getMenus(MenuBar menuBar); + Vector getMenus(MenuBar menuBar); } /** @@ -662,7 +662,7 @@ /** * Returns vector of the items that are part of the Menu */ - Vector getItems(Menu menu); + Vector getItems(Menu menu); } /** --- old/src/share/classes/sun/awt/AppContext.java 2014-04-18 11:25:45.819493809 -0700 +++ new/src/share/classes/sun/awt/AppContext.java 2014-04-18 11:25:45.682827149 -0700 @@ -890,6 +890,7 @@ Supplier supplier) { final AppContext appContext = AppContext.getAppContext(); + @SuppressWarnings("unchecked") SoftReference ref = (SoftReference) appContext.get(key); if (ref != null) { final T object = ref.get(); --- old/src/share/classes/sun/awt/FontConfiguration.java 2014-04-18 11:25:46.649493770 -0700 +++ new/src/share/classes/sun/awt/FontConfiguration.java 2014-04-18 11:25:46.519493777 -0700 @@ -64,7 +64,7 @@ protected static String osName; protected static String encoding; // canonical name of default nio charset protected static Locale startupLocale = null; - protected static Hashtable localeMap = null; + protected static Hashtable localeMap = null; private static FontConfiguration fontConfig; private static PlatformLogger logger; protected static boolean isProperties = true; @@ -159,15 +159,15 @@ short fontNameID = compFontNameIDs[0][0][0]; short fileNameID = getComponentFileID(fontNameID); final String fileName = mapFileName(getComponentFileName(fileNameID)); - Boolean exists = (Boolean)java.security.AccessController.doPrivileged( - new java.security.PrivilegedAction() { - public Object run() { + Boolean exists = java.security.AccessController.doPrivileged( + new java.security.PrivilegedAction() { + public Boolean run() { try { File f = new File(fileName); return Boolean.valueOf(f.exists()); } catch (Exception e) { - return false; + return Boolean.FALSE; } } }); @@ -534,11 +534,11 @@ private short remapLocaleMap(int fontIndex, int styleIndex, short scriptID, short fontID) { String scriptName = getString(table_scriptIDs[scriptID]); - String value = (String)localeMap.get(scriptName); + String value = localeMap.get(scriptName); if (value == null) { String fontName = fontNames[fontIndex]; String styleName = styleNames[styleIndex]; - value = (String)localeMap.get(fontName + "." + styleName + "." + scriptName); + value = localeMap.get(fontName + "." + styleName + "." + scriptName); } if (value == null) { return fontID; @@ -746,7 +746,7 @@ /* Mappings from file encoding to font config name for font supporting * the corresponding language. This is filled in by initReorderMap() */ - protected HashMap reorderMap = null; + protected HashMap reorderMap = null; /* Platform-specific mappings */ protected abstract void initReorderMap(); @@ -777,7 +777,7 @@ if (fontConfig.reorderMap == null) { fontConfig.initReorderMap(); } - HashMap reorderMap = fontConfig.reorderMap; + HashMap reorderMap = fontConfig.reorderMap; /* Find the most specific mapping */ String language = startupLocale.getLanguage(); @@ -817,9 +817,9 @@ } } - private static Vector splitSequence(String sequence) { + private static Vector splitSequence(String sequence) { //String.split would be more convenient, but incurs big performance penalty - Vector parts = new Vector(); + Vector parts = new Vector<>(); int start = 0; int end; while ((end = sequence.indexOf(',', start)) >= 0) { @@ -833,14 +833,14 @@ } protected String[] split(String sequence) { - Vector v = splitSequence(sequence); - return (String[])v.toArray(new String[0]); + Vector v = splitSequence(sequence); + return v.toArray(new String[0]); } //////////////////////////////////////////////////////////////////////// // Methods for extracting information from the fontconfig data for AWT// //////////////////////////////////////////////////////////////////////// - private Hashtable charsetRegistry = new Hashtable(5); + private Hashtable charsetRegistry = new Hashtable<>(5); /** * Returns FontDescriptors describing the physical fonts used for the @@ -932,9 +932,9 @@ Charset fc = null; if (charsetName.equals("default")) { - fc = (Charset) charsetRegistry.get(fontName); + fc = charsetRegistry.get(fontName); } else { - fc = (Charset) charsetRegistry.get(charsetName); + fc = charsetRegistry.get(charsetName); } if (fc != null) { return fc.newEncoder(); @@ -943,8 +943,8 @@ if (!charsetName.startsWith("sun.awt.") && !charsetName.equals("default")) { fc = Charset.forName(charsetName); } else { - Class fcc = (Class) AccessController.doPrivileged(new PrivilegedAction() { - public Object run() { + Class fcc = AccessController.doPrivileged(new PrivilegedAction>() { + public Class run() { try { return Class.forName(charsetName, true, ClassLoader.getSystemClassLoader()); @@ -1377,9 +1377,9 @@ //This method will only be called during build time, do we //need do PrivilegedAction? - String osName = (String)java.security.AccessController.doPrivileged( - new java.security.PrivilegedAction() { - public Object run() { + String osName = java.security.AccessController.doPrivileged( + new java.security.PrivilegedAction() { + public String run() { return System.getProperty("os.name"); } }); @@ -2139,7 +2139,7 @@ boolean has1252 = false; //get the scriptID list - String[] ss = (String[])splitSequence(value).toArray(EMPTY_STRING_ARRAY); + String[] ss = splitSequence(value).toArray(EMPTY_STRING_ARRAY); short [] sa = new short[ss.length]; for (int i = 0; i < ss.length; i++) { if ("alphabetic/default".equals(ss[i])) { --- old/src/share/classes/sun/awt/HToolkit.java 2014-04-18 11:25:47.509493730 -0700 +++ new/src/share/classes/sun/awt/HToolkit.java 2014-04-18 11:25:47.376160402 -0700 @@ -214,7 +214,8 @@ throw new HeadlessException(); } - public Map mapInputMethodHighlight(InputMethodHighlight highlight) + public Map mapInputMethodHighlight( + InputMethodHighlight highlight) throws HeadlessException { throw new HeadlessException(); } --- old/src/share/classes/sun/awt/HeadlessToolkit.java 2014-04-18 11:25:48.486160351 -0700 +++ new/src/share/classes/sun/awt/HeadlessToolkit.java 2014-04-18 11:25:48.332827024 -0700 @@ -29,6 +29,7 @@ import java.awt.dnd.*; import java.awt.dnd.peer.DragSourceContextPeer; import java.awt.event.*; +import java.awt.font.TextAttribute; import java.awt.im.InputMethodHighlight; import java.awt.image.*; import java.awt.datatransfer.Clipboard; @@ -224,7 +225,7 @@ throw new HeadlessException(); } - public Map mapInputMethodHighlight(InputMethodHighlight highlight) + public Map mapInputMethodHighlight(InputMethodHighlight highlight) throws HeadlessException { throw new HeadlessException(); } --- old/src/share/classes/sun/awt/PlatformFont.java 2014-04-18 11:25:49.316160312 -0700 +++ new/src/share/classes/sun/awt/PlatformFont.java 2014-04-18 11:25:49.182826984 -0700 @@ -143,7 +143,7 @@ if (len < 1) { return new CharsetString[0]; } - Vector mcs = null; + Vector mcs = null; char[] tmpStr = new char[len]; char tmpChar = defaultChar; boolean encoded = false; @@ -198,7 +198,7 @@ } if (currentFont != fd){ if (mcs == null) { - mcs = new Vector(3); + mcs = new Vector<>(3); } mcs.addElement(new CharsetString(tmpStr, lastIndex, i-lastIndex, currentFont)); @@ -209,16 +209,13 @@ } CharsetString[] result; CharsetString cs = new CharsetString(tmpStr, lastIndex, - len-lastIndex, currentFont); + len-lastIndex, currentFont); if (mcs == null) { result = new CharsetString[1]; result[0] = cs; } else { mcs.addElement(cs); - result = new CharsetString[mcs.size()]; - for (int i = 0; i < mcs.size(); i++){ - result[i] = (CharsetString)mcs.elementAt(i); - } + result = mcs.toArray(new CharsetString[mcs.size()]); } return result; } --- old/src/share/classes/sun/awt/SunToolkit.java 2014-04-18 11:25:50.182826938 -0700 +++ new/src/share/classes/sun/awt/SunToolkit.java 2014-04-18 11:25:50.042826945 -0700 @@ -1915,6 +1915,7 @@ public synchronized void setWindowDeactivationTime(Window w, long time) { AppContext ctx = getAppContext(w); + @SuppressWarnings("unchecked") WeakHashMap map = (WeakHashMap)ctx.get(DEACTIVATION_TIMES_MAP_KEY); if (map == null) { map = new WeakHashMap(); @@ -1925,6 +1926,7 @@ public synchronized long getWindowDeactivationTime(Window w) { AppContext ctx = getAppContext(w); + @SuppressWarnings("unchecked") WeakHashMap map = (WeakHashMap)ctx.get(DEACTIVATION_TIMES_MAP_KEY); if (map == null) { return -1; --- old/src/share/classes/sun/awt/datatransfer/DataTransferer.java 2014-04-18 11:25:51.102826895 -0700 +++ new/src/share/classes/sun/awt/datatransfer/DataTransferer.java 2014-04-18 11:25:50.962826901 -0700 @@ -354,7 +354,7 @@ return false; } - Class rep_class = flavor.getRepresentationClass(); + Class rep_class = flavor.getRepresentationClass(); if (flavor.isRepresentationClassReader() || String.class.equals(rep_class) || @@ -726,7 +726,7 @@ * DataFlavors and data formats * @throws NullPointerException if formats or map is null */ - public Set getFlavorsForFormatsAsSet(long[] formats, FlavorTable map) { + public Set getFlavorsForFormatsAsSet(long[] formats, FlavorTable map) { Set flavorSet = new HashSet<>(formats.length); for (long format : formats) { @@ -1117,7 +1117,7 @@ throw new IOException("data translation failed"); } - final List list = (List)obj; + final List list = (List)obj; final ProtectionDomain userProtectionDomain = getUserProtectionDomain(contents); @@ -1145,7 +1145,7 @@ if (targetCharset == null) { targetCharset = "UTF-8"; } - final List list = (List)obj; + final List list = (List)obj; final ProtectionDomain userProtectionDomain = getUserProtectionDomain(contents); final ArrayList fileList = castToFiles(list, userProtectionDomain); final ArrayList uriList = new ArrayList<>(fileList.size()); @@ -1290,7 +1290,7 @@ return true; } - private ArrayList castToFiles(final List files, + private ArrayList castToFiles(final List files, final ProtectionDomain userProtectionDomain) throws IOException { try { return AccessController.doPrivileged((PrivilegedExceptionAction>) () -> { @@ -1668,7 +1668,7 @@ * instance of the Class as its sole parameter. */ private Object constructFlavoredObject(Object arg, DataFlavor flavor, - Class clazz) + Class clazz) throws IOException { final Class dfrc = flavor.getRepresentationClass(); @@ -1676,19 +1676,19 @@ if (clazz.equals(dfrc)) { return arg; // simple case } else { - Constructor[] constructors; + Constructor[] constructors; try { constructors = AccessController.doPrivileged( - (PrivilegedAction) dfrc::getConstructors); + (PrivilegedAction[]>) dfrc::getConstructors); } catch (SecurityException se) { throw new IOException(se.getMessage()); } - Constructor constructor = Stream.of(constructors) + Constructor constructor = Stream.of(constructors) .filter(c -> Modifier.isPublic(c.getModifiers())) .filter(c -> { - Class[] ptypes = c.getParameterTypes(); + Class[] ptypes = c.getParameterTypes(); return ptypes != null && ptypes.length == 1 && clazz.equals(ptypes[0]); @@ -1917,7 +1917,8 @@ byte[] bytes, String mimeType) throws IOException { - Iterator readerIterator = ImageIO.getImageReadersByMIMEType(mimeType); + Iterator readerIterator = + ImageIO.getImageReadersByMIMEType(mimeType); if (!readerIterator.hasNext()) { throw new IOException("No registered service provider can decode " + @@ -1927,7 +1928,7 @@ IOException ioe = null; while (readerIterator.hasNext()) { - ImageReader imageReader = (ImageReader)readerIterator.next(); + ImageReader imageReader = readerIterator.next(); try (ByteArrayInputStream bais = new ByteArrayInputStream(bytes)) { try (ImageInputStream imageInputStream = ImageIO.createImageInputStream(bais)) { ImageReadParam param = imageReader.getDefaultReadParam(); @@ -1970,7 +1971,8 @@ throws IOException { IOException originalIOE = null; - Iterator writerIterator = ImageIO.getImageWritersByMIMEType(mimeType); + Iterator writerIterator = + ImageIO.getImageWritersByMIMEType(mimeType); if (!writerIterator.hasNext()) { throw new IOException("No registered service provider can encode " + @@ -2029,7 +2031,8 @@ String mimeType) throws IOException { - Iterator writerIterator = ImageIO.getImageWritersByMIMEType(mimeType); + Iterator writerIterator = + ImageIO.getImageWritersByMIMEType(mimeType); ImageTypeSpecifier typeSpecifier = new ImageTypeSpecifier(renderedImage); @@ -2038,7 +2041,7 @@ IOException ioe = null; while (writerIterator.hasNext()) { - ImageWriter imageWriter = (ImageWriter)writerIterator.next(); + ImageWriter imageWriter = writerIterator.next(); ImageWriterSpi writerSpi = imageWriter.getOriginatingProvider(); if (!writerSpi.canEncodeImage(typeSpecifier)) { @@ -2122,7 +2125,7 @@ public byte[] convertData(final Object source, final Transferable contents, final long format, - final Map formatMap, + final Map formatMap, final boolean isToolkitThread) throws IOException { @@ -2145,7 +2148,7 @@ } byte[] data = null; try { - DataFlavor flavor = (DataFlavor)formatMap.get(format); + DataFlavor flavor = formatMap.get(format); if (flavor != null) { data = translateTransferable(contents, flavor, format); } @@ -2186,7 +2189,7 @@ } finally { getToolkitThreadBlockedHandler().unlock(); } else { - DataFlavor flavor = (DataFlavor)formatMap.get(format); + DataFlavor flavor = formatMap.get(format); if (flavor != null) { ret = translateTransferable(contents, flavor, format); } @@ -2235,7 +2238,7 @@ * Helper function to convert a Set of DataFlavors to a sorted array. * The array will be sorted according to DataFlavorComparator. */ - public static DataFlavor[] setToSortedDataFlavorArray(Set flavorsSet) { + public static DataFlavor[] setToSortedDataFlavorArray(Set flavorsSet) { DataFlavor[] flavors = new DataFlavor[flavorsSet.size()]; flavorsSet.toArray(flavors); final Comparator comparator = @@ -2598,12 +2601,12 @@ String primaryType1 = flavor1.getPrimaryType(); String subType1 = flavor1.getSubType(); String mimeType1 = primaryType1 + "/" + subType1; - Class class1 = flavor1.getRepresentationClass(); + Class class1 = flavor1.getRepresentationClass(); String primaryType2 = flavor2.getPrimaryType(); String subType2 = flavor2.getSubType(); String mimeType2 = primaryType2 + "/" + subType2; - Class class2 = flavor2.getRepresentationClass(); + Class class2 = flavor2.getRepresentationClass(); if (flavor1.isFlavorTextType() && flavor2.isFlavorTextType()) { // First, compare MIME types --- old/src/share/classes/sun/awt/datatransfer/SunClipboard.java 2014-04-18 11:25:52.032826851 -0700 +++ new/src/share/classes/sun/awt/datatransfer/SunClipboard.java 2014-04-18 11:25:51.879493525 -0700 @@ -78,7 +78,7 @@ * this clipboard. It is used for tracking changes * of DataFlavors available on this clipboard. */ - private volatile Set currentDataFlavors; + private volatile Set currentDataFlavors; public SunClipboard(String name) { @@ -338,7 +338,7 @@ protected abstract byte[] getClipboardData(long format) throws IOException; - private static Set formatArrayAsDataFlavorSet(long[] formats) { + private static Set formatArrayAsDataFlavorSet(long[] formats) { return (formats == null) ? null : DataTransferer.getInstance(). getFlavorsForFormatsAsSet(formats, getDefaultFlavorTable()); @@ -417,7 +417,7 @@ * this clipboard */ public void checkChange(long[] formats) { - Set prevDataFlavors = currentDataFlavors; + Set prevDataFlavors = currentDataFlavors; currentDataFlavors = formatArrayAsDataFlavorSet(formats); if (Objects.equals(prevDataFlavors, currentDataFlavors)) { --- old/src/share/classes/sun/awt/datatransfer/TransferableProxy.java 2014-04-18 11:25:52.992826806 -0700 +++ new/src/share/classes/sun/awt/datatransfer/TransferableProxy.java 2014-04-18 11:25:52.842826813 -0700 @@ -111,9 +111,9 @@ } protected void annotateClass(final Class cl) throws IOException { - ClassLoader classLoader = - (ClassLoader)AccessController.doPrivileged(new PrivilegedAction() { - public Object run() { + ClassLoader classLoader = AccessController.doPrivileged( + new PrivilegedAction() { + public ClassLoader run() { return cl.getClassLoader(); } }); @@ -124,14 +124,14 @@ map.put(s, classLoader); } protected void annotateProxyClass(final Class cl) throws IOException { - ClassLoader classLoader = - (ClassLoader)AccessController.doPrivileged(new PrivilegedAction() { - public Object run() { + ClassLoader classLoader = AccessController.doPrivileged( + new PrivilegedAction() { + public ClassLoader run() { return cl.getClassLoader(); } }); - Class[] interfaces = cl.getInterfaces(); + Class[] interfaces = cl.getInterfaces(); Set s = new HashSet(interfaces.length); for (int i = 0; i < interfaces.length; i++) { s.add(interfaces[i].getName()); @@ -141,7 +141,7 @@ } Map, ClassLoader> getClassLoaderMap() { - return new HashMap(map); + return new HashMap<>(map); } } @@ -191,9 +191,9 @@ boolean hasNonPublicInterface = false; // define proxy in class loader of non-public interface(s), if any - Class[] classObjs = new Class[interfaces.length]; + Class[] classObjs = new Class[interfaces.length]; for (int i = 0; i < interfaces.length; i++) { - Class cl = Class.forName(interfaces[i], false, classLoader); + Class cl = Class.forName(interfaces[i], false, classLoader); if ((cl.getModifiers() & Modifier.PUBLIC) == 0) { if (hasNonPublicInterface) { if (nonPublicLoader != cl.getClassLoader()) { --- old/src/share/classes/sun/awt/dnd/SunDragSourceContextPeer.java 2014-04-18 11:25:53.836160100 -0700 +++ new/src/share/classes/sun/awt/dnd/SunDragSourceContextPeer.java 2014-04-18 11:25:53.696160106 -0700 @@ -146,7 +146,7 @@ } protected abstract void startDrag(Transferable trans, - long[] formats, Map formatMap); + long[] formats, Map formatMap); /** * set cursor --- old/src/share/classes/sun/awt/dnd/SunDropTargetContextPeer.java 2014-04-18 11:25:54.669493394 -0700 +++ new/src/share/classes/sun/awt/dnd/SunDropTargetContextPeer.java 2014-04-18 11:25:54.519493401 -0700 @@ -245,11 +245,11 @@ throw new InvalidDnDOperationException("No drop current"); } - Map flavorMap = DataTransferer.getInstance().getFlavorsForFormats - (currentT, DataTransferer.adaptFlavorMap + Map flavorMap = DataTransferer.getInstance() + .getFlavorsForFormats(currentT, DataTransferer.adaptFlavorMap (currentDT.getFlavorMap())); - lFormat = (Long)flavorMap.get(df); + lFormat = flavorMap.get(df); if (lFormat == null) { throw new UnsupportedFlavorException(df); } @@ -738,7 +738,7 @@ // dispatcher state fields private int returnValue = 0; // set of events to be dispatched by this dispatcher - private final HashSet eventSet = new HashSet(3); + private final HashSet eventSet = new HashSet<>(3); static final ToolkitThreadBlockedHandler handler = DataTransferer.getInstance().getToolkitThreadBlockedHandler(); --- old/src/share/classes/sun/awt/geom/AreaOp.java 2014-04-18 11:25:55.552826686 -0700 +++ new/src/share/classes/sun/awt/geom/AreaOp.java 2014-04-18 11:25:55.409493359 -0700 @@ -152,36 +152,36 @@ public abstract int getState(); - public Vector calculate(Vector left, Vector right) { - Vector edges = new Vector(); + public Vector calculate(Vector left, Vector right) { + Vector edges = new Vector<>(); addEdges(edges, left, AreaOp.CTAG_LEFT); addEdges(edges, right, AreaOp.CTAG_RIGHT); - edges = pruneEdges(edges); + Vector curves = pruneEdges(edges); if (false) { System.out.println("result: "); - int numcurves = edges.size(); - Curve[] curvelist = (Curve[]) edges.toArray(new Curve[numcurves]); + int numcurves = curves.size(); + Curve[] curvelist = curves.toArray(new Curve[numcurves]); for (int i = 0; i < numcurves; i++) { System.out.println("curvelist["+i+"] = "+curvelist[i]); } } - return edges; + return curves; } - private static void addEdges(Vector edges, Vector curves, int curvetag) { - Enumeration enum_ = curves.elements(); + private static void addEdges(Vector edges, Vector curves, int curvetag) { + Enumeration enum_ = curves.elements(); while (enum_.hasMoreElements()) { - Curve c = (Curve) enum_.nextElement(); + Curve c = enum_.nextElement(); if (c.getOrder() > 0) { edges.add(new Edge(c, curvetag)); } } } - private static Comparator YXTopComparator = new Comparator() { - public int compare(Object o1, Object o2) { - Curve c1 = ((Edge) o1).getCurve(); - Curve c2 = ((Edge) o2).getCurve(); + private static Comparator YXTopComparator = new Comparator() { + public int compare(Edge o1, Edge o2) { + Curve c1 = o1.getCurve(); + Curve c2 = o2.getCurve(); double v1, v2; if ((v1 = c1.getYTop()) == (v2 = c2.getYTop())) { if ((v1 = c1.getXTop()) == (v2 = c2.getXTop())) { @@ -195,12 +195,16 @@ } }; - private Vector pruneEdges(Vector edges) { + private Vector pruneEdges(Vector edges) { int numedges = edges.size(); if (numedges < 2) { - return edges; + Vector rt = new Vector<>(); + for (Edge edge: edges) { + rt.add(edge.getCurve()); + } + return rt; } - Edge[] edgelist = (Edge[]) edges.toArray(new Edge[numedges]); + Edge[] edgelist = edges.toArray(new Edge[numedges]); Arrays.sort(edgelist, YXTopComparator); if (false) { System.out.println("pruning: "); @@ -214,9 +218,9 @@ int cur = 0; int next = 0; double yrange[] = new double[2]; - Vector subcurves = new Vector(); - Vector chains = new Vector(); - Vector links = new Vector(); + Vector subcurves = new Vector<>(); + Vector chains = new Vector<>(); + Vector links = new Vector<>(); // Active edges are between left (inclusive) and right (exclusive) while (left < numedges) { double y = yrange[0]; @@ -385,7 +389,7 @@ if (false) { System.out.println("new links:"); for (int i = 0; i < links.size(); i++) { - CurveLink link = (CurveLink) links.elementAt(i); + CurveLink link = links.elementAt(i); System.out.println(" "+link.getSubCurve()); } } @@ -396,10 +400,10 @@ yrange[0] = yend; } finalizeSubCurves(subcurves, chains); - Vector ret = new Vector(); - Enumeration enum_ = subcurves.elements(); + Vector ret = new Vector<>(); + Enumeration enum_ = subcurves.elements(); while (enum_.hasMoreElements()) { - CurveLink link = (CurveLink) enum_.nextElement(); + CurveLink link = enum_.nextElement(); ret.add(link.getMoveto()); CurveLink nextlink = link; while ((nextlink = nextlink.getNext()) != null) { @@ -413,7 +417,8 @@ return ret; } - public static void finalizeSubCurves(Vector subcurves, Vector chains) { + public static void finalizeSubCurves(Vector subcurves, + Vector chains) { int numchains = chains.size(); if (numchains == 0) { return; @@ -437,9 +442,9 @@ private static CurveLink[] EmptyLinkList = new CurveLink[2]; private static ChainEnd[] EmptyChainList = new ChainEnd[2]; - public static void resolveLinks(Vector subcurves, - Vector chains, - Vector links) + public static void resolveLinks(Vector subcurves, + Vector chains, + Vector links) { int numlinks = links.size(); CurveLink[] linklist; --- old/src/share/classes/sun/awt/geom/Crossings.java 2014-04-18 11:25:56.439493311 -0700 +++ new/src/share/classes/sun/awt/geom/Crossings.java 2014-04-18 11:25:56.302826651 -0700 @@ -77,14 +77,14 @@ public abstract boolean covers(double ystart, double yend); - public static Crossings findCrossings(Vector curves, + public static Crossings findCrossings(Vector curves, double xlo, double ylo, double xhi, double yhi) { Crossings cross = new EvenOdd(xlo, ylo, xhi, yhi); - Enumeration enum_ = curves.elements(); + Enumeration enum_ = curves.elements(); while (enum_.hasMoreElements()) { - Curve c = (Curve) enum_.nextElement(); + Curve c = enum_.nextElement(); if (c.accumulateCrossings(cross)) { return null; } @@ -237,7 +237,7 @@ return false; } - private Vector tmp = new Vector(); + private Vector tmp = new Vector<>(); public boolean accumulateQuad(double x0, double y0, double coords[]) { if (y0 < ylo && coords[1] < ylo && coords[3] < ylo) { @@ -258,9 +258,9 @@ return false; } Curve.insertQuad(tmp, x0, y0, coords); - Enumeration enum_ = tmp.elements(); + Enumeration enum_ = tmp.elements(); while (enum_.hasMoreElements()) { - Curve c = (Curve) enum_.nextElement(); + Curve c = enum_.nextElement(); if (c.accumulateCrossings(this)) { return true; } @@ -296,9 +296,9 @@ return false; } Curve.insertCubic(tmp, x0, y0, coords); - Enumeration enum_ = tmp.elements(); + Enumeration enum_ = tmp.elements(); while (enum_.hasMoreElements()) { - Curve c = (Curve) enum_.nextElement(); + Curve c = enum_.nextElement(); if (c.accumulateCrossings(this)) { return true; } --- old/src/share/classes/sun/awt/geom/Curve.java 2014-04-18 11:25:57.296159938 -0700 +++ new/src/share/classes/sun/awt/geom/Curve.java 2014-04-18 11:25:57.159493277 -0700 @@ -38,11 +38,11 @@ protected int direction; - public static void insertMove(Vector curves, double x, double y) { + public static void insertMove(Vector curves, double x, double y) { curves.add(new Order0(x, y)); } - public static void insertLine(Vector curves, + public static void insertLine(Vector curves, double x0, double y0, double x1, double y1) { @@ -59,7 +59,7 @@ } } - public static void insertQuad(Vector curves, + public static void insertQuad(Vector curves, double x0, double y0, double coords[]) { @@ -82,7 +82,7 @@ } } - public static void insertCubic(Vector curves, + public static void insertCubic(Vector curves, double x0, double y0, double coords[]) { --- old/src/share/classes/sun/awt/geom/Order2.java 2014-04-18 11:25:58.186159896 -0700 +++ new/src/share/classes/sun/awt/geom/Order2.java 2014-04-18 11:25:58.049493235 -0700 @@ -47,7 +47,7 @@ private double ycoeff1; private double ycoeff2; - public static void insert(Vector curves, double tmp[], + public static void insert(Vector curves, double tmp[], double x0, double y0, double cx0, double cy0, double x1, double y1, @@ -74,7 +74,7 @@ tmp[i1 + 4], tmp[i1 + 5], direction); } - public static void addInstance(Vector curves, + public static void addInstance(Vector curves, double x0, double y0, double cx0, double cy0, double x1, double y1, --- old/src/share/classes/sun/awt/geom/Order3.java 2014-04-18 11:25:59.186159849 -0700 +++ new/src/share/classes/sun/awt/geom/Order3.java 2014-04-18 11:25:59.046159856 -0700 @@ -53,7 +53,7 @@ private double ycoeff2; private double ycoeff3; - public static void insert(Vector curves, double tmp[], + public static void insert(Vector curves, double tmp[], double x0, double y0, double cx0, double cy0, double cx1, double cy1, @@ -105,7 +105,7 @@ } } - public static void addInstance(Vector curves, + public static void addInstance(Vector curves, double x0, double y0, double cx0, double cy0, double cx1, double cy1, --- old/src/share/classes/sun/awt/image/BufImgSurfaceData.java 2014-04-18 11:26:00.036159809 -0700 +++ new/src/share/classes/sun/awt/image/BufImgSurfaceData.java 2014-04-18 11:25:59.892826482 -0700 @@ -51,7 +51,7 @@ private BufferedImageGraphicsConfig graphicsConfig; RenderLoops solidloops; - private static native void initIDs(Class ICM, Class ICMColorData); + private static native void initIDs(Class ICM, Class ICMColorData); private static final int DCM_RGBX_RED_MASK = 0xff000000; private static final int DCM_RGBX_GREEN_MASK = 0x00ff0000; --- old/src/share/classes/sun/awt/image/GifImageDecoder.java 2014-04-18 11:26:00.889493103 -0700 +++ new/src/share/classes/sun/awt/image/GifImageDecoder.java 2014-04-18 11:26:00.739493109 -0700 @@ -61,7 +61,7 @@ int trans_pixel = -1; IndexColorModel global_model; - Hashtable props = new Hashtable(); + Hashtable props = new Hashtable<>(); byte[] saved_image; IndexColorModel saved_model; --- old/src/share/classes/sun/awt/image/ImageDecoder.java 2014-04-18 11:26:01.739493063 -0700 +++ new/src/share/classes/sun/awt/image/ImageDecoder.java 2014-04-18 11:26:01.602826402 -0700 @@ -83,7 +83,7 @@ return count; } - protected int setProperties(Hashtable props) { + protected int setProperties(Hashtable props) { ImageConsumerQueue cq = null; int count = 0; while ((cq = nextConsumer(cq)) != null) { @@ -164,7 +164,7 @@ source.doneDecoding(this); close(); java.security.AccessController.doPrivileged( - new java.security.PrivilegedAction() { + new java.security.PrivilegedAction() { public Object run() { feeder.interrupt(); return null; --- old/src/share/classes/sun/awt/image/ImageFetcher.java 2014-04-18 11:26:02.569493024 -0700 +++ new/src/share/classes/sun/awt/image/ImageFetcher.java 2014-04-18 11:26:02.432826363 -0700 @@ -152,7 +152,7 @@ info.numWaiting--; } } - src = (ImageFetchable) info.waitList.elementAt(0); + src = info.waitList.elementAt(0); info.waitList.removeElement(src); } return src; @@ -303,26 +303,25 @@ final ThreadGroup fetcherGroup = fetcherThreadGroup; java.security.AccessController.doPrivileged( - new java.security.PrivilegedAction() { - public Object run() { - for (int i = 0; i < info.fetchers.length; i++) { - if (info.fetchers[i] == null) { - ImageFetcher f = new ImageFetcher( - fetcherGroup, i); - try { - f.start(); - info.fetchers[i] = f; - info.numFetchers++; - break; - } catch (Error e) { + new java.security.PrivilegedAction() { + public Object run() { + for (int i = 0; i < info.fetchers.length; i++) { + if (info.fetchers[i] == null) { + ImageFetcher f = new ImageFetcher(fetcherGroup, i); + try { + f.start(); + info.fetchers[i] = f; + info.numFetchers++; + break; + } catch (Error e) { + } } + } + return null; } - } - return null; - } - }); - return; - } + }); + return; + } } @@ -337,13 +336,13 @@ Thread[] fetchers; int numFetchers; int numWaiting; - Vector waitList; + Vector waitList; private FetcherInfo() { fetchers = new Thread[MAX_NUM_FETCHERS_PER_APPCONTEXT]; numFetchers = 0; numWaiting = 0; - waitList = new Vector(); + waitList = new Vector<>(); } /* The key to put()/get() the FetcherInfo into/from the AppContext. */ --- old/src/share/classes/sun/awt/image/ImageRepresentation.java 2014-04-18 11:26:03.416159651 -0700 +++ new/src/share/classes/sun/awt/image/ImageRepresentation.java 2014-04-18 11:26:03.279492990 -0700 @@ -185,7 +185,7 @@ protected BufferedImage createImage(ColorModel cm, WritableRaster raster, boolean isRasterPremultiplied, - Hashtable properties) + Hashtable properties) { BufferedImage bi = new BufferedImage(cm, raster, isRasterPremultiplied, null); --- old/src/share/classes/sun/awt/image/ImagingLib.java 2014-04-18 11:26:04.289492943 -0700 +++ new/src/share/classes/sun/awt/image/ImagingLib.java 2014-04-18 11:26:04.142826283 -0700 @@ -61,7 +61,7 @@ private static final int AFFINE_OP = 1; private static final int CONVOLVE_OP = 2; - private static Class[] nativeOpClass = new Class[NUM_NATIVE_OPS]; + private static Class[] nativeOpClass = new Class[NUM_NATIVE_OPS]; /** * Returned value indicates whether the library initailization was @@ -134,7 +134,7 @@ } - private static int getNativeOpIndex(Class opClass) { + private static int getNativeOpIndex(Class opClass) { // // Search for this class in cached list of // classes supplying native acceleration --- old/src/share/classes/sun/awt/image/JPEGImageDecoder.java 2014-04-18 11:26:05.129492904 -0700 +++ new/src/share/classes/sun/awt/image/JPEGImageDecoder.java 2014-04-18 11:26:04.989492911 -0700 @@ -47,8 +47,8 @@ private static ColorModel ARGBcolormodel; private static ColorModel Graycolormodel; - private static final Class InputStreamClass = InputStream.class; - private static native void initIDs(Class InputStreamClass); + private static final Class InputStreamClass = InputStream.class; + private static native void initIDs(Class InputStreamClass); private ColorModel colormodel; @@ -73,7 +73,7 @@ private native void readImage(InputStream is, byte buf[]) throws ImageFormatException, IOException; - Hashtable props = new Hashtable(); + Hashtable props = new Hashtable<>(); public JPEGImageDecoder(InputStreamImageSource src, InputStream is) { super(src, is); --- old/src/share/classes/sun/awt/image/OffScreenImageSource.java 2014-04-18 11:26:05.966159531 -0700 +++ new/src/share/classes/sun/awt/image/OffScreenImageSource.java 2014-04-18 11:26:05.812826205 -0700 @@ -40,15 +40,15 @@ BufferedImage image; int width; int height; - Hashtable properties; + Hashtable properties; public OffScreenImageSource(BufferedImage image, - Hashtable properties) { + Hashtable properties) { this.image = image; if (properties != null) { this.properties = properties; } else { - this.properties = new Hashtable(); + this.properties = new Hashtable(); } width = image.getWidth(); height = image.getHeight(); --- old/src/share/classes/sun/awt/image/PNGImageDecoder.java 2014-04-18 11:26:06.819492824 -0700 +++ new/src/share/classes/sun/awt/image/PNGImageDecoder.java 2014-04-18 11:26:06.682826164 -0700 @@ -68,7 +68,7 @@ private int filterMethod; private int interlaceMethod; private int gamma = 100000; - private java.util.Hashtable properties; + private java.util.Hashtable properties; /* this is not needed ImageConsumer target; */ @@ -83,7 +83,7 @@ private void property(String key,Object value) { if(value==null) return; - if(properties==null) properties=new java.util.Hashtable(); + if(properties==null) properties=new java.util.Hashtable<>(); properties.put(key,value); } private void property(String key,float value) { --- old/src/share/classes/sun/awt/image/ToolkitImage.java 2014-04-18 11:26:07.676159451 -0700 +++ new/src/share/classes/sun/awt/image/ToolkitImage.java 2014-04-18 11:26:07.546159457 -0700 @@ -79,7 +79,7 @@ private int width = -1; private int height = -1; - private Hashtable properties; + private Hashtable properties; private int availinfo; @@ -254,9 +254,9 @@ addInfo(ImageObserver.WIDTH | ImageObserver.HEIGHT); } - void setProperties(Hashtable props) { + void setProperties(Hashtable props) { if (props == null) { - props = new Hashtable(); + props = new Hashtable(); } properties = props; addInfo(ImageObserver.PROPERTIES); --- old/src/share/classes/sun/awt/shell/ShellFolder.java 2014-04-18 11:26:08.506159412 -0700 +++ new/src/share/classes/sun/awt/shell/ShellFolder.java 2014-04-18 11:26:08.369492752 -0700 @@ -127,14 +127,14 @@ File[] files = super.listFiles(); if (!includeHiddenFiles) { - Vector v = new Vector(); + Vector v = new Vector<>(); int nameCount = (files == null) ? 0 : files.length; for (int i = 0; i < nameCount; i++) { if (!files[i].isHidden()) { v.addElement(files[i]); } } - files = (File[])v.toArray(new File[v.size()]); + files = v.toArray(new File[v.size()]); } return files; @@ -208,7 +208,7 @@ static { String managerClassName = (String)Toolkit.getDefaultToolkit(). getDesktopProperty("Shell.shellFolderManager"); - Class managerClass = null; + Class managerClass = null; try { managerClass = ReflectUtil.forName(managerClassName); // swallow the exceptions below and use default shell folder @@ -554,7 +554,7 @@ /** * Provides a default comparator for the default column set */ - private static final Comparator DEFAULT_COMPARATOR = new Comparator() { + private static final Comparator DEFAULT_COMPARATOR = new Comparator() { public int compare(Object o1, Object o2) { int gt; @@ -565,7 +565,9 @@ } else if (o1 == null && o2 != null) { gt = -1; } else if (o1 instanceof Comparable) { - gt = ((Comparable) o1).compareTo(o2); + @SuppressWarnings("unchecked") + Comparable o = (Comparable) o1; + gt = o.compareTo(o2); } else { gt = 0; } --- old/src/share/classes/sun/awt/shell/ShellFolderColumnInfo.java 2014-04-18 11:26:09.349492705 -0700 +++ new/src/share/classes/sun/awt/shell/ShellFolderColumnInfo.java 2014-04-18 11:26:09.216159379 -0700 @@ -38,7 +38,7 @@ */ private Integer alignment; private SortOrder sortOrder; - private Comparator comparator; + private Comparator comparator; /** * false (default) if the {@link comparator} expects folders as arguments, * and true if folder's column values. The first option is used default for comparison @@ -49,7 +49,7 @@ public ShellFolderColumnInfo(String title, Integer width, Integer alignment, boolean visible, - SortOrder sortOrder, Comparator comparator, + SortOrder sortOrder, Comparator comparator, boolean compareByColumn) { this.title = title; this.width = width; @@ -62,7 +62,7 @@ public ShellFolderColumnInfo(String title, Integer width, Integer alignment, boolean visible, - SortOrder sortOrder, Comparator comparator) { + SortOrder sortOrder, Comparator comparator) { this(title, width, alignment, visible, sortOrder, comparator, false); } @@ -115,11 +115,11 @@ this.sortOrder = sortOrder; } - public Comparator getComparator() { + public Comparator getComparator() { return comparator; } - public void setComparator(Comparator comparator) { + public void setComparator(Comparator comparator) { this.comparator = comparator; } --- old/src/share/classes/sun/awt/util/IdentityArrayList.java 2014-04-18 11:26:10.196159332 -0700 +++ new/src/share/classes/sun/awt/util/IdentityArrayList.java 2014-04-18 11:26:10.056159339 -0700 @@ -285,6 +285,7 @@ * this list * @throws NullPointerException if the specified array is null */ + @SuppressWarnings("unchecked") public T[] toArray(T[] a) { if (a.length < size) // Make a new array of a's runtime type, but my contents: @@ -307,7 +308,9 @@ public E get(int index) { rangeCheck(index); - return (E) elementData[index]; + @SuppressWarnings("unchecked") + E rv = (E) elementData[index]; + return rv; } /** @@ -322,6 +325,7 @@ public E set(int index, E element) { rangeCheck(index); + @SuppressWarnings("unchecked") E oldValue = (E) elementData[index]; elementData[index] = element; return oldValue; @@ -371,6 +375,7 @@ rangeCheck(index); modCount++; + @SuppressWarnings("unchecked") E oldValue = (E) elementData[index]; int numMoved = size - index - 1; --- old/src/share/classes/sun/awt/util/IdentityLinkedList.java 2014-04-18 11:26:11.062825958 -0700 +++ new/src/share/classes/sun/awt/util/IdentityLinkedList.java 2014-04-18 11:26:10.916159298 -0700 @@ -280,7 +280,9 @@ Entry successor = (index==size ? header : entry(index)); Entry predecessor = successor.previous; for (int i=0; i e = new Entry((E)a[i], successor, predecessor); + @SuppressWarnings("unchecked") + E tmp = (E) a[i]; + Entry e = new Entry(tmp, successor, predecessor); predecessor.next = e; predecessor = e; } @@ -396,7 +398,7 @@ */ public int indexOf(Object o) { int index = 0; - for (Entry e = header.next; e != header; e = e.next) { + for (Entry e = header.next; e != header; e = e.next) { if (o == e.element) { return index; } @@ -418,7 +420,7 @@ */ public int lastIndexOf(Object o) { int index = size; - for (Entry e = header.previous; e != header; e = e.previous) { + for (Entry e = header.previous; e != header; e = e.previous) { index--; if (o == e.element) { return index; @@ -787,7 +789,7 @@ } /** Adapter to provide descending iterators via ListItr.previous */ - private class DescendingIterator implements Iterator { + private class DescendingIterator implements Iterator { final ListItr itr = new ListItr(size()); public boolean hasNext() { return itr.hasPrevious(); @@ -860,6 +862,7 @@ * this list * @throws NullPointerException if the specified array is null */ + @SuppressWarnings("unchecked") public T[] toArray(T[] a) { if (a.length < size) a = (T[])java.lang.reflect.Array.newInstance( --- old/src/solaris/classes/sun/awt/X11/InfoWindow.java 2014-04-18 11:26:11.946159250 -0700 +++ new/src/solaris/classes/sun/awt/X11/InfoWindow.java 2014-04-18 11:26:11.792825925 -0700 @@ -207,8 +207,9 @@ textLabel.setText(tooltipString); } - Point pointer = (Point)AccessController.doPrivileged(new PrivilegedAction() { - public Object run() { + Point pointer = AccessController.doPrivileged( + new PrivilegedAction() { + public Point run() { if (!isPointerOverTrayIcon(liveArguments.getBounds())) { return null; } --- old/src/solaris/classes/sun/awt/X11/ListHelper.java 2014-04-18 11:26:12.822825877 -0700 +++ new/src/solaris/classes/sun/awt/X11/ListHelper.java 2014-04-18 11:26:12.682825883 -0700 @@ -55,10 +55,10 @@ private final int SCROLLBAR_WIDTH; // Width of a scrollbar - private java.util.List items; // List of items + private java.util.List items; // List of items // TODO: maybe this would be better as a simple int[] - private java.util.List selected; // List of selected items + private java.util.List selected; // List of selected items private boolean multiSelect; // Can multiple items be selected // at once? private int focusedIndex; @@ -100,8 +100,8 @@ this.peer = peer; this.colors = colors; this.multiSelect = multiSelect; - items = new ArrayList(initialSize); - selected = new ArrayList(1); + items = new ArrayList<>(initialSize); + selected = new ArrayList<>(1); selected.add(Integer.valueOf(-1)); this.maxVisItems = maxVisItems; @@ -190,7 +190,7 @@ /* if called for multiselect, return -1 */ public int getSelectedIndex() { if (!multiSelect) { - Integer val = (Integer)selected.get(0); + Integer val = selected.get(0); return val.intValue(); } return -1; @@ -217,7 +217,7 @@ } public String getItem(int index) { - return (String) items.get(index); + return items.get(index); } /**********************************************************************/ @@ -576,9 +576,9 @@ } boolean isItemSelected(int index) { - Iterator itr = selected.iterator(); + Iterator itr = selected.iterator(); while (itr.hasNext()) { - Integer val = (Integer)itr.next(); + Integer val = itr.next(); if (val.intValue() == index) { return true; } --- old/src/solaris/classes/sun/awt/X11/MotifDnDDragSourceProtocol.java 2014-04-18 11:26:13.662825836 -0700 +++ new/src/solaris/classes/sun/awt/X11/MotifDnDDragSourceProtocol.java 2014-04-18 11:26:13.526159177 -0700 @@ -26,6 +26,7 @@ package sun.awt.X11; import java.awt.datatransfer.Transferable; +import java.awt.datatransfer.DataFlavor; import java.awt.dnd.DnDConstants; import java.awt.dnd.InvalidDnDOperationException; @@ -65,7 +66,7 @@ } protected void initializeDragImpl(int actions, Transferable contents, - Map formatMap, long[] formats) + Map formatMap, long[] formats) throws InvalidDnDOperationException, IllegalArgumentException, XException { --- old/src/solaris/classes/sun/awt/X11/Native.java 2014-04-18 11:26:14.506159131 -0700 +++ new/src/solaris/classes/sun/awt/X11/Native.java 2014-04-18 11:26:14.369492470 -0700 @@ -43,13 +43,12 @@ static int dataModel; static { - String dataModelProp = (String)AccessController. - doPrivileged( - new PrivilegedAction() { - public Object run() { - return System.getProperty("sun.arch.data.model"); - } - }); + String dataModelProp = AccessController.doPrivileged( + new PrivilegedAction() { + public String run() { + return System.getProperty("sun.arch.data.model"); + } + }); try { dataModel = Integer.parseInt(dataModelProp); } catch (Exception e) { @@ -333,9 +332,9 @@ * Stores Java Vector of Longs into memory. Memory location is treated as array * of native longs */ - static void putLong(long ptr, Vector arr) { + static void putLong(long ptr, Vector arr) { for (int i = 0; i < arr.size(); i ++, ptr += getLongSize()) { - putLong(ptr, ((Long)arr.elementAt(i)).longValue()); + putLong(ptr, arr.elementAt(i).longValue()); } } @@ -343,9 +342,9 @@ * Stores Java Vector of Longs into memory. Memory location is treated as array * of native longs. Array is stored in reverse order */ - static void putLongReverse(long ptr, Vector arr) { + static void putLongReverse(long ptr, Vector arr) { for (int i = arr.size()-1; i >= 0; i--, ptr += getLongSize()) { - putLong(ptr, ((Long)arr.elementAt(i)).longValue()); + putLong(ptr, arr.elementAt(i).longValue()); } } /** --- old/src/solaris/classes/sun/awt/X11/XAWTXSettings.java 2014-04-18 11:26:15.369492424 -0700 +++ new/src/solaris/classes/sun/awt/X11/XAWTXSettings.java 2014-04-18 11:26:15.232825763 -0700 @@ -98,7 +98,7 @@ * should be "good enough" for most cases. */ - Map updatedSettings = null; + Map updatedSettings = null; XToolkit.awtLock(); try { long display = XToolkit.getDisplay(); @@ -112,7 +112,7 @@ } private void updateXSettings(int screen, long owner) { - final Map updatedSettings = getUpdatedSettings(owner); + final Map updatedSettings = getUpdatedSettings(owner); // this method is called under awt lock and usually on toolkit thread // but parseXSettings() causes public code execution, so we need to transfer // this to EDT @@ -123,7 +123,7 @@ }); } - private Map getUpdatedSettings(final long owner) { + private Map getUpdatedSettings(final long owner) { if (log.isLoggable(PlatformLogger.Level.FINE)) { log.fine("owner =" + owner); } @@ -131,7 +131,7 @@ return null; } - Map settings = null; + Map settings = null; try { WindowPropertyGetter getter = new WindowPropertyGetter(owner, xSettingsPropertyAtom, 0, MAX_LENGTH, --- old/src/solaris/classes/sun/awt/X11/XAtomList.java 2014-04-18 11:26:16.336159045 -0700 +++ new/src/solaris/classes/sun/awt/X11/XAtomList.java 2014-04-18 11:26:16.199492385 -0700 @@ -157,7 +157,7 @@ public String toString() { StringBuffer buf = new StringBuffer(); buf.append("["); - Iterator iter = atoms.iterator(); + Iterator iter = atoms.iterator(); while (iter.hasNext()) { buf.append(iter.next().toString()); if (iter.hasNext()) { --- old/src/solaris/classes/sun/awt/X11/XAwtState.java 2014-04-18 11:26:17.159492340 -0700 +++ new/src/solaris/classes/sun/awt/X11/XAwtState.java 2014-04-18 11:26:17.022825679 -0700 @@ -40,7 +40,7 @@ * The mouse is over this component. * If the component is not disabled, it received MOUSE_ENTERED but no MOUSE_EXITED. */ - private static WeakReference componentMouseEnteredRef = null; + private static WeakReference componentMouseEnteredRef = null; static void setComponentMouseEntered(Component component) { XToolkit.awtLock(); @@ -50,7 +50,7 @@ return; } if (component != getComponentMouseEntered()) { - componentMouseEnteredRef = new WeakReference(component); + componentMouseEnteredRef = new WeakReference<>(component); } } finally { XToolkit.awtUnlock(); @@ -63,7 +63,7 @@ if (componentMouseEnteredRef == null) { return null; } - return (Component)componentMouseEnteredRef.get(); + return componentMouseEnteredRef.get(); } finally { XToolkit.awtUnlock(); } @@ -83,7 +83,7 @@ return inManualGrab; } - private static WeakReference grabWindowRef = null; + private static WeakReference grabWindowRef = null; /** * The X Active Grab overrides any other active grab by the same @@ -112,7 +112,7 @@ return; } if (grabWindow != getGrabWindow()) { - grabWindowRef = new WeakReference(grabWindow); + grabWindowRef = new WeakReference<>(grabWindow); } } finally { XToolkit.awtUnlock(); @@ -125,7 +125,7 @@ if (grabWindowRef == null) { return null; } - XBaseWindow xbw = (XBaseWindow)grabWindowRef.get(); + XBaseWindow xbw = grabWindowRef.get(); if( xbw != null && xbw.isDisposed() ) { xbw = null; grabWindowRef = null; --- old/src/solaris/classes/sun/awt/X11/XBaseMenuWindow.java 2014-04-18 11:26:17.992825633 -0700 +++ new/src/solaris/classes/sun/awt/X11/XBaseMenuWindow.java 2014-04-18 11:26:17.846158974 -0700 @@ -231,7 +231,7 @@ */ void instantPreInit(XCreateWindowParams params) { super.instantPreInit(params); - items = new ArrayList(); + items = new ArrayList<>(); } /************************************************ @@ -367,10 +367,10 @@ * Clears items vector and loads specified vector * @param items vector to be loaded */ - public void reloadItems(Vector items) { + public void reloadItems(Vector items) { synchronized(getMenuTreeLock()) { this.items.clear(); - MenuItem[] itemArray = (MenuItem[])items.toArray(new MenuItem[] {}); + MenuItem[] itemArray = items.toArray(new MenuItem[] {}); int itemCnt = itemArray.length; for(int i = 0; i < itemCnt; i++) { addItem(itemArray[i]); --- old/src/solaris/classes/sun/awt/X11/XComponentPeer.java 2014-04-18 11:26:18.892825592 -0700 +++ new/src/solaris/classes/sun/awt/X11/XComponentPeer.java 2014-04-18 11:26:18.749492265 -0700 @@ -236,8 +236,8 @@ return false; } - private static Class seClass; - private static Constructor seCtor; + private static Class seClass; + private static Constructor seCtor; final static AWTEvent wrapInSequenced(AWTEvent event) { try { @@ -246,9 +246,11 @@ } if (seCtor == null) { - seCtor = (Constructor) AccessController.doPrivileged(new PrivilegedExceptionAction() { - public Object run() throws Exception { - Constructor ctor = seClass.getConstructor(new Class[] { AWTEvent.class }); + seCtor = AccessController.doPrivileged(new + PrivilegedExceptionAction>() { + public Constructor run() throws Exception { + Constructor ctor = seClass.getConstructor( + new Class[] { AWTEvent.class }); ctor.setAccessible(true); return ctor; } @@ -1322,7 +1324,7 @@ } } - private void addTree(Collection order, Set set, Container cont) { + private void addTree(Collection order, Set set, Container cont) { for (int i = 0; i < cont.getComponentCount(); i++) { Component comp = cont.getComponent(i); ComponentPeer peer = comp.getPeer(); --- old/src/solaris/classes/sun/awt/X11/XCreateWindowParams.java 2014-04-18 11:26:19.789492216 -0700 +++ new/src/solaris/classes/sun/awt/X11/XCreateWindowParams.java 2014-04-18 11:26:19.642825556 -0700 @@ -30,7 +30,7 @@ import java.util.Map; @SuppressWarnings("serial") // JDK-implementation class -public class XCreateWindowParams extends HashMap { +public class XCreateWindowParams extends HashMap { public XCreateWindowParams() { } public XCreateWindowParams(Object[] map) { @@ -82,9 +82,9 @@ } public String toString() { StringBuffer buf = new StringBuffer(); - Iterator eIter = entrySet().iterator(); + Iterator> eIter = entrySet().iterator(); while (eIter.hasNext()) { - Map.Entry entry = (Map.Entry)eIter.next(); + Map.Entry entry = eIter.next(); buf.append(entry.getKey() + ": " + entry.getValue() + "\n"); } return buf.toString(); --- old/src/solaris/classes/sun/awt/X11/XDataTransferer.java 2014-04-18 11:26:20.679492175 -0700 +++ new/src/solaris/classes/sun/awt/X11/XDataTransferer.java 2014-04-18 11:26:20.522825515 -0700 @@ -48,6 +48,7 @@ import java.util.List; import javax.imageio.ImageIO; +import javax.imageio.ImageReader; import javax.imageio.ImageTypeSpecifier; import javax.imageio.ImageWriter; import javax.imageio.spi.ImageWriterSpi; @@ -354,7 +355,7 @@ // flavors to enable dynamic text native-to-flavor mapping generation. // See SystemFlavorMap.getFlavorsForNative() for details. if ("image".equals(primaryType)) { - Iterator readers = ImageIO.getImageReadersByMIMEType(baseType); + Iterator readers = ImageIO.getImageReadersByMIMEType(baseType); if (readers.hasNext()) { flavors.add(DataFlavor.imageFlavor); } --- old/src/solaris/classes/sun/awt/X11/XDnDDragSourceProtocol.java 2014-04-18 11:26:21.592825465 -0700 +++ new/src/solaris/classes/sun/awt/X11/XDnDDragSourceProtocol.java 2014-04-18 11:26:21.432825473 -0700 @@ -26,6 +26,7 @@ package sun.awt.X11; import java.awt.datatransfer.Transferable; +import java.awt.datatransfer.DataFlavor; import java.awt.dnd.DnDConstants; import java.awt.dnd.InvalidDnDOperationException; @@ -70,7 +71,7 @@ * @returns true if the initialized successfully. */ protected void initializeDragImpl(int actions, Transferable contents, - Map formatMap, long[] formats) + Map formatMap, long[] formats) throws InvalidDnDOperationException, IllegalArgumentException, XException { assert XToolkit.isAWTLockHeldByCurrentThread(); --- old/src/solaris/classes/sun/awt/X11/XDragAndDropProtocols.java 2014-04-18 11:26:22.496158756 -0700 +++ new/src/solaris/classes/sun/awt/X11/XDragAndDropProtocols.java 2014-04-18 11:26:22.336158764 -0700 @@ -36,8 +36,8 @@ * @since 1.5 */ final class XDragAndDropProtocols { - private final static List dragProtocols; - private final static List dropProtocols; + private final static List dragProtocols; + private final static List dropProtocols; public static final String XDnD = "XDnD"; public static final String MotifDnD = "MotifDnD"; @@ -50,7 +50,7 @@ XDropTargetProtocolListener dropTargetProtocolListener = XDropTargetContextPeer.getXDropTargetProtocolListener(); - List tDragSourceProtocols = new ArrayList(); + List tDragSourceProtocols = new ArrayList<>(); XDragSourceProtocol xdndDragSourceProtocol = XDnDDragSourceProtocol.createInstance(dragSourceProtocolListener); tDragSourceProtocols.add(xdndDragSourceProtocol); @@ -58,7 +58,7 @@ MotifDnDDragSourceProtocol.createInstance(dragSourceProtocolListener); tDragSourceProtocols.add(motifdndDragSourceProtocol); - List tDropTargetProtocols = new ArrayList(); + List tDropTargetProtocols = new ArrayList<>(); XDropTargetProtocol xdndDropTargetProtocol = XDnDDropTargetProtocol.createInstance(dropTargetProtocolListener); tDropTargetProtocols.add(xdndDropTargetProtocol); @@ -70,11 +70,11 @@ dropProtocols = Collections.unmodifiableList(tDropTargetProtocols); } - static Iterator getDragSourceProtocols() { + static Iterator getDragSourceProtocols() { return dragProtocols.iterator(); } - static Iterator getDropTargetProtocols() { + static Iterator getDropTargetProtocols() { return dropProtocols.iterator(); } @@ -88,10 +88,10 @@ return null; } - Iterator dragProtocols = XDragAndDropProtocols.getDragSourceProtocols(); + Iterator dragProtocols = + XDragAndDropProtocols.getDragSourceProtocols(); while (dragProtocols.hasNext()) { - XDragSourceProtocol dragProtocol = - (XDragSourceProtocol)dragProtocols.next(); + XDragSourceProtocol dragProtocol = dragProtocols.next(); if (dragProtocol.getProtocolName().equals(name)) { return dragProtocol; } @@ -110,10 +110,10 @@ return null; } - Iterator dropProtocols = XDragAndDropProtocols.getDropTargetProtocols(); + Iterator dropProtocols = + XDragAndDropProtocols.getDropTargetProtocols(); while (dropProtocols.hasNext()) { - XDropTargetProtocol dropProtocol = - (XDropTargetProtocol)dropProtocols.next(); + XDropTargetProtocol dropProtocol = dropProtocols.next(); if (dropProtocol.getProtocolName().equals(name)) { return dropProtocol; } --- old/src/solaris/classes/sun/awt/X11/XDragSourceContextPeer.java 2014-04-18 11:26:23.362825382 -0700 +++ new/src/solaris/classes/sun/awt/X11/XDragSourceContextPeer.java 2014-04-18 11:26:23.202825390 -0700 @@ -29,6 +29,7 @@ import java.awt.Cursor; import java.awt.Window; +import java.awt.datatransfer.DataFlavor; import java.awt.datatransfer.Transferable; import java.awt.dnd.DnDConstants; @@ -110,7 +111,7 @@ } protected void startDrag(Transferable transferable, - long[] formats, Map formatMap) { + long[] formats, Map formatMap) { Component component = getTrigger().getComponent(); Component c = null; XWindowPeer wpeer = null; @@ -161,9 +162,10 @@ int dropActions = getDragSourceContext().getSourceActions(); - Iterator dragProtocols = XDragAndDropProtocols.getDragSourceProtocols(); + Iterator dragProtocols = + XDragAndDropProtocols.getDragSourceProtocols(); while (dragProtocols.hasNext()) { - XDragSourceProtocol dragProtocol = (XDragSourceProtocol)dragProtocols.next(); + XDragSourceProtocol dragProtocol = dragProtocols.next(); try { dragProtocol.initializeDrag(dropActions, transferable, formatMap, formats); @@ -313,9 +315,10 @@ dragDropFinished(false, DnDConstants.ACTION_NONE, xRoot, yRoot); } - Iterator dragProtocols = XDragAndDropProtocols.getDragSourceProtocols(); + Iterator dragProtocols = + XDragAndDropProtocols.getDragSourceProtocols(); while (dragProtocols.hasNext()) { - XDragSourceProtocol dragProtocol = (XDragSourceProtocol)dragProtocols.next(); + XDragSourceProtocol dragProtocol = dragProtocols.next(); try { dragProtocol.cleanup(); } catch (XException xe) { @@ -418,9 +421,10 @@ } if (clientWindow != 0) { - Iterator dragProtocols = XDragAndDropProtocols.getDragSourceProtocols(); + Iterator dragProtocols = + XDragAndDropProtocols.getDragSourceProtocols(); while (dragProtocols.hasNext()) { - XDragSourceProtocol dragProtocol = (XDragSourceProtocol)dragProtocols.next(); + XDragSourceProtocol dragProtocol = dragProtocols.next(); if (dragProtocol.attachTargetWindow(clientWindow, time)) { protocol = dragProtocol; break; @@ -550,10 +554,10 @@ XClientMessageEvent xclient = ev.get_xclient(); - Iterator dragProtocols = XDragAndDropProtocols.getDragSourceProtocols(); + Iterator dragProtocols = + XDragAndDropProtocols.getDragSourceProtocols(); while (dragProtocols.hasNext()) { - XDragSourceProtocol dragProtocol = - (XDragSourceProtocol)dragProtocols.next(); + XDragSourceProtocol dragProtocol = dragProtocols.next(); if (dragProtocol.processProxyModeEvent(xclient, getProxyModeSourceWindow())) { return true; --- old/src/solaris/classes/sun/awt/X11/XDragSourceProtocol.java 2014-04-18 11:26:24.256158674 -0700 +++ new/src/solaris/classes/sun/awt/X11/XDragSourceProtocol.java 2014-04-18 11:26:24.112825346 -0700 @@ -26,6 +26,7 @@ package sun.awt.X11; import java.awt.datatransfer.Transferable; +import java.awt.datatransfer.DataFlavor; import java.awt.dnd.DnDConstants; import java.awt.dnd.InvalidDnDOperationException; @@ -84,7 +85,7 @@ * @throws XException if some X call failed. */ public final void initializeDrag(int actions, Transferable contents, - Map formatMap, long[] formats) + Map formatMap, long[] formats) throws InvalidDnDOperationException, IllegalArgumentException, XException { XToolkit.awtLock(); @@ -110,7 +111,8 @@ /* The caller must hold AWT_LOCK. */ protected abstract void initializeDragImpl(int actions, Transferable contents, - Map formatMap, long[] formats) + Map formatMap, + long[] formats) throws InvalidDnDOperationException, IllegalArgumentException, XException; /** --- old/src/solaris/classes/sun/awt/X11/XDropTargetContextPeer.java 2014-04-18 11:26:25.119491967 -0700 +++ new/src/solaris/classes/sun/awt/X11/XDropTargetContextPeer.java 2014-04-18 11:26:24.976158640 -0700 @@ -89,12 +89,12 @@ /* If the event was not consumed, send a response to the source. */ try { if (ctxt != 0 && !e.isConsumed()) { - Iterator dropTargetProtocols = + Iterator dropTargetProtocols = XDragAndDropProtocols.getDropTargetProtocols(); while (dropTargetProtocols.hasNext()) { XDropTargetProtocol dropTargetProtocol = - (XDropTargetProtocol)dropTargetProtocols.next(); + dropTargetProtocols.next(); if (dropTargetProtocol.sendResponse(ctxt, e.getID(), returnValue)) { break; @@ -116,12 +116,12 @@ if (ctxt != 0) { try { - Iterator dropTargetProtocols = + Iterator dropTargetProtocols = XDragAndDropProtocols.getDropTargetProtocols(); while (dropTargetProtocols.hasNext()) { XDropTargetProtocol dropTargetProtocol = - (XDropTargetProtocol)dropTargetProtocols.next(); + dropTargetProtocols.next(); if (dropTargetProtocol.sendDropDone(ctxt, success, dropAction)) { break; @@ -140,12 +140,12 @@ long ctxt = getNativeDragContext(); if (ctxt != 0) { - Iterator dropTargetProtocols = + Iterator dropTargetProtocols = XDragAndDropProtocols.getDropTargetProtocols(); while (dropTargetProtocols.hasNext()) { XDropTargetProtocol dropTargetProtocol = - (XDropTargetProtocol)dropTargetProtocols.next(); + dropTargetProtocols.next(); // getData throws IAE if ctxt is not for this protocol. try { return dropTargetProtocol.getData(ctxt, format); @@ -221,12 +221,11 @@ public void forwardEventToEmbedded(long embedded, long ctxt, int eventID) { - Iterator dropTargetProtocols = + Iterator dropTargetProtocols = XDragAndDropProtocols.getDropTargetProtocols(); while (dropTargetProtocols.hasNext()) { - XDropTargetProtocol dropTargetProtocol = - (XDropTargetProtocol)dropTargetProtocols.next(); + XDropTargetProtocol dropTargetProtocol = dropTargetProtocols.next(); if (dropTargetProtocol.forwardEventToEmbedded(embedded, ctxt, eventID)) { break; --- old/src/solaris/classes/sun/awt/X11/XDropTargetEventProcessor.java 2014-04-18 11:26:25.982825259 -0700 +++ new/src/solaris/classes/sun/awt/X11/XDropTargetEventProcessor.java 2014-04-18 11:26:25.839491933 -0700 @@ -79,12 +79,11 @@ } if (protocol == null) { - Iterator dropTargetProtocols = + Iterator dropTargetProtocols = XDragAndDropProtocols.getDropTargetProtocols(); while (dropTargetProtocols.hasNext()) { - XDropTargetProtocol dropTargetProtocol = - (XDropTargetProtocol)dropTargetProtocols.next(); + XDropTargetProtocol dropTargetProtocol = dropTargetProtocols.next(); // Don't try to process it again with the current protocol. if (dropTargetProtocol == curProtocol) { continue; --- old/src/solaris/classes/sun/awt/X11/XDropTargetProtocol.java 2014-04-18 11:26:26.866158551 -0700 +++ new/src/solaris/classes/sun/awt/X11/XDropTargetProtocol.java 2014-04-18 11:26:26.716158558 -0700 @@ -295,7 +295,8 @@ } /* Access to HashMap is synchronized on this XDropTargetProtocol instance. */ - private final HashMap embedderRegistry = new HashMap(); + private final HashMap embedderRegistry = + new HashMap<>(); protected final void putEmbedderRegistryEntry(long embedder, boolean overriden, @@ -310,8 +311,7 @@ protected final EmbedderRegistryEntry getEmbedderRegistryEntry(long embedder) { synchronized (this) { - return - (EmbedderRegistryEntry)embedderRegistry.get(Long.valueOf(embedder)); + return embedderRegistry.get(Long.valueOf(embedder)); } } --- old/src/solaris/classes/sun/awt/X11/XDropTargetRegistry.java 2014-04-18 11:26:27.736158511 -0700 +++ new/src/solaris/classes/sun/awt/X11/XDropTargetRegistry.java 2014-04-18 11:26:27.592825184 -0700 @@ -141,10 +141,10 @@ } public long[] getSites() { long[] ret = new long[sites.size()]; - Iterator iter = sites.iterator(); + Iterator iter = sites.iterator(); int index = 0; while (iter.hasNext()) { - Long l = (Long)iter.next(); + Long l = iter.next(); ret[index++] = l.longValue(); } return ret; @@ -199,14 +199,13 @@ private EmbeddedDropSiteEntry registerEmbedderDropSite(long embedder) { assert XToolkit.isAWTLockHeldByCurrentThread(); - Iterator dropTargetProtocols = + Iterator dropTargetProtocols = XDragAndDropProtocols.getDropTargetProtocols(); // The list of protocols supported by the embedder. - List embedderProtocols = new ArrayList(); + List embedderProtocols = new ArrayList<>(); while (dropTargetProtocols.hasNext()) { - XDropTargetProtocol dropTargetProtocol = - (XDropTargetProtocol)dropTargetProtocols.next(); + XDropTargetProtocol dropTargetProtocol = dropTargetProtocols.next(); if (dropTargetProtocol.isProtocolSupported(embedder)) { embedderProtocols.add(dropTargetProtocol); } @@ -262,7 +261,7 @@ private void registerProtocols(long embedder, boolean protocols, List supportedProtocols) { - Iterator dropTargetProtocols = null; + Iterator dropTargetProtocols = null; /* * By default, we register a drop site that supports all dnd @@ -289,8 +288,7 @@ XlibWrapper.XGrabServer(XToolkit.getDisplay()); try { while (dropTargetProtocols.hasNext()) { - XDropTargetProtocol dropTargetProtocol = - (XDropTargetProtocol)dropTargetProtocols.next(); + XDropTargetProtocol dropTargetProtocol = dropTargetProtocols.next(); if ((protocols == XEMBED_PROTOCOLS) == dropTargetProtocol.isXEmbedSupported()) { dropTargetProtocol.registerEmbedderDropSite(embedder); @@ -310,14 +308,13 @@ assert XToolkit.isAWTLockHeldByCurrentThread(); - Iterator dropTargetProtocols = + Iterator dropTargetProtocols = XDragAndDropProtocols.getDropTargetProtocols(); // The list of protocols supported by the embedder. - List embedderProtocols = new ArrayList(); + List embedderProtocols = new ArrayList<>(); while (dropTargetProtocols.hasNext()) { - XDropTargetProtocol dropTargetProtocol = - (XDropTargetProtocol)dropTargetProtocols.next(); + XDropTargetProtocol dropTargetProtocol = dropTargetProtocols.next(); if (dropTargetProtocol.isProtocolSupported(embedder)) { embedderProtocols.add(dropTargetProtocol); } @@ -361,8 +358,7 @@ XlibWrapper.XGrabServer(XToolkit.getDisplay()); try { while (dropTargetProtocols.hasNext()) { - XDropTargetProtocol dropTargetProtocol = - (XDropTargetProtocol)dropTargetProtocols.next(); + XDropTargetProtocol dropTargetProtocol = dropTargetProtocols.next(); if (!isXEmbedServer || !dropTargetProtocol.isXEmbedSupported()) { dropTargetProtocol.registerEmbedderDropSite(embedder); } @@ -376,7 +372,7 @@ EmbeddedDropSiteEntry entry) { assert XToolkit.isAWTLockHeldByCurrentThread(); - Iterator dropTargetProtocols = + Iterator dropTargetProtocols = XDragAndDropProtocols.getDropTargetProtocols(); /* Grab server, since we are working with the window that belongs to @@ -384,8 +380,7 @@ XlibWrapper.XGrabServer(XToolkit.getDisplay()); try { while (dropTargetProtocols.hasNext()) { - XDropTargetProtocol dropTargetProtocol = - (XDropTargetProtocol)dropTargetProtocols.next(); + XDropTargetProtocol dropTargetProtocol = dropTargetProtocols.next(); dropTargetProtocol.unregisterEmbedderDropSite(embedder); } @@ -470,14 +465,14 @@ registerProtocols(toplevel, XEMBED_PROTOCOLS, entry.getSupportedProtocols()); } else { - Iterator dropTargetProtocols = + Iterator dropTargetProtocols = XDragAndDropProtocols.getDropTargetProtocols(); // Register the embedded window as a plain drop site with // all DnD protocols that are supported by XEmbed. while (dropTargetProtocols.hasNext()) { XDropTargetProtocol dropTargetProtocol = - (XDropTargetProtocol)dropTargetProtocols.next(); + dropTargetProtocols.next(); if (dropTargetProtocol.isXEmbedSupported()) { dropTargetProtocol.registerEmbedderDropSite(window); } @@ -558,12 +553,12 @@ } if (toplevel == window) { - Iterator dropTargetProtocols = + Iterator dropTargetProtocols = XDragAndDropProtocols.getDropTargetProtocols(); while (dropTargetProtocols.hasNext()) { XDropTargetProtocol dropTargetProtocol = - (XDropTargetProtocol)dropTargetProtocols.next(); + dropTargetProtocols.next(); dropTargetProtocol.registerDropTarget(toplevel); } } else { @@ -584,13 +579,13 @@ long toplevel = getToplevelWindow(window); if (toplevel == window) { - Iterator dropProtocols = + Iterator dropProtocols = XDragAndDropProtocols.getDropTargetProtocols(); removeDelayedRegistrationEntry(window); while (dropProtocols.hasNext()) { - XDropTargetProtocol dropProtocol = (XDropTargetProtocol)dropProtocols.next(); + XDropTargetProtocol dropProtocol = dropProtocols.next(); dropProtocol.unregisterDropTarget(window); } } else { @@ -615,12 +610,11 @@ } registerEmbeddedDropSite(canvasWindow, clientWindow); - Iterator dropTargetProtocols = + Iterator dropTargetProtocols = XDragAndDropProtocols.getDropTargetProtocols(); while (dropTargetProtocols.hasNext()) { - XDropTargetProtocol dropTargetProtocol = - (XDropTargetProtocol)dropTargetProtocols.next(); + XDropTargetProtocol dropTargetProtocol = dropTargetProtocols.next(); dropTargetProtocol.registerEmbeddedDropSite(clientWindow); } @@ -634,12 +628,11 @@ if (logger.isLoggable(PlatformLogger.Level.FINE)) { logger.fine(" XEmbed drop site will be unregistered for " + Long.toHexString(clientWindow)); } - Iterator dropTargetProtocols = + Iterator dropTargetProtocols = XDragAndDropProtocols.getDropTargetProtocols(); while (dropTargetProtocols.hasNext()) { - XDropTargetProtocol dropTargetProtocol = - (XDropTargetProtocol)dropTargetProtocols.next(); + XDropTargetProtocol dropTargetProtocol = dropTargetProtocols.next(); dropTargetProtocol.unregisterEmbeddedDropSite(clientWindow); } --- old/src/solaris/classes/sun/awt/X11/XEmbeddingContainer.java 2014-04-18 11:26:28.639491802 -0700 +++ new/src/solaris/classes/sun/awt/X11/XEmbeddingContainer.java 2014-04-18 11:26:28.496158475 -0700 @@ -32,7 +32,7 @@ import sun.awt.AWTAccessor; public class XEmbeddingContainer extends XEmbedHelper implements XEventDispatcher { - HashMap children = new HashMap(); + HashMap children = new HashMap<>(); XEmbeddingContainer() { } --- old/src/solaris/classes/sun/awt/X11/XFileDialogPeer.java 2014-04-18 11:26:29.502825094 -0700 +++ new/src/solaris/classes/sun/awt/X11/XFileDialogPeer.java 2014-04-18 11:26:29.359491768 -0700 @@ -146,9 +146,9 @@ savedDir = target.getDirectory(); // Shouldn't save 'user.dir' to 'savedDir' // since getDirectory() will be incorrect after handleCancel - userDir = (String)AccessController.doPrivileged( - new PrivilegedAction() { - public Object run() { + userDir = AccessController.doPrivileged( + new PrivilegedAction() { + public String run() { return System.getProperty("user.dir"); } }); --- old/src/solaris/classes/sun/awt/X11/XListPeer.java 2014-04-18 11:26:30.392825053 -0700 +++ new/src/solaris/classes/sun/awt/X11/XListPeer.java 2014-04-18 11:26:30.249491726 -0700 @@ -70,7 +70,7 @@ ListPainter painter; // TODO: ick - Vector? - Vector items; + Vector items; boolean multipleSelections; int active = NONE; @@ -139,7 +139,7 @@ super.preInit(params); // Stuff that must be initialized before layout() is called - items = new Vector(); + items = new Vector<>(); createVerScrollbar(); createHorScrollbar(); @@ -281,7 +281,7 @@ int m = 0; int end = items.size(); for(int i = 0 ; i < end ; i++) { - int l = fm.stringWidth(((String)items.elementAt(i))); + int l = fm.stringWidth(items.elementAt(i)); m = Math.max(m, l); } return m; @@ -292,7 +292,7 @@ */ int getItemWidth(int i) { FontMetrics fm = getFontMetrics(getFont()); - return fm.stringWidth((String)items.elementAt(i)); + return fm.stringWidth(items.elementAt(i)); } /** @@ -659,7 +659,7 @@ ( clickCount % 2 == 0 ) ) { postEvent(new ActionEvent(target, ActionEvent.ACTION_PERFORMED, - (String)items.elementAt(currentIndex), + items.elementAt(currentIndex), mouseEvent.getWhen(), mouseEvent.getModifiers())); // No ext mods } else if (active == WINDOW) { @@ -986,7 +986,7 @@ if (selected.length > 0) { postEvent(new ActionEvent((List)target, ActionEvent.ACTION_PERFORMED, - (String)items.elementAt(getFocusIndex()), + items.elementAt(getFocusIndex()), e.getWhen(), e.getModifiers())); // ActionEvent doesn't have // extended modifiers. @@ -1343,7 +1343,7 @@ */ public void clear() { selected = new int[0]; - items = new Vector(); + items = new Vector<>(); currentIndex = -1; // Fixed 6291736: ITEM_STATE_CHANGED triggered after List.removeAll(), XToolkit // We should update 'focusIndex' variable more carefully @@ -1926,7 +1926,7 @@ } else { g.setColor(getListForeground()); } - String str = (String)items.elementAt(index); + String str = items.elementAt(index); g.drawString(str, x - hsb.getValue(), y + fontAscent); } else { // Clear the remaining area around the item - focus area and the rest of border --- old/src/solaris/classes/sun/awt/X11/XMSelection.java 2014-04-18 11:26:31.319491675 -0700 +++ new/src/solaris/classes/sun/awt/X11/XMSelection.java 2014-04-18 11:26:31.176158349 -0700 @@ -60,7 +60,7 @@ String selectionName; /* list of listeners to be called for events */ - Vector listeners; + Vector listeners; /* X atom array (one per screen) for this selection */ XAtom atoms[]; @@ -75,7 +75,7 @@ static XAtom XA_MANAGER; - static HashMap selectionMap; + static HashMap selectionMap; static { long display = XToolkit.getDisplay(); @@ -90,7 +90,7 @@ initScreen(display,screen); } - selectionMap = new HashMap(); + selectionMap = new HashMap<>(); } static void initScreen(long display, final int screen) { @@ -227,7 +227,7 @@ static XMSelection getInstance(long selection) { - return (XMSelection) selectionMap.get(Long.valueOf(selection)); + return selectionMap.get(Long.valueOf(selection)); } @@ -259,7 +259,7 @@ public synchronized void addSelectionListener(XMSelectionListener listener) { if (listeners == null) { - listeners = new Vector(); + listeners = new Vector<>(); } listeners.add(listener); } @@ -270,7 +270,7 @@ } } - synchronized Collection getListeners() { + synchronized Collection getListeners() { return listeners; } @@ -310,9 +310,9 @@ log.fine("Selection Changed : Screen = " + screen + "Event =" + ev); } if (listeners != null) { - Iterator iter = listeners.iterator(); + Iterator iter = listeners.iterator(); while (iter.hasNext()) { - XMSelectionListener disp = (XMSelectionListener) iter.next(); + XMSelectionListener disp = iter.next(); disp.selectionChanged(screen, this, ev.get_window(), ev); } } @@ -323,9 +323,9 @@ log.fine("Owner dead : Screen = " + screen + "Event =" + de); } if (listeners != null) { - Iterator iter = listeners.iterator(); + Iterator iter = listeners.iterator(); while (iter.hasNext()) { - XMSelectionListener disp = (XMSelectionListener) iter.next(); + XMSelectionListener disp = iter.next(); disp.ownerDeath(screen, this, de.get_window()); } @@ -349,9 +349,9 @@ synchronized void dispatchOwnerChangedEvent(XEvent ev, int screen, long owner, long data, long timestamp) { if (listeners != null) { - Iterator iter = listeners.iterator(); + Iterator iter = listeners.iterator(); while (iter.hasNext()) { - XMSelectionListener disp = (XMSelectionListener) iter.next(); + XMSelectionListener disp = iter.next(); disp.ownerChanged(screen,this, owner, data, timestamp); } } --- old/src/solaris/classes/sun/awt/X11/XMenuBarPeer.java 2014-04-18 11:26:32.166158302 -0700 +++ new/src/solaris/classes/sun/awt/X11/XMenuBarPeer.java 2014-04-18 11:26:32.019491643 -0700 @@ -195,10 +195,10 @@ void postInit(XCreateWindowParams params) { super.postInit(params); // Get menus from the target. - Vector targetMenuVector = AWTAccessor.getMenuBarAccessor() - .getMenus(menuBarTarget); + Vector targetMenuVector = AWTAccessor.getMenuBarAccessor() + .getMenus(menuBarTarget); Menu targetHelpMenu = AWTAccessor.getMenuBarAccessor() - .getHelpMenu(menuBarTarget); + .getHelpMenu(menuBarTarget); reloadItems(targetMenuVector); if (targetHelpMenu != null) { addHelpMenu(targetHelpMenu); --- old/src/solaris/classes/sun/awt/X11/XMenuPeer.java 2014-04-18 11:26:33.069491593 -0700 +++ new/src/solaris/classes/sun/awt/X11/XMenuPeer.java 2014-04-18 11:26:32.926158266 -0700 @@ -143,7 +143,7 @@ * Access to target's fields * ************************************************/ - Vector getTargetItems() { + Vector getTargetItems() { return AWTAccessor.getMenuAccessor().getItems((Menu)getTarget()); } --- old/src/solaris/classes/sun/awt/X11/XMenuWindow.java 2014-04-18 11:26:33.936158219 -0700 +++ new/src/solaris/classes/sun/awt/X11/XMenuWindow.java 2014-04-18 11:26:33.776158227 -0700 @@ -164,7 +164,7 @@ this.menuPeer = menuPeer; this.target = menuPeer.getContainer().target; // Get menus from the target. - Vector targetItemVector = null; + Vector targetItemVector = null; targetItemVector = getMenuTargetItems(); reloadItems(targetItemVector); } @@ -356,7 +356,7 @@ * Reads vector of items from target * This function is overriden in XPopupMenuPeer */ - Vector getMenuTargetItems() { + Vector getMenuTargetItems() { return menuPeer.getTargetItems(); } --- old/src/solaris/classes/sun/awt/X11/XPopupMenuPeer.java 2014-04-18 11:26:34.799491513 -0700 +++ new/src/solaris/classes/sun/awt/X11/XPopupMenuPeer.java 2014-04-18 11:26:34.656158185 -0700 @@ -134,7 +134,7 @@ public void show(Event e) { target = (Component)e.target; // Get menus from the target. - Vector targetItemVector = getMenuTargetItems(); + Vector targetItemVector = getMenuTargetItems(); if (targetItemVector != null) { reloadItems(targetItemVector); //Fix for 6287092: JCK15a: api/java_awt/interactive/event/EventTests.html#EventTest0015 fails, mustang @@ -188,7 +188,7 @@ return AWTAccessor.getMenuItemAccessor().isEnabled(popupMenuTarget); } - Vector getMenuTargetItems() { + Vector getMenuTargetItems() { if (popupMenuTarget == null) { return null; } --- old/src/solaris/classes/sun/awt/X11/XSelection.java 2014-04-18 11:26:35.689491470 -0700 +++ new/src/solaris/classes/sun/awt/X11/XSelection.java 2014-04-18 11:26:35.546158144 -0700 @@ -25,6 +25,7 @@ package sun.awt.X11; +import java.awt.datatransfer.DataFlavor; import java.awt.datatransfer.Transferable; import java.io.ByteArrayOutputStream; @@ -87,7 +88,7 @@ /* The contents supplied by the current owner. */ private Transferable contents = null; /* The format-to-flavor map for the current owner. */ - private Map formatMap = null; + private Map formatMap = null; /* The formats supported by the current owner was set. */ private long[] formats = null; /* The AppContext in which the current owner was set. */ @@ -134,7 +135,8 @@ return selectionAtom; } - public synchronized boolean setOwner(Transferable contents, Map formatMap, + public synchronized boolean setOwner(Transferable contents, + Map formatMap, long[] formats, long time) { long owner = XWindow.getXAWTRootWindow().getWindow(); --- old/src/solaris/classes/sun/awt/X11/XToolkit.java 2014-04-18 11:26:36.599491428 -0700 +++ new/src/solaris/classes/sun/awt/X11/XToolkit.java 2014-04-18 11:26:36.439491436 -0700 @@ -36,6 +36,7 @@ import java.awt.dnd.MouseDragGestureRecognizer; import java.awt.dnd.InvalidDnDOperationException; import java.awt.dnd.peer.DragSourceContextPeer; +import java.awt.font.TextAttribute; import java.awt.im.InputMethodHighlight; import java.awt.im.spi.InputMethodDescriptor; import java.awt.image.ColorModel; @@ -99,9 +100,9 @@ private FontConfigManager fcManager = new FontConfigManager(); static int arrowCursor; - static TreeMap winMap = new TreeMap(); - static HashMap specialPeerMap = new HashMap(); - static HashMap winToDispatcher = new HashMap(); + static TreeMap winMap = new TreeMap<>(); + static HashMap specialPeerMap = new HashMap<>(); + static HashMap> winToDispatcher = new HashMap<>(); private static long _display; static UIDefaults uidefaults; static X11GraphicsEnvironment localEnv; @@ -358,16 +359,16 @@ } static XBaseWindow windowToXWindow(long window) { synchronized(winMap) { - return (XBaseWindow) winMap.get(Long.valueOf(window)); + return winMap.get(Long.valueOf(window)); } } static void addEventDispatcher(long window, XEventDispatcher dispatcher) { synchronized(winToDispatcher) { Long key = Long.valueOf(window); - Collection dispatchers = (Collection)winToDispatcher.get(key); + Collection dispatchers = winToDispatcher.get(key); if (dispatchers == null) { - dispatchers = new Vector(); + dispatchers = new Vector<>(); winToDispatcher.put(key, dispatchers); } dispatchers.add(dispatcher); @@ -376,7 +377,7 @@ static void removeEventDispatcher(long window, XEventDispatcher dispatcher) { synchronized(winToDispatcher) { Long key = Long.valueOf(window); - Collection dispatchers = (Collection)winToDispatcher.get(key); + Collection dispatchers = winToDispatcher.get(key); if (dispatchers != null) { dispatchers.remove(dispatcher); } @@ -493,18 +494,18 @@ } XBaseWindow.dispatchToWindow(ev); - Collection dispatchers = null; + Collection dispatchers = null; synchronized(winToDispatcher) { Long key = Long.valueOf(xany.get_window()); - dispatchers = (Collection)winToDispatcher.get(key); + dispatchers = winToDispatcher.get(key); if (dispatchers != null) { // Clone it to avoid synchronization during dispatching - dispatchers = new Vector(dispatchers); + dispatchers = new Vector<>(dispatchers); } } if (dispatchers != null) { - Iterator iter = dispatchers.iterator(); + Iterator iter = dispatchers.iterator(); while (iter.hasNext()) { - XEventDispatcher disp = (XEventDispatcher)iter.next(); + XEventDispatcher disp = iter.next(); disp.dispatchEvent(ev); } } @@ -764,7 +765,7 @@ Insets insets = new Insets(0, 0, 0, 0); - java.util.List search = new LinkedList(); + java.util.List search = new LinkedList<>(); search.add(root); search.add(0); while (!search.isEmpty()) @@ -929,6 +930,7 @@ return XDragSourceContextPeer.createDragSourceContextPeer(dge); } + @SuppressWarnings("unchecked") public T createDragGestureRecognizer(Class recognizerClass, DragSource ds, @@ -1147,7 +1149,7 @@ return 2; // Black and white. } - public Map mapInputMethodHighlight(InputMethodHighlight highlight) { + public Map mapInputMethodHighlight( InputMethodHighlight highlight) { return XInputMethod.mapInputMethodHighlight(highlight); } @Override @@ -1338,31 +1340,25 @@ static void dumpPeers() { if (log.isLoggable(PlatformLogger.Level.FINE)) { log.fine("Mapped windows:"); - Iterator iter = winMap.entrySet().iterator(); - while (iter.hasNext()) { - Map.Entry entry = (Map.Entry)iter.next(); - log.fine(entry.getKey() + "->" + entry.getValue()); - if (entry.getValue() instanceof XComponentPeer) { - Component target = (Component)((XComponentPeer)entry.getValue()).getTarget(); + winMap.forEach((k, v) -> { + log.fine(k + "->" + v); + if (v instanceof XComponentPeer) { + Component target = (Component)((XComponentPeer)v).getTarget(); log.fine("\ttarget: " + target); } - } + }); SunToolkit.dumpPeers(log); log.fine("Mapped special peers:"); - iter = specialPeerMap.entrySet().iterator(); - while (iter.hasNext()) { - Map.Entry entry = (Map.Entry)iter.next(); - log.fine(entry.getKey() + "->" + entry.getValue()); - } + specialPeerMap.forEach((k, v) -> { + log.fine(k + "->" + v); + }); log.fine("Mapped dispatchers:"); - iter = winToDispatcher.entrySet().iterator(); - while (iter.hasNext()) { - Map.Entry entry = (Map.Entry)iter.next(); - log.fine(entry.getKey() + "->" + entry.getValue()); - } + winToDispatcher.forEach((k, v) -> { + log.fine(k + "->" + v); + }); } } @@ -1586,16 +1582,16 @@ * loadXSettings. It is called from the System EDT * if triggered by an XSETTINGS change. */ - void parseXSettings(int screen_XXX_ignored,Map updatedSettings) { + void parseXSettings(int screen_XXX_ignored,Map updatedSettings) { if (updatedSettings == null || updatedSettings.isEmpty()) { return; } - Iterator i = updatedSettings.entrySet().iterator(); + Iterator> i = updatedSettings.entrySet().iterator(); while (i.hasNext()) { - Map.Entry e = (Map.Entry)i.next(); - String name = (String)e.getKey(); + Map.Entry e = i.next(); + String name = e.getKey(); name = "gnome." + name; setDesktopProperty(name, e.getValue()); @@ -1692,7 +1688,7 @@ long window = 0; try{ // get any application window - window = ((Long)(winMap.firstKey())).longValue(); + window = winMap.firstKey().longValue(); }catch(NoSuchElementException nex) { // get root window window = getDefaultRootWindow(); @@ -1798,7 +1794,7 @@ } - private static SortedMap timeoutTasks; + private static SortedMap> timeoutTasks; /** * Removed the task from the list of waiting-to-be called tasks. @@ -1819,10 +1815,10 @@ } return; } - Collection values = timeoutTasks.values(); - Iterator iter = values.iterator(); + Collection> values = timeoutTasks.values(); + Iterator> iter = values.iterator(); while (iter.hasNext()) { - java.util.List list = (java.util.List)iter.next(); + java.util.List list = iter.next(); boolean removed = false; if (list.contains(task)) { list.remove(task); @@ -1869,13 +1865,13 @@ } if (timeoutTasks == null) { - timeoutTasks = new TreeMap(); + timeoutTasks = new TreeMap<>(); } Long time = Long.valueOf(System.currentTimeMillis() + interval); - java.util.List tasks = (java.util.List)timeoutTasks.get(time); + java.util.List tasks = timeoutTasks.get(time); if (tasks == null) { - tasks = new ArrayList(1); + tasks = new ArrayList<>(1); timeoutTasks.put(time, tasks); } tasks.add(task); @@ -1897,7 +1893,7 @@ if (timeoutTasks == null || timeoutTasks.isEmpty()) { return -1L; } - return (Long)timeoutTasks.firstKey(); + return timeoutTasks.firstKey(); } finally { awtUnlock(); } @@ -1918,13 +1914,13 @@ } Long currentTime = Long.valueOf(System.currentTimeMillis()); - Long time = (Long)timeoutTasks.firstKey(); + Long time = timeoutTasks.firstKey(); while (time.compareTo(currentTime) <= 0) { - java.util.List tasks = (java.util.List)timeoutTasks.remove(time); + java.util.List tasks = timeoutTasks.remove(time); - for (Iterator iter = tasks.iterator(); iter.hasNext();) { - Runnable task = (Runnable)iter.next(); + for (Iterator iter = tasks.iterator(); iter.hasNext();) { + Runnable task = iter.next(); if (timeoutTaskLog.isLoggable(PlatformLogger.Level.FINER)) { timeoutTaskLog.finer("XToolkit.callTimeoutTasks(): current time={0}" + @@ -1943,7 +1939,7 @@ if (timeoutTasks.isEmpty()) { break; } - time = (Long)timeoutTasks.firstKey(); + time = timeoutTasks.firstKey(); } } --- old/src/solaris/classes/sun/awt/X11/XTrayIconPeer.java 2014-04-18 11:26:37.609491381 -0700 +++ new/src/solaris/classes/sun/awt/X11/XTrayIconPeer.java 2014-04-18 11:26:37.452824721 -0700 @@ -85,7 +85,7 @@ // Fix for 6317038: as EmbeddedFrame is instance of Frame, it is blocked // by modal dialogs, but in the case of TrayIcon it shouldn't. So we // set ModalExclusion property on it. - AccessController.doPrivileged(new PrivilegedAction() { + AccessController.doPrivileged(new PrivilegedAction() { public Object run() { eframe.setModalExclusionType(Dialog.ModalExclusionType.TOOLKIT_EXCLUDE); return null; --- old/src/solaris/classes/sun/awt/X11/XWM.java 2014-04-18 11:26:38.482824673 -0700 +++ new/src/solaris/classes/sun/awt/X11/XWM.java 2014-04-18 11:26:38.326158013 -0700 @@ -1072,6 +1072,7 @@ * Returns all protocols supporting given protocol interface */ Collection getProtocols(Class protocolInterface) { + @SuppressWarnings("unchecked") Collection res = (Collection) protocolsMap.get(protocolInterface); if (res != null) { return res; @@ -1322,9 +1323,9 @@ } } - HashMap storedInsets = new HashMap(); + HashMap, Insets> storedInsets = new HashMap<>(); Insets guessInsets(XDecoratedPeer window) { - Insets res = (Insets)storedInsets.get(window.getClass()); + Insets res = storedInsets.get(window.getClass()); if (res == null) { switch (WMID) { case ENLIGHTEN_WM: --- old/src/solaris/classes/sun/awt/X11/XWindow.java 2014-04-18 11:26:39.392824630 -0700 +++ new/src/solaris/classes/sun/awt/X11/XWindow.java 2014-04-18 11:26:39.246157970 -0700 @@ -59,7 +59,7 @@ static int lastX = 0, lastY = 0; static long lastTime = 0; static long lastButton = 0; - static WeakReference lastWindowRef = null; + static WeakReference lastWindowRef = null; static int clickCount = 0; // used to check if we need to re-create surfaceData. @@ -692,7 +692,7 @@ if (type == XConstants.ButtonPress) { //Allow this mouse button to generate CLICK event on next ButtonRelease mouseButtonClickAllowed |= XlibUtil.getButtonMask(lbutton); - XWindow lastWindow = (lastWindowRef != null) ? ((XWindow)lastWindowRef.get()):(null); + XWindow lastWindow = (lastWindowRef != null) ? (lastWindowRef.get()):(null); /* multiclick checking */ @@ -705,7 +705,7 @@ clickCount++; } else { clickCount = 1; - lastWindowRef = new WeakReference(this); + lastWindowRef = new WeakReference<>(this); lastButton = lbutton; lastX = x; lastY = y; @@ -820,7 +820,7 @@ */ int x = xme.get_x(); int y = xme.get_y(); - XWindow lastWindow = (lastWindowRef != null) ? ((XWindow)lastWindowRef.get()):(null); + XWindow lastWindow = (lastWindowRef != null) ? (lastWindowRef.get()):(null); if (!(lastWindow == this && (xme.get_time() - lastTime) < XToolkit.getMultiClickTime() && --- old/src/solaris/classes/sun/awt/X11/XWindowPeer.java 2014-04-18 11:26:40.336157919 -0700 +++ new/src/solaris/classes/sun/awt/X11/XWindowPeer.java 2014-04-18 11:26:40.176157927 -0700 @@ -950,7 +950,7 @@ // make new hash of toplevels of all windows from 'windows' hash. // FIXME: do not call them "toplevel" as it is misleading. // - HashSet toplevels = new HashSet(); + HashSet toplevels = new HashSet<>(); long topl = 0, mytopl = 0; for (XWindowPeer xp : windows) { --- old/src/solaris/classes/sun/awt/X11CustomCursor.java 2014-04-18 11:26:41.262824543 -0700 +++ new/src/solaris/classes/sun/awt/X11CustomCursor.java 2014-04-18 11:26:41.119491215 -0700 @@ -47,7 +47,7 @@ protected void createNativeCursor(Image im, int[] pixels, int width, int height, int xHotSpot, int yHotSpot) { - class CCount implements Comparable { + class CCount implements Comparable { int color; int count; @@ -56,8 +56,8 @@ count = ct; } - public int compareTo(Object cc) { - return ((CCount)cc).count - count; + public int compareTo(CCount cc) { + return cc.count - count; } } --- old/src/solaris/classes/sun/awt/X11FontManager.java 2014-04-18 11:26:42.126157836 -0700 +++ new/src/solaris/classes/sun/awt/X11FontManager.java 2014-04-18 11:26:41.976157842 -0700 @@ -59,7 +59,7 @@ * E.g., the -0-0-0-0-p-0- reported by X is -*-%d-*-*-p-*- in the font * configuration files. We need to remove that part for comparisons. */ - private static Map fontNameMap = new HashMap(); + private static Map fontNameMap = new HashMap<>(); /* * xlfdMap is a map from a platform path like @@ -72,7 +72,7 @@ * the full XLFD string like :- * "-ricoh-hg gothic b-medium-r-normal--0-0-0-0-m-0-jisx0201.1976-0" */ - private static Map xlfdMap = new HashMap(); + private static Map> xlfdMap = new HashMap<>(); /* xFontDirsMap is also a map from a font ID to a font filepath. * The difference from fontNameMap is just that it does not have @@ -88,7 +88,7 @@ * X11 font directory, then precautions must be taken to include both * directories. */ - private static Map xFontDirsMap; + private static Map xFontDirsMap; /* * This is the set of font directories needed to be on the X font path @@ -121,7 +121,7 @@ * of the singleton GE instance is already synchronised and that is * the only code path that accesses this map. */ - private static HashMap registeredDirs = new HashMap(); + private static HashMap registeredDirs = new HashMap<>(); /* Array of directories to be added to the X11 font path. * Used by static method called from Toolkits which use X11 fonts. @@ -183,7 +183,7 @@ * Add this XLFD (platform name) to the list of known * ones for this file. */ - Vector xVal = (Vector) xlfdMap.get(fileName); + Vector xVal = xlfdMap.get(fileName); if (xVal == null) { /* Try to be robust on Linux distros which move fonts * around by verifying that the fileName represents a @@ -194,7 +194,7 @@ fileName = null; } if (fileName != null) { - xVal = new Vector(); + xVal = new Vector<>(); xVal.add(platName); xlfdMap.put(fileName, xVal); } @@ -211,7 +211,7 @@ } if (fontID != null) { - fileName = (String)fontNameMap.get(fontID); + fileName = fontNameMap.get(fontID); /* On Linux check for the Lucida Oblique fonts */ if (fileName == null && FontUtilities.isLinux && !isOpenJDK()) { if (oblmap == null) { @@ -235,7 +235,7 @@ FontUtilities.getLogger() .warning("** Finished registering all font paths"); } - fileName = (String)fontNameMap.get(fontID); + fileName = fontNameMap.get(fontID); } if (fileName == null && !isHeadless()) { /* Query X11 directly to see if this font is available @@ -245,7 +245,7 @@ } if (fileName == null) { fontID = switchFontIDForName(platName); - fileName = (String)fontNameMap.get(fontID); + fileName = fontNameMap.get(fontID); } if (fileName != null) { fontNameMap.put(fontID, fileName); @@ -257,8 +257,8 @@ @Override protected String[] getNativeNames(String fontFileName, String platformName) { - Vector nativeNames; - if ((nativeNames=(Vector)xlfdMap.get(fontFileName))==null) { + Vector nativeNames; + if ((nativeNames=xlfdMap.get(fontFileName))==null) { if (platformName == null) { return null; } else { @@ -271,7 +271,7 @@ } } else { int len = nativeNames.size(); - return (String[])nativeNames.toArray(new String[len]); + return nativeNames.toArray(new String[len]); } } @@ -366,7 +366,7 @@ } String fontPart = st.sval.substring(breakPos+1); String fontID = specificFontIDForName(fontPart); - String sVal = (String) fontNameMap.get(fontID); + String sVal = fontNameMap.get(fontID); if (FontUtilities.debugFonts()) { PlatformLogger logger = FontUtilities.getLogger(); @@ -386,14 +386,14 @@ * wants to use the native rasteriser. */ if (xFontDirsMap == null) { - xFontDirsMap = new HashMap(); + xFontDirsMap = new HashMap<>(); } xFontDirsMap.put(fontID, path); fullPath = file.getCanonicalPath(); } catch (IOException e) { fullPath = path + File.separator + fileName; } - Vector xVal = (Vector) xlfdMap.get(fullPath); + Vector xVal = xlfdMap.get(fullPath); if (FontUtilities.debugFonts()) { FontUtilities.getLogger() .info("fullPath=" + fullPath + @@ -408,7 +408,7 @@ } fontNameMap.put(fontID, fullPath); if (xVal == null) { - xVal = new Vector(); + xVal = new Vector<>(); xlfdMap.put (fullPath, xVal); } xVal.add(fontPart); @@ -447,8 +447,8 @@ * will typically not ever need to initialise it so it can be null. */ xFontDirsMap = null; - xlfdMap = new HashMap(1); - fontNameMap = new HashMap(1); + xlfdMap = new HashMap<>(1); + fontNameMap = new HashMap<>(1); } private String getObliqueLucidaFontID(String fontID) { @@ -579,10 +579,10 @@ String fileName = null; String fontID = specificFontIDForName(name); if (fontID != null) { - fileName = (String)fontNameMap.get(fontID); + fileName = fontNameMap.get(fontID); if (fileName == null) { fontID = switchFontIDForName(name); - fileName = (String)fontNameMap.get(fontID); + fileName = fontNameMap.get(fontID); } if (fileName == null) { fileName = getDefaultFontFile(); @@ -685,7 +685,7 @@ getPlatformFontPathFromFontConfig(); if (xFontDirsMap != null) { String fontID = specificFontIDForName(platformName); - String dirName = (String)xFontDirsMap.get(fontID); + String dirName = xFontDirsMap.get(fontID); if (dirName != null) { fontConfigDirs.add(dirName); } --- old/src/solaris/classes/sun/awt/X11GraphicsDevice.java 2014-04-18 11:26:43.019491127 -0700 +++ new/src/solaris/classes/sun/awt/X11GraphicsDevice.java 2014-04-18 11:26:42.859491134 -0700 @@ -56,7 +56,7 @@ implements DisplayChangedListener { int screen; - HashMap x11ProxyKeyMap = new HashMap(); + HashMap x11ProxyKeyMap = new HashMap<>(); private static AWTPermission fullScreenExclusivePermission; private static Boolean xrandrExtSupported; @@ -127,7 +127,7 @@ GraphicsConfiguration[] configs; GraphicsConfiguration defaultConfig; - HashSet doubleBufferVisuals; + HashSet doubleBufferVisuals; /** * Returns all of the graphics @@ -159,7 +159,7 @@ boolean dbeSupported = isDBESupported(); if (dbeSupported && doubleBufferVisuals == null) { - doubleBufferVisuals = new HashSet(); + doubleBufferVisuals = new HashSet<>(); getDoubleBufferVisuals(screen); } for ( ; i < num; i++) { @@ -249,7 +249,7 @@ int depth = getConfigDepth(0, screen); boolean doubleBuffer = false; if (isDBESupported() && doubleBufferVisuals == null) { - doubleBufferVisuals = new HashSet(); + doubleBufferVisuals = new HashSet<>(); getDoubleBufferVisuals(screen); doubleBuffer = doubleBufferVisuals.contains(Integer.valueOf(visNum)); --- old/src/solaris/classes/sun/awt/X11GraphicsEnvironment.java 2014-04-18 11:26:43.902824418 -0700 +++ new/src/solaris/classes/sun/awt/X11GraphicsEnvironment.java 2014-04-18 11:26:43.742824426 -0700 @@ -72,7 +72,7 @@ static { java.security.AccessController.doPrivileged( - new java.security.PrivilegedAction() { + new java.security.PrivilegedAction() { public Object run() { System.loadLibrary("awt"); @@ -254,12 +254,12 @@ return true; } - Boolean result = (Boolean)java.security.AccessController.doPrivileged( - new java.security.PrivilegedAction() { - public Object run() { + Boolean result = java.security.AccessController.doPrivileged( + new java.security.PrivilegedAction() { + public Boolean run() { InetAddress remAddr[] = null; - Enumeration locals = null; - Enumeration interfaces = null; + Enumeration locals = null; + Enumeration interfaces = null; try { interfaces = NetworkInterface.getNetworkInterfaces(); remAddr = InetAddress.getAllByName(hostName); @@ -275,7 +275,7 @@ } for (; interfaces.hasMoreElements();) { - locals = ((NetworkInterface)interfaces.nextElement()).getInetAddresses(); + locals = interfaces.nextElement().getInetAddresses(); for (; locals.hasMoreElements();) { for (int i = 0; i < remAddr.length; i++) { if (locals.nextElement().equals(remAddr[i])) { --- old/src/solaris/classes/sun/awt/X11InputMethod.java 2014-04-18 11:26:44.772824378 -0700 +++ new/src/solaris/classes/sun/awt/X11InputMethod.java 2014-04-18 11:26:44.632824385 -0700 @@ -100,7 +100,7 @@ private boolean isLastTemporary = false; private boolean isActive = false; private boolean isActiveClient = false; - private static Map[] highlightStyles; + private static Map[] highlightStyles; private boolean disposed = false; //reset the XIC if necessary @@ -136,31 +136,29 @@ // Initialize highlight mapping table static { - Map styles[] = new Map[4]; - HashMap map; + @SuppressWarnings({"unchecked", "rawtypes"}) + Map styles[] = new Map[4]; + HashMap map; // UNSELECTED_RAW_TEXT_HIGHLIGHT - map = new HashMap(1); - map.put(TextAttribute.WEIGHT, - TextAttribute.WEIGHT_BOLD); + map = new HashMap<>(1); + map.put(TextAttribute.WEIGHT, TextAttribute.WEIGHT_BOLD); styles[0] = Collections.unmodifiableMap(map); // SELECTED_RAW_TEXT_HIGHLIGHT - map = new HashMap(1); - map.put(TextAttribute.SWAP_COLORS, - TextAttribute.SWAP_COLORS_ON); + map = new HashMap<>(1); + map.put(TextAttribute.SWAP_COLORS, TextAttribute.SWAP_COLORS_ON); styles[1] = Collections.unmodifiableMap(map); // UNSELECTED_CONVERTED_TEXT_HIGHLIGHT - map = new HashMap(1); + map = new HashMap<>(1); map.put(TextAttribute.INPUT_METHOD_UNDERLINE, - TextAttribute.UNDERLINE_LOW_ONE_PIXEL); + TextAttribute.UNDERLINE_LOW_ONE_PIXEL); styles[2] = Collections.unmodifiableMap(map); // SELECTED_CONVERTED_TEXT_HIGHLIGHT - map = new HashMap(1); - map.put(TextAttribute.SWAP_COLORS, - TextAttribute.SWAP_COLORS_ON); + map = new HashMap<>(1); + map.put(TextAttribute.SWAP_COLORS, TextAttribute.SWAP_COLORS_ON); styles[3] = Collections.unmodifiableMap(map); highlightStyles = styles; @@ -433,7 +431,7 @@ /** * @see java.awt.Toolkit#mapInputMethodHighlight */ - public static Map mapInputMethodHighlight(InputMethodHighlight highlight) { + public static Map mapInputMethodHighlight(InputMethodHighlight highlight) { int index; int state = highlight.getState(); if (state == InputMethodHighlight.RAW_TEXT) { --- old/src/solaris/classes/sun/awt/XSettings.java 2014-04-18 11:26:45.672824335 -0700 +++ new/src/solaris/classes/sun/awt/XSettings.java 2014-04-18 11:26:45.526157676 -0700 @@ -52,7 +52,7 @@ * settings manager. * @return a Map of changed settings. */ - public Map update(byte[] data) { + public Map update(byte[] data) { return (new Update(data)).update(); } @@ -79,7 +79,7 @@ private int nsettings = 0; private boolean isValid; - private HashMap updatedSettings; + private HashMap updatedSettings; /** @@ -113,7 +113,7 @@ idx = 8; nsettings = getINT32(); - updatedSettings = new HashMap(); + updatedSettings = new HashMap<>(); isValid = true; } @@ -213,7 +213,7 @@ /** * Update settings. */ - public Map update() { + public Map update() { if (!isValid) { return null; } --- old/src/solaris/classes/sun/awt/motif/MFontConfiguration.java 2014-04-18 11:26:46.539490962 -0700 +++ new/src/solaris/classes/sun/awt/motif/MFontConfiguration.java 2014-04-18 11:26:46.396157635 -0700 @@ -67,7 +67,7 @@ * the fontconfig files. */ protected void initReorderMap() { - reorderMap = new HashMap(); + reorderMap = new HashMap<>(); if (osName == null) { /* null means SunOS */ initReorderMapForSolaris(); } else { @@ -240,7 +240,7 @@ return "sun.awt.Symbol"; } } - String encoding = (String) encodingMap.get(xlfdEncoding); + String encoding = encodingMap.get(xlfdEncoding); if (encoding == null) { encoding = "default"; } @@ -288,7 +288,7 @@ /* methods for table setup ***********************************************/ - private static HashMap encodingMap = new HashMap(); + private static HashMap encodingMap = new HashMap<>(); private void initTables() { // encodingMap maps XLFD encoding component to