Skip to content

Commit e3efcd5

Browse files
committed
Fix some qualification relevances
- split up the additions of the relevances to make it a bit easier to debug - enable "trim trailing whitespaces on save" in the javac fragment Signed-off-by: David Thompson <davthomp@redhat.com>
1 parent af87381 commit e3efcd5

3 files changed

Lines changed: 80 additions & 69 deletions

File tree

org.eclipse.jdt.core.javac/.settings/org.eclipse.jdt.ui.prefs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,13 @@ sp_cleanup.remove_private_constructors=true
8989
sp_cleanup.remove_redundant_modifiers=false
9090
sp_cleanup.remove_redundant_semicolons=false
9191
sp_cleanup.remove_redundant_type_arguments=false
92-
sp_cleanup.remove_trailing_whitespaces=false
92+
sp_cleanup.remove_trailing_whitespaces=true
9393
sp_cleanup.remove_trailing_whitespaces_all=true
9494
sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
9595
sp_cleanup.remove_unnecessary_array_creation=false
9696
sp_cleanup.remove_unnecessary_casts=true
9797
sp_cleanup.remove_unnecessary_nls_tags=false
98+
sp_cleanup.remove_unnecessary_suppress_warnings=false
9899
sp_cleanup.remove_unused_imports=false
99100
sp_cleanup.remove_unused_local_variables=false
100101
sp_cleanup.remove_unused_method_parameters=false
@@ -119,6 +120,7 @@ sp_cleanup.stringconcat_stringbuffer_stringbuilder=false
119120
sp_cleanup.stringconcat_to_textblock=false
120121
sp_cleanup.substring=false
121122
sp_cleanup.switch=false
123+
sp_cleanup.switch_for_instanceof_pattern=false
122124
sp_cleanup.system_property=false
123125
sp_cleanup.system_property_boolean=false
124126
sp_cleanup.system_property_file_encoding=false

org.eclipse.jdt.core.javac/src/org/eclipse/jdt/internal/codeassist/DOMCompletionEngine.java

