Bug 560579: Deprecated modules should deprecate all methods and fields
detect deprecations correctly for script deprecation warning
Change-Id: I7d58c37dabcfa8a53f8ebad3865c8e4a3bf3711c
diff --git a/plugins/org.eclipse.ease.ui/src/org/eclipse/ease/ui/modules/ui/ModulesLabelProvider.java b/plugins/org.eclipse.ease.ui/src/org/eclipse/ease/ui/modules/ui/ModulesLabelProvider.java
index 7e86166..2d6da3b 100644
--- a/plugins/org.eclipse.ease.ui/src/org/eclipse/ease/ui/modules/ui/ModulesLabelProvider.java
+++ b/plugins/org.eclipse.ease.ui/src/org/eclipse/ease/ui/modules/ui/ModulesLabelProvider.java
@@ -102,12 +102,9 @@
if (element instanceof ModuleDefinition)
return ((ModuleDefinition) element).isDeprecated();
- if (element instanceof Method)
+ if (element instanceof AccessibleObject)
return ModuleHelper.isDeprecated((AccessibleObject) element) || (((Method) element).getDeclaringClass().getAnnotation(Deprecated.class) != null);
- if (element instanceof Field)
- return ModuleHelper.isDeprecated((AccessibleObject) element) || (((Field) element).getDeclaringClass().getAnnotation(Deprecated.class) != null);
-
return false;
}
diff --git a/plugins/org.eclipse.ease/src/org/eclipse/ease/modules/ModuleHelper.java b/plugins/org.eclipse.ease/src/org/eclipse/ease/modules/ModuleHelper.java
index 46ac159..7b45af5 100644
--- a/plugins/org.eclipse.ease/src/org/eclipse/ease/modules/ModuleHelper.java
+++ b/plugins/org.eclipse.ease/src/org/eclipse/ease/modules/ModuleHelper.java
@@ -246,6 +246,12 @@
* @return <code>true</code> when deprecated
*/
public static boolean isDeprecated(final AccessibleObject element) {
+ if (element instanceof Method)
+ return (element.getAnnotation(Deprecated.class) != null) || (((Method) element).getDeclaringClass().getAnnotation(Deprecated.class) != null);
+
+ if (element instanceof Field)
+ return (element.getAnnotation(Deprecated.class) != null) || (((Field) element).getDeclaringClass().getAnnotation(Deprecated.class) != null);
+
return element.getAnnotation(Deprecated.class) != null;
}
}