### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.core 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.65 diff -u -r1.65 SourceMethod.java --- model/org/eclipse/jdt/internal/core/SourceMethod.java 22 Nov 2007 11:51:58 -0000 1.65 +++ model/org/eclipse/jdt/internal/core/SourceMethod.java 8 Apr 2008 17:20:50 -0000 @@ -51,7 +51,7 @@ return super.equals(o) && Util.equalArraysOrNull(this.parameterTypes, ((SourceMethod)o).parameterTypes); } public IMemberValuePair getDefaultValue() throws JavaModelException { - SourceMethodInfo sourceMethodInfo = (SourceMethodInfo) getElementInfo(); + SourceMethodElementInfo sourceMethodInfo = (SourceMethodElementInfo) getElementInfo(); if (sourceMethodInfo.isAnnotationMethod()) { return ((SourceAnnotationMethodInfo) sourceMethodInfo).defaultValue; } #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.63 diff -u -r1.63 CompilationUnitTests.java --- src/org/eclipse/jdt/core/tests/model/CompilationUnitTests.java 5 Apr 2008 08:45:19 -0000 1.63 +++ src/org/eclipse/jdt/core/tests/model/CompilationUnitTests.java 8 Apr 2008 17:20:54 -0000 @@ -261,6 +261,27 @@ } /* + * Ensures that the default value for a constructor doesn't throw a ClassCastException + * (regression test for https://bugs.eclipse.org/bugs/show_bug.cgi?id=226134 ) + */ +public void testDefaultValue6() throws CoreException { + try { + String cuSource = + "package p;\n" + + "public class Y {\n" + + " public Y() {}\n" + + "}"; + createFile("/P/src/p/Y.java", cuSource); + IMethod method = getCompilationUnit("/P/src/p/Y.java").getType("Y").getMethod("Y", new String[0]); + assertMemberValuePairEquals( + "", + 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) */