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 83518 Details for
Bug 209958
Support getting default value from IMethod
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Corresponding implementation and tests
209958v4.txt (text/plain), 25.35 KB, created by
Jerome Lanneluc
on 2007-11-22 06:27:32 EST
(
hide
)
Description:
Corresponding implementation and tests
Filename:
MIME Type:
Creator:
Jerome Lanneluc
Created:
2007-11-22 06:27:32 EST
Size:
25.35 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core.tests.compiler >Index: src/org/eclipse/jdt/core/tests/compiler/parser/TestSourceElementRequestor.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/TestSourceElementRequestor.java,v >retrieving revision 1.19 >diff -u -r1.19 TestSourceElementRequestor.java >--- src/org/eclipse/jdt/core/tests/compiler/parser/TestSourceElementRequestor.java 24 Oct 2007 13:50:31 -0000 1.19 >+++ src/org/eclipse/jdt/core/tests/compiler/parser/TestSourceElementRequestor.java 22 Nov 2007 10:05:17 -0000 >@@ -12,6 +12,7 @@ > > import org.eclipse.jdt.core.compiler.CategorizedProblem; > import org.eclipse.jdt.internal.compiler.ISourceElementRequestor; >+import org.eclipse.jdt.internal.compiler.ast.Expression; > import org.eclipse.jdt.internal.compiler.ast.ImportReference; > > public class TestSourceElementRequestor implements ISourceElementRequestor { >@@ -100,7 +101,7 @@ > /** > * exitMethod method comment. > */ >-public void exitMethod(int declarationEnd, int defaultValueStart, int defaultValueEnd) {} >+public void exitMethod(int declarationEnd, Expression defaultValue) {} > > /** > * enterInitializer method comment. >Index: src/org/eclipse/jdt/core/tests/compiler/parser/SourceElementParserTest.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SourceElementParserTest.java,v >retrieving revision 1.38 >diff -u -r1.38 SourceElementParserTest.java >--- src/org/eclipse/jdt/core/tests/compiler/parser/SourceElementParserTest.java 24 Oct 2007 13:50:31 -0000 1.38 >+++ src/org/eclipse/jdt/core/tests/compiler/parser/SourceElementParserTest.java 22 Nov 2007 10:05:17 -0000 >@@ -19,6 +19,7 @@ > import org.eclipse.jdt.core.tests.util.AbstractCompilerTest; > import org.eclipse.jdt.internal.compiler.ISourceElementRequestor; > import org.eclipse.jdt.internal.compiler.SourceElementParser; >+import org.eclipse.jdt.internal.compiler.ast.Expression; > import org.eclipse.jdt.internal.compiler.ast.ImportReference; > import org.eclipse.jdt.internal.compiler.batch.CompilationUnit; > import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; >@@ -299,7 +300,7 @@ > public void exitField(int initializationStart, int declarationEnd, int declarationSourceEnd) { > currentField.setDeclarationSourceEnd(declarationEnd); > } >-public void exitMethod(int declarationEnd, int defaultValueStart, int defaultValueEnd) { >+public void exitMethod(int declarationEnd, Expression defaultValue) { > exitAbstractMethod(declarationEnd); > } > protected void exitAbstractMethod(int declarationEnd) { >#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.55 >diff -u -r1.55 CompilationUnitTests.java >--- src/org/eclipse/jdt/core/tests/model/CompilationUnitTests.java 15 Nov 2007 09:46:53 -0000 1.55 >+++ src/org/eclipse/jdt/core/tests/model/CompilationUnitTests.java 22 Nov 2007 10:05:20 -0000 >@@ -152,6 +152,106 @@ > } > > /* >+ * Ensures that the default value for an annotation method is correct. >+ */ >+public void testDefaultValue1() throws CoreException { >+ try { >+ String cuSource = >+ "package p;\n" + >+ "public @interface Y {\n" + >+ " public String member() default \"abc\";\n" + >+ "}"; >+ createFile("/P/src/p/Y.java", cuSource); >+ IMethod method = getCompilationUnit("/P/src/p/Y.java").getType("Y").getMethod("member", new String[0]); >+ assertMemberValuePairEquals( >+ "member=\"abc\"", >+ method.getDefaultValue()); >+ } finally { >+ deleteFile("/P/src/p/Y.java"); >+ } >+} >+ >+/* >+ * Ensures that the default value for an annotation method is correct. >+ */ >+public void testDefaultValue2() throws CoreException { >+ try { >+ String cuSource = >+ "package p;\n" + >+ "public @interface Y {\n" + >+ " public int member() default 1;\n" + >+ "}"; >+ createFile("/P/src/p/Y.java", cuSource); >+ IMethod method = getCompilationUnit("/P/src/p/Y.java").getType("Y").getMethod("member", new String[0]); >+ assertMemberValuePairEquals( >+ "member=(int)1", >+ method.getDefaultValue()); >+ } finally { >+ deleteFile("/P/src/p/Y.java"); >+ } >+} >+ >+/* >+ * Ensures that the default value for an annotation method is correct. >+ */ >+public void testDefaultValue3() throws CoreException { >+ try { >+ String cuSource = >+ "package p;\n" + >+ "public @interface Y {\n" + >+ " public int member();\n" + >+ "}"; >+ createFile("/P/src/p/Y.java", cuSource); >+ IMethod method = getCompilationUnit("/P/src/p/Y.java").getType("Y").getMethod("member", new String[0]); >+ assertMemberValuePairEquals( >+ "<null>", >+ method.getDefaultValue()); >+ } finally { >+ deleteFile("/P/src/p/Y.java"); >+ } >+} >+ >+/* >+ * Ensures that the default value for a non annotation method is correct. >+ */ >+public void testDefaultValue4() throws CoreException { >+ try { >+ String cuSource = >+ "package p;\n" + >+ "public class Y {\n" + >+ " public int member() {}\n" + >+ "}"; >+ createFile("/P/src/p/Y.java", cuSource); >+ IMethod method = getCompilationUnit("/P/src/p/Y.java").getType("Y").getMethod("member", new String[0]); >+ assertMemberValuePairEquals( >+ "<null>", >+ method.getDefaultValue()); >+ } finally { >+ deleteFile("/P/src/p/Y.java"); >+ } >+} >+ >+/* >+ * Ensures that the default value for an annotation method is correct. >+ */ >+public void testDefaultValue5() throws CoreException { >+ try { >+ String cuSource = >+ "package p;\n" + >+ "public @interface Y {\n" + >+ " public String member() default \"abc\" + 1;\n" + >+ "}"; >+ createFile("/P/src/p/Y.java", cuSource); >+ IMethod method = getCompilationUnit("/P/src/p/Y.java").getType("Y").getMethod("member", new String[0]); >+ assertMemberValuePairEquals( >+ "member=<null>", >+ method.getDefaultValue()); >+ } finally { >+ deleteFile("/P/src/p/Y.java"); >+ } >+} >+ >+/* > * Ensure that the deprecated flag is correctly reported > * (regression test fo bug 23207 Flags.isDeprecated(IMethod.getFlags()) doesn't work) > */ >Index: src/org/eclipse/jdt/core/tests/model/AbstractJavaModelTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/AbstractJavaModelTests.java,v >retrieving revision 1.192 >diff -u -r1.192 AbstractJavaModelTests.java >--- src/org/eclipse/jdt/core/tests/model/AbstractJavaModelTests.java 16 Nov 2007 10:06:38 -0000 1.192 >+++ src/org/eclipse/jdt/core/tests/model/AbstractJavaModelTests.java 22 Nov 2007 10:05:19 -0000 >@@ -516,6 +516,16 @@ > assertEquals(message, expectedMarkers, actual); > } > >+ protected void assertMemberValuePairEquals(String expected, IMemberValuePair member) throws JavaModelException { >+ StringBuffer buffer = new StringBuffer(); >+ appendAnnotationMember(buffer, member); >+ String actual = buffer.toString(); >+ if (!expected.equals(actual)) { >+ System.out.println(displayString(actual, 2) + this.endChar); >+ } >+ assertEquals("Unexpected member value pair", expected, actual); >+ } >+ > protected void assertProblems(String message, String expected, ProblemRequestor problemRequestor) { > String actual = org.eclipse.jdt.core.tests.util.Util.convertToIndependantLineDelimiter(problemRequestor.problems.toString()); > String independantExpectedString = org.eclipse.jdt.core.tests.util.Util.convertToIndependantLineDelimiter(expected); >@@ -566,13 +576,7 @@ > if (length > 0) { > buffer.append('('); > for (int i = 0; i < length; i++) { >- IMemberValuePair member = members[i]; >- String name = member.getMemberName(); >- if (!"value".equals(name)) { >- buffer.append(name); >- buffer.append('='); >- } >- appendAnnotationMember(buffer, member); >+ appendAnnotationMember(buffer, members[i]); > if (i < length-1) > buffer.append(", "); > } >@@ -581,6 +585,15 @@ > } > > private void appendAnnotationMember(StringBuffer buffer, IMemberValuePair member) throws JavaModelException { >+ if (member == null) { >+ buffer.append("<null>"); >+ return; >+ } >+ String name = member.getMemberName(); >+ if (!"value".equals(name)) { >+ buffer.append(name); >+ buffer.append('='); >+ } > int kind = member.getValueKind(); > Object value = member.getValue(); > if (value instanceof Object[]) { >Index: src/org/eclipse/jdt/core/tests/model/ClassFileTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ClassFileTests.java,v >retrieving revision 1.31 >diff -u -r1.31 ClassFileTests.java >--- src/org/eclipse/jdt/core/tests/model/ClassFileTests.java 24 Oct 2007 13:50:40 -0000 1.31 >+++ src/org/eclipse/jdt/core/tests/model/ClassFileTests.java 22 Nov 2007 10:05:19 -0000 >@@ -675,6 +675,51 @@ > } > > /* >+ * Ensures that the default value for an annotation method is correct. >+ */ >+public void testDefaultValue1() throws JavaModelException { >+ IType type = this.jarRoot.getPackageFragment("annotated").getClassFile("MyAnnot.class").getType(); >+ IMethod method = type.getMethod("_int", new String[0]); >+ assertMemberValuePairEquals( >+ "_int=(int)0", >+ method.getDefaultValue()); >+} >+ >+/* >+ * Ensures that the default value for an annotation method is correct. >+ */ >+public void testDefaultValue2() throws JavaModelException { >+ IType type = this.jarRoot.getPackageFragment("annotated").getClassFile("MyAnnot.class").getType(); >+ IMethod method = type.getMethod("_annot", new String[0]); >+ assertMemberValuePairEquals( >+ "_annot=@annotated.MyOtherAnnot", >+ method.getDefaultValue()); >+} >+ >+/* >+ * Ensures that the default value for an annotation method is correct. >+ */ >+public void testDefaultValue3() throws JavaModelException { >+ IType type = this.jarRoot.getPackageFragment("annotated").getClassFile("MyAnnot.class").getType(); >+ IMethod method = type.getMethod("_array", new String[0]); >+ assertMemberValuePairEquals( >+ "_array=[unknown]{}", >+ method.getDefaultValue()); >+} >+ >+ >+/* >+ * Ensures that the default value for an annotation method is correct. >+ */ >+public void testDefaultValue4() throws JavaModelException { >+ IType type = getPackageFragmentRoot("P", getExternalJCLPathString()).getPackageFragment("java.lang").getClassFile("Object.class").getType(); >+ IMethod method = type.getMethod("toString", new String[0]); >+ assertMemberValuePairEquals( >+ "<null>", >+ method.getDefaultValue()); >+} >+ >+/* > * Ensures that IType#getSuperclassTypeSignature() is correct for a binary type. > * (regression test for bug 78520 [model] IType#getSuperInterfaceTypeSignatures() doesn't include type arguments) > */ >#P org.eclipse.jdt.core >Index: model/org/eclipse/jdt/internal/core/BinaryMember.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/BinaryMember.java,v >retrieving revision 1.30 >diff -u -r1.30 BinaryMember.java >--- model/org/eclipse/jdt/internal/core/BinaryMember.java 26 Oct 2007 15:17:57 -0000 1.30 >+++ model/org/eclipse/jdt/internal/core/BinaryMember.java 22 Nov 2007 10:05:21 -0000 >@@ -74,7 +74,7 @@ > } > }; > } >-private Object getMemberValue(MemberValuePair memberValuePair, Object binaryValue) { >+protected Object getMemberValue(MemberValuePair memberValuePair, Object binaryValue) { > if (binaryValue instanceof Constant) { > return Util.getAnnotationMemberValue(memberValuePair, (Constant) binaryValue); > } else if (binaryValue instanceof IBinaryAnnotation) { >Index: model/org/eclipse/jdt/internal/core/SourceAnnotationMethodInfo.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SourceAnnotationMethodInfo.java,v >retrieving revision 1.5 >diff -u -r1.5 SourceAnnotationMethodInfo.java >--- model/org/eclipse/jdt/internal/core/SourceAnnotationMethodInfo.java 10 May 2006 18:03:48 -0000 1.5 >+++ model/org/eclipse/jdt/internal/core/SourceAnnotationMethodInfo.java 22 Nov 2007 10:05:21 -0000 >@@ -10,6 +10,8 @@ > *******************************************************************************/ > package org.eclipse.jdt.internal.core; > >+import org.eclipse.jdt.core.IMemberValuePair; >+ > /* > * Element info for annotation method from source. > */ >@@ -20,8 +22,10 @@ > * These are {-1, -1} if the method is an annotation method with no default value. > * Otherwise these are the start and end (inclusive) of the expression representing the default value. > */ >- public int defaultValueStart; >- public int defaultValueEnd; >+ public int defaultValueStart; >+ public int defaultValueEnd; >+ >+ public IMemberValuePair defaultValue; > > public boolean isAnnotationMethod() { > return true; >Index: model/org/eclipse/jdt/internal/core/BinaryMethod.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/BinaryMethod.java,v >retrieving revision 1.96 >diff -u -r1.96 BinaryMethod.java >--- model/org/eclipse/jdt/internal/core/BinaryMethod.java 24 Oct 2007 13:50:51 -0000 1.96 >+++ model/org/eclipse/jdt/internal/core/BinaryMethod.java 22 Nov 2007 10:05:21 -0000 >@@ -59,6 +59,15 @@ > IBinaryAnnotation[] binaryAnnotations = info.getAnnotations(); > return getAnnotations(binaryAnnotations); > } >+public IMemberValuePair getDefaultValue() throws JavaModelException { >+ IBinaryMethod info = (IBinaryMethod) getElementInfo(); >+ Object defaultValue = info.getDefaultValue(); >+ if (defaultValue == null) >+ return null; >+ MemberValuePair memberValuePair = new MemberValuePair(getElementName()); >+ memberValuePair.value = getMemberValue(memberValuePair, defaultValue); >+ return memberValuePair; >+} > /* > * @see IMethod > */ >Index: model/org/eclipse/jdt/internal/core/SourceMapper.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SourceMapper.java,v >retrieving revision 1.129 >diff -u -r1.129 SourceMapper.java >--- model/org/eclipse/jdt/internal/core/SourceMapper.java 24 Oct 2007 13:50:51 -0000 1.129 >+++ model/org/eclipse/jdt/internal/core/SourceMapper.java 22 Nov 2007 10:05:22 -0000 >@@ -54,6 +54,7 @@ > import org.eclipse.jdt.internal.compiler.IProblemFactory; > import org.eclipse.jdt.internal.compiler.ISourceElementRequestor; > import org.eclipse.jdt.internal.compiler.SourceElementParser; >+import org.eclipse.jdt.internal.compiler.ast.Expression; > import org.eclipse.jdt.internal.compiler.ast.ImportReference; > import org.eclipse.jdt.internal.compiler.env.IBinaryType; > import org.eclipse.jdt.internal.compiler.impl.CompilerOptions; >@@ -841,7 +842,7 @@ > /** > * @see ISourceElementRequestor > */ >- public void exitMethod(int declarationEnd, int defaultValueStart, int defaultValueEnd) { >+ public void exitMethod(int declarationEnd, Expression defaultValue) { > exitAbstractMethod(declarationEnd); > } > private void exitAbstractMethod(int declarationEnd) { >Index: model/org/eclipse/jdt/internal/core/SourceMethod.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SourceMethod.java,v >retrieving revision 1.64 >diff -u -r1.64 SourceMethod.java >--- model/org/eclipse/jdt/internal/core/SourceMethod.java 27 Apr 2007 15:51:38 -0000 1.64 >+++ model/org/eclipse/jdt/internal/core/SourceMethod.java 22 Nov 2007 10:05:22 -0000 >@@ -50,6 +50,13 @@ > if (!(o instanceof SourceMethod)) return false; > return super.equals(o) && Util.equalArraysOrNull(this.parameterTypes, ((SourceMethod)o).parameterTypes); > } >+public IMemberValuePair getDefaultValue() throws JavaModelException { >+ SourceMethodInfo sourceMethodInfo = (SourceMethodInfo) getElementInfo(); >+ if (sourceMethodInfo.isAnnotationMethod()) { >+ return ((SourceAnnotationMethodInfo) sourceMethodInfo).defaultValue; >+ } >+ return null; >+} > /** > * @see IJavaElement > */ >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.74 >diff -u -r1.74 CompilationUnitStructureRequestor.java >--- model/org/eclipse/jdt/internal/core/CompilationUnitStructureRequestor.java 26 Oct 2007 15:17:57 -0000 1.74 >+++ model/org/eclipse/jdt/internal/core/CompilationUnitStructureRequestor.java 22 Nov 2007 10:05:21 -0000 >@@ -566,16 +566,20 @@ > /** > * @see ISourceElementRequestor > */ >-public void exitMethod(int declarationEnd, int defaultValueStart, int defaultValueEnd) { >+public void exitMethod(int declarationEnd, Expression defaultValue) { > SourceMethodElementInfo info = (SourceMethodElementInfo) this.infoStack.pop(); > info.setSourceRangeEnd(declarationEnd); > setChildren(info); > > // remember default value of annotation method >- if (info.isAnnotationMethod()) { >+ if (info.isAnnotationMethod() && defaultValue != null) { > SourceAnnotationMethodInfo annotationMethodInfo = (SourceAnnotationMethodInfo) info; >- annotationMethodInfo.defaultValueStart = defaultValueStart; >- annotationMethodInfo.defaultValueEnd = defaultValueEnd; >+ annotationMethodInfo.defaultValueStart = defaultValue.sourceStart; >+ annotationMethodInfo.defaultValueEnd = defaultValue.sourceEnd; >+ JavaElement element = (JavaElement) this.handleStack.peek(); >+ org.eclipse.jdt.internal.core.MemberValuePair defaultMemberValuePair = new org.eclipse.jdt.internal.core.MemberValuePair(element.getElementName()); >+ defaultMemberValuePair.value = getMemberValue(defaultMemberValuePair, defaultValue); >+ annotationMethodInfo.defaultValue = defaultMemberValuePair; > } > this.handleStack.pop(); > } >Index: search/org/eclipse/jdt/internal/core/search/indexing/SourceIndexerRequestor.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/SourceIndexerRequestor.java,v >retrieving revision 1.43 >diff -u -r1.43 SourceIndexerRequestor.java >--- search/org/eclipse/jdt/internal/core/search/indexing/SourceIndexerRequestor.java 24 Oct 2007 13:50:51 -0000 1.43 >+++ search/org/eclipse/jdt/internal/core/search/indexing/SourceIndexerRequestor.java 22 Nov 2007 10:05:22 -0000 >@@ -13,6 +13,7 @@ > import org.eclipse.jdt.core.Signature; > import org.eclipse.jdt.core.compiler.*; > import org.eclipse.jdt.internal.compiler.ISourceElementRequestor; >+import org.eclipse.jdt.internal.compiler.ast.Expression; > import org.eclipse.jdt.internal.compiler.ast.ImportReference; > import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration; > import org.eclipse.jdt.internal.compiler.lookup.TypeConstants; >@@ -294,9 +295,9 @@ > this.methodDepth--; > } > /** >- * @see ISourceElementRequestor#exitMethod(int, int, int) >+ * @see ISourceElementRequestor#exitMethod(int, Expression) > */ >-public void exitMethod(int declarationEnd, int defaultValueStart, int defaultValueEnd) { >+public void exitMethod(int declarationEnd, Expression defaultValue) { > this.methodDepth--; > } > /** >Index: model/org/eclipse/jdt/internal/compiler/SourceElementParser.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/SourceElementParser.java,v >retrieving revision 1.77 >diff -u -r1.77 SourceElementParser.java >--- model/org/eclipse/jdt/internal/compiler/SourceElementParser.java 24 Oct 2007 13:50:51 -0000 1.77 >+++ model/org/eclipse/jdt/internal/compiler/SourceElementParser.java 22 Nov 2007 10:05:21 -0000 >@@ -1222,11 +1222,11 @@ > AnnotationMethodDeclaration annotationMethodDeclaration = (AnnotationMethodDeclaration) methodDeclaration; > Expression expression = annotationMethodDeclaration.defaultValue; > if (expression != null) { >- requestor.exitMethod(methodDeclaration.declarationSourceEnd, expression.sourceStart, expression.sourceEnd); >+ requestor.exitMethod(methodDeclaration.declarationSourceEnd, expression); > return; > } > } >- requestor.exitMethod(methodDeclaration.declarationSourceEnd, -1, -1); >+ requestor.exitMethod(methodDeclaration.declarationSourceEnd, null); > } > } > >Index: model/org/eclipse/jdt/internal/compiler/SourceElementRequestorAdapter.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/SourceElementRequestorAdapter.java,v >retrieving revision 1.16 >diff -u -r1.16 SourceElementRequestorAdapter.java >--- model/org/eclipse/jdt/internal/compiler/SourceElementRequestorAdapter.java 24 Oct 2007 13:50:51 -0000 1.16 >+++ model/org/eclipse/jdt/internal/compiler/SourceElementRequestorAdapter.java 22 Nov 2007 10:05:21 -0000 >@@ -11,6 +11,7 @@ > package org.eclipse.jdt.internal.compiler; > > import org.eclipse.jdt.core.compiler.CategorizedProblem; >+import org.eclipse.jdt.internal.compiler.ast.Expression; > import org.eclipse.jdt.internal.compiler.ast.ImportReference; > > public class SourceElementRequestorAdapter implements ISourceElementRequestor { >@@ -171,9 +172,9 @@ > } > > /** >- * @see ISourceElementRequestor#exitMethod(int, int, int) >+ * @see ISourceElementRequestor#exitMethod(int, Expression) > */ >- public void exitMethod(int declarationEnd, int defaultValueStart, int defaultValueEnd) { >+ public void exitMethod(int declarationEnd, Expression defaultValue) { > // default implementation: do nothing > } > >Index: model/org/eclipse/jdt/internal/compiler/ISourceElementRequestor.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/ISourceElementRequestor.java,v >retrieving revision 1.18 >diff -u -r1.18 ISourceElementRequestor.java >--- model/org/eclipse/jdt/internal/compiler/ISourceElementRequestor.java 24 Oct 2007 13:50:51 -0000 1.18 >+++ model/org/eclipse/jdt/internal/compiler/ISourceElementRequestor.java 22 Nov 2007 10:05:21 -0000 >@@ -12,6 +12,7 @@ > > import org.eclipse.jdt.core.compiler.CategorizedProblem; > import org.eclipse.jdt.internal.compiler.ast.Annotation; >+import org.eclipse.jdt.internal.compiler.ast.Expression; > import org.eclipse.jdt.internal.compiler.ast.ImportReference; > > /* >@@ -159,7 +160,7 @@ > > void exitInitializer(int declarationEnd); > >- void exitMethod(int declarationEnd, int defaultValueStart, int defaultValueEnd); >+ void exitMethod(int declarationEnd, Expression defaultValue); > > void exitType(int declarationEnd); > } >Index: model/org/eclipse/jdt/core/IMethod.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IMethod.java,v >retrieving revision 1.27 >diff -u -r1.27 IMethod.java >--- model/org/eclipse/jdt/core/IMethod.java 24 Oct 2007 13:50:50 -0000 1.27 >+++ model/org/eclipse/jdt/core/IMethod.java 22 Nov 2007 10:05:21 -0000 >@@ -19,6 +19,21 @@ > */ > public interface IMethod extends IMember, IAnnotatable { > /** >+ * Returns a {@link IMemberValuePair member value pair} representing the default >+ * value of this annotation method. >+ * Returns <code>null</code> if this method's parent is not an annotation >+ * type, or if it does not have a default value. >+ * <p> >+ * Note that {@link IMemberValuePair#getValue()} might return <code>null</code>. >+ * Please see this method for more details. >+ * </p> >+ * >+ * @exception JavaModelException if this element does not exist or if an >+ * exception occurs while accessing its corresponding resource. >+ * @since 3.4 >+ */ >+IMemberValuePair getDefaultValue() throws JavaModelException; >+/** > * Returns the simple name of this method. > * For a constructor, this returns the simple name of the declaring type. > * Note: This holds whether the constructor appears in a source or binary type >Index: model/org/eclipse/jdt/internal/core/jdom/SimpleDOMBuilder.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/jdom/SimpleDOMBuilder.java,v >retrieving revision 1.46 >diff -u -r1.46 SimpleDOMBuilder.java >--- model/org/eclipse/jdt/internal/core/jdom/SimpleDOMBuilder.java 24 Oct 2007 13:50:52 -0000 1.46 >+++ model/org/eclipse/jdt/internal/core/jdom/SimpleDOMBuilder.java 22 Nov 2007 10:05:22 -0000 >@@ -18,6 +18,7 @@ > import org.eclipse.jdt.core.jdom.*; > import org.eclipse.jdt.internal.compiler.ISourceElementRequestor; > import org.eclipse.jdt.internal.compiler.SourceElementParser; >+import org.eclipse.jdt.internal.compiler.ast.Expression; > import org.eclipse.jdt.internal.compiler.ast.ImportReference; > import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration; > import org.eclipse.jdt.internal.compiler.env.ICompilationUnit; >@@ -171,7 +172,7 @@ > } > /** > */ >-public void exitMethod(int declarationEnd, int defaultValueStart, int defaultValueEnd) { >+public void exitMethod(int declarationEnd, Expression defaultValue) { > exitMember(declarationEnd); > } > /**
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 209958
: 83518