提交 585ffb5d 编写于 作者: E emcmanus

6763639: Remove "rawtypes" warnings from JMX code

Reviewed-by: dfuchs
上级 72cfca45
...@@ -44,13 +44,13 @@ ...@@ -44,13 +44,13 @@
<!-- because they depend on the values of BUILD_DATE and BUILD_DATE_SIMPLE --> <!-- because they depend on the values of BUILD_DATE and BUILD_DATE_SIMPLE -->
<!-- At this time, ./build.properties has not been loaded yet. --> <!-- At this time, ./build.properties has not been loaded yet. -->
<property name="project.build.name" value="openjdk-bXX"/> <property name="project.build.name" value="openjdk-bXX"/>
<property name="project.build.fulltag" <property name="project.build.fulltag"
value="${ant.project.name}-${project.build.name}-${BUILD_DATE}" /> value="${ant.project.name}-${project.build.name}-${BUILD_DATE}" />
<!-- unchecked warnings will be fixed in JMX 2.0 as part of the work <!-- unchecked warnings will be fixed in JMX 2.0 as part of the work
being done on JSR 255 new features --> being done on JSR 255 new features -->
<property name="javac.options" <property name="javac.options"
value="-Xlint -Xlint:-unchecked -Xlint:-deprecation"/> value="-Xlint -Xlint:-deprecation"/>
</target> </target>
...@@ -58,13 +58,13 @@ ...@@ -58,13 +58,13 @@
<!-- Dir to keep generated stub source --> <!-- Dir to keep generated stub source -->
<mkdir dir="${gensrc.dir}" /> <mkdir dir="${gensrc.dir}" />
</target> </target>
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~ --> <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<!-- Call rmic-jmx subtargets --> <!-- Call rmic-jmx subtargets -->
<target name="-rmic-jmx" depends="-init,-rmic-jmx-jrmp,-rmic-jmx-iiop" <target name="-rmic-jmx" depends="-init,-rmic-jmx-jrmp,-rmic-jmx-iiop"
description="Calls -init,-rmic-jmx-jrmp,-rmic-jmx-iiop" description="Calls -init,-rmic-jmx-jrmp,-rmic-jmx-iiop"
/> />
...@@ -96,7 +96,7 @@ ...@@ -96,7 +96,7 @@
<target name="-rmic-jmx-iiop" depends="-init,-check-jmx-iiop-uptodate" unless="jmx-iiop-uptodate" <target name="-rmic-jmx-iiop" depends="-init,-check-jmx-iiop-uptodate" unless="jmx-iiop-uptodate"
description="Generate RMI IIOP stub class files for remote objects. Do not keep generated java files." > description="Generate RMI IIOP stub class files for remote objects. Do not keep generated java files." >
<rmic base="${classes.dir}" <rmic base="${classes.dir}"
includeAntRuntime="no" includeAntRuntime="no"
includeJavaRuntime="no" includeJavaRuntime="no"
...@@ -115,11 +115,11 @@ ...@@ -115,11 +115,11 @@
<target name="-check-jmx-iiop-uptodate" depends="-init"> <target name="-check-jmx-iiop-uptodate" depends="-init">
<uptodate property="jmx-iiop-uptodate" <uptodate property="jmx-iiop-uptodate"
srcfile="${classes.dir}/javax/management/remote/rmi/RMIConnectionImpl.class" srcfile="${classes.dir}/javax/management/remote/rmi/RMIConnectionImpl.class"
targetfile="${classes.dir}/org/omg/stub/javax/management/remote/rmi/_RMIConnectionImpl_Tie.class" targetfile="${classes.dir}/org/omg/stub/javax/management/remote/rmi/_RMIConnectionImpl_Tie.class"
/> />
<uptodate property="jmx-iiop-uptodate" <uptodate property="jmx-iiop-uptodate"
srcfile="${classes.dir}/javax/management/remote/rmi/RMIServerImpl.class" srcfile="${classes.dir}/javax/management/remote/rmi/RMIServerImpl.class"
targetfile="${classes.dir}/org/omg/stub/javax/management/remote/rmi/_RMIServerImpl_Tie.class" targetfile="${classes.dir}/org/omg/stub/javax/management/remote/rmi/_RMIServerImpl_Tie.class"
/> />
...@@ -131,7 +131,7 @@ ...@@ -131,7 +131,7 @@
<target name="-post-compile" depends="-init,-rmic-jmx" <target name="-post-compile" depends="-init,-rmic-jmx"
description="Jar JMX class files (including RMI stubs)" > description="Jar JMX class files (including RMI stubs)" >
<mkdir dir="${dist.dir}/lib"/> <mkdir dir="${dist.dir}/lib"/>
<jar jarfile="${dist.dir}/lib/${jar.jmx.name}" <jar jarfile="${dist.dir}/lib/${jar.jmx.name}"
update="true" update="true"
index="false" index="false"
duplicate="fail"> duplicate="fail">
...@@ -144,7 +144,7 @@ ...@@ -144,7 +144,7 @@
<attribute name="Specification-Version" value="${jar.jmx.spec.version}" /> <attribute name="Specification-Version" value="${jar.jmx.spec.version}" />
<attribute name="Specification-Vendor" value="${jar.jmx.spec.vendor}" /> <attribute name="Specification-Vendor" value="${jar.jmx.spec.vendor}" />
<attribute name="Implementation-Title" value="${jar.jmx.impl.title}" /> <attribute name="Implementation-Title" value="${jar.jmx.impl.title}" />
<attribute name="Implementation-Version" value="${project.build.fulltag}" /> <attribute name="Implementation-Version" value="${project.build.fulltag}" />
<attribute name="Implementation-Vendor" value="${jar.jmx.impl.vendor}" /> <attribute name="Implementation-Vendor" value="${jar.jmx.impl.vendor}" />
</section> </section>
</manifest> </manifest>
......
...@@ -141,7 +141,7 @@ public class LeaseManager { ...@@ -141,7 +141,7 @@ public class LeaseManager {
} }
private final Runnable callback; private final Runnable callback;
private ScheduledFuture scheduled; // If null, the lease has expired. private ScheduledFuture<?> scheduled; // If null, the lease has expired.
private final ScheduledExecutorService executor private final ScheduledExecutorService executor
= Executors.newScheduledThreadPool(1, = Executors.newScheduledThreadPool(1,
......
...@@ -128,7 +128,7 @@ public class LeaseRenewer { ...@@ -128,7 +128,7 @@ public class LeaseRenewer {
}; };
private final Callable<Long> doRenew; private final Callable<Long> doRenew;
private ScheduledFuture future; private ScheduledFuture<?> future;
private boolean closed = false; private boolean closed = false;
private long nextRenewTime; private long nextRenewTime;
......
...@@ -247,7 +247,7 @@ public class DefaultMBeanServerInterceptor ...@@ -247,7 +247,7 @@ public class DefaultMBeanServerInterceptor
MBeanRegistrationException, MBeanException, MBeanRegistrationException, MBeanException,
NotCompliantMBeanException, InstanceNotFoundException { NotCompliantMBeanException, InstanceNotFoundException {
Class theClass; Class<?> theClass;
if (className == null) { if (className == null) {
final RuntimeException wrapped = final RuntimeException wrapped =
...@@ -327,7 +327,7 @@ public class DefaultMBeanServerInterceptor ...@@ -327,7 +327,7 @@ public class DefaultMBeanServerInterceptor
// ------------------------------ // ------------------------------
// ------------------------------ // ------------------------------
Class theClass = object.getClass(); Class<?> theClass = object.getClass();
Introspector.checkCompliance(theClass); Introspector.checkCompliance(theClass);
...@@ -808,9 +808,8 @@ public class DefaultMBeanServerInterceptor ...@@ -808,9 +808,8 @@ public class DefaultMBeanServerInterceptor
// on each specific attribute // on each specific attribute
// //
allowedAttributes = new AttributeList(attributes.size()); allowedAttributes = new AttributeList(attributes.size());
for (Iterator i = attributes.iterator(); i.hasNext();) { for (Attribute attribute : attributes.asList()) {
try { try {
Attribute attribute = (Attribute) i.next();
checkMBeanPermission(mbeanServerName, classname, attribute.getName(), checkMBeanPermission(mbeanServerName, classname, attribute.getName(),
name, "setAttribute"); name, "setAttribute");
allowedAttributes.add(attribute); allowedAttributes.add(attribute);
...@@ -1857,7 +1856,7 @@ public class DefaultMBeanServerInterceptor ...@@ -1857,7 +1856,7 @@ public class DefaultMBeanServerInterceptor
} }
} }
private static void checkMBeanTrustPermission(final Class theClass) private static void checkMBeanTrustPermission(final Class<?> theClass)
throws SecurityException { throws SecurityException {
SecurityManager sm = System.getSecurityManager(); SecurityManager sm = System.getSecurityManager();
if (sm != null) { if (sm != null) {
......
...@@ -136,14 +136,14 @@ final class ClassLoaderRepositorySupport ...@@ -136,14 +136,14 @@ final class ClassLoaderRepositorySupport
new Hashtable<ObjectName,ClassLoader>(10); new Hashtable<ObjectName,ClassLoader>(10);
// from javax.management.loading.DefaultLoaderRepository // from javax.management.loading.DefaultLoaderRepository
public final Class loadClass(String className) public final Class<?> loadClass(String className)
throws ClassNotFoundException { throws ClassNotFoundException {
return loadClass(loaders, className, null, null); return loadClass(loaders, className, null, null);
} }
// from javax.management.loading.DefaultLoaderRepository // from javax.management.loading.DefaultLoaderRepository
public final Class loadClassWithout(ClassLoader without, String className) public final Class<?> loadClassWithout(ClassLoader without, String className)
throws ClassNotFoundException { throws ClassNotFoundException {
if (MBEANSERVER_LOGGER.isLoggable(Level.FINER)) { if (MBEANSERVER_LOGGER.isLoggable(Level.FINER)) {
MBEANSERVER_LOGGER.logp(Level.FINER, MBEANSERVER_LOGGER.logp(Level.FINER,
...@@ -167,7 +167,7 @@ final class ClassLoaderRepositorySupport ...@@ -167,7 +167,7 @@ final class ClassLoaderRepositorySupport
} }
public final Class loadClassBefore(ClassLoader stop, String className) public final Class<?> loadClassBefore(ClassLoader stop, String className)
throws ClassNotFoundException { throws ClassNotFoundException {
if (MBEANSERVER_LOGGER.isLoggable(Level.FINER)) { if (MBEANSERVER_LOGGER.isLoggable(Level.FINER)) {
MBEANSERVER_LOGGER.logp(Level.FINER, MBEANSERVER_LOGGER.logp(Level.FINER,
...@@ -187,10 +187,10 @@ final class ClassLoaderRepositorySupport ...@@ -187,10 +187,10 @@ final class ClassLoaderRepositorySupport
} }
private Class loadClass(final LoaderEntry list[], private Class<?> loadClass(final LoaderEntry list[],
final String className, final String className,
final ClassLoader without, final ClassLoader without,
final ClassLoader stop) final ClassLoader stop)
throws ClassNotFoundException { throws ClassNotFoundException {
final int size = list.length; final int size = list.length;
for(int i=0; i<size; i++) { for(int i=0; i<size; i++) {
......
...@@ -68,12 +68,12 @@ final class ConvertingMethod { ...@@ -68,12 +68,12 @@ final class ConvertingMethod {
return method.getName(); return method.getName();
} }
OpenType getOpenReturnType() { OpenType<?> getOpenReturnType() {
return returnMapping.getOpenType(); return returnMapping.getOpenType();
} }
OpenType[] getOpenParameterTypes() { OpenType<?>[] getOpenParameterTypes() {
final OpenType[] types = new OpenType[paramMappings.length]; final OpenType<?>[] types = new OpenType<?>[paramMappings.length];
for (int i = 0; i < paramMappings.length; i++) for (int i = 0; i < paramMappings.length; i++)
types[i] = paramMappings[i].getOpenType(); types[i] = paramMappings[i].getOpenType();
return types; return types;
......
...@@ -120,7 +120,7 @@ import javax.management.openmbean.TabularType; ...@@ -120,7 +120,7 @@ import javax.management.openmbean.TabularType;
*/ */
public class DefaultMXBeanMappingFactory extends MXBeanMappingFactory { public class DefaultMXBeanMappingFactory extends MXBeanMappingFactory {
static abstract class NonNullMXBeanMapping extends MXBeanMapping { static abstract class NonNullMXBeanMapping extends MXBeanMapping {
NonNullMXBeanMapping(Type javaType, OpenType openType) { NonNullMXBeanMapping(Type javaType, OpenType<?> openType) {
super(javaType, openType); super(javaType, openType);
} }
...@@ -195,15 +195,15 @@ public class DefaultMXBeanMappingFactory extends MXBeanMappingFactory { ...@@ -195,15 +195,15 @@ public class DefaultMXBeanMappingFactory extends MXBeanMappingFactory {
static { static {
/* Set up the mappings for Java types that map to SimpleType. */ /* Set up the mappings for Java types that map to SimpleType. */
final OpenType[] simpleTypes = { final OpenType<?>[] simpleTypes = {
BIGDECIMAL, BIGINTEGER, BOOLEAN, BYTE, CHARACTER, DATE, BIGDECIMAL, BIGINTEGER, BOOLEAN, BYTE, CHARACTER, DATE,
DOUBLE, FLOAT, INTEGER, LONG, OBJECTNAME, SHORT, STRING, DOUBLE, FLOAT, INTEGER, LONG, OBJECTNAME, SHORT, STRING,
VOID, VOID,
}; };
for (int i = 0; i < simpleTypes.length; i++) { for (int i = 0; i < simpleTypes.length; i++) {
final OpenType t = simpleTypes[i]; final OpenType<?> t = simpleTypes[i];
Class c; Class<?> c;
try { try {
c = Class.forName(t.getClassName(), false, c = Class.forName(t.getClassName(), false,
ObjectName.class.getClassLoader()); ObjectName.class.getClassLoader());
...@@ -224,7 +224,7 @@ public class DefaultMXBeanMappingFactory extends MXBeanMappingFactory { ...@@ -224,7 +224,7 @@ public class DefaultMXBeanMappingFactory extends MXBeanMappingFactory {
if (primitiveType != void.class) { if (primitiveType != void.class) {
final Class<?> primitiveArrayType = final Class<?> primitiveArrayType =
Array.newInstance(primitiveType, 0).getClass(); Array.newInstance(primitiveType, 0).getClass();
final OpenType primitiveArrayOpenType = final OpenType<?> primitiveArrayOpenType =
ArrayType.getPrimitiveArrayType(primitiveArrayType); ArrayType.getPrimitiveArrayType(primitiveArrayType);
final MXBeanMapping primitiveArrayMapping = final MXBeanMapping primitiveArrayMapping =
new IdentityMapping(primitiveArrayType, new IdentityMapping(primitiveArrayType,
...@@ -285,13 +285,13 @@ public class DefaultMXBeanMappingFactory extends MXBeanMappingFactory { ...@@ -285,13 +285,13 @@ public class DefaultMXBeanMappingFactory extends MXBeanMappingFactory {
Type componentType = Type componentType =
((GenericArrayType) objType).getGenericComponentType(); ((GenericArrayType) objType).getGenericComponentType();
return makeArrayOrCollectionMapping(objType, componentType, factory); return makeArrayOrCollectionMapping(objType, componentType, factory);
} else if (objType instanceof Class) { } else if (objType instanceof Class<?>) {
Class<?> objClass = (Class<?>) objType; Class<?> objClass = (Class<?>) objType;
if (objClass.isEnum()) { if (objClass.isEnum()) {
// Huge hack to avoid compiler warnings here. The ElementType // Huge hack to avoid compiler warnings here. The ElementType
// parameter is ignored but allows us to obtain a type variable // parameter is ignored but allows us to obtain a type variable
// T that matches <T extends Enum<T>>. // T that matches <T extends Enum<T>>.
return makeEnumMapping((Class) objClass, ElementType.class); return makeEnumMapping((Class<?>) objClass, ElementType.class);
} else if (objClass.isArray()) { } else if (objClass.isArray()) {
Type componentType = objClass.getComponentType(); Type componentType = objClass.getComponentType();
return makeArrayOrCollectionMapping(objClass, componentType, return makeArrayOrCollectionMapping(objClass, componentType,
...@@ -354,7 +354,7 @@ public class DefaultMXBeanMappingFactory extends MXBeanMappingFactory { ...@@ -354,7 +354,7 @@ public class DefaultMXBeanMappingFactory extends MXBeanMappingFactory {
} }
private static <T extends Enum<T>> MXBeanMapping private static <T extends Enum<T>> MXBeanMapping
makeEnumMapping(Class enumClass, Class<T> fake) { makeEnumMapping(Class<?> enumClass, Class<T> fake) {
return new EnumMapping<T>(Util.<Class<T>>cast(enumClass)); return new EnumMapping<T>(Util.<Class<T>>cast(enumClass));
} }
...@@ -414,14 +414,14 @@ public class DefaultMXBeanMappingFactory extends MXBeanMappingFactory { ...@@ -414,14 +414,14 @@ public class DefaultMXBeanMappingFactory extends MXBeanMappingFactory {
final String objTypeName = objType.toString(); final String objTypeName = objType.toString();
final MXBeanMapping keyMapping = factory.mappingForType(keyType, factory); final MXBeanMapping keyMapping = factory.mappingForType(keyType, factory);
final MXBeanMapping valueMapping = factory.mappingForType(valueType, factory); final MXBeanMapping valueMapping = factory.mappingForType(valueType, factory);
final OpenType keyOpenType = keyMapping.getOpenType(); final OpenType<?> keyOpenType = keyMapping.getOpenType();
final OpenType valueOpenType = valueMapping.getOpenType(); final OpenType<?> valueOpenType = valueMapping.getOpenType();
final CompositeType rowType = final CompositeType rowType =
new CompositeType(objTypeName, new CompositeType(objTypeName,
objTypeName, objTypeName,
keyValueArray, keyValueArray,
keyValueArray, keyValueArray,
new OpenType[] {keyOpenType, valueOpenType}); new OpenType<?>[] {keyOpenType, valueOpenType});
final TabularType tabularType = final TabularType tabularType =
new TabularType(objTypeName, objTypeName, rowType, keyArray); new TabularType(objTypeName, objTypeName, rowType, keyArray);
return new TabularMapping(objType, sortedMap, tabularType, return new TabularMapping(objType, sortedMap, tabularType,
...@@ -440,8 +440,8 @@ public class DefaultMXBeanMappingFactory extends MXBeanMappingFactory { ...@@ -440,8 +440,8 @@ public class DefaultMXBeanMappingFactory extends MXBeanMappingFactory {
final Type rawType = objType.getRawType(); final Type rawType = objType.getRawType();
if (rawType instanceof Class) { if (rawType instanceof Class<?>) {
Class c = (Class<?>) rawType; Class<?> c = (Class<?>) rawType;
if (c == List.class || c == Set.class || c == SortedSet.class) { if (c == List.class || c == Set.class || c == SortedSet.class) {
Type[] actuals = objType.getActualTypeArguments(); Type[] actuals = objType.getActualTypeArguments();
assert(actuals.length == 1); assert(actuals.length == 1);
...@@ -468,7 +468,7 @@ public class DefaultMXBeanMappingFactory extends MXBeanMappingFactory { ...@@ -468,7 +468,7 @@ public class DefaultMXBeanMappingFactory extends MXBeanMappingFactory {
return new MXBeanRefMapping(t); return new MXBeanRefMapping(t);
} }
private MXBeanMapping makeCompositeMapping(Class c, private MXBeanMapping makeCompositeMapping(Class<?> c,
MXBeanMappingFactory factory) MXBeanMappingFactory factory)
throws OpenDataException { throws OpenDataException {
...@@ -514,7 +514,7 @@ public class DefaultMXBeanMappingFactory extends MXBeanMappingFactory { ...@@ -514,7 +514,7 @@ public class DefaultMXBeanMappingFactory extends MXBeanMappingFactory {
final Method[] getters = new Method[nitems]; final Method[] getters = new Method[nitems];
final String[] itemNames = new String[nitems]; final String[] itemNames = new String[nitems];
final OpenType[] openTypes = new OpenType[nitems]; final OpenType<?>[] openTypes = new OpenType<?>[nitems];
int i = 0; int i = 0;
for (Map.Entry<String,Method> entry : getterMap.entrySet()) { for (Map.Entry<String,Method> entry : getterMap.entrySet()) {
itemNames[i] = entry.getKey(); itemNames[i] = entry.getKey();
...@@ -546,7 +546,7 @@ public class DefaultMXBeanMappingFactory extends MXBeanMappingFactory { ...@@ -546,7 +546,7 @@ public class DefaultMXBeanMappingFactory extends MXBeanMappingFactory {
can be directly represented by an ArrayType, and an int needs no mapping can be directly represented by an ArrayType, and an int needs no mapping
because reflection takes care of it. */ because reflection takes care of it. */
private static final class IdentityMapping extends NonNullMXBeanMapping { private static final class IdentityMapping extends NonNullMXBeanMapping {
IdentityMapping(Type targetType, OpenType openType) { IdentityMapping(Type targetType, OpenType<?> openType) {
super(targetType, openType); super(targetType, openType);
} }
...@@ -576,7 +576,7 @@ public class DefaultMXBeanMappingFactory extends MXBeanMappingFactory { ...@@ -576,7 +576,7 @@ public class DefaultMXBeanMappingFactory extends MXBeanMappingFactory {
@Override @Override
final Object toNonNullOpenValue(Object value) { final Object toNonNullOpenValue(Object value) {
return ((Enum) value).name(); return ((Enum<?>) value).name();
} }
@Override @Override
...@@ -595,7 +595,7 @@ public class DefaultMXBeanMappingFactory extends MXBeanMappingFactory { ...@@ -595,7 +595,7 @@ public class DefaultMXBeanMappingFactory extends MXBeanMappingFactory {
private static final class ArrayMapping extends NonNullMXBeanMapping { private static final class ArrayMapping extends NonNullMXBeanMapping {
ArrayMapping(Type targetType, ArrayMapping(Type targetType,
ArrayType openArrayType, Class openArrayClass, ArrayType<?> openArrayType, Class<?> openArrayClass,
MXBeanMapping elementMapping) { MXBeanMapping elementMapping) {
super(targetType, openArrayType); super(targetType, openArrayType);
this.elementMapping = elementMapping; this.elementMapping = elementMapping;
...@@ -623,7 +623,7 @@ public class DefaultMXBeanMappingFactory extends MXBeanMappingFactory { ...@@ -623,7 +623,7 @@ public class DefaultMXBeanMappingFactory extends MXBeanMappingFactory {
if (javaType instanceof GenericArrayType) { if (javaType instanceof GenericArrayType) {
componentType = componentType =
((GenericArrayType) javaType).getGenericComponentType(); ((GenericArrayType) javaType).getGenericComponentType();
} else if (javaType instanceof Class && } else if (javaType instanceof Class<?> &&
((Class<?>) javaType).isArray()) { ((Class<?>) javaType).isArray()) {
componentType = ((Class<?>) javaType).getComponentType(); componentType = ((Class<?>) javaType).getComponentType();
} else { } else {
...@@ -651,8 +651,8 @@ public class DefaultMXBeanMappingFactory extends MXBeanMappingFactory { ...@@ -651,8 +651,8 @@ public class DefaultMXBeanMappingFactory extends MXBeanMappingFactory {
private static final class CollectionMapping extends NonNullMXBeanMapping { private static final class CollectionMapping extends NonNullMXBeanMapping {
CollectionMapping(Type targetType, CollectionMapping(Type targetType,
ArrayType openArrayType, ArrayType<?> openArrayType,
Class openArrayClass, Class<?> openArrayClass,
MXBeanMapping elementMapping) { MXBeanMapping elementMapping) {
super(targetType, openArrayType); super(targetType, openArrayType);
this.elementMapping = elementMapping; this.elementMapping = elementMapping;
...@@ -662,26 +662,28 @@ public class DefaultMXBeanMappingFactory extends MXBeanMappingFactory { ...@@ -662,26 +662,28 @@ public class DefaultMXBeanMappingFactory extends MXBeanMappingFactory {
and all Sets to TreeSet. (TreeSet because it is a SortedSet, and all Sets to TreeSet. (TreeSet because it is a SortedSet,
so works for both Set and SortedSet.) */ so works for both Set and SortedSet.) */
Type raw = ((ParameterizedType) targetType).getRawType(); Type raw = ((ParameterizedType) targetType).getRawType();
Class c = (Class<?>) raw; Class<?> c = (Class<?>) raw;
final Class<?> collC;
if (c == List.class) if (c == List.class)
collectionClass = ArrayList.class; collC = ArrayList.class;
else if (c == Set.class) else if (c == Set.class)
collectionClass = HashSet.class; collC = HashSet.class;
else if (c == SortedSet.class) else if (c == SortedSet.class)
collectionClass = TreeSet.class; collC = TreeSet.class;
else { // can't happen else { // can't happen
assert(false); assert(false);
collectionClass = null; collC = null;
} }
collectionClass = Util.cast(collC);
} }
@Override @Override
final Object toNonNullOpenValue(Object value) final Object toNonNullOpenValue(Object value)
throws OpenDataException { throws OpenDataException {
final Collection valueCollection = (Collection) value; final Collection<?> valueCollection = (Collection<?>) value;
if (valueCollection instanceof SortedSet) { if (valueCollection instanceof SortedSet<?>) {
Comparator comparator = Comparator<?> comparator =
((SortedSet) valueCollection).comparator(); ((SortedSet<?>) valueCollection).comparator();
if (comparator != null) { if (comparator != null) {
final String msg = final String msg =
"Cannot convert SortedSet with non-null comparator: " + "Cannot convert SortedSet with non-null comparator: " +
...@@ -725,7 +727,7 @@ public class DefaultMXBeanMappingFactory extends MXBeanMappingFactory { ...@@ -725,7 +727,7 @@ public class DefaultMXBeanMappingFactory extends MXBeanMappingFactory {
elementMapping.checkReconstructible(); elementMapping.checkReconstructible();
} }
private final Class<? extends Collection> collectionClass; private final Class<? extends Collection<?>> collectionClass;
private final MXBeanMapping elementMapping; private final MXBeanMapping elementMapping;
} }
...@@ -794,8 +796,8 @@ public class DefaultMXBeanMappingFactory extends MXBeanMappingFactory { ...@@ -794,8 +796,8 @@ public class DefaultMXBeanMappingFactory extends MXBeanMappingFactory {
@Override @Override
final Object toNonNullOpenValue(Object value) throws OpenDataException { final Object toNonNullOpenValue(Object value) throws OpenDataException {
final Map<Object, Object> valueMap = cast(value); final Map<Object, Object> valueMap = cast(value);
if (valueMap instanceof SortedMap) { if (valueMap instanceof SortedMap<?,?>) {
Comparator comparator = ((SortedMap) valueMap).comparator(); Comparator<?> comparator = ((SortedMap<?,?>) valueMap).comparator();
if (comparator != null) { if (comparator != null) {
final String msg = final String msg =
"Cannot convert SortedMap with non-null comparator: " + "Cannot convert SortedMap with non-null comparator: " +
...@@ -806,7 +808,7 @@ public class DefaultMXBeanMappingFactory extends MXBeanMappingFactory { ...@@ -806,7 +808,7 @@ public class DefaultMXBeanMappingFactory extends MXBeanMappingFactory {
final TabularType tabularType = (TabularType) getOpenType(); final TabularType tabularType = (TabularType) getOpenType();
final TabularData table = new TabularDataSupport(tabularType); final TabularData table = new TabularDataSupport(tabularType);
final CompositeType rowType = tabularType.getRowType(); final CompositeType rowType = tabularType.getRowType();
for (Map.Entry entry : valueMap.entrySet()) { for (Map.Entry<Object, Object> entry : valueMap.entrySet()) {
final Object openKey = keyMapping.toOpenValue(entry.getKey()); final Object openKey = keyMapping.toOpenValue(entry.getKey());
final Object openValue = valueMapping.toOpenValue(entry.getValue()); final Object openValue = valueMapping.toOpenValue(entry.getValue());
final CompositeData row; final CompositeData row;
...@@ -852,7 +854,7 @@ public class DefaultMXBeanMappingFactory extends MXBeanMappingFactory { ...@@ -852,7 +854,7 @@ public class DefaultMXBeanMappingFactory extends MXBeanMappingFactory {
} }
private final class CompositeMapping extends NonNullMXBeanMapping { private final class CompositeMapping extends NonNullMXBeanMapping {
CompositeMapping(Class targetClass, CompositeMapping(Class<?> targetClass,
CompositeType compositeType, CompositeType compositeType,
String[] itemNames, String[] itemNames,
Method[] getters, Method[] getters,
...@@ -901,7 +903,7 @@ public class DefaultMXBeanMappingFactory extends MXBeanMappingFactory { ...@@ -901,7 +903,7 @@ public class DefaultMXBeanMappingFactory extends MXBeanMappingFactory {
if (compositeBuilder != null) if (compositeBuilder != null)
return; return;
Class targetClass = (Class<?>) getJavaType(); Class<?> targetClass = (Class<?>) getJavaType();
/* In this 2D array, each subarray is a set of builders where /* In this 2D array, each subarray is a set of builders where
there is no point in consulting the ones after the first if there is no point in consulting the ones after the first if
the first refuses. */ the first refuses. */
...@@ -973,7 +975,7 @@ public class DefaultMXBeanMappingFactory extends MXBeanMappingFactory { ...@@ -973,7 +975,7 @@ public class DefaultMXBeanMappingFactory extends MXBeanMappingFactory {
/** Converts from a CompositeData to an instance of the targetClass. */ /** Converts from a CompositeData to an instance of the targetClass. */
private static abstract class CompositeBuilder { private static abstract class CompositeBuilder {
CompositeBuilder(Class targetClass, String[] itemNames) { CompositeBuilder(Class<?> targetClass, String[] itemNames) {
this.targetClass = targetClass; this.targetClass = targetClass;
this.itemNames = itemNames; this.itemNames = itemNames;
} }
...@@ -1008,7 +1010,7 @@ public class DefaultMXBeanMappingFactory extends MXBeanMappingFactory { ...@@ -1008,7 +1010,7 @@ public class DefaultMXBeanMappingFactory extends MXBeanMappingFactory {
private static final class CompositeBuilderViaFrom private static final class CompositeBuilderViaFrom
extends CompositeBuilder { extends CompositeBuilder {
CompositeBuilderViaFrom(Class targetClass, String[] itemNames) { CompositeBuilderViaFrom(Class<?> targetClass, String[] itemNames) {
super(targetClass, itemNames); super(targetClass, itemNames);
} }
...@@ -1018,8 +1020,7 @@ public class DefaultMXBeanMappingFactory extends MXBeanMappingFactory { ...@@ -1018,8 +1020,7 @@ public class DefaultMXBeanMappingFactory extends MXBeanMappingFactory {
Class<?> targetClass = getTargetClass(); Class<?> targetClass = getTargetClass();
try { try {
Method fromMethod = Method fromMethod =
targetClass.getMethod("from", targetClass.getMethod("from", CompositeData.class);
new Class[] {CompositeData.class});
if (!Modifier.isStatic(fromMethod.getModifiers())) { if (!Modifier.isStatic(fromMethod.getModifiers())) {
final String msg = final String msg =
...@@ -1071,7 +1072,7 @@ public class DefaultMXBeanMappingFactory extends MXBeanMappingFactory { ...@@ -1071,7 +1072,7 @@ public class DefaultMXBeanMappingFactory extends MXBeanMappingFactory {
If all the getters are OK, then the "applicable" method will return If all the getters are OK, then the "applicable" method will return
an empty string and the other builders will be tried. */ an empty string and the other builders will be tried. */
private static class CompositeBuilderCheckGetters extends CompositeBuilder { private static class CompositeBuilderCheckGetters extends CompositeBuilder {
CompositeBuilderCheckGetters(Class targetClass, String[] itemNames, CompositeBuilderCheckGetters(Class<?> targetClass, String[] itemNames,
MXBeanMapping[] getterConverters) { MXBeanMapping[] getterConverters) {
super(targetClass, itemNames); super(targetClass, itemNames);
this.getterConverters = getterConverters; this.getterConverters = getterConverters;
...@@ -1115,7 +1116,7 @@ public class DefaultMXBeanMappingFactory extends MXBeanMappingFactory { ...@@ -1115,7 +1116,7 @@ public class DefaultMXBeanMappingFactory extends MXBeanMappingFactory {
Method[] setters = new Method[getters.length]; Method[] setters = new Method[getters.length];
for (int i = 0; i < getters.length; i++) { for (int i = 0; i < getters.length; i++) {
Method getter = getters[i]; Method getter = getters[i];
Class returnType = getter.getReturnType(); Class<?> returnType = getter.getReturnType();
String name = propertyName(getter); String name = propertyName(getter);
String setterName = "set" + name; String setterName = "set" + name;
Method setter; Method setter;
...@@ -1163,7 +1164,7 @@ public class DefaultMXBeanMappingFactory extends MXBeanMappingFactory { ...@@ -1163,7 +1164,7 @@ public class DefaultMXBeanMappingFactory extends MXBeanMappingFactory {
private static final class CompositeBuilderViaConstructor private static final class CompositeBuilderViaConstructor
extends CompositeBuilder { extends CompositeBuilder {
CompositeBuilderViaConstructor(Class targetClass, String[] itemNames) { CompositeBuilderViaConstructor(Class<?> targetClass, String[] itemNames) {
super(targetClass, itemNames); super(targetClass, itemNames);
} }
...@@ -1171,7 +1172,7 @@ public class DefaultMXBeanMappingFactory extends MXBeanMappingFactory { ...@@ -1171,7 +1172,7 @@ public class DefaultMXBeanMappingFactory extends MXBeanMappingFactory {
final Class<ConstructorProperties> propertyNamesClass = ConstructorProperties.class; final Class<ConstructorProperties> propertyNamesClass = ConstructorProperties.class;
Class targetClass = getTargetClass(); Class<?> targetClass = getTargetClass();
Constructor<?>[] constrs = targetClass.getConstructors(); Constructor<?>[] constrs = targetClass.getConstructors();
// Applicable if and only if there are any annotated constructors // Applicable if and only if there are any annotated constructors
...@@ -1384,12 +1385,12 @@ public class DefaultMXBeanMappingFactory extends MXBeanMappingFactory { ...@@ -1384,12 +1385,12 @@ public class DefaultMXBeanMappingFactory extends MXBeanMappingFactory {
private static final class CompositeBuilderViaProxy private static final class CompositeBuilderViaProxy
extends CompositeBuilder { extends CompositeBuilder {
CompositeBuilderViaProxy(Class targetClass, String[] itemNames) { CompositeBuilderViaProxy(Class<?> targetClass, String[] itemNames) {
super(targetClass, itemNames); super(targetClass, itemNames);
} }
String applicable(Method[] getters) { String applicable(Method[] getters) {
Class targetClass = getTargetClass(); Class<?> targetClass = getTargetClass();
if (!targetClass.isInterface()) if (!targetClass.isInterface())
return "not an interface"; return "not an interface";
Set<Method> methods = Set<Method> methods =
...@@ -1401,7 +1402,7 @@ public class DefaultMXBeanMappingFactory extends MXBeanMappingFactory { ...@@ -1401,7 +1402,7 @@ public class DefaultMXBeanMappingFactory extends MXBeanMappingFactory {
String bad = null; String bad = null;
for (Method m : methods) { for (Method m : methods) {
String mname = m.getName(); String mname = m.getName();
Class[] mparams = m.getParameterTypes(); Class<?>[] mparams = m.getParameterTypes();
try { try {
Method om = Object.class.getMethod(mname, mparams); Method om = Object.class.getMethod(mname, mparams);
if (!Modifier.isPublic(om.getModifiers())) if (!Modifier.isPublic(om.getModifiers()))
...@@ -1422,10 +1423,10 @@ public class DefaultMXBeanMappingFactory extends MXBeanMappingFactory { ...@@ -1422,10 +1423,10 @@ public class DefaultMXBeanMappingFactory extends MXBeanMappingFactory {
final Object fromCompositeData(CompositeData cd, final Object fromCompositeData(CompositeData cd,
String[] itemNames, String[] itemNames,
MXBeanMapping[] converters) { MXBeanMapping[] converters) {
final Class targetClass = getTargetClass(); final Class<?> targetClass = getTargetClass();
return return
Proxy.newProxyInstance(targetClass.getClassLoader(), Proxy.newProxyInstance(targetClass.getClassLoader(),
new Class[] {targetClass}, new Class<?>[] {targetClass},
new CompositeDataInvocationHandler(cd)); new CompositeDataInvocationHandler(cd));
} }
} }
...@@ -1447,9 +1448,9 @@ public class DefaultMXBeanMappingFactory extends MXBeanMappingFactory { ...@@ -1447,9 +1448,9 @@ public class DefaultMXBeanMappingFactory extends MXBeanMappingFactory {
return openDataException(cause.getMessage(), cause); return openDataException(cause.getMessage(), cause);
} }
static void mustBeComparable(Class collection, Type element) static void mustBeComparable(Class<?> collection, Type element)
throws OpenDataException { throws OpenDataException {
if (!(element instanceof Class) if (!(element instanceof Class<?>)
|| !Comparable.class.isAssignableFrom((Class<?>) element)) { || !Comparable.class.isAssignableFrom((Class<?>) element)) {
final String msg = final String msg =
"Parameter class " + element + " of " + "Parameter class " + element + " of " +
......
...@@ -115,7 +115,7 @@ public class Introspector { ...@@ -115,7 +115,7 @@ public class Introspector {
* Dynamic MBeans, <code>false</code> otherwise. * Dynamic MBeans, <code>false</code> otherwise.
* *
**/ **/
public static final boolean isDynamic(final Class c) { public static final boolean isDynamic(final Class<?> c) {
// Check if the MBean implements the DynamicMBean interface // Check if the MBean implements the DynamicMBean interface
return javax.management.DynamicMBean.class.isAssignableFrom(c); return javax.management.DynamicMBean.class.isAssignableFrom(c);
} }
...@@ -134,7 +134,7 @@ public class Introspector { ...@@ -134,7 +134,7 @@ public class Introspector {
* MBeanServer. * MBeanServer.
* *
**/ **/
public static void testCreation(Class c) public static void testCreation(Class<?> c)
throws NotCompliantMBeanException { throws NotCompliantMBeanException {
// Check if the class is a concrete class // Check if the class is a concrete class
final int mods = c.getModifiers(); final int mods = c.getModifiers();
...@@ -143,7 +143,7 @@ public class Introspector { ...@@ -143,7 +143,7 @@ public class Introspector {
} }
// Check if the MBean has a public constructor // Check if the MBean has a public constructor
final Constructor[] consList = c.getConstructors(); final Constructor<?>[] consList = c.getConstructors();
if (consList.length == 0) { if (consList.length == 0) {
throw new NotCompliantMBeanException("MBean class must have public constructor"); throw new NotCompliantMBeanException("MBean class must have public constructor");
} }
...@@ -253,7 +253,7 @@ public class Introspector { ...@@ -253,7 +253,7 @@ public class Introspector {
* @exception NotCompliantMBeanException The specified class is not a * @exception NotCompliantMBeanException The specified class is not a
* JMX compliant MBean * JMX compliant MBean
*/ */
public static MBeanInfo testCompliance(Class baseClass) public static MBeanInfo testCompliance(Class<?> baseClass)
throws NotCompliantMBeanException { throws NotCompliantMBeanException {
// ------------------------------ // ------------------------------
...@@ -267,7 +267,7 @@ public class Introspector { ...@@ -267,7 +267,7 @@ public class Introspector {
return testCompliance(baseClass, null); return testCompliance(baseClass, null);
} }
public static void testComplianceMXBeanInterface(Class interfaceClass, public static void testComplianceMXBeanInterface(Class<?> interfaceClass,
MXBeanMappingFactory factory) MXBeanMappingFactory factory)
throws NotCompliantMBeanException { throws NotCompliantMBeanException {
MXBeanIntrospector.getInstance(factory).getAnalyzer(interfaceClass); MXBeanIntrospector.getInstance(factory).getAnalyzer(interfaceClass);
...@@ -596,10 +596,10 @@ public class Introspector { ...@@ -596,10 +596,10 @@ public class Introspector {
ss[i] = (String) annotationToField(xx[i]); ss[i] = (String) annotationToField(xx[i]);
return ss; return ss;
} }
if (x instanceof Class) if (x instanceof Class<?>)
return ((Class<?>) x).getName(); return ((Class<?>) x).getName();
if (x instanceof Enum) if (x instanceof Enum<?>)
return ((Enum) x).name(); return ((Enum<?>) x).name();
// The only other possibility is that the value is another // The only other possibility is that the value is another
// annotation, or that the language has evolved since this code // annotation, or that the language has evolved since this code
// was written. We don't allow for either of those currently. // was written. We don't allow for either of those currently.
......
...@@ -33,6 +33,7 @@ import java.security.AccessController; ...@@ -33,6 +33,7 @@ import java.security.AccessController;
import java.security.Permission; import java.security.Permission;
import java.security.PrivilegedExceptionAction; import java.security.PrivilegedExceptionAction;
import java.util.Iterator; import java.util.Iterator;
import java.util.List;
import java.util.Set; import java.util.Set;
import java.util.logging.Level; import java.util.logging.Level;
...@@ -1144,7 +1145,7 @@ public final class JmxMBeanServer ...@@ -1144,7 +1145,7 @@ public final class JmxMBeanServer
// This call requires MBeanPermission 'getClassLoaderRepository' // This call requires MBeanPermission 'getClassLoaderRepository'
final ClassLoaderRepository clr = getClassLoaderRepository(); final ClassLoaderRepository clr = getClassLoaderRepository();
Class theClass; Class<?> theClass;
try { try {
if (clr == null) throw new ClassNotFoundException(className); if (clr == null) throw new ClassNotFoundException(className);
theClass = clr.loadClass(className); theClass = clr.loadClass(className);
...@@ -1457,23 +1458,22 @@ public final class JmxMBeanServer ...@@ -1457,23 +1458,22 @@ public final class JmxMBeanServer
*/ */
private AttributeList cloneAttributeList(AttributeList list) { private AttributeList cloneAttributeList(AttributeList list) {
if (list != null) { if (list != null) {
List<Attribute> alist = list.asList();
if (!list.getClass().equals(AttributeList.class)) { if (!list.getClass().equals(AttributeList.class)) {
// Create new attribute list // Create new attribute list
// //
AttributeList newList = new AttributeList(list.size()); AttributeList newList = new AttributeList(alist.size());
// Iterate through list and replace non JMX attributes // Iterate through list and replace non JMX attributes
// //
for (Iterator i = list.iterator(); i.hasNext(); ) { for (Attribute attribute : alist)
Attribute attribute = (Attribute) i.next();
newList.add(cloneAttribute(attribute)); newList.add(cloneAttribute(attribute));
}
return newList; return newList;
} else { } else {
// Iterate through list and replace non JMX attributes // Iterate through list and replace non JMX attributes
// //
for (int i = 0; i < list.size(); i++) { for (int i = 0; i < alist.size(); i++) {
Attribute attribute = (Attribute) list.get(i); Attribute attribute = alist.get(i);
if (!attribute.getClass().equals(Attribute.class)) { if (!attribute.getClass().equals(Attribute.class)) {
list.set(i, cloneAttribute(attribute)); list.set(i, cloneAttribute(attribute));
} }
......
...@@ -70,7 +70,7 @@ public class MBeanInstantiator { ...@@ -70,7 +70,7 @@ public class MBeanInstantiator {
* instantiate an MBean of this class in the MBeanServer. * instantiate an MBean of this class in the MBeanServer.
* e.g. it must have a public constructor, be a concrete class... * e.g. it must have a public constructor, be a concrete class...
*/ */
public void testCreation(Class c) throws NotCompliantMBeanException { public void testCreation(Class<?> c) throws NotCompliantMBeanException {
Introspector.testCreation(c); Introspector.testCreation(c);
} }
...@@ -78,10 +78,10 @@ public class MBeanInstantiator { ...@@ -78,10 +78,10 @@ public class MBeanInstantiator {
* Loads the class with the specified name using this object's * Loads the class with the specified name using this object's
* Default Loader Repository. * Default Loader Repository.
**/ **/
public Class findClassWithDefaultLoaderRepository(String className) public Class<?> findClassWithDefaultLoaderRepository(String className)
throws ReflectionException { throws ReflectionException {
Class theClass; Class<?> theClass;
if (className == null) { if (className == null) {
throw new RuntimeOperationsException(new throw new RuntimeOperationsException(new
IllegalArgumentException("The class name cannot be null"), IllegalArgumentException("The class name cannot be null"),
...@@ -105,7 +105,7 @@ public class MBeanInstantiator { ...@@ -105,7 +105,7 @@ public class MBeanInstantiator {
* Gets the class for the specified class name using the MBean * Gets the class for the specified class name using the MBean
* Interceptor's classloader * Interceptor's classloader
*/ */
public Class findClass(String className, ClassLoader loader) public Class<?> findClass(String className, ClassLoader loader)
throws ReflectionException { throws ReflectionException {
return loadClass(className,loader); return loadClass(className,loader);
...@@ -115,7 +115,7 @@ public class MBeanInstantiator { ...@@ -115,7 +115,7 @@ public class MBeanInstantiator {
* Gets the class for the specified class name using the specified * Gets the class for the specified class name using the specified
* class loader * class loader
*/ */
public Class findClass(String className, ObjectName aLoader) public Class<?> findClass(String className, ObjectName aLoader)
throws ReflectionException, InstanceNotFoundException { throws ReflectionException, InstanceNotFoundException {
if (aLoader == null) if (aLoader == null)
...@@ -140,14 +140,14 @@ public class MBeanInstantiator { ...@@ -140,14 +140,14 @@ public class MBeanInstantiator {
* Return an array of Class corresponding to the given signature, using * Return an array of Class corresponding to the given signature, using
* the specified class loader. * the specified class loader.
*/ */
public Class[] findSignatureClasses(String signature[], public Class<?>[] findSignatureClasses(String signature[],
ClassLoader loader) ClassLoader loader)
throws ReflectionException { throws ReflectionException {
if (signature == null) return null; if (signature == null) return null;
final ClassLoader aLoader = loader; final ClassLoader aLoader = loader;
final int length= signature.length; final int length= signature.length;
final Class tab[]=new Class[length]; final Class<?> tab[]=new Class<?>[length];
if (length == 0) return tab; if (length == 0) return tab;
try { try {
...@@ -156,7 +156,7 @@ public class MBeanInstantiator { ...@@ -156,7 +156,7 @@ public class MBeanInstantiator {
// forth) // forth)
// //
final Class primCla = primitiveClasses.get(signature[i]); final Class<?> primCla = primitiveClasses.get(signature[i]);
if (primCla != null) { if (primCla != null) {
tab[i] = primCla; tab[i] = primCla;
continue; continue;
...@@ -203,14 +203,14 @@ public class MBeanInstantiator { ...@@ -203,14 +203,14 @@ public class MBeanInstantiator {
* Instantiates an object given its class, using its empty constructor. * Instantiates an object given its class, using its empty constructor.
* The call returns a reference to the newly created object. * The call returns a reference to the newly created object.
*/ */
public Object instantiate(Class theClass) public Object instantiate(Class<?> theClass)
throws ReflectionException, MBeanException { throws ReflectionException, MBeanException {
Object moi; Object moi;
// ------------------------------ // ------------------------------
// ------------------------------ // ------------------------------
Constructor cons = findConstructor(theClass, null); Constructor<?> cons = findConstructor(theClass, null);
if (cons == null) { if (cons == null) {
throw new ReflectionException(new throw new ReflectionException(new
NoSuchMethodException("No such constructor")); NoSuchMethodException("No such constructor"));
...@@ -257,14 +257,14 @@ public class MBeanInstantiator { ...@@ -257,14 +257,14 @@ public class MBeanInstantiator {
* signature of its constructor The call returns a reference to * signature of its constructor The call returns a reference to
* the newly created object. * the newly created object.
*/ */
public Object instantiate(Class theClass, Object params[], public Object instantiate(Class<?> theClass, Object params[],
String signature[], ClassLoader loader) String signature[], ClassLoader loader)
throws ReflectionException, MBeanException { throws ReflectionException, MBeanException {
// Instantiate the new object // Instantiate the new object
// ------------------------------ // ------------------------------
// ------------------------------ // ------------------------------
final Class[] tab; final Class<?>[] tab;
Object moi; Object moi;
try { try {
// Build the signature of the method // Build the signature of the method
...@@ -283,7 +283,7 @@ public class MBeanInstantiator { ...@@ -283,7 +283,7 @@ public class MBeanInstantiator {
} }
// Query the metadata service to get the right constructor // Query the metadata service to get the right constructor
Constructor cons = findConstructor(theClass, tab); Constructor<?> cons = findConstructor(theClass, tab);
if (cons == null) { if (cons == null) {
throw new ReflectionException(new throw new ReflectionException(new
...@@ -407,7 +407,7 @@ public class MBeanInstantiator { ...@@ -407,7 +407,7 @@ public class MBeanInstantiator {
throw new RuntimeOperationsException(new throw new RuntimeOperationsException(new
IllegalArgumentException(), "Null className passed in parameter"); IllegalArgumentException(), "Null className passed in parameter");
} }
Class theClass; Class<?> theClass;
if (loaderName == null) { if (loaderName == null) {
// Load the class using the agent class loader // Load the class using the agent class loader
theClass = findClass(className, loader); theClass = findClass(className, loader);
...@@ -547,7 +547,7 @@ public class MBeanInstantiator { ...@@ -547,7 +547,7 @@ public class MBeanInstantiator {
throws ReflectionException, throws ReflectionException,
MBeanException { MBeanException {
Class theClass = findClassWithDefaultLoaderRepository(className); Class<?> theClass = findClassWithDefaultLoaderRepository(className);
return instantiate(theClass, params, signature, loader); return instantiate(theClass, params, signature, loader);
} }
...@@ -595,7 +595,7 @@ public class MBeanInstantiator { ...@@ -595,7 +595,7 @@ public class MBeanInstantiator {
// ------------------------------ // ------------------------------
// ------------------------------ // ------------------------------
Class theClass; Class<?> theClass;
if (loaderName == null) { if (loaderName == null) {
theClass = findClass(className, loader); theClass = findClass(className, loader);
...@@ -617,10 +617,10 @@ public class MBeanInstantiator { ...@@ -617,10 +617,10 @@ public class MBeanInstantiator {
* Load a class with the specified loader, or with this object * Load a class with the specified loader, or with this object
* class loader if the specified loader is null. * class loader if the specified loader is null.
**/ **/
static Class loadClass(String className, ClassLoader loader) static Class<?> loadClass(String className, ClassLoader loader)
throws ReflectionException { throws ReflectionException {
Class theClass; Class<?> theClass;
if (className == null) { if (className == null) {
throw new RuntimeOperationsException(new throw new RuntimeOperationsException(new
IllegalArgumentException("The class name cannot be null"), IllegalArgumentException("The class name cannot be null"),
...@@ -647,15 +647,15 @@ public class MBeanInstantiator { ...@@ -647,15 +647,15 @@ public class MBeanInstantiator {
* Load the classes specified in the signature with the given loader, * Load the classes specified in the signature with the given loader,
* or with this object class loader. * or with this object class loader.
**/ **/
static Class[] loadSignatureClasses(String signature[], static Class<?>[] loadSignatureClasses(String signature[],
ClassLoader loader) ClassLoader loader)
throws ReflectionException { throws ReflectionException {
if (signature == null) return null; if (signature == null) return null;
final ClassLoader aLoader = final ClassLoader aLoader =
(loader==null?MBeanInstantiator.class.getClassLoader():loader); (loader==null?MBeanInstantiator.class.getClassLoader():loader);
final int length= signature.length; final int length= signature.length;
final Class tab[]=new Class[length]; final Class<?> tab[]=new Class<?>[length];
if (length == 0) return tab; if (length == 0) return tab;
try { try {
...@@ -664,7 +664,7 @@ public class MBeanInstantiator { ...@@ -664,7 +664,7 @@ public class MBeanInstantiator {
// forth) // forth)
// //
final Class primCla = primitiveClasses.get(signature[i]); final Class<?> primCla = primitiveClasses.get(signature[i]);
if (primCla != null) { if (primCla != null) {
tab[i] = primCla; tab[i] = primCla;
continue; continue;
...@@ -710,9 +710,9 @@ public class MBeanInstantiator { ...@@ -710,9 +710,9 @@ public class MBeanInstantiator {
private static final Map<String, Class<?>> primitiveClasses = Util.newMap(); private static final Map<String, Class<?>> primitiveClasses = Util.newMap();
static { static {
for (Class<?> c : new Class[] {byte.class, short.class, int.class, for (Class<?> c : new Class<?>[] {byte.class, short.class, int.class,
long.class, float.class, double.class, long.class, float.class, double.class,
char.class, boolean.class}) char.class, boolean.class})
primitiveClasses.put(c.getName(), c); primitiveClasses.put(c.getName(), c);
} }
} }
...@@ -160,7 +160,7 @@ class MXBeanIntrospector extends MBeanIntrospector<ConvertingMethod> { ...@@ -160,7 +160,7 @@ class MXBeanIntrospector extends MBeanIntrospector<ConvertingMethod> {
// matched to the corresponding Java type, except when that // matched to the corresponding Java type, except when that
// type is primitive. // type is primitive.
Type t = m.getGenericParameterTypes()[paramNo]; Type t = m.getGenericParameterTypes()[paramNo];
return (!(t instanceof Class) || !((Class) t).isPrimitive()); return (!(t instanceof Class<?>) || !((Class<?>) t).isPrimitive());
} else { } else {
Object v; Object v;
try { try {
...@@ -354,7 +354,7 @@ class MXBeanIntrospector extends MBeanIntrospector<ConvertingMethod> { ...@@ -354,7 +354,7 @@ class MXBeanIntrospector extends MBeanIntrospector<ConvertingMethod> {
} }
} }
private static Descriptor typeDescriptor(OpenType openType, private static Descriptor typeDescriptor(OpenType<?> openType,
Type originalType) { Type originalType) {
return new ImmutableDescriptor( return new ImmutableDescriptor(
new String[] {"openType", new String[] {"openType",
...@@ -380,16 +380,16 @@ class MXBeanIntrospector extends MBeanIntrospector<ConvertingMethod> { ...@@ -380,16 +380,16 @@ class MXBeanIntrospector extends MBeanIntrospector<ConvertingMethod> {
if (type instanceof GenericArrayType) { if (type instanceof GenericArrayType) {
return canUseOpenInfo( return canUseOpenInfo(
((GenericArrayType) type).getGenericComponentType()); ((GenericArrayType) type).getGenericComponentType());
} else if (type instanceof Class && ((Class<?>) type).isArray()) { } else if (type instanceof Class<?> && ((Class<?>) type).isArray()) {
return canUseOpenInfo( return canUseOpenInfo(
((Class<?>) type).getComponentType()); ((Class<?>) type).getComponentType());
} }
return (!(type instanceof Class && ((Class<?>) type).isPrimitive())); return (!(type instanceof Class<?> && ((Class<?>) type).isPrimitive()));
} }
private static String originalTypeString(Type type) { private static String originalTypeString(Type type) {
if (type instanceof Class) if (type instanceof Class<?>)
return ((Class) type).getName(); return ((Class<?>) type).getName();
else else
return genericTypeString(type); return genericTypeString(type);
} }
......
...@@ -54,7 +54,8 @@ class ObjectInputStreamWithLoader extends ObjectInputStream { ...@@ -54,7 +54,8 @@ class ObjectInputStreamWithLoader extends ObjectInputStream {
this.loader = theLoader; this.loader = theLoader;
} }
protected Class resolveClass(ObjectStreamClass aClass) @Override
protected Class<?> resolveClass(ObjectStreamClass aClass)
throws IOException, ClassNotFoundException { throws IOException, ClassNotFoundException {
if (loader == null) { if (loader == null) {
return super.resolveClass(aClass); return super.resolveClass(aClass);
......
...@@ -47,16 +47,16 @@ final class SecureClassLoaderRepository ...@@ -47,16 +47,16 @@ final class SecureClassLoaderRepository
public SecureClassLoaderRepository(ClassLoaderRepository clr) { public SecureClassLoaderRepository(ClassLoaderRepository clr) {
this.clr=clr; this.clr=clr;
} }
public final Class loadClass(String className) public final Class<?> loadClass(String className)
throws ClassNotFoundException { throws ClassNotFoundException {
return clr.loadClass(className); return clr.loadClass(className);
} }
public final Class loadClassWithout(ClassLoader loader, public final Class<?> loadClassWithout(ClassLoader loader,
String className) String className)
throws ClassNotFoundException { throws ClassNotFoundException {
return clr.loadClassWithout(loader,className); return clr.loadClassWithout(loader,className);
} }
public final Class loadClassBefore(ClassLoader loader, public final Class<?> loadClassBefore(ClassLoader loader,
String className) String className)
throws ClassNotFoundException { throws ClassNotFoundException {
return clr.loadClassBefore(loader,className); return clr.loadClassBefore(loader,className);
......
...@@ -669,7 +669,7 @@ public class Util { ...@@ -669,7 +669,7 @@ public class Util {
} }
public static <T> Set<T> cloneSet(Set<T> set) { public static <T> Set<T> cloneSet(Set<T> set) {
if (set instanceof SortedSet) { if (set instanceof SortedSet<?>) {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
SortedSet<T> sset = (SortedSet<T>) set; SortedSet<T> sset = (SortedSet<T>) set;
set = new TreeSet<T>(sset.comparator()); set = new TreeSet<T>(sset.comparator());
...@@ -680,7 +680,7 @@ public class Util { ...@@ -680,7 +680,7 @@ public class Util {
} }
public static <T> Set<T> equivalentEmptySet(Set<T> set) { public static <T> Set<T> equivalentEmptySet(Set<T> set) {
if (set instanceof SortedSet) { if (set instanceof SortedSet<?>) {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
SortedSet<T> sset = (SortedSet<T>) set; SortedSet<T> sset = (SortedSet<T>) set;
set = new TreeSet<T>(sset.comparator()); set = new TreeSet<T>(sset.comparator());
......
...@@ -118,9 +118,9 @@ class WeakIdentityHashMap<K, V> { ...@@ -118,9 +118,9 @@ class WeakIdentityHashMap<K, V> {
public boolean equals(Object o) { public boolean equals(Object o) {
if (this == o) if (this == o)
return true; return true;
if (!(o instanceof IdentityWeakReference)) if (!(o instanceof IdentityWeakReference<?>))
return false; return false;
IdentityWeakReference wr = (IdentityWeakReference) o; IdentityWeakReference<?> wr = (IdentityWeakReference<?>) o;
Object got = get(); Object got = get();
return (got != null && got == wr.get()); return (got != null && got == wr.get());
} }
......
...@@ -120,7 +120,7 @@ public class ArrayNotificationBuffer implements NotificationBuffer { ...@@ -120,7 +120,7 @@ public class ArrayNotificationBuffer implements NotificationBuffer {
private final Collection<ShareBuffer> sharers = new HashSet<ShareBuffer>(1); private final Collection<ShareBuffer> sharers = new HashSet<ShareBuffer>(1);
public static NotificationBuffer getNotificationBuffer( public static NotificationBuffer getNotificationBuffer(
MBeanServer mbs, Map env) { MBeanServer mbs, Map<String, ?> env) {
if (env == null) if (env == null)
env = Collections.emptyMap(); env = Collections.emptyMap();
......
...@@ -54,7 +54,7 @@ import com.sun.jmx.remote.util.EnvHelp; ...@@ -54,7 +54,7 @@ import com.sun.jmx.remote.util.EnvHelp;
public abstract class ClientNotifForwarder { public abstract class ClientNotifForwarder {
public ClientNotifForwarder(Map env) { public ClientNotifForwarder(Map<String, ?> env) {
this(null, env); this(null, env);
} }
...@@ -113,7 +113,7 @@ public abstract class ClientNotifForwarder { ...@@ -113,7 +113,7 @@ public abstract class ClientNotifForwarder {
private Thread thread; private Thread thread;
} }
public ClientNotifForwarder(ClassLoader defaultClassLoader, Map env) { public ClientNotifForwarder(ClassLoader defaultClassLoader, Map<String, ?> env) {
maxNotifications = EnvHelp.getMaxFetchNotifNumber(env); maxNotifications = EnvHelp.getMaxFetchNotifNumber(env);
timeout = EnvHelp.getFetchTimeout(env); timeout = EnvHelp.getFetchTimeout(env);
......
...@@ -36,7 +36,7 @@ import org.omg.CORBA.ORB; ...@@ -36,7 +36,7 @@ import org.omg.CORBA.ORB;
import org.omg.CORBA.TypeCode; import org.omg.CORBA.TypeCode;
import org.omg.CORBA.portable.BoxedValueHelper; import org.omg.CORBA.portable.BoxedValueHelper;
@SuppressWarnings("deprecation") @SuppressWarnings({"deprecation", "rawtypes"})
public class ProxyInputStream extends org.omg.CORBA_2_3.portable.InputStream { public class ProxyInputStream extends org.omg.CORBA_2_3.portable.InputStream {
public ProxyInputStream(org.omg.CORBA.portable.InputStream in) { public ProxyInputStream(org.omg.CORBA.portable.InputStream in) {
this.in = in; this.in = in;
......
...@@ -59,7 +59,7 @@ public class ServerNotifForwarder { ...@@ -59,7 +59,7 @@ public class ServerNotifForwarder {
public ServerNotifForwarder(MBeanServer mbeanServer, public ServerNotifForwarder(MBeanServer mbeanServer,
Map env, Map<String, ?> env,
NotificationBuffer notifBuffer, NotificationBuffer notifBuffer,
String connectionId) { String connectionId) {
this.mbeanServer = mbeanServer; this.mbeanServer = mbeanServer;
......
...@@ -29,6 +29,6 @@ import java.io.IOException; ...@@ -29,6 +29,6 @@ import java.io.IOException;
import java.rmi.MarshalledObject; import java.rmi.MarshalledObject;
public interface Unmarshal { public interface Unmarshal {
public Object get(MarshalledObject mo) public Object get(MarshalledObject<?> mo)
throws IOException, ClassNotFoundException; throws IOException, ClassNotFoundException;
} }
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
package com.sun.jmx.remote.security; package com.sun.jmx.remote.security;
import com.sun.jmx.mbeanserver.GetPropertyAction; import com.sun.jmx.mbeanserver.GetPropertyAction;
import com.sun.jmx.mbeanserver.Util;
import java.io.BufferedInputStream; import java.io.BufferedInputStream;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
...@@ -146,8 +147,8 @@ public class FileLoginModule implements LoginModule { ...@@ -146,8 +147,8 @@ public class FileLoginModule implements LoginModule {
// Initial state // Initial state
private Subject subject; private Subject subject;
private CallbackHandler callbackHandler; private CallbackHandler callbackHandler;
private Map<String, ?> sharedState; private Map<String, Object> sharedState;
private Map options; private Map<String, ?> options;
private String passwordFile; private String passwordFile;
private String passwordFileDisplayName; private String passwordFileDisplayName;
private boolean userSuppliedPasswordFile; private boolean userSuppliedPasswordFile;
...@@ -172,7 +173,7 @@ public class FileLoginModule implements LoginModule { ...@@ -172,7 +173,7 @@ public class FileLoginModule implements LoginModule {
this.subject = subject; this.subject = subject;
this.callbackHandler = callbackHandler; this.callbackHandler = callbackHandler;
this.sharedState = sharedState; this.sharedState = Util.cast(sharedState);
this.options = options; this.options = options;
// initialize any configured options // initialize any configured options
...@@ -454,8 +455,8 @@ public class FileLoginModule implements LoginModule { ...@@ -454,8 +455,8 @@ public class FileLoginModule implements LoginModule {
if (storePass && if (storePass &&
!sharedState.containsKey(USERNAME_KEY) && !sharedState.containsKey(USERNAME_KEY) &&
!sharedState.containsKey(PASSWORD_KEY)) { !sharedState.containsKey(PASSWORD_KEY)) {
((Map) sharedState).put(USERNAME_KEY, username); sharedState.put(USERNAME_KEY, username);
((Map) sharedState).put(PASSWORD_KEY, password); sharedState.put(PASSWORD_KEY, password);
} }
// Create a new user principal // Create a new user principal
......
...@@ -87,7 +87,7 @@ public final class JMXPluggableAuthenticator implements JMXAuthenticator { ...@@ -87,7 +87,7 @@ public final class JMXPluggableAuthenticator implements JMXAuthenticator {
* @exception SecurityException if the authentication mechanism cannot be * @exception SecurityException if the authentication mechanism cannot be
* initialized. * initialized.
*/ */
public JMXPluggableAuthenticator(Map env) { public JMXPluggableAuthenticator(Map<?, ?> env) {
String loginConfigName = null; String loginConfigName = null;
String passwordFile = null; String passwordFile = null;
......
...@@ -249,9 +249,8 @@ public class MBeanServerFileAccessController ...@@ -249,9 +249,8 @@ public class MBeanServerFileAccessController
} }
}); });
if (s == null) return; /* security has not been enabled */ if (s == null) return; /* security has not been enabled */
final Set principals = s.getPrincipals(); final Set<Principal> principals = s.getPrincipals();
for (Iterator i = principals.iterator(); i.hasNext(); ) { for (Principal p : principals) {
final Principal p = (Principal) i.next();
String grantedAccessLevel; String grantedAccessLevel;
synchronized (props) { synchronized (props) {
grantedAccessLevel = props.getProperty(p.getName()); grantedAccessLevel = props.getProperty(p.getName());
...@@ -271,8 +270,8 @@ public class MBeanServerFileAccessController ...@@ -271,8 +270,8 @@ public class MBeanServerFileAccessController
} }
private void checkValues(Properties props) { private void checkValues(Properties props) {
Collection c = props.values(); Collection<?> c = props.values();
for (Iterator i = c.iterator(); i.hasNext(); ) { for (Iterator<?> i = c.iterator(); i.hasNext(); ) {
final String accessLevel = (String) i.next(); final String accessLevel = (String) i.next();
if (!accessLevel.equals(READONLY) && if (!accessLevel.equals(READONLY) &&
!accessLevel.equals(READWRITE)) { !accessLevel.equals(READWRITE)) {
......
...@@ -38,7 +38,7 @@ public class ClassLoaderWithRepository extends ClassLoader { ...@@ -38,7 +38,7 @@ public class ClassLoaderWithRepository extends ClassLoader {
this.cl2 = cl2; this.cl2 = cl2;
} }
protected Class findClass(String name) throws ClassNotFoundException { protected Class<?> findClass(String name) throws ClassNotFoundException {
try { try {
return repository.loadClass(name); return repository.loadClass(name);
} catch (ClassNotFoundException cne) { } catch (ClassNotFoundException cne) {
......
...@@ -41,7 +41,7 @@ public class ClassLogger { ...@@ -41,7 +41,7 @@ public class ClassLogger {
people to use at least J2SE 1.4. */ people to use at least J2SE 1.4. */
boolean loaded = false; boolean loaded = false;
try { try {
Class c = java.util.logging.Logger.class; Class<?> c = java.util.logging.Logger.class;
loaded = true; loaded = true;
} catch (Error e) { } catch (Error e) {
// OK. // OK.
......
...@@ -117,7 +117,7 @@ public class EnvHelp { ...@@ -117,7 +117,7 @@ public class EnvHelp {
* <code>jmx.remote.default.class.loader.name</code> is specified * <code>jmx.remote.default.class.loader.name</code> is specified
* and the ClassLoader MBean is not found in <var>mbs</var>. * and the ClassLoader MBean is not found in <var>mbs</var>.
*/ */
public static ClassLoader resolveServerClassLoader(Map env, public static ClassLoader resolveServerClassLoader(Map<String, ?> env,
MBeanServer mbs) MBeanServer mbs)
throws InstanceNotFoundException { throws InstanceNotFoundException {
...@@ -194,7 +194,7 @@ public class EnvHelp { ...@@ -194,7 +194,7 @@ public class EnvHelp {
* <code>jmx.remote.default.class.loader</code> is specified * <code>jmx.remote.default.class.loader</code> is specified
* and is not an instance of {@link ClassLoader}. * and is not an instance of {@link ClassLoader}.
*/ */
public static ClassLoader resolveClientClassLoader(Map env) { public static ClassLoader resolveClientClassLoader(Map<String, ?> env) {
if (env == null) if (env == null)
return Thread.currentThread().getContextClassLoader(); return Thread.currentThread().getContextClassLoader();
...@@ -241,7 +241,7 @@ public class EnvHelp { ...@@ -241,7 +241,7 @@ public class EnvHelp {
try { try {
java.lang.reflect.Method getCause = java.lang.reflect.Method getCause =
t.getClass().getMethod("getCause", (Class[]) null); t.getClass().getMethod("getCause", (Class<?>[]) null);
ret = (Throwable)getCause.invoke(t, (Object[]) null); ret = (Throwable)getCause.invoke(t, (Object[]) null);
} catch (Exception e) { } catch (Exception e) {
...@@ -264,7 +264,7 @@ public class EnvHelp { ...@@ -264,7 +264,7 @@ public class EnvHelp {
* Returns the size of a notification buffer for a connector server. * Returns the size of a notification buffer for a connector server.
* The default value is 1000. * The default value is 1000.
*/ */
public static int getNotifBufferSize(Map env) { public static int getNotifBufferSize(Map<String, ?> env) {
int defaultQueueSize = 1000; // default value int defaultQueueSize = 1000; // default value
// keep it for the compability for the fix: // keep it for the compability for the fix:
...@@ -327,7 +327,7 @@ public class EnvHelp { ...@@ -327,7 +327,7 @@ public class EnvHelp {
* Returns the maximum notification number which a client will * Returns the maximum notification number which a client will
* fetch every time. * fetch every time.
*/ */
public static int getMaxFetchNotifNumber(Map env) { public static int getMaxFetchNotifNumber(Map<String, ?> env) {
return (int) getIntegerAttribute(env, MAX_FETCH_NOTIFS, 1000, 1, return (int) getIntegerAttribute(env, MAX_FETCH_NOTIFS, 1000, 1,
Integer.MAX_VALUE); Integer.MAX_VALUE);
} }
...@@ -344,7 +344,7 @@ public class EnvHelp { ...@@ -344,7 +344,7 @@ public class EnvHelp {
/** /**
* Returns the timeout for a client to fetch notifications. * Returns the timeout for a client to fetch notifications.
*/ */
public static long getFetchTimeout(Map env) { public static long getFetchTimeout(Map<String, ?> env) {
return getIntegerAttribute(env, FETCH_TIMEOUT, 60000L, 0, return getIntegerAttribute(env, FETCH_TIMEOUT, 60000L, 0,
Long.MAX_VALUE); Long.MAX_VALUE);
} }
...@@ -361,7 +361,7 @@ public class EnvHelp { ...@@ -361,7 +361,7 @@ public class EnvHelp {
"com.sun.jmx.remote.notification.access.controller"; "com.sun.jmx.remote.notification.access.controller";
public static NotificationAccessController getNotificationAccessController( public static NotificationAccessController getNotificationAccessController(
Map env) { Map<String, ?> env) {
return (env == null) ? null : return (env == null) ? null :
(NotificationAccessController) env.get(NOTIF_ACCESS_CONTROLLER); (NotificationAccessController) env.get(NOTIF_ACCESS_CONTROLLER);
} }
...@@ -378,7 +378,7 @@ public class EnvHelp { ...@@ -378,7 +378,7 @@ public class EnvHelp {
* an entry for <code>name</code> but it does not meet the * an entry for <code>name</code> but it does not meet the
* constraints above. * constraints above.
*/ */
public static long getIntegerAttribute(Map env, String name, public static long getIntegerAttribute(Map<String, ?> env, String name,
long defaultValue, long minValue, long defaultValue, long minValue,
long maxValue) { long maxValue) {
final Object o; final Object o;
...@@ -421,9 +421,8 @@ public class EnvHelp { ...@@ -421,9 +421,8 @@ public class EnvHelp {
/* Check that all attributes have a key that is a String. /* Check that all attributes have a key that is a String.
Could make further checks, e.g. appropriate types for attributes. */ Could make further checks, e.g. appropriate types for attributes. */
public static void checkAttributes(Map attributes) { public static void checkAttributes(Map<?, ?> attributes) {
for (Iterator it = attributes.keySet().iterator(); it.hasNext(); ) { for (Object key : attributes.keySet()) {
Object key = it.next();
if (!(key instanceof String)) { if (!(key instanceof String)) {
final String msg = final String msg =
"Attributes contain key that is not a string: " + key; "Attributes contain key that is not a string: " + key;
...@@ -455,7 +454,7 @@ public class EnvHelp { ...@@ -455,7 +454,7 @@ public class EnvHelp {
logger.trace("purgeUnserializable", "starts"); logger.trace("purgeUnserializable", "starts");
ObjectOutputStream oos = null; ObjectOutputStream oos = null;
int i = 0; int i = 0;
for (Iterator it = objects.iterator(); it.hasNext(); i++) { for (Iterator<?> it = objects.iterator(); it.hasNext(); i++) {
Object v = it.next(); Object v = it.next();
if (v == null || v instanceof String) { if (v == null || v instanceof String) {
...@@ -564,18 +563,18 @@ public class EnvHelp { ...@@ -564,18 +563,18 @@ public class EnvHelp {
guarantees that we will never call next() on the corresponding guarantees that we will never call next() on the corresponding
iterator. */ iterator. */
String sentinelKey = map.lastKey() + "X"; String sentinelKey = map.lastKey() + "X";
Iterator keyIterator = map.keySet().iterator(); Iterator<String> keyIterator = map.keySet().iterator();
Iterator stringIterator = hiddenStrings.iterator(); Iterator<String> stringIterator = hiddenStrings.iterator();
Iterator prefixIterator = hiddenPrefixes.iterator(); Iterator<String> prefixIterator = hiddenPrefixes.iterator();
String nextString; String nextString;
if (stringIterator.hasNext()) if (stringIterator.hasNext())
nextString = (String) stringIterator.next(); nextString = stringIterator.next();
else else
nextString = sentinelKey; nextString = sentinelKey;
String nextPrefix; String nextPrefix;
if (prefixIterator.hasNext()) if (prefixIterator.hasNext())
nextPrefix = (String) prefixIterator.next(); nextPrefix = prefixIterator.next();
else else
nextPrefix = sentinelKey; nextPrefix = sentinelKey;
...@@ -583,7 +582,7 @@ public class EnvHelp { ...@@ -583,7 +582,7 @@ public class EnvHelp {
or prefix, remove it. */ or prefix, remove it. */
keys: keys:
while (keyIterator.hasNext()) { while (keyIterator.hasNext()) {
String key = (String) keyIterator.next(); String key = keyIterator.next();
/* Continue through string-match values until we find one /* Continue through string-match values until we find one
that is either greater than the current key, or equal that is either greater than the current key, or equal
...@@ -591,7 +590,7 @@ public class EnvHelp { ...@@ -591,7 +590,7 @@ public class EnvHelp {
int cmp = +1; int cmp = +1;
while ((cmp = nextString.compareTo(key)) < 0) { while ((cmp = nextString.compareTo(key)) < 0) {
if (stringIterator.hasNext()) if (stringIterator.hasNext())
nextString = (String) stringIterator.next(); nextString = stringIterator.next();
else else
nextString = sentinelKey; nextString = sentinelKey;
} }
...@@ -609,7 +608,7 @@ public class EnvHelp { ...@@ -609,7 +608,7 @@ public class EnvHelp {
continue keys; continue keys;
} }
if (prefixIterator.hasNext()) if (prefixIterator.hasNext())
nextPrefix = (String) prefixIterator.next(); nextPrefix = prefixIterator.next();
else else
nextPrefix = sentinelKey; nextPrefix = sentinelKey;
} }
...@@ -640,7 +639,7 @@ public class EnvHelp { ...@@ -640,7 +639,7 @@ public class EnvHelp {
/** /**
* Returns the server side connection timeout. * Returns the server side connection timeout.
*/ */
public static long getServerConnectionTimeout(Map env) { public static long getServerConnectionTimeout(Map<String, ?> env) {
return getIntegerAttribute(env, SERVER_CONNECTION_TIMEOUT, 120000L, return getIntegerAttribute(env, SERVER_CONNECTION_TIMEOUT, 120000L,
0, Long.MAX_VALUE); 0, Long.MAX_VALUE);
} }
...@@ -656,7 +655,7 @@ public class EnvHelp { ...@@ -656,7 +655,7 @@ public class EnvHelp {
/** /**
* Returns the client connection check period. * Returns the client connection check period.
*/ */
public static long getConnectionCheckPeriod(Map env) { public static long getConnectionCheckPeriod(Map<String, ?> env) {
return getIntegerAttribute(env, CLIENT_CONNECTION_CHECK_PERIOD, 60000L, return getIntegerAttribute(env, CLIENT_CONNECTION_CHECK_PERIOD, 60000L,
0, Long.MAX_VALUE); 0, Long.MAX_VALUE);
} }
...@@ -691,7 +690,7 @@ public class EnvHelp { ...@@ -691,7 +690,7 @@ public class EnvHelp {
* to {@code String}. * to {@code String}.
*/ */
public static boolean computeBooleanFromString( public static boolean computeBooleanFromString(
Map env, String prop, boolean systemProperty) { Map<String, ?> env, String prop, boolean systemProperty) {
if (env == null) if (env == null)
throw new IllegalArgumentException("env map cannot be null"); throw new IllegalArgumentException("env map cannot be null");
...@@ -744,7 +743,8 @@ public class EnvHelp { ...@@ -744,7 +743,8 @@ public class EnvHelp {
* to {@code String}. * to {@code String}.
*/ */
public static boolean computeBooleanFromString( public static boolean computeBooleanFromString(
Map env, String prop, boolean systemProperty, boolean defaultValue) { Map<String, ?> env, String prop,
boolean systemProperty, boolean defaultValue) {
if (env == null) if (env == null)
throw new IllegalArgumentException("env map cannot be null"); throw new IllegalArgumentException("env map cannot be null");
...@@ -774,7 +774,7 @@ public class EnvHelp { ...@@ -774,7 +774,7 @@ public class EnvHelp {
public static <K, V> Hashtable<K, V> mapToHashtable(Map<K, V> map) { public static <K, V> Hashtable<K, V> mapToHashtable(Map<K, V> map) {
HashMap<K, V> m = new HashMap<K, V>(map); HashMap<K, V> m = new HashMap<K, V>(map);
if (m.containsKey(null)) m.remove(null); if (m.containsKey(null)) m.remove(null);
for (Iterator i = m.values().iterator(); i.hasNext(); ) for (Iterator<?> i = m.values().iterator(); i.hasNext(); )
if (i.next() == null) i.remove(); if (i.next() == null) i.remove();
return new Hashtable<K, V>(m); return new Hashtable<K, V>(m);
} }
...@@ -783,7 +783,7 @@ public class EnvHelp { ...@@ -783,7 +783,7 @@ public class EnvHelp {
* Returns true if the parameter JMXConnector.USE_EVENT_SERVICE is set to a * Returns true if the parameter JMXConnector.USE_EVENT_SERVICE is set to a
* String equals "true" by ignoring case in the map or in the System. * String equals "true" by ignoring case in the map or in the System.
*/ */
public static boolean eventServiceEnabled(Map env) { public static boolean eventServiceEnabled(Map<String, ?> env) {
return computeBooleanFromString(env, JMXConnector.USE_EVENT_SERVICE, true); return computeBooleanFromString(env, JMXConnector.USE_EVENT_SERVICE, true);
} }
...@@ -793,7 +793,7 @@ public class EnvHelp { ...@@ -793,7 +793,7 @@ public class EnvHelp {
* If the property DELEGATE_TO_EVENT_SERVICE is not set, returns * If the property DELEGATE_TO_EVENT_SERVICE is not set, returns
* a default value of "true". * a default value of "true".
*/ */
public static boolean delegateToEventService(Map env) { public static boolean delegateToEventService(Map<String, ?> env) {
return computeBooleanFromString(env, return computeBooleanFromString(env,
JMXConnectorServer.DELEGATE_TO_EVENT_SERVICE, true, true); JMXConnectorServer.DELEGATE_TO_EVENT_SERVICE, true, true);
} }
......
...@@ -138,8 +138,8 @@ public class EventClientConnection implements InvocationHandler, ...@@ -138,8 +138,8 @@ public class EventClientConnection implements InvocationHandler,
Class<T> interfaceClass, Callable<EventClient> eventClientFactory) { Class<T> interfaceClass, Callable<EventClient> eventClientFactory) {
final InvocationHandler handler = final InvocationHandler handler =
new EventClientConnection(connection,eventClientFactory); new EventClientConnection(connection,eventClientFactory);
final Class[] interfaces = final Class<?>[] interfaces =
new Class[] {interfaceClass, EventClientFactory.class}; new Class<?>[] {interfaceClass, EventClientFactory.class};
Object proxy = Object proxy =
Proxy.newProxyInstance(interfaceClass.getClassLoader(), Proxy.newProxyInstance(interfaceClass.getClassLoader(),
...@@ -156,7 +156,7 @@ public class EventClientConnection implements InvocationHandler, ...@@ -156,7 +156,7 @@ public class EventClientConnection implements InvocationHandler,
// add/remove notification listener are routed to the EventClient // add/remove notification listener are routed to the EventClient
if (methodName.equals("addNotificationListener") if (methodName.equals("addNotificationListener")
|| methodName.equals("removeNotificationListener")) { || methodName.equals("removeNotificationListener")) {
final Class[] sig = method.getParameterTypes(); final Class<?>[] sig = method.getParameterTypes();
if (sig.length>1 && if (sig.length>1 &&
NotificationListener.class.isAssignableFrom(sig[1])) { NotificationListener.class.isAssignableFrom(sig[1])) {
return invokeBroadcasterMethod(proxy,method,args); return invokeBroadcasterMethod(proxy,method,args);
...@@ -164,7 +164,7 @@ public class EventClientConnection implements InvocationHandler, ...@@ -164,7 +164,7 @@ public class EventClientConnection implements InvocationHandler,
} }
// subscribe/unsubscribe are also routed to the EventClient. // subscribe/unsubscribe are also routed to the EventClient.
final Class clazz = method.getDeclaringClass(); final Class<?> clazz = method.getDeclaringClass();
if (clazz.equals(EventClientFactory.class)) { if (clazz.equals(EventClientFactory.class)) {
return invokeEventClientSubscriberMethod(proxy,method,args); return invokeEventClientSubscriberMethod(proxy,method,args);
} }
...@@ -319,7 +319,7 @@ public class EventClientConnection implements InvocationHandler, ...@@ -319,7 +319,7 @@ public class EventClientConnection implements InvocationHandler,
return true; return true;
if (methodName.equals("equals") if (methodName.equals("equals")
&& Arrays.equals(method.getParameterTypes(), && Arrays.equals(method.getParameterTypes(),
new Class[] {Object.class}) new Class<?>[] {Object.class})
&& isLocal(proxy, method)) && isLocal(proxy, method))
return true; return true;
return false; return false;
......
...@@ -32,7 +32,7 @@ public class OrderClassLoaders extends ClassLoader { ...@@ -32,7 +32,7 @@ public class OrderClassLoaders extends ClassLoader {
this.cl2 = cl2; this.cl2 = cl2;
} }
protected Class findClass(String name) throws ClassNotFoundException { protected Class<?> findClass(String name) throws ClassNotFoundException {
try { try {
return super.findClass(name); return super.findClass(name);
} catch (ClassNotFoundException cne) { } catch (ClassNotFoundException cne) {
......
...@@ -159,7 +159,7 @@ public class AttributeList extends ArrayList<Object> { ...@@ -159,7 +159,7 @@ public class AttributeList extends ArrayList<Object> {
checkTypeSafe(this); checkTypeSafe(this);
typeSafe = true; typeSafe = true;
} }
return (List<Attribute>) (List) this; return (List<Attribute>) (List<?>) this;
} }
/** /**
......
...@@ -62,7 +62,7 @@ public class DefaultLoaderRepository { ...@@ -62,7 +62,7 @@ public class DefaultLoaderRepository {
* *
* @exception ClassNotFoundException The specified class could not be found. * @exception ClassNotFoundException The specified class could not be found.
*/ */
public static Class loadClass(String className) public static Class<?> loadClass(String className)
throws ClassNotFoundException { throws ClassNotFoundException {
return javax.management.loading.DefaultLoaderRepository.loadClass(className); return javax.management.loading.DefaultLoaderRepository.loadClass(className);
} }
...@@ -82,7 +82,7 @@ public class DefaultLoaderRepository { ...@@ -82,7 +82,7 @@ public class DefaultLoaderRepository {
* *
* @exception ClassNotFoundException The specified class could not be found. * @exception ClassNotFoundException The specified class could not be found.
*/ */
public static Class loadClassWithout(ClassLoader loader,String className) public static Class<?> loadClassWithout(ClassLoader loader,String className)
throws ClassNotFoundException { throws ClassNotFoundException {
return javax.management.loading.DefaultLoaderRepository.loadClassWithout(loader, className); return javax.management.loading.DefaultLoaderRepository.loadClassWithout(loader, className);
} }
......
...@@ -70,7 +70,7 @@ public class JMRuntimeException extends RuntimeException { ...@@ -70,7 +70,7 @@ public class JMRuntimeException extends RuntimeException {
try { try {
java.lang.reflect.Method initCause = java.lang.reflect.Method initCause =
Throwable.class.getMethod("initCause", Throwable.class.getMethod("initCause",
new Class[] {Throwable.class}); new Class<?>[] {Throwable.class});
initCause.invoke(this, new Object[] {cause}); initCause.invoke(this, new Object[] {cause});
} catch (Exception e) { } catch (Exception e) {
// OK: just means we won't have debugging info // OK: just means we won't have debugging info
......
...@@ -703,12 +703,12 @@ public class JMX { ...@@ -703,12 +703,12 @@ public class JMX {
InvocationHandler handler = new MBeanServerInvocationHandler( InvocationHandler handler = new MBeanServerInvocationHandler(
connection, objectName, opts); connection, objectName, opts);
final Class[] interfaces; final Class<?>[] interfaces;
if (notificationEmitter) { if (notificationEmitter) {
interfaces = interfaces =
new Class<?>[] {interfaceClass, NotificationEmitter.class}; new Class<?>[] {interfaceClass, NotificationEmitter.class};
} else } else
interfaces = new Class[] {interfaceClass}; interfaces = new Class<?>[] {interfaceClass};
Object proxy = Proxy.newProxyInstance( Object proxy = Proxy.newProxyInstance(
interfaceClass.getClassLoader(), interfaceClass.getClassLoader(),
interfaces, interfaces,
......
...@@ -316,7 +316,7 @@ public class MBeanAttributeInfo extends MBeanFeatureInfo implements Cloneable { ...@@ -316,7 +316,7 @@ public class MBeanAttributeInfo extends MBeanFeatureInfo implements Cloneable {
*/ */
private static String attributeType(Method getter, Method setter) private static String attributeType(Method getter, Method setter)
throws IntrospectionException { throws IntrospectionException {
Class type = null; Class<?> type = null;
if (getter != null) { if (getter != null) {
if (getter.getParameterTypes().length != 0) { if (getter.getParameterTypes().length != 0) {
...@@ -330,7 +330,7 @@ public class MBeanAttributeInfo extends MBeanFeatureInfo implements Cloneable { ...@@ -330,7 +330,7 @@ public class MBeanAttributeInfo extends MBeanFeatureInfo implements Cloneable {
} }
if (setter != null) { if (setter != null) {
Class params[] = setter.getParameterTypes(); Class<?> params[] = setter.getParameterTypes();
if (params.length != 1) { if (params.length != 1) {
throw new IntrospectionException("bad setter arg count"); throw new IntrospectionException("bad setter arg count");
} }
......
...@@ -64,7 +64,7 @@ public class MBeanConstructorInfo extends MBeanFeatureInfo implements Cloneable ...@@ -64,7 +64,7 @@ public class MBeanConstructorInfo extends MBeanFeatureInfo implements Cloneable
* @param constructor The <CODE>java.lang.reflect.Constructor</CODE> * @param constructor The <CODE>java.lang.reflect.Constructor</CODE>
* object describing the MBean constructor. * object describing the MBean constructor.
*/ */
public MBeanConstructorInfo(String description, Constructor constructor) { public MBeanConstructorInfo(String description, Constructor<?> constructor) {
this(constructor.getName(), description, this(constructor.getName(), description,
constructorSignature(constructor), constructorSignature(constructor),
Introspector.descriptorForElement(constructor)); Introspector.descriptorForElement(constructor));
...@@ -210,8 +210,8 @@ public class MBeanConstructorInfo extends MBeanFeatureInfo implements Cloneable ...@@ -210,8 +210,8 @@ public class MBeanConstructorInfo extends MBeanFeatureInfo implements Cloneable
return hash; return hash;
} }
private static MBeanParameterInfo[] constructorSignature(Constructor cn) { private static MBeanParameterInfo[] constructorSignature(Constructor<?> cn) {
final Class[] classes = cn.getParameterTypes(); final Class<?>[] classes = cn.getParameterTypes();
final Annotation[][] annots = cn.getParameterAnnotations(); final Annotation[][] annots = cn.getParameterAnnotations();
return MBeanOperationInfo.parameters(classes, annots); return MBeanOperationInfo.parameters(classes, annots);
} }
......
...@@ -524,8 +524,8 @@ public class MBeanInfo implements Cloneable, Serializable, DescriptorRead { ...@@ -524,8 +524,8 @@ public class MBeanInfo implements Cloneable, Serializable, DescriptorRead {
* a WeakHashMap so that we don't prevent a class from being * a WeakHashMap so that we don't prevent a class from being
* garbage collected just because we know whether it's immutable. * garbage collected just because we know whether it's immutable.
*/ */
private static final Map<Class, Boolean> arrayGettersSafeMap = private static final Map<Class<?>, Boolean> arrayGettersSafeMap =
new WeakHashMap<Class, Boolean>(); new WeakHashMap<Class<?>, Boolean>();
/** /**
* Return true if <code>subclass</code> is known to preserve the * Return true if <code>subclass</code> is known to preserve the
...@@ -537,7 +537,7 @@ public class MBeanInfo implements Cloneable, Serializable, DescriptorRead { ...@@ -537,7 +537,7 @@ public class MBeanInfo implements Cloneable, Serializable, DescriptorRead {
* This is obviously not an infallible test for immutability, * This is obviously not an infallible test for immutability,
* but it works for the public interfaces of the MBean*Info classes. * but it works for the public interfaces of the MBean*Info classes.
*/ */
static boolean arrayGettersSafe(Class subclass, Class immutableClass) { static boolean arrayGettersSafe(Class<?> subclass, Class<?> immutableClass) {
if (subclass == immutableClass) if (subclass == immutableClass)
return true; return true;
synchronized (arrayGettersSafeMap) { synchronized (arrayGettersSafeMap) {
......
...@@ -308,17 +308,18 @@ public class MBeanOperationInfo extends MBeanFeatureInfo implements Cloneable { ...@@ -308,17 +308,18 @@ public class MBeanOperationInfo extends MBeanFeatureInfo implements Cloneable {
wrong should be less than the penalty we would pay if it were wrong should be less than the penalty we would pay if it were
right and we needlessly hashed in the description and the right and we needlessly hashed in the description and the
parameter array. */ parameter array. */
@Override
public int hashCode() { public int hashCode() {
return getName().hashCode() ^ getReturnType().hashCode(); return getName().hashCode() ^ getReturnType().hashCode();
} }
private static MBeanParameterInfo[] methodSignature(Method method) { private static MBeanParameterInfo[] methodSignature(Method method) {
final Class[] classes = method.getParameterTypes(); final Class<?>[] classes = method.getParameterTypes();
final Annotation[][] annots = method.getParameterAnnotations(); final Annotation[][] annots = method.getParameterAnnotations();
return parameters(classes, annots); return parameters(classes, annots);
} }
static MBeanParameterInfo[] parameters(Class[] classes, static MBeanParameterInfo[] parameters(Class<?>[] classes,
Annotation[][] annots) { Annotation[][] annots) {
final MBeanParameterInfo[] params = final MBeanParameterInfo[] params =
new MBeanParameterInfo[classes.length]; new MBeanParameterInfo[classes.length];
......
...@@ -747,7 +747,7 @@ public class MBeanServerFactory { ...@@ -747,7 +747,7 @@ public class MBeanServerFactory {
* Load the builder class through the context class loader. * Load the builder class through the context class loader.
* @param builderClassName The name of the builder class. * @param builderClassName The name of the builder class.
**/ **/
private static Class loadBuilderClass(String builderClassName) private static Class<?> loadBuilderClass(String builderClassName)
throws ClassNotFoundException { throws ClassNotFoundException {
final ClassLoader loader = final ClassLoader loader =
Thread.currentThread().getContextClassLoader(); Thread.currentThread().getContextClassLoader();
...@@ -767,7 +767,7 @@ public class MBeanServerFactory { ...@@ -767,7 +767,7 @@ public class MBeanServerFactory {
* If any checked exception needs to be thrown, it is embedded in * If any checked exception needs to be thrown, it is embedded in
* a JMRuntimeException. * a JMRuntimeException.
**/ **/
private static MBeanServerBuilder newBuilder(Class builderClass) { private static MBeanServerBuilder newBuilder(Class<?> builderClass) {
try { try {
final Object abuilder = builderClass.newInstance(); final Object abuilder = builderClass.newInstance();
return (MBeanServerBuilder)abuilder; return (MBeanServerBuilder)abuilder;
...@@ -792,7 +792,7 @@ public class MBeanServerFactory { ...@@ -792,7 +792,7 @@ public class MBeanServerFactory {
String builderClassName = AccessController.doPrivileged(act); String builderClassName = AccessController.doPrivileged(act);
try { try {
final Class newBuilderClass; final Class<?> newBuilderClass;
if (builderClassName == null || builderClassName.length() == 0) if (builderClassName == null || builderClassName.length() == 0)
newBuilderClass = MBeanServerBuilder.class; newBuilderClass = MBeanServerBuilder.class;
else else
...@@ -800,7 +800,7 @@ public class MBeanServerFactory { ...@@ -800,7 +800,7 @@ public class MBeanServerFactory {
// Check whether a new builder needs to be created // Check whether a new builder needs to be created
if (builder != null) { if (builder != null) {
final Class builderClass = builder.getClass(); final Class<?> builderClass = builder.getClass();
if (newBuilderClass == builderClass) if (newBuilderClass == builderClass)
return; // no need to create a new builder... return; // no need to create a new builder...
} }
......
...@@ -253,12 +253,12 @@ public class MBeanServerInvocationHandler implements InvocationHandler { ...@@ -253,12 +253,12 @@ public class MBeanServerInvocationHandler implements InvocationHandler {
boolean notificationBroadcaster) { boolean notificationBroadcaster) {
final InvocationHandler handler = final InvocationHandler handler =
new MBeanServerInvocationHandler(connection, objectName); new MBeanServerInvocationHandler(connection, objectName);
final Class[] interfaces; final Class<?>[] interfaces;
if (notificationBroadcaster) { if (notificationBroadcaster) {
interfaces = interfaces =
new Class[] {interfaceClass, NotificationEmitter.class}; new Class<?>[] {interfaceClass, NotificationEmitter.class};
} else } else
interfaces = new Class[] {interfaceClass}; interfaces = new Class<?>[] {interfaceClass};
Object proxy = Object proxy =
Proxy.newProxyInstance(interfaceClass.getClassLoader(), Proxy.newProxyInstance(interfaceClass.getClassLoader(),
...@@ -269,7 +269,7 @@ public class MBeanServerInvocationHandler implements InvocationHandler { ...@@ -269,7 +269,7 @@ public class MBeanServerInvocationHandler implements InvocationHandler {
public Object invoke(Object proxy, Method method, Object[] args) public Object invoke(Object proxy, Method method, Object[] args)
throws Throwable { throws Throwable {
final Class methodClass = method.getDeclaringClass(); final Class<?> methodClass = method.getDeclaringClass();
if (methodClass.equals(NotificationBroadcaster.class) if (methodClass.equals(NotificationBroadcaster.class)
|| methodClass.equals(NotificationEmitter.class)) || methodClass.equals(NotificationEmitter.class))
...@@ -285,8 +285,8 @@ public class MBeanServerInvocationHandler implements InvocationHandler { ...@@ -285,8 +285,8 @@ public class MBeanServerInvocationHandler implements InvocationHandler {
return p.invoke(connection, objectName, method, args); return p.invoke(connection, objectName, method, args);
} else { } else {
final String methodName = method.getName(); final String methodName = method.getName();
final Class[] paramTypes = method.getParameterTypes(); final Class<?>[] paramTypes = method.getParameterTypes();
final Class returnType = method.getReturnType(); final Class<?> returnType = method.getReturnType();
/* Inexplicably, InvocationHandler specifies that args is null /* Inexplicably, InvocationHandler specifies that args is null
when the method takes no arguments rather than a when the method takes no arguments rather than a
...@@ -452,7 +452,7 @@ public class MBeanServerInvocationHandler implements InvocationHandler { ...@@ -452,7 +452,7 @@ public class MBeanServerInvocationHandler implements InvocationHandler {
return true; return true;
if (methodName.equals("equals") if (methodName.equals("equals")
&& Arrays.equals(method.getParameterTypes(), && Arrays.equals(method.getParameterTypes(),
new Class[] {Object.class}) new Class<?>[] {Object.class})
&& isLocal(proxy, method)) && isLocal(proxy, method))
return true; return true;
return false; return false;
......
...@@ -689,7 +689,7 @@ public class StandardMBean implements DynamicWrapperMBean, MBeanRegistration { ...@@ -689,7 +689,7 @@ public class StandardMBean implements DynamicWrapperMBean, MBeanRegistration {
getImplementationClass().getName()); getImplementationClass().getName());
} }
MBeanSupport msupport = mbean; MBeanSupport<?> msupport = mbean;
final MBeanInfo bi = msupport.getMBeanInfo(); final MBeanInfo bi = msupport.getMBeanInfo();
final Object impl = msupport.getWrappedObject(); final Object impl = msupport.getWrappedObject();
...@@ -1391,8 +1391,8 @@ public class StandardMBean implements DynamicWrapperMBean, MBeanRegistration { ...@@ -1391,8 +1391,8 @@ public class StandardMBean implements DynamicWrapperMBean, MBeanRegistration {
* garbage collected just because we know whether its MBeanInfo * garbage collected just because we know whether its MBeanInfo
* is immutable. * is immutable.
*/ */
private static final Map<Class, Boolean> mbeanInfoSafeMap = private static final Map<Class<?>, Boolean> mbeanInfoSafeMap =
new WeakHashMap<Class, Boolean>(); new WeakHashMap<Class<?>, Boolean>();
/** /**
* Return true if {@code subclass} is known to preserve the immutability * Return true if {@code subclass} is known to preserve the immutability
...@@ -1438,9 +1438,9 @@ public class StandardMBean implements DynamicWrapperMBean, MBeanRegistration { ...@@ -1438,9 +1438,9 @@ public class StandardMBean implements DynamicWrapperMBean, MBeanRegistration {
private static class MBeanInfoSafeAction private static class MBeanInfoSafeAction
implements PrivilegedAction<Boolean> { implements PrivilegedAction<Boolean> {
private final Class subclass; private final Class<?> subclass;
MBeanInfoSafeAction(Class subclass) { MBeanInfoSafeAction(Class<?> subclass) {
this.subclass = subclass; this.subclass = subclass;
} }
...@@ -1454,13 +1454,13 @@ public class StandardMBean implements DynamicWrapperMBean, MBeanRegistration { ...@@ -1454,13 +1454,13 @@ public class StandardMBean implements DynamicWrapperMBean, MBeanRegistration {
// Check for "MBeanInfo getCachedMBeanInfo()" method. // Check for "MBeanInfo getCachedMBeanInfo()" method.
// //
if (overrides(subclass, StandardMBean.class, if (overrides(subclass, StandardMBean.class,
"getCachedMBeanInfo", (Class[]) null)) "getCachedMBeanInfo", (Class<?>[]) null))
return false; return false;
// Check for "MBeanInfo getMBeanInfo()" method. // Check for "MBeanInfo getMBeanInfo()" method.
// //
if (overrides(subclass, StandardMBean.class, if (overrides(subclass, StandardMBean.class,
"getMBeanInfo", (Class[]) null)) "getMBeanInfo", (Class<?>[]) null))
return false; return false;
// Check for "MBeanNotificationInfo[] getNotificationInfo()" // Check for "MBeanNotificationInfo[] getNotificationInfo()"
...@@ -1473,7 +1473,7 @@ public class StandardMBean implements DynamicWrapperMBean, MBeanRegistration { ...@@ -1473,7 +1473,7 @@ public class StandardMBean implements DynamicWrapperMBean, MBeanRegistration {
// //
if (StandardEmitterMBean.class.isAssignableFrom(subclass)) if (StandardEmitterMBean.class.isAssignableFrom(subclass))
if (overrides(subclass, StandardEmitterMBean.class, if (overrides(subclass, StandardEmitterMBean.class,
"getNotificationInfo", (Class[]) null)) "getNotificationInfo", (Class<?>[]) null))
return false; return false;
return true; return true;
} }
......
...@@ -104,8 +104,8 @@ public class EventClientDelegate implements EventClientDelegateMBean { ...@@ -104,8 +104,8 @@ public class EventClientDelegate implements EventClientDelegateMBean {
public static EventClientDelegate getEventClientDelegate(MBeanServer server) { public static EventClientDelegate getEventClientDelegate(MBeanServer server) {
EventClientDelegate delegate = null; EventClientDelegate delegate = null;
synchronized(delegateMap) { synchronized(delegateMap) {
final WeakReference wrf = delegateMap.get(server); final WeakReference<EventClientDelegate> wrf = delegateMap.get(server);
delegate = (wrf == null) ? null : (EventClientDelegate)wrf.get(); delegate = (wrf == null) ? null : wrf.get();
if (delegate == null) { if (delegate == null) {
delegate = new EventClientDelegate(server); delegate = new EventClientDelegate(server);
...@@ -282,7 +282,7 @@ public class EventClientDelegate implements EventClientDelegateMBean { ...@@ -282,7 +282,7 @@ public class EventClientDelegate implements EventClientDelegateMBean {
Constructor<?> foundCons = null; Constructor<?> foundCons = null;
if (sig == null) if (sig == null)
sig = new String[0]; sig = new String[0];
for (Constructor cons : c.getConstructors()) { for (Constructor<?> cons : c.getConstructors()) {
Class<?>[] types = cons.getParameterTypes(); Class<?>[] types = cons.getParameterTypes();
String[] consSig = new String[types.length]; String[] consSig = new String[types.length];
for (int i = 0; i < types.length; i++) for (int i = 0; i < types.length; i++)
......
...@@ -350,8 +350,7 @@ public class EventSubscriber implements EventConsumer { ...@@ -350,8 +350,7 @@ public class EventSubscriber implements EventConsumer {
static { static {
QueryExp broadcasterExp; QueryExp broadcasterExp;
try { try {
final Method m = Query.class.getMethod("isInstanceOf", final Method m = Query.class.getMethod("isInstanceOf", String.class);
new Class[] {String.class});
broadcasterExp = (QueryExp)m.invoke(Query.class, broadcasterExp = (QueryExp)m.invoke(Query.class,
new Object[] {NotificationBroadcaster.class.getName()}); new Object[] {NotificationBroadcaster.class.getName()});
} catch (Exception e) { } catch (Exception e) {
......
...@@ -69,7 +69,7 @@ public class DefaultLoaderRepository { ...@@ -69,7 +69,7 @@ public class DefaultLoaderRepository {
* @exception ClassNotFoundException The specified class could not be * @exception ClassNotFoundException The specified class could not be
* found. * found.
*/ */
public static Class loadClass(String className) public static Class<?> loadClass(String className)
throws ClassNotFoundException { throws ClassNotFoundException {
MBEANSERVER_LOGGER.logp(Level.FINEST, MBEANSERVER_LOGGER.logp(Level.FINEST,
DefaultLoaderRepository.class.getName(), DefaultLoaderRepository.class.getName(),
...@@ -93,7 +93,7 @@ public class DefaultLoaderRepository { ...@@ -93,7 +93,7 @@ public class DefaultLoaderRepository {
* @exception ClassNotFoundException The specified class could not be * @exception ClassNotFoundException The specified class could not be
* found. * found.
*/ */
public static Class loadClassWithout(ClassLoader loader, public static Class<?> loadClassWithout(ClassLoader loader,
String className) String className)
throws ClassNotFoundException { throws ClassNotFoundException {
MBEANSERVER_LOGGER.logp(Level.FINEST, MBEANSERVER_LOGGER.logp(Level.FINEST,
...@@ -102,12 +102,11 @@ public class DefaultLoaderRepository { ...@@ -102,12 +102,11 @@ public class DefaultLoaderRepository {
return load(loader, className); return load(loader, className);
} }
private static Class load(ClassLoader without, String className) private static Class<?> load(ClassLoader without, String className)
throws ClassNotFoundException { throws ClassNotFoundException {
final List mbsList = MBeanServerFactory.findMBeanServer(null); final List<MBeanServer> mbsList = MBeanServerFactory.findMBeanServer(null);
for (Iterator it = mbsList.iterator(); it.hasNext(); ) { for (MBeanServer mbs : mbsList) {
MBeanServer mbs = (MBeanServer) it.next();
ClassLoaderRepository clr = mbs.getClassLoaderRepository(); ClassLoaderRepository clr = mbs.getClassLoaderRepository();
try { try {
return clr.loadClassWithout(without, className); return clr.loadClassWithout(without, className);
......
...@@ -1291,7 +1291,7 @@ public class MLet extends java.net.URLClassLoader ...@@ -1291,7 +1291,7 @@ public class MLet extends java.net.URLClassLoader
if (c != null) { if (c != null) {
try { try {
Constructor<?> cons = Constructor<?> cons =
c.getConstructor(new Class[] {String.class}); c.getConstructor(String.class);
Object[] oo = new Object[1]; Object[] oo = new Object[1];
oo[0]=param; oo[0]=param;
return(cons.newInstance(oo)); return(cons.newInstance(oo));
......
...@@ -55,30 +55,30 @@ class MLetObjectInputStream extends ObjectInputStream { ...@@ -55,30 +55,30 @@ class MLetObjectInputStream extends ObjectInputStream {
this.loader = loader; this.loader = loader;
} }
private Class primitiveType(char c) { private Class<?> primitiveType(char c) {
switch(c) { switch(c) {
case 66: /* 'B' */ case 'B':
return Byte.TYPE; return Byte.TYPE;
case 67: /* 'C' */ case 'C':
return Character.TYPE; return Character.TYPE;
case 68: /* 'D' */ case 'D':
return Double.TYPE; return Double.TYPE;
case 70: /* 'F' */ case 'F':
return Float.TYPE; return Float.TYPE;
case 73: /* 'I' */ case 'I':
return Integer.TYPE; return Integer.TYPE;
case 74: /* 'J' */ case 'J':
return Long.TYPE; return Long.TYPE;
case 83: /* 'S' */ case 'S':
return Short.TYPE; return Short.TYPE;
case 90: /* 'Z' */ case 'Z':
return Boolean.TYPE; return Boolean.TYPE;
} }
return null; return null;
...@@ -87,14 +87,15 @@ class MLetObjectInputStream extends ObjectInputStream { ...@@ -87,14 +87,15 @@ class MLetObjectInputStream extends ObjectInputStream {
/** /**
* Use the given ClassLoader rather than using the system class * Use the given ClassLoader rather than using the system class
*/ */
protected Class resolveClass(ObjectStreamClass objectstreamclass) @Override
protected Class<?> resolveClass(ObjectStreamClass objectstreamclass)
throws IOException, ClassNotFoundException { throws IOException, ClassNotFoundException {
String s = objectstreamclass.getName(); String s = objectstreamclass.getName();
if (s.startsWith("[")) { if (s.startsWith("[")) {
int i; int i;
for (i = 1; s.charAt(i) == '['; i++); for (i = 1; s.charAt(i) == '['; i++);
Class class1; Class<?> class1;
if (s.charAt(i) == 'L') { if (s.charAt(i) == 'L') {
class1 = loader.loadClass(s.substring(i + 1, s.length() - 1)); class1 = loader.loadClass(s.substring(i + 1, s.length() - 1));
} else { } else {
......
...@@ -589,7 +589,7 @@ public class DescriptorSupport ...@@ -589,7 +589,7 @@ public class DescriptorSupport
int numberOfEntries = descriptorMap.size(); int numberOfEntries = descriptorMap.size();
String[] responseFields = new String[numberOfEntries]; String[] responseFields = new String[numberOfEntries];
Set returnedSet = descriptorMap.entrySet(); Set<Map.Entry<String, Object>> returnedSet = descriptorMap.entrySet();
int i = 0; int i = 0;
...@@ -598,8 +598,9 @@ public class DescriptorSupport ...@@ -598,8 +598,9 @@ public class DescriptorSupport
DescriptorSupport.class.getName(), DescriptorSupport.class.getName(),
"getFields()", "Returning " + numberOfEntries + " fields"); "getFields()", "Returning " + numberOfEntries + " fields");
} }
for (Iterator iter = returnedSet.iterator(); iter.hasNext(); i++) { for (Iterator<Map.Entry<String, Object>> iter = returnedSet.iterator();
Map.Entry currElement = (Map.Entry) iter.next(); iter.hasNext(); i++) {
Map.Entry<String, Object> currElement = iter.next();
if (currElement == null) { if (currElement == null) {
if (MODELMBEAN_LOGGER.isLoggable(Level.FINEST)) { if (MODELMBEAN_LOGGER.isLoggable(Level.FINEST)) {
...@@ -642,7 +643,7 @@ public class DescriptorSupport ...@@ -642,7 +643,7 @@ public class DescriptorSupport
int numberOfEntries = descriptorMap.size(); int numberOfEntries = descriptorMap.size();
String[] responseFields = new String[numberOfEntries]; String[] responseFields = new String[numberOfEntries];
Set returnedSet = descriptorMap.entrySet(); Set<Map.Entry<String, Object>> returnedSet = descriptorMap.entrySet();
int i = 0; int i = 0;
...@@ -653,8 +654,9 @@ public class DescriptorSupport ...@@ -653,8 +654,9 @@ public class DescriptorSupport
"Returning " + numberOfEntries + " fields"); "Returning " + numberOfEntries + " fields");
} }
for (Iterator iter = returnedSet.iterator(); iter.hasNext(); i++) { for (Iterator<Map.Entry<String, Object>> iter = returnedSet.iterator();
Map.Entry currElement = (Map.Entry) iter.next(); iter.hasNext(); i++) {
Map.Entry<String, Object> currElement = iter.next();
if (( currElement == null ) || (currElement.getKey() == null)) { if (( currElement == null ) || (currElement.getKey() == null)) {
if (MODELMBEAN_LOGGER.isLoggable(Level.FINEST)) { if (MODELMBEAN_LOGGER.isLoggable(Level.FINEST)) {
...@@ -700,9 +702,8 @@ public class DescriptorSupport ...@@ -700,9 +702,8 @@ public class DescriptorSupport
} }
if (fieldNames == null) { if (fieldNames == null) {
for (Iterator iter = descriptorMap.values().iterator(); for (Object value : descriptorMap.values())
iter.hasNext(); i++) responseFields[i++] = value;
responseFields[i] = iter.next();
} else { } else {
for (i=0; i < fieldNames.length; i++) { for (i=0; i < fieldNames.length; i++) {
if ((fieldNames[i] == null) || (fieldNames[i].equals(""))) { if ((fieldNames[i] == null) || (fieldNames[i].equals(""))) {
...@@ -904,7 +905,7 @@ public class DescriptorSupport ...@@ -904,7 +905,7 @@ public class DescriptorSupport
} }
// verify that the descriptor is valid, by iterating over each field... // verify that the descriptor is valid, by iterating over each field...
Set returnedSet = descriptorMap.entrySet(); Set<Map.Entry<String, Object>> returnedSet = descriptorMap.entrySet();
if (returnedSet == null) { // null descriptor, not valid if (returnedSet == null) { // null descriptor, not valid
if (MODELMBEAN_LOGGER.isLoggable(Level.FINEST)) { if (MODELMBEAN_LOGGER.isLoggable(Level.FINEST)) {
...@@ -925,9 +926,7 @@ public class DescriptorSupport ...@@ -925,9 +926,7 @@ public class DescriptorSupport
// According to the descriptor type we validate the fields contained // According to the descriptor type we validate the fields contained
for (Iterator iter = returnedSet.iterator(); iter.hasNext();) { for (Map.Entry<String, Object> currElement : returnedSet) {
Map.Entry currElement = (Map.Entry) iter.next();
if (currElement != null) { if (currElement != null) {
if (currElement.getValue() != null) { if (currElement.getValue() != null) {
// validate the field valued... // validate the field valued...
...@@ -1083,10 +1082,9 @@ public class DescriptorSupport ...@@ -1083,10 +1082,9 @@ public class DescriptorSupport
*/ */
public synchronized String toXMLString() { public synchronized String toXMLString() {
final StringBuilder buf = new StringBuilder("<Descriptor>"); final StringBuilder buf = new StringBuilder("<Descriptor>");
Set returnedSet = descriptorMap.entrySet(); Set<Map.Entry<String, Object>> returnedSet = descriptorMap.entrySet();
for (Iterator iter = returnedSet.iterator(); iter.hasNext(); ) { for (Map.Entry<String, Object> currElement : returnedSet) {
final Map.Entry currElement = (Map.Entry) iter.next(); final String name = currElement.getKey();
final String name = currElement.getKey().toString();
Object value = currElement.getValue(); Object value = currElement.getValue();
String valueString = null; String valueString = null;
/* Set valueString to non-null if and only if this is a string that /* Set valueString to non-null if and only if this is a string that
...@@ -1256,7 +1254,7 @@ public class DescriptorSupport ...@@ -1256,7 +1254,7 @@ public class DescriptorSupport
} }
final Class<?> c = final Class<?> c =
Class.forName(className, false, contextClassLoader); Class.forName(className, false, contextClassLoader);
constr = c.getConstructor(new Class[] {String.class}); constr = c.getConstructor(new Class<?>[] {String.class});
} catch (Exception e) { } catch (Exception e) {
throw new XMLParseException(e, throw new XMLParseException(e,
"Cannot parse value: <" + s + ">"); "Cannot parse value: <" + s + ">");
......
...@@ -152,7 +152,7 @@ public class ModelMBeanConstructorInfo ...@@ -152,7 +152,7 @@ public class ModelMBeanConstructorInfo
* describing the MBean constructor. * describing the MBean constructor.
*/ */
public ModelMBeanConstructorInfo(String description, public ModelMBeanConstructorInfo(String description,
Constructor constructorMethod) Constructor<?> constructorMethod)
{ {
super(description, constructorMethod); super(description, constructorMethod);
if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) { if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
...@@ -194,7 +194,7 @@ public class ModelMBeanConstructorInfo ...@@ -194,7 +194,7 @@ public class ModelMBeanConstructorInfo
*/ */
public ModelMBeanConstructorInfo(String description, public ModelMBeanConstructorInfo(String description,
Constructor constructorMethod, Constructor<?> constructorMethod,
Descriptor descriptor) Descriptor descriptor)
{ {
......
...@@ -1074,7 +1074,7 @@ public class RequiredModelMBean ...@@ -1074,7 +1074,7 @@ public class RequiredModelMBean
} }
} }
final Class targetClass; final Class<?> targetClass;
if (opClassName != null) { if (opClassName != null) {
try { try {
...@@ -1126,20 +1126,20 @@ public class RequiredModelMBean ...@@ -1126,20 +1126,20 @@ public class RequiredModelMBean
"resolving " + targetClass.getName() + "." + opMethodName); "resolving " + targetClass.getName() + "." + opMethodName);
} }
final Class[] argClasses; final Class<?>[] argClasses;
if (sig == null) if (sig == null)
argClasses = null; argClasses = null;
else { else {
final ClassLoader targetClassLoader = targetClass.getClassLoader(); final ClassLoader targetClassLoader = targetClass.getClassLoader();
argClasses = new Class[sig.length]; argClasses = new Class<?>[sig.length];
for (int i = 0; i < sig.length; i++) { for (int i = 0; i < sig.length; i++) {
if (tracing) { if (tracing) {
MODELMBEAN_LOGGER.logp(Level.FINER, MODELMBEAN_LOGGER.logp(Level.FINER,
RequiredModelMBean.class.getName(),"resolveMethod", RequiredModelMBean.class.getName(),"resolveMethod",
"resolve type " + sig[i]); "resolve type " + sig[i]);
} }
argClasses[i] = (Class) primitiveClassMap.get(sig[i]); argClasses[i] = (Class<?>) primitiveClassMap.get(sig[i]);
if (argClasses[i] == null) { if (argClasses[i] == null) {
try { try {
argClasses[i] = argClasses[i] =
...@@ -1170,7 +1170,7 @@ public class RequiredModelMBean ...@@ -1170,7 +1170,7 @@ public class RequiredModelMBean
/* Map e.g. "int" to int.class. Goodness knows how many time this /* Map e.g. "int" to int.class. Goodness knows how many time this
particular wheel has been reinvented. */ particular wheel has been reinvented. */
private static final Class[] primitiveClasses = { private static final Class<?>[] primitiveClasses = {
int.class, long.class, boolean.class, double.class, int.class, long.class, boolean.class, double.class,
float.class, short.class, byte.class, char.class, float.class, short.class, byte.class, char.class,
}; };
...@@ -1178,7 +1178,7 @@ public class RequiredModelMBean ...@@ -1178,7 +1178,7 @@ public class RequiredModelMBean
new HashMap<String,Class<?>>(); new HashMap<String,Class<?>>();
static { static {
for (int i = 0; i < primitiveClasses.length; i++) { for (int i = 0; i < primitiveClasses.length; i++) {
final Class c = primitiveClasses[i]; final Class<?> c = primitiveClasses[i];
primitiveClassMap.put(c.getName(), c); primitiveClassMap.put(c.getName(), c);
} }
} }
...@@ -1645,7 +1645,7 @@ public class RequiredModelMBean ...@@ -1645,7 +1645,7 @@ public class RequiredModelMBean
try { try {
ClassLoader cl = ClassLoader cl =
response.getClass().getClassLoader(); response.getClass().getClassLoader();
Class c = Class.forName(respType, true, cl); Class<?> c = Class.forName(respType, true, cl);
subtype = c.isInstance(response); subtype = c.isInstance(response);
} catch (Exception e) { } catch (Exception e) {
subtype = false; subtype = false;
...@@ -1904,7 +1904,7 @@ public class RequiredModelMBean ...@@ -1904,7 +1904,7 @@ public class RequiredModelMBean
if (attrSetMethod == null) { if (attrSetMethod == null) {
if (attrValue != null) { if (attrValue != null) {
try { try {
final Class clazz = loadClass(attrType); final Class<?> clazz = loadClass(attrType);
if (! clazz.isInstance(attrValue)) throw new if (! clazz.isInstance(attrValue)) throw new
InvalidAttributeValueException(clazz.getName() + InvalidAttributeValueException(clazz.getName() +
" expected, " + " expected, " +
...@@ -2044,8 +2044,7 @@ public class RequiredModelMBean ...@@ -2044,8 +2044,7 @@ public class RequiredModelMBean
final AttributeList responseList = new AttributeList(); final AttributeList responseList = new AttributeList();
// Go through the list of attributes // Go through the list of attributes
for (Iterator i = attributes.iterator(); i.hasNext();) { for (Attribute attr : attributes.asList()) {
final Attribute attr = (Attribute) i.next();
try { try {
setAttribute(attr); setAttribute(attr);
responseList.add(attr); responseList.add(attr);
...@@ -2799,7 +2798,7 @@ public class RequiredModelMBean ...@@ -2799,7 +2798,7 @@ public class RequiredModelMBean
return MBeanServerFactory.getClassLoaderRepository(server); return MBeanServerFactory.getClassLoaderRepository(server);
} }
private Class loadClass(String className) private Class<?> loadClass(String className)
throws ClassNotFoundException { throws ClassNotFoundException {
try { try {
return Class.forName(className); return Class.forName(className);
......
...@@ -296,7 +296,7 @@ public class ArrayType<T> extends OpenType<T> { ...@@ -296,7 +296,7 @@ public class ArrayType<T> extends OpenType<T> {
// Check and construct state specific to ArrayType // Check and construct state specific to ArrayType
// //
if (elementType.isArray()) { if (elementType.isArray()) {
ArrayType at = (ArrayType) elementType; ArrayType<?> at = (ArrayType<?>) elementType;
this.dimension = at.getDimension() + dimension; this.dimension = at.getDimension() + dimension;
this.elementType = at.getElementOpenType(); this.elementType = at.getElementOpenType();
this.primitiveArray = at.isPrimitiveArray(); this.primitiveArray = at.isPrimitiveArray();
...@@ -384,7 +384,7 @@ public class ArrayType<T> extends OpenType<T> { ...@@ -384,7 +384,7 @@ public class ArrayType<T> extends OpenType<T> {
/* Package-private constructor for callers we trust to get it right. */ /* Package-private constructor for callers we trust to get it right. */
ArrayType(String className, String typeName, String description, ArrayType(String className, String typeName, String description,
int dimension, OpenType elementType, int dimension, OpenType<?> elementType,
boolean primitiveArray) { boolean primitiveArray) {
super(className, typeName, description, true); super(className, typeName, description, true);
this.dimension = dimension; this.dimension = dimension;
...@@ -397,7 +397,7 @@ public class ArrayType<T> extends OpenType<T> { ...@@ -397,7 +397,7 @@ public class ArrayType<T> extends OpenType<T> {
throws OpenDataException { throws OpenDataException {
boolean isPrimitiveArray = false; boolean isPrimitiveArray = false;
if (elementType.isArray()) { if (elementType.isArray()) {
isPrimitiveArray = ((ArrayType) elementType).isPrimitiveArray(); isPrimitiveArray = ((ArrayType<?>) elementType).isPrimitiveArray();
} }
return buildArrayClassName(dimension, elementType, isPrimitiveArray); return buildArrayClassName(dimension, elementType, isPrimitiveArray);
} }
...@@ -443,7 +443,7 @@ public class ArrayType<T> extends OpenType<T> { ...@@ -443,7 +443,7 @@ public class ArrayType<T> extends OpenType<T> {
throws OpenDataException { throws OpenDataException {
boolean isPrimitiveArray = false; boolean isPrimitiveArray = false;
if (elementType.isArray()) { if (elementType.isArray()) {
isPrimitiveArray = ((ArrayType) elementType).isPrimitiveArray(); isPrimitiveArray = ((ArrayType<?>) elementType).isPrimitiveArray();
} }
return buildArrayDescription(dimension, elementType, isPrimitiveArray); return buildArrayDescription(dimension, elementType, isPrimitiveArray);
} }
...@@ -453,7 +453,7 @@ public class ArrayType<T> extends OpenType<T> { ...@@ -453,7 +453,7 @@ public class ArrayType<T> extends OpenType<T> {
boolean isPrimitiveArray) boolean isPrimitiveArray)
throws OpenDataException { throws OpenDataException {
if (elementType.isArray()) { if (elementType.isArray()) {
ArrayType at = (ArrayType) elementType; ArrayType<?> at = (ArrayType<?>) elementType;
dimension += at.getDimension(); dimension += at.getDimension();
elementType = at.getElementOpenType(); elementType = at.getElementOpenType();
isPrimitiveArray = at.isPrimitiveArray(); isPrimitiveArray = at.isPrimitiveArray();
...@@ -551,7 +551,7 @@ public class ArrayType<T> extends OpenType<T> { ...@@ -551,7 +551,7 @@ public class ArrayType<T> extends OpenType<T> {
return false; return false;
} }
Class objClass = obj.getClass(); Class<?> objClass = obj.getClass();
String objClassName = objClass.getName(); String objClassName = objClass.getName();
// if obj is not an array, return false // if obj is not an array, return false
...@@ -636,8 +636,8 @@ public class ArrayType<T> extends OpenType<T> { ...@@ -636,8 +636,8 @@ public class ArrayType<T> extends OpenType<T> {
} }
@Override @Override
boolean isAssignableFrom(OpenType ot) { boolean isAssignableFrom(OpenType<?> ot) {
if (!(ot instanceof ArrayType)) if (!(ot instanceof ArrayType<?>))
return false; return false;
ArrayType<?> at = (ArrayType<?>) ot; ArrayType<?> at = (ArrayType<?>) ot;
return (at.getDimension() == getDimension() && return (at.getDimension() == getDimension() &&
...@@ -675,9 +675,9 @@ public class ArrayType<T> extends OpenType<T> { ...@@ -675,9 +675,9 @@ public class ArrayType<T> extends OpenType<T> {
// if obj is not an ArrayType, return false // if obj is not an ArrayType, return false
// //
if (!(obj instanceof ArrayType)) if (!(obj instanceof ArrayType<?>))
return false; return false;
ArrayType other = (ArrayType) obj; ArrayType<?> other = (ArrayType<?>) obj;
// if other's dimension is different than this instance's, return false // if other's dimension is different than this instance's, return false
// //
...@@ -879,6 +879,7 @@ public class ArrayType<T> extends OpenType<T> { ...@@ -879,6 +879,7 @@ public class ArrayType<T> extends OpenType<T> {
// Build primitive array // Build primitive array
// //
try { try {
@SuppressWarnings("rawtypes")
ArrayType at = new ArrayType(simpleType, true); ArrayType at = new ArrayType(simpleType, true);
if (n > 1) if (n > 1)
at = new ArrayType<T>(n - 1, at); at = new ArrayType<T>(n - 1, at);
...@@ -934,7 +935,7 @@ public class ArrayType<T> extends OpenType<T> { ...@@ -934,7 +935,7 @@ public class ArrayType<T> extends OpenType<T> {
} }
} }
private ArrayType convertFromWrapperToPrimitiveTypes() { private <T> ArrayType<T> convertFromWrapperToPrimitiveTypes() {
String cn = getClassName(); String cn = getClassName();
String tn = getTypeName(); String tn = getTypeName();
String d = getDescription(); String d = getDescription();
...@@ -952,8 +953,8 @@ public class ArrayType<T> extends OpenType<T> { ...@@ -952,8 +953,8 @@ public class ArrayType<T> extends OpenType<T> {
break; break;
} }
} }
return new ArrayType(cn, tn, d, return new ArrayType<T>(cn, tn, d,
dimension, elementType, primitiveArray); dimension, elementType, primitiveArray);
} }
/** /**
...@@ -1002,7 +1003,7 @@ public class ArrayType<T> extends OpenType<T> { ...@@ -1002,7 +1003,7 @@ public class ArrayType<T> extends OpenType<T> {
} }
} }
private ArrayType convertFromPrimitiveToWrapperTypes() { private <T> ArrayType<T> convertFromPrimitiveToWrapperTypes() {
String cn = getClassName(); String cn = getClassName();
String tn = getTypeName(); String tn = getTypeName();
String d = getDescription(); String d = getDescription();
...@@ -1020,7 +1021,7 @@ public class ArrayType<T> extends OpenType<T> { ...@@ -1020,7 +1021,7 @@ public class ArrayType<T> extends OpenType<T> {
break; break;
} }
} }
return new ArrayType(cn, tn, d, return new ArrayType<T>(cn, tn, d,
dimension, elementType, primitiveArray); dimension, elementType, primitiveArray);
} }
} }
...@@ -236,8 +236,8 @@ public class CompositeDataInvocationHandler implements InvocationHandler { ...@@ -236,8 +236,8 @@ public class CompositeDataInvocationHandler implements InvocationHandler {
if (other == null) if (other == null)
return false; return false;
final Class proxyClass = proxy.getClass(); final Class<?> proxyClass = proxy.getClass();
final Class otherClass = other.getClass(); final Class<?> otherClass = other.getClass();
if (proxyClass != otherClass) if (proxyClass != otherClass)
return false; return false;
InvocationHandler otherih = Proxy.getInvocationHandler(other); InvocationHandler otherih = Proxy.getInvocationHandler(other);
......
...@@ -329,7 +329,7 @@ public class CompositeType extends OpenType<CompositeData> { ...@@ -329,7 +329,7 @@ public class CompositeType extends OpenType<CompositeData> {
* @return true if {@code ot} is assignable to this open type. * @return true if {@code ot} is assignable to this open type.
*/ */
@Override @Override
boolean isAssignableFrom(OpenType ot) { boolean isAssignableFrom(OpenType<?> ot) {
if (!(ot instanceof CompositeType)) if (!(ot instanceof CompositeType))
return false; return false;
CompositeType ct = (CompositeType) ot; CompositeType ct = (CompositeType) ot;
...@@ -420,9 +420,7 @@ public class CompositeType extends OpenType<CompositeData> { ...@@ -420,9 +420,7 @@ public class CompositeType extends OpenType<CompositeData> {
if (myHashCode == null) { if (myHashCode == null) {
int value = 0; int value = 0;
value += this.getTypeName().hashCode(); value += this.getTypeName().hashCode();
String key; for (String key : nameToDescription.keySet()) {
for (Iterator k = nameToDescription.keySet().iterator(); k.hasNext(); ) {
key = (String) k.next();
value += key.hashCode(); value += key.hashCode();
value += this.nameToType.get(key).hashCode(); value += this.nameToType.get(key).hashCode();
} }
...@@ -457,10 +455,10 @@ public class CompositeType extends OpenType<CompositeData> { ...@@ -457,10 +455,10 @@ public class CompositeType extends OpenType<CompositeData> {
result.append(getTypeName()); result.append(getTypeName());
result.append(",items=("); result.append(",items=(");
int i=0; int i=0;
Iterator k=nameToType.keySet().iterator(); Iterator<String> k=nameToType.keySet().iterator();
String key; String key;
while (k.hasNext()) { while (k.hasNext()) {
key = (String) k.next(); key = k.next();
if (i > 0) result.append(","); if (i > 0) result.append(",");
result.append("(itemName="); result.append("(itemName=");
result.append(key); result.append(key);
......
...@@ -78,12 +78,12 @@ public class OpenMBeanAttributeInfoSupport ...@@ -78,12 +78,12 @@ public class OpenMBeanAttributeInfoSupport
/** /**
* @serial The open mbean attribute's min value * @serial The open mbean attribute's min value
*/ */
private final Comparable minValue; private final Comparable<?> minValue;
/** /**
* @serial The open mbean attribute's max value * @serial The open mbean attribute's max value
*/ */
private final Comparable maxValue; private final Comparable<?> maxValue;
// As this instance is immutable, these two values need only // As this instance is immutable, these two values need only
...@@ -450,7 +450,7 @@ public class OpenMBeanAttributeInfoSupport ...@@ -450,7 +450,7 @@ public class OpenMBeanAttributeInfoSupport
} }
static void check(OpenMBeanParameterInfo info) throws OpenDataException { static void check(OpenMBeanParameterInfo info) throws OpenDataException {
OpenType openType = info.getOpenType(); OpenType<?> openType = info.getOpenType();
if (openType == null) if (openType == null)
throw new IllegalArgumentException("OpenType cannot be null"); throw new IllegalArgumentException("OpenType cannot be null");
...@@ -562,7 +562,7 @@ public class OpenMBeanAttributeInfoSupport ...@@ -562,7 +562,7 @@ public class OpenMBeanAttributeInfoSupport
} }
@SuppressWarnings("unchecked") @SuppressWarnings({"unchecked", "rawtypes"})
static int compare(Object x, Object y) { static int compare(Object x, Object y) {
return ((Comparable) x).compareTo(y); return ((Comparable) x).compareTo(y);
} }
...@@ -657,11 +657,11 @@ public class OpenMBeanAttributeInfoSupport ...@@ -657,11 +657,11 @@ public class OpenMBeanAttributeInfoSupport
return result; return result;
} }
static <T> Comparable comparableValueFrom(Descriptor d, String name, static <T> Comparable<?> comparableValueFrom(Descriptor d, String name,
OpenType<T> openType) { OpenType<T> openType) {
T t = valueFrom(d, name, openType); T t = valueFrom(d, name, openType);
if (t == null || t instanceof Comparable<?>) if (t == null || t instanceof Comparable<?>)
return (Comparable) t; return (Comparable<?>) t;
final String msg = final String msg =
"Descriptor field " + name + " with value " + t + "Descriptor field " + name + " with value " + t +
" is not Comparable"; " is not Comparable";
...@@ -925,7 +925,7 @@ public class OpenMBeanAttributeInfoSupport ...@@ -925,7 +925,7 @@ public class OpenMBeanAttributeInfoSupport
return isValue(this, obj); return isValue(this, obj);
} }
@SuppressWarnings("unchecked") // cast to Comparable @SuppressWarnings({"unchecked", "rawtypes"}) // cast to Comparable
static boolean isValue(OpenMBeanParameterInfo info, Object obj) { static boolean isValue(OpenMBeanParameterInfo info, Object obj) {
if (info.hasDefaultValue() && obj == null) if (info.hasDefaultValue() && obj == null)
return true; return true;
......
...@@ -74,12 +74,12 @@ public class OpenMBeanParameterInfoSupport ...@@ -74,12 +74,12 @@ public class OpenMBeanParameterInfoSupport
/** /**
* @serial The open mbean parameter's min value * @serial The open mbean parameter's min value
*/ */
private Comparable minValue = null; private Comparable<?> minValue = null;
/** /**
* @serial The open mbean parameter's max value * @serial The open mbean parameter's max value
*/ */
private Comparable maxValue = null; private Comparable<?> maxValue = null;
// As this instance is immutable, these two values need only // As this instance is immutable, these two values need only
......
...@@ -206,7 +206,7 @@ public abstract class OpenType<T> implements Serializable { ...@@ -206,7 +206,7 @@ public abstract class OpenType<T> implements Serializable {
} }
} }
private static boolean overridesGetClassName(final Class<? extends OpenType> c) { private static boolean overridesGetClassName(final Class<?> c) {
return AccessController.doPrivileged(new PrivilegedAction<Boolean>() { return AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
public Boolean run() { public Boolean run() {
try { try {
......
...@@ -163,7 +163,7 @@ public final class SimpleType<T> extends OpenType<T> { ...@@ -163,7 +163,7 @@ public final class SimpleType<T> extends OpenType<T> {
public static final SimpleType<ObjectName> OBJECTNAME = public static final SimpleType<ObjectName> OBJECTNAME =
new SimpleType<ObjectName>(ObjectName.class); new SimpleType<ObjectName>(ObjectName.class);
private static final SimpleType[] typeArray = { private static final SimpleType<?>[] typeArray = {
VOID, BOOLEAN, CHARACTER, BYTE, SHORT, INTEGER, LONG, FLOAT, VOID, BOOLEAN, CHARACTER, BYTE, SHORT, INTEGER, LONG, FLOAT,
DOUBLE, STRING, BIGDECIMAL, BIGINTEGER, DATE, OBJECTNAME, DOUBLE, STRING, BIGDECIMAL, BIGINTEGER, DATE, OBJECTNAME,
}; };
...@@ -232,10 +232,10 @@ public final class SimpleType<T> extends OpenType<T> { ...@@ -232,10 +232,10 @@ public final class SimpleType<T> extends OpenType<T> {
return (this == obj); return (this == obj);
*/ */
if (!(obj instanceof SimpleType)) if (!(obj instanceof SimpleType<?>))
return false; return false;
SimpleType other = (SimpleType) obj; SimpleType<?> other = (SimpleType<?>) obj;
// Test if other's className field is the same as for this instance // Test if other's className field is the same as for this instance
// //
...@@ -290,11 +290,11 @@ public final class SimpleType<T> extends OpenType<T> { ...@@ -290,11 +290,11 @@ public final class SimpleType<T> extends OpenType<T> {
return myToString; return myToString;
} }
private static final Map<SimpleType,SimpleType> canonicalTypes = private static final Map<SimpleType<?>,SimpleType<?>> canonicalTypes =
new HashMap<SimpleType,SimpleType>(); new HashMap<SimpleType<?>,SimpleType<?>>();
static { static {
for (int i = 0; i < typeArray.length; i++) { for (int i = 0; i < typeArray.length; i++) {
final SimpleType type = typeArray[i]; final SimpleType<?> type = typeArray[i];
canonicalTypes.put(type, type); canonicalTypes.put(type, type);
} }
} }
...@@ -310,7 +310,7 @@ public final class SimpleType<T> extends OpenType<T> { ...@@ -310,7 +310,7 @@ public final class SimpleType<T> extends OpenType<T> {
* resolved. * resolved.
*/ */
public Object readResolve() throws ObjectStreamException { public Object readResolve() throws ObjectStreamException {
final SimpleType canonical = canonicalTypes.get(this); final SimpleType<?> canonical = canonicalTypes.get(this);
if (canonical == null) { if (canonical == null) {
// Should not happen // Should not happen
throw new InvalidObjectException("Invalid SimpleType: " + this); throw new InvalidObjectException("Invalid SimpleType: " + this);
......
...@@ -30,6 +30,7 @@ package javax.management.openmbean; ...@@ -30,6 +30,7 @@ package javax.management.openmbean;
// java import // java import
// //
import com.sun.jmx.mbeanserver.GetPropertyAction; import com.sun.jmx.mbeanserver.GetPropertyAction;
import com.sun.jmx.mbeanserver.Util;
import java.io.IOException; import java.io.IOException;
import java.io.ObjectInputStream; import java.io.ObjectInputStream;
import java.io.Serializable; import java.io.Serializable;
...@@ -611,7 +612,7 @@ public class TabularDataSupport ...@@ -611,7 +612,7 @@ public class TabularDataSupport
@SuppressWarnings("unchecked") // historical confusion about the return type @SuppressWarnings("unchecked") // historical confusion about the return type
public Collection<Object> values() { public Collection<Object> values() {
return (Collection) dataMap.values() ; return Util.cast(dataMap.values());
} }
...@@ -647,7 +648,7 @@ public class TabularDataSupport ...@@ -647,7 +648,7 @@ public class TabularDataSupport
@SuppressWarnings("unchecked") // historical confusion about the return type @SuppressWarnings("unchecked") // historical confusion about the return type
public Set<Map.Entry<Object,Object>> entrySet() { public Set<Map.Entry<Object,Object>> entrySet() {
return (Set) dataMap.entrySet(); return Util.cast(dataMap.entrySet());
} }
...@@ -725,8 +726,7 @@ public class TabularDataSupport ...@@ -725,8 +726,7 @@ public class TabularDataSupport
if (this.size() != other.size()) { if (this.size() != other.size()) {
return false; return false;
} }
for (Iterator iter = this.values().iterator(); iter.hasNext(); ) { for (CompositeData value : dataMap.values()) {
CompositeData value = (CompositeData) iter.next();
if ( ! other.containsValue(value) ) { if ( ! other.containsValue(value) ) {
return false; return false;
} }
...@@ -760,9 +760,8 @@ public class TabularDataSupport ...@@ -760,9 +760,8 @@ public class TabularDataSupport
int result = 0; int result = 0;
result += this.tabularType.hashCode(); result += this.tabularType.hashCode();
for (Iterator iter = this.values().iterator(); iter.hasNext(); ) { for (Object value : values())
result += ((CompositeData)iter.next()).hashCode(); result += value.hashCode();
}
return result; return result;
......
...@@ -237,7 +237,7 @@ public class TabularType extends OpenType<TabularData> { ...@@ -237,7 +237,7 @@ public class TabularType extends OpenType<TabularData> {
} }
@Override @Override
boolean isAssignableFrom(OpenType ot) { boolean isAssignableFrom(OpenType<?> ot) {
if (!(ot instanceof TabularType)) if (!(ot instanceof TabularType))
return false; return false;
TabularType tt = (TabularType) ot; TabularType tt = (TabularType) ot;
...@@ -329,9 +329,8 @@ public class TabularType extends OpenType<TabularData> { ...@@ -329,9 +329,8 @@ public class TabularType extends OpenType<TabularData> {
int value = 0; int value = 0;
value += this.getTypeName().hashCode(); value += this.getTypeName().hashCode();
value += this.rowType.hashCode(); value += this.rowType.hashCode();
for (Iterator k = indexNames.iterator(); k.hasNext(); ) { for (String index : indexNames)
value += k.next().hashCode(); value += index.hashCode();
}
myHashCode = Integer.valueOf(value); myHashCode = Integer.valueOf(value);
} }
...@@ -364,12 +363,10 @@ public class TabularType extends OpenType<TabularData> { ...@@ -364,12 +363,10 @@ public class TabularType extends OpenType<TabularData> {
.append(",rowType=") .append(",rowType=")
.append(rowType.toString()) .append(rowType.toString())
.append(",indexNames=("); .append(",indexNames=(");
int i=0; String sep = "";
Iterator k = indexNames.iterator(); for (String index : indexNames) {
while( k.hasNext() ) { result.append(sep).append(index);
if (i > 0) result.append(","); sep = ",";
result.append(k.next().toString());
i++;
} }
result.append("))"); result.append("))");
myToString = result.toString(); myToString = result.toString();
......
...@@ -354,7 +354,7 @@ public class MBeanServerNotificationFilter extends NotificationFilterSupport { ...@@ -354,7 +354,7 @@ public class MBeanServerNotificationFilter extends NotificationFilterSupport {
// Checks the type first // Checks the type first
String ntfType = notif.getType(); String ntfType = notif.getType();
Vector enabledTypes = getEnabledTypes(); Vector<String> enabledTypes = getEnabledTypes();
if (!(enabledTypes.contains(ntfType))) { if (!(enabledTypes.contains(ntfType))) {
RELATION_LOGGER.logp(Level.FINER, RELATION_LOGGER.logp(Level.FINER,
MBeanServerNotificationFilter.class.getName(), MBeanServerNotificationFilter.class.getName(),
...@@ -464,8 +464,8 @@ public class MBeanServerNotificationFilter extends NotificationFilterSupport { ...@@ -464,8 +464,8 @@ public class MBeanServerNotificationFilter extends NotificationFilterSupport {
// Serializes this instance in the old serial form // Serializes this instance in the old serial form
// //
ObjectOutputStream.PutField fields = out.putFields(); ObjectOutputStream.PutField fields = out.putFields();
fields.put("mySelectObjNameList", (Vector)selectedNames); fields.put("mySelectObjNameList", selectedNames);
fields.put("myDeselectObjNameList", (Vector)deselectedNames); fields.put("myDeselectObjNameList", deselectedNames);
out.writeFields(); out.writeFields();
} }
else else
......
...@@ -1111,7 +1111,7 @@ public class RelationService extends NotificationBroadcasterSupport ...@@ -1111,7 +1111,7 @@ public class RelationService extends NotificationBroadcasterSupport
throw new IllegalArgumentException(excMsg); throw new IllegalArgumentException(excMsg);
} }
if (!(oldValue instanceof ArrayList)) if (!(oldValue instanceof ArrayList<?>))
oldValue = new ArrayList<ObjectName>(oldValue); oldValue = new ArrayList<ObjectName>(oldValue);
RELATION_LOGGER.entering(RelationService.class.getName(), RELATION_LOGGER.entering(RelationService.class.getName(),
...@@ -1881,7 +1881,7 @@ public class RelationService extends NotificationBroadcasterSupport ...@@ -1881,7 +1881,7 @@ public class RelationService extends NotificationBroadcasterSupport
"getRole", "getRole",
params, params,
signature)); signature));
if (invokeResult == null || invokeResult instanceof ArrayList) if (invokeResult == null || invokeResult instanceof ArrayList<?>)
result = invokeResult; result = invokeResult;
else else
result = new ArrayList<ObjectName>(invokeResult); result = new ArrayList<ObjectName>(invokeResult);
...@@ -2786,7 +2786,7 @@ public class RelationService extends NotificationBroadcasterSupport ...@@ -2786,7 +2786,7 @@ public class RelationService extends NotificationBroadcasterSupport
// Note that it is possible that the MBean has already been removed // Note that it is possible that the MBean has already been removed
// from the internal map: this is the case when the MBean is // from the internal map: this is the case when the MBean is
// unregistered, the role is updated, then we arrive here. // unregistered, the role is updated, then we arrive here.
HashMap mbeanRefMap = (HashMap) Map<String,List<String>> mbeanRefMap =
(myRefedMBeanObjName2RelIdsMap.get(objectName)); (myRefedMBeanObjName2RelIdsMap.get(objectName));
if (mbeanRefMap == null) { if (mbeanRefMap == null) {
...@@ -2796,11 +2796,11 @@ public class RelationService extends NotificationBroadcasterSupport ...@@ -2796,11 +2796,11 @@ public class RelationService extends NotificationBroadcasterSupport
return true; return true;
} }
ArrayList roleNames = new ArrayList(); List<String> roleNames = null;
if (!allRolesFlag) { if (!allRolesFlag) {
// Now retrieves the roles of current relation where the MBean // Now retrieves the roles of current relation where the MBean
// was referenced // was referenced
roleNames = (ArrayList)(mbeanRefMap.get(relationId)); roleNames = mbeanRefMap.get(relationId);
// Removes obsolete reference to role // Removes obsolete reference to role
int obsRefIdx = roleNames.indexOf(roleName); int obsRefIdx = roleNames.indexOf(roleName);
...@@ -2840,8 +2840,8 @@ public class RelationService extends NotificationBroadcasterSupport ...@@ -2840,8 +2840,8 @@ public class RelationService extends NotificationBroadcasterSupport
// //
// -exception RelationServiceNotRegisteredException if the Relation // -exception RelationServiceNotRegisteredException if the Relation
// Service is not registered in the MBean Server. // Service is not registered in the MBean Server.
private void updateUnregistrationListener(List newRefList, private void updateUnregistrationListener(List<ObjectName> newRefList,
List obsoleteRefList) List<ObjectName> obsoleteRefList)
throws RelationServiceNotRegisteredException { throws RelationServiceNotRegisteredException {
if (newRefList != null && obsoleteRefList != null) { if (newRefList != null && obsoleteRefList != null) {
...@@ -2871,24 +2871,14 @@ public class RelationService extends NotificationBroadcasterSupport ...@@ -2871,24 +2871,14 @@ public class RelationService extends NotificationBroadcasterSupport
// Enables ObjectNames in newRefList // Enables ObjectNames in newRefList
if (newRefList != null) { if (newRefList != null) {
for (Iterator newRefIter = newRefList.iterator(); for (ObjectName newObjName : newRefList)
newRefIter.hasNext();) {
ObjectName newObjName = (ObjectName)
(newRefIter.next());
myUnregNtfFilter.enableObjectName(newObjName); myUnregNtfFilter.enableObjectName(newObjName);
}
} }
if (obsoleteRefList != null) { if (obsoleteRefList != null) {
// Disables ObjectNames in obsoleteRefList // Disables ObjectNames in obsoleteRefList
for (Iterator obsRefIter = obsoleteRefList.iterator(); for (ObjectName obsObjName : obsoleteRefList)
obsRefIter.hasNext();) {
ObjectName obsObjName = (ObjectName)
(obsRefIter.next());
myUnregNtfFilter.disableObjectName(obsObjName); myUnregNtfFilter.disableObjectName(obsObjName);
}
} }
// Under test // Under test
...@@ -3047,18 +3037,13 @@ public class RelationService extends NotificationBroadcasterSupport ...@@ -3047,18 +3037,13 @@ public class RelationService extends NotificationBroadcasterSupport
// to see which roles have not been initialized // to see which roles have not been initialized
// Note: no need to test if list not null before cloning, not allowed // Note: no need to test if list not null before cloning, not allowed
// to have an empty relation type. // to have an empty relation type.
ArrayList roleInfoList = (ArrayList) List<RoleInfo> roleInfoList = new ArrayList<RoleInfo>(relType.getRoleInfos());
(((ArrayList)(relType.getRoleInfos())).clone());
if (roleList != null) { if (roleList != null) {
for (Iterator roleIter = roleList.iterator(); for (Role currRole : roleList.asList()) {
roleIter.hasNext();) {
Role currRole = (Role)(roleIter.next());
String currRoleName = currRole.getRoleName(); String currRoleName = currRole.getRoleName();
ArrayList currRoleValue = (ArrayList) List<ObjectName> currRoleValue = currRole.getRoleValue();
(currRole.getRoleValue());
// Retrieves corresponding role info // Retrieves corresponding role info
// Can throw a RoleInfoNotFoundException to be converted into a // Can throw a RoleInfoNotFoundException to be converted into a
// RoleNotFoundException // RoleNotFoundException
...@@ -3137,9 +3122,7 @@ public class RelationService extends NotificationBroadcasterSupport ...@@ -3137,9 +3122,7 @@ public class RelationService extends NotificationBroadcasterSupport
// Only role list parameter used, as default initialization of roles // Only role list parameter used, as default initialization of roles
// done automatically in initializeMissingRoles() sets each // done automatically in initializeMissingRoles() sets each
// uninitialized role to an empty value. // uninitialized role to an empty value.
for (Iterator roleIter = roleList.iterator(); for (Role currRole : roleList.asList()) {
roleIter.hasNext();) {
Role currRole = (Role)(roleIter.next());
// Creates a dummy empty ArrayList of ObjectNames to be the old // Creates a dummy empty ArrayList of ObjectNames to be the old
// role value :) // role value :)
List<ObjectName> dummyList = new ArrayList<ObjectName>(); List<ObjectName> dummyList = new ArrayList<ObjectName>();
...@@ -3191,7 +3174,7 @@ public class RelationService extends NotificationBroadcasterSupport ...@@ -3191,7 +3174,7 @@ public class RelationService extends NotificationBroadcasterSupport
// -exception IllegalArgumentException if null parameter // -exception IllegalArgumentException if null parameter
private Integer checkRoleInt(int chkType, private Integer checkRoleInt(int chkType,
String roleName, String roleName,
List roleValue, List<ObjectName> roleValue,
RoleInfo roleInfo, RoleInfo roleInfo,
boolean writeChkFlag) boolean writeChkFlag)
throws IllegalArgumentException { throws IllegalArgumentException {
...@@ -3266,9 +3249,7 @@ public class RelationService extends NotificationBroadcasterSupport ...@@ -3266,9 +3249,7 @@ public class RelationService extends NotificationBroadcasterSupport
// registered in the same MBean Server. // registered in the same MBean Server.
String expClassName = roleInfo.getRefMBeanClassName(); String expClassName = roleInfo.getRefMBeanClassName();
for (Iterator refMBeanIter = roleValue.iterator(); for (ObjectName currObjName : roleValue) {
refMBeanIter.hasNext();) {
ObjectName currObjName = (ObjectName)(refMBeanIter.next());
// Checks it is registered // Checks it is registered
if (currObjName == null) { if (currObjName == null) {
...@@ -3330,7 +3311,7 @@ public class RelationService extends NotificationBroadcasterSupport ...@@ -3330,7 +3311,7 @@ public class RelationService extends NotificationBroadcasterSupport
ObjectName relationObjName, ObjectName relationObjName,
String relationId, String relationId,
String relationTypeName, String relationTypeName,
List roleInfoList) List<RoleInfo> roleInfoList)
throws IllegalArgumentException, throws IllegalArgumentException,
RelationServiceNotRegisteredException, RelationServiceNotRegisteredException,
InvalidRoleValueException { InvalidRoleValueException {
...@@ -3361,10 +3342,8 @@ public class RelationService extends NotificationBroadcasterSupport ...@@ -3361,10 +3342,8 @@ public class RelationService extends NotificationBroadcasterSupport
// with an empty list of ObjectNames. // with an empty list of ObjectNames.
// A check is performed to verify that the role can be set to an // A check is performed to verify that the role can be set to an
// empty value, according to its minimum cardinality // empty value, according to its minimum cardinality
for (Iterator roleInfoIter = roleInfoList.iterator(); for (RoleInfo currRoleInfo : roleInfoList) {
roleInfoIter.hasNext();) {
RoleInfo currRoleInfo = (RoleInfo)(roleInfoIter.next());
String roleName = currRoleInfo.getName(); String roleName = currRoleInfo.getName();
// Creates an empty value // Creates an empty value
...@@ -3663,7 +3642,7 @@ public class RelationService extends NotificationBroadcasterSupport ...@@ -3663,7 +3642,7 @@ public class RelationService extends NotificationBroadcasterSupport
// not exist in the relation // not exist in the relation
private void handleReferenceUnregistration(String relationId, private void handleReferenceUnregistration(String relationId,
ObjectName objectName, ObjectName objectName,
List roleNameList) List<String> roleNameList)
throws IllegalArgumentException, throws IllegalArgumentException,
RelationServiceNotRegisteredException, RelationServiceNotRegisteredException,
RelationNotFoundException, RelationNotFoundException,
...@@ -3694,14 +3673,12 @@ public class RelationService extends NotificationBroadcasterSupport ...@@ -3694,14 +3673,12 @@ public class RelationService extends NotificationBroadcasterSupport
// Flag to specify if the relation has to be deleted // Flag to specify if the relation has to be deleted
boolean deleteRelFlag = false; boolean deleteRelFlag = false;
for (Iterator roleNameIter = roleNameList.iterator(); for (String currRoleName : roleNameList) {
roleNameIter.hasNext();) {
if (deleteRelFlag) { if (deleteRelFlag) {
break; break;
} }
String currRoleName = (String)(roleNameIter.next());
// Retrieves number of MBeans currently referenced in role // Retrieves number of MBeans currently referenced in role
// BEWARE! Do not use getRole() as role may be not readable // BEWARE! Do not use getRole() as role may be not readable
// //
...@@ -3753,10 +3730,7 @@ public class RelationService extends NotificationBroadcasterSupport ...@@ -3753,10 +3730,7 @@ public class RelationService extends NotificationBroadcasterSupport
// using setRole(). So the Relation Service will update the // using setRole(). So the Relation Service will update the
// myRefedMBeanObjName2RelIdsMap to refelect the new role // myRefedMBeanObjName2RelIdsMap to refelect the new role
// value! // value!
for (Iterator roleNameIter = roleNameList.iterator(); for (String currRoleName : roleNameList) {
roleNameIter.hasNext();) {
String currRoleName = (String)(roleNameIter.next());
if (relObj instanceof RelationSupport) { if (relObj instanceof RelationSupport) {
// Internal relation // Internal relation
......
...@@ -108,7 +108,7 @@ public class RelationSupport ...@@ -108,7 +108,7 @@ public class RelationSupport
// via Relation Service setRole() and setRoles() methods // via Relation Service setRole() and setRoles() methods
// - if the relation is internal to the Relation Service, via // - if the relation is internal to the Relation Service, via
// setRoleInt() and setRolesInt() methods. // setRoleInt() and setRolesInt() methods.
private Map<String,Role> myRoleName2ValueMap = new HashMap<String,Role>(); private final Map<String,Role> myRoleName2ValueMap = new HashMap<String,Role>();
// Flag to indicate if the object has been added in the Relation Service // Flag to indicate if the object has been added in the Relation Service
private final AtomicBoolean myInRelServFlg = new AtomicBoolean(); private final AtomicBoolean myInRelServFlg = new AtomicBoolean();
...@@ -424,7 +424,7 @@ public class RelationSupport ...@@ -424,7 +424,7 @@ public class RelationSupport
} }
} }
ArrayList roleValue = (ArrayList)(role.getRoleValue()); List<ObjectName> roleValue = role.getRoleValue();
RELATION_LOGGER.exiting(RelationSupport.class.getName(), RELATION_LOGGER.exiting(RelationSupport.class.getName(),
"getRoleCardinality"); "getRoleCardinality");
...@@ -855,8 +855,7 @@ public class RelationSupport ...@@ -855,8 +855,7 @@ public class RelationSupport
// Note: no need to test if role value (list) not null before // Note: no need to test if role value (list) not null before
// cloning, null value not allowed, empty list if // cloning, null value not allowed, empty list if
// nothing. // nothing.
result = (ArrayList) result = new ArrayList<ObjectName>(role.getRoleValue());
(((ArrayList)(role.getRoleValue())).clone());
} else { } else {
// Role retrieved during multi-role retrieval: returns the // Role retrieved during multi-role retrieval: returns the
...@@ -1492,10 +1491,7 @@ public class RelationSupport ...@@ -1492,10 +1491,7 @@ public class RelationSupport
RoleList roleList = new RoleList(); RoleList roleList = new RoleList();
RoleUnresolvedList roleUnresList = new RoleUnresolvedList(); RoleUnresolvedList roleUnresList = new RoleUnresolvedList();
for (Iterator roleIter = list.iterator(); for (Role currRole : list.asList()) {
roleIter.hasNext();) {
Role currRole = (Role)(roleIter.next());
Object currResult = null; Object currResult = null;
// Can throw: // Can throw:
...@@ -1617,12 +1613,10 @@ public class RelationSupport ...@@ -1617,12 +1613,10 @@ public class RelationSupport
synchronized(myRoleName2ValueMap) { synchronized(myRoleName2ValueMap) {
for (Iterator roleIter = list.iterator(); for (Role currRole : list.asList()) {
roleIter.hasNext();) {
// No need to check if role is null, it is not allowed to store // No need to check if role is null, it is not allowed to store
// a null role in a RoleList :) // a null role in a RoleList :)
Role currRole = (Role)(roleIter.next());
String currRoleName = currRole.getRoleName(); String currRoleName = currRole.getRoleName();
if (myRoleName2ValueMap.containsKey(currRoleName)) { if (myRoleName2ValueMap.containsKey(currRoleName)) {
......
...@@ -228,9 +228,9 @@ public class Role implements Serializable { ...@@ -228,9 +228,9 @@ public class Role implements Serializable {
public String toString() { public String toString() {
StringBuilder result = new StringBuilder(); StringBuilder result = new StringBuilder();
result.append("role name: " + name + "; role value: "); result.append("role name: " + name + "; role value: ");
for (Iterator objNameIter = objectNameList.iterator(); for (Iterator<ObjectName> objNameIter = objectNameList.iterator();
objNameIter.hasNext();) { objNameIter.hasNext();) {
ObjectName currObjName = (ObjectName)(objNameIter.next()); ObjectName currObjName = objNameIter.next();
result.append(currObjName.toString()); result.append(currObjName.toString());
if (objNameIter.hasNext()) { if (objNameIter.hasNext()) {
result.append(", "); result.append(", ");
...@@ -325,7 +325,7 @@ public class Role implements Serializable { ...@@ -325,7 +325,7 @@ public class Role implements Serializable {
// //
ObjectOutputStream.PutField fields = out.putFields(); ObjectOutputStream.PutField fields = out.putFields();
fields.put("myName", name); fields.put("myName", name);
fields.put("myObjNameList", (ArrayList)objectNameList); fields.put("myObjNameList", objectNameList);
out.writeFields(); out.writeFields();
} }
else else
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
package javax.management.relation; package javax.management.relation;
import com.sun.jmx.mbeanserver.Util;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
...@@ -140,7 +141,7 @@ public class RoleList extends ArrayList<Object> { ...@@ -140,7 +141,7 @@ public class RoleList extends ArrayList<Object> {
checkTypeSafe(this); checkTypeSafe(this);
typeSafe = true; typeSafe = true;
} }
return (List<Role>) (List) this; return Util.cast(this);
} }
// //
......
...@@ -172,7 +172,7 @@ public class RoleResult implements Serializable { ...@@ -172,7 +172,7 @@ public class RoleResult implements Serializable {
roleList = new RoleList(); roleList = new RoleList();
for (Iterator roleIter = list.iterator(); for (Iterator<?> roleIter = list.iterator();
roleIter.hasNext();) { roleIter.hasNext();) {
Role currRole = (Role)(roleIter.next()); Role currRole = (Role)(roleIter.next());
roleList.add((Role)(currRole.clone())); roleList.add((Role)(currRole.clone()));
...@@ -195,7 +195,7 @@ public class RoleResult implements Serializable { ...@@ -195,7 +195,7 @@ public class RoleResult implements Serializable {
unresolvedRoleList = new RoleUnresolvedList(); unresolvedRoleList = new RoleUnresolvedList();
for (Iterator roleUnresIter = unresolvedList.iterator(); for (Iterator<?> roleUnresIter = unresolvedList.iterator();
roleUnresIter.hasNext();) { roleUnresIter.hasNext();) {
RoleUnresolved currRoleUnres = RoleUnresolved currRoleUnres =
(RoleUnresolved)(roleUnresIter.next()); (RoleUnresolved)(roleUnresIter.next());
......
...@@ -285,9 +285,9 @@ public class RoleUnresolved implements Serializable { ...@@ -285,9 +285,9 @@ public class RoleUnresolved implements Serializable {
result.append("role name: " + roleName); result.append("role name: " + roleName);
if (roleValue != null) { if (roleValue != null) {
result.append("; value: "); result.append("; value: ");
for (Iterator objNameIter = roleValue.iterator(); for (Iterator<ObjectName> objNameIter = roleValue.iterator();
objNameIter.hasNext();) { objNameIter.hasNext();) {
ObjectName currObjName = (ObjectName)(objNameIter.next()); ObjectName currObjName = objNameIter.next();
result.append(currObjName.toString()); result.append(currObjName.toString());
if (objNameIter.hasNext()) { if (objNameIter.hasNext()) {
result.append(", "); result.append(", ");
...@@ -344,7 +344,7 @@ public class RoleUnresolved implements Serializable { ...@@ -344,7 +344,7 @@ public class RoleUnresolved implements Serializable {
// //
ObjectOutputStream.PutField fields = out.putFields(); ObjectOutputStream.PutField fields = out.putFields();
fields.put("myRoleName", roleName); fields.put("myRoleName", roleName);
fields.put("myRoleValue", (ArrayList)roleValue); fields.put("myRoleValue", roleValue);
fields.put("myPbType", problemType); fields.put("myPbType", problemType);
out.writeFields(); out.writeFields();
} }
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
package javax.management.relation; package javax.management.relation;
import com.sun.jmx.mbeanserver.Util;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
...@@ -140,7 +141,7 @@ public class RoleUnresolvedList extends ArrayList<Object> { ...@@ -140,7 +141,7 @@ public class RoleUnresolvedList extends ArrayList<Object> {
checkTypeSafe(this); checkTypeSafe(this);
typeSafe = true; typeSafe = true;
} }
return (List<RoleUnresolved>) (List) this; return Util.cast(this);
} }
// //
......
...@@ -367,7 +367,8 @@ public class JMXConnectorFactory { ...@@ -367,7 +367,8 @@ public class JMXConnectorFactory {
return provider.newJMXConnector(serviceURL, fixedenv); return provider.newJMXConnector(serviceURL, fixedenv);
} }
private static String resolvePkgs(Map env) throws JMXProviderException { private static String resolvePkgs(Map<String, ?> env)
throws JMXProviderException {
Object pkgsObject = null; Object pkgsObject = null;
...@@ -521,7 +522,7 @@ public class JMXConnectorFactory { ...@@ -521,7 +522,7 @@ public class JMXConnectorFactory {
return null; return null;
} }
static ClassLoader resolveClassLoader(Map environment) { static ClassLoader resolveClassLoader(Map<String, ?> environment) {
ClassLoader loader = null; ClassLoader loader = null;
if (environment != null) { if (environment != null) {
......
...@@ -118,7 +118,8 @@ class NoCallStackClassLoader extends ClassLoader { ...@@ -118,7 +118,8 @@ class NoCallStackClassLoader extends ClassLoader {
* if it is one of the classes whose byte code we have, or * if it is one of the classes whose byte code we have, or
* delegate the load if it is one of the referenced classes. * delegate the load if it is one of the referenced classes.
*/ */
protected Class findClass(String name) throws ClassNotFoundException { @Override
protected Class<?> findClass(String name) throws ClassNotFoundException {
for (int i = 0; i < classNames.length; i++) { for (int i = 0; i < classNames.length; i++) {
if (name.equals(classNames[i])) { if (name.equals(classNames[i])) {
return defineClass(classNames[i], byteCodes[i], 0, return defineClass(classNames[i], byteCodes[i], 0,
......
...@@ -31,7 +31,6 @@ import java.rmi.MarshalledObject; ...@@ -31,7 +31,6 @@ import java.rmi.MarshalledObject;
import java.rmi.Remote; import java.rmi.Remote;
import java.util.Set; import java.util.Set;
import javax.management.Attribute;
import javax.management.AttributeList; import javax.management.AttributeList;
import javax.management.AttributeNotFoundException; import javax.management.AttributeNotFoundException;
import javax.management.InstanceAlreadyExistsException; import javax.management.InstanceAlreadyExistsException;
...@@ -45,11 +44,11 @@ import javax.management.MBeanRegistrationException; ...@@ -45,11 +44,11 @@ import javax.management.MBeanRegistrationException;
import javax.management.MBeanServerConnection; import javax.management.MBeanServerConnection;
import javax.management.NotCompliantMBeanException; import javax.management.NotCompliantMBeanException;
import javax.management.NotificationFilter;
import javax.management.ObjectInstance; import javax.management.ObjectInstance;
import javax.management.ObjectName; import javax.management.ObjectName;
import javax.management.QueryExp;
import javax.management.ReflectionException; import javax.management.ReflectionException;
import javax.management.RuntimeMBeanException;
import javax.management.RuntimeOperationsException;
import javax.management.remote.NotificationResult; import javax.management.remote.NotificationResult;
import javax.security.auth.Subject; import javax.security.auth.Subject;
...@@ -89,8 +88,9 @@ import javax.security.auth.Subject; ...@@ -89,8 +88,9 @@ import javax.security.auth.Subject;
* even though it would add useful information to the documentation. The * even though it would add useful information to the documentation. The
* reason is that it was only added in Mustang (Java SE 6), whereas versions * reason is that it was only added in Mustang (Java SE 6), whereas versions
* 1.4 and 2.0 of the JMX API must be implementable on Tiger per our * 1.4 and 2.0 of the JMX API must be implementable on Tiger per our
* commitments for JSR 255. * commitments for JSR 255. This is also why we suppress rawtypes warnings.
*/ */
@SuppressWarnings("rawtypes")
public interface RMIConnection extends Closeable, Remote { public interface RMIConnection extends Closeable, Remote {
/** /**
* <p>Returns the connection ID. This string is different for * <p>Returns the connection ID. This string is different for
......
...@@ -308,6 +308,7 @@ public class RMIConnectionImpl implements RMIConnection, Unreferenced { ...@@ -308,6 +308,7 @@ public class RMIConnectionImpl implements RMIConnection, Unreferenced {
} }
} }
@SuppressWarnings("rawtypes") // MarshalledObject
public ObjectInstance createMBean(String className, public ObjectInstance createMBean(String className,
ObjectName name, ObjectName name,
MarshalledObject params, MarshalledObject params,
...@@ -368,6 +369,7 @@ public class RMIConnectionImpl implements RMIConnection, Unreferenced { ...@@ -368,6 +369,7 @@ public class RMIConnectionImpl implements RMIConnection, Unreferenced {
} }
} }
@SuppressWarnings("rawtypes") // MarshalledObject
public ObjectInstance createMBean(String className, public ObjectInstance createMBean(String className,
ObjectName name, ObjectName name,
ObjectName loaderName, ObjectName loaderName,
...@@ -493,6 +495,7 @@ public class RMIConnectionImpl implements RMIConnection, Unreferenced { ...@@ -493,6 +495,7 @@ public class RMIConnectionImpl implements RMIConnection, Unreferenced {
} }
} }
@SuppressWarnings("rawtypes") // MarshalledObject
public Set<ObjectInstance> public Set<ObjectInstance>
queryMBeans(ObjectName name, queryMBeans(ObjectName name,
MarshalledObject query, MarshalledObject query,
...@@ -527,6 +530,7 @@ public class RMIConnectionImpl implements RMIConnection, Unreferenced { ...@@ -527,6 +530,7 @@ public class RMIConnectionImpl implements RMIConnection, Unreferenced {
} }
} }
@SuppressWarnings("rawtypes") // MarshalledObject
public Set<ObjectName> public Set<ObjectName>
queryNames(ObjectName name, queryNames(ObjectName name,
MarshalledObject query, MarshalledObject query,
...@@ -668,6 +672,7 @@ public class RMIConnectionImpl implements RMIConnection, Unreferenced { ...@@ -668,6 +672,7 @@ public class RMIConnectionImpl implements RMIConnection, Unreferenced {
} }
} }
@SuppressWarnings("rawtypes") // MarshalledObject
public void setAttribute(ObjectName name, public void setAttribute(ObjectName name,
MarshalledObject attribute, MarshalledObject attribute,
Subject delegationSubject) Subject delegationSubject)
...@@ -720,6 +725,7 @@ public class RMIConnectionImpl implements RMIConnection, Unreferenced { ...@@ -720,6 +725,7 @@ public class RMIConnectionImpl implements RMIConnection, Unreferenced {
} }
} }
@SuppressWarnings("rawtypes") // MarshalledObject
public AttributeList setAttributes(ObjectName name, public AttributeList setAttributes(ObjectName name,
MarshalledObject attributes, MarshalledObject attributes,
Subject delegationSubject) Subject delegationSubject)
...@@ -765,6 +771,7 @@ public class RMIConnectionImpl implements RMIConnection, Unreferenced { ...@@ -765,6 +771,7 @@ public class RMIConnectionImpl implements RMIConnection, Unreferenced {
} }
} }
@SuppressWarnings("rawtypes") // MarshalledObject
public Object invoke(ObjectName name, public Object invoke(ObjectName name,
String operationName, String operationName,
MarshalledObject params, MarshalledObject params,
...@@ -928,6 +935,7 @@ public class RMIConnectionImpl implements RMIConnection, Unreferenced { ...@@ -928,6 +935,7 @@ public class RMIConnectionImpl implements RMIConnection, Unreferenced {
} }
} }
@SuppressWarnings("rawtypes") // MarshalledObject
public Integer[] addNotificationListeners(ObjectName[] names, public Integer[] addNotificationListeners(ObjectName[] names,
MarshalledObject[] filters, MarshalledObject[] filters,
Subject[] delegationSubjects) Subject[] delegationSubjects)
...@@ -1013,6 +1021,7 @@ public class RMIConnectionImpl implements RMIConnection, Unreferenced { ...@@ -1013,6 +1021,7 @@ public class RMIConnectionImpl implements RMIConnection, Unreferenced {
} }
} }
@SuppressWarnings("rawtypes") // MarshalledObject
public void addNotificationListener(ObjectName name, public void addNotificationListener(ObjectName name,
ObjectName listener, ObjectName listener,
MarshalledObject filter, MarshalledObject filter,
...@@ -1148,6 +1157,7 @@ public class RMIConnectionImpl implements RMIConnection, Unreferenced { ...@@ -1148,6 +1157,7 @@ public class RMIConnectionImpl implements RMIConnection, Unreferenced {
} }
} }
@SuppressWarnings("rawtypes") // MarshalledObject
public void removeNotificationListener(ObjectName name, public void removeNotificationListener(ObjectName name,
ObjectName listener, ObjectName listener,
MarshalledObject filter, MarshalledObject filter,
...@@ -1809,7 +1819,7 @@ public class RMIConnectionImpl implements RMIConnection, Unreferenced { ...@@ -1809,7 +1819,7 @@ public class RMIConnectionImpl implements RMIConnection, Unreferenced {
} }
} }
private static <T> T unwrap(final MarshalledObject mo, private static <T> T unwrap(final MarshalledObject<?> mo,
final ClassLoader cl, final ClassLoader cl,
final Class<T> wrappedClass) final Class<T> wrappedClass)
throws IOException { throws IOException {
...@@ -1847,7 +1857,7 @@ public class RMIConnectionImpl implements RMIConnection, Unreferenced { ...@@ -1847,7 +1857,7 @@ public class RMIConnectionImpl implements RMIConnection, Unreferenced {
return null; return null;
} }
private static <T> T unwrap(final MarshalledObject mo, private static <T> T unwrap(final MarshalledObject<?> mo,
final ClassLoader cl1, final ClassLoader cl1,
final ClassLoader cl2, final ClassLoader cl2,
final Class<T> wrappedClass) final Class<T> wrappedClass)
......
...@@ -28,6 +28,7 @@ package javax.management.remote.rmi; ...@@ -28,6 +28,7 @@ package javax.management.remote.rmi;
import com.sun.jmx.event.DaemonThreadFactory; import com.sun.jmx.event.DaemonThreadFactory;
import com.sun.jmx.event.EventConnection; import com.sun.jmx.event.EventConnection;
import com.sun.jmx.mbeanserver.PerThreadGroupPool; import com.sun.jmx.mbeanserver.PerThreadGroupPool;
import com.sun.jmx.mbeanserver.Util;
import com.sun.jmx.remote.internal.ClientCommunicatorAdmin; import com.sun.jmx.remote.internal.ClientCommunicatorAdmin;
import com.sun.jmx.remote.internal.ClientListenerInfo; import com.sun.jmx.remote.internal.ClientListenerInfo;
import com.sun.jmx.remote.internal.ClientNotifForwarder; import com.sun.jmx.remote.internal.ClientNotifForwarder;
...@@ -584,7 +585,7 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable ...@@ -584,7 +585,7 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable
// added for re-connection // added for re-connection
private Integer addListenerWithSubject(ObjectName name, private Integer addListenerWithSubject(ObjectName name,
MarshalledObject filter, MarshalledObject<NotificationFilter> filter,
Subject delegationSubject, Subject delegationSubject,
boolean reconnect) boolean reconnect)
throws InstanceNotFoundException, IOException { throws InstanceNotFoundException, IOException {
...@@ -595,7 +596,8 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable ...@@ -595,7 +596,8 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable
"(ObjectName,MarshalledObject,Subject)"); "(ObjectName,MarshalledObject,Subject)");
final ObjectName[] names = new ObjectName[] {name}; final ObjectName[] names = new ObjectName[] {name};
final MarshalledObject[] filters = new MarshalledObject[] {filter}; final MarshalledObject<NotificationFilter>[] filters =
Util.cast(new MarshalledObject<?>[] {filter});
final Subject[] delegationSubjects = new Subject[] { final Subject[] delegationSubjects = new Subject[] {
delegationSubject delegationSubject
}; };
...@@ -611,7 +613,7 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable ...@@ -611,7 +613,7 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable
// added for re-connection // added for re-connection
private Integer[] addListenersWithSubjects(ObjectName[] names, private Integer[] addListenersWithSubjects(ObjectName[] names,
MarshalledObject[] filters, MarshalledObject<NotificationFilter>[] filters,
Subject[] delegationSubjects, Subject[] delegationSubjects,
boolean reconnect) boolean reconnect)
throws InstanceNotFoundException, IOException { throws InstanceNotFoundException, IOException {
...@@ -1362,7 +1364,7 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable ...@@ -1362,7 +1364,7 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable
//-------------------------------------------------------------------- //--------------------------------------------------------------------
private class RMINotifClient extends ClientNotifForwarder { private class RMINotifClient extends ClientNotifForwarder {
public RMINotifClient(ClassLoader cl, Map env) { public RMINotifClient(ClassLoader cl, Map<String, ?> env) {
super(cl, env); super(cl, env);
} }
...@@ -1444,8 +1446,8 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable ...@@ -1444,8 +1446,8 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable
Integer[] listenerIDs; Integer[] listenerIDs;
final ObjectName[] names = final ObjectName[] names =
new ObjectName[] {MBeanServerDelegate.DELEGATE_NAME}; new ObjectName[] {MBeanServerDelegate.DELEGATE_NAME};
final MarshalledObject[] filters = final MarshalledObject<NotificationFilter>[] filters =
new MarshalledObject[] {sFilter}; Util.cast(new MarshalledObject<?>[] {sFilter});
final Subject[] subjects = new Subject[] {null}; final Subject[] subjects = new Subject[] {null};
try { try {
listenerIDs = listenerIDs =
...@@ -1580,7 +1582,8 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable ...@@ -1580,7 +1582,8 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable
final ObjectName[] names = new ObjectName[len]; final ObjectName[] names = new ObjectName[len];
final NotificationListener[] listeners = new NotificationListener[len]; final NotificationListener[] listeners = new NotificationListener[len];
final NotificationFilter[] filters = new NotificationFilter[len]; final NotificationFilter[] filters = new NotificationFilter[len];
final MarshalledObject[] mFilters = new MarshalledObject[len]; final MarshalledObject<NotificationFilter>[] mFilters =
Util.cast(new MarshalledObject<?>[len]);
final Object[] handbacks = new Object[len]; final Object[] handbacks = new Object[len];
for (i=0;i<len;i++) { for (i=0;i<len;i++) {
...@@ -1742,7 +1745,7 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable ...@@ -1742,7 +1745,7 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable
* @exception IOException if the connection to the ORB failed. * @exception IOException if the connection to the ORB failed.
**/ **/
static RMIServer connectStub(RMIServer rmiServer, static RMIServer connectStub(RMIServer rmiServer,
Map environment) Map<String, ?> environment)
throws IOException { throws IOException {
if (rmiServer instanceof javax.rmi.CORBA.Stub) { if (rmiServer instanceof javax.rmi.CORBA.Stub) {
javax.rmi.CORBA.Stub stub = (javax.rmi.CORBA.Stub) rmiServer; javax.rmi.CORBA.Stub stub = (javax.rmi.CORBA.Stub) rmiServer;
...@@ -1776,7 +1779,7 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable ...@@ -1776,7 +1779,7 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable
* does not point to an {@link org.omg.CORBA.ORB ORB}. * does not point to an {@link org.omg.CORBA.ORB ORB}.
* @exception IOException if the ORB initialization failed. * @exception IOException if the ORB initialization failed.
**/ **/
static ORB resolveOrb(Map environment) static ORB resolveOrb(Map<String, ?> environment)
throws IOException { throws IOException {
if (environment != null) { if (environment != null) {
final Object orb = environment.get(EnvHelp.DEFAULT_ORB); final Object orb = environment.get(EnvHelp.DEFAULT_ORB);
...@@ -2004,7 +2007,7 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable ...@@ -2004,7 +2007,7 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable
} }
} }
private RMIServer findRMIServerIIOP(String ior, Map env, boolean isIiop) { private RMIServer findRMIServerIIOP(String ior, Map<String, ?> env, boolean isIiop) {
// could forbid "rmi:" URL here -- but do we need to? // could forbid "rmi:" URL here -- but do we need to?
final ORB orb = (ORB) final ORB orb = (ORB)
env.get(EnvHelp.DEFAULT_ORB); env.get(EnvHelp.DEFAULT_ORB);
...@@ -2012,7 +2015,7 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable ...@@ -2012,7 +2015,7 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable
return (RMIServer) PortableRemoteObject.narrow(stub, RMIServer.class); return (RMIServer) PortableRemoteObject.narrow(stub, RMIServer.class);
} }
private RMIServer findRMIServerJRMP(String base64, Map env, boolean isIiop) private RMIServer findRMIServerJRMP(String base64, Map<String, ?> env, boolean isIiop)
throws IOException { throws IOException {
// could forbid "iiop:" URL here -- but do we need to? // could forbid "iiop:" URL here -- but do we need to?
final byte[] serialized; final byte[] serialized;
...@@ -2046,7 +2049,8 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable ...@@ -2046,7 +2049,8 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable
this.loader = cl; this.loader = cl;
} }
protected Class resolveClass(ObjectStreamClass classDesc) @Override
protected Class<?> resolveClass(ObjectStreamClass classDesc)
throws IOException, ClassNotFoundException { throws IOException, ClassNotFoundException {
return Class.forName(classDesc.getName(), false, loader); return Class.forName(classDesc.getName(), false, loader);
} }
...@@ -2121,13 +2125,13 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable ...@@ -2121,13 +2125,13 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable
private static final String rmiServerImplStubClassName = private static final String rmiServerImplStubClassName =
RMIServer.class.getName() + "Impl_Stub"; RMIServer.class.getName() + "Impl_Stub";
private static final Class rmiServerImplStubClass; private static final Class<?> rmiServerImplStubClass;
private static final String rmiConnectionImplStubClassName = private static final String rmiConnectionImplStubClassName =
RMIConnection.class.getName() + "Impl_Stub"; RMIConnection.class.getName() + "Impl_Stub";
private static final Class<?> rmiConnectionImplStubClass; private static final Class<?> rmiConnectionImplStubClass;
private static final String pRefClassName = private static final String pRefClassName =
"com.sun.jmx.remote.internal.PRef"; "com.sun.jmx.remote.internal.PRef";
private static final Constructor proxyRefConstructor; private static final Constructor<?> proxyRefConstructor;
static { static {
final String pRefByteCodeString = final String pRefByteCodeString =
"\312\376\272\276\0\0\0.\0\27\12\0\5\0\15\11\0\4\0\16\13\0\17\0"+ "\312\376\272\276\0\0\0.\0\27\12\0\5\0\15\11\0\4\0\16\13\0\17\0"+
...@@ -2162,7 +2166,7 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable ...@@ -2162,7 +2166,7 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable
} }
}; };
Class serverStubClass; Class<?> serverStubClass;
try { try {
serverStubClass = Class.forName(rmiServerImplStubClassName); serverStubClass = Class.forName(rmiServerImplStubClassName);
} catch (Exception e) { } catch (Exception e) {
...@@ -2175,10 +2179,10 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable ...@@ -2175,10 +2179,10 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable
rmiServerImplStubClass = serverStubClass; rmiServerImplStubClass = serverStubClass;
Class<?> stubClass; Class<?> stubClass;
Constructor constr; Constructor<?> constr;
try { try {
stubClass = Class.forName(rmiConnectionImplStubClassName); stubClass = Class.forName(rmiConnectionImplStubClassName);
constr = (Constructor) AccessController.doPrivileged(action); constr = (Constructor<?>) AccessController.doPrivileged(action);
} catch (Exception e) { } catch (Exception e) {
logger.error("<clinit>", logger.error("<clinit>",
"Failed to initialize proxy reference constructor "+ "Failed to initialize proxy reference constructor "+
...@@ -2198,9 +2202,8 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable ...@@ -2198,9 +2202,8 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable
RemoteRef ref = stub.getRef(); RemoteRef ref = stub.getRef();
RemoteRef proxyRef = (RemoteRef) RemoteRef proxyRef = (RemoteRef)
proxyRefConstructor.newInstance(new Object[] {ref}); proxyRefConstructor.newInstance(new Object[] {ref});
final Class[] constrTypes = {RemoteRef.class}; final Constructor<?> rmiConnectionImplStubConstructor =
final Constructor rmiConnectionImplStubConstructor = rmiConnectionImplStubClass.getConstructor(RemoteRef.class);
rmiConnectionImplStubClass.getConstructor(constrTypes);
Object[] args = {proxyRef}; Object[] args = {proxyRef};
RMIConnection proxyStub = (RMIConnection) RMIConnection proxyStub = (RMIConnection)
rmiConnectionImplStubConstructor.newInstance(args); rmiConnectionImplStubConstructor.newInstance(args);
...@@ -2328,7 +2331,7 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable ...@@ -2328,7 +2331,7 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable
"com.sun.jmx.remote.internal.ProxyStub"; "com.sun.jmx.remote.internal.ProxyStub";
private static final String pInputStreamClassName = private static final String pInputStreamClassName =
"com.sun.jmx.remote.internal.PInputStream"; "com.sun.jmx.remote.internal.PInputStream";
private static final Class proxyStubClass; private static final Class<?> proxyStubClass;
static { static {
final String proxyStubByteCodeString = final String proxyStubByteCodeString =
"\312\376\272\276\0\0\0.\0)\12\0\14\0\26\7\0\27\12\0\14\0\30\12"+ "\312\376\272\276\0\0\0.\0)\12\0\14\0\26\7\0\27\12\0\14\0\30\12"+
......
...@@ -423,7 +423,7 @@ public class RMIConnectorServer extends JMXConnectorServer { ...@@ -423,7 +423,7 @@ public class RMIConnectorServer extends JMXConnectorServer {
try { try {
if (tracing) logger.trace("start", "binding to " + jndiUrl); if (tracing) logger.trace("start", "binding to " + jndiUrl);
final Hashtable usemap = EnvHelp.mapToHashtable(attributes); final Hashtable<?, ?> usemap = EnvHelp.mapToHashtable(attributes);
bind(jndiUrl, usemap, objref, rebind); bind(jndiUrl, usemap, objref, rebind);
...@@ -555,7 +555,7 @@ public class RMIConnectorServer extends JMXConnectorServer { ...@@ -555,7 +555,7 @@ public class RMIConnectorServer extends JMXConnectorServer {
logger.trace("stop", logger.trace("stop",
"unbind from external directory: " + boundJndiUrl); "unbind from external directory: " + boundJndiUrl);
final Hashtable usemap = EnvHelp.mapToHashtable(attributes); final Hashtable<?, ?> usemap = EnvHelp.mapToHashtable(attributes);
InitialContext ctx = InitialContext ctx =
new InitialContext(usemap); new InitialContext(usemap);
...@@ -655,7 +655,7 @@ public class RMIConnectorServer extends JMXConnectorServer { ...@@ -655,7 +655,7 @@ public class RMIConnectorServer extends JMXConnectorServer {
* @param rmiServer The object to bind in the registry * @param rmiServer The object to bind in the registry
* @param rebind true if the object must be rebound. * @param rebind true if the object must be rebound.
**/ **/
void bind(String jndiUrl, Hashtable attributes, void bind(String jndiUrl, Hashtable<?, ?> attributes,
RMIServer rmiServer, boolean rebind) RMIServer rmiServer, boolean rebind)
throws NamingException, MalformedURLException { throws NamingException, MalformedURLException {
// if jndiURL is not null, we nust bind the stub to a // if jndiURL is not null, we nust bind the stub to a
...@@ -692,7 +692,8 @@ public class RMIConnectorServer extends JMXConnectorServer { ...@@ -692,7 +692,8 @@ public class RMIConnectorServer extends JMXConnectorServer {
* @param attributes A Map containing environment parameters, * @param attributes A Map containing environment parameters,
* built from the Map specified at this object creation. * built from the Map specified at this object creation.
**/ **/
private void encodeStubInAddress(RMIServer rmiServer, Map attributes) private void encodeStubInAddress(
RMIServer rmiServer, Map<String, ?> attributes)
throws IOException { throws IOException {
final String protocol, host; final String protocol, host;
...@@ -735,14 +736,16 @@ public class RMIConnectorServer extends JMXConnectorServer { ...@@ -735,14 +736,16 @@ public class RMIConnectorServer extends JMXConnectorServer {
/** /**
* Returns the IOR of the given rmiServer. * Returns the IOR of the given rmiServer.
**/ **/
static String encodeStub(RMIServer rmiServer, Map env) throws IOException { static String encodeStub(
RMIServer rmiServer, Map<String, ?> env) throws IOException {
if (rmiServer instanceof javax.rmi.CORBA.Stub) if (rmiServer instanceof javax.rmi.CORBA.Stub)
return "/ior/" + encodeIIOPStub(rmiServer, env); return "/ior/" + encodeIIOPStub(rmiServer, env);
else else
return "/stub/" + encodeJRMPStub(rmiServer, env); return "/stub/" + encodeJRMPStub(rmiServer, env);
} }
static String encodeJRMPStub(RMIServer rmiServer, Map env) static String encodeJRMPStub(
RMIServer rmiServer, Map<String, ?> env)
throws IOException { throws IOException {
ByteArrayOutputStream bout = new ByteArrayOutputStream(); ByteArrayOutputStream bout = new ByteArrayOutputStream();
ObjectOutputStream oout = new ObjectOutputStream(bout); ObjectOutputStream oout = new ObjectOutputStream(bout);
...@@ -752,7 +755,8 @@ public class RMIConnectorServer extends JMXConnectorServer { ...@@ -752,7 +755,8 @@ public class RMIConnectorServer extends JMXConnectorServer {
return byteArrayToBase64(bytes); return byteArrayToBase64(bytes);
} }
static String encodeIIOPStub(RMIServer rmiServer, Map env) static String encodeIIOPStub(
RMIServer rmiServer, Map<String, ?> env)
throws IOException { throws IOException {
try { try {
javax.rmi.CORBA.Stub stub = javax.rmi.CORBA.Stub stub =
...@@ -767,7 +771,8 @@ public class RMIConnectorServer extends JMXConnectorServer { ...@@ -767,7 +771,8 @@ public class RMIConnectorServer extends JMXConnectorServer {
* Object that we will bind to the registry. * Object that we will bind to the registry.
* This object is a stub connected to our RMIServerImpl. * This object is a stub connected to our RMIServerImpl.
**/ **/
private static RMIServer objectToBind(RMIServerImpl rmiServer, Map env) private static RMIServer objectToBind(
RMIServerImpl rmiServer, Map<String, ?> env)
throws IOException { throws IOException {
return RMIConnector. return RMIConnector.
connectStub((RMIServer)rmiServer.toStub(),env); connectStub((RMIServer)rmiServer.toStub(),env);
......
...@@ -75,7 +75,7 @@ public abstract class RMIServerImpl implements Closeable, RMIServer { ...@@ -75,7 +75,7 @@ public abstract class RMIServerImpl implements Closeable, RMIServer {
* to an empty Map. * to an empty Map.
*/ */
public RMIServerImpl(Map<String,?> env) { public RMIServerImpl(Map<String,?> env) {
this.env = (env == null) ? Collections.EMPTY_MAP : env; this.env = (env == null) ? Collections.<String,Object>emptyMap() : env;
} }
void setRMIConnectorServer(RMIConnectorServer connServer) void setRMIConnectorServer(RMIConnectorServer connServer)
...@@ -337,8 +337,9 @@ public abstract class RMIServerImpl implements Closeable, RMIServer { ...@@ -337,8 +337,9 @@ public abstract class RMIServerImpl implements Closeable, RMIServer {
synchronized (clientList) { synchronized (clientList) {
dropDeadReferences(); dropDeadReferences();
for (Iterator it = clientList.iterator(); it.hasNext(); ) { for (Iterator<WeakReference<RMIConnection>> it = clientList.iterator();
WeakReference wr = (WeakReference) it.next(); it.hasNext(); ) {
WeakReference<RMIConnection> wr = it.next();
if (wr.get() == client) { if (wr.get() == client) {
it.remove(); it.remove();
break; break;
...@@ -417,9 +418,10 @@ public abstract class RMIServerImpl implements Closeable, RMIServer { ...@@ -417,9 +418,10 @@ public abstract class RMIServerImpl implements Closeable, RMIServer {
dropDeadReferences(), this will usually be the first dropDeadReferences(), this will usually be the first
element of the list, but a garbage collection could have element of the list, but a garbage collection could have
happened in between. */ happened in between. */
for (Iterator it = clientList.iterator(); it.hasNext(); ) { for (Iterator<WeakReference<RMIConnection>> it = clientList.iterator();
WeakReference wr = (WeakReference) it.next(); it.hasNext(); ) {
RMIConnection client = (RMIConnection) wr.get(); WeakReference<RMIConnection> wr = it.next();
RMIConnection client = wr.get();
it.remove(); it.remove();
if (client != null) { if (client != null) {
try { try {
...@@ -475,10 +477,10 @@ public abstract class RMIServerImpl implements Closeable, RMIServer { ...@@ -475,10 +477,10 @@ public abstract class RMIServerImpl implements Closeable, RMIServer {
buf.append("//").append(clientHost); buf.append("//").append(clientHost);
buf.append(" "); buf.append(" ");
if (subject != null) { if (subject != null) {
Set principals = subject.getPrincipals(); Set<Principal> principals = subject.getPrincipals();
String sep = ""; String sep = "";
for (Iterator it = principals.iterator(); it.hasNext(); ) { for (Iterator<Principal> it = principals.iterator(); it.hasNext(); ) {
Principal p = (Principal) it.next(); Principal p = it.next();
String name = p.getName().replace(' ', '_').replace(';', ':'); String name = p.getName().replace(' ', '_').replace(';', ':');
buf.append(sep).append(name); buf.append(sep).append(name);
sep = ";"; sep = ";";
...@@ -492,8 +494,9 @@ public abstract class RMIServerImpl implements Closeable, RMIServer { ...@@ -492,8 +494,9 @@ public abstract class RMIServerImpl implements Closeable, RMIServer {
private void dropDeadReferences() { private void dropDeadReferences() {
synchronized (clientList) { synchronized (clientList) {
for (Iterator it = clientList.iterator(); it.hasNext(); ) { for (Iterator<WeakReference<RMIConnection>> it = clientList.iterator();
WeakReference wr = (WeakReference) it.next(); it.hasNext(); ) {
WeakReference<RMIConnection> wr = it.next();
if (wr.get() == null) if (wr.get() == null)
it.remove(); it.remove();
} }
...@@ -522,7 +525,7 @@ public abstract class RMIServerImpl implements Closeable, RMIServer { ...@@ -522,7 +525,7 @@ public abstract class RMIServerImpl implements Closeable, RMIServer {
private MBeanServer mbeanServer; private MBeanServer mbeanServer;
private final Map env; private final Map<String, ?> env;
private RMIConnectorServer connServer; private RMIConnectorServer connServer;
......
...@@ -248,8 +248,7 @@ public class Timer extends NotificationBroadcasterSupport ...@@ -248,8 +248,7 @@ public class Timer extends NotificationBroadcasterSupport
*/ */
public synchronized MBeanNotificationInfo[] getNotificationInfo() { public synchronized MBeanNotificationInfo[] getNotificationInfo() {
Set<String> notifTypes = new TreeSet<String>(); Set<String> notifTypes = new TreeSet<String>();
for (Iterator it = timerTable.values().iterator(); it.hasNext(); ) { for (Object[] entry : timerTable.values()) {
Object[] entry = (Object[]) it.next();
TimerNotification notif = (TimerNotification) TimerNotification notif = (TimerNotification)
entry[TIMER_NOTIF_INDEX]; entry[TIMER_NOTIF_INDEX];
notifTypes.add(notif.getType()); notifTypes.add(notif.getType());
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册