JDK RFR to clean-up lint warnings in reflection implementation

2013-11-08 Thread Joe Darcy

Hello,

Please review the simple patch below which addresses a handful of raw 
types lint warning in the core reflection implementation code.


(If memory serves, this code dates back from a time during the 
development of JDK 5 when wildcards could not be used with arrays; 
before the release shipped, that combination was allowed.)


Thanks,

-Joe

diff -r 46982ca895b4 
src/share/classes/sun/reflect/generics/reflectiveObjects/ParameterizedTypeImpl.java
--- 
a/src/share/classes/sun/reflect/generics/reflectiveObjects/ParameterizedTypeImpl.java 
Fri Nov 08 18:54:29 2013 +
+++ 
b/src/share/classes/sun/reflect/generics/reflectiveObjects/ParameterizedTypeImpl.java 
Fri Nov 08 11:37:54 2013 -0800

@@ -52,7 +52,7 @@
 }

 private void validateConstructorArguments() {
-TypeVariable/*?*/[] formals = rawType.getTypeParameters();
+TypeVariable?[] formals = rawType.getTypeParameters();
 // check correct arity of actual type args
 if (formals.length != actualTypeArguments.length){
 throw new MalformedParameterizedTypeException();
diff -r 46982ca895b4 
src/share/classes/sun/reflect/generics/repository/GenericDeclRepository.java
--- 
a/src/share/classes/sun/reflect/generics/repository/GenericDeclRepository.java 
Fri Nov 08 18:54:29 2013 +
+++ 
b/src/share/classes/sun/reflect/generics/repository/GenericDeclRepository.java 
Fri Nov 08 11:37:54 2013 -0800

@@ -42,7 +42,7 @@
 public abstract class GenericDeclRepositoryS extends Signature
 extends AbstractRepositoryS {

-private TypeVariable[] typeParams; // caches the formal type parameters
+private TypeVariable?[] typeParams; // caches the formal type 
parameters


 protected GenericDeclRepository(String rawSig, GenericsFactory f) {
 super(rawSig, f);
@@ -64,7 +64,7 @@
  * Return the formal type parameters of this generic declaration.
  * @return the formal type parameters of this generic declaration
  */
-public TypeVariable/*?*/[] getTypeParameters(){
+public TypeVariable?[] getTypeParameters(){
 if (typeParams == null) { // lazily initialize type parameters
 // first, extract type parameter subtree(s) from AST
 FormalTypeParameter[] ftps = 
getTree().getFormalTypeParameters();




Re: JDK RFR to clean-up lint warnings in reflection implementation

2013-11-08 Thread Lance Andersen - Oracle
looks fine Joe
On Nov 8, 2013, at 2:40 PM, Joe Darcy wrote:

 Hello,
 
 Please review the simple patch below which addresses a handful of raw types 
 lint warning in the core reflection implementation code.
 
 (If memory serves, this code dates back from a time during the development of 
 JDK 5 when wildcards could not be used with arrays; before the release 
 shipped, that combination was allowed.)
 
 Thanks,
 
 -Joe
 
 diff -r 46982ca895b4 
 src/share/classes/sun/reflect/generics/reflectiveObjects/ParameterizedTypeImpl.java
 --- 
 a/src/share/classes/sun/reflect/generics/reflectiveObjects/ParameterizedTypeImpl.java
  Fri Nov 08 18:54:29 2013 +
 +++ 
 b/src/share/classes/sun/reflect/generics/reflectiveObjects/ParameterizedTypeImpl.java
  Fri Nov 08 11:37:54 2013 -0800
 @@ -52,7 +52,7 @@
 }
 
 private void validateConstructorArguments() {
 -TypeVariable/*?*/[] formals = rawType.getTypeParameters();
 +TypeVariable?[] formals = rawType.getTypeParameters();
 // check correct arity of actual type args
 if (formals.length != actualTypeArguments.length){
 throw new MalformedParameterizedTypeException();
 diff -r 46982ca895b4 
 src/share/classes/sun/reflect/generics/repository/GenericDeclRepository.java
 --- 
 a/src/share/classes/sun/reflect/generics/repository/GenericDeclRepository.java
  Fri Nov 08 18:54:29 2013 +
 +++ 
 b/src/share/classes/sun/reflect/generics/repository/GenericDeclRepository.java
  Fri Nov 08 11:37:54 2013 -0800
 @@ -42,7 +42,7 @@
 public abstract class GenericDeclRepositoryS extends Signature
 extends AbstractRepositoryS {
 
 -private TypeVariable[] typeParams; // caches the formal type parameters
 +private TypeVariable?[] typeParams; // caches the formal type 
 parameters
 
 protected GenericDeclRepository(String rawSig, GenericsFactory f) {
 super(rawSig, f);
 @@ -64,7 +64,7 @@
  * Return the formal type parameters of this generic declaration.
  * @return the formal type parameters of this generic declaration
  */
 -public TypeVariable/*?*/[] getTypeParameters(){
 +public TypeVariable?[] getTypeParameters(){
 if (typeParams == null) { // lazily initialize type parameters
 // first, extract type parameter subtree(s) from AST
 FormalTypeParameter[] ftps = getTree().getFormalTypeParameters();
 


Lance Andersen| Principal Member of Technical Staff | +1.781.442.2037
Oracle Java Engineering 
1 Network Drive 
Burlington, MA 01803
lance.ander...@oracle.com



Re: JDK RFR to clean-up lint warnings in reflection implementation

2013-11-08 Thread Alan Bateman

On 08/11/2013 19:40, Joe Darcy wrote:

Hello,

Please review the simple patch below which addresses a handful of raw 
types lint warning in the core reflection implementation code.


(If memory serves, this code dates back from a time during the 
development of JDK 5 when wildcards could not be used with arrays; 
before the release shipped, that combination was allowed.)
This looks okay to me (and I think we have the same thing in a few other 
areas).


-Alan


Re: JDK RFR to clean-up lint warnings in reflection implementation

2013-11-08 Thread Joe Darcy

On 11/08/2013 12:06 PM, Alan Bateman wrote:

On 08/11/2013 19:40, Joe Darcy wrote:

Hello,

Please review the simple patch below which addresses a handful of raw 
types lint warning in the core reflection implementation code.


(If memory serves, this code dates back from a time during the 
development of JDK 5 when wildcards could not be used with arrays; 
before the release shipped, that combination was allowed.)
This looks okay to me (and I think we have the same thing in a few 
other areas).





Hi Alan,

Yes; over 1/3 of the remaining lint warnings in core-libs are for the 
use of raw types. There are many uses of Class or Class[] instead of 
Class? or Class?[].


-Joe


Re: JDK RFR to clean-up lint warnings in reflection implementation

2013-11-08 Thread Joel Borggrén-Franck
Looks good Joe.

cheers
/Joel

On 8 nov 2013, at 20:40, Joe Darcy joe.da...@oracle.com wrote:

 Hello,
 
 Please review the simple patch below which addresses a handful of raw types 
 lint warning in the core reflection implementation code.
 
 (If memory serves, this code dates back from a time during the development of 
 JDK 5 when wildcards could not be used with arrays; before the release 
 shipped, that combination was allowed.)
 
 Thanks,
 
 -Joe
 
 diff -r 46982ca895b4 
 src/share/classes/sun/reflect/generics/reflectiveObjects/ParameterizedTypeImpl.java
 --- 
 a/src/share/classes/sun/reflect/generics/reflectiveObjects/ParameterizedTypeImpl.java
  Fri Nov 08 18:54:29 2013 +
 +++ 
 b/src/share/classes/sun/reflect/generics/reflectiveObjects/ParameterizedTypeImpl.java
  Fri Nov 08 11:37:54 2013 -0800
 @@ -52,7 +52,7 @@
 }
 
 private void validateConstructorArguments() {
 -TypeVariable/*?*/[] formals = rawType.getTypeParameters();
 +TypeVariable?[] formals = rawType.getTypeParameters();
 // check correct arity of actual type args
 if (formals.length != actualTypeArguments.length){
 throw new MalformedParameterizedTypeException();
 diff -r 46982ca895b4 
 src/share/classes/sun/reflect/generics/repository/GenericDeclRepository.java
 --- 
 a/src/share/classes/sun/reflect/generics/repository/GenericDeclRepository.java
  Fri Nov 08 18:54:29 2013 +
 +++ 
 b/src/share/classes/sun/reflect/generics/repository/GenericDeclRepository.java
  Fri Nov 08 11:37:54 2013 -0800
 @@ -42,7 +42,7 @@
 public abstract class GenericDeclRepositoryS extends Signature
 extends AbstractRepositoryS {
 
 -private TypeVariable[] typeParams; // caches the formal type parameters
 +private TypeVariable?[] typeParams; // caches the formal type 
 parameters
 
 protected GenericDeclRepository(String rawSig, GenericsFactory f) {
 super(rawSig, f);
 @@ -64,7 +64,7 @@
  * Return the formal type parameters of this generic declaration.
  * @return the formal type parameters of this generic declaration
  */
 -public TypeVariable/*?*/[] getTypeParameters(){
 +public TypeVariable?[] getTypeParameters(){
 if (typeParams == null) { // lazily initialize type parameters
 // first, extract type parameter subtree(s) from AST
 FormalTypeParameter[] ftps = getTree().getFormalTypeParameters();