summaryrefslogtreecommitdiffstats
path: root/java/sca/modules/implementation-java/src
diff options
context:
space:
mode:
Diffstat (limited to 'java/sca/modules/implementation-java/src')
-rw-r--r--java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/xml/JavaImplementationProcessor.java27
-rw-r--r--java/sca/modules/implementation-java/src/main/resources/impl-javaxml-validation-messages.properties2
2 files changed, 28 insertions, 1 deletions
diff --git a/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/xml/JavaImplementationProcessor.java b/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/xml/JavaImplementationProcessor.java
index 1653e935dc..df67814bd4 100644
--- a/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/xml/JavaImplementationProcessor.java
+++ b/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/xml/JavaImplementationProcessor.java
@@ -25,6 +25,7 @@ import static org.apache.tuscany.sca.implementation.java.xml.JavaImplementationC
import static org.apache.tuscany.sca.implementation.java.xml.JavaImplementationConstants.IMPLEMENTATION_JAVA_QNAME;
import static org.apache.tuscany.sca.implementation.java.xml.JavaImplementationConstants.SCA11_NS;
+import java.lang.annotation.Annotation;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
@@ -187,6 +188,8 @@ public class JavaImplementationProcessor implements StAXArtifactProcessor<JavaIm
return;
}
+ checkNoStaticAnnotations(monitor, javaImplementation);
+
javaImplementation.setUnresolved(false);
mergeComponentType(resolver, javaImplementation, context);
@@ -199,6 +202,30 @@ public class JavaImplementationProcessor implements StAXArtifactProcessor<JavaIm
} // end try
} // end method
+ private void checkNoStaticAnnotations(Monitor monitor, JavaImplementation javaImplementation) {
+ if (javaImplementation.getJavaClass() != null) {
+ Class<?> clazz = javaImplementation.getJavaClass();
+ for (Method m : clazz.getMethods()) {
+ if (Modifier.isStatic(m.getModifiers())) {
+ for (Annotation a : m.getAnnotations()) {
+ if (a.annotationType().getName().startsWith("org.oasisopen.sca.annotation")) {
+ error(monitor, "IllegalSCAAnnotation", javaFactory, javaImplementation.getName(), m.getName());
+ }
+ }
+ }
+ }
+ for (Field f : clazz.getFields()) {
+ if (Modifier.isStatic(f.getModifiers())) {
+ for (Annotation a : f.getAnnotations()) {
+ if (a.annotationType().getName().startsWith("org.oasisopen.sca.annotation")) {
+ error(monitor, "IllegalSCAAnnotation", javaFactory, javaImplementation.getName(), f.getName());
+ }
+ }
+ }
+ }
+ }
+ }
+
private JavaElementImpl getMemeber(JavaImplementation impl, String name, Class<?> type) {
String setter = JavaIntrospectionHelper.toSetter(name);
try {
diff --git a/java/sca/modules/implementation-java/src/main/resources/impl-javaxml-validation-messages.properties b/java/sca/modules/implementation-java/src/main/resources/impl-javaxml-validation-messages.properties
index 210b715da8..337a0b8458 100644
--- a/java/sca/modules/implementation-java/src/main/resources/impl-javaxml-validation-messages.properties
+++ b/java/sca/modules/implementation-java/src/main/resources/impl-javaxml-validation-messages.properties
@@ -20,4 +20,4 @@
#
ClassNotFoundException = Class Not Found Exception: {0}
ContributionResolveException = Contribution Resolve Exception occured due to:
-
+IllegalSCAAnnotation = JCA9002 SCA annotations are not permitted on static members: {0}.{1}