View | Details | Raw Unified | Return to bug 210565 | Differences between
and this patch

Collapse All | Expand All

(-)model/org/eclipse/jdt/internal/core/LocalVariable.java (+5 lines)
Lines 22-27 Link Here
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.QualifiedNameReference;
24
import org.eclipse.jdt.internal.compiler.ast.QualifiedNameReference;
25
import org.eclipse.jdt.internal.compiler.ast.SingleNameReference;
25
import org.eclipse.jdt.internal.core.util.MementoTokenizer;
26
import org.eclipse.jdt.internal.core.util.MementoTokenizer;
26
import org.eclipse.jdt.internal.core.util.Util;
27
import org.eclipse.jdt.internal.core.util.Util;
27
28
Lines 168-173 Link Here
168
			char[] qualifiedName = CharOperation.concatWith(((QualifiedNameReference) expression).tokens, '.');
169
			char[] qualifiedName = CharOperation.concatWith(((QualifiedNameReference) expression).tokens, '.');
169
			memberValuePair.valueKind = IMemberValuePair.K_QUALIFIED_NAME;
170
			memberValuePair.valueKind = IMemberValuePair.K_QUALIFIED_NAME;
170
			return new String(qualifiedName);		
171
			return new String(qualifiedName);		
172
		} else if (expression instanceof SingleNameReference) {
173
			char[] simpleName = ((SingleNameReference) expression).token;
174
			memberValuePair.valueKind = IMemberValuePair.K_SIMPLE_NAME;
175
			return new String(simpleName);		
171
		} else if (expression instanceof ArrayInitializer) {
176
		} else if (expression instanceof ArrayInitializer) {
172
			memberValuePair.valueKind = -1; // modified below by the first call to getMemberValue(...)
177
			memberValuePair.valueKind = -1; // modified below by the first call to getMemberValue(...)
173
			Expression[] expressions = ((ArrayInitializer) expression).expressions;
178
			Expression[] expressions = ((ArrayInitializer) expression).expressions;
(-)model/org/eclipse/jdt/internal/core/CompilationUnitStructureRequestor.java (+5 lines)
Lines 28-33 Link Here
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.QualifiedNameReference;
30
import org.eclipse.jdt.internal.compiler.ast.QualifiedNameReference;
31
import org.eclipse.jdt.internal.compiler.ast.SingleNameReference;
31
import org.eclipse.jdt.internal.compiler.parser.Parser;
32
import org.eclipse.jdt.internal.compiler.parser.Parser;
32
import org.eclipse.jdt.internal.compiler.util.HashtableOfObject;
33
import org.eclipse.jdt.internal.compiler.util.HashtableOfObject;
33
import org.eclipse.jdt.internal.core.util.ReferenceInfoAdapter;
34
import org.eclipse.jdt.internal.core.util.ReferenceInfoAdapter;
Lines 627-632 Link Here
627
		char[] qualifiedName = CharOperation.concatWith(((QualifiedNameReference) expression).tokens, '.');
628
		char[] qualifiedName = CharOperation.concatWith(((QualifiedNameReference) expression).tokens, '.');
628
		memberValuePair.valueKind = IMemberValuePair.K_QUALIFIED_NAME;
629
		memberValuePair.valueKind = IMemberValuePair.K_QUALIFIED_NAME;
629
		return new String(qualifiedName);		
630
		return new String(qualifiedName);		
631
	} else if (expression instanceof SingleNameReference) {
632
		char[] simpleName = ((SingleNameReference) expression).token;
633
		memberValuePair.valueKind = IMemberValuePair.K_SIMPLE_NAME;
634
		return new String(simpleName);		
630
	} else if (expression instanceof ArrayInitializer) {
635
	} else if (expression instanceof ArrayInitializer) {
631
		memberValuePair.valueKind = -1; // modified below by the first call to getMemberValue(...)
636
		memberValuePair.valueKind = -1; // modified below by the first call to getMemberValue(...)
632
		Expression[] expressions = ((ArrayInitializer) expression).expressions;
637
		Expression[] expressions = ((ArrayInitializer) expression).expressions;
(-)model/org/eclipse/jdt/core/IMemberValuePair.java (-2 / +11 lines)
Lines 105-110 Link Here
105
	int K_QUALIFIED_NAME = 12;
105
	int K_QUALIFIED_NAME = 12;
106
	
106
	
107
	/**
107
	/**
108
	 * Constant indicating that the value is a simple name represented by a {@link String}.
109
	 * This usually represents an enumeration's constant (e.g. "FIRST" when there is a
110
	 * static import for "MyEnum.FIRST"), but this would need to be further analyzed to ensure 
111
	 * that.
112
	 */
113
	int K_SIMPLE_NAME = 13;
114
	
115
	/**
108
	 * Constant indicating that the value kind is unknown at this stage. The value is unknown in the
116
	 * Constant indicating that the value kind is unknown at this stage. The value is unknown in the
109
	 * following cases:
117
	 * following cases:
110
	 * <ul>
118
	 * <ul>
Lines 121-127 Link Here
121
	 * If the value kind is unknown, the returned value is always either <code>null</code>, or an 
129
	 * If the value kind is unknown, the returned value is always either <code>null</code>, or an 
122
	 * array containing {@link Object}s and/or <code>null</code>s for unknown elements.
130
	 * array containing {@link Object}s and/or <code>null</code>s for unknown elements.
123
	 */
131
	 */
124
	int K_UNKNOWN = 13;
132
	int K_UNKNOWN = 14;
125
133
126
	/**
134
	/**
127
	 * Returns the member's name of this member-value pair.
135
	 * Returns the member's name of this member-value pair.
Lines 152-158 Link Here
152
	 * is an array. The value kind is one of the following constants:
160
	 * is an array. The value kind is one of the following constants:
153
	 * {@link #K_ANNOTATION}, {@link #K_BOOLEAN}, {@link #K_BYTE}, {@link #K_CHAR},
161
	 * {@link #K_ANNOTATION}, {@link #K_BOOLEAN}, {@link #K_BYTE}, {@link #K_CHAR},
154
	 * {@link #K_CLASS}, {@link #K_DOUBLE}, {@link #K_FLOAT}, {@link #K_INT}, {@link #K_LONG},
162
	 * {@link #K_CLASS}, {@link #K_DOUBLE}, {@link #K_FLOAT}, {@link #K_INT}, {@link #K_LONG},
155
	 * {@link #K_QUALIFIED_NAME}, {@link #K_SHORT}, {@link #K_STRING}, {@link #K_UNKNOWN}.
163
	 * {@link #K_QUALIFIED_NAME}, {@link #K_SIMPLE_NAME}, {@link #K_SHORT}, {@link #K_STRING}, 
164
	 * {@link #K_UNKNOWN}.
156
	 * 
165
	 * 
157
	 * @return the value kind of this member-value pair
166
	 * @return the value kind of this member-value pair
158
	 */
167
	 */
(-)src/org/eclipse/jdt/core/tests/model/CompilationUnitTests.java (+17 lines)
Lines 745-750 Link Here
745
}
745
}
746
746
747
/*
747
/*
748
 * Ensure that a simple name member annotation is correct.
749
 */
