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 128899 Details for
Bug 203060
[codeassist] assert keyword should not be proposed when compliance level is set to 1.3
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed fix and tests
patch.txt (text/plain), 4.26 KB, created by
Srikanth Sankaran
on 2009-03-16 07:16:51 EDT
(
hide
)
Description:
Proposed fix and tests
Filename:
MIME Type:
Creator:
Srikanth Sankaran
Created:
2009-03-16 07:16:51 EDT
Size:
4.26 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#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.202 >diff -u -r1.202 CompletionParser.java >--- codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionParser.java 4 Mar 2009 11:57:21 -0000 1.202 >+++ codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionParser.java 16 Mar 2009 10:47:33 -0000 >@@ -4018,8 +4018,9 @@ > if(this.canBeExplicitConstructor == YES) { > canBeExplicitConstructorCall = true; > } >- >- keywords[count++]= Keywords.ASSERT; >+ if (this.options.complianceLevel >= ClassFileConstants.JDK1_4) { >+ keywords[count++]= Keywords.ASSERT; >+ } > keywords[count++]= Keywords.DO; > keywords[count++]= Keywords.FOR; > keywords[count++]= Keywords.IF; >@@ -4061,8 +4062,9 @@ > } > keywords[count++]= Keywords.BREAK; > keywords[count++]= Keywords.CASE; >- >- keywords[count++]= Keywords.ASSERT; >+ if (this.options.complianceLevel >= ClassFileConstants.JDK1_4) { >+ keywords[count++]= Keywords.ASSERT; >+ } > keywords[count++]= Keywords.DO; > keywords[count++]= Keywords.FOR; > keywords[count++]= Keywords.IF; >#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.196 >diff -u -r1.196 CompletionTests.java >--- src/org/eclipse/jdt/core/tests/model/CompletionTests.java 5 Mar 2009 13:49:11 -0000 1.196 >+++ src/org/eclipse/jdt/core/tests/model/CompletionTests.java 16 Mar 2009 10:48:03 -0000 >@@ -12,6 +12,7 @@ > > import java.io.IOException; > import java.util.Hashtable; >+import java.util.Map; > > import junit.framework.Test; > >@@ -30,6 +31,7 @@ > import org.eclipse.jdt.core.Signature; > import org.eclipse.jdt.core.eval.IEvaluationContext; > import org.eclipse.jdt.internal.codeassist.CompletionEngine; >+import org.eclipse.jdt.internal.compiler.impl.CompilerOptions; > import org.eclipse.jdt.internal.core.eval.EvaluationContextWrapper; > > public class CompletionTests extends AbstractJavaModelCompletionTests { >@@ -19480,4 +19482,44 @@ > requestor.getResults()); > } > >+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=203060: assert keyword should not be proposed when >+// compliance level is set to 1.3 >+public void test203060() throws JavaModelException { >+ this.workingCopies = new ICompilationUnit[1]; >+ this.workingCopies[0] = getWorkingCopy( >+ "/Completion/src/test/KeywordAssert.java", >+ "package test;" + >+ "public class CompletionKeywordAssert1 {\n" + >+ " void foo() {\n" + >+ " as\n" + >+ " }\n" + >+ "}\n"); >+ CompletionTestsRequestor requestor = new CompletionTestsRequestor(); >+ String str = this.workingCopies[0].getSource(); >+ String completeBehind = "as"; >+ int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); >+ >+ // Save current compliance settings >+ Map options = COMPLETION_PROJECT.getOptions(true); >+ Object savedOptionCompliance = options.get(CompilerOptions.OPTION_Compliance); >+ >+ // Verify that at 1.3 assert is not proposed. >+ options.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_3); >+ COMPLETION_PROJECT.setOptions(options); >+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); >+ assertEquals("", requestor.getResults()); >+ >+ // Verify that at 1.4 assert IS proposed. >+ options.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_4); >+ COMPLETION_PROJECT.setOptions(options); >+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); >+ assertEquals( >+ "element:assert completion:assert relevance:"+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE+ R_NON_RESTRICTED), >+ requestor.getResults()); >+ >+ // Restore compliance settings. >+ options.put(CompilerOptions.OPTION_Compliance, savedOptionCompliance); >+ COMPLETION_PROJECT.setOptions(options); >+} >+ > }
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 203060
:
128899
|
129035