Mercurial > hg > graal-compiler
comparison c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/logging/LoggingProxy.java @ 2288:8c426c2891c8
client/server: new interface Remote marks classes that should not be serialized, but called remotely
author | Lukas Stadler <lukas.stadler@jku.at> |
---|---|
date | Mon, 11 Apr 2011 10:37:24 +0200 |
parents | 9e5e83ca2259 |
children |
comparison
equal
deleted
inserted
replaced
2287:66ffa0e99cef | 2288:8c426c2891c8 |
---|---|
19 * Company, Ltd. | 19 * Company, Ltd. |
20 */ | 20 */ |
21 package com.sun.hotspot.c1x.logging; | 21 package com.sun.hotspot.c1x.logging; |
22 | 22 |
23 import java.lang.reflect.*; | 23 import java.lang.reflect.*; |
24 | |
25 import com.sun.hotspot.c1x.server.*; | |
24 | 26 |
25 /** | 27 /** |
26 * A java.lang.reflect proxy that hierarchically logs all method invocations along with their parameters and return values. | 28 * A java.lang.reflect proxy that hierarchically logs all method invocations along with their parameters and return values. |
27 * | 29 * |
28 * @author Lukas Stadler | 30 * @author Lukas Stadler |
62 } | 64 } |
63 Logger.endScope(" = " + Logger.pretty(result)); | 65 Logger.endScope(" = " + Logger.pretty(result)); |
64 return result; | 66 return result; |
65 } | 67 } |
66 | 68 |
69 /** | |
70 * The object returned by this method will implement all interfaces that are implemented by delegate. | |
71 */ | |
67 public static <T> T getProxy(Class<T> interf, T delegate) { | 72 public static <T> T getProxy(Class<T> interf, T delegate) { |
68 Object obj = Proxy.newProxyInstance(interf.getClassLoader(), new Class[] {interf}, new LoggingProxy<T>(delegate)); | 73 Class<?>[] interfaces = ReplacingStreams.getAllInterfaces(delegate.getClass()); |
74 Object obj = Proxy.newProxyInstance(interf.getClassLoader(), interfaces, new LoggingProxy<T>(delegate)); | |
69 return interf.cast(obj); | 75 return interf.cast(obj); |
70 } | 76 } |
71 } | 77 } |