750
public void testAnnotations25() throws CoreException {
751
	createWorkingCopy(
752
		"package p;\n" +
753
		"import static MyEnum.FIRST;\n" +
754
		"@MyAnnot(simpleMember=FIRST)\n" +
755
		"public class Y {\n" +
756
		"}"
757
	);
758
	IAnnotation[] annotations = this.workingCopy.getType("Y").getAnnotations();
759
	assertAnnotationsEqual(
760
		"@MyAnnot(simpleMember=FIRST)\n",
761
		annotations);
762
}
763
764
/*
748
 * Ensures that the categories for a class are correct.
765
 * Ensures that the categories for a class are correct.
749
 */
766
 */
750
public void testGetCategories01() throws CoreException {
767
public void testGetCategories01() throws CoreException {
(-)src/org/eclipse/jdt/core/tests/model/AbstractJavaModelTests.java (+3 lines)
Lines 665-670 Link Here
665
		case IMemberValuePair.K_QUALIFIED_NAME:
665
		case IMemberValuePair.K_QUALIFIED_NAME:
666
			buffer.append(value);
666
			buffer.append(value);
667
			break;
667
			break;
668
		case IMemberValuePair.K_SIMPLE_NAME:
669
			buffer.append(value);
670
			break;
668
		case IMemberValuePair.K_UNKNOWN:
671
		case IMemberValuePair.K_UNKNOWN:
669
			appendAnnotationMemberValue(buffer, value, getValueKind(value));
672
			appendAnnotationMemberValue(buffer, value, getValueKind(value));
670
			break;
673
			break;

Return to bug 210565