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 99908 Details for
Bug 231747
[assist] UnsupportedOperationException even when the context is extended
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Updated patch
bug231747_002.txt (text/plain), 6.64 KB, created by
David Audel
on 2008-05-13 05:14:48 EDT
(
hide
)
Description:
Updated patch
Filename:
MIME Type:
Creator:
David Audel
Created:
2008-05-13 05:14:48 EDT
Size:
6.64 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core.tests.model >Index: src/org/eclipse/jdt/core/tests/model/CompletionContextTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionContextTests.java,v >retrieving revision 1.11 >diff -u -r1.11 CompletionContextTests.java >--- src/org/eclipse/jdt/core/tests/model/CompletionContextTests.java 12 May 2008 15:25:59 -0000 1.11 >+++ src/org/eclipse/jdt/core/tests/model/CompletionContextTests.java 13 May 2008 09:11:19 -0000 >@@ -4864,4 +4864,39 @@ > "}", > result.context); > } >+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=231747 >+public void test0165() throws JavaModelException { >+ this.workingCopies = new ICompilationUnit[1]; >+ this.workingCopies[0] = getWorkingCopy( >+ "/Completion/src3/test/X.java", >+ "package test;\n" + >+ "public class X {\n" + >+ " class Y {\n" + >+ " }\n" + >+ " class Y {\n" + >+ " int var;\n" + >+ " void foo() {\n" + >+ " var\n" + >+ " }\n" + >+ " }\n" + >+ "}"); >+ >+ String str = this.workingCopies[0].getSource(); >+ int tokenStart = -1; >+ int tokenEnd = -1; >+ int cursorLocation = str.lastIndexOf("var") + "var".length(); >+ >+ CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation, false, true, "I"); >+ >+ assertResults( >+ "completion offset="+(cursorLocation)+"\n" + >+ "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + >+ "completion token=null\n" + >+ "completion token kind=TOKEN_KIND_UNKNOWN\n" + >+ "expectedTypesSignatures=null\n" + >+ "expectedTypesKeys=null\n" + >+ "completion token location=UNKNOWN\n" + >+ "visibleElements={}", >+ result.context); >+} > } >#P org.eclipse.jdt.core >Index: codeassist/org/eclipse/jdt/internal/codeassist/InternalCompletionContext.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/InternalCompletionContext.java,v >retrieving revision 1.9 >diff -u -r1.9 InternalCompletionContext.java >--- codeassist/org/eclipse/jdt/internal/codeassist/InternalCompletionContext.java 6 Mar 2008 15:31:28 -0000 1.9 >+++ codeassist/org/eclipse/jdt/internal/codeassist/InternalCompletionContext.java 13 May 2008 09:11:21 -0000 >@@ -35,6 +35,7 @@ > protected int tokenKind; > protected int tokenLocation; > >+ protected boolean isExtended; > protected InternalExtendedCompletionContext extendedContext; > > protected void setExpectedTypesKeys(char[][] expectedTypesKeys) { >@@ -45,6 +46,10 @@ > this.expectedTypesSignatures = expectedTypesSignatures; > } > >+ protected void setExtended() { >+ this.isExtended = true; >+ } >+ > protected void setExtendedData( > ITypeRoot typeRoot, > CompilationUnitDeclaration compilationUnitDeclaration, >@@ -53,6 +58,7 @@ > ASTNode astNode, > WorkingCopyOwner owner, > CompletionParser parser) { >+ this.isExtended = true; > this.extendedContext = > new InternalExtendedCompletionContext( > this, >Index: codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java,v >retrieving revision 1.367 >diff -u -r1.367 CompletionEngine.java >--- codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java 12 May 2008 08:18:47 -0000 1.367 >+++ codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java 13 May 2008 09:11:21 -0000 >@@ -2311,7 +2311,9 @@ > if(this.noProposal && this.problem != null) { > if(!contextAccepted) { > contextAccepted = true; >- this.requestor.acceptContext(new CompletionContext()); >+ CompletionContext context = new CompletionContext(); >+ if (this.requestor.isExtendedContextRequired()) context.setExtended(); >+ this.requestor.acceptContext(context); > } > this.requestor.completionFailure(this.problem); > if(DEBUG) { >@@ -2344,7 +2346,9 @@ > } > if(!contextAccepted) { > contextAccepted = true; >- this.requestor.acceptContext(new CompletionContext()); >+ CompletionContext context = new CompletionContext(); >+ if (this.requestor.isExtendedContextRequired()) context.setExtended(); >+ this.requestor.acceptContext(context); > } > if(this.requestor != null){ > this.requestor.endReporting(); >@@ -2565,6 +2569,7 @@ > CompletionContext context = new CompletionContext(); > context.setOffset(completionPosition - this.offset); > context.setTokenKind(CompletionContext.TOKEN_KIND_UNKNOWN); >+ if (this.requestor.isExtendedContextRequired()) context.setExtended(); > this.requestor.acceptContext(context); > } > this.requestor.completionFailure(this.problem); >@@ -2610,6 +2615,7 @@ > CompletionContext context = new CompletionContext(); > context.setTokenKind(CompletionContext.TOKEN_KIND_UNKNOWN); > context.setOffset(completionPosition - this.offset); >+ if (this.requestor.isExtendedContextRequired()) context.setExtended(); > this.requestor.acceptContext(context); > } > this.requestor.endReporting(); >Index: model/org/eclipse/jdt/core/CompletionContext.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/core/CompletionContext.java,v >retrieving revision 1.13 >diff -u -r1.13 CompletionContext.java >--- model/org/eclipse/jdt/core/CompletionContext.java 28 Apr 2008 19:45:56 -0000 1.13 >+++ model/org/eclipse/jdt/core/CompletionContext.java 13 May 2008 09:11:22 -0000 >@@ -123,7 +123,7 @@ > * @since 3.4 > */ > public boolean isExtended() { >- return this.extendedContext != null; >+ return this.isExtended; > } > > /** >@@ -275,7 +275,7 @@ > * @since 3.4 > */ > public IJavaElement getEnclosingElement() { >- if (!this.isExtended()) throw new UnsupportedOperationException("Operation only supported in extended context"); //$NON-NLS-1$ >+ if (!this.isExtended) throw new UnsupportedOperationException("Operation only supported in extended context"); //$NON-NLS-1$ > > if (this.extendedContext == null) return null; > >@@ -320,7 +320,7 @@ > * @since 3.4 > */ > public IJavaElement[] getVisibleElements(String typeSignature) { >- if (!this.isExtended()) throw new UnsupportedOperationException("Operation only supported in extended context"); //$NON-NLS-1$ >+ if (!this.isExtended) throw new UnsupportedOperationException("Operation only supported in extended context"); //$NON-NLS-1$ > > if (this.extendedContext == null) return new IJavaElement[0]; >
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 231747
:
99899
| 99908