Lines 11-16
Link Here
|
11 |
package org.eclipse.jdt.internal.compiler.ast; |
11 |
package org.eclipse.jdt.internal.compiler.ast; |
12 |
|
12 |
|
13 |
import org.eclipse.jdt.internal.compiler.ASTVisitor; |
13 |
import org.eclipse.jdt.internal.compiler.ASTVisitor; |
|
|
14 |
import org.eclipse.jdt.internal.compiler.env.AccessRestriction; |
14 |
import org.eclipse.jdt.internal.compiler.impl.Constant; |
15 |
import org.eclipse.jdt.internal.compiler.impl.Constant; |
15 |
import org.eclipse.jdt.internal.compiler.lookup.*; |
16 |
import org.eclipse.jdt.internal.compiler.lookup.*; |
16 |
|
17 |
|
Lines 95-101
Link Here
|
95 |
} |
96 |
} |
96 |
this.binding = (FieldBinding) fieldBinding; |
97 |
this.binding = (FieldBinding) fieldBinding; |
97 |
|
98 |
|
98 |
if (isFieldUseDeprecated(this.binding, scope, (this.bits & IsStrictlyAssigned) != 0)) { |
99 |
if (fieldCanBeUsedAsReference(this.binding, scope, (this.bits & IsStrictlyAssigned) != 0)) { |
99 |
scope.problemReporter().javadocDeprecatedField(this.binding, this, scope.getDeclarationModifiers()); |
100 |
scope.problemReporter().javadocDeprecatedField(this.binding, this, scope.getDeclarationModifiers()); |
100 |
} |
101 |
} |
101 |
return this.resolvedType = this.binding.type; |
102 |
return this.resolvedType = this.binding.type; |
Lines 144-147
Link Here
|
144 |
} |
145 |
} |
145 |
visitor.endVisit(this, scope); |
146 |
visitor.endVisit(this, scope); |
146 |
} |
147 |
} |
|
|
148 |
/* |
149 |
* @ASTNode#isFieldUseDeprecated(FieldBinding, Scope, boolean) |
150 |
* Do not modify field modifiers when searching for reference in Javadoc |
151 |
*/ |
152 |
public final boolean fieldCanBeUsedAsReference(FieldBinding field, Scope scope, boolean isStrictlyAssigned) { |
153 |
|
154 |
if ((field.modifiers & ExtraCompilerModifiers.AccRestrictedAccess) != 0) { |
155 |
AccessRestriction restriction = |
156 |
scope.environment().getAccessRestriction(field.declaringClass.erasure()); |
157 |
if (restriction != null) { |
158 |
scope.problemReporter().forbiddenReference(field, this, |
159 |
restriction.getFieldAccessMessageTemplate(), restriction.getProblemId()); |
160 |
} |
161 |
} |
162 |
|
163 |
if (!field.isViewedAsDeprecated()) return false; |
164 |
|
165 |
// inside same unit - no report |
166 |
if (scope.isDefinedInSameUnit(field.declaringClass)) return false; |
167 |
|
168 |
// if context is deprecated, may avoid reporting |
169 |
if (!scope.compilerOptions().reportDeprecationInsideDeprecatedCode && scope.isInsideDeprecatedCode()) return false; |
170 |
return true; |
171 |
} |
147 |
} |
172 |
} |