@Test(enabled = false) public void shouldDeProxyJavassistProxy() { ProxyFactory proxyFactory = new ProxyFactory(); proxyFactory.setSuperclass(ArrayList.class); Class<?> proxy = proxyFactory.createClass(); assertEquals(Types.deProxy(proxy), ArrayList.class); }
@SuppressWarnings("unchecked") public static <T> Class<T> deProxy(Class<?> type) { if (type.isInterface()) return (Class<T>) type; if (type.getName().contains("$$Enhancer")) return (Class<T>) type.getSuperclass(); try { if (JAVASSIST_IS_PROXY_CLASS_METHOD != null && (Boolean) JAVASSIST_IS_PROXY_CLASS_METHOD.invoke(null, type)) return (Class<T>) type.getSuperclass(); } catch (Exception ignore) { } return (Class<T>) type; }
Types { @SuppressWarnings("unchecked") public static <T> Class<T> deProxy(Class<?> type) { if (type.isInterface()) return (Class<T>) type; if (type.getName().contains("$$Enhancer")) return (Class<T>) type.getSuperclass(); try { if (JAVASSIST_IS_PROXY_CLASS_METHOD != null && (Boolean) JAVASSIST_IS_PROXY_CLASS_METHOD.invoke(null, type)) return (Class<T>) type.getSuperclass(); } catch (Exception ignore) { } return (Class<T>) type; } }
Types { @SuppressWarnings("unchecked") public static <T> Class<T> deProxy(Class<?> type) { if (type.isInterface()) return (Class<T>) type; if (type.getName().contains("$$Enhancer")) return (Class<T>) type.getSuperclass(); try { if (JAVASSIST_IS_PROXY_CLASS_METHOD != null && (Boolean) JAVASSIST_IS_PROXY_CLASS_METHOD.invoke(null, type)) return (Class<T>) type.getSuperclass(); } catch (Exception ignore) { } return (Class<T>) type; } private  Types(); }
Types { @SuppressWarnings("unchecked") public static <T> Class<T> deProxy(Class<?> type) { if (type.isInterface()) return (Class<T>) type; if (type.getName().contains("$$Enhancer")) return (Class<T>) type.getSuperclass(); try { if (JAVASSIST_IS_PROXY_CLASS_METHOD != null && (Boolean) JAVASSIST_IS_PROXY_CLASS_METHOD.invoke(null, type)) return (Class<T>) type.getSuperclass(); } catch (Exception ignore) { } return (Class<T>) type; } private  Types(); @SuppressWarnings("unchecked") static Class<T> deProxy(Class<?> type); }
Types { @SuppressWarnings("unchecked") public static <T> Class<T> deProxy(Class<?> type) { if (type.isInterface()) return (Class<T>) type; if (type.getName().contains("$$Enhancer")) return (Class<T>) type.getSuperclass(); try { if (JAVASSIST_IS_PROXY_CLASS_METHOD != null && (Boolean) JAVASSIST_IS_PROXY_CLASS_METHOD.invoke(null, type)) return (Class<T>) type.getSuperclass(); } catch (Exception ignore) { } return (Class<T>) type; } private  Types(); @SuppressWarnings("unchecked") static Class<T> deProxy(Class<?> type);  }