Warning Fixes from LJC Hack Session

Chris Hegarty chris.hegarty at oracle.com
Thu Feb 2 06:10:07 PST 2012


Michael,

I see others have guessed submitting separate code reviews. I can wait 
till then for a formal review, but here are a few specific comments:

ICC_Profile.java
   You can use ICC_Profile as the generic type for the PrivilegedAction 
rather than Object.

--- a/src/share/classes/java/awt/color/ICC_Profile.java Sat Jan 28 
20:41:27 2012 -0800
+++ b/src/share/classes/java/awt/color/ICC_Profile.java Thu Feb 02 
09:56:41 2012 +0000
@@ -921,9 +921,9 @@ public class ICC_Profile implements Seri
       */
      private static ICC_Profile getStandardProfile(final String name) {

-        return (ICC_Profile) AccessController.doPrivileged(
-            new PrivilegedAction() {marino :
-                 public Object run() {
+        return AccessController.doPrivileged(
+            new PrivilegedAction<ICC_Profile>() {
+                 public ICC_Profile run() {
                       ICC_Profile p = null;
                       try {
                           p = getInstance (name);

JarVerifier.java (Wow, great work). Some additional cleanup.
This is a package-private class so changing this method signature is 
fine. I think it would be better as <? extends ZipEntry>, and remove 
redundant cast.

--- JarVerifier.java    Thu Feb  2 11:20:43 2012
+++ JarVerifier.java      Thu Feb  2 11:17:57 2012
@@ -719,10 +719,10 @@
       * 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<? extends ZipEntry> e) {
+    public Enumeration<JarEntry> entries2(final JarFile jar, 
Enumeration<?> e) {
          final Map<String, CodeSigner[]> map = new HashMap<>();
          map.putAll(signerMap());
-        final Enumeration<? extends ZipEntry> enum_ = e;
+        final Enumeration<?> enum_ = e;
          return new Enumeration<JarEntry>() {

              Enumeration<String> signers = null;
@@ -733,7 +733,7 @@
                      return true;
                  }
                  while (enum_.hasMoreElements()) {
-                    ZipEntry ze = enum_.nextElement();
+                    ZipEntry ze = (ZipEntry) enum_.nextElement();
                      if (JarVerifier.isSigningRelated(ze.getName())) {
                          continue;
                      }
@@ -814,7 +814,7 @@
                  }
                  while (entries.hasMoreElements()) {
                      String value;
-                    ZipEntry e = entries.nextElement();
+                    ZipEntry e = (ZipEntry) entries.nextElement();
                      value = e.getName();
                      if (e.isDirectory() || isSigningRelated(value)) {
                          continue;

-Chris.



On 02/ 2/12 09:05 AM, Michael Barker wrote:
> 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.


More information about the jdk8-dev mailing list