| 48 | } |
| 49 | |
| 50 | public static Class getProxyClass(ClassLoader loader, |
| 51 | Class ... interfaces) |
| 52 | { |
| 53 | for (Class c: interfaces) { |
| 54 | if (! c.isInterface()) { |
| 55 | throw new IllegalArgumentException(); |
| 56 | } |
| 57 | } |
| 58 | |
| 59 | int number; |
| 60 | synchronized (Proxy.class) { |
| 61 | number = nextNumber++; |
| 62 | } |
| 63 | |
| 64 | try { |
| 65 | return makeClass(loader, interfaces, "Proxy-" + number); |
| 66 | } catch (IOException e) { |
| 67 | AssertionError error = new AssertionError(); |
| 68 | error.initCause(e); |
| 69 | throw error; |
| 70 | } |
| 71 | } |
| 72 | |
| 73 | public static boolean isProxyClass(Class c) { |
| 74 | return c.getName().startsWith("Proxy-"); |