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 assistNodeIsImplementedType; // 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.assistNodeIsImplementedType = assistNodeIsImplementedType(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 assistNodeIsImplementedType(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.assistNodeIsImplementedType = assistNodeIsImplementedType(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.assistNodeIsImplementedType = assistNodeIsImplementedType(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 9281-9286
Link Here
|
9281 |
typesFound.add(memberType); |
9301 |
typesFound.add(memberType); |
9282 |
|
9302 |
|
9283 |
if (this.assistNodeIsExtendedType && memberType.isFinal()) continue next; |
9303 |
if (this.assistNodeIsExtendedType && memberType.isFinal()) continue next; |
|
|
9304 |
if (this.assistNodeIsImplementedType && memberType.isAnnotationType()) continue next; |
9284 |
if(!this.insideQualifiedReference) { |
9305 |
if(!this.insideQualifiedReference) { |
9285 |
if(this.assistNodeIsClass) { |
9306 |
if(this.assistNodeIsClass) { |
9286 |
if(!memberType.isClass()) continue next; |
9307 |
if(!memberType.isClass()) continue next; |
Lines 9769-9774
Link Here
|
9769 |
} |
9790 |
} |
9770 |
|
9791 |
|
9771 |
if (this.assistNodeIsExtendedType && localType.isFinal()) continue next; |
9792 |
if (this.assistNodeIsExtendedType && localType.isFinal()) continue next; |
|
|
9793 |
if (this.assistNodeIsImplementedType && localType.isAnnotationType()) continue next; |
9772 |
if(this.assistNodeIsClass) { |
9794 |
if(this.assistNodeIsClass) { |
9773 |
if(!localType.isClass()) continue next; |
9795 |
if(!localType.isClass()) continue next; |
9774 |
} else if(this.assistNodeIsInterface) { |
9796 |
} else if(this.assistNodeIsInterface) { |
Lines 10150-10155
Link Here
|
10150 |
typesFound.add(sourceType); |
10172 |
typesFound.add(sourceType); |
10151 |
|
10173 |
|
10152 |
if (this.assistNodeIsExtendedType && sourceType.isFinal()) continue next; |
10174 |
if (this.assistNodeIsExtendedType && sourceType.isFinal()) continue next; |
|
|
10175 |
if (this.assistNodeIsImplementedType && sourceType.isAnnotationType()) continue next; |
10153 |
if(this.assistNodeIsClass) { |
10176 |
if(this.assistNodeIsClass) { |
10154 |
if(!sourceType.isClass()) continue next; |
10177 |
if(!sourceType.isClass()) continue next; |
10155 |
} else if(this.assistNodeIsInterface) { |
10178 |
} else if(this.assistNodeIsInterface) { |
Lines 10283-10288
Link Here
|
10283 |
int searchFor = IJavaSearchConstants.TYPE; |
10306 |
int searchFor = IJavaSearchConstants.TYPE; |
10284 |
if(this.assistNodeIsClass) { |
10307 |
if(this.assistNodeIsClass) { |
10285 |
searchFor = IJavaSearchConstants.CLASS; |
10308 |
searchFor = IJavaSearchConstants.CLASS; |
|
|
10309 |
} else if (this.assistNodeIsImplementedType) { |
10310 |
searchFor = IJavaSearchConstants.INTERFACE; |
10286 |
} else if(this.assistNodeIsInterface) { |
10311 |
} else if(this.assistNodeIsInterface) { |
10287 |
searchFor = IJavaSearchConstants.INTERFACE_AND_ANNOTATION; |
10312 |
searchFor = IJavaSearchConstants.INTERFACE_AND_ANNOTATION; |
10288 |
} else if(this.assistNodeIsEnum) { |
10313 |
} else if(this.assistNodeIsEnum) { |
Lines 10375-10380
Link Here
|
10375 |
continue; |
10400 |
continue; |
10376 |
|
10401 |
|
10377 |
if (this.assistNodeIsExtendedType && sourceType.isFinal()) continue; |
10402 |
if (this.assistNodeIsExtendedType && sourceType.isFinal()) continue; |
|
|
10403 |
if (this.assistNodeIsImplementedType && sourceType.isAnnotationType()) continue; |
10378 |
int accessibility = IAccessRule.K_ACCESSIBLE; |
10404 |
int accessibility = IAccessRule.K_ACCESSIBLE; |
10379 |
if(sourceType.hasRestrictedAccess()) { |
10405 |
if(sourceType.hasRestrictedAccess()) { |
10380 |
AccessRestriction accessRestriction = this.lookupEnvironment.getAccessRestriction(sourceType); |
10406 |
AccessRestriction accessRestriction = this.lookupEnvironment.getAccessRestriction(sourceType); |
Lines 10462-10467
Link Here
|
10462 |
int searchFor = IJavaSearchConstants.TYPE; |
10488 |
int searchFor = IJavaSearchConstants.TYPE; |
10463 |
if(this.assistNodeIsClass) { |
10489 |
if(this.assistNodeIsClass) { |
10464 |
searchFor = IJavaSearchConstants.CLASS; |
10490 |
searchFor = IJavaSearchConstants.CLASS; |
|
|
10491 |
} else if (this.assistNodeIsImplementedType) { |
10492 |
searchFor = IJavaSearchConstants.INTERFACE; |
10465 |
} else if(this.assistNodeIsInterface) { |
10493 |
} else if(this.assistNodeIsInterface) { |
10466 |
searchFor = IJavaSearchConstants.INTERFACE_AND_ANNOTATION; |
10494 |
searchFor = IJavaSearchConstants.INTERFACE_AND_ANNOTATION; |
10467 |
} else if(this.assistNodeIsEnum) { |
10495 |
} else if(this.assistNodeIsEnum) { |
Lines 10568-10573
Link Here
|
10568 |
} |
10596 |
} |
10569 |
|
10597 |
|
10570 |
if (this.assistNodeIsExtendedType && refBinding.isFinal()) continue next; |
10598 |
if (this.assistNodeIsExtendedType && refBinding.isFinal()) continue next; |
|
|
10599 |
if (this.assistNodeIsImplementedType && refBinding.isAnnotationType()) continue next; |
10571 |
if(this.assistNodeIsClass) { |
10600 |
if(this.assistNodeIsClass) { |
10572 |
if(!refBinding.isClass()) continue next; |
10601 |
if(!refBinding.isClass()) continue next; |
10573 |
} else if(this.assistNodeIsInterface) { |
10602 |
} else if(this.assistNodeIsInterface) { |
Lines 10698-10703
Link Here
|
10698 |
typesFound.add(typeBinding); |
10727 |
typesFound.add(typeBinding); |
10699 |
|
10728 |
|
10700 |
if (this.assistNodeIsExtendedType && typeBinding.isFinal()) continue; |
10729 |
if (this.assistNodeIsExtendedType && typeBinding.isFinal()) continue; |
|
|
10730 |
if (this.assistNodeIsImplementedType && typeBinding.isAnnotationType()) continue; |
10701 |
if(this.assistNodeIsClass) { |
10731 |
if(this.assistNodeIsClass) { |
10702 |
if(!typeBinding.isClass()) continue; |
10732 |
if(!typeBinding.isClass()) continue; |
10703 |
} else if(this.assistNodeIsInterface) { |
10733 |
} else if(this.assistNodeIsInterface) { |
Lines 10801-10806
Link Here
|
10801 |
typesFound.add(typeBinding); |
10831 |
typesFound.add(typeBinding); |
10802 |
|
10832 |
|
10803 |
if (this.assistNodeIsExtendedType && typeBinding.isFinal()) continue; |
10833 |
if (this.assistNodeIsExtendedType && typeBinding.isFinal()) continue; |
|
|
10834 |
if (this.assistNodeIsImplementedType && typeBinding.isAnnotationType()) continue; |
10804 |
if(this.assistNodeIsClass) { |
10835 |
if(this.assistNodeIsClass) { |
10805 |
if(!typeBinding.isClass()) continue; |
10836 |
if(!typeBinding.isClass()) continue; |
10806 |
} else if(this.assistNodeIsInterface) { |
10837 |
} else if(this.assistNodeIsInterface) { |