8032616: Fix non-deprecation warnings in com.sun.beans.*
authordarcy
Fri, 24 Jan 2014 11:03:15 -0800
changeset 22577 64bb7e55d3c7
parent 22576 2bafb46a12c4
child 22578 ff8d54ac7c5c
8032616: Fix non-deprecation warnings in com.sun.beans.* Reviewed-by: alanb
jdk/src/share/classes/com/sun/beans/TypeResolver.java
jdk/src/share/classes/com/sun/beans/editors/EnumEditor.java
jdk/src/share/classes/com/sun/beans/finder/ConstructorFinder.java
jdk/src/share/classes/com/sun/beans/finder/InstanceFinder.java
jdk/src/share/classes/com/sun/beans/finder/SignatureException.java
jdk/src/share/classes/com/sun/beans/util/Cache.java
--- a/jdk/src/share/classes/com/sun/beans/TypeResolver.java	Fri Jan 24 19:18:17 2014 +0100
+++ b/jdk/src/share/classes/com/sun/beans/TypeResolver.java	Fri Jan 24 11:03:15 2014 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, 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
@@ -238,7 +238,7 @@
             return (Class<?>) pt.getRawType();
         }
         if (type instanceof TypeVariable) {
-            TypeVariable tv = (TypeVariable)type;
+            TypeVariable<?> tv = (TypeVariable<?>)type;
             Type[] bounds = tv.getBounds();
             return (0 < bounds.length)
                     ? erase(bounds[0])
@@ -267,9 +267,9 @@
      *
      * @see #erase(Type)
      */
-    public static Class[] erase(Type[] types) {
+    public static Class<?>[] erase(Type[] types) {
         int length = types.length;
-        Class[] classes = new Class[length];
+        Class<?>[] classes = new Class<?>[length];
         for (int i = 0; i < length; i++) {
             classes[i] = TypeResolver.erase(types[i]);
         }
--- a/jdk/src/share/classes/com/sun/beans/editors/EnumEditor.java	Fri Jan 24 19:18:17 2014 +0100
+++ b/jdk/src/share/classes/com/sun/beans/editors/EnumEditor.java	Fri Jan 24 11:03:15 2014 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2014, 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
@@ -45,17 +45,18 @@
 public final class EnumEditor implements PropertyEditor {
     private final List<PropertyChangeListener> listeners = new ArrayList<PropertyChangeListener>();
 
-    private final Class type;
+    @SuppressWarnings("rawtypes")
+    private final Class<? extends Enum> type;
     private final String[] tags;
 
     private Object value;
 
-    public EnumEditor( Class type ) {
+    public EnumEditor(Class<?> type) {
         Object[] values = type.getEnumConstants();
         if ( values == null ) {
             throw new IllegalArgumentException( "Unsupported " + type );
         }
-        this.type = type;
+        this.type = type.asSubclass(java.lang.Enum.class);
         this.tags = new String[values.length];
         for ( int i = 0; i < values.length; i++ ) {
             this.tags[i] = ( ( Enum )values[i] ).name();
@@ -98,9 +99,11 @@
     }
 
     public void setAsText( String text ) {
-        setValue( ( text != null )
-                ? Enum.valueOf( this.type, text )
-                : null );
+        @SuppressWarnings("unchecked")
+        Object tmp = ( text != null )
+            ? Enum.valueOf( (Class)this.type, text )
+            : null;
+        setValue(tmp);
     }
 
     public String[] getTags() {
--- a/jdk/src/share/classes/com/sun/beans/finder/ConstructorFinder.java	Fri Jan 24 19:18:17 2014 +0100
+++ b/jdk/src/share/classes/com/sun/beans/finder/ConstructorFinder.java	Fri Jan 24 11:03:15 2014 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2014, 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
@@ -44,7 +44,7 @@
 public final class ConstructorFinder extends AbstractFinder<Constructor<?>> {
     private static final Cache<Signature, Constructor<?>> CACHE = new Cache<Signature, Constructor<?>>(SOFT, SOFT) {
         @Override
-        public Constructor create(Signature signature) {
+        public Constructor<?> create(Signature signature) {
             try {
                 ConstructorFinder finder = new ConstructorFinder(signature.getArgs());
                 return finder.find(signature.getType().getConstructors());
--- a/jdk/src/share/classes/com/sun/beans/finder/InstanceFinder.java	Fri Jan 24 19:18:17 2014 +0100
+++ b/jdk/src/share/classes/com/sun/beans/finder/InstanceFinder.java	Fri Jan 24 11:03:15 2014 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2014, 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
@@ -93,7 +93,9 @@
                     type = ClassFinder.findClass(name, type.getClassLoader());
                 }
                 if (this.type.isAssignableFrom(type)) {
-                    return (T) type.newInstance();
+                    @SuppressWarnings("unchecked")
+                    T tmp = (T) type.newInstance();
+                    return tmp;
                 }
             }
             catch (Exception exception) {
--- a/jdk/src/share/classes/com/sun/beans/finder/SignatureException.java	Fri Jan 24 19:18:17 2014 +0100
+++ b/jdk/src/share/classes/com/sun/beans/finder/SignatureException.java	Fri Jan 24 11:03:15 2014 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2014, 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
@@ -25,6 +25,8 @@
 package com.sun.beans.finder;
 
 final class SignatureException extends RuntimeException {
+    private static final long serialVersionUID = 4536098341586118473L;
+
     SignatureException(Throwable cause) {
         super(cause);
     }
--- a/jdk/src/share/classes/com/sun/beans/util/Cache.java	Fri Jan 24 19:18:17 2014 +0100
+++ b/jdk/src/share/classes/com/sun/beans/util/Cache.java	Fri Jan 24 11:03:15 2014 -0800
@@ -244,7 +244,7 @@
      * @param size requested capacity MUST be a power of two
      * @return a new array for the cache entries
      */
-    @SuppressWarnings("unchecked")
+    @SuppressWarnings({"unchecked", "rawtypes"})
     private CacheEntry<K,V>[] newTable(int size) {
         return (CacheEntry<K,V>[]) new CacheEntry[size];
     }
@@ -265,6 +265,7 @@
             synchronized (this.queue) {
                 do {
                     if (reference instanceof Ref) {
+                        @SuppressWarnings("rawtypes")
                         Ref ref = (Ref) reference;
                         @SuppressWarnings("unchecked")
                         CacheEntry<K,V> owner = (CacheEntry<K,V>) ref.getOwner();