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 183977 Details for
Bug 331271
[assist] Reconsider assumption to filter not yet declared fields from being proposed
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
proposed fix
patch331271.txt (text/plain), 4.78 KB, created by
Ayushman Jain
on 2010-11-27 08:44:40 EST
(
hide
)
Description:
proposed fix
Filename:
MIME Type:
Creator:
Ayushman Jain
Created:
2010-11-27 08:44:40 EST
Size:
4.78 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: codeassist/org/eclipse/jdt/internal/codeassist/InternalExtendedCompletionContext.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/InternalExtendedCompletionContext.java,v >retrieving revision 1.21 >diff -u -r1.21 InternalExtendedCompletionContext.java >--- codeassist/org/eclipse/jdt/internal/codeassist/InternalExtendedCompletionContext.java 7 Oct 2010 14:11:29 -0000 1.21 >+++ codeassist/org/eclipse/jdt/internal/codeassist/InternalExtendedCompletionContext.java 27 Nov 2010 13:35:33 -0000 >@@ -19,6 +19,7 @@ > import org.eclipse.jdt.core.JavaModelException; > import org.eclipse.jdt.core.WorkingCopyOwner; > import org.eclipse.jdt.core.compiler.CharOperation; >+import org.eclipse.jdt.internal.codeassist.complete.CompletionNodeDetector; > import org.eclipse.jdt.internal.codeassist.complete.CompletionParser; > import org.eclipse.jdt.internal.codeassist.impl.AssistCompilationUnit; > import org.eclipse.jdt.internal.compiler.ast.ASTNode; >@@ -186,49 +187,41 @@ > break done; > } > } else { >- FieldDeclaration fieldDeclaration = fields[i]; >+ FieldDeclaration fieldDeclaration = fields[i]; > if (fieldDeclaration.initialization != null) { >- // completion is inside a field initializer >- searchVisibleVariablesAndMethods(scope, this.visibleLocalVariables, this.visibleFields, this.visibleMethods, notInJavadoc); >- // remove this field from visibleFields list because completion is being asked in its >- // intialization and so this has not yet been declared successfully. >- if (this.visibleFields.size > 0 && this.visibleFields.contains(fieldDeclaration.binding)) { >- this.visibleFields.remove(fieldDeclaration.binding); >- } >- int count = 0; >- while (count < this.visibleFields.size) { >- FieldBinding visibleField = (FieldBinding)this.visibleFields.elementAt(count); >- if (visibleField.id > fieldDeclaration.binding.id) { >- this.visibleFields.remove(visibleField); >- continue; >- } >- count++; >- } >- break done; >- } >- /*(Incase fieldDeclaration != null is not sufficient to infer that >- proposal is being asked inside initializer of field decl, use the below if >- block instead of the above) >- if (fieldDeclaration.initialization != null) { >- >+ boolean isInsideInitializer = false; > if (fieldDeclaration.initialization.sourceEnd > 0) { > if (fieldDeclaration.initialization.sourceStart <= astNode.sourceStart && > astNode.sourceEnd <= fieldDeclaration.initialization.sourceEnd) { > // completion is inside a field initializer >- searchVisibleVariablesAndMethods(scope, this.visibleLocalVariables, this.visibleFields, this.visibleMethods, notInJavadoc); >+ isInsideInitializer = true; > } > } else { // The sourceEnd may not yet be set > CompletionNodeDetector detector = new CompletionNodeDetector(this.assistNode, fieldDeclaration.initialization); > if (detector.containsCompletionNode()) { >- searchVisibleVariablesAndMethods(scope, this.visibleLocalVariables, this.visibleFields, this.visibleMethods, notInJavadoc); >+ // completion is inside a field initializer >+ isInsideInitializer = true; > } > } >- // remove this field from visibleFields list because completion is being asked in its >- // intialization and so this has not yet been declared successfully. >- if (this.visibleFields.size > 0 && this.visibleFields.contains(fieldDeclaration.binding)) { >- this.visibleFields.remove(fieldDeclaration.binding); >+ if (isInsideInitializer) { >+ searchVisibleVariablesAndMethods(scope, this.visibleLocalVariables, this.visibleFields, this.visibleMethods, notInJavadoc); >+ // remove this field from visibleFields list because completion is being asked in its >+ // intialization and so this has not yet been declared successfully. >+ if (this.visibleFields.size > 0 && this.visibleFields.contains(fieldDeclaration.binding)) { >+ this.visibleFields.remove(fieldDeclaration.binding); >+ } >+ int count = 0; >+ while (count < this.visibleFields.size) { >+ FieldBinding visibleField = (FieldBinding)this.visibleFields.elementAt(count); >+ if (visibleField.id > fieldDeclaration.binding.id) { >+ this.visibleFields.remove(visibleField); >+ continue; >+ } >+ count++; >+ } >+ break done; > } >- }*/ >+ } > } > } > }
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 Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 331271
: 183977