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 91278 Details for
Bug 220940
Get unexpected NaN value from IMemberValuePair
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed fix and regression test
220940.txt (text/plain), 4.42 KB, created by
Jerome Lanneluc
on 2008-03-01 13:08:53 EST
(
hide
)
Description:
Proposed fix and regression test
Filename:
MIME Type:
Creator:
Jerome Lanneluc
Created:
2008-03-01 13:08:53 EST
Size:
4.42 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core.tests.model >Index: src/org/eclipse/jdt/core/tests/model/CompilationUnitTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompilationUnitTests.java,v >retrieving revision 1.60 >diff -u -r1.60 CompilationUnitTests.java >--- src/org/eclipse/jdt/core/tests/model/CompilationUnitTests.java 27 Feb 2008 14:50:29 -0000 1.60 >+++ src/org/eclipse/jdt/core/tests/model/CompilationUnitTests.java 1 Mar 2008 18:04:56 -0000 >@@ -802,6 +802,23 @@ > } > > /* >+ * Ensure that a simple name member annotation with an array {null} value is correct. >+ * (regression test for https://bugs.eclipse.org/bugs/show_bug.cgi?id=220940 ) >+ */ >+public void testAnnotations26() throws CoreException { >+ createWorkingCopy( >+ "package p;\n" + >+ "@MyAnnot(value={null})\n" + >+ "public class Y {\n" + >+ "}" >+ ); >+ IAnnotation[] annotations = this.workingCopy.getType("Y").getAnnotations(); >+ assertAnnotationsEqual( >+ "@MyAnnot([unknown]{<null>})\n", >+ annotations); >+} >+ >+/* > * Ensures that the categories for a class are correct. > */ > public void testGetCategories01() throws CoreException { >#P org.eclipse.jdt.core >Index: model/org/eclipse/jdt/internal/core/LocalVariable.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/LocalVariable.java,v >retrieving revision 1.24 >diff -u -r1.24 LocalVariable.java >--- model/org/eclipse/jdt/internal/core/LocalVariable.java 26 Feb 2008 10:11:46 -0000 1.24 >+++ model/org/eclipse/jdt/internal/core/LocalVariable.java 1 Mar 2008 18:04:58 -0000 >@@ -21,6 +21,7 @@ > import org.eclipse.jdt.internal.compiler.ast.ClassLiteralAccess; > import org.eclipse.jdt.internal.compiler.ast.Expression; > import org.eclipse.jdt.internal.compiler.ast.Literal; >+import org.eclipse.jdt.internal.compiler.ast.NullLiteral; > import org.eclipse.jdt.internal.compiler.ast.QualifiedNameReference; > import org.eclipse.jdt.internal.compiler.ast.SingleNameReference; > import org.eclipse.jdt.internal.core.util.MementoTokenizer; >@@ -154,7 +155,9 @@ > * Creates the value wrapper from the given expression, and sets the valueKind on the given memberValuePair > */ > private Object getAnnotationMemberValue(MemberValuePair memberValuePair, Expression expression, JavaElement parentElement) { >- if (expression instanceof Literal) { >+ if (expression instanceof NullLiteral) { >+ return null; >+ } else if (expression instanceof Literal) { > ((Literal) expression).computeConstant(); > return Util.getAnnotationMemberValue(memberValuePair, expression.constant); > } else if (expression instanceof org.eclipse.jdt.internal.compiler.ast.Annotation) { >Index: model/org/eclipse/jdt/internal/core/CompilationUnitStructureRequestor.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CompilationUnitStructureRequestor.java,v >retrieving revision 1.76 >diff -u -r1.76 CompilationUnitStructureRequestor.java >--- model/org/eclipse/jdt/internal/core/CompilationUnitStructureRequestor.java 22 Nov 2007 15:05:51 -0000 1.76 >+++ model/org/eclipse/jdt/internal/core/CompilationUnitStructureRequestor.java 1 Mar 2008 18:04:58 -0000 >@@ -27,6 +27,7 @@ > import org.eclipse.jdt.internal.compiler.ast.ImportReference; > import org.eclipse.jdt.internal.compiler.ast.Literal; > import org.eclipse.jdt.internal.compiler.ast.MemberValuePair; >+import org.eclipse.jdt.internal.compiler.ast.NullLiteral; > import org.eclipse.jdt.internal.compiler.ast.QualifiedNameReference; > import org.eclipse.jdt.internal.compiler.ast.SingleNameReference; > import org.eclipse.jdt.internal.compiler.parser.Parser; >@@ -610,7 +611,9 @@ > * Creates the value from the given expression, and sets the valueKind on the given memberValuePair > */ > private Object getMemberValue(org.eclipse.jdt.internal.core.MemberValuePair memberValuePair, Expression expression) { >- if (expression instanceof Literal) { >+ if (expression instanceof NullLiteral) { >+ return null; >+ } else if (expression instanceof Literal) { > ((Literal) expression).computeConstant(); > return Util.getAnnotationMemberValue(memberValuePair, expression.constant); > } else if (expression instanceof org.eclipse.jdt.internal.compiler.ast.Annotation) {
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 220940
: 91278