1 |
/* Proxy.java -- build a proxy class that implements reflected interfaces |
/* Proxy.java -- build a proxy class that implements reflected interfaces |
2 |
Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. |
Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. |
3 |
|
|
4 |
This file is part of GNU Classpath. |
This file is part of GNU Classpath. |
5 |
|
|
155 |
* @see Class |
* @see Class |
156 |
* @author Eric Blake <ebb9@email.byu.edu> |
* @author Eric Blake <ebb9@email.byu.edu> |
157 |
* @since 1.3 |
* @since 1.3 |
158 |
* @status updated to 1.4, except for the use of ProtectionDomain |
* @status updated to 1.5, except for the use of ProtectionDomain |
159 |
*/ |
*/ |
160 |
public class Proxy implements Serializable |
public class Proxy implements Serializable |
161 |
{ |
{ |
254 |
*/ |
*/ |
255 |
// synchronized so that we aren't trying to build the same class |
// synchronized so that we aren't trying to build the same class |
256 |
// simultaneously in two threads |
// simultaneously in two threads |
257 |
public static synchronized Class getProxyClass(ClassLoader loader, |
public static synchronized Class<?> getProxyClass(ClassLoader loader, |
258 |
Class[] interfaces) |
Class<?>... interfaces) |
259 |
{ |
{ |
260 |
interfaces = (Class[]) interfaces.clone(); |
interfaces = (Class[]) interfaces.clone(); |
261 |
ProxyType pt = new ProxyType(loader, interfaces); |
ProxyType pt = new ProxyType(loader, interfaces); |
309 |
* @see Constructor#newInstance(Object[]) |
* @see Constructor#newInstance(Object[]) |
310 |
*/ |
*/ |
311 |
public static Object newProxyInstance(ClassLoader loader, |
public static Object newProxyInstance(ClassLoader loader, |
312 |
Class[] interfaces, |
Class<?>[] interfaces, |
313 |
InvocationHandler handler) |
InvocationHandler handler) |
314 |
{ |
{ |
315 |
try |
try |
357 |
*/ |
*/ |
358 |
// This is synchronized on the off chance that another thread is |
// This is synchronized on the off chance that another thread is |
359 |
// trying to add a class to the map at the same time we read it. |
// trying to add a class to the map at the same time we read it. |
360 |
public static synchronized boolean isProxyClass(Class clazz) |
public static synchronized boolean isProxyClass(Class<?> clazz) |
361 |
{ |
{ |
362 |
if (! Proxy.class.isAssignableFrom(clazz)) |
if (! Proxy.class.isAssignableFrom(clazz)) |
363 |
return false; |
return false; |