View | Details | Raw Unified | Return to bug 220940
Collapse All | Expand All

(-)src/org/eclipse/jdt/core/tests/model/CompilationUnitTests.java (+17 lines)
Lines 802-807 Link Here
802
}
802
}
803
803
804
/*
804
/*
805
 * Ensure that a simple name member annotation with an array {null} value is correct.
806
 * (regression test for https://bugs.eclipse.org/bugs/show_bug.cgi?id=220940 )
807
 */
808
public void testAnnotations26() throws CoreException {
809
	createWorkingCopy(
810
		"package p;\n" +
811
		"@MyAnnot(value={null})\n" +
812
		"public class Y {\n" +
813
		"}"
814
	);
815
	IAnnotation[] annotations = this.workingCopy.getType("Y").getAnnotations();
816
	assertAnnotationsEqual(
817
		"@MyAnnot([unknown]{<null>})\n",
818
		annotations);
819
}
820
821
/*
805
 * Ensures that the categories for a class are correct.
822
 * Ensures that the categories for a class are correct.
806
 */
823
 */
807
public void testGetCategories01() throws CoreException {
824
public void testGetCategories01() throws CoreException {
(-)model/org/eclipse/jdt/internal/core/LocalVariable.java (-1 / +4 lines)
Lines 21-26 Link Here
21
import org.eclipse.jdt.internal.compiler.ast.ClassLiteralAccess;
21
import org.eclipse.jdt.internal.compiler.ast.ClassLiteralAccess;
22
import org.eclipse.jdt.internal.compiler.ast.Expression;
22
import org.eclipse.jdt.internal.compiler.ast.Expression;
23
import org.eclipse.jdt.internal.compiler.ast.Literal;
23
import org.eclipse.jdt.internal.compiler.ast.Literal;
24
import org.eclipse.jdt.internal.compiler.ast.NullLiteral;
24
import org.eclipse.jdt.internal.compiler.ast.QualifiedNameReference;
25
import org.eclipse.jdt.internal.compiler.ast.QualifiedNameReference;
25
import org.eclipse.jdt.internal.compiler.ast.SingleNameReference;
26
import org.eclipse.jdt.internal.compiler.ast.SingleNameReference;
26
import org.eclipse.jdt.internal.core.util.MementoTokenizer;
27
import org.eclipse.jdt.internal.core.util.MementoTokenizer;
Lines 154-160 Link Here
154
	 * Creates the value wrapper from the given expression, and sets the valueKind on the given memberValuePair
155
	 * Creates the value wrapper from the given expression, and sets the valueKind on the given memberValuePair
155
	 */
156
	 */
156
	private Object getAnnotationMemberValue(MemberValuePair memberValuePair, Expression expression, JavaElement parentElement) {
157
	private Object getAnnotationMemberValue(MemberValuePair memberValuePair, Expression expression, JavaElement parentElement) {
157
		if (expression instanceof Literal) {
158
		if (expression instanceof NullLiteral) {
159
			return null;
160
		} else if (expression instanceof Literal) {
158
			((Literal) expression).computeConstant();
161
			((Literal) expression).computeConstant();
159
			return Util.getAnnotationMemberValue(memberValuePair, expression.constant);
162
			return Util.getAnnotationMemberValue(memberValuePair, expression.constant);
160
		} else if (expression instanceof org.eclipse.jdt.internal.compiler.ast.Annotation) {
163
		} else if (expression instanceof org.eclipse.jdt.internal.compiler.ast.Annotation) {
(-)model/org/eclipse/jdt/internal/core/CompilationUnitStructureRequestor.java (-1 / +4 lines)
Lines 27-32 Link Here
27
import org.eclipse.jdt.internal.compiler.ast.ImportReference;
27
import org.eclipse.jdt.internal.compiler.ast.ImportReference;
28
import org.eclipse.jdt.internal.compiler.ast.Literal;
28
import org.eclipse.jdt.internal.compiler.ast.Literal;
29
import org.eclipse.jdt.internal.compiler.ast.MemberValuePair;
29
import org.eclipse.jdt.internal.compiler.ast.MemberValuePair;
30
import org.eclipse.jdt.internal.compiler.ast.NullLiteral;
30
import org.eclipse.jdt.internal.compiler.ast.QualifiedNameReference;
31
import org.eclipse.jdt.internal.compiler.ast.QualifiedNameReference;
31
import org.eclipse.jdt.internal.compiler.ast.SingleNameReference;
32
import org.eclipse.jdt.internal.compiler.ast.SingleNameReference;
32
import org.eclipse.jdt.internal.compiler.parser.Parser;
33
import org.eclipse.jdt.internal.compiler.parser.Parser;
Lines 610-616 Link Here
610
 * Creates the value from the given expression, and sets the valueKind on the given memberValuePair
611
 * Creates the value from the given expression, and sets the valueKind on the given memberValuePair
611
 */
612
 */
612
private Object getMemberValue(org.eclipse.jdt.internal.core.MemberValuePair memberValuePair, Expression expression) {
613
private Object getMemberValue(org.eclipse.jdt.internal.core.MemberValuePair memberValuePair, Expression expression) {
613
	if (expression instanceof Literal) {
614
	if (expression instanceof NullLiteral) {
615
		return null;
616
	} else if (expression instanceof Literal) {
614
		((Literal) expression).computeConstant();
617
		((Literal) expression).computeConstant();
615
		return Util.getAnnotationMemberValue(memberValuePair, expression.constant);
618
		return Util.getAnnotationMemberValue(memberValuePair, expression.constant);
616
	} else if (expression instanceof org.eclipse.jdt.internal.compiler.ast.Annotation) {
619
	} else if (expression instanceof org.eclipse.jdt.internal.compiler.ast.Annotation) {

Return to bug 220940