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

(-)src/org/eclipse/jdt/core/tests/compiler/parser/TestSourceElementRequestor.java (-1 / +2 lines)
Lines 12-17 Link Here
12
12
13
import org.eclipse.jdt.core.compiler.CategorizedProblem;
13
import org.eclipse.jdt.core.compiler.CategorizedProblem;
14
import org.eclipse.jdt.internal.compiler.ISourceElementRequestor;
14
import org.eclipse.jdt.internal.compiler.ISourceElementRequestor;
15
import org.eclipse.jdt.internal.compiler.ast.Expression;
15
import org.eclipse.jdt.internal.compiler.ast.ImportReference;
16
import org.eclipse.jdt.internal.compiler.ast.ImportReference;
16
17
17
public class TestSourceElementRequestor implements ISourceElementRequestor {
18
public class TestSourceElementRequestor implements ISourceElementRequestor {
Lines 100-106 Link Here
100
/**
101
/**
101
 * exitMethod method comment.
102
 * exitMethod method comment.
102
 */
103
 */
103
public void exitMethod(int declarationEnd, int defaultValueStart, int defaultValueEnd) {}
104
public void exitMethod(int declarationEnd, Expression defaultValue) {}
104
105
105
/**
106
/**
106
 * enterInitializer method comment.
107
 * enterInitializer method comment.
(-)src/org/eclipse/jdt/core/tests/compiler/parser/SourceElementParserTest.java (-1 / +2 lines)
Lines 19-24 Link Here
19
import org.eclipse.jdt.core.tests.util.AbstractCompilerTest;
19
import org.eclipse.jdt.core.tests.util.AbstractCompilerTest;
20
import org.eclipse.jdt.internal.compiler.ISourceElementRequestor;
20
import org.eclipse.jdt.internal.compiler.ISourceElementRequestor;
21
import org.eclipse.jdt.internal.compiler.SourceElementParser;
21
import org.eclipse.jdt.internal.compiler.SourceElementParser;
22
import org.eclipse.jdt.internal.compiler.ast.Expression;
22
import org.eclipse.jdt.internal.compiler.ast.ImportReference;
23
import org.eclipse.jdt.internal.compiler.ast.ImportReference;
23
import org.eclipse.jdt.internal.compiler.batch.CompilationUnit;
24
import org.eclipse.jdt.internal.compiler.batch.CompilationUnit;
24
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
25
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
Lines 299-305 Link Here
299
public void exitField(int initializationStart, int declarationEnd, int declarationSourceEnd) {
300
public void exitField(int initializationStart, int declarationEnd, int declarationSourceEnd) {
300
	currentField.setDeclarationSourceEnd(declarationEnd);
301
	currentField.setDeclarationSourceEnd(declarationEnd);
301
}
302
}
302
public void exitMethod(int declarationEnd, int defaultValueStart, int defaultValueEnd) {
303
public void exitMethod(int declarationEnd, Expression defaultValue) {
303
	exitAbstractMethod(declarationEnd);
304
	exitAbstractMethod(declarationEnd);
304
}
305
}
305
protected void exitAbstractMethod(int declarationEnd) {
306
protected void exitAbstractMethod(int declarationEnd) {
(-)src/org/eclipse/jdt/core/tests/model/CompilationUnitTests.java (+100 lines)
Lines 152-157 Link Here
152
}
152
}
153
153
154
/*
154
/*
155
 * Ensures that the default value for an annotation method is correct.
156
 */
157
public void testDefaultValue1() throws CoreException {
158
	try {
159
		String cuSource = 
160
			"package p;\n" +
161
			"public @interface Y {\n" +
162
			"  public String member() default \"abc\";\n" +
163
			"}";
164
		createFile("/P/src/p/Y.java", cuSource);
165
		IMethod method = getCompilationUnit("/P/src/p/Y.java").getType("Y").getMethod("member", new String[0]);
166
		assertMemberValuePairEquals(
167
			"member=\"abc\"",
168
			method.getDefaultValue());
169
	} finally {
170
		deleteFile("/P/src/p/Y.java");
171
	}
172
}
173
174
/*
175
 * Ensures that the default value for an annotation method is correct.
176
 */
177
public void testDefaultValue2() throws CoreException {
178
	try {
179
		String cuSource = 
180
			"package p;\n" +
181
			"public @interface Y {\n" +
182
			"  public int member() default 1;\n" +
183
			"}";
184
		createFile("/P/src/p/Y.java", cuSource);
185
		IMethod method = getCompilationUnit("/P/src/p/Y.java").getType("Y").getMethod("member", new String[0]);
186
		assertMemberValuePairEquals(
187
			"member=(int)1",
188
			method.getDefaultValue());
189
	} finally {
190
		deleteFile("/P/src/p/Y.java");
191
	}
192
}
193
194
/*
195
 * Ensures that the default value for an annotation method is correct.
196
 */
197
public void testDefaultValue3() throws CoreException {
198
	try {
199
		String cuSource = 
200
			"package p;\n" +
201
			"public @interface Y {\n" +
202
			"  public int member();\n" +
203
			"}";
204
		createFile("/P/src/p/Y.java", cuSource);
205
		IMethod method = getCompilationUnit("/P/src/p/Y.java").getType("Y").getMethod("member", new String[0]);
206
		assertMemberValuePairEquals(
207
			"<null>",
208
			method.getDefaultValue());
209
	} finally {
210
		deleteFile("/P/src/p/Y.java");
211
	}
212
}
213
214
/*
215
 * Ensures that the default value for a non annotation method is correct.
216
 */
217
public void testDefaultValue4() throws CoreException {
218
	try {
219
		String cuSource = 
220
			"package p;\n" +
221
			"public class Y {\n" +
222
			"  public int member() {}\n" +
223
			"}";
224
		createFile("/P/src/p/Y.java", cuSource);
225
		IMethod method = getCompilationUnit("/P/src/p/Y.java").getType("Y").getMethod("member", new String[0]);
226
		assertMemberValuePairEquals(
227
			"<null>",
228
			method.getDefaultValue());
229
	} finally {
230
		deleteFile("/P/src/p/Y.java");
231
	}
232
}
233
234
/*
235
 * Ensures that the default value for an annotation method is correct.
236
 */
237
public void testDefaultValue5() throws CoreException {
238
	try {
239
		String cuSource = 
240
			"package p;\n" +
241
			"public @interface Y {\n" +
242
			"  public String member() default \"abc\" + 1;\n" +
243
			"}";
244
		createFile("/P/src/p/Y.java", cuSource);
245
		IMethod method = getCompilationUnit("/P/src/p/Y.java").getType("Y").getMethod("member", new String[0]);
246
		assertMemberValuePairEquals(
247
			"member=<null>",
248
			method.getDefaultValue());
249
	} finally {
250
		deleteFile("/P/src/p/Y.java");
251
	}
252
}
253
254
/*
155
 * Ensure that the deprecated flag is correctly reported
255
 * Ensure that the deprecated flag is correctly reported
156
 * (regression test fo bug 23207 Flags.isDeprecated(IMethod.getFlags()) doesn't work)
256
 * (regression test fo bug 23207 Flags.isDeprecated(IMethod.getFlags()) doesn't work)
157
 */
257
 */
(-)src/org/eclipse/jdt/core/tests/model/AbstractJavaModelTests.java (-7 / +20 lines)
Lines 516-521 Link Here
516
		assertEquals(message, expectedMarkers, actual);
516
		assertEquals(message, expectedMarkers, actual);
517
	}
517
	}
