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 130200 Details for
Bug 269493
[assist] Keywords are not proposed in a for statement without block
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Revised patch
patch.txt (text/plain), 12.56 KB, created by
Srikanth Sankaran
on 2009-03-30 01:57:25 EDT
(
hide
)
Description:
Revised patch
Filename:
MIME Type:
Creator:
Srikanth Sankaran
Created:
2009-03-30 01:57:25 EDT
Size:
12.56 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core.tests.model >Index: src/org/eclipse/jdt/core/tests/model/CompletionTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionTests.java,v >retrieving revision 1.197 >diff -u -r1.197 CompletionTests.java >--- src/org/eclipse/jdt/core/tests/model/CompletionTests.java 20 Mar 2009 10:39:24 -0000 1.197 >+++ src/org/eclipse/jdt/core/tests/model/CompletionTests.java 30 Mar 2009 05:47:02 -0000 >@@ -19627,4 +19627,251 @@ > COMPLETION_PROJECT.setOptions(options); > } > } >+ >+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=269493: Keywords are not proposed in a for loop without block >+// All the tests with the prefix test269493 are designed to offer coverage for all the changes that went >+// into this fix. >+public void test269493() throws JavaModelException { >+ this.workingCopies = new ICompilationUnit[1]; >+ this.workingCopies[0] = getWorkingCopy( >+ "/Completion/src/test/Test269493.java", >+ "package test;" + >+ "public class Test269493 {\n" + >+ " void foo() {\n" + >+ " for (int i = 0; i < 10; i++)\n" + >+ " ass\n" + >+ " }\n" + >+ "}\n" + >+ "}\n"); >+ >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(); >+ String str = this.workingCopies[0].getSource(); >+ String completeBehind = "ass"; >+ int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); >+ >+ // Save current compliance settings >+ Map options = COMPLETION_PROJECT.getOptions(true); >+ Object savedOptionCompliance = options.get(CompilerOptions.OPTION_Compliance); >+ >+ try { >+ options.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_4); >+ COMPLETION_PROJECT.setOptions(options); >+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); >+ assertResults( >+ "assert[KEYWORD]{assert, null, null, assert, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}", >+ requestor.getResults()); >+ } finally { >+ // Restore compliance settings. >+ options.put(CompilerOptions.OPTION_Compliance, savedOptionCompliance); >+ COMPLETION_PROJECT.setOptions(options); >+ } >+} >+ >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=269493: Keywords are not proposed in a for loop without block >+public void test269493b() throws JavaModelException { >+ this.workingCopies = new ICompilationUnit[1]; >+ this.workingCopies[0] = getWorkingCopy( >+ "/Completion/src/test/Test269493.java", >+ "package test;" + >+ "public class Test269493 {\n" + >+ " void foo() {\n" + >+ " for (int i = 0; i < 10; i++)\n" + >+ " ret\n" + >+ " }\n" + >+ "}\n" + >+ "}\n"); >+ >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(); >+ String str = this.workingCopies[0].getSource(); >+ String completeBehind = "ret"; >+ int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); >+ >+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); >+ assertResults( >+ "return[KEYWORD]{return, null, null, return, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}", >+ requestor.getResults()); >+} >+ >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=269493: Keywords are not proposed in a for loop without block >+public void test269493c() throws JavaModelException { >+ this.workingCopies = new ICompilationUnit[1]; >+ this.workingCopies[0] = getWorkingCopy( >+ "/Completion/src/test/Test269493.java", >+ "package test;" + >+ "public class Test269493 {\n" + >+ " void foo() {\n" + >+ " for (int i = 0; i < 10; i++)\n" + >+ " bre\n" + >+ " }\n" + >+ "}\n" + >+ "}\n"); >+ >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(); >+ String str = this.workingCopies[0].getSource(); >+ String completeBehind = "bre"; >+ int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); >+ >+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); >+ assertResults( >+ "break[KEYWORD]{break, null, null, break, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}", >+ requestor.getResults()); >+} >+ >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=269493: Keywords are not proposed in a for loop without block >+public void test269493d() throws JavaModelException { >+ this.workingCopies = new ICompilationUnit[1]; >+ this.workingCopies[0] = getWorkingCopy( >+ "/Completion/src/test/Test269493.java", >+ "package test;" + >+ "public class Test269493 {\n" + >+ " void foo() {\n" + >+ " for (int i = 0; i < 10; i++)\n" + >+ " cont\n" + >+ " }\n" + >+ "}\n" + >+ "}\n"); >+ >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(); >+ String str = this.workingCopies[0].getSource(); >+ String completeBehind = "cont"; >+ int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); >+ >+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); >+ assertResults( >+ "continue[KEYWORD]{continue, null, null, continue, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}", >+ requestor.getResults()); >+} >+ >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=269493: Keywords are not proposed in a for loop without block >+public void test269493e() throws JavaModelException { >+ this.workingCopies = new ICompilationUnit[1]; >+ this.workingCopies[0] = getWorkingCopy( >+ "/Completion/src/test/Test269493.java", >+ "package test;" + >+ "public class Test269493 {\n" + >+ " int foo(int p) {\n" + >+ " if (p == 0)\n" + >+ " return 0;\n" + >+ " else\n" + >+ " ret\n" + >+ " }\n" + >+ "}\n" + >+ "}\n"); >+ >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(); >+ String str = this.workingCopies[0].getSource(); >+ String completeBehind = "ret"; >+ int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); >+ >+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); >+ assertResults( >+ "return[KEYWORD]{return, null, null, return, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}", >+ requestor.getResults()); >+} >+ >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=269493: Keywords are not proposed in a for loop without block >+public void test269493f() throws JavaModelException { >+ this.workingCopies = new ICompilationUnit[1]; >+ this.workingCopies[0] = getWorkingCopy( >+ "/Completion/src/test/Test269493.java", >+ "package test;" + >+ "public class Test269493 {\n" + >+ " int foo(int p) {\n" + >+ " if (p == 0)\n" + >+ " return 0;\n" + >+ " els\n" + >+ " }\n" + >+ "}\n" + >+ "}\n"); >+ >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(); >+ String str = this.workingCopies[0].getSource(); >+ String completeBehind = "els"; >+ int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); >+ >+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); >+ assertResults( >+ "else[KEYWORD]{else, null, null, else, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}", >+ requestor.getResults()); >+} >+ >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=269493: Keywords are not proposed in a for loop without block >+public void test269493g() throws JavaModelException { >+ this.workingCopies = new ICompilationUnit[1]; >+ this.workingCopies[0] = getWorkingCopy( >+ "/Completion/src/test/Test269493.java", >+ "package test;" + >+ "public class Test269493 {\n" + >+ " int foo(int p) {\n" + >+ " els\n" + >+ " }\n" + >+ "}\n" + >+ "}\n"); >+ >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(); >+ String str = this.workingCopies[0].getSource(); >+ String completeBehind = "els"; >+ int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); >+ >+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); >+ assertResults( >+ "", >+ requestor.getResults()); >+} >+ >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=269493: Keywords are not proposed in a for loop without block >+public void test269493h() throws JavaModelException { >+ this.workingCopies = new ICompilationUnit[1]; >+ this.workingCopies[0] = getWorkingCopy( >+ "/Completion/src/test/Test269493.java", >+ "package test;" + >+ "public class Test269493 {\n" + >+ " int foo(int p) {\n" + >+ " if (p == 0)\n" + >+ " return 0;\n" + >+ " else\n" + >+ " els\n" + >+ " }\n" + >+ "}\n" + >+ "}\n"); >+ >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(); >+ String str = this.workingCopies[0].getSource(); >+ String completeBehind = "els"; >+ int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); >+ >+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); >+ assertResults( >+ "", >+ requestor.getResults()); >+} >+ >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=269493: Keywords are not proposed in a for loop without block >+public void test269493i() throws JavaModelException { >+ this.workingCopies = new ICompilationUnit[1]; >+ this.workingCopies[0] = getWorkingCopy( >+ "/Completion/src/test/Test269493.java", >+ "package test;" + >+ "public class Test269493 {\n" + >+ " int foo(int p) {\n" + >+ " if (p == 0) {\n" + >+ " return 0;\n" + >+ " }\n" + >+ " else\n" + >+ " els\n" + >+ " }\n" + >+ "}\n" + >+ "}\n"); >+ >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(); >+ String str = this.workingCopies[0].getSource(); >+ String completeBehind = "els"; >+ int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); >+ >+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); >+ assertResults( >+ "", >+ requestor.getResults()); >+} >+ > } >#P org.eclipse.jdt.core >Index: codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionParser.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionParser.java,v >retrieving revision 1.203 >diff -u -r1.203 CompletionParser.java >--- codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionParser.java 20 Mar 2009 10:39:13 -0000 1.203 >+++ codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionParser.java 30 Mar 2009 05:47:07 -0000 >@@ -3595,6 +3595,7 @@ > if (topKnownElementKind(COMPLETION_OR_ASSIST_PARSER) == K_CONTROL_STATEMENT_DELIMITER) { > popElement(K_CONTROL_STATEMENT_DELIMITER); > } >+ pushOnElementStack(K_CONTROL_STATEMENT_DELIMITER); > break; > case TokenNamewhile: > pushOnElementStack(K_BETWEEN_WHILE_AND_RIGHT_PAREN, this.bracketDepth); >@@ -4013,8 +4014,10 @@ > keywords[count++]= Keywords.THIS; > } > keywords[count++]= Keywords.NEW; >- >- if(kind == K_BLOCK_DELIMITER) { >+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=269493: Keywords are not proposed in a for >+ // loop without block. Completion while at K_CONTROL_STATEMENT_DELIMITER case needs to handled >+ // similar to the K_BLOCK_DELIMITER with minor differences. >+ if(kind == K_BLOCK_DELIMITER || kind == K_CONTROL_STATEMENT_DELIMITER) { > if(this.canBeExplicitConstructor == YES) { > canBeExplicitConstructorCall = true; > } >@@ -4044,6 +4047,8 @@ > keywords[count++]= Keywords.FINALLY; > break; > } >+ } else if(this.previousKind == K_CONTROL_STATEMENT_DELIMITER && this.previousInfo == IF) { >+ keywords[count++]= Keywords.ELSE; > } > if(isInsideLoop()) { > keywords[count++]= Keywords.CONTINUE; >@@ -4341,6 +4346,7 @@ > case K_FIELD_INITIALIZER_DELIMITER : return false; > case K_SWITCH_LABEL : return true; > case K_BLOCK_DELIMITER : >+ case K_CONTROL_STATEMENT_DELIMITER: > switch(this.elementInfoStack[i]) { > case FOR : > case DO : >@@ -4360,6 +4366,7 @@ > case K_METHOD_DELIMITER : return false; > case K_FIELD_INITIALIZER_DELIMITER : return false; > case K_BLOCK_DELIMITER : >+ case K_CONTROL_STATEMENT_DELIMITER: > switch(this.elementInfoStack[i]) { > case FOR : > case DO : >@@ -4379,6 +4386,7 @@ > case K_METHOD_DELIMITER : return false; > case K_FIELD_INITIALIZER_DELIMITER : return false; > case K_BLOCK_DELIMITER : return false; >+ case K_CONTROL_STATEMENT_DELIMITER: return false; // FWIW > case K_INSIDE_RETURN_STATEMENT : return true; > } > i--;
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 269493
:
129967
| 130200