@SuppressWarnings("unchecked") public static <T extends Annotation> T newInstance( final org.jboss.forge.roaster.model.Annotation<?> annotationSource) { try { Class<T> annotationClass = (Class<T>) Class.forName(annotationSource.getQualifiedName()); // TODO: test this not using annotationSource.getClass().getClassLoader() (will require integration test) return (T) java.lang.reflect.Proxy.newProxyInstance( annotationClass.getClassLoader(), new Class[] { annotationClass }, new AnnotationProxy<T>(annotationClass, annotationSource)); } catch (Exception e) { throw InspectorException.newException(e); } }
@SuppressWarnings("unchecked") public static <T extends Annotation> T newInstance( final org.jboss.forge.roaster.model.Annotation<?> annotationSource) { try { Class<T> annotationClass = (Class<T>) Class.forName(annotationSource.getQualifiedName()); // TODO: test this not using annotationSource.getClass().getClassLoader() (will require integration test) return (T) java.lang.reflect.Proxy.newProxyInstance( annotationClass.getClassLoader(), new Class[] { annotationClass }, new AnnotationProxy<T>(annotationClass, annotationSource)); } catch (Exception e) { throw InspectorException.newException(e); } }