mirror of
https://github.com/openjdk/jdk.git
synced 2026-05-18 17:37:53 +00:00
8042860: Fix raw and unchecked warnings in java.beans
Reviewed-by: malenkov, alanb, mduigou
This commit is contained in:
parent
333b1ed5ba
commit
faa3d72cb0
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 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
|
||||
@ -446,7 +446,7 @@ public class EventHandler implements InvocationHandler {
|
||||
}
|
||||
|
||||
if (listenerMethodName == null || listenerMethodName.equals(methodName)) {
|
||||
Class[] argTypes = null;
|
||||
Class<?>[] argTypes = null;
|
||||
Object[] newArgs = null;
|
||||
|
||||
if (eventPropertyName == null) { // Nullary method.
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1996, 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
|
||||
@ -81,7 +81,7 @@ public class EventSetDescriptor extends FeatureDescriptor {
|
||||
String eventName = NameGenerator.capitalize(eventSetName) + "Event";
|
||||
Method[] listenerMethods = getListenerMethods();
|
||||
if (listenerMethods.length > 0) {
|
||||
Class[] args = getParameterTypes(getClass0(), listenerMethods[0]);
|
||||
Class<?>[] args = getParameterTypes(getClass0(), listenerMethods[0]);
|
||||
// Check for EventSet compliance. Special case for vetoableChange. See 4529996
|
||||
if (!"vetoableChange".equals(eventSetName) && !args[0].getName().endsWith(eventName)) {
|
||||
throw new IntrospectionException("Method \"" + listenerMethodName +
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1996, 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
|
||||
@ -353,7 +353,7 @@ public class IndexedPropertyDescriptor extends PropertyDescriptor {
|
||||
Class<?> indexedPropertyType = null;
|
||||
|
||||
if (indexedReadMethod != null) {
|
||||
Class params[] = getParameterTypes(getClass0(), indexedReadMethod);
|
||||
Class<?>[] params = getParameterTypes(getClass0(), indexedReadMethod);
|
||||
if (params.length != 1) {
|
||||
throw new IntrospectionException("bad indexed read method arg count");
|
||||
}
|
||||
@ -366,7 +366,7 @@ public class IndexedPropertyDescriptor extends PropertyDescriptor {
|
||||
}
|
||||
}
|
||||
if (indexedWriteMethod != null) {
|
||||
Class params[] = getParameterTypes(getClass0(), indexedWriteMethod);
|
||||
Class<?>[] params = getParameterTypes(getClass0(), indexedWriteMethod);
|
||||
if (params.length != 2) {
|
||||
throw new IntrospectionException("bad indexed write method arg count");
|
||||
}
|
||||
|
||||
@ -1384,7 +1384,7 @@ public class Introspector {
|
||||
* parameter list on a given class.
|
||||
*/
|
||||
private static Method internalFindMethod(Class<?> start, String methodName,
|
||||
int argCount, Class args[]) {
|
||||
int argCount, Class<?> args[]) {
|
||||
// For overriden methods we need to find the most derived version.
|
||||
// So we start with the given class and walk up the superclass chain.
|
||||
|
||||
@ -1426,7 +1426,7 @@ public class Introspector {
|
||||
// Now check any inherited interfaces. This is necessary both when
|
||||
// the argument class is itself an interface, and when the argument
|
||||
// class is an abstract class.
|
||||
Class ifcs[] = start.getInterfaces();
|
||||
Class<?>[] ifcs = start.getInterfaces();
|
||||
for (int i = 0 ; i < ifcs.length; i++) {
|
||||
// Note: The original implementation had both methods calling
|
||||
// the 3 arg method. This is preserved but perhaps it should
|
||||
@ -1459,7 +1459,7 @@ public class Introspector {
|
||||
* @return the method or null if not found
|
||||
*/
|
||||
static Method findMethod(Class<?> cls, String methodName, int argCount,
|
||||
Class args[]) {
|
||||
Class<?>[] args) {
|
||||
if (methodName == null) {
|
||||
return null;
|
||||
}
|
||||
@ -1502,7 +1502,7 @@ public class Introspector {
|
||||
* Return true iff the given method throws the given exception.
|
||||
*/
|
||||
private boolean throwsException(Method method, Class<?> exception) {
|
||||
Class exs[] = method.getExceptionTypes();
|
||||
Class<?>[] exs = method.getExceptionTypes();
|
||||
for (int i = 0; i < exs.length; i++) {
|
||||
if (exs[i] == exception) {
|
||||
return true;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 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
|
||||
@ -1401,7 +1401,7 @@ static final class sun_swing_PrintColorUIResource_PersistenceDelegate extends Pe
|
||||
}
|
||||
|
||||
private static boolean isValid(Constructor<?> constructor, String[] names) {
|
||||
Class[] parameters = constructor.getParameterTypes();
|
||||
Class<?>[] parameters = constructor.getParameterTypes();
|
||||
if (names.length != parameters.length) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1996, 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
|
||||
@ -112,7 +112,7 @@ public class PropertyDescriptor extends FeatureDescriptor {
|
||||
// If this class or one of its base classes allow PropertyChangeListener,
|
||||
// then we assume that any properties we discover are "bound".
|
||||
// See Introspector.getTargetPropertyInfo() method.
|
||||
Class[] args = { PropertyChangeListener.class };
|
||||
Class<?>[] args = { PropertyChangeListener.class };
|
||||
this.bound = null != Introspector.findMethod(beanClass, "addPropertyChangeListener", args.length, args);
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2009, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1998, 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
|
||||
@ -47,7 +47,7 @@ public class BeanContextServiceAvailableEvent extends BeanContextEvent {
|
||||
* @param bcs The context in which the service has become available
|
||||
* @param sc A <code>Class</code> reference to the newly available service
|
||||
*/
|
||||
public BeanContextServiceAvailableEvent(BeanContextServices bcs, Class sc) {
|
||||
public BeanContextServiceAvailableEvent(BeanContextServices bcs, Class<?> sc) {
|
||||
super((BeanContext)bcs);
|
||||
|
||||
serviceClass = sc;
|
||||
@ -65,13 +65,13 @@ public class BeanContextServiceAvailableEvent extends BeanContextEvent {
|
||||
* Gets the service class that is the subject of this notification.
|
||||
* @return A <code>Class</code> reference to the newly available service
|
||||
*/
|
||||
public Class getServiceClass() { return serviceClass; }
|
||||
public Class<?> getServiceClass() { return serviceClass; }
|
||||
|
||||
/**
|
||||
* Gets the list of service dependent selectors.
|
||||
* @return the current selectors available from the service
|
||||
*/
|
||||
public Iterator getCurrentServiceSelectors() {
|
||||
public Iterator<?> getCurrentServiceSelectors() {
|
||||
return ((BeanContextServices)getSource()).getCurrentServiceSelectors(serviceClass);
|
||||
}
|
||||
|
||||
@ -82,5 +82,5 @@ public class BeanContextServiceAvailableEvent extends BeanContextEvent {
|
||||
/**
|
||||
* A <code>Class</code> reference to the newly available service
|
||||
*/
|
||||
protected Class serviceClass;
|
||||
protected Class<?> serviceClass;
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2004, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1998, 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
|
||||
@ -70,7 +70,7 @@ public interface BeanContextServiceProvider {
|
||||
*
|
||||
* @return a reference to the requested service
|
||||
*/
|
||||
Object getService(BeanContextServices bcs, Object requestor, Class serviceClass, Object serviceSelector);
|
||||
Object getService(BeanContextServices bcs, Object requestor, Class<?> serviceClass, Object serviceSelector);
|
||||
|
||||
/**
|
||||
* Invoked by <code>BeanContextServices</code>,
|
||||
@ -100,5 +100,5 @@ public interface BeanContextServiceProvider {
|
||||
* @param serviceClass the specified service
|
||||
* @return the current service selectors for the specified serviceClass
|
||||
*/
|
||||
Iterator getCurrentServiceSelectors(BeanContextServices bcs, Class serviceClass);
|
||||
Iterator<?> getCurrentServiceSelectors(BeanContextServices bcs, Class<?> serviceClass);
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2009, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1998, 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
|
||||
@ -46,7 +46,7 @@ public class BeanContextServiceRevokedEvent extends BeanContextEvent {
|
||||
* @param sc the service that is being revoked
|
||||
* @param invalidate <code>true</code> for immediate revocation
|
||||
*/
|
||||
public BeanContextServiceRevokedEvent(BeanContextServices bcs, Class sc, boolean invalidate) {
|
||||
public BeanContextServiceRevokedEvent(BeanContextServices bcs, Class<?> sc, boolean invalidate) {
|
||||
super((BeanContext)bcs);
|
||||
|
||||
serviceClass = sc;
|
||||
@ -67,7 +67,7 @@ public class BeanContextServiceRevokedEvent extends BeanContextEvent {
|
||||
* @return A <code>Class</code> reference to the
|
||||
* service that is being revoked
|
||||
*/
|
||||
public Class getServiceClass() { return serviceClass; }
|
||||
public Class<?> getServiceClass() { return serviceClass; }
|
||||
|
||||
/**
|
||||
* Checks this event to determine whether or not
|
||||
@ -76,7 +76,7 @@ public class BeanContextServiceRevokedEvent extends BeanContextEvent {
|
||||
* @return <code>true</code> if the service being revoked is of the
|
||||
* same class as the specified service
|
||||
*/
|
||||
public boolean isServiceClass(Class service) {
|
||||
public boolean isServiceClass(Class<?> service) {
|
||||
return serviceClass.equals(service);
|
||||
}
|
||||
|
||||
@ -94,6 +94,6 @@ public class BeanContextServiceRevokedEvent extends BeanContextEvent {
|
||||
/**
|
||||
* A <code>Class</code> reference to the service that is being revoked.
|
||||
*/
|
||||
protected Class serviceClass;
|
||||
protected Class<?> serviceClass;
|
||||
private boolean invalidateRefs;
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1998, 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
|
||||
@ -62,7 +62,7 @@ public interface BeanContextServices extends BeanContext, BeanContextServicesLis
|
||||
* associated with the service
|
||||
* @return true if the service was successful added, false otherwise
|
||||
*/
|
||||
boolean addService(Class serviceClass, BeanContextServiceProvider serviceProvider);
|
||||
boolean addService(Class<?> serviceClass, BeanContextServiceProvider serviceProvider);
|
||||
|
||||
/**
|
||||
* BeanContextServiceProviders wishing to remove
|
||||
@ -83,7 +83,7 @@ public interface BeanContextServices extends BeanContext, BeanContextServicesLis
|
||||
* terminate service to all currently outstanding references
|
||||
* to the specified service.
|
||||
*/
|
||||
void revokeService(Class serviceClass, BeanContextServiceProvider serviceProvider, boolean revokeCurrentServicesNow);
|
||||
void revokeService(Class<?> serviceClass, BeanContextServiceProvider serviceProvider, boolean revokeCurrentServicesNow);
|
||||
|
||||
/**
|
||||
* Reports whether or not a given service is
|
||||
@ -91,7 +91,7 @@ public interface BeanContextServices extends BeanContext, BeanContextServicesLis
|
||||
* @param serviceClass the service in question
|
||||
* @return true if the service is available
|
||||
*/
|
||||
boolean hasService(Class serviceClass);
|
||||
boolean hasService(Class<?> serviceClass);
|
||||
|
||||
/**
|
||||
* A <code>BeanContextChild</code>, or any arbitrary object
|
||||
@ -113,7 +113,7 @@ public interface BeanContextServices extends BeanContext, BeanContextServicesLis
|
||||
* @return a reference to this context's named
|
||||
* Service as requested or <code>null</code>
|
||||
*/
|
||||
Object getService(BeanContextChild child, Object requestor, Class serviceClass, Object serviceSelector, BeanContextServiceRevokedListener bcsrl) throws TooManyListenersException;
|
||||
Object getService(BeanContextChild child, Object requestor, Class<?> serviceClass, Object serviceSelector, BeanContextServiceRevokedListener bcsrl) throws TooManyListenersException;
|
||||
|
||||
/**
|
||||
* Releases a <code>BeanContextChild</code>'s
|
||||
@ -131,7 +131,7 @@ public interface BeanContextServices extends BeanContext, BeanContextServicesLis
|
||||
* @return an <code>Iterator</code> consisting of the
|
||||
* currently available services
|
||||
*/
|
||||
Iterator getCurrentServiceClasses();
|
||||
Iterator<?> getCurrentServiceClasses();
|
||||
|
||||
/**
|
||||
* Gets the list of service dependent service parameters
|
||||
@ -142,7 +142,7 @@ public interface BeanContextServices extends BeanContext, BeanContextServicesLis
|
||||
* @return the currently available service selectors
|
||||
* for the named serviceClass
|
||||
*/
|
||||
Iterator getCurrentServiceSelectors(Class serviceClass);
|
||||
Iterator<?> getCurrentServiceSelectors(Class<?> serviceClass);
|
||||
|
||||
/**
|
||||
* Adds a <code>BeanContextServicesListener</code> to this BeanContext
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1998, 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
|
||||
@ -129,9 +129,8 @@ public class BeanContextServicesSupport extends BeanContextSupport
|
||||
|
||||
public void initialize() {
|
||||
super.initialize();
|
||||
|
||||
services = new HashMap(serializable + 1);
|
||||
bcsListeners = new ArrayList(1);
|
||||
services = new HashMap<>(serializable + 1);
|
||||
bcsListeners = new ArrayList<>(1);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -169,7 +168,7 @@ public class BeanContextServicesSupport extends BeanContextSupport
|
||||
|
||||
// create an instance of a service ref
|
||||
|
||||
BCSSCServiceClassRef(Class sc, BeanContextServiceProvider bcsp, boolean delegated) {
|
||||
BCSSCServiceClassRef(Class<?> sc, BeanContextServiceProvider bcsp, boolean delegated) {
|
||||
super();
|
||||
|
||||
serviceClass = sc;
|
||||
@ -183,7 +182,7 @@ public class BeanContextServicesSupport extends BeanContextSupport
|
||||
// add a requestor and assoc listener
|
||||
|
||||
void addRequestor(Object requestor, BeanContextServiceRevokedListener bcsrl) throws TooManyListenersException {
|
||||
BeanContextServiceRevokedListener cbcsrl = (BeanContextServiceRevokedListener)requestors.get(requestor);
|
||||
BeanContextServiceRevokedListener cbcsrl = requestors.get(requestor);
|
||||
|
||||
if (cbcsrl != null && !cbcsrl.equals(bcsrl))
|
||||
throw new TooManyListenersException();
|
||||
@ -200,7 +199,7 @@ public class BeanContextServicesSupport extends BeanContextSupport
|
||||
// check a requestors listener
|
||||
|
||||
void verifyRequestor(Object requestor, BeanContextServiceRevokedListener bcsrl) throws TooManyListenersException {
|
||||
BeanContextServiceRevokedListener cbcsrl = (BeanContextServiceRevokedListener)requestors.get(requestor);
|
||||
BeanContextServiceRevokedListener cbcsrl = requestors.get(requestor);
|
||||
|
||||
if (cbcsrl != null && !cbcsrl.equals(bcsrl))
|
||||
throw new TooManyListenersException();
|
||||
@ -230,15 +229,18 @@ public class BeanContextServicesSupport extends BeanContextSupport
|
||||
|
||||
}
|
||||
|
||||
Iterator cloneOfEntries() {
|
||||
return ((HashMap)requestors.clone()).entrySet().iterator();
|
||||
@SuppressWarnings("unchecked") // Cast from clone
|
||||
Iterator<Map.Entry<Object, BeanContextServiceRevokedListener>> cloneOfEntries() {
|
||||
return ((HashMap<Object, BeanContextServiceRevokedListener>)requestors.clone()).entrySet().iterator();
|
||||
}
|
||||
|
||||
Iterator entries() { return requestors.entrySet().iterator(); }
|
||||
Iterator<Map.Entry<Object, BeanContextServiceRevokedListener>> entries() {
|
||||
return requestors.entrySet().iterator();
|
||||
}
|
||||
|
||||
boolean isEmpty() { return requestors.isEmpty(); }
|
||||
|
||||
Class getServiceClass() { return serviceClass; }
|
||||
Class<?> getServiceClass() { return serviceClass; }
|
||||
|
||||
BeanContextServiceProvider getServiceProvider() {
|
||||
return serviceProvider;
|
||||
@ -281,7 +283,7 @@ public class BeanContextServicesSupport extends BeanContextSupport
|
||||
* fields
|
||||
*/
|
||||
|
||||
Class serviceClass;
|
||||
Class<?> serviceClass;
|
||||
|
||||
BeanContextServiceProvider serviceProvider;
|
||||
int serviceRefs;
|
||||
@ -289,7 +291,7 @@ public class BeanContextServicesSupport extends BeanContextSupport
|
||||
BeanContextServiceProvider delegateProvider; // proxy
|
||||
int delegateRefs;
|
||||
|
||||
HashMap requestors = new HashMap(1);
|
||||
HashMap<Object, BeanContextServiceRevokedListener> requestors = new HashMap<>(1);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -322,16 +324,16 @@ public class BeanContextServicesSupport extends BeanContextSupport
|
||||
|
||||
// note usage of service per requestor, per service
|
||||
|
||||
synchronized void usingService(Object requestor, Object service, Class serviceClass, BeanContextServiceProvider bcsp, boolean isDelegated, BeanContextServiceRevokedListener bcsrl) throws TooManyListenersException, UnsupportedOperationException {
|
||||
synchronized void usingService(Object requestor, Object service, Class<?> serviceClass, BeanContextServiceProvider bcsp, boolean isDelegated, BeanContextServiceRevokedListener bcsrl) throws TooManyListenersException, UnsupportedOperationException {
|
||||
|
||||
// first, process mapping from serviceClass to requestor(s)
|
||||
|
||||
BCSSCServiceClassRef serviceClassRef = null;
|
||||
|
||||
if (serviceClasses == null)
|
||||
serviceClasses = new HashMap(1);
|
||||
serviceClasses = new HashMap<>(1);
|
||||
else
|
||||
serviceClassRef = (BCSSCServiceClassRef)serviceClasses.get(serviceClass);
|
||||
serviceClassRef = serviceClasses.get(serviceClass);
|
||||
|
||||
if (serviceClassRef == null) { // new service being used ...
|
||||
serviceClassRef = new BCSSCServiceClassRef(serviceClass, bcsp, isDelegated);
|
||||
@ -348,20 +350,20 @@ public class BeanContextServicesSupport extends BeanContextSupport
|
||||
// now handle mapping from requestor to service(s)
|
||||
|
||||
BCSSCServiceRef serviceRef = null;
|
||||
Map services = null;
|
||||
Map<Object , BCSSCServiceRef> services = null;
|
||||
|
||||
if (serviceRequestors == null) {
|
||||
serviceRequestors = new HashMap(1);
|
||||
serviceRequestors = new HashMap<>(1);
|
||||
} else {
|
||||
services = (Map)serviceRequestors.get(requestor);
|
||||
services = serviceRequestors.get(requestor);
|
||||
}
|
||||
|
||||
if (services == null) {
|
||||
services = new HashMap(1);
|
||||
services = new HashMap<>(1);
|
||||
|
||||
serviceRequestors.put(requestor, services);
|
||||
} else
|
||||
serviceRef = (BCSSCServiceRef)services.get(service);
|
||||
serviceRef = services.get(service);
|
||||
|
||||
if (serviceRef == null) {
|
||||
serviceRef = new BCSSCServiceRef(serviceClassRef, isDelegated);
|
||||
@ -377,11 +379,11 @@ public class BeanContextServicesSupport extends BeanContextSupport
|
||||
synchronized void releaseService(Object requestor, Object service) {
|
||||
if (serviceRequestors == null) return;
|
||||
|
||||
Map services = (Map)serviceRequestors.get(requestor);
|
||||
Map<Object, BCSSCServiceRef> services = serviceRequestors.get(requestor);
|
||||
|
||||
if (services == null) return; // oops its not there anymore!
|
||||
|
||||
BCSSCServiceRef serviceRef = (BCSSCServiceRef)services.get(service);
|
||||
BCSSCServiceRef serviceRef = services.get(service);
|
||||
|
||||
if (serviceRef == null) return; // oops its not there anymore!
|
||||
|
||||
@ -418,33 +420,33 @@ public class BeanContextServicesSupport extends BeanContextSupport
|
||||
|
||||
// revoke a service
|
||||
|
||||
synchronized void revokeService(Class serviceClass, boolean isDelegated, boolean revokeNow) {
|
||||
synchronized void revokeService(Class<?> serviceClass, boolean isDelegated, boolean revokeNow) {
|
||||
if (serviceClasses == null) return;
|
||||
|
||||
BCSSCServiceClassRef serviceClassRef = (BCSSCServiceClassRef)serviceClasses.get(serviceClass);
|
||||
BCSSCServiceClassRef serviceClassRef = serviceClasses.get(serviceClass);
|
||||
|
||||
if (serviceClassRef == null) return;
|
||||
|
||||
Iterator i = serviceClassRef.cloneOfEntries();
|
||||
Iterator<Map.Entry<Object, BeanContextServiceRevokedListener>> i = serviceClassRef.cloneOfEntries();
|
||||
|
||||
BeanContextServiceRevokedEvent bcsre = new BeanContextServiceRevokedEvent(BeanContextServicesSupport.this.getBeanContextServicesPeer(), serviceClass, revokeNow);
|
||||
boolean noMoreRefs = false;
|
||||
|
||||
while (i.hasNext() && serviceRequestors != null) {
|
||||
Map.Entry entry = (Map.Entry)i.next();
|
||||
BeanContextServiceRevokedListener listener = (BeanContextServiceRevokedListener)entry.getValue();
|
||||
Map.Entry<Object,BeanContextServiceRevokedListener> entry = i.next();
|
||||
BeanContextServiceRevokedListener listener = entry.getValue();
|
||||
|
||||
if (revokeNow) {
|
||||
Object requestor = entry.getKey();
|
||||
Map services = (Map)serviceRequestors.get(requestor);
|
||||
Map<Object, BCSSCServiceRef> services = serviceRequestors.get(requestor);
|
||||
|
||||
if (services != null) {
|
||||
Iterator i1 = services.entrySet().iterator();
|
||||
Iterator<Map.Entry<Object, BCSSCServiceRef>> i1 = services.entrySet().iterator();
|
||||
|
||||
while (i1.hasNext()) {
|
||||
Map.Entry tmp = (Map.Entry)i1.next();
|
||||
Map.Entry<Object, BCSSCServiceRef> tmp = i1.next();
|
||||
|
||||
BCSSCServiceRef serviceRef = (BCSSCServiceRef)tmp.getValue();
|
||||
BCSSCServiceRef serviceRef = tmp.getValue();
|
||||
if (serviceRef.getServiceClassRef().equals(serviceClassRef) && isDelegated == serviceRef.isDelegated()) {
|
||||
i1.remove();
|
||||
}
|
||||
@ -479,19 +481,19 @@ public class BeanContextServicesSupport extends BeanContextSupport
|
||||
|
||||
if (serviceRequestors == null) return;
|
||||
|
||||
Iterator requestors = serviceRequestors.entrySet().iterator();
|
||||
Iterator<Map.Entry<Object, Map<Object, BCSSCServiceRef>>> requestors = serviceRequestors.entrySet().iterator();
|
||||
|
||||
while(requestors.hasNext()) {
|
||||
Map.Entry tmp = (Map.Entry)requestors.next();
|
||||
Map.Entry<Object, Map<Object, BCSSCServiceRef>> tmp = requestors.next();
|
||||
Object requestor = tmp.getKey();
|
||||
Iterator services = ((Map)tmp.getValue()).entrySet().iterator();
|
||||
Iterator<Map.Entry<Object, BCSSCServiceRef>> services = tmp.getValue().entrySet().iterator();
|
||||
|
||||
requestors.remove();
|
||||
|
||||
while (services.hasNext()) {
|
||||
Map.Entry entry = (Map.Entry)services.next();
|
||||
Map.Entry<Object, BCSSCServiceRef> entry = services.next();
|
||||
Object service = entry.getKey();
|
||||
BCSSCServiceRef sref = (BCSSCServiceRef)entry.getValue();
|
||||
BCSSCServiceRef sref = entry.getValue();
|
||||
|
||||
BCSSCServiceClassRef scref = sref.getServiceClassRef();
|
||||
|
||||
@ -513,32 +515,32 @@ public class BeanContextServicesSupport extends BeanContextSupport
|
||||
void revokeAllDelegatedServicesNow() {
|
||||
if (serviceClasses == null) return;
|
||||
|
||||
Iterator serviceClassRefs =
|
||||
new HashSet(serviceClasses.values()).iterator();
|
||||
Iterator<BCSSCServiceClassRef> serviceClassRefs =
|
||||
new HashSet<>(serviceClasses.values()).iterator();
|
||||
|
||||
while (serviceClassRefs.hasNext()) {
|
||||
BCSSCServiceClassRef serviceClassRef = (BCSSCServiceClassRef)serviceClassRefs.next();
|
||||
BCSSCServiceClassRef serviceClassRef = serviceClassRefs.next();
|
||||
|
||||
if (!serviceClassRef.isDelegated()) continue;
|
||||
|
||||
Iterator i = serviceClassRef.cloneOfEntries();
|
||||
Iterator<Map.Entry<Object, BeanContextServiceRevokedListener>> i = serviceClassRef.cloneOfEntries();
|
||||
BeanContextServiceRevokedEvent bcsre = new BeanContextServiceRevokedEvent(BeanContextServicesSupport.this.getBeanContextServicesPeer(), serviceClassRef.getServiceClass(), true);
|
||||
boolean noMoreRefs = false;
|
||||
|
||||
while (i.hasNext()) {
|
||||
Map.Entry entry = (Map.Entry)i.next();
|
||||
BeanContextServiceRevokedListener listener = (BeanContextServiceRevokedListener)entry.getValue();
|
||||
Map.Entry<Object, BeanContextServiceRevokedListener> entry = i.next();
|
||||
BeanContextServiceRevokedListener listener = entry.getValue();
|
||||
|
||||
Object requestor = entry.getKey();
|
||||
Map services = (Map)serviceRequestors.get(requestor);
|
||||
Map<Object, BCSSCServiceRef> services = serviceRequestors.get(requestor);
|
||||
|
||||
if (services != null) {
|
||||
Iterator i1 = services.entrySet().iterator();
|
||||
Iterator<Map.Entry<Object, BCSSCServiceRef>> i1 = services.entrySet().iterator();
|
||||
|
||||
while (i1.hasNext()) {
|
||||
Map.Entry tmp = (Map.Entry)i1.next();
|
||||
Map.Entry<Object, BCSSCServiceRef> tmp = i1.next();
|
||||
|
||||
BCSSCServiceRef serviceRef = (BCSSCServiceRef)tmp.getValue();
|
||||
BCSSCServiceRef serviceRef = tmp.getValue();
|
||||
if (serviceRef.getServiceClassRef().equals(serviceClassRef) && serviceRef.isDelegated()) {
|
||||
i1.remove();
|
||||
}
|
||||
@ -568,8 +570,8 @@ public class BeanContextServicesSupport extends BeanContextSupport
|
||||
* fields
|
||||
*/
|
||||
|
||||
private transient HashMap serviceClasses;
|
||||
private transient HashMap serviceRequestors;
|
||||
private transient HashMap<Class<?>, BCSSCServiceClassRef> serviceClasses;
|
||||
private transient HashMap<Object, Map<Object, BeanContextServicesSupport.BCSSChild.BCSSCServiceRef>> serviceRequestors;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -597,7 +599,7 @@ public class BeanContextServicesSupport extends BeanContextSupport
|
||||
protected static class BCSSServiceProvider implements Serializable {
|
||||
private static final long serialVersionUID = 861278251667444782L;
|
||||
|
||||
BCSSServiceProvider(Class sc, BeanContextServiceProvider bcsp) {
|
||||
BCSSServiceProvider(Class<?> sc, BeanContextServiceProvider bcsp) {
|
||||
super();
|
||||
|
||||
serviceProvider = bcsp;
|
||||
@ -627,7 +629,7 @@ public class BeanContextServicesSupport extends BeanContextSupport
|
||||
* @return a service provider without overriding addService()
|
||||
*/
|
||||
|
||||
protected BCSSServiceProvider createBCSSServiceProvider(Class sc, BeanContextServiceProvider bcsp) {
|
||||
protected BCSSServiceProvider createBCSSServiceProvider(Class<?> sc, BeanContextServiceProvider bcsp) {
|
||||
return new BCSSServiceProvider(sc, bcsp);
|
||||
}
|
||||
|
||||
@ -671,7 +673,7 @@ public class BeanContextServicesSupport extends BeanContextSupport
|
||||
* @param bcsp the service provider
|
||||
*/
|
||||
|
||||
public boolean addService(Class serviceClass, BeanContextServiceProvider bcsp) {
|
||||
public boolean addService(Class<?> serviceClass, BeanContextServiceProvider bcsp) {
|
||||
return addService(serviceClass, bcsp, true);
|
||||
}
|
||||
|
||||
@ -683,7 +685,7 @@ public class BeanContextServicesSupport extends BeanContextSupport
|
||||
* @return true if the service was successfully added
|
||||
*/
|
||||
|
||||
protected boolean addService(Class serviceClass, BeanContextServiceProvider bcsp, boolean fireEvent) {
|
||||
protected boolean addService(Class<?> serviceClass, BeanContextServiceProvider bcsp, boolean fireEvent) {
|
||||
|
||||
if (serviceClass == null) throw new NullPointerException("serviceClass");
|
||||
if (bcsp == null) throw new NullPointerException("bcsp");
|
||||
@ -704,7 +706,7 @@ public class BeanContextServicesSupport extends BeanContextSupport
|
||||
fireServiceAdded(bcssae);
|
||||
|
||||
synchronized(children) {
|
||||
Iterator i = children.keySet().iterator();
|
||||
Iterator<Object> i = children.keySet().iterator();
|
||||
|
||||
while (i.hasNext()) {
|
||||
Object c = i.next();
|
||||
@ -727,7 +729,7 @@ public class BeanContextServicesSupport extends BeanContextSupport
|
||||
* @param revokeCurrentServicesNow whether or not to revoke the service
|
||||
*/
|
||||
|
||||
public void revokeService(Class serviceClass, BeanContextServiceProvider bcsp, boolean revokeCurrentServicesNow) {
|
||||
public void revokeService(Class<?> serviceClass, BeanContextServiceProvider bcsp, boolean revokeCurrentServicesNow) {
|
||||
|
||||
if (serviceClass == null) throw new NullPointerException("serviceClass");
|
||||
if (bcsp == null) throw new NullPointerException("bcsp");
|
||||
@ -735,7 +737,7 @@ public class BeanContextServicesSupport extends BeanContextSupport
|
||||
synchronized(BeanContext.globalHierarchyLock) {
|
||||
if (!services.containsKey(serviceClass)) return;
|
||||
|
||||
BCSSServiceProvider bcsssp = (BCSSServiceProvider)services.get(serviceClass);
|
||||
BCSSServiceProvider bcsssp = services.get(serviceClass);
|
||||
|
||||
if (!bcsssp.getServiceProvider().equals(bcsp))
|
||||
throw new IllegalArgumentException("service provider mismatch");
|
||||
@ -744,7 +746,7 @@ public class BeanContextServicesSupport extends BeanContextSupport
|
||||
|
||||
if (bcsp instanceof Serializable) serializable--;
|
||||
|
||||
Iterator i = bcsChildren(); // get the BCSChild values.
|
||||
Iterator<BeanContextSupport.BCSChild> i = bcsChildren(); // get the BCSChild values.
|
||||
|
||||
while (i.hasNext()) {
|
||||
((BCSSChild)i.next()).revokeService(serviceClass, false, revokeCurrentServicesNow);
|
||||
@ -758,7 +760,7 @@ public class BeanContextServicesSupport extends BeanContextSupport
|
||||
* has a service, which may be delegated
|
||||
*/
|
||||
|
||||
public synchronized boolean hasService(Class serviceClass) {
|
||||
public synchronized boolean hasService(Class<?> serviceClass) {
|
||||
if (serviceClass == null) throw new NullPointerException("serviceClass");
|
||||
|
||||
synchronized(BeanContext.globalHierarchyLock) {
|
||||
@ -791,7 +793,7 @@ public class BeanContextServicesSupport extends BeanContextSupport
|
||||
nestingCtxt = bcs;
|
||||
}
|
||||
|
||||
public Object getService(BeanContextServices bcs, Object requestor, Class serviceClass, Object serviceSelector) {
|
||||
public Object getService(BeanContextServices bcs, Object requestor, Class<?> serviceClass, Object serviceSelector) {
|
||||
Object service = null;
|
||||
|
||||
try {
|
||||
@ -807,12 +809,12 @@ public class BeanContextServicesSupport extends BeanContextSupport
|
||||
nestingCtxt.releaseService(bcs, requestor, service);
|
||||
}
|
||||
|
||||
public Iterator getCurrentServiceSelectors(BeanContextServices bcs, Class serviceClass) {
|
||||
public Iterator<?> getCurrentServiceSelectors(BeanContextServices bcs, Class<?> serviceClass) {
|
||||
return nestingCtxt.getCurrentServiceSelectors(serviceClass);
|
||||
}
|
||||
|
||||
public void serviceRevoked(BeanContextServiceRevokedEvent bcsre) {
|
||||
Iterator i = bcsChildren(); // get the BCSChild values.
|
||||
Iterator<BeanContextSupport.BCSChild> i = bcsChildren(); // get the BCSChild values.
|
||||
|
||||
while (i.hasNext()) {
|
||||
((BCSSChild)i.next()).revokeService(bcsre.getServiceClass(), true, bcsre.isCurrentServiceInvalidNow());
|
||||
@ -832,7 +834,7 @@ public class BeanContextServicesSupport extends BeanContextSupport
|
||||
* obtain a service which may be delegated
|
||||
*/
|
||||
|
||||
public Object getService(BeanContextChild child, Object requestor, Class serviceClass, Object serviceSelector, BeanContextServiceRevokedListener bcsrl) throws TooManyListenersException {
|
||||
public Object getService(BeanContextChild child, Object requestor, Class<?> serviceClass, Object serviceSelector, BeanContextServiceRevokedListener bcsrl) throws TooManyListenersException {
|
||||
if (child == null) throw new NullPointerException("child");
|
||||
if (serviceClass == null) throw new NullPointerException("serviceClass");
|
||||
if (requestor == null) throw new NullPointerException("requestor");
|
||||
@ -847,7 +849,7 @@ public class BeanContextServicesSupport extends BeanContextSupport
|
||||
|
||||
if (bcsc == null) throw new IllegalArgumentException("not a child of this context"); // not a child ...
|
||||
|
||||
BCSSServiceProvider bcsssp = (BCSSServiceProvider)services.get(serviceClass);
|
||||
BCSSServiceProvider bcsssp = services.get(serviceClass);
|
||||
|
||||
if (bcsssp != null) {
|
||||
BeanContextServiceProvider bcsp = bcsssp.getServiceProvider();
|
||||
@ -918,7 +920,7 @@ public class BeanContextServicesSupport extends BeanContextSupport
|
||||
* @return an iterator for all the currently registered service classes.
|
||||
*/
|
||||
|
||||
public Iterator getCurrentServiceClasses() {
|
||||
public Iterator<Object> getCurrentServiceClasses() {
|
||||
return new BCSIterator(services.keySet().iterator());
|
||||
}
|
||||
|
||||
@ -927,9 +929,9 @@ public class BeanContextServicesSupport extends BeanContextSupport
|
||||
* (if any) available for the specified service.
|
||||
*/
|
||||
|
||||
public Iterator getCurrentServiceSelectors(Class serviceClass) {
|
||||
public Iterator<?> getCurrentServiceSelectors(Class<?> serviceClass) {
|
||||
|
||||
BCSSServiceProvider bcsssp = (BCSSServiceProvider)services.get(serviceClass);
|
||||
BCSSServiceProvider bcsssp = services.get(serviceClass);
|
||||
|
||||
return bcsssp != null ? new BCSIterator(bcsssp.getServiceProvider().getCurrentServiceSelectors(getBeanContextServicesPeer(), serviceClass)) : null;
|
||||
}
|
||||
@ -950,7 +952,7 @@ public class BeanContextServicesSupport extends BeanContextSupport
|
||||
|
||||
fireServiceAdded(bcssae);
|
||||
|
||||
Iterator i;
|
||||
Iterator<Object> i;
|
||||
|
||||
synchronized(children) {
|
||||
i = children.keySet().iterator();
|
||||
@ -982,7 +984,7 @@ public class BeanContextServicesSupport extends BeanContextSupport
|
||||
|
||||
fireServiceRevoked(bcssre);
|
||||
|
||||
Iterator i;
|
||||
Iterator<Object> i;
|
||||
|
||||
synchronized(children) {
|
||||
i = children.keySet().iterator();
|
||||
@ -1085,7 +1087,7 @@ public class BeanContextServicesSupport extends BeanContextSupport
|
||||
* Fires a <tt>BeanContextServiceEvent</tt> notifying of a new service.
|
||||
* @param serviceClass the service class
|
||||
*/
|
||||
protected final void fireServiceAdded(Class serviceClass) {
|
||||
protected final void fireServiceAdded(Class<?> serviceClass) {
|
||||
BeanContextServiceAvailableEvent bcssae = new BeanContextServiceAvailableEvent(getBeanContextServicesPeer(), serviceClass);
|
||||
|
||||
fireServiceAdded(bcssae);
|
||||
@ -1129,7 +1131,7 @@ public class BeanContextServicesSupport extends BeanContextSupport
|
||||
* @param serviceClass the service class
|
||||
* @param revokeNow whether or not the event should be revoked now
|
||||
*/
|
||||
protected final void fireServiceRevoked(Class serviceClass, boolean revokeNow) {
|
||||
protected final void fireServiceRevoked(Class<?> serviceClass, boolean revokeNow) {
|
||||
Object[] copy;
|
||||
BeanContextServiceRevokedEvent bcsre = new BeanContextServiceRevokedEvent(getBeanContextServicesPeer(), serviceClass, revokeNow);
|
||||
|
||||
@ -1159,14 +1161,14 @@ public class BeanContextServicesSupport extends BeanContextSupport
|
||||
|
||||
int count = 0;
|
||||
|
||||
Iterator i = services.entrySet().iterator();
|
||||
Iterator<Map.Entry<Object, BCSSServiceProvider>> i = services.entrySet().iterator();
|
||||
|
||||
while (i.hasNext() && count < serializable) {
|
||||
Map.Entry entry = (Map.Entry)i.next();
|
||||
Map.Entry<Object, BCSSServiceProvider> entry = i.next();
|
||||
BCSSServiceProvider bcsp = null;
|
||||
|
||||
try {
|
||||
bcsp = (BCSSServiceProvider)entry.getValue();
|
||||
bcsp = entry.getValue();
|
||||
} catch (ClassCastException cce) {
|
||||
continue;
|
||||
}
|
||||
@ -1201,7 +1203,7 @@ public class BeanContextServicesSupport extends BeanContextSupport
|
||||
int count = serializable;
|
||||
|
||||
while (count > 0) {
|
||||
services.put(ois.readObject(), ois.readObject());
|
||||
services.put(ois.readObject(), (BCSSServiceProvider)ois.readObject());
|
||||
count--;
|
||||
}
|
||||
}
|
||||
@ -1236,7 +1238,7 @@ public class BeanContextServicesSupport extends BeanContextSupport
|
||||
* all accesses to the <code> protected transient HashMap services </code>
|
||||
* field should be synchronized on that object
|
||||
*/
|
||||
protected transient HashMap services;
|
||||
protected transient HashMap<Object, BCSSServiceProvider> services;
|
||||
|
||||
/**
|
||||
* The number of instances of a serializable <tt>BeanContextServceProvider</tt>.
|
||||
@ -1253,5 +1255,5 @@ public class BeanContextServicesSupport extends BeanContextSupport
|
||||
/**
|
||||
* List of <tt>BeanContextServicesListener</tt> objects.
|
||||
*/
|
||||
protected transient ArrayList bcsListeners;
|
||||
protected transient ArrayList<BeanContextServicesListener> bcsListeners;
|
||||
}
|
||||
|
||||
@ -254,7 +254,7 @@ public class BeanContextSupport extends BeanContextChildSupport
|
||||
* currently nested in this <tt>BeanContext</tt>.
|
||||
* @return an <tt>Iterator</tt> of the nested children
|
||||
*/
|
||||
public Iterator iterator() {
|
||||
public Iterator<Object> iterator() {
|
||||
synchronized(children) {
|
||||
return new BCSIterator(children.keySet().iterator());
|
||||
}
|
||||
@ -292,14 +292,14 @@ public class BeanContextSupport extends BeanContextChildSupport
|
||||
* a noop remove() method.
|
||||
*/
|
||||
|
||||
protected static final class BCSIterator implements Iterator {
|
||||
BCSIterator(Iterator i) { super(); src = i; }
|
||||
protected static final class BCSIterator implements Iterator<Object> {
|
||||
BCSIterator(Iterator<?> i) { super(); src = i; }
|
||||
|
||||
public boolean hasNext() { return src.hasNext(); }
|
||||
public Object next() { return src.next(); }
|
||||
public Object next() { return src.next(); }
|
||||
public void remove() { /* do nothing */ }
|
||||
|
||||
private Iterator src;
|
||||
private Iterator<?> src;
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
@ -504,7 +504,7 @@ public class BeanContextSupport extends BeanContextChildSupport
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
BCSChild bcsc = (BCSChild)children.get(targetChild);
|
||||
BCSChild bcsc = children.get(targetChild);
|
||||
BCSChild pbcsc = null;
|
||||
Object peer = null;
|
||||
|
||||
@ -533,7 +533,7 @@ public class BeanContextSupport extends BeanContextChildSupport
|
||||
children.remove(targetChild);
|
||||
|
||||
if (bcsc.isProxyPeer()) {
|
||||
pbcsc = (BCSChild)children.get(peer = bcsc.getProxyPeer());
|
||||
pbcsc = children.get(peer = bcsc.getProxyPeer());
|
||||
children.remove(peer);
|
||||
}
|
||||
}
|
||||
@ -566,9 +566,10 @@ public class BeanContextSupport extends BeanContextChildSupport
|
||||
* in the collection are children of
|
||||
* this <tt>BeanContext</tt>, false if not.
|
||||
*/
|
||||
@SuppressWarnings("rawtypes")
|
||||
public boolean containsAll(Collection c) {
|
||||
synchronized(children) {
|
||||
Iterator i = c.iterator();
|
||||
Iterator<?> i = c.iterator();
|
||||
while (i.hasNext())
|
||||
if(!contains(i.next()))
|
||||
return false;
|
||||
@ -583,6 +584,7 @@ public class BeanContextSupport extends BeanContextChildSupport
|
||||
* @throws UnsupportedOperationException thrown unconditionally by this implementation
|
||||
* @return this implementation unconditionally throws {@code UnsupportedOperationException}
|
||||
*/
|
||||
@SuppressWarnings("rawtypes")
|
||||
public boolean addAll(Collection c) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
@ -594,6 +596,7 @@ public class BeanContextSupport extends BeanContextChildSupport
|
||||
* @return this implementation unconditionally throws {@code UnsupportedOperationException}
|
||||
|
||||
*/
|
||||
@SuppressWarnings("rawtypes")
|
||||
public boolean removeAll(Collection c) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
@ -605,6 +608,7 @@ public class BeanContextSupport extends BeanContextChildSupport
|
||||
* @throws UnsupportedOperationException thrown unconditionally by this implementation
|
||||
* @return this implementation unconditionally throws {@code UnsupportedOperationException}
|
||||
*/
|
||||
@SuppressWarnings("rawtypes")
|
||||
public boolean retainAll(Collection c) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
@ -763,7 +767,7 @@ public class BeanContextSupport extends BeanContextChildSupport
|
||||
}
|
||||
|
||||
synchronized(children) {
|
||||
for (Iterator i = children.keySet().iterator(); i.hasNext();) {
|
||||
for (Iterator<Object> i = children.keySet().iterator(); i.hasNext();) {
|
||||
Object c = i.next();
|
||||
|
||||
try {
|
||||
@ -790,7 +794,7 @@ public class BeanContextSupport extends BeanContextChildSupport
|
||||
|
||||
// lets also tell the Children that can that they may not use their GUI's
|
||||
synchronized(children) {
|
||||
for (Iterator i = children.keySet().iterator(); i.hasNext();) {
|
||||
for (Iterator<Object> i = children.keySet().iterator(); i.hasNext();) {
|
||||
Visibility v = getChildVisibility(i.next());
|
||||
|
||||
if (v != null) v.dontUseGui();
|
||||
@ -809,7 +813,7 @@ public class BeanContextSupport extends BeanContextChildSupport
|
||||
|
||||
// lets also tell the Children that can that they may use their GUI's
|
||||
synchronized(children) {
|
||||
for (Iterator i = children.keySet().iterator(); i.hasNext();) {
|
||||
for (Iterator<Object> i = children.keySet().iterator(); i.hasNext();) {
|
||||
Visibility v = getChildVisibility(i.next());
|
||||
|
||||
if (v != null) v.okToUseGui();
|
||||
@ -841,7 +845,7 @@ public class BeanContextSupport extends BeanContextChildSupport
|
||||
* of this <tt>BeanContext</tt>.
|
||||
* @return an iterator for all the current BCSChild values
|
||||
*/
|
||||
protected Iterator bcsChildren() { synchronized(children) { return children.values().iterator(); } }
|
||||
protected Iterator<BCSChild> bcsChildren() { synchronized(children) { return children.values().iterator(); } }
|
||||
|
||||
/**
|
||||
* called by writeObject after defaultWriteObject() but prior to
|
||||
@ -896,7 +900,7 @@ public class BeanContextSupport extends BeanContextChildSupport
|
||||
* @param coll the <tt>Collection</tt> to serialize
|
||||
* @throws IOException if serialization failed
|
||||
*/
|
||||
protected final void serialize(ObjectOutputStream oos, Collection coll) throws IOException {
|
||||
protected final void serialize(ObjectOutputStream oos, Collection<?> coll) throws IOException {
|
||||
int count = 0;
|
||||
Object[] objects = coll.toArray();
|
||||
|
||||
@ -926,6 +930,7 @@ public class BeanContextSupport extends BeanContextChildSupport
|
||||
* @throws IOException if deserialization failed
|
||||
* @throws ClassNotFoundException if needed classes are not found
|
||||
*/
|
||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||
protected final void deserialize(ObjectInputStream ois, Collection coll) throws IOException, ClassNotFoundException {
|
||||
int count = 0;
|
||||
|
||||
@ -953,10 +958,10 @@ public class BeanContextSupport extends BeanContextChildSupport
|
||||
int count = 0;
|
||||
|
||||
synchronized(children) {
|
||||
Iterator i = children.entrySet().iterator();
|
||||
Iterator<Map.Entry<Object, BCSChild>> i = children.entrySet().iterator();
|
||||
|
||||
while (i.hasNext() && count < serializable) {
|
||||
Map.Entry entry = (Map.Entry)i.next();
|
||||
Map.Entry<Object, BCSChild> entry = i.next();
|
||||
|
||||
if (entry.getKey() instanceof Serializable) {
|
||||
try {
|
||||
@ -1082,7 +1087,7 @@ public class BeanContextSupport extends BeanContextChildSupport
|
||||
if (serializable > 0 && this.equals(getBeanContextPeer()))
|
||||
readChildren(ois);
|
||||
|
||||
deserialize(ois, bcmListeners = new ArrayList(1));
|
||||
deserialize(ois, bcmListeners = new ArrayList<>(1));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1101,7 +1106,7 @@ public class BeanContextSupport extends BeanContextChildSupport
|
||||
) {
|
||||
if (!validatePendingRemove(source)) {
|
||||
throw new PropertyVetoException("current BeanContext vetoes setBeanContext()", pce);
|
||||
} else ((BCSChild)children.get(source)).setRemovePending(true);
|
||||
} else children.get(source).setRemovePending(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1117,13 +1122,13 @@ public class BeanContextSupport extends BeanContextChildSupport
|
||||
synchronized(children) {
|
||||
if ("beanContext".equals(propertyName) &&
|
||||
containsKey(source) &&
|
||||
((BCSChild)children.get(source)).isRemovePending()) {
|
||||
children.get(source).isRemovePending()) {
|
||||
BeanContext bc = getBeanContextPeer();
|
||||
|
||||
if (bc.equals(pce.getOldValue()) && !bc.equals(pce.getNewValue())) {
|
||||
remove(source, false);
|
||||
} else {
|
||||
((BCSChild)children.get(source)).setRemovePending(false);
|
||||
children.get(source).setRemovePending(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1312,8 +1317,8 @@ public class BeanContextSupport extends BeanContextChildSupport
|
||||
*/
|
||||
|
||||
protected synchronized void initialize() {
|
||||
children = new HashMap(serializable + 1);
|
||||
bcmListeners = new ArrayList(1);
|
||||
children = new HashMap<>(serializable + 1);
|
||||
bcmListeners = new ArrayList<>(1);
|
||||
|
||||
childPCL = new PropertyChangeListener() {
|
||||
|
||||
@ -1359,7 +1364,7 @@ public class BeanContextSupport extends BeanContextChildSupport
|
||||
* @param second the second object
|
||||
* @return true if equal, false if not
|
||||
*/
|
||||
protected static final boolean classEquals(Class first, Class second) {
|
||||
protected static final boolean classEquals(Class<?> first, Class<?> second) {
|
||||
return first.equals(second) || first.getName().equals(second.getName());
|
||||
}
|
||||
|
||||
@ -1373,7 +1378,7 @@ public class BeanContextSupport extends BeanContextChildSupport
|
||||
* all accesses to the <code> protected HashMap children </code> field
|
||||
* shall be synchronized on that object.
|
||||
*/
|
||||
protected transient HashMap children;
|
||||
protected transient HashMap<Object, BCSChild> children;
|
||||
|
||||
private int serializable = 0; // children serializable
|
||||
|
||||
@ -1381,7 +1386,7 @@ public class BeanContextSupport extends BeanContextChildSupport
|
||||
* all accesses to the <code> protected ArrayList bcmListeners </code> field
|
||||
* shall be synchronized on that object.
|
||||
*/
|
||||
protected transient ArrayList bcmListeners;
|
||||
protected transient ArrayList<BeanContextMembershipListener> bcmListeners;
|
||||
|
||||
//
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user