Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephan Herrmann2019-02-10 10:35:48 +0000
committerStephan Herrmann2019-02-10 11:55:02 +0000
commitc0a450d6d478972de7ffb4ec43ebd4a908dfbbbc (patch)
tree80dd404701bc1d95a1080558101d6d2ff7bf676b
parent18baae4ac007703438f2e33f74d619dae2cf177f (diff)
downloadeclipse.jdt.core-c0a450d6d478972de7ffb4ec43ebd4a908dfbbbc.tar.gz
eclipse.jdt.core-c0a450d6d478972de7ffb4ec43ebd4a908dfbbbc.tar.xz
eclipse.jdt.core-c0a450d6d478972de7ffb4ec43ebd4a908dfbbbc.zip
Bug 395051 - Access restriction on method invocation: error range tooI20190212-1800I20190211-1800I20190210-2135I20190210-1800
big Change-Id: I533f832054f79ee59b31e902bcfe466be62bf517 Signed-off-by: Stephan Herrmann <stephan.herrmann@berlin.de>
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java16
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/AccessRestrictionsTests.java42
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ASTNode.java6
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AllocationExpression.java10
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ExplicitConstructorCall.java4
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/JavadocAllocationExpression.java4
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/JavadocMessageSend.java4
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MessageSend.java12
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedAllocationExpression.java4
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ReferenceExpression.java4
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/InvocationSite.java4
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java10
-rw-r--r--org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetAllocationExpression.java4
-rw-r--r--org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetMessageSend.java4
14 files changed, 73 insertions, 55 deletions
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java
index ca1357961d..030401eee6 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2018 IBM Corporation and others.
+ * Copyright (c) 2000, 2019 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -2527,13 +2527,13 @@ public void test039(){
"----------\n" +
"4. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/src2/Y.java (at line 4)\n" +
" X<String> x2 = new X<String>();\n" +
- " ^^^^^^^^^^^^^^^\n" +
- "Discouraged access: The constructor \'X<String>()\' is not API (restriction on classpath entry \'---OUTPUT_DIR_PLACEHOLDER---/bin1\')\n" +
+ " ^\n" +
+ "Discouraged access: The type \'X<String>\' is not API (restriction on classpath entry \'---OUTPUT_DIR_PLACEHOLDER---/bin1\')\n" +
"----------\n" +
"5. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/src2/Y.java (at line 4)\n" +
" X<String> x2 = new X<String>();\n" +
" ^\n" +
- "Discouraged access: The type \'X<String>\' is not API (restriction on classpath entry \'---OUTPUT_DIR_PLACEHOLDER---/bin1\')\n" +
+ "Discouraged access: The constructor \'X<String>()\' is not API (restriction on classpath entry \'---OUTPUT_DIR_PLACEHOLDER---/bin1\')\n" +
"----------\n" +
"5 problems (5 warnings)\n",
false);
@@ -5331,17 +5331,17 @@ public void test148_access_restrictions(){
"----------\n" +
"2. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 5)\n" +
" ko = new KO();\n" +
- " ^^^^^^^^\n" +
- "Access restriction: The constructor \'KO()\' is not API (restriction on classpath entry \'---OUTPUT_DIR_PLACEHOLDER---\')\n" +
+ " ^^\n" +
+ "Access restriction: The type \'KO\' is not API (restriction on classpath entry \'---OUTPUT_DIR_PLACEHOLDER---\')\n" +
"----------\n" +
"3. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 5)\n" +
" ko = new KO();\n" +
" ^^\n" +
- "Access restriction: The type \'KO\' is not API (restriction on classpath entry \'---OUTPUT_DIR_PLACEHOLDER---\')\n" +
+ "Access restriction: The constructor \'KO()\' is not API (restriction on classpath entry \'---OUTPUT_DIR_PLACEHOLDER---\')\n" +
"----------\n" +
"4. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 6)\n" +
" ko.bar();\n" +
- " ^^^^^^^^\n" +
+ " ^^^\n" +
"Access restriction: The method \'KO.bar()\' is not API (restriction on classpath entry \'---OUTPUT_DIR_PLACEHOLDER---\')\n" +
"----------\n" +
"5. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 7)\n" +
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/AccessRestrictionsTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/AccessRestrictionsTests.java
index 59b37f6f23..994a526d58 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/AccessRestrictionsTests.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/AccessRestrictionsTests.java
@@ -167,7 +167,7 @@ public void test001() throws CoreException {
"----------\n" +
"1. ERROR in /P2/src/p/Y.java (at line 4)\n" +
" foo(); // accesses X1.foo, should trigger an error\n" +
- " ^^^^^\n" +
+ " ^^^\n" +
"Access restriction: The method \'X1.foo()\' is not API (restriction on required project \'P1\')\n" +
"----------\n"
);
@@ -352,7 +352,7 @@ public void test003() throws CoreException {
"----------\n" +
"3. ERROR in /P2/src/p/Y.java (at line 6)\n" +
" foo(); // error\n" +
- " ^^^^^\n" +
+ " ^^^\n" +
"Access restriction: The method \'X1.C1.foo()\' is not API (restriction on required project \'P1\')\n" +
"----------\n" +
"4. ERROR in /P2/src/p/Y.java (at line 11)\n" +
@@ -362,13 +362,13 @@ public void test003() throws CoreException {
"----------\n" +
"5. ERROR in /P2/src/p/Y.java (at line 12)\n" +
" new C1(0); // error\n" +
- " ^^^^^^^^^\n" +
- "Access restriction: The constructor \'X1.C1(int)\' is not API (restriction on required project \'P1\')\n" +
+ " ^^\n" +
+ "Access restriction: The type \'X1.C1\' is not API (restriction on required project \'P1\')\n" +
"----------\n" +
"6. ERROR in /P2/src/p/Y.java (at line 12)\n" +
" new C1(0); // error\n" +
" ^^\n" +
- "Access restriction: The type \'X1.C1\' is not API (restriction on required project \'P1\')\n" +
+ "Access restriction: The constructor \'X1.C1(int)\' is not API (restriction on required project \'P1\')\n" +
"----------\n"
);
} finally {
@@ -531,7 +531,7 @@ public void test005() throws CoreException {
"----------\n" +
"1. ERROR in /P2/src/r/Y.java (at line 4)\n" +
" (new q.X2()).foo(); // accesses p.X1#foo, should trigger an error\n" +
- " ^^^^^^^^^^^^^^^^^^\n" +
+ " ^^^\n" +
"Access restriction: The method \'X1.foo()\' is not API (restriction on required project \'P1\')\n" +
"----------\n"
);
@@ -617,13 +617,13 @@ public void test006() throws CoreException {
"----------\n" +
"3. ERROR in /P2/src/p/Y.java (at line 4)\n" +
" X<String> x2 = new X<String>();\n" +
- " ^^^^^^^^^^^^^^^\n" +
- "Access restriction: The constructor \'X<String>()\' is not API (restriction on required project \'P1\')\n" +
+ " ^\n" +
+ "Access restriction: The type \'X<String>\' is not API (restriction on required project \'P1\')\n" +
"----------\n" +
"4. ERROR in /P2/src/p/Y.java (at line 4)\n" +
" X<String> x2 = new X<String>();\n" +
" ^\n" +
- "Access restriction: The type \'X<String>\' is not API (restriction on required project \'P1\')\n" +
+ "Access restriction: The constructor \'X<String>()\' is not API (restriction on required project \'P1\')\n" +
"----------\n");
} finally {
if (x != null) {
@@ -709,13 +709,13 @@ public void test007() throws CoreException {
"----------\n" +
"3. ERROR in /P2/src/p/Y.java (at line 4)\n" +
" X<String> x2 = new X<String>(\"\");\n" +
- " ^^^^^^^^^^^^^^^^^\n" +
- "Access restriction: The constructor \'X<String>(String)\' is not API (restriction on required project \'P1\')\n" +
+ " ^\n" +
+ "Access restriction: The type \'X<String>\' is not API (restriction on required project \'P1\')\n" +
"----------\n" +
"4. ERROR in /P2/src/p/Y.java (at line 4)\n" +
" X<String> x2 = new X<String>(\"\");\n" +
" ^\n" +
- "Access restriction: The type \'X<String>\' is not API (restriction on required project \'P1\')\n" +
+ "Access restriction: The constructor \'X<String>(String)\' is not API (restriction on required project \'P1\')\n" +
"----------\n");
} finally {
if (x != null) {
@@ -800,7 +800,7 @@ public void test008() throws CoreException {
"----------\n" +
"1. ERROR in /P2/src/p/Y.java (at line 4)\n" +
" foo(); // accesses X1.foo, should trigger an error\n" +
- " ^^^^^\n" +
+ " ^^^\n" +
"Access restriction: The method \'X1.foo()\' is not API (restriction on required project \'P1\')\n" +
"----------\n"
);
@@ -996,7 +996,7 @@ public void test010() throws CoreException {
"----------\n" +
"3. ERROR in /P2/src/p/Y.java (at line 6)\n" +
" foo(); // error\n" +
- " ^^^^^\n" +
+ " ^^^\n" +
"Access restriction: The method \'X1.C1.foo()\' is not API (restriction on required project \'P1\')\n" +
"----------\n" +
"4. ERROR in /P2/src/p/Y.java (at line 11)\n" +
@@ -1006,13 +1006,13 @@ public void test010() throws CoreException {
"----------\n" +
"5. ERROR in /P2/src/p/Y.java (at line 12)\n" +
" new C1(0); // error\n" +
- " ^^^^^^^^^\n" +
- "Access restriction: The constructor \'X1.C1(int)\' is not API (restriction on required project \'P1\')\n" +
+ " ^^\n" +
+ "Access restriction: The type \'X1.C1\' is not API (restriction on required project \'P1\')\n" +
"----------\n" +
"6. ERROR in /P2/src/p/Y.java (at line 12)\n" +
" new C1(0); // error\n" +
" ^^\n" +
- "Access restriction: The type \'X1.C1\' is not API (restriction on required project \'P1\')\n" +
+ "Access restriction: The constructor \'X1.C1(int)\' is not API (restriction on required project \'P1\')\n" +
"----------\n"
);
} finally {
@@ -1070,17 +1070,17 @@ public void test011() throws CoreException {
"----------\n" +
"2. ERROR in /P1/src/q/Y.java (at line 4)\n" +
" p.X x = new p.X();\n" +
- " ^^^^^^^^^\n" +
- "Access restriction: The constructor \'X()\' is not API (restriction on required library \'AccessRestrictions/lib.jar\')\n" +
+ " ^^^\n" +
+ "Access restriction: The type \'X\' is not API (restriction on required library \'AccessRestrictions/lib.jar\')\n" +
"----------\n" +
"3. ERROR in /P1/src/q/Y.java (at line 4)\n" +
" p.X x = new p.X();\n" +
" ^^^\n" +
- "Access restriction: The type \'X\' is not API (restriction on required library \'AccessRestrictions/lib.jar\')\n" +
+ "Access restriction: The constructor \'X()\' is not API (restriction on required library \'AccessRestrictions/lib.jar\')\n" +
"----------\n" +
"4. ERROR in /P1/src/q/Y.java (at line 5)\n" +
" x.foo();\n" +
- " ^^^^^^^\n" +
+ " ^^^\n" +
"Access restriction: The method \'X.foo()\' is not API (restriction on required library \'AccessRestrictions/lib.jar\')\n" +
"----------\n" +
"5. ERROR in /P1/src/q/Y.java (at line 6)\n" +
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ASTNode.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ASTNode.java
index 50391b4520..78b31ccf23 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ASTNode.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ASTNode.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2018 IBM Corporation and others.
+ * Copyright (c) 2000, 2019 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -513,7 +513,7 @@ public abstract class ASTNode implements TypeConstants, TypeIds {
* An access in the same compilation unit is allowed.
*/
public final boolean isMethodUseDeprecated(MethodBinding method, Scope scope,
- boolean isExplicitUse) {
+ boolean isExplicitUse, InvocationSite invocation) {
// ignore references insing Javadoc comments
if ((this.bits & ASTNode.InsideJavadoc) == 0 && method.isOrEnclosedByPrivateType() && !scope.isDefinedInMethod(method)) {
// ignore cases where method is used from inside itself (e.g. direct recursions)
@@ -530,7 +530,7 @@ public abstract class ASTNode implements TypeConstants, TypeIds {
AccessRestriction restriction =
env.getAccessRestriction(method.declaringClass.erasure());
if (restriction != null) {
- scope.problemReporter().forbiddenReference(method, this,
+ scope.problemReporter().forbiddenReference(method, invocation,
restriction.classpathEntryType, restriction.classpathEntryName,
restriction.getProblemId());
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AllocationExpression.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AllocationExpression.java
index 7710fcfdee..d53c24f175 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AllocationExpression.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AllocationExpression.java
@@ -503,7 +503,7 @@ public TypeBinding resolveType(BlockScope scope) {
if ((this.binding.tagBits & TagBits.HasMissingType) != 0) {
scope.problemReporter().missingTypeInConstructor(this, this.binding);
}
- if (isMethodUseDeprecated(this.binding, scope, true)) {
+ if (isMethodUseDeprecated(this.binding, scope, true, this)) {
scope.problemReporter().deprecatedMethod(this.binding, this);
}
if (checkInvocationArguments(scope, null, this.resolvedType, this.binding, this.arguments, this.argumentTypes, this.argsContainCast, this)) {
@@ -809,4 +809,12 @@ public ExpressionContext getExpressionContext() {
public InferenceContext18 freshInferenceContext(Scope scope) {
return new InferenceContext18(scope, this.arguments, this, this.outerInferenceContext);
}
+@Override
+public int nameSourceStart() {
+ return this.type.sourceStart;
+}
+@Override
+public int nameSourceEnd() {
+ return this.type.sourceEnd;
+}
} \ No newline at end of file
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ExplicitConstructorCall.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ExplicitConstructorCall.java
index 0553640750..de4fc80b4d 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ExplicitConstructorCall.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ExplicitConstructorCall.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2018 IBM Corporation and others.
+ * Copyright (c) 2000, 2019 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -446,7 +446,7 @@ public class ExplicitConstructorCall extends Statement implements Invocation {
scope.problemReporter().missingTypeInConstructor(this, this.binding);
}
}
- if (isMethodUseDeprecated(this.binding, scope, this.accessMode != ExplicitConstructorCall.ImplicitSuper)) {
+ if (isMethodUseDeprecated(this.binding, scope, this.accessMode != ExplicitConstructorCall.ImplicitSuper, this)) {
scope.problemReporter().deprecatedMethod(this.binding, this);
}
if (checkInvocationArguments(scope, null, receiverType, this.binding, this.arguments, argumentTypes, argsContainCast, this)) {
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/JavadocAllocationExpression.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/JavadocAllocationExpression.java
index 7b69cf564b..d0c1c6d56a 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/JavadocAllocationExpression.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/JavadocAllocationExpression.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
+ * Copyright (c) 2000, 2019 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -144,7 +144,7 @@ public class JavadocAllocationExpression extends AllocationExpression {
}
}
}
- if (isMethodUseDeprecated(this.binding, scope, true)) {
+ if (isMethodUseDeprecated(this.binding, scope, true, this)) {
scope.problemReporter().javadocDeprecatedMethod(this.binding, this, scope.getDeclarationModifiers());
}
return allocationType;
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/JavadocMessageSend.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/JavadocMessageSend.java
index a1988de9bf..4fdc64dc71 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/JavadocMessageSend.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/JavadocMessageSend.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2012 IBM Corporation and others.
+ * Copyright (c) 2000, 2019 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -172,7 +172,7 @@ public class JavadocMessageSend extends MessageSend {
}
}
}
- if (isMethodUseDeprecated(this.binding, scope, true)) {
+ if (isMethodUseDeprecated(this.binding, scope, true, this)) {
scope.problemReporter().javadocDeprecatedMethod(this.binding, this, scope.getDeclarationModifiers());
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MessageSend.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MessageSend.java
index 2421cfb906..2e52f5a05e 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MessageSend.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MessageSend.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2018 IBM Corporation and others.
+ * Copyright (c) 2000, 2019 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -898,7 +898,7 @@ public TypeBinding resolveType(BlockScope scope) {
}
// abstract private methods cannot occur nor abstract static............
}
- if (isMethodUseDeprecated(this.binding, scope, true))
+ if (isMethodUseDeprecated(this.binding, scope, true, this))
scope.problemReporter().deprecatedMethod(this.binding, this);
TypeBinding returnType;
@@ -1171,4 +1171,12 @@ public InferenceContext18 freshInferenceContext(Scope scope) {
public boolean isQualifiedSuper() {
return this.receiver.isQualifiedSuper();
}
+@Override
+public int nameSourceStart() {
+ return (int) (this.nameSourcePosition >>> 32);
+}
+@Override
+public int nameSourceEnd() {
+ return (int) this.nameSourcePosition;
+}
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedAllocationExpression.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedAllocationExpression.java
index bed5d38c3f..bd4ba12a44 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedAllocationExpression.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedAllocationExpression.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2017 IBM Corporation and others.
+ * Copyright (c) 2000, 2019 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -561,7 +561,7 @@ public class QualifiedAllocationExpression extends AllocationExpression {
ReferenceBinding receiver = (ReferenceBinding) receiverType;
ReferenceBinding superType = receiver.isInterface() ? scope.getJavaLangObject() : receiver;
if (constructorBinding.isValidBinding()) {
- if (isMethodUseDeprecated(constructorBinding, scope, true)) {
+ if (isMethodUseDeprecated(constructorBinding, scope, true, this)) {
scope.problemReporter().deprecatedMethod(constructorBinding, this);
}
if (checkInvocationArguments(scope, null, superType, constructorBinding, this.arguments,
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ReferenceExpression.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ReferenceExpression.java
index c7e4eb8909..d6d044c7a5 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ReferenceExpression.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ReferenceExpression.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2018 IBM Corporation and others.
+ * Copyright (c) 2000, 2019 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -799,7 +799,7 @@ public class ReferenceExpression extends FunctionalExpression implements IPolyEx
srcMethod.bits &= ~ASTNode.CanBeStatic;
}
- if (isMethodUseDeprecated(this.binding, scope, true))
+ if (isMethodUseDeprecated(this.binding, scope, true, this))
scope.problemReporter().deprecatedMethod(this.binding, this);
if (this.typeArguments != null && this.binding.original().typeVariables == Binding.NO_TYPE_VARIABLES)
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/InvocationSite.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/InvocationSite.java
index 8513fed83b..aa57e1214e 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/InvocationSite.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/InvocationSite.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2014 IBM Corporation and others.
+ * Copyright (c) 2000, 2019 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -34,6 +34,8 @@ public interface InvocationSite {
void setFieldIndex(int depth);
int sourceEnd();
int sourceStart();
+ default int nameSourceStart() { return sourceStart(); }
+ default int nameSourceEnd() { return sourceEnd(); }
TypeBinding invocationTargetType();
boolean receiverIsImplicitThis();
boolean checkingPotentialCompatibility();
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java
index a4db767ee5..1a47e1d8c2 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java
@@ -2453,7 +2453,7 @@ public void forbiddenReference(FieldBinding field, ASTNode location,
}
/** @param classpathEntryType one of {@link AccessRestriction#COMMAND_LINE},
* {@link AccessRestriction#LIBRARY}, {@link AccessRestriction#PROJECT} */
-public void forbiddenReference(MethodBinding method, ASTNode location,
+public void forbiddenReference(MethodBinding method, InvocationSite location,
byte classpathEntryType, String classpathEntryName, int problemId) {
int severity = computeSeverity(problemId);
if (severity == ProblemSeverities.Ignore) return;
@@ -2466,8 +2466,8 @@ public void forbiddenReference(MethodBinding method, ASTNode location,
classpathEntryName,
new String(method.shortReadableName())},
severity,
- location.sourceStart,
- location.sourceEnd);
+ location.nameSourceStart(),
+ location.nameSourceEnd());
else
this.handle(
problemId,
@@ -2478,8 +2478,8 @@ public void forbiddenReference(MethodBinding method, ASTNode location,
new String(method.shortReadableName()),
new String(method.declaringClass.shortReadableName())},
severity,
- location.sourceStart,
- location.sourceEnd);
+ location.nameSourceStart(),
+ location.nameSourceEnd());
}
/** @param classpathEntryType one of {@link AccessRestriction#COMMAND_LINE},
* {@link AccessRestriction#LIBRARY}, {@link AccessRestriction#PROJECT} */
diff --git a/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetAllocationExpression.java b/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetAllocationExpression.java
index 2de2f1abcf..1536b4faf0 100644
--- a/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetAllocationExpression.java
+++ b/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetAllocationExpression.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2014 IBM Corporation and others.
+ * Copyright (c) 2000, 2019 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -279,7 +279,7 @@ public TypeBinding resolveType(BlockScope scope) {
return this.resolvedType;
}
}
- if (isMethodUseDeprecated(this.binding, scope, true)) {
+ if (isMethodUseDeprecated(this.binding, scope, true, this)) {
scope.problemReporter().deprecatedMethod(this.binding, this);
}
if (this.arguments != null) {
diff --git a/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetMessageSend.java b/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetMessageSend.java
index 98d1f8631c..9a00586b24 100644
--- a/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetMessageSend.java
+++ b/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetMessageSend.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2017 IBM Corporation and others.
+ * Copyright (c) 2000, 2019 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -337,7 +337,7 @@ public TypeBinding resolveType(BlockScope scope) {
}
// abstract private methods cannot occur nor abstract static............
}
- if (isMethodUseDeprecated(this.binding, scope, true))
+ if (isMethodUseDeprecated(this.binding, scope, true, this))
scope.problemReporter().deprecatedMethod(this.binding, this);
// from 1.5 compliance on, array#clone() returns the array type (but binding still shows Object)

Back to the top