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 82093 Details for
Bug 207572
[select] codeselect not available if unterminated string literal
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Better patch
bug207572_003.txt (text/plain), 5.86 KB, created by
David Audel
on 2007-11-05 09:27:18 EST
(
hide
)
Description:
Better patch
Filename:
MIME Type:
Creator:
David Audel
Created:
2007-11-05 09:27:18 EST
Size:
5.86 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core.tests.model >Index: src/org/eclipse/jdt/core/tests/model/ResolveTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ResolveTests.java,v >retrieving revision 1.82 >diff -u -r1.82 ResolveTests.java >--- src/org/eclipse/jdt/core/tests/model/ResolveTests.java 26 Sep 2007 14:23:00 -0000 1.82 >+++ src/org/eclipse/jdt/core/tests/model/ResolveTests.java 5 Nov 2007 10:20:19 -0000 >@@ -2262,6 +2262,30 @@ > elements > ); > } >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=207572 >+public void testSelectOnCursor2() throws JavaModelException { >+ ICompilationUnit cu = getWorkingCopy( >+ "/Resolve/src/AType.java", >+ "public class X {\n" + >+ " Object o;\n" + >+ "\n" + >+ " String foo() {\n" + >+ " return \"aaa\n" + >+ " }\n" + >+ "}n"); >+ >+ String str = cu.getSource(); >+ >+ int start = str.indexOf("foo") + "fo".length(); >+ int length = 0; >+ IJavaElement[] elements = cu.codeSelect(start, length); >+ assertElementsEqual( >+ "Unexpected elements", >+ "foo() [in X [in [Working copy] AType.java [in <default> [in src [in Resolve]]]]]", >+ elements >+ ); >+} >+ > > /* > * Ensures that the first type is found when defined in 2 different roots by working copies. >#P org.eclipse.jdt.core >Index: codeassist/org/eclipse/jdt/internal/codeassist/SelectionEngine.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/SelectionEngine.java,v >retrieving revision 1.139 >diff -u -r1.139 SelectionEngine.java >--- codeassist/org/eclipse/jdt/internal/codeassist/SelectionEngine.java 27 Jun 2007 13:44:24 -0000 1.139 >+++ codeassist/org/eclipse/jdt/internal/codeassist/SelectionEngine.java 5 Nov 2007 10:20:21 -0000 >@@ -400,7 +400,7 @@ > > // compute start and end of the last token > scanner.resetTo(nextCharacterPosition, end); >- do { >+ isolateLastName: do { > try { > token = scanner.getNextToken(); > } catch (InvalidInputException e) { >@@ -420,6 +420,7 @@ > lastIdentifierStart = scanner.startPosition; > lastIdentifierEnd = scanner.currentPosition - 1; > lastIdentifier = scanner.getCurrentTokenSource(); >+ break isolateLastName; > } > break; > } >@@ -428,50 +429,48 @@ > scanner.resetTo(selectionStart, selectionEnd); > > boolean expectingIdentifier = true; >- try { >- do { >+ do { >+ try { > token = scanner.getNextToken(); >- >- switch (token) { >- case TerminalTokens.TokenNamethis : >- case TerminalTokens.TokenNamesuper : >- case TerminalTokens.TokenNameIdentifier : >- if (!expectingIdentifier) >- return false; >- lastIdentifier = scanner.getCurrentTokenSource(); >- lastIdentifierStart = scanner.startPosition; >- lastIdentifierEnd = scanner.currentPosition - 1; >- if(lastIdentifierEnd > selectionEnd) { >- lastIdentifierEnd = selectionEnd; >- lastIdentifier = CharOperation.subarray(lastIdentifier, 0,lastIdentifierEnd - lastIdentifierStart + 1); >- } >- >- expectingIdentifier = false; >- break; >- case TerminalTokens.TokenNameDOT : >- if (expectingIdentifier) >- return false; >- expectingIdentifier = true; >- break; >- case TerminalTokens.TokenNameEOF : >- if (expectingIdentifier) >- return false; >- break; >- case TerminalTokens.TokenNameLESS : >- if(!checkTypeArgument(scanner)) >- return false; >- break; >- case TerminalTokens.TokenNameAT: >- if(scanner.startPosition != scanner.initialPosition) >- return false; >- break; >- default : >+ } catch (InvalidInputException e) { >+ return false; >+ } >+ switch (token) { >+ case TerminalTokens.TokenNamethis : >+ case TerminalTokens.TokenNamesuper : >+ case TerminalTokens.TokenNameIdentifier : >+ if (!expectingIdentifier) > return false; >- } >- } while (token != TerminalTokens.TokenNameEOF); >- } catch (InvalidInputException e) { >- return false; >- } >+ lastIdentifier = scanner.getCurrentTokenSource(); >+ lastIdentifierStart = scanner.startPosition; >+ lastIdentifierEnd = scanner.currentPosition - 1; >+ if(lastIdentifierEnd > selectionEnd) { >+ lastIdentifierEnd = selectionEnd; >+ lastIdentifier = CharOperation.subarray(lastIdentifier, 0,lastIdentifierEnd - lastIdentifierStart + 1); >+ } >+ expectingIdentifier = false; >+ break; >+ case TerminalTokens.TokenNameDOT : >+ if (expectingIdentifier) >+ return false; >+ expectingIdentifier = true; >+ break; >+ case TerminalTokens.TokenNameEOF : >+ if (expectingIdentifier) >+ return false; >+ break; >+ case TerminalTokens.TokenNameLESS : >+ if(!checkTypeArgument(scanner)) >+ return false; >+ break; >+ case TerminalTokens.TokenNameAT: >+ if(scanner.startPosition != scanner.initialPosition) >+ return false; >+ break; >+ default : >+ return false; >+ } >+ } while (token != TerminalTokens.TokenNameEOF); > } > if (lastIdentifierStart > 0) { > this.actualSelectionStart = lastIdentifierStart; >@@ -481,13 +480,16 @@ > } > return false; > } >- private boolean checkTypeArgument(Scanner scanner) throws InvalidInputException { >+ private boolean checkTypeArgument(Scanner scanner) { > int depth = 1; > int token; > StringBuffer buffer = new StringBuffer(); > do { >- token = scanner.getNextToken(); >- >+ try { >+ token = scanner.getNextToken(); >+ } catch (InvalidInputException e) { >+ return false; >+ } > switch(token) { > case TerminalTokens.TokenNameLESS : > depth++;
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 207572
:
81310
| 82093