518
	
518
	
519
	protected void assertMemberValuePairEquals(String expected, IMemberValuePair member) throws JavaModelException {
520
		StringBuffer buffer = new StringBuffer();
521
		appendAnnotationMember(buffer, member);
522
		String actual = buffer.toString();
523
		if (!expected.equals(actual)) {
524
			System.out.println(displayString(actual, 2) + this.endChar);
525
		}
526
		assertEquals("Unexpected member value pair", expected, actual);
527
	}
528
	
519
	protected void assertProblems(String message, String expected, ProblemRequestor problemRequestor) {
529
	protected void assertProblems(String message, String expected, ProblemRequestor problemRequestor) {
520
		String actual = org.eclipse.jdt.core.tests.util.Util.convertToIndependantLineDelimiter(problemRequestor.problems.toString());
530
		String actual = org.eclipse.jdt.core.tests.util.Util.convertToIndependantLineDelimiter(problemRequestor.problems.toString());
521
		String independantExpectedString = org.eclipse.jdt.core.tests.util.Util.convertToIndependantLineDelimiter(expected);
531
		String independantExpectedString = org.eclipse.jdt.core.tests.util.Util.convertToIndependantLineDelimiter(expected);
Lines 566-578 Link Here
566
		if (length > 0) {
576
		if (length > 0) {
567
			buffer.append('(');
577
			buffer.append('(');
568
			for (int i = 0; i < length; i++) {
578
			for (int i = 0; i < length; i++) {
569
				IMemberValuePair member = members[i];
579
				appendAnnotationMember(buffer, members[i]);
570
				String name = member.getMemberName();
571
				if (!"value".equals(name)) {
572
					buffer.append(name);
573
					buffer.append('=');
574
				}
575
				appendAnnotationMember(buffer, member);
576
				if (i < length-1)
580
				if (i < length-1)
577
					buffer.append(", ");
581
					buffer.append(", ");
578
			}
582
			}
Lines 581-586 Link Here
581
	}
585
	}
582
586
583
	private void appendAnnotationMember(StringBuffer buffer, IMemberValuePair member) throws JavaModelException {
587
	private void appendAnnotationMember(StringBuffer buffer, IMemberValuePair member) throws JavaModelException {
588
		if (member == null) {
589
			buffer.append("<null>");
590
			return;
591
		}
592
		String name = member.getMemberName();
593
		if (!"value".equals(name)) {
594
			buffer.append(name);
595
			buffer.append('=');
596
		}
584
		int kind = member.getValueKind();
597
		int kind = member.getValueKind();
585
		Object value = member.getValue();
598
		Object value = member.getValue();
586
		if (value instanceof Object[]) {
599
		if (value instanceof Object[]) {
(-)src/org/eclipse/jdt/core/tests/model/ClassFileTests.java (+45 lines)
Lines 675-680 Link Here
675
}
675
}
676
676
677
/*
677
/*
678
 * Ensures that the default value for an annotation method is correct.
679
 */
680
public void testDefaultValue1() throws JavaModelException {
681
	IType type = this.jarRoot.getPackageFragment("annotated").getClassFile("MyAnnot.class").getType();
682
	IMethod method = type.getMethod("_int", new String[0]);
683
	assertMemberValuePairEquals(
684
		"_int=(int)0",
685
		method.getDefaultValue());
686
}
687
688
/*
689
 * Ensures that the default value for an annotation method is correct.
690
 */
691
public void testDefaultValue2() throws JavaModelException {
692
	IType type = this.jarRoot.getPackageFragment("annotated").getClassFile("MyAnnot.class").getType();
693
	IMethod method = type.getMethod("_annot", new String[0]);
694
	assertMemberValuePairEquals(
695
		"_annot=@annotated.MyOtherAnnot",
696
		method.getDefaultValue());
697
}
698
699
/*
700
 * Ensures that the default value for an annotation method is correct.
701
 */
702
public void testDefaultValue3() throws JavaModelException {
703
	IType type = this.jarRoot.getPackageFragment("annotated").getClassFile("MyAnnot.class").getType();
704
	IMethod method = type.getMethod("_array", new String[0]);
705
	assertMemberValuePairEquals(
706
		"_array=[unknown]{}",
707
		method.getDefaultValue());
708
}
709
710
711
/*
712
 * Ensures that the default value for an annotation method is correct.
713
 */
714
public void testDefaultValue4() throws JavaModelException {
715
	IType type = getPackageFragmentRoot("P", getExternalJCLPathString()).getPackageFragment("java.lang").getClassFile("Object.class").getType();
716
	IMethod method = type.getMethod("toString", new String[0]);
717
	assertMemberValuePairEquals(
718
		"<null>",
719
		method.getDefaultValue());
720
}
721
722
/*
678
 * Ensures that IType#getSuperclassTypeSignature() is correct for a binary type.
723
 * Ensures that IType#getSuperclassTypeSignature() is correct for a binary type.
679
 * (regression test for bug 78520 [model] IType#getSuperInterfaceTypeSignatures() doesn't include type arguments)
724
 * (regression test for bug 78520 [model] IType#getSuperInterfaceTypeSignatures() doesn't include type arguments)
680
 */
725
 */
(-)model/org/eclipse/jdt/internal/core/BinaryMember.java (-1 / +1 lines)
Lines 74-80 Link Here
74
		}
74
		}
75
	};
75
	};
