Lines 520-525
Link Here
|
520 |
boolean assistNodeIsConstructor; |
520 |
boolean assistNodeIsConstructor; |
521 |
boolean assistNodeIsSuperType; |
521 |
boolean assistNodeIsSuperType; |
522 |
boolean assistNodeIsExtendedType; |
522 |
boolean assistNodeIsExtendedType; |
|
|
523 |
boolean assistNodeIsInterfaceExcludingAnnotation; // https://bugs.eclipse.org/bugs/show_bug.cgi?id=310423 |
523 |
int assistNodeInJavadoc = 0; |
524 |
int assistNodeInJavadoc = 0; |
524 |
boolean assistNodeCanBeSingleMemberAnnotation = false; |
525 |
boolean assistNodeCanBeSingleMemberAnnotation = false; |
525 |
|
526 |
|
Lines 2780-2785
Link Here
|
2780 |
this.assistNodeIsInterface = ref.isInterface(); |
2781 |
this.assistNodeIsInterface = ref.isInterface(); |
2781 |
this.assistNodeIsSuperType = ref.isSuperType(); |
2782 |
this.assistNodeIsSuperType = ref.isSuperType(); |
2782 |
this.assistNodeIsExtendedType = assistNodeIsExtendedType(astNode, astNodeParent); |
2783 |
this.assistNodeIsExtendedType = assistNodeIsExtendedType(astNode, astNodeParent); |
|
|
2784 |
this.assistNodeIsInterfaceExcludingAnnotation = assistNodeIsInterfaceExcludingAnnotation(astNode, astNodeParent); |
2783 |
|
2785 |
|
2784 |
this.completionToken = ref.completionIdentifier; |
2786 |
this.completionToken = ref.completionIdentifier; |
2785 |
long completionPosition = ref.sourcePositions[ref.tokens.length]; |
2787 |
long completionPosition = ref.sourcePositions[ref.tokens.length]; |
Lines 2842-2847
Link Here
|
2842 |
return false; |
2844 |
return false; |
2843 |
} |
2845 |
} |
2844 |
|
2846 |
|
|
|
2847 |
private boolean assistNodeIsInterfaceExcludingAnnotation(ASTNode astNode, ASTNode astNodeParent) { |
2848 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=310423, don't propose annotations for implements. |
2849 |
if (astNodeParent == null) |
2850 |
return false; |
2851 |
if (astNodeParent instanceof TypeDeclaration) { |
2852 |
TypeDeclaration typeDeclaration = (TypeDeclaration) astNodeParent; |
2853 |
TypeReference [] superInterfaces = typeDeclaration.superInterfaces; |
2854 |
int length = superInterfaces == null ? 0 : superInterfaces.length; |
2855 |
for (int i = 0; i < length; i++) { |
2856 |
if (superInterfaces[i] == astNode) |
2857 |
return true; |
2858 |
} |
2859 |
} |
2860 |
return false; |
2861 |
} |
2862 |
|
2845 |
private void completionOnQualifiedAllocationExpression(ASTNode astNode, Binding qualifiedBinding, Scope scope) { |
2863 |
private void completionOnQualifiedAllocationExpression(ASTNode astNode, Binding qualifiedBinding, Scope scope) { |
2846 |
setSourceAndTokenRange(astNode.sourceStart, astNode.sourceEnd, false); |
2864 |
setSourceAndTokenRange(astNode.sourceStart, astNode.sourceEnd, false); |
2847 |
|
2865 |
|
Lines 3041-3046
Link Here
|
3041 |
this.assistNodeIsConstructor = ref.isConstructorType; |
3059 |
this.assistNodeIsConstructor = ref.isConstructorType; |
3042 |
this.assistNodeIsSuperType = ref.isSuperType(); |
3060 |
this.assistNodeIsSuperType = ref.isSuperType(); |
3043 |
this.assistNodeIsExtendedType = assistNodeIsExtendedType(astNode, astNodeParent); |
3061 |
this.assistNodeIsExtendedType = assistNodeIsExtendedType(astNode, astNodeParent); |
|
|
3062 |
this.assistNodeIsInterfaceExcludingAnnotation = assistNodeIsInterfaceExcludingAnnotation(astNode, astNodeParent); |
3044 |
|
3063 |
|
3045 |
this.completionToken = ref.completionIdentifier; |
3064 |
this.completionToken = ref.completionIdentifier; |
3046 |
long completionPosition = ref.sourcePositions[ref.tokens.length]; |
3065 |
long completionPosition = ref.sourcePositions[ref.tokens.length]; |
Lines 3175-3180
Link Here
|
3175 |
this.assistNodeIsConstructor = singleRef.isConstructorType; |
3194 |
this.assistNodeIsConstructor = singleRef.isConstructorType; |
3176 |
this.assistNodeIsSuperType = singleRef.isSuperType(); |
3195 |
this.assistNodeIsSuperType = singleRef.isSuperType(); |
3177 |
this.assistNodeIsExtendedType = assistNodeIsExtendedType(astNode, astNodeParent); |
3196 |
this.assistNodeIsExtendedType = assistNodeIsExtendedType(astNode, astNodeParent); |
|
|
3197 |
this.assistNodeIsInterfaceExcludingAnnotation = assistNodeIsInterfaceExcludingAnnotation(astNode, astNodeParent); |
3178 |
|
3198 |
|
3179 |
// can be the start of a qualified type name |
3199 |
// can be the start of a qualified type name |
3180 |
if (qualifiedBinding == null) { |
3200 |
if (qualifiedBinding == null) { |
Lines 9291-9296
Link Here
|
9291 |
typesFound.add(memberType); |
9311 |
typesFound.add(memberType); |
9292 |
|
9312 |
|
9293 |
if (this.assistNodeIsExtendedType && memberType.isFinal()) continue next; |
9313 |
if (this.assistNodeIsExtendedType && memberType.isFinal()) continue next; |
|
|
9314 |
if (this.assistNodeIsInterfaceExcludingAnnotation && memberType.isAnnotationType()) continue next; |
9294 |
if(!this.insideQualifiedReference) { |
9315 |
if(!this.insideQualifiedReference) { |
9295 |
if(this.assistNodeIsClass) { |
9316 |
if(this.assistNodeIsClass) { |
9296 |
if(!memberType.isClass()) continue next; |
9317 |
if(!memberType.isClass()) continue next; |
Lines 9779-9784
Link Here
|
9779 |
} |
9800 |
} |
9780 |
|
9801 |
|
9781 |
if (this.assistNodeIsExtendedType && localType.isFinal()) continue next; |
9802 |
if (this.assistNodeIsExtendedType && localType.isFinal()) continue next; |
|
|
9803 |
if (this.assistNodeIsInterfaceExcludingAnnotation && localType.isAnnotationType()) continue next; |
9782 |
if(this.assistNodeIsClass) { |
9804 |
if(this.assistNodeIsClass) { |
9783 |
if(!localType.isClass()) continue next; |
9805 |
if(!localType.isClass()) continue next; |
9784 |
} else if(this.assistNodeIsInterface) { |
9806 |
} else if(this.assistNodeIsInterface) { |
Lines 10160-10165
Link Here
|
10160 |
typesFound.add(sourceType); |
10182 |
typesFound.add(sourceType); |
10161 |
|
10183 |
|
10162 |
if (this.assistNodeIsExtendedType && sourceType.isFinal()) continue next; |
10184 |
if (this.assistNodeIsExtendedType && sourceType.isFinal()) continue next; |
|
|
10185 |
if (this.assistNodeIsInterfaceExcludingAnnotation && sourceType.isAnnotationType()) continue next; |
10163 |
if(this.assistNodeIsClass) { |
10186 |
if(this.assistNodeIsClass) { |
10164 |
if(!sourceType.isClass()) continue next; |
10187 |
if(!sourceType.isClass()) continue next; |
10165 |
} else if(this.assistNodeIsInterface) { |
10188 |
} else if(this.assistNodeIsInterface) { |
Lines 10293-10298
Link Here
|
10293 |
int searchFor = IJavaSearchConstants.TYPE; |
10316 |
int searchFor = IJavaSearchConstants.TYPE; |
10294 |
if(this.assistNodeIsClass) { |
10317 |
if(this.assistNodeIsClass) { |
10295 |
searchFor = IJavaSearchConstants.CLASS; |
10318 |
searchFor = IJavaSearchConstants.CLASS; |
|
|
10319 |
} else if (this.assistNodeIsInterfaceExcludingAnnotation) { |
10320 |
searchFor = IJavaSearchConstants.INTERFACE; |
10296 |
} else if(this.assistNodeIsInterface) { |
10321 |
} else if(this.assistNodeIsInterface) { |
10297 |
searchFor = IJavaSearchConstants.INTERFACE_AND_ANNOTATION; |
10322 |
searchFor = IJavaSearchConstants.INTERFACE_AND_ANNOTATION; |
10298 |
} else if(this.assistNodeIsEnum) { |
10323 |
} else if(this.assistNodeIsEnum) { |
Lines 10385-10390
Link Here
|
10385 |
continue; |
10410 |
continue; |
10386 |
|
10411 |
|
10387 |
if (this.assistNodeIsExtendedType && sourceType.isFinal()) continue; |
10412 |
if (this.assistNodeIsExtendedType && sourceType.isFinal()) continue; |
|
|
10413 |
if (this.assistNodeIsInterfaceExcludingAnnotation && sourceType.isAnnotationType()) continue; |
10388 |
int accessibility = IAccessRule.K_ACCESSIBLE; |
10414 |
int accessibility = IAccessRule.K_ACCESSIBLE; |
10389 |
if(sourceType.hasRestrictedAccess()) { |
10415 |
if(sourceType.hasRestrictedAccess()) { |
10390 |
AccessRestriction accessRestriction = this.lookupEnvironment.getAccessRestriction(sourceType); |
10416 |
AccessRestriction accessRestriction = this.lookupEnvironment.getAccessRestriction(sourceType); |
Lines 10472-10477
Link Here
|
10472 |
int searchFor = IJavaSearchConstants.TYPE; |
10498 |
int searchFor = IJavaSearchConstants.TYPE; |
10473 |
if(this.assistNodeIsClass) { |
10499 |
if(this.assistNodeIsClass) { |
10474 |
searchFor = IJavaSearchConstants.CLASS; |
10500 |
searchFor = IJavaSearchConstants.CLASS; |
|
|
10501 |
} else if (this.assistNodeIsInterfaceExcludingAnnotation) { |
10502 |
searchFor = IJavaSearchConstants.INTERFACE; |
10475 |
} else if(this.assistNodeIsInterface) { |
10503 |
} else if(this.assistNodeIsInterface) { |
10476 |
searchFor = IJavaSearchConstants.INTERFACE_AND_ANNOTATION; |
10504 |
searchFor = IJavaSearchConstants.INTERFACE_AND_ANNOTATION; |
10477 |
} else if(this.assistNodeIsEnum) { |
10505 |
} else if(this.assistNodeIsEnum) { |
Lines 10578-10583
Link Here
|
10578 |
} |
10606 |
} |
10579 |
|
10607 |
|
10580 |
if (this.assistNodeIsExtendedType && refBinding.isFinal()) continue next; |
10608 |
if (this.assistNodeIsExtendedType && refBinding.isFinal()) continue next; |
|
|
10609 |
if (this.assistNodeIsInterfaceExcludingAnnotation && refBinding.isAnnotationType()) continue next; |
10581 |
if(this.assistNodeIsClass) { |
10610 |
if(this.assistNodeIsClass) { |
10582 |
if(!refBinding.isClass()) continue next; |
10611 |
if(!refBinding.isClass()) continue next; |
10583 |
} else if(this.assistNodeIsInterface) { |
10612 |
} else if(this.assistNodeIsInterface) { |
Lines 10708-10713
Link Here
|
10708 |
typesFound.add(typeBinding); |
10737 |
typesFound.add(typeBinding); |
10709 |
|
10738 |
|
10710 |
if (this.assistNodeIsExtendedType && typeBinding.isFinal()) continue; |
10739 |
if (this.assistNodeIsExtendedType && typeBinding.isFinal()) continue; |
|
|
10740 |
if (this.assistNodeIsInterfaceExcludingAnnotation && typeBinding.isAnnotationType()) continue; |
10711 |
if(this.assistNodeIsClass) { |
10741 |
if(this.assistNodeIsClass) { |
10712 |
if(!typeBinding.isClass()) continue; |
10742 |
if(!typeBinding.isClass()) continue; |
10713 |
} else if(this.assistNodeIsInterface) { |
10743 |
} else if(this.assistNodeIsInterface) { |
Lines 10811-10816
Link Here
|
10811 |
typesFound.add(typeBinding); |
10841 |
typesFound.add(typeBinding); |
10812 |
|
10842 |
|
10813 |
if (this.assistNodeIsExtendedType && typeBinding.isFinal()) continue; |
10843 |
if (this.assistNodeIsExtendedType && typeBinding.isFinal()) continue; |
|
|
10844 |
if (this.assistNodeIsInterfaceExcludingAnnotation && typeBinding.isAnnotationType()) continue; |
10814 |
if(this.assistNodeIsClass) { |
10845 |
if(this.assistNodeIsClass) { |
10815 |
if(!typeBinding.isClass()) continue; |
10846 |
if(!typeBinding.isClass()) continue; |
10816 |
} else if(this.assistNodeIsInterface) { |
10847 |
} else if(this.assistNodeIsInterface) { |