Index: src/org/eclipse/jdt/core/tests/dom/ASTConverter15Test.java =================================================================== RCS file: /home/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverter15Test.java,v retrieving revision 1.169 diff -u -r1.169 ASTConverter15Test.java --- src/org/eclipse/jdt/core/tests/dom/ASTConverter15Test.java 12 Aug 2005 15:40:11 -0000 1.169 +++ src/org/eclipse/jdt/core/tests/dom/ASTConverter15Test.java 19 Aug 2005 14:59:17 -0000 @@ -11,11 +11,16 @@ package org.eclipse.jdt.core.tests.dom; +import java.io.File; import java.io.IOException; +import java.util.HashMap; import java.util.List; +import java.util.Map; import junit.framework.Test; +import org.eclipse.core.resources.IFolder; +import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.CoreException; import org.eclipse.jdt.core.ICompilationUnit; import org.eclipse.jdt.core.IJavaElement; @@ -24,6 +29,7 @@ import org.eclipse.jdt.core.JavaCore; import org.eclipse.jdt.core.JavaModelException; import org.eclipse.jdt.core.dom.*; +import org.eclipse.jdt.core.tests.util.Util; public class ASTConverter15Test extends ConverterTestSetup { @@ -39,7 +45,7 @@ } static { -// TESTS_NUMBERS = new int[] { 195 }; +// TESTS_NUMBERS = new int[] { 196 }; // TESTS_NAMES = new String[] {"test0189"}; } public static Test suite() { @@ -5879,4 +5885,45 @@ assertTrue("Bindings are not equals", methodBinding2.isEqualTo(methodBinding2)); assertTrue("Bindings are not equals", methodBinding.isEqualTo(methodBinding)); } + + /* + * Ensures that creating an AST with binding resolution where there is a problem in a binary + * doesn't throw an NPE + * (regression test for bug 100606 NPE during reconcile) + */ + public void test0196() throws CoreException { + try { + createJavaProject("P", new String[] {"src" }, new String[] {"CONVERTER_JCL15_LIB", "/P/lib"}, "bin", "1.5"); + IFolder folder = createFolder("/P/lib"); + String classesPath = folder.getLocation().toOSString(); + Map options = new HashMap(); + String[] pathsAndContents = new String[] { + "p/Bin.java", + "package p;\n" + + "public class Bin {\n" + + "}", + "p/BinSub.java", + "package p;\n" + + "public class BinSub extends Bin {\n" + + "}", + }; + Util.compile(pathsAndContents, options, classesPath); + folder.refreshLocal(IResource.DEPTH_INFINITE, null); + folder.getFolder("p").getFile("Bin.class").delete(false, null); + this.workingCopy = getWorkingCopy("/P/src/X.java", true/*resolve*/); + String contents = + "public class X {\n" + + " void bar() throws p.BinSub {\n" + + " }\n" + + " void foo() {\n" + + " }\n" + + "}"; + IBinding[] bindings = resolveBindings(contents, this.workingCopy); + assertBindingsEqual( + "LX;.foo():TT;", + bindings); + } finally { + deleteProject("P"); + } + } } \ No newline at end of file