Lines 1540-1545
Link Here
|
1540 |
argTypes, |
1540 |
argTypes, |
1541 |
scope, |
1541 |
scope, |
1542 |
constructorCall, |
1542 |
constructorCall, |
|
|
1543 |
false, |
1544 |
null, |
1545 |
null, |
1546 |
null, |
1543 |
false); |
1547 |
false); |
1544 |
} |
1548 |
} |
1545 |
} |
1549 |
} |
Lines 1618-1624
Link Here
|
1618 |
|
1622 |
|
1619 |
ReferenceBinding ref = (ReferenceBinding) qualifiedBinding; |
1623 |
ReferenceBinding ref = (ReferenceBinding) qualifiedBinding; |
1620 |
if (!this.requestor.isIgnored(CompletionProposal.METHOD_REF) && ref.isClass()) { |
1624 |
if (!this.requestor.isIgnored(CompletionProposal.METHOD_REF) && ref.isClass()) { |
1621 |
findConstructors(ref, argTypes, scope, allocExpression, false); |
1625 |
findConstructors(ref, argTypes, scope, allocExpression, false, null, null, null, false); |
1622 |
} |
1626 |
} |
1623 |
} |
1627 |
} |
1624 |
//TODO |
1628 |
//TODO |
Lines 1690-1696
Link Here
|
1690 |
if (this.completionToken == null |
1694 |
if (this.completionToken == null |
1691 |
|| CharOperation.prefixEquals(this.completionToken, refBinding.sourceName) |
1695 |
|| CharOperation.prefixEquals(this.completionToken, refBinding.sourceName) |
1692 |
|| (this.options.camelCaseMatch && CharOperation.camelCaseMatch(this.completionToken, refBinding.sourceName))) { |
1696 |
|| (this.options.camelCaseMatch && CharOperation.camelCaseMatch(this.completionToken, refBinding.sourceName))) { |
1693 |
findConstructors(refBinding, null, scope, fieldRef, false); |
1697 |
findConstructors(refBinding, null, scope, fieldRef, false, null, null, null, false); |
1694 |
} |
1698 |
} |
1695 |
} |
1699 |
} |
1696 |
} |
1700 |
} |
Lines 2277-2303
Link Here
|
2277 |
TypeBinding[] argTypes = computeTypes(allocExpression.arguments); |
2281 |
TypeBinding[] argTypes = computeTypes(allocExpression.arguments); |
2278 |
|
2282 |
|
2279 |
ReferenceBinding ref = (ReferenceBinding) qualifiedBinding; |
2283 |
ReferenceBinding ref = (ReferenceBinding) qualifiedBinding; |
2280 |
if (!this.requestor.isIgnored(CompletionProposal.METHOD_REF) |
2284 |
|
2281 |
&& ref.isClass() |
2285 |
if (ref.problemId() == ProblemReasons.NotFound) { |
2282 |
&& !ref.isAbstract()) { |
2286 |
findConstructorsFromMissingType( |
2283 |
findConstructors( |
2287 |
allocExpression.type, |
|
|
2288 |
argTypes, |
2289 |
scope, |
2290 |
allocExpression); |
2291 |
} else { |
2292 |
if (!this.requestor.isIgnored(CompletionProposal.METHOD_REF) |
2293 |
&& ref.isClass() |
2294 |
&& !ref.isAbstract()) { |
2295 |
findConstructors( |
2296 |
ref, |
2297 |
argTypes, |
2298 |
scope, |
2299 |
allocExpression, |
2300 |
false, |
2301 |
null, |
2302 |
null, |
2303 |
null, |
2304 |
false); |
2305 |
} |
2306 |
|
2307 |
checkCancel(); |
2308 |
|
2309 |
if (!this.requestor.isIgnored(CompletionProposal.ANONYMOUS_CLASS_DECLARATION) |
2310 |
&& !ref.isFinal() |
2311 |
&& !ref.isEnum()){ |
2312 |
findAnonymousType( |
2284 |
ref, |
2313 |
ref, |
2285 |
argTypes, |
2314 |
argTypes, |
2286 |
scope, |
2315 |
scope, |
2287 |
allocExpression, |
2316 |
allocExpression, |
|
|
2317 |
null, |
2318 |
null, |
2319 |
null, |
2288 |
false); |
2320 |
false); |
2289 |
} |
2321 |
} |
2290 |
|
|
|
2291 |
checkCancel(); |
2292 |
|
2293 |
if (!this.requestor.isIgnored(CompletionProposal.ANONYMOUS_CLASS_DECLARATION) |
2294 |
&& !ref.isFinal() |
2295 |
&& !ref.isEnum()){ |
2296 |
findAnonymousType( |
2297 |
ref, |
2298 |
argTypes, |
2299 |
scope, |
2300 |
allocExpression); |
2301 |
} |
2322 |
} |
2302 |
} |
2323 |
} |
2303 |
|
2324 |
|
Lines 3942-3952
Link Here
|
3942 |
} |
3963 |
} |
3943 |
} |
3964 |
} |
3944 |
} |
3965 |
} |
3945 |
private void findAnonymousType( |
3966 |
void findAnonymousType( |
3946 |
ReferenceBinding currentType, |
3967 |
ReferenceBinding currentType, |
3947 |
TypeBinding[] argTypes, |
3968 |
TypeBinding[] argTypes, |
3948 |
Scope scope, |
3969 |
Scope scope, |
3949 |
InvocationSite invocationSite) { |
3970 |
InvocationSite invocationSite, |
|
|
3971 |
Binding[] missingElements, |
3972 |
int[] missingElementsStarts, |
3973 |
int[] missingElementsEnds, |
3974 |
boolean missingElementsHaveProblems) { |
3950 |
|
3975 |
|
3951 |
if (currentType.isInterface()) { |
3976 |
if (currentType.isInterface()) { |
3952 |
char[] completion = CharOperation.NO_CHAR; |
3977 |
char[] completion = CharOperation.NO_CHAR; |
Lines 3954-3962
Link Here
|
3954 |
relevance += computeRelevanceForResolution(); |
3979 |
relevance += computeRelevanceForResolution(); |
3955 |
relevance += computeRelevanceForInterestingProposal(); |
3980 |
relevance += computeRelevanceForInterestingProposal(); |
3956 |
relevance += computeRelevanceForRestrictions(IAccessRule.K_ACCESSIBLE); |
3981 |
relevance += computeRelevanceForRestrictions(IAccessRule.K_ACCESSIBLE); |
|
|
3982 |
|
3983 |
if (missingElements != null) { |
3984 |
relevance += computeRelevanceForMissingElements(missingElementsHaveProblems); |
3985 |
} |
3957 |
|
3986 |
|
3958 |
this.noProposal = false; |
3987 |
this.noProposal = false; |
3959 |
if(!this.requestor.isIgnored(CompletionProposal.ANONYMOUS_CLASS_DECLARATION)) { |
3988 |
if(!isIgnored(CompletionProposal.ANONYMOUS_CLASS_DECLARATION, missingElements != null)) { |
3960 |
InternalCompletionProposal proposal = createProposal(CompletionProposal.ANONYMOUS_CLASS_DECLARATION, this.actualCompletionPosition); |
3989 |
InternalCompletionProposal proposal = createProposal(CompletionProposal.ANONYMOUS_CLASS_DECLARATION, this.actualCompletionPosition); |
3961 |
proposal.setDeclarationSignature(getSignature(currentType)); |
3990 |
proposal.setDeclarationSignature(getSignature(currentType)); |
3962 |
proposal.setDeclarationKey(currentType.computeUniqueKey()); |
3991 |
proposal.setDeclarationKey(currentType.computeUniqueKey()); |
Lines 3974-3979
Link Here
|
3974 |
//proposal.setParameterTypeNames(null); |
4003 |
//proposal.setParameterTypeNames(null); |
3975 |
//proposal.setPackageName(null); |
4004 |
//proposal.setPackageName(null); |
3976 |
//proposal.setTypeName(null); |
4005 |
//proposal.setTypeName(null); |
|
|
4006 |
if (missingElements != null) { |
4007 |
CompletionProposal[] subProposals = new CompletionProposal[missingElements.length]; |
4008 |
for (int i = 0; i < missingElements.length; i++) { |
4009 |
subProposals[i] = |
4010 |
createRequiredTypeProposal( |
4011 |
missingElements[i], |
4012 |
missingElementsStarts[i], |
4013 |
missingElementsEnds[i], |
4014 |
relevance); |
4015 |
} |
4016 |
proposal.setRequiredProposals(subProposals); |
4017 |
} |
3977 |
proposal.setCompletion(completion); |
4018 |
proposal.setCompletion(completion); |
3978 |
proposal.setFlags(Flags.AccPublic); |
4019 |
proposal.setFlags(Flags.AccPublic); |
3979 |
proposal.setReplaceRange(this.endPosition - this.offset, this.endPosition - this.offset); |
4020 |
proposal.setReplaceRange(this.endPosition - this.offset, this.endPosition - this.offset); |
Lines 3990-3996
Link Here
|
3990 |
argTypes, |
4031 |
argTypes, |
3991 |
scope, |
4032 |
scope, |
3992 |
invocationSite, |
4033 |
invocationSite, |
3993 |
true); |
4034 |
true, |
|
|
4035 |
missingElements, |
4036 |
missingElementsStarts, |
4037 |
missingElementsEnds, |
4038 |
missingElementsHaveProblems); |
3994 |
} |
4039 |
} |
3995 |
} |
4040 |
} |
3996 |
private void findClassField( |
4041 |
private void findClassField( |
Lines 4069-4080
Link Here
|
4069 |
} |
4114 |
} |
4070 |
} |
4115 |
} |
4071 |
} |
4116 |
} |
4072 |
private void findConstructors( |
4117 |
void findConstructors( |
4073 |
ReferenceBinding currentType, |
4118 |
ReferenceBinding currentType, |
4074 |
TypeBinding[] argTypes, |
4119 |
TypeBinding[] argTypes, |
4075 |
Scope scope, |
4120 |
Scope scope, |
4076 |
InvocationSite invocationSite, |
4121 |
InvocationSite invocationSite, |
4077 |
boolean forAnonymousType) { |
4122 |
boolean forAnonymousType, |
|
|
4123 |
Binding[] missingElements, |
4124 |
int[] missingElementsStarts, |
4125 |
int[] missingElementsEnds, |
4126 |
boolean missingElementsHaveProblems) { |
4078 |
|
4127 |
|
4079 |
// No visibility checks can be performed without the scope & invocationSite |
4128 |
// No visibility checks can be performed without the scope & invocationSite |
4080 |
MethodBinding[] methods = currentType.availableMethods(); |
4129 |
MethodBinding[] methods = currentType.availableMethods(); |
Lines 4122-4130
Link Here
|
4122 |
relevance += computeRelevanceForResolution(); |
4171 |
relevance += computeRelevanceForResolution(); |
4123 |
relevance += computeRelevanceForInterestingProposal(); |
4172 |
relevance += computeRelevanceForInterestingProposal(); |
4124 |
relevance += computeRelevanceForRestrictions(IAccessRule.K_ACCESSIBLE); |
4173 |
relevance += computeRelevanceForRestrictions(IAccessRule.K_ACCESSIBLE); |
|
|
4174 |
|
4175 |
if (missingElements != null) { |
4176 |
relevance += computeRelevanceForMissingElements(missingElementsHaveProblems); |
4177 |
} |
4125 |
|
4178 |
|
4126 |
this.noProposal = false; |
4179 |
this.noProposal = false; |
4127 |
if(!this.requestor.isIgnored(CompletionProposal.ANONYMOUS_CLASS_DECLARATION)) { |
4180 |
if(!this.isIgnored(CompletionProposal.ANONYMOUS_CLASS_DECLARATION, missingElements != null)) { |
4128 |
InternalCompletionProposal proposal = createProposal(CompletionProposal.ANONYMOUS_CLASS_DECLARATION, this.actualCompletionPosition); |
4181 |
InternalCompletionProposal proposal = createProposal(CompletionProposal.ANONYMOUS_CLASS_DECLARATION, this.actualCompletionPosition); |
4129 |
proposal.setDeclarationSignature(getSignature(currentType)); |
4182 |
proposal.setDeclarationSignature(getSignature(currentType)); |
4130 |
proposal.setDeclarationKey(currentType.computeUniqueKey()); |
4183 |
proposal.setDeclarationKey(currentType.computeUniqueKey()); |
Lines 4140-4145
Link Here
|
4140 |
proposal.setParameterTypeNames(parameterTypeNames); |
4193 |
proposal.setParameterTypeNames(parameterTypeNames); |
4141 |
//proposal.setPackageName(null); |
4194 |
//proposal.setPackageName(null); |
4142 |
//proposal.setTypeName(null); |
4195 |
//proposal.setTypeName(null); |
|
|
4196 |
if (missingElements != null) { |
4197 |
CompletionProposal[] subProposals = new CompletionProposal[missingElements.length]; |
4198 |
for (int i = 0; i < missingElements.length; i++) { |
4199 |
subProposals[i] = |
4200 |
createRequiredTypeProposal( |
4201 |
missingElements[i], |
4202 |
missingElementsStarts[i], |
4203 |
missingElementsEnds[i], |
4204 |
relevance); |
4205 |
} |
4206 |
proposal.setRequiredProposals(subProposals); |
4207 |
} |
4143 |
proposal.setCompletion(completion); |
4208 |
proposal.setCompletion(completion); |
4144 |
proposal.setFlags(constructor.modifiers); |
4209 |
proposal.setFlags(constructor.modifiers); |
4145 |
proposal.setReplaceRange(this.endPosition - this.offset, this.endPosition - this.offset); |
4210 |
proposal.setReplaceRange(this.endPosition - this.offset, this.endPosition - this.offset); |
Lines 4156-4161
Link Here
|
4156 |
relevance += computeRelevanceForResolution(); |
4221 |
relevance += computeRelevanceForResolution(); |
4157 |
relevance += computeRelevanceForInterestingProposal(); |
4222 |
relevance += computeRelevanceForInterestingProposal(); |
4158 |
relevance += computeRelevanceForRestrictions(IAccessRule.K_ACCESSIBLE); |
4223 |
relevance += computeRelevanceForRestrictions(IAccessRule.K_ACCESSIBLE); |
|
|
4224 |
|
4225 |
if (missingElements != null) { |
4226 |
relevance += computeRelevanceForMissingElements(missingElementsHaveProblems); |
4227 |
} |
4159 |
|
4228 |
|
4160 |
// Special case for completion in javadoc |
4229 |
// Special case for completion in javadoc |
4161 |
if (this.assistNodeInJavadoc > 0) { |
4230 |
if (this.assistNodeInJavadoc > 0) { |
Lines 4212-4218
Link Here
|
4212 |
|
4281 |
|
4213 |
// Create standard proposal |
4282 |
// Create standard proposal |
4214 |
this.noProposal = false; |
4283 |
this.noProposal = false; |
4215 |
if(!this.requestor.isIgnored(CompletionProposal.METHOD_REF) && (this.assistNodeInJavadoc & CompletionOnJavadoc.ONLY_INLINE_TAG) == 0) { |
4284 |
if(!this.isIgnored(CompletionProposal.METHOD_REF, missingElements != null) && (this.assistNodeInJavadoc & CompletionOnJavadoc.ONLY_INLINE_TAG) == 0) { |
4216 |
InternalCompletionProposal proposal = createProposal(CompletionProposal.METHOD_REF, this.actualCompletionPosition); |
4285 |
InternalCompletionProposal proposal = createProposal(CompletionProposal.METHOD_REF, this.actualCompletionPosition); |
4217 |
proposal.setDeclarationSignature(getSignature(currentType)); |
4286 |
proposal.setDeclarationSignature(getSignature(currentType)); |
4218 |
proposal.setSignature(getSignature(constructor)); |
4287 |
proposal.setSignature(getSignature(constructor)); |
Lines 4227-4232
Link Here
|
4227 |
//proposal.setPackageName(null); |
4296 |
//proposal.setPackageName(null); |
4228 |
//proposal.setTypeName(null); |
4297 |
//proposal.setTypeName(null); |
4229 |
proposal.setName(currentType.sourceName()); |
4298 |
proposal.setName(currentType.sourceName()); |
|
|
4299 |
if (missingElements != null) { |
4300 |
CompletionProposal[] subProposals = new CompletionProposal[missingElements.length]; |
4301 |
for (int i = 0; i < missingElements.length; i++) { |
4302 |
subProposals[i] = |
4303 |
createRequiredTypeProposal( |
4304 |
missingElements[i], |
4305 |
missingElementsStarts[i], |
4306 |
missingElementsEnds[i], |
4307 |
relevance); |
4308 |
} |
4309 |
proposal.setRequiredProposals(subProposals); |
4310 |
} |
4230 |
proposal.setIsContructor(true); |
4311 |
proposal.setIsContructor(true); |
4231 |
proposal.setCompletion(completion); |
4312 |
proposal.setCompletion(completion); |
4232 |
proposal.setFlags(constructor.modifiers); |
4313 |
proposal.setFlags(constructor.modifiers); |
Lines 5925-5930
Link Here
|
5925 |
}; |
6006 |
}; |
5926 |
missingTypesConverter.guess(typeRef, scope, substitutionRequestor); |
6007 |
missingTypesConverter.guess(typeRef, scope, substitutionRequestor); |
5927 |
} |
6008 |
} |
|
|
6009 |
|
6010 |
private void findConstructorsFromMissingType( |
6011 |
TypeReference typeRef, |
6012 |
final TypeBinding[] argTypes, |
6013 |
final Scope scope, |
6014 |
final InvocationSite invocationSite) { |
6015 |
MissingTypesGuesser missingTypesConverter = new MissingTypesGuesser(this); |
6016 |
MissingTypesGuesser.GuessedTypeRequestor substitutionRequestor = |
6017 |
new MissingTypesGuesser.GuessedTypeRequestor() { |
6018 |
public void accept( |
6019 |
TypeBinding guessedType, |
6020 |
Binding[] missingElements, |
6021 |
int[] missingElementsStarts, |
6022 |
int[] missingElementsEnds, |
6023 |
boolean hasProblems) { |
6024 |
if (guessedType instanceof ReferenceBinding) { |
6025 |
ReferenceBinding ref = (ReferenceBinding) guessedType; |
6026 |
if (!isIgnored(CompletionProposal.METHOD_REF, missingElements != null) |
6027 |
&& ref.isClass() |
6028 |
&& !ref.isAbstract()) { |
6029 |
findConstructors( |
6030 |
ref, |
6031 |
argTypes, |
6032 |
scope, |
6033 |
invocationSite, |
6034 |
false, |
6035 |
missingElements, |
6036 |
missingElementsStarts, |
6037 |
missingElementsEnds, |
6038 |
hasProblems); |
6039 |
} |
6040 |
|
6041 |
checkCancel(); |
6042 |
|
6043 |
if (!isIgnored(CompletionProposal.ANONYMOUS_CLASS_DECLARATION, missingElements != null) |
6044 |
&& !ref.isFinal() |
6045 |
&& !ref.isEnum()){ |
6046 |
findAnonymousType( |
6047 |
ref, |
6048 |
argTypes, |
6049 |
scope, |
6050 |
invocationSite, |
6051 |
missingElements, |
6052 |
missingElementsStarts, |
6053 |
missingElementsEnds, |
6054 |
hasProblems); |
6055 |
} |
6056 |
} |
6057 |
} |
6058 |
}; |
6059 |
missingTypesConverter.guess(typeRef, scope, substitutionRequestor); |
6060 |
} |
5928 |
|
6061 |
|
5929 |
private void findFieldsAndMethodsFromStaticImports( |
6062 |
private void findFieldsAndMethodsFromStaticImports( |
5930 |
char[] token, |
6063 |
char[] token, |
Lines 10275-10281
Link Here
|
10275 |
private boolean isIgnored(int kind) { |
10408 |
private boolean isIgnored(int kind) { |
10276 |
return this.requestor.isIgnored(kind); |
10409 |
return this.requestor.isIgnored(kind); |
10277 |
} |
10410 |
} |
10278 |
private boolean isIgnored(int kind, boolean missingTypes) { |
10411 |
boolean isIgnored(int kind, boolean missingTypes) { |
10279 |
return this.requestor.isIgnored(kind) || |
10412 |
return this.requestor.isIgnored(kind) || |
10280 |
(missingTypes && !this.requestor.isAllowingRequiredProposals(kind, CompletionProposal.TYPE_REF)); |
10413 |
(missingTypes && !this.requestor.isAllowingRequiredProposals(kind, CompletionProposal.TYPE_REF)); |
10281 |
} |
10414 |
} |