Lines changed: 51 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -212,14 +212,14 @@ public class DOMCompletionEngine implements ICompletionEngine {
212212
private ASTNode toComplete;
213213
private String textContent;
214214
private ExtendsOrImplementsInfo extendsOrImplementsInfo;
215-
215+
216216
private Map<String, ITypeHierarchy> typeHierarchyCache = new HashMap<>();
217217

218218
class Bindings {
219219
// those need to be list since the order matters
220220
// fields must be before methods
221221
private List<IBinding> others = new ArrayList<>();
222-
222+
223223
private Set<IBinding> shadowed = new HashSet<>();
224224
private boolean alreadyScrapedAccessibleBindings = false;
225225
private boolean requestAccessibleBindings = false;
@@ -525,7 +525,7 @@ private Collection<? extends IBinding> visibleBindings(ASTNode node) {
525525
* @param falseBindings the bindings that are accessible when the expression is false
526526
*/
527527
record TrueFalseBindings(List<IVariableBinding> trueBindings, List<IVariableBinding> falseBindings) {}
528-
528+
529529
record TrueFalseCasts(List<ITypeBinding> trueCasts, List<ITypeBinding> falseCasts) {}
530530

531531
private TrueFalseBindings collectTrueFalseBindings(Expression e) {
@@ -554,7 +554,7 @@ private TrueFalseBindings collectTrueFalseBindings(Expression e) {
554554
return new TrueFalseBindings(typePatternBindings, Collections.emptyList());
555555
}
556556
}
557-
557+
558558
private static TrueFalseCasts collectTrueFalseCasts(Expression e, IVariableBinding castedBinding) {
559559
if (e instanceof PrefixExpression prefixExpression && prefixExpression.getOperator() == PrefixExpression.Operator.NOT) {
560560
TrueFalseCasts notBindings = collectTrueFalseCasts(prefixExpression.getOperand(), castedBinding);
@@ -902,14 +902,14 @@ public void complete(org.eclipse.jdt.internal.compiler.env.ICompilationUnit sour
902902
// ba|
903903
// }
904904
BodyDeclaration bodyDeclaration = (BodyDeclaration)simpleType.getParent();
905-
905+
906906
ITypeBinding typeDeclBinding;
907907
if (simpleType.getParent().getParent() instanceof AbstractTypeDeclaration typeDecl) {
908908
typeDeclBinding = typeDecl.resolveBinding();
909909
} else {
910910
typeDeclBinding = ((AnonymousClassDeclaration)simpleType.getParent().getParent()).resolveBinding();
911911
}
912-
912+
913913
if (!typeDeclBinding.isAnnotation()) {
914914
findOverridableMethods(typeDeclBinding, this.javaProject, context);
915915
}
@@ -1890,7 +1890,7 @@ public void complete(org.eclipse.jdt.internal.compiler.env.ICompilationUnit sour
18901890
}
18911891
}
18921892
if (context instanceof VariableDeclarationFragment vdf) {
1893-
if (this.toComplete.equals(vdf.getName())
1893+
if (this.toComplete.equals(vdf.getName())
18941894
|| this.toComplete.getLength() == 0 /* recovered */) {
18951895
ITypeBinding typeBinding = null;
18961896
if (vdf.getParent() instanceof VariableDeclarationStatement vds) {
@@ -2028,7 +2028,7 @@ public void complete(org.eclipse.jdt.internal.compiler.env.ICompilationUnit sour
20282028
afterBrokenImport = true;
20292029
}
20302030
}
2031-
2031+
20322032
if (!afterBrokenImport && startOffset <= this.offset) {
20332033
int existingModifiers = 0;
20342034
String[] potentialModifiers = this.textContent.substring(startOffset).split("\\s+");
@@ -2038,7 +2038,7 @@ public void complete(org.eclipse.jdt.internal.compiler.env.ICompilationUnit sour
20382038
existingModifiers |= potentialModifierKeyword.toFlagValue();
20392039
}
20402040
}
2041-
2041+
20422042
suggestModifierKeywords(existingModifiers);
20432043
suggestClassDeclarationLikeKeywords();
20442044
}
@@ -2210,7 +2210,7 @@ public void complete(org.eclipse.jdt.internal.compiler.env.ICompilationUnit sour
22102210
}
22112211
}
22122212
}
2213-
2213+
22142214
private void suggestClassDeclarationLikeKeywords() {
22152215
if (!this.isFailedMatch(this.prefix.toCharArray(), Keywords.CLASS)) {
22162216
this.requestor.accept(createKeywordProposal(Keywords.CLASS, -1, -1));
@@ -2344,13 +2344,13 @@ private void suggestVariableNamesForType(ITypeBinding typeBinding, Set<String> a
23442344
}
23452345

23462346
List<String> nameSegments = Stream.of(simpleName.split("(?=_)|(?<=_)")).flatMap(nameSegment -> Stream.of(nameSegment.split("(?<=[a-z0-9])(?=[A-Z])"))).filter(str -> !str.isEmpty()).toList();
2347-
2347+
23482348
if (nameSegments.isEmpty()) {
23492349
return;
23502350
}
2351-
2351+
23522352
List<String> variablePortionsOfName = new ArrayList<>();
2353-
2353+
23542354
for (int i = 0; i < nameSegments.size(); i++) {
23552355
if (nameSegments.get(i).equals("_")) {
23562356
continue;
@@ -2370,7 +2370,7 @@ private void suggestVariableNamesForType(ITypeBinding typeBinding, Set<String> a
23702370
}
23712371
variablePortionsOfName.add(variablePortionOfName.toString());
23722372
}
2373-
2373+
23742374
List<String> prefixes = new ArrayList<>();
23752375
List<String> suffixes = new ArrayList<>();
23762376
if (this.assistOptions.localPrefixes != null) {
@@ -2394,7 +2394,7 @@ private void suggestVariableNamesForType(ITypeBinding typeBinding, Set<String> a
23942394
if (this.prefix.length() < shortest) {
23952395
shortest = this.prefix.length();
23962396
}
2397-
2397+
23982398
if (localPrefix.substring(0, shortest).equals(this.prefix.substring(0, shortest))) {
23992399
int outerAdditionalRelevance = 0;
24002400
if (firstPrefix) {
@@ -2492,15 +2492,15 @@ private void suggestVariableNamesForType(ITypeBinding typeBinding, Set<String> a
24922492
if (!alreadySuggestedNames.contains(possibleName)) {
24932493
alreadySuggestedNames.add(possibleName);
24942494
CompletionProposal res = createProposal(CompletionProposal.VARIABLE_DECLARATION);
2495-
2495+
24962496
int additionalRelevance = additionalRelevances.getOrDefault(possibleName, 0);
24972497
if (SourceVersion.isKeyword(possibleName)) {
24982498
possibleName += "1";
24992499
}
2500-
2500+
25012501
res.setName(possibleName.toCharArray());
25022502
res.setCompletion(possibleName.toCharArray());
2503-
2503+
25042504
res.setRelevance(RelevanceConstants.R_DEFAULT
25052505
+ RelevanceConstants.R_INTERESTING
25062506
+ RelevanceUtils.computeRelevanceForCaseMatching(this.prefix.toCharArray(), possibleName.toCharArray(), this.assistOptions)
@@ -2512,10 +2512,10 @@ private void suggestVariableNamesForType(ITypeBinding typeBinding, Set<String> a
25122512
}
25132513
}
25142514
}
2515-
2515+
25162516
/**
25172517
* Returns the string with the first codepoint capitalized
2518-
*
2518+
*
25192519
* @param str the string to capitalize
25202520
* @return the string with the first codepoint capitalized
25212521
*/
@@ -2635,7 +2635,7 @@ private CompletionProposal toCastedReceiverProposal(IBinding castedBinding, ITyp
26352635
completion.append(template.getCompletion());
26362636

26372637
res.setCompletion(completion.toString().toCharArray());
2638-
2638+
26392639
// copy props from the template proposal
26402640
if (!castedType.isArray()) {
26412641
res.setDeclarationSignature(template.getDeclarationSignature());
@@ -3482,7 +3482,7 @@ private void completeConstructor(ITypeBinding typeBinding, ASTNode referencedFro
34823482

34833483
private void findOverridableMethods(ITypeBinding typeBinding, IJavaProject javaProject, ASTNode toReplace) {
34843484
String originalPackageKey = typeBinding.getPackage().getKey();
3485-
3485+
34863486
String currentPackageName = this.unit.getPackage() != null ? this.unit.getPackage().getName().toString() : "";
34873487
List<ITypeBinding> importedTypes = this.unit.imports().stream() //
34883488
.map(importDecl -> ((ImportDeclaration)importDecl).resolveBinding()) //
@@ -3534,7 +3534,7 @@ private void findOverridableMethods0(ITypeBinding currentType, ITypeBinding type
35343534
proposal.setDeclarationSignature(SignatureUtils.getSignatureChar(method.getDeclaringClass()));
35353535
proposal.setKey(method.getKey().toCharArray());
35363536
proposal.setSignature(SignatureUtils.getSignatureChar(method));
3537-
3537+
35383538
try {
35393539
if (method.getJavaElement() != null) {
35403540
proposal.setParameterNames(Stream.of(((IMethod)method.getJavaElement()).getParameterNames()).map(name -> name.toCharArray()).toArray(char[][]::new));
@@ -3842,7 +3842,7 @@ public void acceptTypeNameMatch(TypeNameMatch match) {
38423842
.map(t -> processMembers(t, searchEngine, scope))
38433843
.flatMap(Function.identity()));
38443844
}
3845-
3845+
38463846
private String getSignature(IMethodBinding method) {
38473847
return method.getName() + '(' +
38483848
Arrays.stream(method.getParameterTypes()).map(paramType -> paramType != null ? paramType.getName() : "Object").collect(Collectors.joining(","))
@@ -4105,25 +4105,21 @@ private CompletionProposal toProposal(IBinding binding, String completion) {
41054105
res.setDeclarationPackageName(element.getAncestor(IJavaElement.PACKAGE_FRAGMENT).getElementName().toCharArray());
41064106
}
41074107

4108-
boolean isInQualifiedName = Set.of(QualifiedName.NAME_PROPERTY,
4109-
FieldAccess.NAME_PROPERTY,
4110-
ExpressionMethodReference.NAME_PROPERTY,
4111-
TypeMethodReference.NAME_PROPERTY,
4112-
SuperMethodReference.NAME_PROPERTY).contains(this.toComplete.getLocationInParent());
4113-
res.setRelevance(RelevanceConstants.R_DEFAULT +
4114-
RelevanceConstants.R_RESOLVED +
4115-
RelevanceConstants.R_INTERESTING +
4116-
(res.isConstructor() ? 0 : RelevanceUtils.computeRelevanceForCaseMatching(this.prefix.toCharArray(), binding.getName().toCharArray(), this.assistOptions)) +
4117-
RelevanceUtils.computeRelevanceForExpectingType(binding instanceof ITypeBinding typeBinding ? typeBinding :
4108+
boolean isInQualifiedName = DOMCompletionUtil.isInQualifiedName(this.toComplete);
4109+
int relevance = RelevanceConstants.R_DEFAULT;
4110+
relevance += RelevanceConstants.R_RESOLVED;
4111+
relevance += RelevanceConstants.R_INTERESTING;
4112+
relevance += (res.isConstructor() ? 0 : RelevanceUtils.computeRelevanceForCaseMatching(this.prefix.toCharArray(), binding.getName().toCharArray(), this.assistOptions));
4113+
relevance += RelevanceUtils.computeRelevanceForExpectingType(binding instanceof ITypeBinding typeBinding ? typeBinding :
41184114
binding instanceof IMethodBinding methodBinding ? methodBinding.getReturnType() :
41194115
binding instanceof IVariableBinding variableBinding ? variableBinding.getType() :
4120-
this.toComplete.getAST().resolveWellKnownType(Object.class.getName()), this.expectedTypes) +
4121-
(isInQualifiedName || res.getRequiredProposals() != null || inJavadoc ? 0 : RelevanceUtils.computeRelevanceForQualification(new String(res.getCompletion()).indexOf('.') >= 0, this.prefix, this.qualifiedPrefix)) +
4122-
RelevanceConstants.R_NON_RESTRICTED +
4123-
RelevanceUtils.computeRelevanceForInheritance(this.qualifyingType, binding) +
4124-
((insideQualifiedReference() && !staticOnly() && !Modifier.isStatic(binding.getModifiers())) || (inJavadoc && !res.isConstructor()) ? RelevanceConstants.R_NON_STATIC : 0) +
4125-
(binding instanceof IVariableBinding field && field.isEnumConstant() ? RelevanceConstants.R_ENUM + RelevanceConstants.R_ENUM_CONSTANT : 0)
4126-
);
4116+
this.toComplete.getAST().resolveWellKnownType(Object.class.getName()), this.expectedTypes);
4117+
relevance += (isInQualifiedName || res.getRequiredProposals() != null || inJavadoc ? 0 : RelevanceUtils.computeRelevanceForQualification(new String(res.getCompletion()).indexOf('.') >= 0, this.prefix, this.qualifiedPrefix));
4118+
relevance += RelevanceConstants.R_NON_RESTRICTED;
4119+
relevance += RelevanceUtils.computeRelevanceForInheritance(this.qualifyingType, binding);
4120+
relevance += ((isInQualifiedName && !staticOnly() && !Modifier.isStatic(binding.getModifiers())) || (inJavadoc && !res.isConstructor()) ? RelevanceConstants.R_NON_STATIC : 0) +
4121+
(binding instanceof IVariableBinding field && field.isEnumConstant() ? RelevanceConstants.R_ENUM + RelevanceConstants.R_ENUM_CONSTANT : 0);
4122+
res.setRelevance(relevance);
41274123
if (res.getRequiredProposals() != null) {
41284124
for (CompletionProposal req : res.getRequiredProposals()) {
41294125
req.setRelevance(res.getRelevance());
@@ -4139,14 +4135,6 @@ private boolean isStaticallyImported(IBinding binding) {
41394135
.anyMatch(importBinding -> binding.isEqualTo(importBinding) || getDeclaringClass(binding).isEqualTo(importBinding));
41404136
}
41414137

4142-
private boolean insideQualifiedReference() {
4143-
return this.toComplete instanceof QualifiedName ||
4144-
(this.toComplete instanceof SimpleName simple && (simple.getParent() instanceof QualifiedName || simple.getParent() instanceof FieldAccess)) ||
4145-
Set.of(ExpressionMethodReference.NAME_PROPERTY,
4146-
TypeMethodReference.NAME_PROPERTY,
4147-
SuperMethodReference.NAME_PROPERTY).contains(this.toComplete.getLocationInParent());
4148-
}
4149-
41504138
private boolean staticOnly() {
41514139
if (this.toComplete.getLocationInParent() == QualifiedName.NAME_PROPERTY) {
41524140
return DOMCodeSelector.resolveBinding(((QualifiedName)this.toComplete.getParent()).getQualifier()) instanceof ITypeBinding;
@@ -4269,17 +4257,17 @@ private CompletionProposal toProposal(IType type, int access, int modifiers) {
42694257
inSamePackage = type.getPackageFragment().getElementName().isEmpty();
42704258
}
42714259
boolean inCatchClause = DOMCompletionUtil.findParent(this.toComplete, new int[] { ASTNode.CATCH_CLAUSE }) != null;
4272-
int relevance = RelevanceConstants.R_DEFAULT
4273-
+ RelevanceConstants.R_RESOLVED
4274-
+ RelevanceUtils.computeRelevanceForInteresting(type, expectedTypes)
4275-
+ RelevanceUtils.computeRelevanceForRestrictions(access, this.settings)
4276-
+ (inCatchClause && DOMCompletionUtil.findInSupers(type, "Ljava/lang/Exception;", this.workingCopyOwner, this.typeHierarchyCache) ? RelevanceConstants.R_EXCEPTION : 0)
4277-
+ RelevanceUtils.computeRelevanceForInheritance(this.qualifyingType, type)
4278-
+ RelevanceUtils.computeRelevanceForQualification(!"java.lang".equals(type.getPackageFragment().getElementName()) && !nodeInImports && !fromCurrentCU && !inSamePackage && !typeIsImported, this.prefix, this.qualifiedPrefix)
4279-
+ (type.getFullyQualifiedName().startsWith("java.") ? RelevanceConstants.R_JAVA_LIBRARY : 0)
4280-
// sometimes subclasses and superclasses are considered, sometimes they aren't
4281-
+ (inCatchClause ? RelevanceUtils.computeRelevanceForExpectingType(type, expectedTypes, this.workingCopyOwner, this.typeHierarchyCache) : RelevanceUtils.simpleComputeRelevanceForExpectingType(type, expectedTypes))
4282-
+ RelevanceUtils.computeRelevanceForCaseMatching(this.prefix.toCharArray(), simpleName, this.assistOptions);
4260+
int relevance = RelevanceConstants.R_DEFAULT;
4261+
relevance += RelevanceConstants.R_RESOLVED;
4262+
relevance += RelevanceUtils.computeRelevanceForInteresting(type, expectedTypes);
4263+
relevance += RelevanceUtils.computeRelevanceForRestrictions(access, this.settings);
4264+
relevance += (inCatchClause && DOMCompletionUtil.findInSupers(type, "Ljava/lang/Exception;", this.workingCopyOwner, this.typeHierarchyCache) ? RelevanceConstants.R_EXCEPTION : 0);
4265+
relevance += RelevanceUtils.computeRelevanceForInheritance(this.qualifyingType, type);
4266+
relevance += RelevanceUtils.computeRelevanceForQualification(!"java.lang".equals(type.getPackageFragment().getElementName()) && !nodeInImports && !fromCurrentCU && !inSamePackage && !typeIsImported, this.prefix, this.qualifiedPrefix);
4267+
relevance += (type.getFullyQualifiedName().startsWith("java.") ? RelevanceConstants.R_JAVA_LIBRARY : 0);
4268+
// sometimes subclasses and superclasses are considered, sometimes they aren't
4269+
relevance += (inCatchClause ? RelevanceUtils.computeRelevanceForExpectingType(type, expectedTypes, this.workingCopyOwner, this.typeHierarchyCache) : RelevanceUtils.simpleComputeRelevanceForExpectingType(type, expectedTypes));
4270+
relevance += RelevanceUtils.computeRelevanceForCaseMatching(this.prefix.toCharArray(), simpleName, this.assistOptions);
42834271
try {
42844272
if (type.isAnnotation()) {
42854273
ASTNode current = this.toComplete;
@@ -4375,7 +4363,7 @@ private CompletionProposal toProposal(IJavaElement element) {
43754363
}
43764364
res.setCompletion(field.getElementName().toCharArray());
43774365
setRange(res);
4378-
res.setRelevance(RelevanceConstants.R_DEFAULT +
4366+
res.setRelevance(RelevanceConstants.R_DEFAULT +
43794367
RelevanceConstants.R_RESOLVED +
43804368
RelevanceConstants.R_INTERESTING +
43814369
RelevanceConstants.R_CASE +
@@ -5146,7 +5134,7 @@ private void setRange(CompletionProposal completionProposal) {
51465134
completionProposal.setReplaceRange(startPos, cursor);
51475135
completionProposal.setTokenRange(startPos, cursor);
51485136
}
5149-
5137+
51505138
/**
51515139
* Sets the token range of the completion based on the contents of the buffer.
51525140
*
@@ -5269,5 +5257,5 @@ private ITypeBinding currentTypeBinding() {
52695257
}
52705258
return _currentTypeBinding;
52715259
}
5272-
5260+
52735261
}

org.eclipse.jdt.core.javac/src/org/eclipse/jdt/internal/codeassist/DOMCompletionUtil.java

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,12 @@
2727
import org.eclipse.jdt.core.dom.ASTNode;
2828
import org.eclipse.jdt.core.dom.ASTVisitor;
2929
import org.eclipse.jdt.core.dom.AbstractTypeDeclaration;
30+
import org.eclipse.jdt.core.dom.ExpressionMethodReference;
31+
import org.eclipse.jdt.core.dom.FieldAccess;
3032
import org.eclipse.jdt.core.dom.ITypeBinding;
33+
import org.eclipse.jdt.core.dom.QualifiedName;
34+
import org.eclipse.jdt.core.dom.SuperMethodReference;
35+
import org.eclipse.jdt.core.dom.TypeMethodReference;
3136
import org.eclipse.jdt.core.dom.Modifier.ModifierKeyword;
3237

3338
public class DOMCompletionUtil {
@@ -100,10 +105,10 @@ public static AbstractTypeDeclaration findParentTypeDeclaration(ASTNode nodeToSe
100105
public static boolean isJavaFieldOrMethodModifier(String potentialModifer) {
101106
return JAVA_MODIFIERS.contains(potentialModifer);
102107
}
103-
108+
104109
/**
105110
* Returns true if toFind is a superclass of root.
106-
*
111+
*
107112
* @param root the class to begin searching in
108113
* @param toFind the class to find
109114
* @return true if toFind is a superclass of root
@@ -119,7 +124,7 @@ public static boolean findInSupers(ITypeBinding root, ITypeBinding toFind) {
119124

120125
/**
121126
* Returns true if the type indicated by keyOfTypeToFind is a superclass of root.
122-
*
127+
*
123128
* @param root the class to begin searching in
124129
* @param keyOfTypeToFind the key of the class to find
125130
* @return true if the type indicated by keyOfTypeToFind is a superclass of root
@@ -154,7 +159,7 @@ public static boolean findInSupers(ITypeBinding root, String keyOfTypeToFind) {
154159

155160
/**
156161
* Returns true if the type indicated by keyOfTypeToFind is a superclass of root.
157-
*
162+
*
158163
* @param root the class to begin searching in
159164
* @param keyOfTypeToFind the key of the class to find
160165
* @param workignCopyOwner the working copy owner
@@ -177,7 +182,7 @@ public static boolean findInSupers(IType root, String keyOfTypeToFind, WorkingCo
177182
hierarchy = typeToFind.newTypeHierarchy(root.getJavaProject(), workingCopyOwner, new NullProgressMonitor());
178183
hierarchyCache.put(keyOfTypeToFind, hierarchy);
179184
}
180-
185+
181186
for (IType subType : hierarchy.getAllSubtypes(typeToFind)) {
182187
if (subType.getKey().equals(root.getKey())) {
183188
return true;
@@ -190,4 +195,20 @@ public static boolean findInSupers(IType root, String keyOfTypeToFind, WorkingCo
190195
}
191196
}
192197

198+
/**
199+
* Returns true if the given node is in a qualified name and false otherwise.
200+
*
201+
* @return true if the given node is in a qualified name and false otherwise
202+
*/
203+
public static boolean isInQualifiedName(ASTNode node) {
204+
return Set.of(QualifiedName.NAME_PROPERTY,
205+
FieldAccess.NAME_PROPERTY,
206+
ExpressionMethodReference.NAME_PROPERTY,
207+
TypeMethodReference.NAME_PROPERTY,
208+
SuperMethodReference.NAME_PROPERTY).contains(node.getLocationInParent())
209+
|| node instanceof FieldAccess
210+
|| node instanceof SuperMethodReference
211+
|| node instanceof TypeMethodReference;
212+
}
213+
193214
}

0 commit comments

Comments
 (0)