Skip to content

Commit a21bca3

Browse files
committed
[WIP] adjust the method of calculating the signature
Signed-off-by: David Thompson <davthomp@redhat.com>
1 parent 7a91853 commit a21bca3

1 file changed

Lines changed: 7 additions & 8 deletions

File tree

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

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4578,7 +4578,7 @@ private List<CompletionProposal> toConstructorProposals(ITypeBinding typeBinding
45784578
// We should consider making those completion items here instead
45794579
} else {
45804580
if (!this.requestor.isIgnored(CompletionProposal.ANONYMOUS_CLASS_CONSTRUCTOR_INVOCATION) && isExactName) {
4581-
List<IMethodBinding> constructors = Stream.of(typeBinding.getDeclaredMethods()).filter(IMethodBinding::isConstructor).toList();
4581+
List<IMethodBinding> constructors = Stream.of(typeBinding.getErasure().getDeclaredMethods()).filter(IMethodBinding::isConstructor).toList();
45824582
if (constructors.isEmpty()) {
45834583
IMethodBinding constructorBinding = ((ClassInstanceCreation)this.toComplete).resolveConstructorBinding();
45844584
if (constructorBinding != null) {
@@ -4590,7 +4590,7 @@ private List<CompletionProposal> toConstructorProposals(ITypeBinding typeBinding
45904590
}
45914591
}
45924592
try {
4593-
List<IMethodBinding> constructors = Stream.of(typeBinding.getErasure().getDeclaredMethods()).filter(IMethodBinding::isConstructor).toList();
4593+
List<IMethodBinding> constructors = Stream.of(typeBinding.getDeclaredMethods()).filter(IMethodBinding::isConstructor).toList();
45944594
if (!constructors.isEmpty()) {
45954595
for (IMethodBinding constructor: constructors) {
45964596
if (
@@ -4806,14 +4806,13 @@ private CompletionProposal toConstructorProposal(IMethodBinding method, boolean
48064806
res.setSignature(signature);
48074807
res.setOriginalSignature(signature);
48084808

4809-
if (declaringClass.getTypeArguments().length == 0
4810-
&& declaringClass.getErasure().getTypeParameters().length > 0) {
4809+
if (declaringClass.getTypeArguments().length > 0
4810+
&& declaringClass.getTypeParameters().length == 0) {
48114811
// we need to massage the signature; the signature doesn't include the type
48124812
// parameters in this case for whatever reason
4813-
res.setDeclarationSignature(Signature.getTypeErasure(SignatureUtils.getSignature(declaringClass))
4814-
.replace(";", "<>;").toCharArray());
4815-
} else if (declaringClass.getErasure().getTypeParameters().length > 0) {
4816-
res.setDeclarationSignature(SignatureUtils.getSignatureChar(declaringClass.getErasure()));
4813+
String massagedSignature = SignatureUtils.getSignature(declaringClass);
4814+
massagedSignature = massagedSignature.substring(0, massagedSignature.lastIndexOf('<')) + "<>;";
4815+
res.setDeclarationSignature(massagedSignature.toCharArray());
48174816
} else {
48184817
res.setDeclarationSignature(SignatureUtils.getSignature(declaringClass).toCharArray());
48194818
}

0 commit comments

Comments
 (0)