Warning Fixes from LJC Hack Session
Michael Barker
mikeb01 at gmail.com
Thu Feb 2 01:05:19 PST 2012
Hi,
Attached is a patch that was a result of our work at the LJC OpenJDK
Hack session on Tuesday. They are all warning fixes, based on the
same rules as the big warning cleanup day from last year. I rolled it
up into a single patch, but I can split it by packages or classes if
that is preferred.
Thanks to those involved:
- Prasannaa
- Graham Allan
- Samir Talwar
- Martjin Verberg
- Michael Barker
- Carl Jokl
- Dinuk Weerasinghe
- Iordanis Giannakakis
- Abraham Marín Pérez
- Jose Llarena
Regards,
Michael Barker.
-------------- next part --------------
diff -r 663a6333105d src/share/classes/java/awt/List.java
--- a/src/share/classes/java/awt/List.java Tue Jan 31 04:57:20 2012 -0800
+++ b/src/share/classes/java/awt/List.java Thu Feb 02 08:52:26 2012 +0000
@@ -115,7 +115,7 @@
* @see #addItem(String)
* @see #getItem(int)
*/
- Vector items = new Vector();
+ Vector<String> items = new Vector<>();
/**
* This field will represent the number of visible rows in the
@@ -306,7 +306,7 @@
// to insure that it cannot be overridden by client subclasses.
// DO NOT INVOKE CLIENT CODE ON THIS THREAD!
final String getItemImpl(int index) {
- return (String)items.elementAt(index);
+ return items.elementAt(index);
}
/**
@@ -415,7 +415,7 @@
if (peer != null) {
peer.removeAll();
}
- items = new Vector();
+ items = new Vector<>();
selected = new int[0];
}
@@ -490,9 +490,9 @@
public synchronized int[] getSelectedIndexes() {
ListPeer peer = (ListPeer)this.peer;
if (peer != null) {
- selected = ((ListPeer)peer).getSelectedIndexes();
+ selected = peer.getSelectedIndexes();
}
- return (int[])selected.clone();
+ return selected.clone();
}
/**
@@ -908,7 +908,7 @@
* @since 1.4
*/
public synchronized ItemListener[] getItemListeners() {
- return (ItemListener[])(getListeners(ItemListener.class));
+ return getListeners(ItemListener.class);
}
/**
@@ -975,7 +975,7 @@
* @since 1.4
*/
public synchronized ActionListener[] getActionListeners() {
- return (ActionListener[])(getListeners(ActionListener.class));
+ return getListeners(ActionListener.class);
}
/**
diff -r 663a6333105d src/share/classes/java/awt/Window.java
--- a/src/share/classes/java/awt/Window.java Tue Jan 31 04:57:20 2012 -0800
+++ b/src/share/classes/java/awt/Window.java Thu Feb 02 08:52:26 2012 +0000
@@ -398,10 +398,10 @@
initIDs();
}
- String s = (String) java.security.AccessController.doPrivileged(
+ String s = java.security.AccessController.doPrivileged(
new GetPropertyAction("java.awt.syncLWRequests"));
systemSyncLWRequests = (s != null && s.equals("true"));
- s = (String) java.security.AccessController.doPrivileged(
+ s = java.security.AccessController.doPrivileged(
new GetPropertyAction("java.awt.Window.locationByPlatform"));
locationByPlatformProp = (s != null && s.equals("true"));
}
@@ -1378,7 +1378,7 @@
// make sure the privileged action is only
// for getting the property! We don't want the
// above checkTopLevelWindow call to always succeed!
- warningString = (String) AccessController.doPrivileged(
+ warningString = AccessController.doPrivileged(
new GetPropertyAction("awt.appletWarning",
"Java Applet Window"));
}
diff -r 663a6333105d src/share/classes/java/awt/color/ICC_Profile.java
--- a/src/share/classes/java/awt/color/ICC_Profile.java Tue Jan 31 04:57:20 2012 -0800
+++ b/src/share/classes/java/awt/color/ICC_Profile.java Thu Feb 02 08:52:26 2012 +0000
@@ -922,7 +922,7 @@
private static ICC_Profile getStandardProfile(final String name) {
return (ICC_Profile) AccessController.doPrivileged(
- new PrivilegedAction() {
+ new PrivilegedAction<Object>() {
public Object run() {
ICC_Profile p = null;
try {
diff -r 663a6333105d src/share/classes/java/beans/beancontext/BeanContextSupport.java
--- a/src/share/classes/java/beans/beancontext/BeanContextSupport.java Tue Jan 31 04:57:20 2012 -0800
+++ b/src/share/classes/java/beans/beancontext/BeanContextSupport.java Thu Feb 02 08:52:26 2012 +0000
@@ -1068,7 +1068,7 @@
if (serializable > 0 && this.equals(getBeanContextPeer()))
readChildren(ois);
- deserialize(ois, bcmListeners = new ArrayList(1));
+ deserialize(ois, bcmListeners = new ArrayList<>(1));
}
}
@@ -1291,7 +1291,7 @@
protected synchronized void initialize() {
children = new HashMap(serializable + 1);
- bcmListeners = new ArrayList(1);
+ bcmListeners = new ArrayList<>(1);
childPCL = new PropertyChangeListener() {
@@ -1359,7 +1359,7 @@
* all accesses to the <code> protected ArrayList bcmListeners </code> field
* shall be synchronized on that object.
*/
- protected transient ArrayList bcmListeners;
+ protected transient ArrayList<BeanContextMembershipListener> bcmListeners;
//
diff -r 663a6333105d src/share/classes/java/sql/Date.java
--- a/src/share/classes/java/sql/Date.java Tue Jan 31 04:57:20 2012 -0800
+++ b/src/share/classes/java/sql/Date.java Thu Feb 02 08:52:26 2012 +0000
@@ -51,6 +51,7 @@
* @param day 1 to 31
* @deprecated instead use the constructor <code>Date(long date)</code>
*/
+ @Deprecated
public Date(int year, int month, int day) {
super(year, month, day);
}
@@ -179,6 +180,7 @@
* @exception java.lang.IllegalArgumentException if this method is invoked
* @see #setHours
*/
+ @Deprecated
public int getHours() {
throw new java.lang.IllegalArgumentException();
}
@@ -191,6 +193,7 @@
* @exception java.lang.IllegalArgumentException if this method is invoked
* @see #setMinutes
*/
+ @Deprecated
public int getMinutes() {
throw new java.lang.IllegalArgumentException();
}
@@ -203,6 +206,7 @@
* @exception java.lang.IllegalArgumentException if this method is invoked
* @see #setSeconds
*/
+ @Deprecated
public int getSeconds() {
throw new java.lang.IllegalArgumentException();
}
@@ -215,6 +219,7 @@
* @exception java.lang.IllegalArgumentException if this method is invoked
* @see #getHours
*/
+ @Deprecated
public void setHours(int i) {
throw new java.lang.IllegalArgumentException();
}
@@ -227,6 +232,7 @@
* @exception java.lang.IllegalArgumentException if this method is invoked
* @see #getMinutes
*/
+ @Deprecated
public void setMinutes(int i) {
throw new java.lang.IllegalArgumentException();
}
@@ -239,6 +245,7 @@
* @exception java.lang.IllegalArgumentException if this method is invoked
* @see #getSeconds
*/
+ @Deprecated
public void setSeconds(int i) {
throw new java.lang.IllegalArgumentException();
}
diff -r 663a6333105d src/share/classes/java/sql/ResultSet.java
--- a/src/share/classes/java/sql/ResultSet.java Tue Jan 31 04:57:20 2012 -0800
+++ b/src/share/classes/java/sql/ResultSet.java Thu Feb 02 08:52:26 2012 +0000
@@ -358,6 +358,7 @@
* this method
* @deprecated
*/
+ @Deprecated
BigDecimal getBigDecimal(int columnIndex, int scale) throws SQLException;
/**
@@ -477,6 +478,7 @@
* @deprecated use <code>getCharacterStream</code> in place of
* <code>getUnicodeStream</code>
*/
+ @Deprecated
java.io.InputStream getUnicodeStream(int columnIndex) throws SQLException;
/**
@@ -643,6 +645,7 @@
* this method
* @deprecated
*/
+ @Deprecated
BigDecimal getBigDecimal(String columnLabel, int scale) throws SQLException;
/**
@@ -760,6 +763,7 @@
* this method
* @deprecated use <code>getCharacterStream</code> instead
*/
+ @Deprecated
java.io.InputStream getUnicodeStream(String columnLabel) throws SQLException;
/**
diff -r 663a6333105d src/share/classes/java/util/jar/Attributes.java
--- a/src/share/classes/java/util/jar/Attributes.java Tue Jan 31 04:57:20 2012 -0800
+++ b/src/share/classes/java/util/jar/Attributes.java Thu Feb 02 08:52:26 2012 +0000
@@ -71,7 +71,7 @@
* @param size the initial number of attributes
*/
public Attributes(int size) {
- map = new HashMap(size);
+ map = new HashMap<>(size);
}
/**
@@ -81,7 +81,7 @@
* @param attr the specified Attributes
*/
public Attributes(Attributes attr) {
- map = new HashMap(attr);
+ map = new HashMap<>(attr);
}
@@ -296,9 +296,9 @@
* XXX Need to handle UTF8 values and break up lines longer than 72 bytes
*/
void write(DataOutputStream os) throws IOException {
- Iterator it = entrySet().iterator();
+ Iterator<Map.Entry<Object, Object>> it = entrySet().iterator();
while (it.hasNext()) {
- Map.Entry e = (Map.Entry)it.next();
+ Map.Entry<Object, Object> e = it.next();
StringBuffer buffer = new StringBuffer(
((Name)e.getKey()).toString());
buffer.append(": ");
@@ -340,9 +340,9 @@
// write out all attributes except for the version
// we wrote out earlier
- Iterator it = entrySet().iterator();
+ Iterator<Map.Entry<Object, Object>> it = entrySet().iterator();
while (it.hasNext()) {
- Map.Entry e = (Map.Entry)it.next();
+ Map.Entry<Object, Object> e = it.next();
String name = ((Name)e.getKey()).toString();
if ((version != null) && ! (name.equalsIgnoreCase(vername))) {
@@ -499,7 +499,7 @@
*/
public boolean equals(Object o) {
if (o instanceof Name) {
- Comparator c = ASCIICaseInsensitiveComparator.CASE_INSENSITIVE_ORDER;
+ Comparator<String> c = ASCIICaseInsensitiveComparator.CASE_INSENSITIVE_ORDER;
return c.compare(name, ((Name)o).name) == 0;
} else {
return false;
diff -r 663a6333105d src/share/classes/java/util/jar/JarVerifier.java
--- a/src/share/classes/java/util/jar/JarVerifier.java Tue Jan 31 04:57:20 2012 -0800
+++ b/src/share/classes/java/util/jar/JarVerifier.java Thu Feb 02 08:52:26 2012 +0000
@@ -48,21 +48,21 @@
/* a table mapping names to code signers, for jar entries that have
had their actual hashes verified */
- private Hashtable verifiedSigners;
+ private Hashtable<String, CodeSigner[]> verifiedSigners;
/* a table mapping names to code signers, for jar entries that have
passed the .SF/.DSA/.EC -> MANIFEST check */
- private Hashtable sigFileSigners;
+ private Hashtable<String, CodeSigner[]> sigFileSigners;
/* a hash table to hold .SF bytes */
- private Hashtable sigFileData;
+ private Hashtable<String, byte[]> sigFileData;
/** "queue" of pending PKCS7 blocks that we couldn't parse
* until we parsed the .SF file */
- private ArrayList pendingBlocks;
+ private ArrayList<SignatureFileVerifier> pendingBlocks;
/* cache of CodeSigner objects */
- private ArrayList signerCache;
+ private ArrayList<CodeSigner[]> signerCache;
/* Are we parsing a block? */
private boolean parsingBlockOrSF = false;
@@ -94,10 +94,10 @@
public JarVerifier(byte rawBytes[]) {
manifestRawBytes = rawBytes;
- sigFileSigners = new Hashtable();
- verifiedSigners = new Hashtable();
- sigFileData = new Hashtable(11);
- pendingBlocks = new ArrayList();
+ sigFileSigners = new Hashtable<>();
+ verifiedSigners = new Hashtable<>();
+ sigFileData = new Hashtable<>(11);
+ pendingBlocks = new ArrayList<>();
baos = new ByteArrayOutputStream();
manifestDigests = new ArrayList<>();
}
@@ -248,10 +248,9 @@
sigFileData.put(key, bytes);
// check pending blocks, we can now process
// anyone waiting for this .SF file
- Iterator it = pendingBlocks.iterator();
+ Iterator<SignatureFileVerifier> it = pendingBlocks.iterator();
while (it.hasNext()) {
- SignatureFileVerifier sfv =
- (SignatureFileVerifier) it.next();
+ SignatureFileVerifier sfv = it.next();
if (sfv.needSignatureFile(key)) {
if (debug != null) {
debug.println(
@@ -270,7 +269,7 @@
String key = uname.substring(0, uname.lastIndexOf("."));
if (signerCache == null)
- signerCache = new ArrayList();
+ signerCache = new ArrayList<>();
if (manDig == null) {
synchronized(manifestRawBytes) {
@@ -287,7 +286,7 @@
if (sfv.needSignatureFileBytes()) {
// see if we have already parsed an external .SF file
- byte[] bytes = (byte[]) sigFileData.get(key);
+ byte[] bytes = sigFileData.get(key);
if (bytes == null) {
// put this block on queue for later processing
@@ -326,6 +325,7 @@
* the given file in the jar.
* @deprecated
*/
+ @Deprecated
public java.security.cert.Certificate[] getCerts(String name)
{
return mapSignersToCertArray(getCodeSigners(name));
@@ -343,7 +343,7 @@
*/
public CodeSigner[] getCodeSigners(String name)
{
- return (CodeSigner[])verifiedSigners.get(name);
+ return verifiedSigners.get(name);
}
public CodeSigner[] getCodeSigners(JarFile jar, JarEntry entry)
@@ -376,15 +376,14 @@
CodeSigner[] signers) {
if (signers != null) {
- ArrayList certChains = new ArrayList();
+ ArrayList<java.security.cert.Certificate> certChains = new ArrayList<>();
for (int i = 0; i < signers.length; i++) {
certChains.addAll(
signers[i].getSignerCertPath().getCertificates());
}
// Convert into a Certificate[]
- return (java.security.cert.Certificate[])
- certChains.toArray(
+ return certChains.toArray(
new java.security.cert.Certificate[certChains.size()]);
}
return null;
@@ -418,8 +417,8 @@
// MANIFEST.MF is always treated as signed and verified,
// move its signers from sigFileSigners to verifiedSigners.
if (sigFileSigners.containsKey(JarFile.MANIFEST_NAME)) {
- verifiedSigners.put(JarFile.MANIFEST_NAME,
- sigFileSigners.remove(JarFile.MANIFEST_NAME));
+ CodeSigner[] codeSigners = sigFileSigners.remove(JarFile.MANIFEST_NAME);
+ verifiedSigners.put(JarFile.MANIFEST_NAME, codeSigners);
}
}
@@ -493,10 +492,10 @@
// Extended JavaUtilJarAccess CodeSource API Support
- private Map urlToCodeSourceMap = new HashMap();
- private Map signerToCodeSource = new HashMap();
+ private Map<URL, Map<CodeSigner[], CodeSource>> urlToCodeSourceMap = new HashMap<>();
+ private Map<CodeSigner[], CodeSource> signerToCodeSource = new HashMap<>();
private URL lastURL;
- private Map lastURLMap;
+ private Map<CodeSigner[], CodeSource> lastURLMap;
/*
* Create a unique mapping from codeSigner cache entries to CodeSource.
@@ -504,19 +503,19 @@
* and shared JAR file although in practice there will be a single URL in use.
*/
private synchronized CodeSource mapSignersToCodeSource(URL url, CodeSigner[] signers) {
- Map map;
+ Map<CodeSigner[], CodeSource> map;
if (url == lastURL) {
map = lastURLMap;
} else {
- map = (Map) urlToCodeSourceMap.get(url);
+ map = urlToCodeSourceMap.get(url);
if (map == null) {
- map = new HashMap();
+ map = new HashMap<>();
urlToCodeSourceMap.put(url, map);
}
lastURLMap = map;
lastURL = url;
}
- CodeSource cs = (CodeSource) map.get(signers);
+ CodeSource cs = map.get(signers);
if (cs == null) {
cs = new VerifierCodeSource(csdomain, url, signers);
signerToCodeSource.put(signers, cs);
@@ -524,16 +523,16 @@
return cs;
}
- private CodeSource[] mapSignersToCodeSources(URL url, List signers, boolean unsigned) {
- List sources = new ArrayList();
+ private CodeSource[] mapSignersToCodeSources(URL url, List<CodeSigner[]> signers, boolean unsigned) {
+ List<CodeSource> sources = new ArrayList<>();
for (int i = 0; i < signers.size(); i++) {
- sources.add(mapSignersToCodeSource(url, (CodeSigner[]) signers.get(i)));
+ sources.add(mapSignersToCodeSource(url, signers.get(i)));
}
if (unsigned) {
sources.add(mapSignersToCodeSource(url, null));
}
- return (CodeSource[]) sources.toArray(new CodeSource[sources.size()]);
+ return sources.toArray(new CodeSource[sources.size()]);
}
private CodeSigner[] emptySigner = new CodeSigner[0];
@@ -553,7 +552,7 @@
* but this handles a CodeSource of any type, just in case.
*/
CodeSource[] sources = mapSignersToCodeSources(cs.getLocation(), getJarCodeSigners(), true);
- List sourceList = new ArrayList();
+ List<CodeSource> sourceList = new ArrayList<>();
for (int i = 0; i < sources.length; i++) {
sourceList.add(sources[i]);
}
@@ -574,6 +573,7 @@
* signing data that can be compared by object reference identity.
*/
private static class VerifierCodeSource extends CodeSource {
+ private static final long serialVersionUID = -9047366145967768825L;
URL vlocation;
CodeSigner[] vsigners;
@@ -641,16 +641,16 @@
return vcerts;
}
}
- private Map signerMap;
+ private Map<String, CodeSigner[]> signerMap;
- private synchronized Map signerMap() {
+ private synchronized Map<String, CodeSigner[]> signerMap() {
if (signerMap == null) {
/*
* Snapshot signer state so it doesn't change on us. We care
* only about the asserted signatures. Verification of
* signature validity happens via the JarEntry apis.
*/
- signerMap = new HashMap(verifiedSigners.size() + sigFileSigners.size());
+ signerMap = new HashMap<>(verifiedSigners.size() + sigFileSigners.size());
signerMap.putAll(verifiedSigners);
signerMap.putAll(sigFileSigners);
}
@@ -658,15 +658,15 @@
}
public synchronized Enumeration<String> entryNames(JarFile jar, final CodeSource[] cs) {
- final Map map = signerMap();
- final Iterator itor = map.entrySet().iterator();
+ final Map<String, CodeSigner[]> map = signerMap();
+ final Iterator<Map.Entry<String, CodeSigner[]>> itor = map.entrySet().iterator();
boolean matchUnsigned = false;
/*
* Grab a single copy of the CodeSigner arrays. Check
* to see if we can optimize CodeSigner equality test.
*/
- List req = new ArrayList(cs.length);
+ List<CodeSigner[]> req = new ArrayList<>(cs.length);
for (int i = 0; i < cs.length; i++) {
CodeSigner[] match = findMatchingSigners(cs[i]);
if (match != null) {
@@ -678,8 +678,8 @@
}
}
- final List signersReq = req;
- final Enumeration enum2 = (matchUnsigned) ? unsignedEntryNames(jar) : emptyEnumeration;
+ final List<CodeSigner[]> signersReq = req;
+ final Enumeration<String> enum2 = (matchUnsigned) ? unsignedEntryNames(jar) : emptyEnumeration;
return new Enumeration<String>() {
@@ -691,14 +691,14 @@
}
while (itor.hasNext()) {
- Map.Entry e = (Map.Entry) itor.next();
- if (signersReq.contains((CodeSigner[]) e.getValue())) {
- name = (String) e.getKey();
+ Map.Entry<String, CodeSigner[]> e = itor.next();
+ if (signersReq.contains(e.getValue())) {
+ name = e.getKey();
return true;
}
}
while (enum2.hasMoreElements()) {
- name = (String) enum2.nextElement();
+ name = enum2.nextElement();
return true;
}
return false;
@@ -719,13 +719,13 @@
* Like entries() but screens out internal JAR mechanism entries
* and includes signed entries with no ZIP data.
*/
- public Enumeration<JarEntry> entries2(final JarFile jar, Enumeration e) {
- final Map map = new HashMap();
+ public Enumeration<JarEntry> entries2(final JarFile jar, Enumeration<?> e) {
+ final Map<String, CodeSigner[]> map = new HashMap<>();
map.putAll(signerMap());
- final Enumeration enum_ = e;
+ final Enumeration<?> enum_ = e;
return new Enumeration<JarEntry>() {
- Enumeration signers = null;
+ Enumeration<String> signers = null;
JarEntry entry;
public boolean hasMoreElements() {
@@ -744,7 +744,7 @@
signers = Collections.enumeration(map.keySet());
}
while (signers.hasMoreElements()) {
- String name = (String) signers.nextElement();
+ String name = signers.nextElement();
entry = jar.newEntry(new ZipEntry(name));
return true;
}
@@ -764,7 +764,7 @@
}
};
}
- private Enumeration emptyEnumeration = new Enumeration<String>() {
+ private Enumeration<String> emptyEnumeration = new Enumeration<String>() {
public boolean hasMoreElements() {
return false;
@@ -797,8 +797,8 @@
}
private Enumeration<String> unsignedEntryNames(JarFile jar) {
- final Map map = signerMap();
- final Enumeration entries = jar.entries();
+ final Map<String, CodeSigner[]> map = signerMap();
+ final Enumeration<JarEntry> entries = jar.entries();
return new Enumeration<String>() {
String name;
@@ -836,14 +836,14 @@
}
};
}
- private List jarCodeSigners;
+ private List<CodeSigner[]> jarCodeSigners;
- private synchronized List getJarCodeSigners() {
+ private synchronized List<CodeSigner[]> getJarCodeSigners() {
CodeSigner[] signers;
if (jarCodeSigners == null) {
- HashSet set = new HashSet();
+ HashSet<CodeSigner[]> set = new HashSet<>();
set.addAll(signerMap().values());
- jarCodeSigners = new ArrayList();
+ jarCodeSigners = new ArrayList<>();
jarCodeSigners.addAll(set);
}
return jarCodeSigners;
@@ -858,7 +858,7 @@
public CodeSource getCodeSource(URL url, String name) {
CodeSigner[] signers;
- signers = (CodeSigner[]) signerMap().get(name);
+ signers = signerMap().get(name);
return mapSignersToCodeSource(url, signers);
}
diff -r 663a6333105d src/share/classes/javax/print/attribute/standard/PrinterStateReasons.java
--- a/src/share/classes/javax/print/attribute/standard/PrinterStateReasons.java Tue Jan 31 04:57:20 2012 -0800
+++ b/src/share/classes/javax/print/attribute/standard/PrinterStateReasons.java Thu Feb 02 08:52:26 2012 +0000
@@ -180,8 +180,7 @@
if (severity == null) {
throw new NullPointerException("severity is null");
}
- return super.put((PrinterStateReason) reason,
- (Severity) severity);
+ return super.put(reason, severity);
}
/**
diff -r 663a6333105d src/share/classes/javax/print/attribute/standard/ReferenceUriSchemesSupported.java
--- a/src/share/classes/javax/print/attribute/standard/ReferenceUriSchemesSupported.java Tue Jan 31 04:57:20 2012 -0800
+++ b/src/share/classes/javax/print/attribute/standard/ReferenceUriSchemesSupported.java Thu Feb 02 08:52:26 2012 +0000
@@ -141,7 +141,7 @@
* Returns the string table for class ReferenceUriSchemesSupported.
*/
protected String[] getStringTable() {
- return (String[])myStringTable.clone();
+ return myStringTable.clone();
}
/**
diff -r 663a6333105d src/share/classes/sun/beans/infos/ComponentBeanInfo.java
--- a/src/share/classes/sun/beans/infos/ComponentBeanInfo.java Tue Jan 31 04:57:20 2012 -0800
+++ b/src/share/classes/sun/beans/infos/ComponentBeanInfo.java Thu Feb 02 08:52:26 2012 +0000
@@ -32,7 +32,7 @@
*/
public class ComponentBeanInfo extends SimpleBeanInfo {
- private static final Class beanClass = java.awt.Component.class;
+ private static final Class<java.awt.Component> beanClass = java.awt.Component.class;
public PropertyDescriptor[] getPropertyDescriptors() {
try {
diff -r 663a6333105d src/share/demo/management/MemoryMonitor/MemoryMonitor.java
--- a/src/share/demo/management/MemoryMonitor/MemoryMonitor.java Tue Jan 31 04:57:20 2012 -0800
+++ b/src/share/demo/management/MemoryMonitor/MemoryMonitor.java Thu Feb 02 08:52:26 2012 +0000
@@ -213,10 +213,10 @@
// Calculate remaining size
float ssH = ascent + descent;
- float remainingHeight = (float) (y2 - (ssH*2) - 0.5f);
+ float remainingHeight = (y2 - (ssH*2) - 0.5f);
float blockHeight = remainingHeight/10;
float blockWidth = 20.0f;
- float remainingWidth = (float) (x2 - blockWidth - 10);
+ float remainingWidth = (x2 - blockWidth - 10);
// .. Memory Free ..
big.setColor(mfColor);
@@ -224,7 +224,7 @@
int i = 0;
for ( ; i < MemUsage ; i++) {
mfRect.setRect(x1+5,(float) y1+ssH+i*blockHeight,
- blockWidth,(float) blockHeight-1);
+ blockWidth, blockHeight-1);
big.fill(mfRect);
}
@@ -232,13 +232,13 @@
big.setColor(Color.green);
for ( ; i < 10; i++) {
muRect.setRect(x1+5,(float) y1 + ssH+i*blockHeight,
- blockWidth,(float) blockHeight-1);
+ blockWidth, blockHeight-1);
big.fill(muRect);
}
// .. Draw History Graph ..
if (remainingWidth <= 30) remainingWidth = (float)30;
- if (remainingHeight <= ssH) remainingHeight = (float)ssH;
+ if (remainingHeight <= ssH) remainingHeight = ssH;
big.setColor(graphColor);
int graphX = x1+30;
int graphY = y1 + (int) ssH;
@@ -347,8 +347,8 @@
big = bimg.createGraphics();
big.setFont(font);
FontMetrics fm = big.getFontMetrics(font);
- ascent = (int) fm.getAscent();
- descent = (int) fm.getDescent();
+ ascent = fm.getAscent();
+ descent = fm.getDescent();
}
repaint();
try {
diff -r 663a6333105d src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipFileStore.java
--- a/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipFileStore.java Tue Jan 31 04:57:20 2012 -0800
+++ b/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipFileStore.java Thu Feb 02 08:52:26 2012 +0000
@@ -61,7 +61,7 @@
private final ZipFileSystem zfs;
ZipFileStore(ZipPath zpath) {
- this.zfs = (ZipFileSystem)zpath.getFileSystem();
+ this.zfs = zpath.getFileSystem();
}
@Override
diff -r 663a6333105d src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipFileSystem.java
--- a/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipFileSystem.java Tue Jan 31 04:57:20 2012 -0800
+++ b/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipFileSystem.java Thu Feb 02 08:52:26 2012 +0000
@@ -1609,7 +1609,7 @@
synchronized (inflaters) {
int size = inflaters.size();
if (size > 0) {
- Inflater inf = (Inflater)inflaters.remove(size - 1);
+ Inflater inf = inflaters.remove(size - 1);
return inf;
} else {
return new Inflater(true);
@@ -1638,7 +1638,7 @@
synchronized (deflaters) {
int size = deflaters.size();
if (size > 0) {
- Deflater def = (Deflater)deflaters.remove(size - 1);
+ Deflater def = deflaters.remove(size - 1);
return def;
} else {
return new Deflater(Deflater.DEFAULT_COMPRESSION, true);
diff -r 663a6333105d src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipFileSystemProvider.java
--- a/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipFileSystemProvider.java Tue Jan 31 04:57:20 2012 -0800
+++ b/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipFileSystemProvider.java Thu Feb 02 08:52:26 2012 +0000
@@ -211,7 +211,7 @@
public <V extends FileAttributeView> V
getFileAttributeView(Path path, Class<V> type, LinkOption... options)
{
- return (V)ZipFileAttributeView.get(toZipPath(path), type);
+ return ZipFileAttributeView.get(toZipPath(path), type);
}
@Override
diff -r 663a6333105d src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipInfo.java
--- a/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipInfo.java Tue Jan 31 04:57:20 2012 -0800
+++ b/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipInfo.java Thu Feb 02 08:52:26 2012 +0000
@@ -78,12 +78,12 @@
// twice
long len = LOCHDR + CENNAM(cen, pos) + CENEXT(cen, pos) + CENHDR;
if (zfs.readFullyAt(buf, 0, len, locoff(cen, pos)) != len)
- zfs.zerror("read loc header failed");
+ ZipFileSystem.zerror("read loc header failed");
if (LOCEXT(buf) > CENEXT(cen, pos) + CENHDR) {
// have to read the second time;
len = LOCHDR + LOCNAM(buf) + LOCEXT(buf);
if (zfs.readFullyAt(buf, 0, len, locoff(cen, pos)) != len)
- zfs.zerror("read loc header failed");
+ ZipFileSystem.zerror("read loc header failed");
}
printLOC(buf);
pos += CENHDR + CENNAM(cen, pos) + CENEXT(cen, pos) + CENCOM(cen, pos);
More information about the jdk8-dev
mailing list