76
}
76
}
77
private Object getMemberValue(MemberValuePair memberValuePair, Object binaryValue) {
77
protected Object getMemberValue(MemberValuePair memberValuePair, Object binaryValue) {
78
	if (binaryValue instanceof Constant) {
78
	if (binaryValue instanceof Constant) {
79
		return Util.getAnnotationMemberValue(memberValuePair, (Constant) binaryValue);
79
		return Util.getAnnotationMemberValue(memberValuePair, (Constant) binaryValue);
80
	} else if (binaryValue instanceof IBinaryAnnotation) {
80
	} else if (binaryValue instanceof IBinaryAnnotation) {
(-)model/org/eclipse/jdt/internal/core/SourceAnnotationMethodInfo.java (-2 / +6 lines)
Lines 10-15 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.jdt.internal.core;
11
package org.eclipse.jdt.internal.core;
12
12
13
import org.eclipse.jdt.core.IMemberValuePair;
14
13
/*
15
/*
14
 * Element info for annotation method from source.
16
 * Element info for annotation method from source.
15
 */
17
 */
Lines 20-27 Link Here
20
	 * These are {-1, -1} if the method is an annotation method with no default value.
22
	 * These are {-1, -1} if the method is an annotation method with no default value.
21
	 * Otherwise these are the start and end (inclusive) of the expression representing the default value.
23
	 * Otherwise these are the start and end (inclusive) of the expression representing the default value.
22
	 */
24
	 */
23
 public int defaultValueStart;
25
	public int defaultValueStart;
24
 public int defaultValueEnd;
26
	public int defaultValueEnd;
27
	
28
	public IMemberValuePair defaultValue;
25
29
26
	public boolean isAnnotationMethod() {
30
	public boolean isAnnotationMethod() {
27
		return true;
31
		return true;
(-)model/org/eclipse/jdt/internal/core/BinaryMethod.java (+9 lines)
Lines 59-64 Link Here
59
	IBinaryAnnotation[] binaryAnnotations = info.getAnnotations();
59
	IBinaryAnnotation[] binaryAnnotations = info.getAnnotations();
60
	return getAnnotations(binaryAnnotations);
60
	return getAnnotations(binaryAnnotations);
61
}
61
}
62
public IMemberValuePair getDefaultValue() throws JavaModelException {
63
	IBinaryMethod info = (IBinaryMethod) getElementInfo();
64
	Object defaultValue = info.getDefaultValue();
65
	if (defaultValue == null)
66
		return null;
67
	MemberValuePair memberValuePair = new MemberValuePair(getElementName());
68
	memberValuePair.value = getMemberValue(memberValuePair, defaultValue);
69
	return memberValuePair;
70
}
62
/*
71
/*
63
 * @see IMethod
72
 * @see IMethod
64
 */
73
 */
(-)model/org/eclipse/jdt/internal/core/SourceMapper.java (-1 / +2 lines)
Lines 54-59 Link Here
54
import org.eclipse.jdt.internal.compiler.IProblemFactory;
54
import org.eclipse.jdt.internal.compiler.IProblemFactory;
55
import org.eclipse.jdt.internal.compiler.ISourceElementRequestor;
55
import org.eclipse.jdt.internal.compiler.ISourceElementRequestor;
56
import org.eclipse.jdt.internal.compiler.SourceElementParser;
56
import org.eclipse.jdt.internal.compiler.SourceElementParser;
57
import org.eclipse.jdt.internal.compiler.ast.Expression;
57
import org.eclipse.jdt.internal.compiler.ast.ImportReference;
58
import org.eclipse.jdt.internal.compiler.ast.ImportReference;
58
import org.eclipse.jdt.internal.compiler.env.IBinaryType;
59
import org.eclipse.jdt.internal.compiler.env.IBinaryType;
59
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
60
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
Lines 841-847 Link Here
841
	/**
842
	/**
842
	 * @see ISourceElementRequestor
843
	 * @see ISourceElementRequestor
843
	 */
844
	 */
844
	public void exitMethod(int declarationEnd, int defaultValueStart, int defaultValueEnd) {
845
	public void exitMethod(int declarationEnd, Expression defaultValue) {
845
		exitAbstractMethod(declarationEnd);
846
		exitAbstractMethod(declarationEnd);
846
	}
847
	}
847
	private void exitAbstractMethod(int declarationEnd) {
848
	private void exitAbstractMethod(int declarationEnd) {
(-)model/org/eclipse/jdt/internal/core/SourceMethod.java (+7 lines)
Lines 50-55 Link Here
50
	if (!(o instanceof SourceMethod)) return false;
50
	if (!(o instanceof SourceMethod)) return false;
51
	return super.equals(o) && Util.equalArraysOrNull(this.parameterTypes, ((SourceMethod)o).parameterTypes);
51
	return super.equals(o) && Util.equalArraysOrNull(this.parameterTypes, ((SourceMethod)o).parameterTypes);
52
}
52
}
53
public IMemberValuePair getDefaultValue() throws JavaModelException {
54
	SourceMethodInfo sourceMethodInfo = (SourceMethodInfo) getElementInfo();
55
	if (sourceMethodInfo.isAnnotationMethod()) {
56
		return ((SourceAnnotationMethodInfo) sourceMethodInfo).defaultValue;
57
	}
58
	return null;
59
}
53
/**
60
/**
54
 * @see IJavaElement
61
 * @see IJavaElement
55
 */
62
 */
(-)model/org/eclipse/jdt/internal/core/CompilationUnitStructureRequestor.java (-4 / +8 lines)
Lines 566-581 Link Here
566
/**
566
/**
567
 * @see ISourceElementRequestor
567
 * @see ISourceElementRequestor
568
 */
568
 */
569
public void exitMethod(int declarationEnd, int defaultValueStart, int defaultValueEnd) {
569
public void exitMethod(int declarationEnd, Expression defaultValue) {
570
	SourceMethodElementInfo info = (SourceMethodElementInfo) this.infoStack.pop();
570
	SourceMethodElementInfo info = (SourceMethodElementInfo) this.infoStack.pop();
571
	info.setSourceRangeEnd(declarationEnd);
571
	info.setSourceRangeEnd(declarationEnd);
572
	setChildren(info);
572
	setChildren(info);
573
	
573
	
574
	// remember default value of annotation method
574
	// remember default value of annotation method
575
	if (info.isAnnotationMethod()) {
575
	if (info.isAnnotationMethod() && defaultValue != null) {
576
		SourceAnnotationMethodInfo annotationMethodInfo = (SourceAnnotationMethodInfo) info;
576
		SourceAnnotationMethodInfo annotationMethodInfo = (SourceAnnotationMethodInfo) info;
577
		annotationMethodInfo.defaultValueStart = defaultValueStart;
577
		annotationMethodInfo.defaultValueStart = defaultValue.sourceStart;
578
		annotationMethodInfo.defaultValueEnd = defaultValueEnd;
578
		annotationMethodInfo.defaultValueEnd = defaultValue.sourceEnd;
579
		JavaElement element = (JavaElement) this.handleStack.peek();
580
		org.eclipse.jdt.internal.core.MemberValuePair defaultMemberValuePair = new org.eclipse.jdt.internal.core.MemberValuePair(element.getElementName());
581
		defaultMemberValuePair.value = getMemberValue(defaultMemberValuePair, defaultValue);
582
		annotationMethodInfo.defaultValue = defaultMemberValuePair;
579
	}
583
	}
580
	this.handleStack.pop();
584
	this.handleStack.pop();
581
}
585
}
(-)search/org/eclipse/jdt/internal/core/search/indexing/SourceIndexerRequestor.java (-2 / +3 lines)
Lines 13-18 Link Here
13
import org.eclipse.jdt.core.Signature;
13
import org.eclipse.jdt.core.Signature;
14
import org.eclipse.jdt.core.compiler.*;
14
import org.eclipse.jdt.core.compiler.*;
15
import org.eclipse.jdt.internal.compiler.ISourceElementRequestor;
15
import org.eclipse.jdt.internal.compiler.ISourceElementRequestor;
16
import org.eclipse.jdt.internal.compiler.ast.Expression;
16
import org.eclipse.jdt.internal.compiler.ast.ImportReference;
17
import org.eclipse.jdt.internal.compiler.ast.ImportReference;
17
import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
18
import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
18
import org.eclipse.jdt.internal.compiler.lookup.TypeConstants;
19
import org.eclipse.jdt.internal.compiler.lookup.TypeConstants;
Lines 294-302 Link Here
294
	this.methodDepth--;
295
	this.methodDepth--;
295
}
296
}
296
/**
297
/**
297
 * @see ISourceElementRequestor#exitMethod(int, int, int)
298
 * @see ISourceElementRequestor#exitMethod(int, Expression)
298
 */
299
 */
299
public void exitMethod(int declarationEnd, int defaultValueStart, int defaultValueEnd) {
300
public void exitMethod(int declarationEnd, Expression defaultValue) {
300
	this.methodDepth--;
301
	this.methodDepth--;
301
}
302
}
302
/**
303
/**
(-)model/org/eclipse/jdt/internal/compiler/SourceElementParser.java (-2 / +2 lines)
Lines 1222-1232 Link Here
1222
			AnnotationMethodDeclaration annotationMethodDeclaration = (AnnotationMethodDeclaration) methodDeclaration;
1222
			AnnotationMethodDeclaration annotationMethodDeclaration = (AnnotationMethodDeclaration) methodDeclaration;
1223
			Expression expression = annotationMethodDeclaration.defaultValue;
1223
			Expression expression = annotationMethodDeclaration.defaultValue;
1224
			if (expression != null) {
1224
			if (expression != null) {
1225
				requestor.exitMethod(methodDeclaration.declarationSourceEnd, expression.sourceStart, expression.sourceEnd);
1225
				requestor.exitMethod(methodDeclaration.declarationSourceEnd, expression);
1226
				return;
1226
				return;
1227
			}
1227
			}
1228
		} 
1228
		} 
1229
		requestor.exitMethod(methodDeclaration.declarationSourceEnd, -1, -1);
1229
		requestor.exitMethod(methodDeclaration.declarationSourceEnd, null);
1230
	}
1230
	}
1231
}
1231
}
1232
1232
(-)model/org/eclipse/jdt/internal/compiler/SourceElementRequestorAdapter.java (-2 / +3 lines)
Lines 11-16 Link Here
11
package org.eclipse.jdt.internal.compiler;
11
package org.eclipse.jdt.internal.compiler;
12
12
13
import org.eclipse.jdt.core.compiler.CategorizedProblem;
13
import org.eclipse.jdt.core.compiler.CategorizedProblem;
14
import org.eclipse.jdt.internal.compiler.ast.Expression;
14
import org.eclipse.jdt.internal.compiler.ast.ImportReference;
15
import org.eclipse.jdt.internal.compiler.ast.ImportReference;
15
16
16
public class SourceElementRequestorAdapter implements ISourceElementRequestor {
17
public class SourceElementRequestorAdapter implements ISourceElementRequestor {
Lines 171-179 Link Here
171
	}
172
	}
172
173
173
	/**
174
	/**
174
	 * @see ISourceElementRequestor#exitMethod(int, int, int)
175
	 * @see ISourceElementRequestor#exitMethod(int, Expression)
175
	 */
176
	 */
176
	public void exitMethod(int declarationEnd, int defaultValueStart, int defaultValueEnd) {
177
	public void exitMethod(int declarationEnd, Expression defaultValue) {
177
		// default implementation: do nothing
178
		// default implementation: do nothing
178
	}
179
	}
179
	
180
	
(-)model/org/eclipse/jdt/internal/compiler/ISourceElementRequestor.java (-1 / +2 lines)
Lines 12-17 Link Here
12
12
13
import org.eclipse.jdt.core.compiler.CategorizedProblem;
13
import org.eclipse.jdt.core.compiler.CategorizedProblem;
14
import org.eclipse.jdt.internal.compiler.ast.Annotation;
14
import org.eclipse.jdt.internal.compiler.ast.Annotation;
15
import org.eclipse.jdt.internal.compiler.ast.Expression;
15
import org.eclipse.jdt.internal.compiler.ast.ImportReference;
16
import org.eclipse.jdt.internal.compiler.ast.ImportReference;
16
17
17
/*
18
/*
Lines 159-165 Link Here
159
	
160
	
160
	void exitInitializer(int declarationEnd);
161
	void exitInitializer(int declarationEnd);
161
	
162
	
162
	void exitMethod(int declarationEnd, int defaultValueStart, int defaultValueEnd);
163
	void exitMethod(int declarationEnd, Expression defaultValue);
163
	
164
	
164
	void exitType(int declarationEnd);
165
	void exitType(int declarationEnd);
165
}
166
}
(-)model/org/eclipse/jdt/core/IMethod.java (+15 lines)
Lines 19-24 Link Here
19
 */
19
 */
20
public interface IMethod extends IMember, IAnnotatable {
20
public interface IMethod extends IMember, IAnnotatable {
21
/**
21
/**
22
 * Returns a {@link IMemberValuePair member value pair} representing the default 
23
 * value of this annotation method.
24
 * Returns <code>null</code> if this method's parent is not an annotation 
25
 * type, or if it does not have a default value.
26
 * <p>
27
 * Note that {@link IMemberValuePair#getValue()} might return <code>null</code>. 
28
 * Please see this method for more details.
29
 * </p>
30
 * 
31
 * @exception JavaModelException if this element does not exist or if an
32
 *      exception occurs while accessing its corresponding resource.
33
 * @since 3.4
34
 */
35
IMemberValuePair getDefaultValue() throws JavaModelException;
36
/**
22
 * Returns the simple name of this method.
37
 * Returns the simple name of this method.
23
 * For a constructor, this returns the simple name of the declaring type.
38
 * For a constructor, this returns the simple name of the declaring type.
24
 * Note: This holds whether the constructor appears in a source or binary type
39
 * Note: This holds whether the constructor appears in a source or binary type
(-)model/org/eclipse/jdt/internal/core/jdom/SimpleDOMBuilder.java (-1 / +2 lines)
Lines 18-23 Link Here
18
import org.eclipse.jdt.core.jdom.*;
18
import org.eclipse.jdt.core.jdom.*;
19
import org.eclipse.jdt.internal.compiler.ISourceElementRequestor;
19
import org.eclipse.jdt.internal.compiler.ISourceElementRequestor;
20
import org.eclipse.jdt.internal.compiler.SourceElementParser;
20
import org.eclipse.jdt.internal.compiler.SourceElementParser;
21
import org.eclipse.jdt.internal.compiler.ast.Expression;
21
import org.eclipse.jdt.internal.compiler.ast.ImportReference;
22
import org.eclipse.jdt.internal.compiler.ast.ImportReference;
22
import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
23
import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
23
import org.eclipse.jdt.internal.compiler.env.ICompilationUnit;
24
import org.eclipse.jdt.internal.compiler.env.ICompilationUnit;
Lines 171-177 Link Here
171
}
172
}
172
/**
173
/**
173
 */
174
 */
174
public void exitMethod(int declarationEnd, int defaultValueStart, int defaultValueEnd) {
175
public void exitMethod(int declarationEnd, Expression defaultValue) {
175
	exitMember(declarationEnd);
176
	exitMember(declarationEnd);
176
}
177
}
177
/**
178
/**

Return to bug 209958