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 127331 Details for
Bug 266837
[model] SourceField.getConstant does not supply a value if type is fully qualified
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed patch
v01.txt (text/plain), 5.09 KB, created by
Frederic Fusier
on 2009-03-03 10:52:12 EST
(
hide
)
Description:
Proposed patch
Filename:
MIME Type:
Creator:
Frederic Fusier
Created:
2009-03-03 10:52:12 EST
Size:
5.09 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core.tests.model >Index: src/org/eclipse/jdt/core/tests/model/JavaSearchBugsTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaSearchBugsTests.java,v >retrieving revision 1.166 >diff -u -r1.166 JavaSearchBugsTests.java >--- src/org/eclipse/jdt/core/tests/model/JavaSearchBugsTests.java 3 Mar 2009 08:56:18 -0000 1.166 >+++ src/org/eclipse/jdt/core/tests/model/JavaSearchBugsTests.java 3 Mar 2009 15:51:25 -0000 >@@ -10622,4 +10622,25 @@ > } > } > >+/** >+ * @bug 266837: SourceField.getConstant does not supply a value if type is fully qualified >+ * @test Ensure that source field constant is not null when fully qualified type String is used >+ * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=266837" >+ */ >+public void testBug266837() throws Exception { >+ this.workingCopies = new ICompilationUnit[1]; >+ this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/Test.java", >+ "public class Test {\n" + >+ " private static final java.lang.String f266837 = \"myString\";\n" + >+ "}\n" >+ ); >+ SearchRequestor requestor = new SearchRequestor() { >+ public void acceptSearchMatch(SearchMatch searchMatch) throws CoreException { >+ IField sourceField = (IField) searchMatch.getElement(); >+ assertEquals("Unexpected source field constant!", "\"myString\"", sourceField.getConstant()); >+ } >+ }; >+ search("f266837", FIELD, DECLARATIONS, requestor); >+} >+ > } >\ No newline at end of file >Index: src/org/eclipse/jdt/core/tests/model/GetSourceTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/GetSourceTests.java,v >retrieving revision 1.25 >diff -u -r1.25 GetSourceTests.java >--- src/org/eclipse/jdt/core/tests/model/GetSourceTests.java 27 Jun 2008 16:02:38 -0000 1.25 >+++ src/org/eclipse/jdt/core/tests/model/GetSourceTests.java 3 Mar 2009 15:51:21 -0000 >@@ -85,7 +85,9 @@ > " static final char field4 = ' ';\n" + > " static final double field5 = 938245798324893D;\n" + > " static final float field6 = 123456f;\n" + >- " static final int field7 = 1<<0;\n" + >+ " static final String field7 = \"simple string\";\n" + >+ " static final java.lang.String field8 = \"qualified string\";\n" + >+ " static final int field9 = 1<<0;\n" + > "}"; > createFile("/P/p/Constants.java", cuSource); > } >@@ -158,6 +160,16 @@ > > public void testFieldConstant07() throws CoreException { > IField field = getConstantField("field7"); >+ assertEquals("Wrong value", "\"simple string\"", field.getConstant()); >+ } >+ >+ public void testFieldConstant08() throws CoreException { >+ IField field = getConstantField("field8"); >+ assertEquals("Wrong value", "\"qualified string\"", field.getConstant()); >+ } >+ >+ public void testFieldConstant09() throws CoreException { >+ IField field = getConstantField("field9"); > > Object constant = field.getConstant(); > assertNull("Should not be a constant", constant); >Index: src/org/eclipse/jdt/core/tests/model/AbstractJavaSearchTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/AbstractJavaSearchTests.java,v >retrieving revision 1.38 >diff -u -r1.38 AbstractJavaSearchTests.java >--- src/org/eclipse/jdt/core/tests/model/AbstractJavaSearchTests.java 16 Jan 2009 14:29:34 -0000 1.38 >+++ src/org/eclipse/jdt/core/tests/model/AbstractJavaSearchTests.java 3 Mar 2009 15:51:21 -0000 >@@ -825,6 +825,9 @@ > protected void search(String patternString, int searchFor, int limitTo, IJavaSearchScope scope) throws CoreException { > search(patternString, searchFor, limitTo, EXACT_RULE, scope, this.resultCollector); > } >+ protected void search(String patternString, int searchFor, int limitTo, SearchRequestor requestor) throws CoreException { >+ search(patternString, searchFor, limitTo, EXACT_RULE, getJavaSearchScope(), requestor); >+ } > protected void search(String patternString, int searchFor, int limitTo, int matchRule, IJavaSearchScope scope) throws CoreException { > search(patternString, searchFor, limitTo, matchRule, scope, this.resultCollector); > } >#P org.eclipse.jdt.core >Index: model/org/eclipse/jdt/internal/core/SourceField.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SourceField.java,v >retrieving revision 1.47 >diff -u -r1.47 SourceField.java >--- model/org/eclipse/jdt/internal/core/SourceField.java 27 Jun 2008 16:03:51 -0000 1.47 >+++ model/org/eclipse/jdt/internal/core/SourceField.java 3 Mar 2009 15:51:27 -0000 >@@ -85,6 +85,8 @@ > } > } else if (signature.equals("QString;")) {//$NON-NLS-1$ > constant = constantSource; >+ } else if (signature.equals("Qjava.lang.String;")) {//$NON-NLS-1$ >+ constant = constantSource; > } > } catch (NumberFormatException e) { > // not a parsable constant
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
Flags:
jerome_lanneluc
:
review+
Actions:
View
|
Diff
Attachments on
bug 266837
: 127331