JDK 8 RFR: more core libs raw warnings cleanup
Hello, Please review the patch below which would remove another batch of raw type javac lint warnings from the core libraries. No signatures of public or protected methods in the Java SE specification have been modified. Regression tests in affected areas pass. Thanks, -Joe diff -r 9fcb07df1c92 src/share/classes/java/io/ObjectOutputStream.java --- a/src/share/classes/java/io/ObjectOutputStream.javaSat Nov 09 04:21:28 2013 +0400 +++ b/src/share/classes/java/io/ObjectOutputStream.javaTue Nov 12 00:51:15 2013 -0800 @@ -1248,7 +1248,7 @@ handles.assign(unshared ? null : desc); Class? cl = desc.forClass(); -Class[] ifaces = cl.getInterfaces(); +Class?[] ifaces = cl.getInterfaces(); bout.writeInt(ifaces.length); for (int i = 0; i ifaces.length; i++) { bout.writeUTF(ifaces[i].getName()); diff -r 9fcb07df1c92 src/share/classes/java/io/ObjectStreamClass.java --- a/src/share/classes/java/io/ObjectStreamClass.javaSat Nov 09 04:21:28 2013 +0400 +++ b/src/share/classes/java/io/ObjectStreamClass.javaTue Nov 12 00:51:15 2013 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -1746,7 +1746,7 @@ dout.writeUTF(()V); } -Constructor[] cons = cl.getDeclaredConstructors(); +Constructor?[] cons = cl.getDeclaredConstructors(); MemberSignature[] consSigs = new MemberSignature[cons.length]; for (int i = 0; i cons.length; i++) { consSigs[i] = new MemberSignature(cons[i]); diff -r 9fcb07df1c92 src/share/classes/java/lang/reflect/Proxy.java --- a/src/share/classes/java/lang/reflect/Proxy.javaSat Nov 09 04:21:28 2013 +0400 +++ b/src/share/classes/java/lang/reflect/Proxy.javaTue Nov 12 00:51:15 2013 -0800 @@ -494,9 +494,10 @@ private final int hash; private final WeakReferenceClass?[] refs; +@SuppressWarnings({rawtypes, unchecked}) KeyX(Class?[] interfaces) { hash = Arrays.hashCode(interfaces); -refs = new WeakReference[interfaces.length]; +refs = (WeakReferenceClass?[])new WeakReference[interfaces.length]; for (int i = 0; i interfaces.length; i++) { refs[i] = new WeakReference(interfaces[i]); } diff -r 9fcb07df1c92 src/share/classes/java/nio/file/TempFileHelper.java --- a/src/share/classes/java/nio/file/TempFileHelper.javaSat Nov 09 04:21:28 2013 +0400 +++ b/src/share/classes/java/nio/file/TempFileHelper.javaTue Nov 12 00:51:15 2013 -0800 @@ -81,7 +81,7 @@ String prefix, String suffix, boolean createDirectory, - FileAttribute[] attrs) + FileAttribute?[] attrs) throws IOException { if (prefix == null) @@ -155,7 +155,7 @@ static Path createTempFile(Path dir, String prefix, String suffix, - FileAttribute[] attrs) + FileAttribute?[] attrs) throws IOException { return create(dir, prefix, suffix, false, attrs); @@ -167,7 +167,7 @@ */ static Path createTempDirectory(Path dir, String prefix, -FileAttribute[] attrs) +FileAttribute?[] attrs) throws IOException { return create(dir, prefix, null, true, attrs); diff -r 9fcb07df1c92 src/share/classes/java/util/IdentityHashMap.java --- a/src/share/classes/java/util/IdentityHashMap.javaSat Nov 09 04:21:28 2013 +0400 +++ b/src/share/classes/java/util/IdentityHashMap.javaTue Nov 12 00:51:15 2013 -0800 @@ -1243,7 +1243,7 @@ if (ti = size) { throw new ConcurrentModificationException(); } -a[ti++] = (T) new AbstractMap.SimpleEntry(unmaskNull(key), tab[si + 1]); +a[ti++] = (T) new AbstractMap.SimpleEntry(unmaskNull(key), tab[si + 1]); } } // fewer elements than expected or concurrent modification from other thread detected diff -r 9fcb07df1c92 src/share/classes/java/util/logging/Logger.java --- a/src/share/classes/java/util/logging/Logger.javaSat Nov 09 04:21:28 2013 +0400 +++ b/src/share/classes/java/util/logging/Logger.javaTue Nov 12 00:51:15 2013 -0800 @@ -351,7 +351,7 @@ ? caller.getClassLoader()
Re: JDK 8 RFR: more core libs raw warnings cleanup
Looks ok to me Joe. -Chris. On 12/11/13 09:28, Joe Darcy wrote: Hello, Please review the patch below which would remove another batch of raw type javac lint warnings from the core libraries. No signatures of public or protected methods in the Java SE specification have been modified. Regression tests in affected areas pass. Thanks, -Joe diff -r 9fcb07df1c92 src/share/classes/java/io/ObjectOutputStream.java --- a/src/share/classes/java/io/ObjectOutputStream.javaSat Nov 09 04:21:28 2013 +0400 +++ b/src/share/classes/java/io/ObjectOutputStream.javaTue Nov 12 00:51:15 2013 -0800 @@ -1248,7 +1248,7 @@ handles.assign(unshared ? null : desc); Class? cl = desc.forClass(); -Class[] ifaces = cl.getInterfaces(); +Class?[] ifaces = cl.getInterfaces(); bout.writeInt(ifaces.length); for (int i = 0; i ifaces.length; i++) { bout.writeUTF(ifaces[i].getName()); diff -r 9fcb07df1c92 src/share/classes/java/io/ObjectStreamClass.java --- a/src/share/classes/java/io/ObjectStreamClass.javaSat Nov 09 04:21:28 2013 +0400 +++ b/src/share/classes/java/io/ObjectStreamClass.javaTue Nov 12 00:51:15 2013 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -1746,7 +1746,7 @@ dout.writeUTF(()V); } -Constructor[] cons = cl.getDeclaredConstructors(); +Constructor?[] cons = cl.getDeclaredConstructors(); MemberSignature[] consSigs = new MemberSignature[cons.length]; for (int i = 0; i cons.length; i++) { consSigs[i] = new MemberSignature(cons[i]); diff -r 9fcb07df1c92 src/share/classes/java/lang/reflect/Proxy.java --- a/src/share/classes/java/lang/reflect/Proxy.javaSat Nov 09 04:21:28 2013 +0400 +++ b/src/share/classes/java/lang/reflect/Proxy.javaTue Nov 12 00:51:15 2013 -0800 @@ -494,9 +494,10 @@ private final int hash; private final WeakReferenceClass?[] refs; +@SuppressWarnings({rawtypes, unchecked}) KeyX(Class?[] interfaces) { hash = Arrays.hashCode(interfaces); -refs = new WeakReference[interfaces.length]; +refs = (WeakReferenceClass?[])new WeakReference[interfaces.length]; for (int i = 0; i interfaces.length; i++) { refs[i] = new WeakReference(interfaces[i]); } diff -r 9fcb07df1c92 src/share/classes/java/nio/file/TempFileHelper.java --- a/src/share/classes/java/nio/file/TempFileHelper.javaSat Nov 09 04:21:28 2013 +0400 +++ b/src/share/classes/java/nio/file/TempFileHelper.javaTue Nov 12 00:51:15 2013 -0800 @@ -81,7 +81,7 @@ String prefix, String suffix, boolean createDirectory, - FileAttribute[] attrs) + FileAttribute?[] attrs) throws IOException { if (prefix == null) @@ -155,7 +155,7 @@ static Path createTempFile(Path dir, String prefix, String suffix, - FileAttribute[] attrs) + FileAttribute?[] attrs) throws IOException { return create(dir, prefix, suffix, false, attrs); @@ -167,7 +167,7 @@ */ static Path createTempDirectory(Path dir, String prefix, -FileAttribute[] attrs) +FileAttribute?[] attrs) throws IOException { return create(dir, prefix, null, true, attrs); diff -r 9fcb07df1c92 src/share/classes/java/util/IdentityHashMap.java --- a/src/share/classes/java/util/IdentityHashMap.javaSat Nov 09 04:21:28 2013 +0400 +++ b/src/share/classes/java/util/IdentityHashMap.javaTue Nov 12 00:51:15 2013 -0800 @@ -1243,7 +1243,7 @@ if (ti = size) { throw new ConcurrentModificationException(); } -a[ti++] = (T) new AbstractMap.SimpleEntry(unmaskNull(key), tab[si + 1]); +a[ti++] = (T) new AbstractMap.SimpleEntry(unmaskNull(key), tab[si + 1]); } } // fewer elements than expected or concurrent modification from other thread detected diff -r 9fcb07df1c92 src/share/classes/java/util/logging/Logger.java --- a/src/share/classes/java/util/logging/Logger.javaSat Nov 09 04:21:28 2013 +0400 +++ b/src/share/classes/java/util/logging/Logger.javaTue Nov 12 00:51:15 2013 -0800 @@ -351,7 +351,7 @@
Re: JDK 8 RFR: more core libs raw warnings cleanup
On 12/11/2013 09:28, Joe Darcy wrote: Hello, Please review the patch below which would remove another batch of raw type javac lint warnings from the core libraries. No signatures of public or protected methods in the Java SE specification have been modified. Regression tests in affected areas pass. Thanks, -Joe These looks okay to me too. -Alan.
Re: JDK 8 RFR: more core libs raw warnings cleanup
On 11/12/2013 10:51 AM, Chris Hegarty wrote: Looks ok to me Joe. -Chris. A small issue, refs = (WeakReferenceClass?[])new WeakReference[interfaces.length]; should be refs = (WeakReferenceClass?[])new WeakReference?[interfaces.length]; otherwise, looks good. Rémi On 12/11/13 09:28, Joe Darcy wrote: Hello, Please review the patch below which would remove another batch of raw type javac lint warnings from the core libraries. No signatures of public or protected methods in the Java SE specification have been modified. Regression tests in affected areas pass. Thanks, -Joe diff -r 9fcb07df1c92 src/share/classes/java/io/ObjectOutputStream.java --- a/src/share/classes/java/io/ObjectOutputStream.javaSat Nov 09 04:21:28 2013 +0400 +++ b/src/share/classes/java/io/ObjectOutputStream.javaTue Nov 12 00:51:15 2013 -0800 @@ -1248,7 +1248,7 @@ handles.assign(unshared ? null : desc); Class? cl = desc.forClass(); -Class[] ifaces = cl.getInterfaces(); +Class?[] ifaces = cl.getInterfaces(); bout.writeInt(ifaces.length); for (int i = 0; i ifaces.length; i++) { bout.writeUTF(ifaces[i].getName()); diff -r 9fcb07df1c92 src/share/classes/java/io/ObjectStreamClass.java --- a/src/share/classes/java/io/ObjectStreamClass.javaSat Nov 09 04:21:28 2013 +0400 +++ b/src/share/classes/java/io/ObjectStreamClass.javaTue Nov 12 00:51:15 2013 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -1746,7 +1746,7 @@ dout.writeUTF(()V); } -Constructor[] cons = cl.getDeclaredConstructors(); +Constructor?[] cons = cl.getDeclaredConstructors(); MemberSignature[] consSigs = new MemberSignature[cons.length]; for (int i = 0; i cons.length; i++) { consSigs[i] = new MemberSignature(cons[i]); diff -r 9fcb07df1c92 src/share/classes/java/lang/reflect/Proxy.java --- a/src/share/classes/java/lang/reflect/Proxy.javaSat Nov 09 04:21:28 2013 +0400 +++ b/src/share/classes/java/lang/reflect/Proxy.javaTue Nov 12 00:51:15 2013 -0800 @@ -494,9 +494,10 @@ private final int hash; private final WeakReferenceClass?[] refs; +@SuppressWarnings({rawtypes, unchecked}) KeyX(Class?[] interfaces) { hash = Arrays.hashCode(interfaces); -refs = new WeakReference[interfaces.length]; +refs = (WeakReferenceClass?[])new WeakReference[interfaces.length]; for (int i = 0; i interfaces.length; i++) { refs[i] = new WeakReference(interfaces[i]); } diff -r 9fcb07df1c92 src/share/classes/java/nio/file/TempFileHelper.java --- a/src/share/classes/java/nio/file/TempFileHelper.javaSat Nov 09 04:21:28 2013 +0400 +++ b/src/share/classes/java/nio/file/TempFileHelper.javaTue Nov 12 00:51:15 2013 -0800 @@ -81,7 +81,7 @@ String prefix, String suffix, boolean createDirectory, - FileAttribute[] attrs) + FileAttribute?[] attrs) throws IOException { if (prefix == null) @@ -155,7 +155,7 @@ static Path createTempFile(Path dir, String prefix, String suffix, - FileAttribute[] attrs) + FileAttribute?[] attrs) throws IOException { return create(dir, prefix, suffix, false, attrs); @@ -167,7 +167,7 @@ */ static Path createTempDirectory(Path dir, String prefix, -FileAttribute[] attrs) +FileAttribute?[] attrs) throws IOException { return create(dir, prefix, null, true, attrs); diff -r 9fcb07df1c92 src/share/classes/java/util/IdentityHashMap.java --- a/src/share/classes/java/util/IdentityHashMap.javaSat Nov 09 04:21:28 2013 +0400 +++ b/src/share/classes/java/util/IdentityHashMap.javaTue Nov 12 00:51:15 2013 -0800 @@ -1243,7 +1243,7 @@ if (ti = size) { throw new ConcurrentModificationException(); } -a[ti++] = (T) new AbstractMap.SimpleEntry(unmaskNull(key), tab[si + 1]); +a[ti++] = (T) new AbstractMap.SimpleEntry(unmaskNull(key), tab[si + 1]); } } // fewer elements than expected or concurrent modification from other thread detected diff -r
Re: JDK 8 RFR: more core libs raw warnings cleanup
Hi Joe, Looks good, but your mailer trashes the patch. Please fix your mailer linewrap settings. cheers /Joel On 2013-11-12, Joe Darcy wrote: Hello, Please review the patch below which would remove another batch of raw type javac lint warnings from the core libraries. No signatures of public or protected methods in the Java SE specification have been modified. Regression tests in affected areas pass. Thanks, -Joe diff -r 9fcb07df1c92 src/share/classes/java/io/ObjectOutputStream.java --- a/src/share/classes/java/io/ObjectOutputStream.javaSat Nov 09 04:21:28 2013 +0400 +++ b/src/share/classes/java/io/ObjectOutputStream.javaTue Nov 12 00:51:15 2013 -0800 @@ -1248,7 +1248,7 @@ handles.assign(unshared ? null : desc); Class? cl = desc.forClass(); -Class[] ifaces = cl.getInterfaces(); +Class?[] ifaces = cl.getInterfaces(); bout.writeInt(ifaces.length); for (int i = 0; i ifaces.length; i++) { bout.writeUTF(ifaces[i].getName()); diff -r 9fcb07df1c92 src/share/classes/java/io/ObjectStreamClass.java --- a/src/share/classes/java/io/ObjectStreamClass.javaSat Nov 09 04:21:28 2013 +0400 +++ b/src/share/classes/java/io/ObjectStreamClass.javaTue Nov 12 00:51:15 2013 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -1746,7 +1746,7 @@ dout.writeUTF(()V); } -Constructor[] cons = cl.getDeclaredConstructors(); +Constructor?[] cons = cl.getDeclaredConstructors(); MemberSignature[] consSigs = new MemberSignature[cons.length]; for (int i = 0; i cons.length; i++) { consSigs[i] = new MemberSignature(cons[i]); diff -r 9fcb07df1c92 src/share/classes/java/lang/reflect/Proxy.java --- a/src/share/classes/java/lang/reflect/Proxy.javaSat Nov 09 04:21:28 2013 +0400 +++ b/src/share/classes/java/lang/reflect/Proxy.javaTue Nov 12 00:51:15 2013 -0800 @@ -494,9 +494,10 @@ private final int hash; private final WeakReferenceClass?[] refs; +@SuppressWarnings({rawtypes, unchecked}) KeyX(Class?[] interfaces) { hash = Arrays.hashCode(interfaces); -refs = new WeakReference[interfaces.length]; +refs = (WeakReferenceClass?[])new WeakReference[interfaces.length]; for (int i = 0; i interfaces.length; i++) { refs[i] = new WeakReference(interfaces[i]); } diff -r 9fcb07df1c92 src/share/classes/java/nio/file/TempFileHelper.java --- a/src/share/classes/java/nio/file/TempFileHelper.javaSat Nov 09 04:21:28 2013 +0400 +++ b/src/share/classes/java/nio/file/TempFileHelper.javaTue Nov 12 00:51:15 2013 -0800 @@ -81,7 +81,7 @@ String prefix, String suffix, boolean createDirectory, - FileAttribute[] attrs) + FileAttribute?[] attrs) throws IOException { if (prefix == null) @@ -155,7 +155,7 @@ static Path createTempFile(Path dir, String prefix, String suffix, - FileAttribute[] attrs) + FileAttribute?[] attrs) throws IOException { return create(dir, prefix, suffix, false, attrs); @@ -167,7 +167,7 @@ */ static Path createTempDirectory(Path dir, String prefix, -FileAttribute[] attrs) +FileAttribute?[] attrs) throws IOException { return create(dir, prefix, null, true, attrs); diff -r 9fcb07df1c92 src/share/classes/java/util/IdentityHashMap.java --- a/src/share/classes/java/util/IdentityHashMap.javaSat Nov 09 04:21:28 2013 +0400 +++ b/src/share/classes/java/util/IdentityHashMap.javaTue Nov 12 00:51:15 2013 -0800 @@ -1243,7 +1243,7 @@ if (ti = size) { throw new ConcurrentModificationException(); } -a[ti++] = (T) new AbstractMap.SimpleEntry(unmaskNull(key), tab[si + 1]); +a[ti++] = (T) new AbstractMap.SimpleEntry(unmaskNull(key), tab[si + 1]); } } // fewer elements than expected or concurrent modification from other thread detected diff -r 9fcb07df1c92 src/share/classes/java/util/logging/Logger.java ---
Re: JDK 8 RFR: more core libs raw warnings cleanup
Looks Ok Joe On Nov 12, 2013, at 4:28 AM, Joe Darcy wrote: Hello, Please review the patch below which would remove another batch of raw type javac lint warnings from the core libraries. No signatures of public or protected methods in the Java SE specification have been modified. Regression tests in affected areas pass. Thanks, -Joe diff -r 9fcb07df1c92 src/share/classes/java/io/ObjectOutputStream.java --- a/src/share/classes/java/io/ObjectOutputStream.javaSat Nov 09 04:21:28 2013 +0400 +++ b/src/share/classes/java/io/ObjectOutputStream.javaTue Nov 12 00:51:15 2013 -0800 @@ -1248,7 +1248,7 @@ handles.assign(unshared ? null : desc); Class? cl = desc.forClass(); -Class[] ifaces = cl.getInterfaces(); +Class?[] ifaces = cl.getInterfaces(); bout.writeInt(ifaces.length); for (int i = 0; i ifaces.length; i++) { bout.writeUTF(ifaces[i].getName()); diff -r 9fcb07df1c92 src/share/classes/java/io/ObjectStreamClass.java --- a/src/share/classes/java/io/ObjectStreamClass.javaSat Nov 09 04:21:28 2013 +0400 +++ b/src/share/classes/java/io/ObjectStreamClass.javaTue Nov 12 00:51:15 2013 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -1746,7 +1746,7 @@ dout.writeUTF(()V); } -Constructor[] cons = cl.getDeclaredConstructors(); +Constructor?[] cons = cl.getDeclaredConstructors(); MemberSignature[] consSigs = new MemberSignature[cons.length]; for (int i = 0; i cons.length; i++) { consSigs[i] = new MemberSignature(cons[i]); diff -r 9fcb07df1c92 src/share/classes/java/lang/reflect/Proxy.java --- a/src/share/classes/java/lang/reflect/Proxy.javaSat Nov 09 04:21:28 2013 +0400 +++ b/src/share/classes/java/lang/reflect/Proxy.javaTue Nov 12 00:51:15 2013 -0800 @@ -494,9 +494,10 @@ private final int hash; private final WeakReferenceClass?[] refs; +@SuppressWarnings({rawtypes, unchecked}) KeyX(Class?[] interfaces) { hash = Arrays.hashCode(interfaces); -refs = new WeakReference[interfaces.length]; +refs = (WeakReferenceClass?[])new WeakReference[interfaces.length]; for (int i = 0; i interfaces.length; i++) { refs[i] = new WeakReference(interfaces[i]); } diff -r 9fcb07df1c92 src/share/classes/java/nio/file/TempFileHelper.java --- a/src/share/classes/java/nio/file/TempFileHelper.javaSat Nov 09 04:21:28 2013 +0400 +++ b/src/share/classes/java/nio/file/TempFileHelper.javaTue Nov 12 00:51:15 2013 -0800 @@ -81,7 +81,7 @@ String prefix, String suffix, boolean createDirectory, - FileAttribute[] attrs) + FileAttribute?[] attrs) throws IOException { if (prefix == null) @@ -155,7 +155,7 @@ static Path createTempFile(Path dir, String prefix, String suffix, - FileAttribute[] attrs) + FileAttribute?[] attrs) throws IOException { return create(dir, prefix, suffix, false, attrs); @@ -167,7 +167,7 @@ */ static Path createTempDirectory(Path dir, String prefix, -FileAttribute[] attrs) +FileAttribute?[] attrs) throws IOException { return create(dir, prefix, null, true, attrs); diff -r 9fcb07df1c92 src/share/classes/java/util/IdentityHashMap.java --- a/src/share/classes/java/util/IdentityHashMap.javaSat Nov 09 04:21:28 2013 +0400 +++ b/src/share/classes/java/util/IdentityHashMap.javaTue Nov 12 00:51:15 2013 -0800 @@ -1243,7 +1243,7 @@ if (ti = size) { throw new ConcurrentModificationException(); } -a[ti++] = (T) new AbstractMap.SimpleEntry(unmaskNull(key), tab[si + 1]); +a[ti++] = (T) new AbstractMap.SimpleEntry(unmaskNull(key), tab[si + 1]); } } // fewer elements than expected or concurrent modification from other thread detected diff -r 9fcb07df1c92 src/share/classes/java/util/logging/Logger.java --- a/src/share/classes/java/util/logging/Logger.javaSat Nov 09 04:21:28 2013 +0400 +++ b/src/share/classes/java/util/logging/Logger.javaTue Nov 12
Re: JDK 8 RFR: more core libs raw warnings cleanup
This also allows you to get rid of the raw type suppression I think, the attached code compiles. Thanks Remi, cheers /Joel diff --git a/src/share/classes/java/lang/reflect/Proxy.java b/src/share/classes/java/lang/reflect/Proxy.java --- a/src/share/classes/java/lang/reflect/Proxy.java +++ b/src/share/classes/java/lang/reflect/Proxy.java @@ -490,13 +490,14 @@ * a key used for proxy class with any number of implemented interfaces * (used here for 3 or more only) */ +@SuppressWarnings(unchecked) private static final class KeyX { private final int hash; private final WeakReferenceClass?[] refs; KeyX(Class?[] interfaces) { hash = Arrays.hashCode(interfaces); -refs = new WeakReference[interfaces.length]; +refs = (WeakReferenceClass?[]) new WeakReference?[interfaces.length]; for (int i = 0; i interfaces.length; i++) { refs[i] = new WeakReference(interfaces[i]); } On 2013-11-12, Remi Forax wrote: On 11/12/2013 10:51 AM, Chris Hegarty wrote: Looks ok to me Joe. -Chris. A small issue, refs = (WeakReferenceClass?[])new WeakReference[interfaces.length]; should be refs = (WeakReferenceClass?[])new WeakReference?[interfaces.length]; otherwise, looks good. Rémi On 12/11/13 09:28, Joe Darcy wrote: Hello, Please review the patch below which would remove another batch of raw type javac lint warnings from the core libraries. No signatures of public or protected methods in the Java SE specification have been modified. Regression tests in affected areas pass. Thanks, -Joe diff -r 9fcb07df1c92 src/share/classes/java/io/ObjectOutputStream.java --- a/src/share/classes/java/io/ObjectOutputStream.javaSat Nov 09 04:21:28 2013 +0400 +++ b/src/share/classes/java/io/ObjectOutputStream.javaTue Nov 12 00:51:15 2013 -0800 @@ -1248,7 +1248,7 @@ handles.assign(unshared ? null : desc); Class? cl = desc.forClass(); -Class[] ifaces = cl.getInterfaces(); +Class?[] ifaces = cl.getInterfaces(); bout.writeInt(ifaces.length); for (int i = 0; i ifaces.length; i++) { bout.writeUTF(ifaces[i].getName()); diff -r 9fcb07df1c92 src/share/classes/java/io/ObjectStreamClass.java --- a/src/share/classes/java/io/ObjectStreamClass.javaSat Nov 09 04:21:28 2013 +0400 +++ b/src/share/classes/java/io/ObjectStreamClass.javaTue Nov 12 00:51:15 2013 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -1746,7 +1746,7 @@ dout.writeUTF(()V); } -Constructor[] cons = cl.getDeclaredConstructors(); +Constructor?[] cons = cl.getDeclaredConstructors(); MemberSignature[] consSigs = new MemberSignature[cons.length]; for (int i = 0; i cons.length; i++) { consSigs[i] = new MemberSignature(cons[i]); diff -r 9fcb07df1c92 src/share/classes/java/lang/reflect/Proxy.java --- a/src/share/classes/java/lang/reflect/Proxy.javaSat Nov 09 04:21:28 2013 +0400 +++ b/src/share/classes/java/lang/reflect/Proxy.javaTue Nov 12 00:51:15 2013 -0800 @@ -494,9 +494,10 @@ private final int hash; private final WeakReferenceClass?[] refs; +@SuppressWarnings({rawtypes, unchecked}) KeyX(Class?[] interfaces) { hash = Arrays.hashCode(interfaces); -refs = new WeakReference[interfaces.length]; +refs = (WeakReferenceClass?[])new WeakReference[interfaces.length]; for (int i = 0; i interfaces.length; i++) { refs[i] = new WeakReference(interfaces[i]); } diff -r 9fcb07df1c92 src/share/classes/java/nio/file/TempFileHelper.java --- a/src/share/classes/java/nio/file/TempFileHelper.javaSat Nov 09 04:21:28 2013 +0400 +++ b/src/share/classes/java/nio/file/TempFileHelper.javaTue Nov 12 00:51:15 2013 -0800 @@ -81,7 +81,7 @@ String prefix, String suffix, boolean createDirectory, - FileAttribute[] attrs) + FileAttribute?[] attrs) throws IOException { if (prefix == null) @@ -155,7 +155,7 @@ static Path createTempFile(Path dir, String prefix, String suffix, - FileAttribute[] attrs) + FileAttribute?[] attrs) throws IOException {
Re: JDK 8 RFR: more core libs raw warnings cleanup
I'll push with this improvement; thanks, -Joe On 11/12/2013 04:20 AM, Joel Borggren-Franck wrote: This also allows you to get rid of the raw type suppression I think, the attached code compiles. Thanks Remi, cheers /Joel diff --git a/src/share/classes/java/lang/reflect/Proxy.java b/src/share/classes/java/lang/reflect/Proxy.java --- a/src/share/classes/java/lang/reflect/Proxy.java +++ b/src/share/classes/java/lang/reflect/Proxy.java @@ -490,13 +490,14 @@ * a key used for proxy class with any number of implemented interfaces * (used here for 3 or more only) */ +@SuppressWarnings(unchecked) private static final class KeyX { private final int hash; private final WeakReferenceClass?[] refs; KeyX(Class?[] interfaces) { hash = Arrays.hashCode(interfaces); -refs = new WeakReference[interfaces.length]; +refs = (WeakReferenceClass?[]) new WeakReference?[interfaces.length]; for (int i = 0; i interfaces.length; i++) { refs[i] = new WeakReference(interfaces[i]); } On 2013-11-12, Remi Forax wrote: On 11/12/2013 10:51 AM, Chris Hegarty wrote: Looks ok to me Joe. -Chris. A small issue, refs = (WeakReferenceClass?[])new WeakReference[interfaces.length]; should be refs = (WeakReferenceClass?[])new WeakReference?[interfaces.length]; otherwise, looks good. Rémi