### Eclipse Workspace Patch 1.0 #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.38 diff -u -r1.38 CompilationUnitTests.java --- src/org/eclipse/jdt/core/tests/model/CompilationUnitTests.java 24 Nov 2005 12:14:42 -0000 1.38 +++ src/org/eclipse/jdt/core/tests/model/CompilationUnitTests.java 14 Dec 2005 17:20:43 -0000 @@ -1153,4 +1153,28 @@ deleteFile("/P/src/X.java"); } } +public void test120902() throws CoreException { + try { + String source = + "/**\r\n" + + " * Toy\r\n" + + " */\r\n" + + "public class X {\r\n" + + "}"; + createFile("/P/src/X.java", source); + final ICompilationUnit compilationUnit = getCompilationUnit("/P/src/X.java"); + IType type = compilationUnit.getType("X"); + ISourceRange javadocRange = type.getJavadocRange(); + assertNotNull("No source range", javadocRange); + compilationUnit.getBuffer().setContents(""); + try { + javadocRange = type.getJavadocRange(); + assertNull("Got a source range", javadocRange); + } catch (ArrayIndexOutOfBoundsException e) { + assertFalse("Should not happen", true); + } + } finally { + deleteFile("/P/src/X.java"); + } +} }