summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sca-java-2.x/trunk/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ServiceProcessor.java10
1 files changed, 10 insertions, 0 deletions
diff --git a/sca-java-2.x/trunk/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ServiceProcessor.java b/sca-java-2.x/trunk/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ServiceProcessor.java
index 70a7d489cd..6ad2140304 100644
--- a/sca-java-2.x/trunk/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ServiceProcessor.java
+++ b/sca-java-2.x/trunk/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ServiceProcessor.java
@@ -37,6 +37,7 @@ import org.apache.tuscany.sca.core.ExtensionPointRegistry;
import org.apache.tuscany.sca.implementation.java.IntrospectionException;
import org.apache.tuscany.sca.implementation.java.JavaElementImpl;
import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.implementation.java.JavaScopeImpl;
import org.apache.tuscany.sca.implementation.java.introspect.BaseJavaClassVisitor;
import org.apache.tuscany.sca.implementation.java.introspect.JavaIntrospectionHelper;
import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
@@ -52,6 +53,9 @@ import org.oasisopen.sca.annotation.Remotable;
* the component type with corresponding {@link Service}s. Also processes
* related {@link org.oasisopen.sca.annotation.Callback} annotations.
*
+ * This Visitor MUST follow the ScopeProcessor in the sequence of visitors, since processing of
+ * the Callback annotations depends on knowing the Scope of the implementation
+ *
* @version $Rev$ $Date$
*/
public class ServiceProcessor extends BaseJavaClassVisitor {
@@ -149,6 +153,9 @@ public class ServiceProcessor extends BaseJavaClassVisitor {
if (annotation == null) {
return;
}
+ if( type.getJavaScope() == JavaScopeImpl.COMPOSITE ) {
+ throw new IllegalCallbackReferenceException("[JCA90057] @Callback on field or method cannot be used for a class with @Scope(COMPOSITE): " + type.getName() + "." + method.getName());
+ }
if (!(annotation.value() == null || annotation.value() == Void.class)) {
throw new IllegalCallbackReferenceException("[JCA90046] @Callback on field of method must not have any parameters: " + type.getName() + "." + method.getName());
@@ -171,6 +178,9 @@ public class ServiceProcessor extends BaseJavaClassVisitor {
if (annotation == null) {
return;
}
+ if( type.getJavaScope() == JavaScopeImpl.COMPOSITE ) {
+ throw new IllegalCallbackReferenceException("[JCA90057] @Callback on field or method cannot be used for a class with @Scope(COMPOSITE): " + type.getName() + "." + field.getName());
+ }
if (!(annotation.value() == null || annotation.value() == Void.class)) {
throw new IllegalCallbackReferenceException("[JCA90046] @Callback on field of method must not have any parameters: " + type.getName() + "." + field.getName());
}