Community
Participate
Working Groups
When I try to execute with Wildfly 11 in Debug mode this instruction: private static final String entity = MasUtil.getAnnotationValue(Anagrafica.class, "TipoRecord", "code"); I receive this error org.eclipse.jdt.internal.debug.core.model.JDIClassType cannot be cast to org.eclipse.jdt.debug.core.IJavaValue no error when running in start "not debug" mode The above method is this: /* * Return the annotation value of a class * @param clazz: class to extract the annotation * @param annotationName: name of the annotation * @param annotationMethod: method of the annotation */ public static String getAnnotationValue(Class<?> clazz, String annotationName, String annotationMethod) { Object value = ""; if (annotationName == null || annotationMethod == null) { return value.toString(); } for (Annotation annotation : clazz.getAnnotations()) { Class<? extends Annotation> type = annotation.annotationType(); String[] parts = type.getName().split(Pattern.quote(".")); String name = parts[parts.length-1]; if (annotationName.equals(name)) { for (Method method : type.getDeclaredMethods()) { if (method.getName() == annotationMethod) { try { value = method.invoke(annotation, (Object[])null); } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { return value.toString(); } } } } } return value.toString(); }
Can you provide a stacktrace?