[421419] Incorrect annotation error on @Webservice in an interface class
in EJB 3.0 Project
diff --git a/bundles/org.eclipse.jst.ws.jaxws.core/src/org/eclipse/jst/ws/internal/jaxws/core/JAXWSCoreMessages.java b/bundles/org.eclipse.jst.ws.jaxws.core/src/org/eclipse/jst/ws/internal/jaxws/core/JAXWSCoreMessages.java
index 9bf1320..3917515 100644
--- a/bundles/org.eclipse.jst.ws.jaxws.core/src/org/eclipse/jst/ws/internal/jaxws/core/JAXWSCoreMessages.java
+++ b/bundles/org.eclipse.jst.ws.jaxws.core/src/org/eclipse/jst/ws/internal/jaxws/core/JAXWSCoreMessages.java
@@ -113,7 +113,7 @@
public static String IMPLEMENTS_MULTIPLE_INTERFACES;
public static String WEBPARAM_NAME_REDUNDANT;
- public static String WEBSERVICE_ONLY_ON_STATELESS_SESSION_BEANS;
+ public static String WEBSERVICE_ONLY_ON_STATELESS_OR_SINGLETON_SESSION_BEANS;
public static String TARGET_NAMESPACE_URI_SYNTAX_ERROR;
public static String EMPTY_ATTRIBUTE_VALUE;
diff --git a/bundles/org.eclipse.jst.ws.jaxws.core/src/org/eclipse/jst/ws/internal/jaxws/core/JAXWSCoreMessages.properties b/bundles/org.eclipse.jst.ws.jaxws.core/src/org/eclipse/jst/ws/internal/jaxws/core/JAXWSCoreMessages.properties
index 449fa62..34c65ef 100644
--- a/bundles/org.eclipse.jst.ws.jaxws.core/src/org/eclipse/jst/ws/internal/jaxws/core/JAXWSCoreMessages.properties
+++ b/bundles/org.eclipse.jst.ws.jaxws.core/src/org/eclipse/jst/ws/internal/jaxws/core/JAXWSCoreMessages.properties
@@ -84,7 +84,7 @@
WEBSERVICEPROVIDER_DATASOURCE_MESSAGE_MODE=javax.activation.DataSource derived objects require the Provider implementation to specify a @javax.xml.ws.ServiceMode annotation with javax.xml.ws.Service.Mode.MESSAGE as the value
EMPTY_ATTRIBUTE_VALUE=The @{0} {1} attribute should not be empty
WEBPARAM_NAME_REDUNDANT=Name attribute is not used if SOAPBinding.Style is RPC and partName is present
-WEBSERVICE_ONLY_ON_STATELESS_SESSION_BEANS=@WebService annotation in EJB modules can be only used on stateless session beans
+WEBSERVICE_ONLY_ON_STATELESS_OR_SINGLETON_SESSION_BEANS=@WebService annotation in EJB modules can be only used on stateless or singleton session beans
WEBSERVICE_ENPOINTINTERFACE_INCOMPATIBLE_EXCEPTIONS=Method {0} declares exceptions that are not compatible with the throws clause of the {0} method in the service endpoint interface {1}
INTERFACES_NOT_SUPPORTED={0} is an interface and may not be used as a return type or method parameter as JAXB cannot handle interfaces
HAS_INADMISSIBLE_INNER_TYPES=Class {0} may not be used as a return type or method parameter as it has inner types that are not public and static
diff --git a/bundles/org.eclipse.jst.ws.jaxws.core/src/org/eclipse/jst/ws/internal/jaxws/core/annotations/validation/WebServiceEJBModuleRule.java b/bundles/org.eclipse.jst.ws.jaxws.core/src/org/eclipse/jst/ws/internal/jaxws/core/annotations/validation/WebServiceEJBModuleRule.java
index f1507d4..1ab9223 100644
--- a/bundles/org.eclipse.jst.ws.jaxws.core/src/org/eclipse/jst/ws/internal/jaxws/core/annotations/validation/WebServiceEJBModuleRule.java
+++ b/bundles/org.eclipse.jst.ws.jaxws.core/src/org/eclipse/jst/ws/internal/jaxws/core/annotations/validation/WebServiceEJBModuleRule.java
@@ -28,11 +28,13 @@
import com.sun.mirror.declaration.AnnotationMirror;
import com.sun.mirror.declaration.AnnotationTypeDeclaration;
+import com.sun.mirror.declaration.ClassDeclaration;
import com.sun.mirror.declaration.Declaration;
public class WebServiceEJBModuleRule extends AbstractAnnotationProcessor {
private static final String STATELESS = "javax.ejb.Stateless"; //$NON-NLS-1$
+ private static final String SINGLETON = "javax.ejb.Singleton"; //$NON-NLS-1$
private static final String EJB_FACET = "jst.ejb"; //$NON-NLS-1$
private static final String EJB_FACET_VERSION = "3.0"; //$NON-NLS-1$
@@ -51,9 +53,9 @@
AnnotationTypeDeclaration webServiceDeclaration = (AnnotationTypeDeclaration) eclipseEnvironment.getTypeDeclaration(WebService.class.getName());
Collection<Declaration> annotatedTypes = eclipseEnvironment.getDeclarationsAnnotatedWith(webServiceDeclaration);
for (Declaration declaration : annotatedTypes) {
- if (getStatelessAnnotation(declaration) == null) {
+ if (declaration instanceof ClassDeclaration && getStatelessOrSingletonAnnotation(declaration) == null) {
AnnotationMirror webService = AnnotationUtils.getAnnotation(declaration, WebService.class);
- printError(webService.getPosition(), JAXWSCoreMessages.WEBSERVICE_ONLY_ON_STATELESS_SESSION_BEANS);
+ printError(webService.getPosition(), JAXWSCoreMessages.WEBSERVICE_ONLY_ON_STATELESS_OR_SINGLETON_SESSION_BEANS);
}
}
}
@@ -65,13 +67,14 @@
}
}
- private AnnotationMirror getStatelessAnnotation(Declaration declaration) {
+ private AnnotationMirror getStatelessOrSingletonAnnotation(Declaration declaration) {
Collection<AnnotationMirror> aannotationMirrors = declaration.getAnnotationMirrors();
for (AnnotationMirror annotationMirror : aannotationMirrors) {
AnnotationTypeDeclaration annotationTypeDeclaration = annotationMirror.getAnnotationType().getDeclaration();
if (annotationTypeDeclaration != null
- && annotationTypeDeclaration.getQualifiedName().equals(STATELESS)) {
+ && (annotationTypeDeclaration.getQualifiedName().equals(STATELESS)
+ || annotationTypeDeclaration.getQualifiedName().equals(SINGLETON))) {
return annotationMirror;
}
}
diff --git a/features/org.eclipse.jst.ws.jaxws.dom_tests.feature/feature.xml b/features/org.eclipse.jst.ws.jaxws.dom_tests.feature/feature.xml
index 2c32c85..c599612 100644
--- a/features/org.eclipse.jst.ws.jaxws.dom_tests.feature/feature.xml
+++ b/features/org.eclipse.jst.ws.jaxws.dom_tests.feature/feature.xml
@@ -2,7 +2,7 @@
<feature
id="org.eclipse.jst.ws.jaxws.dom_tests.feature"
label="%featureName"
- version="1.0.201.qualifier"
+ version="1.0.202.qualifier"
provider-name="%featureProvider"
image="eclipse_update_120.jpg"
license-feature="org.eclipse.license"
diff --git a/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/META-INF/MANIFEST.MF b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/META-INF/MANIFEST.MF
index 231dbe2..c627afb 100755
--- a/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/META-INF/MANIFEST.MF
+++ b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/META-INF/MANIFEST.MF
@@ -3,7 +3,7 @@
Bundle-Name: %Bundle-Name.0
Bundle-Vendor: %Bundle-Vendor.0
Bundle-SymbolicName: org.eclipse.jst.ws.jaxws.dom.runtime.tests;singleton:=true
-Bundle-Version: 1.0.200.qualifier
+Bundle-Version: 1.0.201.qualifier
Bundle-Localization: plugin
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Require-Bundle: org.eclipse.jst.ws.jaxws.testutils,
diff --git a/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/validation/EndpointIsSessionBeanRuleTest.java b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/validation/EndpointIsSessionBeanRuleTest.java
index 2b8cc90..660cf9d 100755
--- a/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/validation/EndpointIsSessionBeanRuleTest.java
+++ b/tests/org.eclipse.jst.ws.jaxws.dom.runtime.tests/src/org/eclipse/jst/ws/jaxws/dom/runtime/tests/dom/validation/EndpointIsSessionBeanRuleTest.java
@@ -108,7 +108,7 @@
markersExpectations.put(IMarker.CHAR_START, 46);
markersExpectations.put(IMarker.CHAR_END, 56);
markersExpectations.put(IMarker.LINE_NUMBER, 5);
- markersExpectations.put(IMarker.MESSAGE, JAXWSCoreMessages.WEBSERVICE_ONLY_ON_STATELESS_SESSION_BEANS);
+ markersExpectations.put(IMarker.MESSAGE, JAXWSCoreMessages.WEBSERVICE_ONLY_ON_STATELESS_OR_SINGLETON_SESSION_BEANS);
validateResourceMarkers(endpointType.getResource(), new MarkerData(endpointType.getResource(), VALIDATION_PROBLEM_MARKER_ID, markersExpectations));
}