Skip to content

Commit 8f0dd73

Browse files
committed
removing warnings
1 parent 8ef4197 commit 8f0dd73

File tree

2 files changed

+20
-19
lines changed
  • sources

2 files changed

+20
-19
lines changed

sources/net.sf.j2s.core/src/net/sf/j2s/core/astvisitors/adapters/TypeAdapter.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
import org.eclipse.jdt.core.dom.Type;
2121
import org.eclipse.jdt.core.dom.WildcardType;
2222

23-
import net.sf.j2s.core.astvisitors.ASTEmptyVisitor;
2423
import net.sf.j2s.core.astvisitors.ASTKeywordVisitor;
2524

2625
/**

sources/net.sf.j2s.java.core/src/java/lang/reflect/Proxy.java

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -224,22 +224,22 @@ public class Proxy implements java.io.Serializable {
224224
private final static String proxyClassNamePrefix = "$Proxy";
225225

226226
/** parameter types of a proxy class constructor */
227-
private final static Class[] constructorParams =
227+
private final static Class<?>[] constructorParams =
228228
{ InvocationHandler.class };
229229

230230
/** maps a class loader to the proxy class cache for that loader */
231-
private static Map loaderToCache = new HashMap();
231+
private static Map<ClassLoader, Map<Object, Object>> loaderToCache = new HashMap<ClassLoader, Map<Object, Object>>();
232232

233-
/** marks that a particular proxy class is currently being generated */
234-
private static Object pendingGenerationMarker = new Object();
233+
// /** marks that a particular proxy class is currently being generated */
234+
// private static Object pendingGenerationMarker = new Object();
235235

236236
/** next number to use for generation of unique proxy class names */
237237
private static long nextUniqueNumber = 0;
238238
private static Object nextUniqueNumberLock = new Object();
239239

240240
/** set of all generated proxy classes, for isProxyClass implementation */
241-
private static Map proxyClasses =
242-
Collections.synchronizedMap(new HashMap());
241+
private static Map<Class<?>, String> proxyClasses =
242+
Collections.synchronizedMap(new HashMap<Class<?>, String>());
243243

244244
/**
245245
* the invocation handler for this proxy instance.
@@ -250,7 +250,8 @@ public class Proxy implements java.io.Serializable {
250250
/**
251251
* Prohibits instantiation.
252252
*/
253-
private Proxy() {
253+
@SuppressWarnings("unused")
254+
private Proxy() {
254255
}
255256

256257
/**
@@ -338,28 +339,29 @@ protected Proxy(InvocationHandler h) {
338339
* @throws NullPointerException if the {@code interfaces} array
339340
* argument or any of its elements are {@code null}
340341
*/
341-
public static Class<?> getProxyClass(ClassLoader loader,
342+
@SuppressWarnings("null")
343+
public static Class<?> getProxyClass(ClassLoader loader,
342344
Class<?>... interfaces)
343345
throws IllegalArgumentException
344346
{
345347
if (interfaces.length > 65535) {
346348
throw new IllegalArgumentException("interface limit exceeded");
347349
}
348350

349-
Class proxyClass = null;
351+
Class<?> proxyClass = null;
350352

351353
/* collect interface names to use as key for proxy class cache */
352354
String[] interfaceNames = new String[interfaces.length];
353355

354-
Set interfaceSet = new HashSet(); // for detecting duplicates
356+
Set<Class<?>> interfaceSet = new HashSet<Class<?>>(); // for detecting duplicates
355357

356358
for (int i = 0; i < interfaces.length; i++) {
357359
/*
358360
* Verify that the class loader resolves the name of this
359361
* interface to the same Class object.
360362
*/
361363
String interfaceName = interfaces[i].getName();
362-
Class interfaceClass = null;
364+
Class<?> interfaceClass = null;
363365
/**
364366
* @j2sNative
365367
*
@@ -411,7 +413,7 @@ public static Class<?> getProxyClass(ClassLoader loader,
411413
/*
412414
* Find or create the proxy class cache for the class loader.
413415
*/
414-
Map cache;
416+
Map<Object, Object> cache;
415417
/**
416418
* will be "[object Object]" as class loaders have not been implemented in SwingJS
417419
*
@@ -422,9 +424,9 @@ public static Class<?> getProxyClass(ClassLoader loader,
422424
*/
423425
{}
424426
synchronized (loaderToCache) {
425-
cache = (Map) loaderToCache.get(loader);
427+
cache = (Map<Object, Object>) loaderToCache.get(loader);
426428
if (cache == null) {
427-
cache = new HashMap();
429+
cache = new HashMap<Object, Object>();
428430
loaderToCache.put(loader, cache);
429431
}
430432
/*
@@ -454,7 +456,7 @@ public static Class<?> getProxyClass(ClassLoader loader,
454456
* from the loaderToCache map.
455457
*/
456458
do {
457-
Object value = cache.get(key);
459+
// Object value = cache.get(key);
458460
// if (value instanceof Reference) {
459461
// proxyClass = (Class) ((Reference) value).get();
460462
// }
@@ -610,13 +612,13 @@ public static Object newProxyInstance(ClassLoader loader,
610612
/*
611613
* Look up or generate the designated proxy class.
612614
*/
613-
Class cl = getProxyClass(loader, interfaces);
615+
Class<?> cl = getProxyClass(loader, interfaces);
614616

615617
/*
616618
* Invoke its constructor with the designated invocation handler.
617619
*/
618620
try {
619-
Constructor cons = cl.getConstructor(constructorParams);
621+
Constructor<?> cons = cl.getConstructor(constructorParams);
620622
return (Object) cons.newInstance(new Object[] { h });
621623
} catch (NoSuchMethodException e) {
622624
throw new InternalError(e.toString());
@@ -673,7 +675,7 @@ public static InvocationHandler getInvocationHandler(Object proxy)
673675
return p.h;
674676
}
675677

676-
private static Class defineClass0(ClassLoader loader, String name, Class<?>[] interfaces) {
678+
private static Class<?> defineClass0(ClassLoader loader, String name, Class<?>[] interfaces) {
677679
Class<?> cl = null;
678680
/**
679681
* @j2sNative

0 commit comments

Comments
 (0)