in modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/xml/JavaInterfaceProcessor.java [295:391]
private void checkForbiddenAnnotations(Monitor monitor, JavaInterfaceContract javaInterfaceContract) {
if (javaInterfaceContract.getInterface() == null) {
return;
}
Class<?> ifc = ((JavaInterface) javaInterfaceContract.getInterface()).getJavaClass();
if (ifc == null) {
return;
}
for (Annotation a : ifc.getAnnotations()) {
if (ifc.isInterface()) {
if (JCA30006_ANNOTATIONS.contains(a.annotationType())) {
error(monitor, "ForbiddenAnnotationJCA30006", javaInterfaceContract, a.annotationType(), ifc.getName());
}
} else {
if (JCA30008_ANNOTATIONS.contains(a.annotationType())) {
error(monitor, "ForbiddenAnnotationJCA30008", javaInterfaceContract, a.annotationType(), ifc.getName());
}
}
if ( a.annotationType().equals(WebServiceClient.class) ) {
error(monitor, "ForbiddenAnnotationJCA100018", javaInterfaceContract, a.annotationType(), ifc.getName());
}
}
for (Method m : ifc.getMethods()) {
for (Annotation a : m.getAnnotations()) {
if (ifc.isInterface()) {
if (JCA30006_ANNOTATIONS.contains(a.annotationType())) {
error(monitor, "ForbiddenAnnotationJCA30006", javaInterfaceContract, a.annotationType(), ifc.getName());
}
} else {
if (JCA30008_ANNOTATIONS.contains(a.annotationType())) {
error(monitor, "ForbiddenAnnotationJCA30008", javaInterfaceContract, a.annotationType(), ifc.getName());
}
}
}
}
for (Field f : ifc.getFields()) {
for (Annotation a : f.getAnnotations()) {
if (ifc.isInterface()) {
if (JCA30006_ANNOTATIONS.contains(a.annotationType())) {
error(monitor, "ForbiddenAnnotationJCA30006", javaInterfaceContract, a.annotationType(), ifc.getName());
}
} else {
if (JCA30008_ANNOTATIONS.contains(a.annotationType())) {
error(monitor, "ForbiddenAnnotationJCA30008", javaInterfaceContract, a.annotationType(), ifc.getName());
}
}
}
}
if (javaInterfaceContract.getCallbackInterface() == null) {
return;
}
ifc = ((JavaInterface) javaInterfaceContract.getCallbackInterface()).getJavaClass();
if (ifc == null) {
return;
}
for (Annotation a : ifc.getAnnotations()) {
if (ifc.isInterface()) {
if (JCA30007_ANNOTATIONS.contains(a.annotationType())) {
error(monitor, "ForbiddenAnnotationJCA30007", javaInterfaceContract, a.annotationType(), ifc.getName());
}
} else {
if (JCA30008_ANNOTATIONS.contains(a.annotationType())) {
error(monitor, "ForbiddenAnnotationJCA30008", javaInterfaceContract, a.annotationType(), ifc.getName());
}
}
}
for (Method m : ifc.getMethods()) {
for (Annotation a : m.getAnnotations()) {
if (ifc.isInterface()) {
if (JCA30007_ANNOTATIONS.contains(a.annotationType())) {
error(monitor, "ForbiddenAnnotationJCA30007", javaInterfaceContract, a.annotationType(), ifc.getName());
}
} else {
if (JCA30008_ANNOTATIONS.contains(a.annotationType())) {
error(monitor, "ForbiddenAnnotationJCA30008", javaInterfaceContract, a.annotationType(), ifc.getName());
}
}
}
}
for (Field f : ifc.getFields()) {
for (Annotation a : f.getAnnotations()) {
if (ifc.isInterface()) {
if (JCA30007_ANNOTATIONS.contains(a.annotationType())) {
error(monitor, "ForbiddenAnnotationJCA30007", javaInterfaceContract, a.annotationType(), ifc.getName());
}
} else {
if (JCA30008_ANNOTATIONS.contains(a.annotationType())) {
error(monitor, "ForbiddenAnnotationJCA30008", javaInterfaceContract, a.annotationType(), ifc.getName());
}
}
}
}
}