changeset 9167:78d907730378

8032616: Fix non-deprecation warnings in com.sun.beans.* Reviewed-by: alanb
author darcy
date Fri, 24 Jan 2014 11:03:15 -0800
parents c4cfefdbd6a7
children 73de11a22589
files src/share/classes/com/sun/beans/TypeResolver.java src/share/classes/com/sun/beans/editors/EnumEditor.java src/share/classes/com/sun/beans/finder/ConstructorFinder.java src/share/classes/com/sun/beans/finder/InstanceFinder.java src/share/classes/com/sun/beans/finder/SignatureException.java src/share/classes/com/sun/beans/util/Cache.java
diffstat 6 files changed, 25 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/com/sun/beans/TypeResolver.java	Fri Jan 24 19:18:17 2014 +0100
+++ b/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/src/share/classes/com/sun/beans/editors/EnumEditor.java	Fri Jan 24 19:18:17 2014 +0100
+++ b/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/src/share/classes/com/sun/beans/finder/ConstructorFinder.java	Fri Jan 24 19:18:17 2014 +0100
+++ b/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/src/share/classes/com/sun/beans/finder/InstanceFinder.java	Fri Jan 24 19:18:17 2014 +0100
+++ b/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/src/share/classes/com/sun/beans/finder/SignatureException.java	Fri Jan 24 19:18:17 2014 +0100
+++ b/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/src/share/classes/com/sun/beans/util/Cache.java	Fri Jan 24 19:18:17 2014 +0100
+++ b/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();