Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 23653 Details for
Bug 100009
[assist] Content assist uses generic parameter name arg0 instead of real name
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Proposed patch
patchjdtcore003.txt (text/plain), 14.68 KB, created by
David Audel
on 2005-06-21 14:26:33 EDT
(
hide
)
Description:
Proposed patch
Filename:
MIME Type:
Creator:
David Audel
Created:
2005-06-21 14:26:33 EDT
Size:
14.68 KB
patch
obsolete
>Index: codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java,v >retrieving revision 1.247 >diff -u -r1.247 CompletionEngine.java >--- codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java 14 Jun 2005 19:25:45 -0000 1.247 >+++ codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java 21 Jun 2005 18:22:51 -0000 >@@ -1714,6 +1714,7 @@ > CharOperation.NO_CHAR_CHAR, > CharOperation.NO_CHAR, > CharOperation.NO_CHAR)); >+ //proposal.setOriginalSignature(null); > //proposal.setUniqueKey(null); > proposal.setDeclarationPackageName(currentType.qualifiedPackageName()); > proposal.setDeclarationTypeName(currentType.qualifiedSourceName()); >@@ -1907,6 +1908,10 @@ > CompletionProposal proposal = this.createProposal(CompletionProposal.METHOD_REF, this.actualCompletionPosition); > proposal.setDeclarationSignature(getSignature(currentType)); > proposal.setSignature(getSignature(constructor)); >+ MethodBinding original = constructor.original(); >+ if(original != constructor) { >+ proposal.setOriginalSignature(getSignature(original)); >+ } > proposal.setDeclarationPackageName(currentType.qualifiedPackageName()); > proposal.setDeclarationTypeName(currentType.qualifiedSourceName()); > proposal.setParameterPackageNames(parameterPackageNames); >@@ -1988,6 +1993,10 @@ > proposal.setDeclarationSignature(getSignature(currentType)); > proposal.setDeclarationKey(currentType.computeUniqueKey()); > proposal.setSignature(getSignature(constructor)); >+ MethodBinding original = constructor.original(); >+ if(original != constructor) { >+ proposal.setOriginalSignature(getSignature(original)); >+ } > proposal.setKey(constructor.computeUniqueKey()); > proposal.setDeclarationPackageName(currentType.qualifiedPackageName()); > proposal.setDeclarationTypeName(currentType.qualifiedSourceName()); >@@ -2015,6 +2024,10 @@ > CompletionProposal proposal = this.createProposal(CompletionProposal.METHOD_REF, this.actualCompletionPosition); > proposal.setDeclarationSignature(getSignature(currentType)); > proposal.setSignature(getSignature(constructor)); >+ MethodBinding original = constructor.original(); >+ if(original != constructor) { >+ proposal.setOriginalSignature(getSignature(original)); >+ } > proposal.setDeclarationPackageName(currentType.qualifiedPackageName()); > proposal.setDeclarationTypeName(currentType.qualifiedSourceName()); > proposal.setParameterPackageNames(parameterPackageNames); >@@ -2346,6 +2359,7 @@ > CharOperation.NO_CHAR_CHAR, > CharOperation.concatWith(JAVA_LANG, '.'), > OBJECT)); >+ //proposal.setOriginalSignature(null); > //proposal.setDeclarationPackageName(null); > //proposal.setDeclarationTypeName(null); > //proposal.setParameterPackageNames(null); >@@ -3424,6 +3438,10 @@ > CompletionProposal proposal = this.createProposal(CompletionProposal.METHOD_REF, this.actualCompletionPosition); > proposal.setDeclarationSignature(getSignature(method.declaringClass)); > proposal.setSignature(getSignature(method)); >+ MethodBinding original = method.original(); >+ if(original != method) { >+ proposal.setOriginalSignature(getSignature(original)); >+ } > proposal.setDeclarationPackageName(method.declaringClass.qualifiedPackageName()); > proposal.setDeclarationTypeName(method.declaringClass.qualifiedSourceName()); > proposal.setParameterPackageNames(parameterPackageNames); >@@ -3509,6 +3527,10 @@ > CompletionProposal proposal = this.createProposal(CompletionProposal.METHOD_REF, this.actualCompletionPosition); > proposal.setDeclarationSignature(getSignature(method.declaringClass)); > proposal.setSignature(getSignature(method)); >+ MethodBinding original = method.original(); >+ if(original != method) { >+ proposal.setOriginalSignature(getSignature(original)); >+ } > proposal.setDeclarationPackageName(method.declaringClass.qualifiedPackageName()); > proposal.setDeclarationTypeName(method.declaringClass.qualifiedSourceName()); > proposal.setParameterPackageNames(parameterPackageNames); >@@ -3754,6 +3776,10 @@ > proposal.setDeclarationSignature(getSignature(method.declaringClass)); > proposal.setDeclarationKey(method.declaringClass.computeUniqueKey()); > proposal.setSignature(getSignature(method)); >+ MethodBinding original = method.original(); >+ if(original != method) { >+ proposal.setOriginalSignature(getSignature(original)); >+ } > proposal.setKey(method.computeUniqueKey()); > proposal.setDeclarationPackageName(method.declaringClass.qualifiedPackageName()); > proposal.setDeclarationTypeName(method.declaringClass.qualifiedSourceName()); >Index: codeassist/org/eclipse/jdt/internal/codeassist/InternalCompletionProposal.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/InternalCompletionProposal.java,v >retrieving revision 1.5 >diff -u -r1.5 InternalCompletionProposal.java >--- codeassist/org/eclipse/jdt/internal/codeassist/InternalCompletionProposal.java 8 Jun 2005 11:21:45 -0000 1.5 >+++ codeassist/org/eclipse/jdt/internal/codeassist/InternalCompletionProposal.java 21 Jun 2005 18:22:51 -0000 >@@ -14,7 +14,6 @@ > import org.eclipse.jdt.core.IMethod; > import org.eclipse.jdt.core.IType; > import org.eclipse.jdt.core.JavaModelException; >-import org.eclipse.jdt.core.Signature; > import org.eclipse.jdt.core.compiler.CharOperation; > import org.eclipse.jdt.internal.core.BinaryType; > import org.eclipse.jdt.internal.core.NameLookup; >@@ -46,17 +45,46 @@ > protected char[][] parameterPackageNames; > protected char[][] parameterTypeNames; > >+ protected char[] originalSignature; >+ > protected int accessibility = IAccessRule.K_ACCESSIBLE; > > protected boolean isConstructor = false; > >- protected char[][] findMethodParameterNames(char[] signatureType, char[] selector, char[][] paramTypeNames){ >- if(signatureType == null) return null; >+ protected char[][] createDefaultParamterNames(int length) { >+ char[][] parameterNames; >+ switch (length) { >+ case 0 : >+ parameterNames = new char[length][]; >+ break; >+ case 1 : >+ parameterNames = ARGS1; >+ break; >+ case 2 : >+ parameterNames = ARGS2; >+ break; >+ case 3 : >+ parameterNames = ARGS3; >+ break; >+ case 4 : >+ parameterNames = ARGS4; >+ break; >+ default : >+ parameterNames = new char[length][]; >+ for (int i = 0; i < length; i++) { >+ parameterNames[i] = CharOperation.concat(ARG, String.valueOf(i).toCharArray()); >+ } >+ break; >+ } >+ return parameterNames; >+ } >+ protected char[][] findMethodParameterNames(char[] declaringTypePackageName, char[] declaringTypeName, char[] selector, char[][] paramTypeNames){ >+ if(paramTypeNames == null || declaringTypeName == null) return null; > >- char[] tName = Signature.toCharArray(signatureType); > char[][] parameterNames = null; > int length = paramTypeNames.length; > >+ char[] tName = CharOperation.concat(declaringTypePackageName,declaringTypeName,'.'); > Object cachedType = this.completionEngine.typeCache.get(tName); > > IType type = null; >@@ -96,32 +124,9 @@ > } > } > >-// default parameters name >+ // default parameters name > if(parameterNames == null) { >- switch (length) { >- case 0 : >- parameterNames = new char[length][]; >- break; >- case 1 : >- parameterNames = ARGS1; >- break; >- case 2 : >- parameterNames = ARGS2; >- break; >- case 3 : >- parameterNames = ARGS3; >- break; >- case 4 : >- parameterNames = ARGS4; >- break; >- default : >- parameterNames = new char[length][]; >- for (int i = 0; i < length; i++) { >- parameterNames[i] = CharOperation.concat(ARG, String.valueOf(i).toCharArray()); >- } >- break; >- } >- >+ parameterNames = createDefaultParamterNames(length); > } > > return parameterNames; >@@ -152,82 +157,6 @@ > return this.parameterTypeNames; > } > >- protected char[][] findMethodParameterNames(char[] declaringTypePackageName, char[] declaringTypeName, char[] selector, char[][] paramPackageNames, char[][] paramTypeNames){ >- if(paramTypeNames == null) return null; >- >- char[][] parameterNames = null; >- int length = paramTypeNames.length; >- >- char[] tName = CharOperation.concat(declaringTypePackageName,declaringTypeName,'.'); >- Object cachedType = this.completionEngine.typeCache.get(tName); >- >- IType type = null; >- if(cachedType != null) { >- if(cachedType != NO_ATTACHED_SOURCE && cachedType instanceof BinaryType) { >- type = (BinaryType)cachedType; >- } >- } else { >- // TODO (david) shouldn't it be NameLookup.ACCEPT_ALL ? >- type = this.nameLookup.findType(new String(tName), false, NameLookup.ACCEPT_CLASSES & NameLookup.ACCEPT_INTERFACES); >- if(type instanceof BinaryType){ >- if(((BinaryType)type).getSourceMapper() != null) { >- this.completionEngine.typeCache.put(tName, type); >- } else { >- this.completionEngine.typeCache.put(tName, NO_ATTACHED_SOURCE); >- type = null; >- } >- } else { >- type = null; >- } >- } >- >- if(type != null) { >- String[] args = new String[length]; >- for(int i = 0; i< length ; i++){ >- char[] parameterType = CharOperation.concat(paramPackageNames[i],paramTypeNames[i],'.'); >- args[i] = Signature.createTypeSignature(parameterType,true); >- } >- IMethod method = type.getMethod(new String(selector),args); >- try{ >- parameterNames = new char[length][]; >- String[] params = method.getParameterNames(); >- for(int i = 0; i< length ; i++){ >- parameterNames[i] = params[i].toCharArray(); >- } >- } catch(JavaModelException e){ >- parameterNames = null; >- } >- } >- // default parameters name >- if(parameterNames == null) { >- switch (length) { >- case 0 : >- parameterNames = new char[length][]; >- break; >- case 1 : >- parameterNames = ARGS1; >- break; >- case 2 : >- parameterNames = ARGS2; >- break; >- case 3 : >- parameterNames = ARGS3; >- break; >- case 4 : >- parameterNames = ARGS4; >- break; >- default : >- parameterNames = new char[length][]; >- for (int i = 0; i < length; i++) { >- parameterNames[i] = CharOperation.concat(ARG, String.valueOf(i).toCharArray()); >- } >- break; >- } >- >- } >- return parameterNames; >- } >- > protected void setDeclarationPackageName(char[] declarationPackageName) { > this.declarationPackageName = declarationPackageName; > } >@@ -259,4 +188,7 @@ > protected void setIsContructor(boolean isConstructor) { > this.isConstructor = isConstructor; > } >+ public void setOriginalSignature(char[] originalSignature) { >+ this.originalSignature = originalSignature; >+ } > } >Index: model/org/eclipse/jdt/core/CompletionProposal.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/core/CompletionProposal.java,v >retrieving revision 1.26 >diff -u -r1.26 CompletionProposal.java >--- model/org/eclipse/jdt/core/CompletionProposal.java 13 Jun 2005 15:57:54 -0000 1.26 >+++ model/org/eclipse/jdt/core/CompletionProposal.java 21 Jun 2005 18:22:53 -0000 >@@ -1359,37 +1359,52 @@ > > switch(this.completionKind) { > case ANONYMOUS_CLASS_DECLARATION: >- this.parameterNames = this.findMethodParameterNames( >- this.declarationPackageName, >- this.declarationTypeName, >- CharOperation.lastSegment(this.declarationTypeName, '.'), >- this.parameterPackageNames, >- this.parameterTypeNames); >+ try { >+ this.parameterNames = this.findMethodParameterNames( >+ this.declarationPackageName, >+ this.declarationTypeName, >+ CharOperation.lastSegment(this.declarationTypeName, '.'), >+ Signature.getParameterTypes(this.originalSignature == null ? this.signature : this.originalSignature)); >+ } catch(IllegalArgumentException e) { >+ // protection for invalid signature >+ if(this.parameterTypeNames != null) { >+ this.parameterNames = this.createDefaultParamterNames(this.parameterTypeNames.length); >+ } else { >+ this.parameterNames = null; >+ } >+ } > break; > case METHOD_REF: >- this.parameterNames = this.findMethodParameterNames( >- this.declarationPackageName, >- this.declarationTypeName, >- this.name, >- this.parameterPackageNames, >- this.parameterTypeNames); >- //this.parameterNames = this.findMethodParameterNames( >- // this.declarationSignature, >- // this.name, >- // Signature.getParameterTypes(this.getSignature())); >+ try { >+ this.parameterNames = this.findMethodParameterNames( >+ this.declarationPackageName, >+ this.declarationTypeName, >+ this.name, >+ Signature.getParameterTypes(this.originalSignature == null ? this.signature : this.originalSignature)); >+ } catch(IllegalArgumentException e) { >+ // protection for invalid signature >+ if(this.parameterTypeNames != null) { >+ this.parameterNames = this.createDefaultParamterNames(this.parameterTypeNames.length); >+ } else { >+ this.parameterNames = null; >+ } >+ } > break; > case METHOD_DECLARATION: >- this.parameterNames = this.findMethodParameterNames( >- this.declarationPackageName, >- this.declarationTypeName, >- this.name, >- this.parameterPackageNames, >- this.parameterTypeNames); >- //char[][] parameterTypes = Signature.getParameterTypes(this.getSignature(); >- ///this.parameterNames = this.findMethodParameterNames( >- // this.declarationSignature, >- // this.name, >- // parameterTypes); >+ try { >+ this.parameterNames = this.findMethodParameterNames( >+ this.declarationPackageName, >+ this.declarationTypeName, >+ this.name, >+ Signature.getParameterTypes(this.originalSignature == null ? this.signature : this.originalSignature)); >+ } catch(IllegalArgumentException e) { >+ // protection for invalid signature >+ if(this.parameterTypeNames != null) { >+ this.parameterNames = this.createDefaultParamterNames(this.parameterTypeNames.length); >+ } else { >+ this.parameterNames = null; >+ } >+ } > if(this.parameterNames != null) { > this.updateCompletion = true; > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 100009
:
23604
|
23635
| 23653