8032616: Fix non-deprecation warnings in com.sun.beans.*

Reviewed-by: alanb
This commit is contained in:
Joe Darcy 2014-01-24 11:03:15 -08:00
parent c329a619fd
commit d1fc6d132c
6 changed files with 25 additions and 17 deletions

View File

@ -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 @@ public final class TypeResolver {
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 @@ public final class TypeResolver {
*
* @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]);
}

View File

@ -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 @@ import java.util.List;
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 final class EnumEditor implements PropertyEditor {
}
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() {

View File

@ -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 @@ import static sun.reflect.misc.ReflectUtil.isPackageAccessible;
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());

View File

@ -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 @@ class InstanceFinder<T> {
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) {

View File

@ -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);
}

View File

@ -244,7 +244,7 @@ public abstract class Cache<K,V> {
* @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 @@ public abstract class Cache<K,V> {
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();