aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzzhongwei2013-01-31 03:54:55 (EST)
committerzzhongwei2013-01-31 03:54:55 (EST)
commitf8a628650b1fdbda79043613c6cc08b26cd031f7 (patch)
treecab629e288933c807d5fa729b80d389b73a74ccf
parent0796f66102604af1df3317cbfb26b2651ea9c6b8 (diff)
downloadorg.eclipse.pdt-f8a628650b1fdbda79043613c6cc08b26cd031f7.zip
org.eclipse.pdt-f8a628650b1fdbda79043613c6cc08b26cd031f7.tar.gz
org.eclipse.pdt-f8a628650b1fdbda79043613c6cc08b26cd031f7.tar.bz2
357919: Making function deprecated will also affect other functions with
the same name https://bugs.eclipse.org/bugs/show_bug.cgi?id=357919
-rw-r--r--plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/editor/highlighter/ModelUtils.java17
-rw-r--r--plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/editor/highlighters/DeprecatedHighlighting.java9
2 files changed, 25 insertions, 1 deletions
diff --git a/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/editor/highlighter/ModelUtils.java b/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/editor/highlighter/ModelUtils.java
index 610601e..e744455 100644
--- a/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/editor/highlighter/ModelUtils.java
+++ b/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/editor/highlighter/ModelUtils.java
@@ -64,6 +64,23 @@ public abstract class ModelUtils {
return null;
}
+ static public IMethod getMethod(StaticMethodInvocation methodInvocation) {
+ ITypeBinding type = methodInvocation.getClassName()
+ .resolveTypeBinding();
+ String methodName = getFunctionName(methodInvocation.getMethod()
+ .getFunctionName());
+ if (type != null && methodName != null) {
+ IMethodBinding[] methods = type.getDeclaredMethods();
+ for (IMethodBinding method : methods) {
+ if (method.getName().toLowerCase()
+ .equals(methodName.toLowerCase())) {
+ return (IMethod) method.getPHPElement();
+ }
+ }
+ }
+ return null;
+ }
+
static public IMethod getMethod(MethodDeclaration methodDeclaration) {
IMethodBinding methodBinding = methodDeclaration.resolveMethodBinding();
if (methodBinding == null) {
diff --git a/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/editor/highlighters/DeprecatedHighlighting.java b/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/editor/highlighters/DeprecatedHighlighting.java
index b21c98a..f4a06df 100644
--- a/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/editor/highlighters/DeprecatedHighlighting.java
+++ b/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/editor/highlighters/DeprecatedHighlighting.java
@@ -86,7 +86,14 @@ public class DeprecatedHighlighting extends AbstractSemanticHighlighting {
}
public boolean visit(FunctionInvocation funcInv) {
- if (!(funcInv.getParent() instanceof MethodInvocation)) {
+ if ((funcInv.getParent() instanceof StaticMethodInvocation)) {
+ StaticMethodInvocation methodInvocation = (StaticMethodInvocation) funcInv
+ .getParent();
+ IMethod method = ModelUtils.getMethod(methodInvocation);
+ if (method != null && ModelUtils.isDeprecated(method)) {
+ highlight(methodInvocation.getMethod().getFunctionName());
+ }
+ } else if (!(funcInv.getParent() instanceof MethodInvocation)) {
IModelAccessCache cache = funcInv.getAST().getBindingResolver()
.getModelAccessCache();
if (cache != null) {