[395842] JAX-WS Annotation Processor incorrectly flags a missing SEI
method
diff --git a/bundles/org.eclipse.jst.ws.cxf.creation.ui/.gitignore b/bundles/org.eclipse.jst.ws.cxf.creation.ui/.gitignore
new file mode 100644
index 0000000..7447f89
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.cxf.creation.ui/.gitignore
@@ -0,0 +1 @@
+/bin
\ No newline at end of file
diff --git a/bundles/org.eclipse.jst.ws.cxf.creation.ui/META-INF/MANIFEST.MF b/bundles/org.eclipse.jst.ws.cxf.creation.ui/META-INF/MANIFEST.MF
index fd974af..52c67da 100644
--- a/bundles/org.eclipse.jst.ws.cxf.creation.ui/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.jst.ws.cxf.creation.ui/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.jst.ws.cxf.creation.ui;singleton:=true
-Bundle-Version: 1.0.200.qualifier
+Bundle-Version: 1.0.201.qualifier
Bundle-ClassPath: .
Bundle-Activator: org.eclipse.jst.ws.internal.cxf.creation.ui.CXFCreationUIPlugin
Bundle-Vendor: %pluginProvider
diff --git a/bundles/org.eclipse.jst.ws.cxf.creation.ui/src/org/eclipse/jst/ws/internal/cxf/creation/ui/widgets/Java2WSClassConfigWidget.java b/bundles/org.eclipse.jst.ws.cxf.creation.ui/src/org/eclipse/jst/ws/internal/cxf/creation/ui/widgets/Java2WSClassConfigWidget.java
index 4821b33..d2c1e14 100644
--- a/bundles/org.eclipse.jst.ws.cxf.creation.ui/src/org/eclipse/jst/ws/internal/cxf/creation/ui/widgets/Java2WSClassConfigWidget.java
+++ b/bundles/org.eclipse.jst.ws.cxf.creation.ui/src/org/eclipse/jst/ws/internal/cxf/creation/ui/widgets/Java2WSClassConfigWidget.java
@@ -60,11 +60,10 @@
import org.eclipse.swt.widgets.TableItem;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.dialogs.ElementTreeSelectionDialog;
-import org.eclipse.wst.command.internal.env.ui.widgets.SimpleWidgetDataContributor;
import org.eclipse.wst.command.internal.env.ui.widgets.WidgetDataEvents;
@SuppressWarnings("restriction")
-public class Java2WSClassConfigWidget extends SimpleWidgetDataContributor {
+public class Java2WSClassConfigWidget extends Java2WSTypeConfigWidget {
private IStatus JAVA_TYPE_NAME_STATUS = Status.OK_STATUS;
private IStatus JAVA_TYPE_EXISTS_STATUS = Status.OK_STATUS;
private IStatus SEI_SELECTION_STATUS = Status.OK_STATUS;
@@ -419,8 +418,7 @@
try {
IMethod[] seiMethods = seiType.getMethods();
for (IMethod seiMethod : seiMethods) {
- IMethod[] implMethods = startingPointType.findMethods(seiMethod);
- if (implMethods == null) {
+ if (!isMethodImplemented(startingPointType, seiMethod)) {
SEI_SELECTION_STATUS = new Status(IStatus.ERROR, CXFCreationUIPlugin.PLUGIN_ID,
CXFCreationUIMessages.bind(CXFCreationUIMessages.WEBSERVICE_ENPOINTINTERFACE_MUST_IMPLEMENT,
getImplementsMessage(seiType, seiMethod)));
diff --git a/bundles/org.eclipse.jst.ws.cxf.creation.ui/src/org/eclipse/jst/ws/internal/cxf/creation/ui/widgets/Java2WSInterfaceConfigWidget.java b/bundles/org.eclipse.jst.ws.cxf.creation.ui/src/org/eclipse/jst/ws/internal/cxf/creation/ui/widgets/Java2WSInterfaceConfigWidget.java
index 020a4f9..ff5f5de 100644
--- a/bundles/org.eclipse.jst.ws.cxf.creation.ui/src/org/eclipse/jst/ws/internal/cxf/creation/ui/widgets/Java2WSInterfaceConfigWidget.java
+++ b/bundles/org.eclipse.jst.ws.cxf.creation.ui/src/org/eclipse/jst/ws/internal/cxf/creation/ui/widgets/Java2WSInterfaceConfigWidget.java
@@ -39,11 +39,10 @@
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.ui.dialogs.ElementTreeSelectionDialog;
-import org.eclipse.wst.command.internal.env.ui.widgets.SimpleWidgetDataContributor;
import org.eclipse.wst.command.internal.env.ui.widgets.WidgetDataEvents;
@SuppressWarnings("restriction")
-public class Java2WSInterfaceConfigWidget extends SimpleWidgetDataContributor {
+public class Java2WSInterfaceConfigWidget extends Java2WSTypeConfigWidget {
private IStatus IMPL_SELECTION_STATUS = Status.OK_STATUS;
private Java2WSDataModel model;
@@ -134,8 +133,7 @@
try {
IMethod[] seiMethods = startingPointType.getMethods();
for (IMethod seiMethod : seiMethods) {
- IMethod[] implMethod = implType.findMethods(seiMethod);
- if (implMethod == null) {
+ if (!isMethodImplemented(implType, seiMethod)) {
IMPL_SELECTION_STATUS = new Status(IStatus.ERROR, CXFCreationUIPlugin.PLUGIN_ID,
CXFCreationUIMessages.bind(CXFCreationUIMessages.WEBSERVICE_ENPOINTINTERFACE_MUST_IMPLEMENT,
getImplementsMessage(startingPointType, seiMethod)));
diff --git a/bundles/org.eclipse.jst.ws.cxf.creation.ui/src/org/eclipse/jst/ws/internal/cxf/creation/ui/widgets/Java2WSTypeConfigWidget.java b/bundles/org.eclipse.jst.ws.cxf.creation.ui/src/org/eclipse/jst/ws/internal/cxf/creation/ui/widgets/Java2WSTypeConfigWidget.java
new file mode 100644
index 0000000..e8406ee
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.cxf.creation.ui/src/org/eclipse/jst/ws/internal/cxf/creation/ui/widgets/Java2WSTypeConfigWidget.java
@@ -0,0 +1,27 @@
+package org.eclipse.jst.ws.internal.cxf.creation.ui.widgets;
+
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.ITypeHierarchy;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.wst.command.internal.env.ui.widgets.SimpleWidgetDataContributor;
+
+@SuppressWarnings("restriction")
+public class Java2WSTypeConfigWidget extends SimpleWidgetDataContributor {
+
+ protected boolean isMethodImplemented(IType type, IMethod seiMethod) throws JavaModelException {
+ if (type.findMethods(seiMethod) != null) {
+ return true;
+ } else {
+ ITypeHierarchy typeHierarchy = type.newTypeHierarchy(new NullProgressMonitor());
+ for (IType t : typeHierarchy.getAllSuperclasses(type)) {
+ if (t.findMethods(seiMethod) != null) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.core/.gitignore b/bundles/org.eclipse.jst.ws.jaxws.core/.gitignore
new file mode 100644
index 0000000..7447f89
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.jaxws.core/.gitignore
@@ -0,0 +1 @@
+/bin
\ No newline at end of file
diff --git a/bundles/org.eclipse.jst.ws.jaxws.core/META-INF/MANIFEST.MF b/bundles/org.eclipse.jst.ws.jaxws.core/META-INF/MANIFEST.MF
index 9d8036e..2eb7279 100644
--- a/bundles/org.eclipse.jst.ws.jaxws.core/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.jst.ws.jaxws.core/META-INF/MANIFEST.MF
@@ -3,7 +3,7 @@
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.jst.ws.jaxws.core;singleton:=true
Bundle-Vendor: %pluginProvider
-Bundle-Version: 1.0.200.qualifier
+Bundle-Version: 1.0.201.qualifier
Bundle-ClassPath: .
Bundle-Localization: plugin
Bundle-RequiredExecutionEnvironment: J2SE-1.5
diff --git a/bundles/org.eclipse.jst.ws.jaxws.core/src/org/eclipse/jst/ws/internal/jaxws/core/annotations/validation/WebServiceSEIRestrictionsRule.java b/bundles/org.eclipse.jst.ws.jaxws.core/src/org/eclipse/jst/ws/internal/jaxws/core/annotations/validation/WebServiceSEIRestrictionsRule.java
index 67ba4aa..ee68cc1 100644
--- a/bundles/org.eclipse.jst.ws.jaxws.core/src/org/eclipse/jst/ws/internal/jaxws/core/annotations/validation/WebServiceSEIRestrictionsRule.java
+++ b/bundles/org.eclipse.jst.ws.jaxws.core/src/org/eclipse/jst/ws/internal/jaxws/core/annotations/validation/WebServiceSEIRestrictionsRule.java
@@ -13,8 +13,10 @@
import static org.eclipse.jst.ws.internal.jaxws.core.utils.JAXWSUtils.ENDPOINT_INTERFACE;
import static org.eclipse.jst.ws.internal.jaxws.core.utils.JAXWSUtils.NAME;
+import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
+import java.util.List;
import javax.jws.Oneway;
import javax.jws.WebMethod;
@@ -39,6 +41,7 @@
import com.sun.mirror.declaration.Modifier;
import com.sun.mirror.declaration.ParameterDeclaration;
import com.sun.mirror.declaration.TypeDeclaration;
+import com.sun.mirror.type.ClassType;
public class WebServiceSEIRestrictionsRule extends AbstractAnnotationProcessor {
@@ -98,7 +101,7 @@
if (!classDeclaration.getSuperinterfaces().contains(typeDeclaration)) {
Collection<? extends MethodDeclaration> seiMethods = typeDeclaration.getMethods();
- Collection<? extends MethodDeclaration> implMethods = classDeclaration.getMethods();
+ Collection<? extends MethodDeclaration> implMethods = getAllMethods(classDeclaration);
for (MethodDeclaration seiMethod : seiMethods) {
boolean implemented = false;
@@ -138,6 +141,23 @@
}
}
+ private Collection<MethodDeclaration> getAllMethods(ClassDeclaration classDeclaration) {
+ List<MethodDeclaration> allMethods = new ArrayList<MethodDeclaration>();
+ collectAllMethodDeclarations(classDeclaration, allMethods);
+ return allMethods;
+ }
+
+ private void collectAllMethodDeclarations(ClassDeclaration classDeclaration, Collection<MethodDeclaration> methods) {
+ if (classDeclaration != null) {
+ methods.addAll(classDeclaration.getMethods());
+
+ ClassType classType = classDeclaration.getSuperclass();
+ if (classType != null && classType.getDeclaration() != null) {
+ collectAllMethodDeclarations(classType.getDeclaration(), methods);
+ }
+ }
+ }
+
private String getImplementsMessage(TypeDeclaration typeDeclaration, MethodDeclaration seiMethod) {
StringBuilder message = new StringBuilder(typeDeclaration.getSimpleName());
message.append("."); //$NON-NLS-1$