### 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]{})\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) {