diff --git a/tests/org.eclipse.wst.jsdt.core.tests.compiler/META-INF/MANIFEST.MF b/tests/org.eclipse.wst.jsdt.core.tests.compiler/META-INF/MANIFEST.MF
index 4737d63..c659474 100644
--- a/tests/org.eclipse.wst.jsdt.core.tests.compiler/META-INF/MANIFEST.MF
+++ b/tests/org.eclipse.wst.jsdt.core.tests.compiler/META-INF/MANIFEST.MF
@@ -12,7 +12,6 @@
 Export-Package: org.eclipse.wst.jsdt.core.tests.compiler,
  org.eclipse.wst.jsdt.core.tests.compiler.parser,
  org.eclipse.wst.jsdt.core.tests.compiler.regression,
- org.eclipse.wst.jsdt.core.tests.eval,
  org.eclipse.wst.jsdt.core.tests.eval.target,
  org.eclipse.wst.jsdt.core.tests.interpret,
  org.eclipse.wst.jsdt.core.tests.junit.extension,
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/JSDTTestAll.java b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/JSDTTestAll.java
index 7b9942b..5455ac7 100644
--- a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/JSDTTestAll.java
+++ b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/JSDTTestAll.java
@@ -15,6 +15,7 @@
 
 import org.eclipse.wst.jsdt.core.tests.compiler.regression.BasicErrorTests;
 import org.eclipse.wst.jsdt.core.tests.compiler.regression.BasicParserTests;
+import org.eclipse.wst.jsdt.core.tests.compiler.regression.BasicResolveTests;
 import org.eclipse.wst.jsdt.core.tests.compiler.regression.InferTypesTests;
 import org.eclipse.wst.jsdt.core.tests.junit.extension.TestCase;
 import org.eclipse.wst.jsdt.core.tests.util.AbstractCompilerTest;
@@ -36,6 +37,7 @@
 	standardTests.add(BasicParserTests.class);
 //	standardTests.add(BasicErrorTests.class);
 	standardTests.add(InferTypesTests.class);
+	standardTests.add(BasicResolveTests.class);
 	//	// add all javadoc tests
 //	for (int i=0, l=JavadocTest.ALL_CLASSES.size(); i<l; i++) {
 //		standardTests.add(JavadocTest.ALL_CLASSES.get(i));
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/AbstractRegressionTest.java b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/AbstractRegressionTest.java
index 68a38a8..0beda0f 100644
--- a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/AbstractRegressionTest.java
+++ b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/AbstractRegressionTest.java
@@ -13,7 +13,6 @@
 import java.io.BufferedReader;
 import java.io.BufferedWriter;
 import java.io.File;
-import java.io.FileInputStream;
 import java.io.FileOutputStream;
 import java.io.FileWriter;
 import java.io.IOException;
@@ -48,7 +47,6 @@
 import org.eclipse.wst.jsdt.internal.compiler.ast.CompilationUnitDeclaration;
 import org.eclipse.wst.jsdt.internal.compiler.batch.CompilationUnit;
 import org.eclipse.wst.jsdt.internal.compiler.batch.FileSystem;
-import org.eclipse.wst.jsdt.internal.compiler.classfmt.ClassFileReader;
 import org.eclipse.wst.jsdt.internal.compiler.env.ICompilationUnit;
 import org.eclipse.wst.jsdt.internal.compiler.env.INameEnvironment;
 import org.eclipse.wst.jsdt.internal.compiler.impl.CompilerOptions;
@@ -59,7 +57,7 @@
 import org.eclipse.wst.jsdt.internal.compiler.problem.DefaultProblemFactory;
 import org.eclipse.wst.jsdt.internal.compiler.problem.ProblemReporter;
 import org.eclipse.wst.jsdt.internal.core.search.JavaSearchParticipant;
-import org.eclipse.wst.jsdt.internal.core.search.indexing.BinaryIndexer;
+import org.eclipse.wst.jsdt.internal.core.search.indexing.SourceIndexer;
 import org.eclipse.wst.jsdt.internal.infer.InferEngine;
 import org.eclipse.wst.jsdt.internal.infer.InferOptions;
 
@@ -335,7 +333,7 @@
 			}
 		};
 		SearchDocument document = participant.getDocument(new File(classFilePath).getPath());
-		BinaryIndexer indexer = new BinaryIndexer(document) {
+		SourceIndexer indexer = new SourceIndexer(document) {
 			protected void addIndexEntry(char[] category, char[] key) {
 				references.append(category);
 				references.append('/');
@@ -348,25 +346,7 @@
 		return computedReferences;
 	}
 	
-	protected ClassFileReader getClassFileReader(String fileName, String className) {
-		File classFile = new File(fileName);
-		if (!classFile.exists()) {
-			assertTrue(".class file doesn't exist", false);
-		}
-		try {
-			FileInputStream stream = new FileInputStream(classFile);
-			ClassFileReader reader = ClassFileReader.read(stream, className + ".class", true);
-			stream.close();
-			return reader;
-		} catch (org.eclipse.wst.jsdt.internal.compiler.classfmt.ClassFormatException e) {
-			e.printStackTrace();
-			assertTrue("ClassFormatException", false);
-		} catch (IOException e) {
-			e.printStackTrace();
-			assertTrue("IOException", false);
-		}
-		return null;
-	}
+
 
 	protected INameEnvironment[] getClassLibs() {
 		String encoding = (String)getCompilerOptions().get(CompilerOptions.OPTION_Encoding);
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/AnnotationTest.java b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/AnnotationTest.java
index 506d7ea..632364d 100644
--- a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/AnnotationTest.java
+++ b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/AnnotationTest.java
@@ -11,7 +11,6 @@
 package org.eclipse.wst.jsdt.core.tests.compiler.regression;
 
 import java.io.File;
-import java.io.IOException;
 import java.util.HashMap;
 import java.util.Hashtable;
 import java.util.Map;
@@ -20,8 +19,6 @@
 
 import org.eclipse.wst.jsdt.core.tests.util.Util;
 import org.eclipse.wst.jsdt.internal.compiler.classfmt.ClassFileConstants;
-import org.eclipse.wst.jsdt.internal.compiler.classfmt.ClassFileReader;
-import org.eclipse.wst.jsdt.internal.compiler.classfmt.ClassFormatException;
 import org.eclipse.wst.jsdt.internal.compiler.impl.CompilerOptions;
 
 public class AnnotationTest extends AbstractComparableTest {
@@ -3265,52 +3262,6 @@
 			"");	
 	}
 	
-	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=82136
-	public void test105() {
-		this.runConformTest(
-			new String[] {
-				"Property.java",
-				"import java.lang.annotation.Documented;\n" +
-				"import java.lang.annotation.Retention;\n" +
-				"import java.lang.annotation.RetentionPolicy;\n" +
-				"\n" +
-				"@Documented\n" +
-				"@Retention(RetentionPolicy.RUNTIME)\n" +
-				"public @interface Property\n" +
-				"{\n" +
-				"  String property();\n" +
-				"  String identifier() default \"\";\n" +
-				"}",
-				"Properties.java",
-				"import java.lang.annotation.Documented;\n" +
-				"import java.lang.annotation.Retention;\n" +
-				"import java.lang.annotation.RetentionPolicy;\n" +
-				"\n" +
-				"@Documented\n" +
-				"@Retention(RetentionPolicy.RUNTIME)\n" +
-				"public @interface Properties {\n" +
-				"  Property[] value();\n" +
-				"}",
-				"X.java",
-				"@Properties({\n" +
-				"  @Property(property = \"prop\", identifier = \"someIdentifier\"),\n" +
-				"  @Property(property = \"type\")\n" +
-				"})\n" +
-				"public interface X {\n" +
-				"  void setName();\n" +
-				"  String getName();\n" +
-				"}"
-			},
-			"");	
-			try {
-				byte[] classFileBytes = org.eclipse.wst.jsdt.internal.compiler.util.Util.getFileByteContent(new File(OUTPUT_DIR + File.separator  +"X.class"));
-				new ClassFileReader(classFileBytes, "X.java".toCharArray(), true);
-			} catch (ClassFormatException e) {
-				assertTrue("ClassFormatException", false);
-			} catch (IOException e) {
-				assertTrue("IOException", false);
-			}
-	}
     
     // https://bugs.eclipse.org/bugs/show_bug.cgi?id=83939
     public void test106() {
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/GenericTypeSignatureTest.java b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/GenericTypeSignatureTest.java
index 0e67c0f..a29f227 100644
--- a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/GenericTypeSignatureTest.java
+++ b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/GenericTypeSignatureTest.java
@@ -21,10 +21,6 @@
 import org.eclipse.core.runtime.IPath;
 import org.eclipse.core.runtime.Path;
 import org.eclipse.wst.jsdt.core.tests.util.Util;
-import org.eclipse.wst.jsdt.internal.compiler.classfmt.ClassFileReader;
-import org.eclipse.wst.jsdt.internal.compiler.classfmt.ClassFormatException;
-import org.eclipse.wst.jsdt.internal.compiler.env.IBinaryField;
-import org.eclipse.wst.jsdt.internal.compiler.env.IBinaryMethod;
 import org.eclipse.wst.jsdt.internal.compiler.impl.CompilerOptions;
 
 public class GenericTypeSignatureTest extends AbstractRegressionTest {
@@ -292,235 +288,235 @@
 		
 	}
 	
-	public void test006() {
-		final String[] testsSource = new String[] {
-			"X.java",
-			"public class X <T> {\n" + 
-			"    protected T t;\n" + 
-			"    X(T t) {\n" +
-			"        this.t = t;\n" + 
-			"    }\n" + 
-			"	T foo(T t1) {\n" + 
-			"		return t1;\n" + 
-			"    }\n" + 
-			"	T field;\n" +
-			"    public static void main(String[] args) {\n" + 
-			"        System.out.print(\"SUCCESS\");\n" + 
-			"    }\n" + 
-			"}",
-		};
-		this.runConformTest(
-			testsSource,
-			"SUCCESS");
-
-		try {
-			ClassFileReader classFileReader = ClassFileReader.read(OUTPUT_DIR + File.separator + "X.class");
-			assertEquals("Wrong signature", "<T:Ljava/lang/Object;>Ljava/lang/Object;", new String(classFileReader.getGenericSignature()));
-			
-			IBinaryField[] fields = classFileReader.getFields();
-			assertNotNull("No fields", fields);
-			assertEquals("Wrong size", 2, fields.length);
-			assertEquals("Wrong name", "field", new String(fields[1].getName()));
-			char[] signature = fields[1].getGenericSignature();
-			assertNotNull("No signature", signature);
-			assertEquals("Wrong signature", "TT;", new String(signature));
-
-			IBinaryMethod[] methods = classFileReader.getMethods();
-			assertNotNull("No methods", methods);
-			assertEquals("Wrong size", 3, methods.length);
-			assertEquals("Wrong name", "foo", new String(methods[1].getSelector()));
-			signature = methods[1].getGenericSignature();
-			assertNotNull("No signature", signature);
-			assertEquals("Wrong signature", "(TT;)TT;", new String(signature));
-		} catch (ClassFormatException e) {
-			assertTrue(false);
-		} catch (IOException e) {
-			assertTrue(false);
-		}
-	}
-
-	public void test007() {
-		final String[] testsSource = new String[] {
-			"X.java",
-			"public class X <T> {\n" + 
-			"    protected T t;\n" + 
-			"    X(T t) {\n" +
-			"        this.t = t;\n" + 
-			"    }\n" + 
-			"	T foo(X<T> x1) {\n" + 
-			"		return x1.t;\n" + 
-			"    }\n" + 
-			"	X<T> field;\n" +
-			"    public static void main(String[] args) {\n" + 
-			"        System.out.print(\"SUCCESS\");\n" + 
-			"    }\n" + 
-			"}",
-		};
-		this.runConformTest(
-			testsSource,
-			"SUCCESS");
-
-		try {
-			ClassFileReader classFileReader = ClassFileReader.read(OUTPUT_DIR + File.separator + "X.class");
-			assertEquals("Wrong signature", "<T:Ljava/lang/Object;>Ljava/lang/Object;", new String(classFileReader.getGenericSignature()));
-			
-			IBinaryField[] fields = classFileReader.getFields();
-			assertNotNull("No fields", fields);
-			assertEquals("Wrong size", 2, fields.length);
-			assertEquals("Wrong name", "field", new String(fields[1].getName()));
-			char[] signature = fields[1].getGenericSignature();
-			assertNotNull("No signature", signature);
-			assertEquals("Wrong signature", "LX<TT;>;", new String(signature));
-
-			IBinaryMethod[] methods = classFileReader.getMethods();
-			assertNotNull("No methods", methods);
-			assertEquals("Wrong size", 3, methods.length);
-			assertEquals("Wrong name", "foo", new String(methods[1].getSelector()));
-			signature = methods[1].getGenericSignature();
-			assertNotNull("No signature", signature);
-			assertEquals("Wrong signature", "(LX<TT;>;)TT;", new String(signature));
-		} catch (ClassFormatException e) {
-			assertTrue(false);
-		} catch (IOException e) {
-			assertTrue(false);
-		}
-	}
-
-	public void test008() {
-		final String[] testsSource = new String[] {
-			"X.java",
-			"public class X  <T> {\n" + 
-			"	T newInstance() throws IllegalAccessException {\n" + 
-			"	    return null;\n" + 
-			"	}\n" + 
-			"    public static void main(String[] args) {\n" + 
-			"        System.out.print(\"SUCCESS\");\n" + 
-			"    }\n" + 
-			"}",
-		};
-		this.runConformTest(
-			testsSource,
-			"SUCCESS");
-
-		try {
-			ClassFileReader classFileReader = ClassFileReader.read(OUTPUT_DIR + File.separator + "X.class");
-			IBinaryMethod[] methods = classFileReader.getMethods();
-			assertNotNull("No methods", methods);
-			assertEquals("Wrong size", 3, methods.length);
-			assertEquals("Wrong name", "newInstance", new String(methods[1].getSelector()));
-			char[] signature = methods[1].getGenericSignature();
-			assertNotNull("No signature", signature);
-			assertEquals("Wrong signature", "()TT;", new String(signature));
-		} catch (ClassFormatException e) {
-			assertTrue(false);
-		} catch (IOException e) {
-			assertTrue(false);
-		}
-	}
+//	public void test006() {
+//		final String[] testsSource = new String[] {
+//			"X.java",
+//			"public class X <T> {\n" + 
+//			"    protected T t;\n" + 
+//			"    X(T t) {\n" +
+//			"        this.t = t;\n" + 
+//			"    }\n" + 
+//			"	T foo(T t1) {\n" + 
+//			"		return t1;\n" + 
+//			"    }\n" + 
+//			"	T field;\n" +
+//			"    public static void main(String[] args) {\n" + 
+//			"        System.out.print(\"SUCCESS\");\n" + 
+//			"    }\n" + 
+//			"}",
+//		};
+//		this.runConformTest(
+//			testsSource,
+//			"SUCCESS");
+//
+//		try {
+//			ClassFileReader classFileReader = ClassFileReader.read(OUTPUT_DIR + File.separator + "X.class");
+//			assertEquals("Wrong signature", "<T:Ljava/lang/Object;>Ljava/lang/Object;", new String(classFileReader.getGenericSignature()));
+//			
+//			IBinaryField[] fields = classFileReader.getFields();
+//			assertNotNull("No fields", fields);
+//			assertEquals("Wrong size", 2, fields.length);
+//			assertEquals("Wrong name", "field", new String(fields[1].getName()));
+//			char[] signature = fields[1].getGenericSignature();
+//			assertNotNull("No signature", signature);
+//			assertEquals("Wrong signature", "TT;", new String(signature));
+//
+//			IBinaryMethod[] methods = classFileReader.getMethods();
+//			assertNotNull("No methods", methods);
+//			assertEquals("Wrong size", 3, methods.length);
+//			assertEquals("Wrong name", "foo", new String(methods[1].getSelector()));
+//			signature = methods[1].getGenericSignature();
+//			assertNotNull("No signature", signature);
+//			assertEquals("Wrong signature", "(TT;)TT;", new String(signature));
+//		} catch (ClassFormatException e) {
+//			assertTrue(false);
+//		} catch (IOException e) {
+//			assertTrue(false);
+//		}
+//	}
+//
+//	public void test007() {
+//		final String[] testsSource = new String[] {
+//			"X.java",
+//			"public class X <T> {\n" + 
+//			"    protected T t;\n" + 
+//			"    X(T t) {\n" +
+//			"        this.t = t;\n" + 
+//			"    }\n" + 
+//			"	T foo(X<T> x1) {\n" + 
+//			"		return x1.t;\n" + 
+//			"    }\n" + 
+//			"	X<T> field;\n" +
+//			"    public static void main(String[] args) {\n" + 
+//			"        System.out.print(\"SUCCESS\");\n" + 
+//			"    }\n" + 
+//			"}",
+//		};
+//		this.runConformTest(
+//			testsSource,
+//			"SUCCESS");
+//
+//		try {
+//			ClassFileReader classFileReader = ClassFileReader.read(OUTPUT_DIR + File.separator + "X.class");
+//			assertEquals("Wrong signature", "<T:Ljava/lang/Object;>Ljava/lang/Object;", new String(classFileReader.getGenericSignature()));
+//			
+//			IBinaryField[] fields = classFileReader.getFields();
+//			assertNotNull("No fields", fields);
+//			assertEquals("Wrong size", 2, fields.length);
+//			assertEquals("Wrong name", "field", new String(fields[1].getName()));
+//			char[] signature = fields[1].getGenericSignature();
+//			assertNotNull("No signature", signature);
+//			assertEquals("Wrong signature", "LX<TT;>;", new String(signature));
+//
+//			IBinaryMethod[] methods = classFileReader.getMethods();
+//			assertNotNull("No methods", methods);
+//			assertEquals("Wrong size", 3, methods.length);
+//			assertEquals("Wrong name", "foo", new String(methods[1].getSelector()));
+//			signature = methods[1].getGenericSignature();
+//			assertNotNull("No signature", signature);
+//			assertEquals("Wrong signature", "(LX<TT;>;)TT;", new String(signature));
+//		} catch (ClassFormatException e) {
+//			assertTrue(false);
+//		} catch (IOException e) {
+//			assertTrue(false);
+//		}
+//	}
+//
+//	public void test008() {
+//		final String[] testsSource = new String[] {
+//			"X.java",
+//			"public class X  <T> {\n" + 
+//			"	T newInstance() throws IllegalAccessException {\n" + 
+//			"	    return null;\n" + 
+//			"	}\n" + 
+//			"    public static void main(String[] args) {\n" + 
+//			"        System.out.print(\"SUCCESS\");\n" + 
+//			"    }\n" + 
+//			"}",
+//		};
+//		this.runConformTest(
+//			testsSource,
+//			"SUCCESS");
+//
+//		try {
+//			ClassFileReader classFileReader = ClassFileReader.read(OUTPUT_DIR + File.separator + "X.class");
+//			IBinaryMethod[] methods = classFileReader.getMethods();
+//			assertNotNull("No methods", methods);
+//			assertEquals("Wrong size", 3, methods.length);
+//			assertEquals("Wrong name", "newInstance", new String(methods[1].getSelector()));
+//			char[] signature = methods[1].getGenericSignature();
+//			assertNotNull("No signature", signature);
+//			assertEquals("Wrong signature", "()TT;", new String(signature));
+//		} catch (ClassFormatException e) {
+//			assertTrue(false);
+//		} catch (IOException e) {
+//			assertTrue(false);
+//		}
+//	}
 	
-	public void test009() {
-		final String[] testsSource = new String[] {
-			"X.java",
-			"public class X<T> {\n" + 
-			"class MX<U> {\n" + 
-			"}\n" + 
-			" \n" + 
-			"public static void main(String[] args) {\n" + 
-			"    new X<Thread>().foo(new X<String>().new MX<Thread>());\n" + 
-			"}\n" + 
-			"void foo(X<String>.MX<Thread> mx) {\n" + 
-			"   System.out.println(\"SUCCESS\");\n" + 
-			"}\n" + 
-			"}",
-		};
-		this.runConformTest(
-			testsSource,
-			"SUCCESS");
-
-		try {
-			ClassFileReader classFileReader = ClassFileReader.read(OUTPUT_DIR + File.separator + "X.class");
-			IBinaryMethod[] methods = classFileReader.getMethods();
-			assertNotNull("No methods", methods);
-			assertEquals("Wrong size", 3, methods.length);
-			assertEquals("Wrong name", "foo", new String(methods[2].getSelector()));
-			char[] signature = methods[2].getGenericSignature();
-			assertNotNull("No signature", signature);
-			assertEquals("Wrong signature", "(LX<Ljava/lang/String;>.MX<Ljava/lang/Thread;>;)V", new String(signature));
-		} catch (ClassFormatException e) {
-			assertTrue(false);
-		} catch (IOException e) {
-			assertTrue(false);
-		}
-	}
+//	public void test009() {
+//		final String[] testsSource = new String[] {
+//			"X.java",
+//			"public class X<T> {\n" + 
+//			"class MX<U> {\n" + 
+//			"}\n" + 
+//			" \n" + 
+//			"public static void main(String[] args) {\n" + 
+//			"    new X<Thread>().foo(new X<String>().new MX<Thread>());\n" + 
+//			"}\n" + 
+//			"void foo(X<String>.MX<Thread> mx) {\n" + 
+//			"   System.out.println(\"SUCCESS\");\n" + 
+//			"}\n" + 
+//			"}",
+//		};
+//		this.runConformTest(
+//			testsSource,
+//			"SUCCESS");
+//
+//		try {
+//			ClassFileReader classFileReader = ClassFileReader.read(OUTPUT_DIR + File.separator + "X.class");
+//			IBinaryMethod[] methods = classFileReader.getMethods();
+//			assertNotNull("No methods", methods);
+//			assertEquals("Wrong size", 3, methods.length);
+//			assertEquals("Wrong name", "foo", new String(methods[2].getSelector()));
+//			char[] signature = methods[2].getGenericSignature();
+//			assertNotNull("No signature", signature);
+//			assertEquals("Wrong signature", "(LX<Ljava/lang/String;>.MX<Ljava/lang/Thread;>;)V", new String(signature));
+//		} catch (ClassFormatException e) {
+//			assertTrue(false);
+//		} catch (IOException e) {
+//			assertTrue(false);
+//		}
+//	}
 	
-	public void test010() {
-		final String[] testsSource = new String[] {
-			"X.java",
-			"public class X<T> {\n" + 
-			"class MX<U> {\n" + 
-			"}\n" + 
-			" \n" + 
-			"public static void main(String[] args) {\n" + 
-			"    new X<Thread>().foo(new X<String>().new MX<Thread>());\n" + 
-			"}\n" + 
-			"void foo(X.MX mx) {\n" + 
-			"   System.out.println(\"SUCCESS\");\n" + 
-			"}\n" + 
-			"}",
-		};
-		this.runConformTest(
-			testsSource,
-			"SUCCESS");
-
-		try {
-			ClassFileReader classFileReader = ClassFileReader.read(OUTPUT_DIR + File.separator + "X.class");
-			IBinaryMethod[] methods = classFileReader.getMethods();
-			assertNotNull("No methods", methods);
-			assertEquals("Wrong size", 3, methods.length);
-			assertEquals("Wrong name", "foo", new String(methods[2].getSelector()));
-			char[] signature = methods[2].getGenericSignature();
-			assertNull("Unexpected generic signature", signature);
-		} catch (ClassFormatException e) {
-			assertTrue(false);
-		} catch (IOException e) {
-			assertTrue(false);
-		}
-	}
+//	public void test010() {
+//		final String[] testsSource = new String[] {
+//			"X.java",
+//			"public class X<T> {\n" + 
+//			"class MX<U> {\n" + 
+//			"}\n" + 
+//			" \n" + 
+//			"public static void main(String[] args) {\n" + 
+//			"    new X<Thread>().foo(new X<String>().new MX<Thread>());\n" + 
+//			"}\n" + 
+//			"void foo(X.MX mx) {\n" + 
+//			"   System.out.println(\"SUCCESS\");\n" + 
+//			"}\n" + 
+//			"}",
+//		};
+//		this.runConformTest(
+//			testsSource,
+//			"SUCCESS");
+//
+//		try {
+//			ClassFileReader classFileReader = ClassFileReader.read(OUTPUT_DIR + File.separator + "X.class");
+//			IBinaryMethod[] methods = classFileReader.getMethods();
+//			assertNotNull("No methods", methods);
+//			assertEquals("Wrong size", 3, methods.length);
+//			assertEquals("Wrong name", "foo", new String(methods[2].getSelector()));
+//			char[] signature = methods[2].getGenericSignature();
+//			assertNull("Unexpected generic signature", signature);
+//		} catch (ClassFormatException e) {
+//			assertTrue(false);
+//		} catch (IOException e) {
+//			assertTrue(false);
+//		}
+//	}
 	
-	public void test011() {
-		final String[] testsSource = new String[] {
-			"X.java",
-			"public class X<T> {\n" + 
-			"  class MX<U> {\n" + 
-			"  }\n" + 
-			"\n" + 
-			"  public static void main(String[] args) {\n" + 
-			"    new X<Thread>().foo(new X<String>().new MX<Thread>());\n" + 
-			"  }\n" + 
-			"  void foo(X<String>.MX<?> mx) {\n" + 
-			"	System.out.println(\"SUCCESS\");\n" + 
-			"  }\n" + 
-			"}",
-		};
-		this.runConformTest(
-			testsSource,
-			"SUCCESS");
-
-		try {
-			ClassFileReader classFileReader = ClassFileReader.read(OUTPUT_DIR + File.separator + "X.class");
-			IBinaryMethod[] methods = classFileReader.getMethods();
-			assertNotNull("No methods", methods);
-			assertEquals("Wrong size", 3, methods.length);
-			assertEquals("Wrong name", "foo", new String(methods[2].getSelector()));
-			char[] signature = methods[2].getGenericSignature();
-			assertNotNull("No signature", signature);
-			assertEquals("Wrong signature", "(LX<Ljava/lang/String;>.MX<*>;)V", new String(signature));
-		} catch (ClassFormatException e) {
-			assertTrue(false);
-		} catch (IOException e) {
-			assertTrue(false);
-		}
-	}
+//	public void test011() {
+//		final String[] testsSource = new String[] {
+//			"X.java",
+//			"public class X<T> {\n" + 
+//			"  class MX<U> {\n" + 
+//			"  }\n" + 
+//			"\n" + 
+//			"  public static void main(String[] args) {\n" + 
+//			"    new X<Thread>().foo(new X<String>().new MX<Thread>());\n" + 
+//			"  }\n" + 
+//			"  void foo(X<String>.MX<?> mx) {\n" + 
+//			"	System.out.println(\"SUCCESS\");\n" + 
+//			"  }\n" + 
+//			"}",
+//		};
+//		this.runConformTest(
+//			testsSource,
+//			"SUCCESS");
+//
+//		try {
+//			ClassFileReader classFileReader = ClassFileReader.read(OUTPUT_DIR + File.separator + "X.class");
+//			IBinaryMethod[] methods = classFileReader.getMethods();
+//			assertNotNull("No methods", methods);
+//			assertEquals("Wrong size", 3, methods.length);
+//			assertEquals("Wrong name", "foo", new String(methods[2].getSelector()));
+//			char[] signature = methods[2].getGenericSignature();
+//			assertNotNull("No signature", signature);
+//			assertEquals("Wrong signature", "(LX<Ljava/lang/String;>.MX<*>;)V", new String(signature));
+//		} catch (ClassFormatException e) {
+//			assertTrue(false);
+//		} catch (IOException e) {
+//			assertTrue(false);
+//		}
+//	}
 	
 	// WORK check whether needed or not
 	/*
@@ -552,331 +548,331 @@
 		}
 	}
 
-	public void test012() {
-		final String[] testsSource = new String[] {
-			"X.java",
-			"public class X<T> {\n" + 
-			"  class MX<U> {\n" + 
-			"  }\n" + 
-			"\n" + 
-			"  public static void main(String[] args) {\n" + 
-			"    new X<Thread>().foo(new X<String>().new MX<Thread>());\n" + 
-			"  }\n" + 
-			"  void foo(X.MX mx) {			// no signature\n" + 
-			"	System.out.println(\"SUCCESS\");\n" + 
-			"  }\n" + 
-			"}",
-		};
-		this.runConformTest(
-			testsSource,
-			"SUCCESS");
+//	public void test012() {
+//		final String[] testsSource = new String[] {
+//			"X.java",
+//			"public class X<T> {\n" + 
+//			"  class MX<U> {\n" + 
+//			"  }\n" + 
+//			"\n" + 
+//			"  public static void main(String[] args) {\n" + 
+//			"    new X<Thread>().foo(new X<String>().new MX<Thread>());\n" + 
+//			"  }\n" + 
+//			"  void foo(X.MX mx) {			// no signature\n" + 
+//			"	System.out.println(\"SUCCESS\");\n" + 
+//			"  }\n" + 
+//			"}",
+//		};
+//		this.runConformTest(
+//			testsSource,
+//			"SUCCESS");
+//	
+//		try {
+//			ClassFileReader classFileReader = ClassFileReader.read(OUTPUT_DIR + File.separator + "X.class");
+//			IBinaryMethod[] methods = classFileReader.getMethods();
+//			assertNotNull("No methods", methods);
+//			assertEquals("Wrong size", 3, methods.length);
+//			assertEquals("Wrong name", "foo", new String(methods[2].getSelector()));
+//			assertNull("Wrong signature", methods[2].getGenericSignature());
+//		} catch (ClassFormatException e) {
+//			assertTrue(false);
+//		} catch (IOException e) {
+//			assertTrue(false);
+//		}
+//	}
 	
-		try {
-			ClassFileReader classFileReader = ClassFileReader.read(OUTPUT_DIR + File.separator + "X.class");
-			IBinaryMethod[] methods = classFileReader.getMethods();
-			assertNotNull("No methods", methods);
-			assertEquals("Wrong size", 3, methods.length);
-			assertEquals("Wrong name", "foo", new String(methods[2].getSelector()));
-			assertNull("Wrong signature", methods[2].getGenericSignature());
-		} catch (ClassFormatException e) {
-			assertTrue(false);
-		} catch (IOException e) {
-			assertTrue(false);
-		}
-	}
-	
-	public void test013() {
-		final String[] testsSource = new String[] {
-			"X.java",
-			"import java.util.ArrayList;\n" + 
-			"\n" + 
-			"public class X<T> {\n" + 
-			"	\n" + 
-			"	public static void main(String[] args) {\n" + 
-			"		System.out.println(\"SUCCESS\");\n" + 
-			"	}\n" + 
-			"	public <U> void foo(ArrayList<U> arr) {\n" + 
-			"		for (U e : arr) {\n" + 
-			"			System.out.println(e);\n" + 
-			"		}\n" + 
-			"	}\n" + 
-			"}",
-		};
-		this.runConformTest(
-			testsSource,
-			"SUCCESS");
-
-		try {
-			ClassFileReader classFileReader = ClassFileReader.read(OUTPUT_DIR + File.separator + "X.class");
-			IBinaryMethod[] methods = classFileReader.getMethods();
-			assertNotNull("No methods", methods);
-			assertEquals("Wrong size", 3, methods.length);
-			assertEquals("Wrong name", "foo", new String(methods[2].getSelector()));
-			char[] signature = methods[2].getGenericSignature();
-			assertNotNull("No signature", signature);
-			assertEquals("Wrong signature", "<U:Ljava/lang/Object;>(Ljava/util/ArrayList<TU;>;)V", new String(signature));
-		} catch (ClassFormatException e) {
-			assertTrue(false);
-		} catch (IOException e) {
-			assertTrue(false);
-		}
-	}
+//	public void test013() {
+//		final String[] testsSource = new String[] {
+//			"X.java",
+//			"import java.util.ArrayList;\n" + 
+//			"\n" + 
+//			"public class X<T> {\n" + 
+//			"	\n" + 
+//			"	public static void main(String[] args) {\n" + 
+//			"		System.out.println(\"SUCCESS\");\n" + 
+//			"	}\n" + 
+//			"	public <U> void foo(ArrayList<U> arr) {\n" + 
+//			"		for (U e : arr) {\n" + 
+//			"			System.out.println(e);\n" + 
+//			"		}\n" + 
+//			"	}\n" + 
+//			"}",
+//		};
+//		this.runConformTest(
+//			testsSource,
+//			"SUCCESS");
+//
+//		try {
+//			ClassFileReader classFileReader = ClassFileReader.read(OUTPUT_DIR + File.separator + "X.class");
+//			IBinaryMethod[] methods = classFileReader.getMethods();
+//			assertNotNull("No methods", methods);
+//			assertEquals("Wrong size", 3, methods.length);
+//			assertEquals("Wrong name", "foo", new String(methods[2].getSelector()));
+//			char[] signature = methods[2].getGenericSignature();
+//			assertNotNull("No signature", signature);
+//			assertEquals("Wrong signature", "<U:Ljava/lang/Object;>(Ljava/util/ArrayList<TU;>;)V", new String(signature));
+//		} catch (ClassFormatException e) {
+//			assertTrue(false);
+//		} catch (IOException e) {
+//			assertTrue(false);
+//		}
+//	}
 	// 59983 - incorrect signature for List<X>
-	public void test014() {
-		final String[] testsSource = new String[] {
-			"X.java",
-			"import java.util.ArrayList;\n" + 
-			"import java.util.List;\n" + 
-			"public class X {\n" + 
-			"	private List<X> games = new ArrayList<X>();\n" + 
-			"	public static void main(String[] args) {\n" + 
-			"		System.out.println(\"SUCCESS\");\n" + 
-			"	}\n" + 
-			"}",
-		};
-		this.runConformTest(
-			testsSource,
-			"SUCCESS");
-
-		try {
-			ClassFileReader classFileReader = ClassFileReader.read(OUTPUT_DIR + File.separator + "X.class");
-			IBinaryField[] fields = classFileReader.getFields();
-			assertNotNull("No fields", fields);
-			assertEquals("Wrong size", 1, fields.length);
-			assertEquals("Wrong name", "games", new String(fields[0].getName()));
-			char[] signature = fields[0].getGenericSignature();
-			assertNotNull("No signature", signature);
-			assertEquals("Wrong signature", "Ljava/util/List<LX;>;", new String(signature));
-		} catch (ClassFormatException e) {
-			assertTrue(false);
-		} catch (IOException e) {
-			assertTrue(false);
-		}
-	}
+//	public void test014() {
+//		final String[] testsSource = new String[] {
+//			"X.java",
+//			"import java.util.ArrayList;\n" + 
+//			"import java.util.List;\n" + 
+//			"public class X {\n" + 
+//			"	private List<X> games = new ArrayList<X>();\n" + 
+//			"	public static void main(String[] args) {\n" + 
+//			"		System.out.println(\"SUCCESS\");\n" + 
+//			"	}\n" + 
+//			"}",
+//		};
+//		this.runConformTest(
+//			testsSource,
+//			"SUCCESS");
+//
+//		try {
+//			ClassFileReader classFileReader = ClassFileReader.read(OUTPUT_DIR + File.separator + "X.class");
+//			IBinaryField[] fields = classFileReader.getFields();
+//			assertNotNull("No fields", fields);
+//			assertEquals("Wrong size", 1, fields.length);
+//			assertEquals("Wrong name", "games", new String(fields[0].getName()));
+//			char[] signature = fields[0].getGenericSignature();
+//			assertNotNull("No signature", signature);
+//			assertEquals("Wrong signature", "Ljava/util/List<LX;>;", new String(signature));
+//		} catch (ClassFormatException e) {
+//			assertTrue(false);
+//		} catch (IOException e) {
+//			assertTrue(false);
+//		}
+//	}
 	// 65953 - incorrect signature for generic interface
-	public void test015() {
-		final String[] testsSource = new String[] {
-			"X.java",
-			"public interface X<T> {\n" + 
-			"}",
-		};
-		this.runConformTest(
-			testsSource,
-			"");
-
-		try {
-			ClassFileReader classFileReader = ClassFileReader.read(OUTPUT_DIR + File.separator + "X.class");
-			char[] signature = classFileReader.getGenericSignature();
-			assertNotNull("No signature", signature);
-			assertEquals("Wrong signature", "<T:Ljava/lang/Object;>Ljava/lang/Object;", new String(signature));
-		} catch (ClassFormatException e) {
-			assertTrue(false);
-		} catch (IOException e) {
-			assertTrue(false);
-		}
-	}	
+//	public void test015() {
+//		final String[] testsSource = new String[] {
+//			"X.java",
+//			"public interface X<T> {\n" + 
+//			"}",
+//		};
+//		this.runConformTest(
+//			testsSource,
+//			"");
+//
+//		try {
+//			ClassFileReader classFileReader = ClassFileReader.read(OUTPUT_DIR + File.separator + "X.class");
+//			char[] signature = classFileReader.getGenericSignature();
+//			assertNotNull("No signature", signature);
+//			assertEquals("Wrong signature", "<T:Ljava/lang/Object;>Ljava/lang/Object;", new String(signature));
+//		} catch (ClassFormatException e) {
+//			assertTrue(false);
+//		} catch (IOException e) {
+//			assertTrue(false);
+//		}
+//	}	
 	// 70975 - invalid signature for method with array of type variables
-	public void test016() {
-		final String[] testsSource = new String[] {
-			"X.java",
-			"import java.util.ArrayList;\n" + 
-			"\n" + 
-			"public class X<T> {\n" + 
-			"	\n" + 
-			"	public static void main(String[] args) {\n" + 
-			"		System.out.println(\"SUCCESS\");\n" + 
-			"	}\n" + 
-			"	public <U> void foo(U[] arr) {\n" + 
-			"	}\n" + 
-			"}",
-		};
-		this.runConformTest(
-			testsSource,
-			"SUCCESS");
-
-		try {
-			ClassFileReader classFileReader = ClassFileReader.read(OUTPUT_DIR + File.separator + "X.class");
-			IBinaryMethod[] methods = classFileReader.getMethods();
-			assertNotNull("No methods", methods);
-			assertEquals("Wrong size", 3, methods.length);
-			assertEquals("Wrong name", "foo", new String(methods[2].getSelector()));
-			char[] signature = methods[2].getGenericSignature();
-			assertNotNull("No signature", signature);
-			assertEquals("Wrong signature", "<U:Ljava/lang/Object;>([TU;)V", new String(signature));
-		} catch (ClassFormatException e) {
-			assertTrue(false);
-		} catch (IOException e) {
-			assertTrue(false);
-		}
-	}	
-	public void test017() {
-		final String[] testsSource = new String[] {
-			"X.java",
-			"public class X<T> {\n" + 
-			"  static class MX<U> {\n" + 
-			"  }\n" + 
-			"\n" + 
-			"  public static void main(String[] args) {\n" + 
-			"    new X<Thread>().foo(new MX<Thread>());\n" + 
-			"  }\n" + 
-			"  void foo(X.MX<?> mx) {\n" + 
-			"	System.out.println(\"SUCCESS\");\n" + 
-			"  }\n" + 
-			"}",
-		};
-		this.runConformTest(
-			testsSource,
-			"SUCCESS");
-
-		try {
-			ClassFileReader classFileReader = ClassFileReader.read(OUTPUT_DIR + File.separator + "X.class");
-			IBinaryMethod[] methods = classFileReader.getMethods();
-			assertNotNull("No methods", methods);
-			assertEquals("Wrong size", 3, methods.length);
-			assertEquals("Wrong name", "foo", new String(methods[2].getSelector()));
-			char[] signature = methods[2].getGenericSignature();
-			assertNotNull("No signature", signature);
-			assertEquals("Wrong signature", "(LX$MX<*>;)V", new String(signature));
-		} catch (ClassFormatException e) {
-			assertTrue(false);
-		} catch (IOException e) {
-			assertTrue(false);
-		}
-	}	
-	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=98322
-	public void test018() {
-		final String[] testsSource = new String[] {
-			"X.java",
-			"public class X<K extends X.Key> {\n" + 
-			"    public abstract static class Key {\n" + 
-			"         public abstract String getName();\n" + 
-			"    }\n" + 
-			"    public class Holder {}\n" + 
-			"    \n" + 
-			"    void baz(X<K>.Holder h) {} // (LX<TK;>.Holder;)V\n" + 
-			"    void bar(X.Holder h) {} // n/a\n" + 
-			"    void foo(X<Key>.Holder h) {} // (LX<LX$Key;>.Holder;)V\n" + 
-			"}\n",
-		};
-		this.runConformTest(
-			testsSource,
-			"");
-
-		try {
-			ClassFileReader classFileReader = ClassFileReader.read(OUTPUT_DIR + File.separator + "X.class");
-			IBinaryMethod[] methods = classFileReader.getMethods();
-			assertNotNull("No methods", methods);
-			assertEquals("Wrong size", 4, methods.length);
-
-			assertEquals("Wrong name", "baz", new String(methods[1].getSelector()));
-			char[] signature = methods[1].getGenericSignature();
-			assertNotNull("No signature", signature);
-			assertEquals("Wrong signature", "(LX<TK;>.Holder;)V", new String(signature));
-
-			assertEquals("Wrong name", "bar", new String(methods[2].getSelector()));
-			signature = methods[2].getGenericSignature();
-			assertNull("No signature", signature);
-
-			assertEquals("Wrong name", "foo", new String(methods[3].getSelector()));
-			signature = methods[3].getGenericSignature();
-			assertNotNull("No signature", signature);
-			assertEquals("Wrong signature", "(LX<LX$Key;>.Holder;)V", new String(signature));
-		} catch (ClassFormatException e) {
-			assertTrue(false);
-		} catch (IOException e) {
-			assertTrue(false);
-		}
-	}	
-	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=100293
-	public void test019() {
-		final String[] testsSource = new String[] {
-			"X.java",
-			"public class X<K extends X.Key> {\n" + 
-			"    public abstract static class Key {\n" + 
-			"         public abstract String getName();\n" + 
-			"    }\n" + 
-			"    public class Holder {}\n" + 
-			"    \n" + 
-			"    X<K>.Holder foo() { return null; }\n" + 
-			"    \n" + 
-			"    static void bar() {\n" + 
-			"    	Object o = new X<Key>().foo();\n" + 
-			"    	class Local<U> {\n" + 
-			"    		X<Key>.Holder field;\n" + 
-			"    		Local<String> foo1() { return null; }\n" + 
-			"    		Local<U> foo2() { return null; }\n" + 
-			"    		Local foo3() { return null; }\n" + 
-			"    	}\n" + 
-			"    }\n" + 
-			"}\n",
-		};
-		this.runConformTest(
-			testsSource,
-			"");
-
-		try {
-			ClassFileReader classFileReader = ClassFileReader.read(OUTPUT_DIR + File.separator + "X$1Local.class");
-			IBinaryField[] fields = classFileReader.getFields();
-			assertNotNull("No fields", fields);
-			assertEquals("Wrong size", 1, fields.length);
-
-			assertEquals("Wrong name", "field", new String(fields[0].getName()));
-			char[] signature = fields[0].getGenericSignature();
-			assertNotNull("No signature", signature);
-			assertEquals("Wrong signature", "LX<LX$Key;>.Holder;", new String(signature));
-
-			IBinaryMethod[] methods = classFileReader.getMethods();
-			assertNotNull("No methods", methods);
-			assertEquals("Wrong size", 4, methods.length);
-
-			assertEquals("Wrong name", "foo1", new String(methods[1].getSelector()));
-			signature = methods[1].getGenericSignature();
-			assertNotNull("No signature", signature);
-			assertEquals("Wrong signature", "()LX$1Local<Ljava/lang/String;>;", new String(signature));
-
-			assertEquals("Wrong name", "foo2", new String(methods[2].getSelector()));
-			signature = methods[2].getGenericSignature();
-			assertNotNull("No signature", signature);
-			assertEquals("Wrong signature", "()LX$1Local<TU;>;", new String(signature));
-
-			assertEquals("Wrong name", "foo3", new String(methods[3].getSelector()));
-			signature = methods[3].getGenericSignature();
-			assertNull("No signature", signature);
-		} catch (ClassFormatException e) {
-			assertTrue(false);
-		} catch (IOException e) {
-			assertTrue(false);
-		}
-	}
-	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=160132 - variation
-	public void test020() {
-		final String[] testsSource = new String[] {
-			"X.java",
-			"public interface X<E extends Object & X.Entry> {\n" + 
-			"  interface Entry {\n" + 
-			"    interface Internal extends Entry {\n" + 
-			"      Internal createEntry();\n" + 
-			"    }\n" + 
-			"  }\n" + 
-			"}\n",
-		};
-		this.runConformTest(
-			testsSource,
-			"");
-
-		try {
-			ClassFileReader classFileReader = ClassFileReader.read(OUTPUT_DIR + File.separator + "X$Entry$Internal.class");
-			IBinaryMethod[] methods = classFileReader.getMethods();
-			assertNotNull("No methods", methods);
-			assertEquals("Wrong size", 1, methods.length);
-			assertEquals("Wrong name", "createEntry", new String(methods[0].getSelector()));
-			char[] signature = methods[0].getGenericSignature();
-			assertNull("Unexpected signature", signature); // no generic signature should have been produced
-		} catch (ClassFormatException e) {
-			assertTrue(false);
-		} catch (IOException e) {
-			assertTrue(false);
-		}
-	}
+//	public void test016() {
+//		final String[] testsSource = new String[] {
+//			"X.java",
+//			"import java.util.ArrayList;\n" + 
+//			"\n" + 
+//			"public class X<T> {\n" + 
+//			"	\n" + 
+//			"	public static void main(String[] args) {\n" + 
+//			"		System.out.println(\"SUCCESS\");\n" + 
+//			"	}\n" + 
+//			"	public <U> void foo(U[] arr) {\n" + 
+//			"	}\n" + 
+//			"}",
+//		};
+//		this.runConformTest(
+//			testsSource,
+//			"SUCCESS");
+//
+//		try {
+//			ClassFileReader classFileReader = ClassFileReader.read(OUTPUT_DIR + File.separator + "X.class");
+//			IBinaryMethod[] methods = classFileReader.getMethods();
+//			assertNotNull("No methods", methods);
+//			assertEquals("Wrong size", 3, methods.length);
+//			assertEquals("Wrong name", "foo", new String(methods[2].getSelector()));
+//			char[] signature = methods[2].getGenericSignature();
+//			assertNotNull("No signature", signature);
+//			assertEquals("Wrong signature", "<U:Ljava/lang/Object;>([TU;)V", new String(signature));
+//		} catch (ClassFormatException e) {
+//			assertTrue(false);
+//		} catch (IOException e) {
+//			assertTrue(false);
+//		}
+//	}	
+//	public void test017() {
+//		final String[] testsSource = new String[] {
+//			"X.java",
+//			"public class X<T> {\n" + 
+//			"  static class MX<U> {\n" + 
+//			"  }\n" + 
+//			"\n" + 
+//			"  public static void main(String[] args) {\n" + 
+//			"    new X<Thread>().foo(new MX<Thread>());\n" + 
+//			"  }\n" + 
+//			"  void foo(X.MX<?> mx) {\n" + 
+//			"	System.out.println(\"SUCCESS\");\n" + 
+//			"  }\n" + 
+//			"}",
+//		};
+//		this.runConformTest(
+//			testsSource,
+//			"SUCCESS");
+//
+//		try {
+//			ClassFileReader classFileReader = ClassFileReader.read(OUTPUT_DIR + File.separator + "X.class");
+//			IBinaryMethod[] methods = classFileReader.getMethods();
+//			assertNotNull("No methods", methods);
+//			assertEquals("Wrong size", 3, methods.length);
+//			assertEquals("Wrong name", "foo", new String(methods[2].getSelector()));
+//			char[] signature = methods[2].getGenericSignature();
+//			assertNotNull("No signature", signature);
+//			assertEquals("Wrong signature", "(LX$MX<*>;)V", new String(signature));
+//		} catch (ClassFormatException e) {
+//			assertTrue(false);
+//		} catch (IOException e) {
+//			assertTrue(false);
+//		}
+//	}	
+//	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=98322
+//	public void test018() {
+//		final String[] testsSource = new String[] {
+//			"X.java",
+//			"public class X<K extends X.Key> {\n" + 
+//			"    public abstract static class Key {\n" + 
+//			"         public abstract String getName();\n" + 
+//			"    }\n" + 
+//			"    public class Holder {}\n" + 
+//			"    \n" + 
+//			"    void baz(X<K>.Holder h) {} // (LX<TK;>.Holder;)V\n" + 
+//			"    void bar(X.Holder h) {} // n/a\n" + 
+//			"    void foo(X<Key>.Holder h) {} // (LX<LX$Key;>.Holder;)V\n" + 
+//			"}\n",
+//		};
+//		this.runConformTest(
+//			testsSource,
+//			"");
+//
+//		try {
+//			ClassFileReader classFileReader = ClassFileReader.read(OUTPUT_DIR + File.separator + "X.class");
+//			IBinaryMethod[] methods = classFileReader.getMethods();
+//			assertNotNull("No methods", methods);
+//			assertEquals("Wrong size", 4, methods.length);
+//
+//			assertEquals("Wrong name", "baz", new String(methods[1].getSelector()));
+//			char[] signature = methods[1].getGenericSignature();
+//			assertNotNull("No signature", signature);
+//			assertEquals("Wrong signature", "(LX<TK;>.Holder;)V", new String(signature));
+//
+//			assertEquals("Wrong name", "bar", new String(methods[2].getSelector()));
+//			signature = methods[2].getGenericSignature();
+//			assertNull("No signature", signature);
+//
+//			assertEquals("Wrong name", "foo", new String(methods[3].getSelector()));
+//			signature = methods[3].getGenericSignature();
+//			assertNotNull("No signature", signature);
+//			assertEquals("Wrong signature", "(LX<LX$Key;>.Holder;)V", new String(signature));
+//		} catch (ClassFormatException e) {
+//			assertTrue(false);
+//		} catch (IOException e) {
+//			assertTrue(false);
+//		}
+//	}	
+//	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=100293
+//	public void test019() {
+//		final String[] testsSource = new String[] {
+//			"X.java",
+//			"public class X<K extends X.Key> {\n" + 
+//			"    public abstract static class Key {\n" + 
+//			"         public abstract String getName();\n" + 
+//			"    }\n" + 
+//			"    public class Holder {}\n" + 
+//			"    \n" + 
+//			"    X<K>.Holder foo() { return null; }\n" + 
+//			"    \n" + 
+//			"    static void bar() {\n" + 
+//			"    	Object o = new X<Key>().foo();\n" + 
+//			"    	class Local<U> {\n" + 
+//			"    		X<Key>.Holder field;\n" + 
+//			"    		Local<String> foo1() { return null; }\n" + 
+//			"    		Local<U> foo2() { return null; }\n" + 
+//			"    		Local foo3() { return null; }\n" + 
+//			"    	}\n" + 
+//			"    }\n" + 
+//			"}\n",
+//		};
+//		this.runConformTest(
+//			testsSource,
+//			"");
+//
+//		try {
+//			ClassFileReader classFileReader = ClassFileReader.read(OUTPUT_DIR + File.separator + "X$1Local.class");
+//			IBinaryField[] fields = classFileReader.getFields();
+//			assertNotNull("No fields", fields);
+//			assertEquals("Wrong size", 1, fields.length);
+//
+//			assertEquals("Wrong name", "field", new String(fields[0].getName()));
+//			char[] signature = fields[0].getGenericSignature();
+//			assertNotNull("No signature", signature);
+//			assertEquals("Wrong signature", "LX<LX$Key;>.Holder;", new String(signature));
+//
+//			IBinaryMethod[] methods = classFileReader.getMethods();
+//			assertNotNull("No methods", methods);
+//			assertEquals("Wrong size", 4, methods.length);
+//
+//			assertEquals("Wrong name", "foo1", new String(methods[1].getSelector()));
+//			signature = methods[1].getGenericSignature();
+//			assertNotNull("No signature", signature);
+//			assertEquals("Wrong signature", "()LX$1Local<Ljava/lang/String;>;", new String(signature));
+//
+//			assertEquals("Wrong name", "foo2", new String(methods[2].getSelector()));
+//			signature = methods[2].getGenericSignature();
+//			assertNotNull("No signature", signature);
+//			assertEquals("Wrong signature", "()LX$1Local<TU;>;", new String(signature));
+//
+//			assertEquals("Wrong name", "foo3", new String(methods[3].getSelector()));
+//			signature = methods[3].getGenericSignature();
+//			assertNull("No signature", signature);
+//		} catch (ClassFormatException e) {
+//			assertTrue(false);
+//		} catch (IOException e) {
+//			assertTrue(false);
+//		}
+//	}
+//	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=160132 - variation
+//	public void test020() {
+//		final String[] testsSource = new String[] {
+//			"X.java",
+//			"public interface X<E extends Object & X.Entry> {\n" + 
+//			"  interface Entry {\n" + 
+//			"    interface Internal extends Entry {\n" + 
+//			"      Internal createEntry();\n" + 
+//			"    }\n" + 
+//			"  }\n" + 
+//			"}\n",
+//		};
+//		this.runConformTest(
+//			testsSource,
+//			"");
+//
+//		try {
+//			ClassFileReader classFileReader = ClassFileReader.read(OUTPUT_DIR + File.separator + "X$Entry$Internal.class");
+//			IBinaryMethod[] methods = classFileReader.getMethods();
+//			assertNotNull("No methods", methods);
+//			assertEquals("Wrong size", 1, methods.length);
+//			assertEquals("Wrong name", "createEntry", new String(methods[0].getSelector()));
+//			char[] signature = methods[0].getGenericSignature();
+//			assertNull("Unexpected signature", signature); // no generic signature should have been produced
+//		} catch (ClassFormatException e) {
+//			assertTrue(false);
+//		} catch (IOException e) {
+//			assertTrue(false);
+//		}
+//	}
 	
 }
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/ProblemTypeAndMethodTest.java b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/ProblemTypeAndMethodTest.java
index 5b20b2a..febe824 100644
--- a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/ProblemTypeAndMethodTest.java
+++ b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/ProblemTypeAndMethodTest.java
@@ -10,11 +10,6 @@
  *******************************************************************************/
 package org.eclipse.wst.jsdt.core.tests.compiler.regression;
 
-import java.io.File;
-
-import org.eclipse.wst.jsdt.internal.compiler.classfmt.ClassFileReader;
-import org.eclipse.wst.jsdt.internal.compiler.env.IBinaryMethod;
-
 import junit.framework.Test;
 
 public class ProblemTypeAndMethodTest extends AbstractRegressionTest {
@@ -78,40 +73,40 @@
 		false /* do not show warning token */, 
 		false  /* do not skip javac for this peculiar test */,
 		false  /* do not perform statements recovery */);
-	ClassFileReader reader = this.getClassFileReader(OUTPUT_DIR + File.separator  +"X$W.class", "X$W");
-	IBinaryMethod[] methods = reader.getMethods();
-	assertEquals("Wrong size", 2, methods.length);
-	int counter = 0;
-	for (int i = 0; i < 2; i++) {
-		IBinaryMethod method = methods[i];
-		if (new String(method.getSelector()).equals("foo")) {
-			counter++;
-		}
-	}
-	assertEquals("Wrong number of foo method", 1, counter);
-	
-	reader = this.getClassFileReader(OUTPUT_DIR + File.separator  +"X$Y.class", "X$Y");
-	methods = reader.getMethods();
-	assertEquals("Wrong size", 2, methods.length);
-	counter = 0;
-	for (int i = 0; i < 2; i++) {
-		IBinaryMethod method = methods[i];
-		if (new String(method.getSelector()).equals("foo")) {
-			counter++;
-		}
-	}
-	assertEquals("Wrong number of foo method", 1, counter);
-	
-	reader = this.getClassFileReader(OUTPUT_DIR + File.separator  +"X$Z.class", "X$Z");
-	methods = reader.getMethods();
-	assertEquals("Wrong size", 2, methods.length);
-	counter = 0;
-	for (int i = 0; i < 2; i++) {
-		IBinaryMethod method = methods[i];
-		if (new String(method.getSelector()).equals("foo")) {
-			counter++;
-		}
-	}
-	assertEquals("Wrong number of foo method", 1, counter);
+//	ClassFileReader reader = this.getClassFileReader(OUTPUT_DIR + File.separator  +"X$W.class", "X$W");
+//	IBinaryMethod[] methods = reader.getMethods();
+//	assertEquals("Wrong size", 2, methods.length);
+//	int counter = 0;
+//	for (int i = 0; i < 2; i++) {
+//		IBinaryMethod method = methods[i];
+//		if (new String(method.getSelector()).equals("foo")) {
+//			counter++;
+//		}
+//	}
+//	assertEquals("Wrong number of foo method", 1, counter);
+//	
+//	reader = this.getClassFileReader(OUTPUT_DIR + File.separator  +"X$Y.class", "X$Y");
+//	methods = reader.getMethods();
+//	assertEquals("Wrong size", 2, methods.length);
+//	counter = 0;
+//	for (int i = 0; i < 2; i++) {
+//		IBinaryMethod method = methods[i];
+//		if (new String(method.getSelector()).equals("foo")) {
+//			counter++;
+//		}
+//	}
+//	assertEquals("Wrong number of foo method", 1, counter);
+//	
+//	reader = this.getClassFileReader(OUTPUT_DIR + File.separator  +"X$Z.class", "X$Z");
+//	methods = reader.getMethods();
+//	assertEquals("Wrong size", 2, methods.length);
+//	counter = 0;
+//	for (int i = 0; i < 2; i++) {
+//		IBinaryMethod method = methods[i];
+//		if (new String(method.getSelector()).equals("foo")) {
+//			counter++;
+//		}
+//	}
+//	assertEquals("Wrong number of foo method", 1, counter);
 }
 }
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/Requestor.java b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/Requestor.java
index 47563c3..647b6d3 100644
--- a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/Requestor.java
+++ b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/Requestor.java
@@ -10,14 +10,11 @@
  *******************************************************************************/
 package org.eclipse.wst.jsdt.core.tests.compiler.regression;
 
-import java.io.File;
-import java.io.IOException;
 import java.util.Hashtable;
 
 import junit.framework.Assert;
 
 import org.eclipse.wst.jsdt.core.compiler.CategorizedProblem;
-import org.eclipse.wst.jsdt.internal.compiler.ClassFile;
 import org.eclipse.wst.jsdt.internal.compiler.CompilationResult;
 import org.eclipse.wst.jsdt.internal.compiler.ICompilerRequestor;
 import org.eclipse.wst.jsdt.internal.compiler.IProblemFactory;
@@ -87,27 +84,9 @@
 		}
 		problemLog += buffer.toString();
 	}
-	outputClassFiles(compilationResult);
 	if (this.clientRequestor != null) {
 		this.clientRequestor.acceptResult(compilationResult);
 	}
 }
-protected void outputClassFiles(CompilationResult unitResult) {
 
-	if ((unitResult != null) && (!unitResult.hasErrors() || generateOutput)) {
-		ClassFile[]classFiles = unitResult.getClassFiles();
-		if (outputPath != null) {
-			for (int i = 0, fileCount = classFiles.length; i < fileCount; i++) {
-				// retrieve the key and the corresponding classfile
-				ClassFile classFile = classFiles[i];
-				String relativeName = 
-					new String(classFile.fileName()).replace('/', File.separatorChar) + ".class";
-				try {
-					ClassFile.writeToDisk(true, outputPath, relativeName, classFile);
-				} catch(IOException e) {
-				}
-			}
-		}
-	}
-}
 }
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/eval/CodeSnippetTest.java b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/eval/CodeSnippetTest.java
deleted file mode 100644
index fe64514..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/eval/CodeSnippetTest.java
+++ /dev/null
@@ -1,702 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *     IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.jsdt.core.tests.eval;
-
-import junit.framework.Test;
-
-import org.eclipse.wst.jsdt.core.compiler.CategorizedProblem;
-import org.eclipse.wst.jsdt.core.compiler.IProblem;
-import org.eclipse.wst.jsdt.internal.compiler.problem.ProblemSeverities;
-import org.eclipse.wst.jsdt.internal.eval.EvaluationResult;
-import org.eclipse.wst.jsdt.internal.eval.IRequestor;
-/**
- * Test the code snippet evaluation.
- * This assumes that the EvaluationContext class and that the EvaluationResult class
- * are working correctly.
- */
-public class CodeSnippetTest extends EvaluationTest {
-/**
- * Creates a new CodeSnippetTest.
- */
-public CodeSnippetTest(String name) {
-	super(name);
-}
-/**
- * Returns a requestor that expects no result.
- */
-private IRequestor getNoResultRequestor() {
-	return new Requestor() {
-		public void acceptResult(EvaluationResult result) {
-			assertTrue("No result", false);
-		}
-	};
-}
-public static Test suite() {
-	return setupSuite(testClass());
-}
-/**
- * Tests code snippet that throws a checked exception.
- * (Regression test for 1G0T5XK)
- */
-public void testCheckedException() {
-	evaluateWithExpectedDisplayString(buildCharArray(new String[] {
-		"try {",
-		"	throw new java.io.IOException();",
-		"} finally {",
-		"	System.err.println(\"This is an expected exception printed by the target VM:\");",
-		"}"}), 
-		null);
-}
-public static Class testClass() {
-	return CodeSnippetTest.class;
-}
-/**
- * Tests that no errors are reported for an empty statement followed by an expression.
- * (Regression test for PR #1G1HGHE)
- */
-public void testEmptyStatement() {
-	evaluateWithExpectedDisplayString(buildCharArray(new String[] {
-		"class X {",
-		"	public int fact(int n){",
-		"		return fact0(n, 1);",
-		"	}",
-		"	public int fact0(int n, int acc){",
-		"		if (n <= 1) return acc;",
-		"		return fact0(n - 1, acc * n);",
-		"	}",
-		"};",
-		"new X().fact(10)"}), 
-		"3628800".toCharArray());
-}
-/**
- * Tests that an error is reported for an empty import.
- */
-public void testEvaluateEmptyImport() {
-	try {
-		char[] importName = new char[0];
-		context.setImports(new char[][] {importName});
-		Requestor requestor = new Requestor();
-		context.evaluateImports(getEnv(), requestor, getProblemFactory());
-		assertTrue("Got one result", requestor.resultIndex == 0);
-		EvaluationResult result = requestor.results[0];
-		assertTrue("Problems", result.hasProblems());
-		assertEquals("Evaluation type", EvaluationResult.T_IMPORT, result.getEvaluationType());
-		assertEquals("Evaluation ID", importName, result.getEvaluationID());
-	} finally {
-		// clean up
-		context.setImports(new char[0][]);
-	}
-}
-/**
- * Tests that an error is reported for an existing package and a non existing type imports.
- */
-public void testEvaluateExistingPackageAndNonExistingTypeImports() {
-	try {
-		char[] importName = "non.existing.Type".toCharArray();
-		context.setImports(new char[][] {"java.lang.reflect.*".toCharArray(), importName});
-		Requestor requestor = new Requestor();
-		context.evaluateImports(getEnv(), requestor, getProblemFactory());
-		assertTrue("Got one result", requestor.resultIndex == 0);
-		EvaluationResult result = requestor.results[0];
-		assertTrue("Problems", result.hasProblems());
-		assertEquals("Evaluation type", EvaluationResult.T_IMPORT, result.getEvaluationType());
-		assertEquals("Evaluation ID", importName, result.getEvaluationID());
-	} finally {
-		// clean up
-		context.setImports(new char[0][]);
-	}
-}
-/**
- * Tests that an error is reported for a non existing package and an existing type imports.
- */
-public void testEvaluateNonExistingPackageAndExistingTypeImports() {
-	try {
-		char[] importName = "non.existing.*".toCharArray();
-		context.setImports(new char[][] {importName, "java.math.BigInteger".toCharArray()});
-		Requestor requestor = new Requestor();
-		context.evaluateImports(getEnv(), requestor, getProblemFactory());
-		assertTrue("Got one result", requestor.resultIndex == 0);
-		EvaluationResult result = requestor.results[0];
-		assertTrue("Problems", result.hasProblems());
-		assertEquals("Evaluation type", EvaluationResult.T_IMPORT, result.getEvaluationType());
-		assertEquals("Evaluation ID", importName, result.getEvaluationID());
-	} finally {
-		// clean up
-		context.setImports(new char[0][]);
-	}
-}
-/**
- * Tests that an error is reported for a non existing package import.
- */
-public void testEvaluateNonExistingPackageImport() {
-	try {
-		char[] importName = "non.existing.*".toCharArray();
-		context.setImports(new char[][] {importName});
-		Requestor requestor = new Requestor();
-		context.evaluateImports(getEnv(), requestor, getProblemFactory());
-		assertTrue("Got one result", requestor.resultIndex == 0);
-		EvaluationResult result = requestor.results[0];
-		assertTrue("Problems", result.hasProblems());
-		assertEquals("Evaluation type", EvaluationResult.T_IMPORT, result.getEvaluationType());
-		assertEquals("Evaluation ID", importName, result.getEvaluationID());
-	} finally {
-		// clean up
-		context.setImports(new char[0][]);
-	}
-}
-/**
- * Tests that an error is reported for a non existing type import.
- */
-public void testEvaluateNonExistingTypeImport() {
-	try {
-		char[] importName = "non.existing.Type".toCharArray();
-		context.setImports(new char[][] {importName});
-		Requestor requestor = new Requestor();
-		context.evaluateImports(getEnv(), requestor, getProblemFactory());
-		assertTrue("Got one result", requestor.resultIndex == 0);
-		EvaluationResult result = requestor.results[0];
-		assertTrue("Problems", result.hasProblems());
-		assertEquals("Evaluation type", EvaluationResult.T_IMPORT, result.getEvaluationType());
-		assertEquals("Evaluation ID", importName, result.getEvaluationID());
-	} finally {
-		// clean up
-		context.setImports(new char[0][]);
-	}
-}
-/**
- * Tests that no errors are reported for valid package and type imports.
- */
-public void testEvaluateValidPackageAndTypeImports() {
-	try {
-		context.setImports(new char[][] {"java.util.Enumeration".toCharArray(), "java.lang.reflect.*".toCharArray()});
-		context.evaluateImports(getEnv(), getNoResultRequestor(), getProblemFactory());
-	} finally {
-		// clean up
-		context.setImports(new char[0][]);
-	}
-}
-/**
- * Tests that no errors are reported for a valid package import.
- */
-public void testEvaluateValidPackageImport() {
-	try {
-		context.setImports(new char[][] {"java.io.*".toCharArray()});
-		context.evaluateImports(getEnv(), getNoResultRequestor(), getProblemFactory());
-	} finally {
-		// clean up
-		context.setImports(new char[0][]);
-	}
-}
-/**
- * Tests that no errors are reported for a valid type import.
- */
-public void testEvaluateValidTypeImport() {
-	try {
-		context.setImports(new char[][] {"java.math.BigInteger".toCharArray()});
-		context.evaluateImports(getEnv(), getNoResultRequestor(), getProblemFactory());
-	} finally {
-		// clean up
-		context.setImports(new char[0][]);
-	}
-}
-/**
- * Tests code snippet that include a finally block triggered by an error.
- */
-public void testFinallyError() {
-	evaluateWithExpectedDisplayString(buildCharArray(new String[] {
-		"try {",
-		"	throw new Error();",
-		"} finally {",
-		"	System.err.println(\"This is an expected error printed by the target VM:\");",
-		"}"}), 
-		null);
-}
-/**
- * Tests code snippet that include one finally block.
- */
-public void testFinallyOneBlock() {
-	evaluateWithExpectedWarningAndDisplayString(buildCharArray(new String[] {
-		"try {",
-		"	return 1;",
-		"} finally {",
-		"	return 2;",
-		"}"}), 
-		new CategorizedProblem[] {
-			newProblem(IProblem.FinallyMustCompleteNormally, ProblemSeverities.Warning, 30, 40, 4), 
-		},
-		"2".toCharArray());
-}
-/**
- * Tests code snippet that include 2 finally blocks.
- */
-public void testFinallyTwoBlock() {
-	evaluateWithExpectedWarningAndDisplayString(buildCharArray(new String[] {
-		"try {",
-		"	try {",
-		"		return 1;",
-		"	} finally {",
-		"		return 2;",
-		"	}",
-		"} finally {",
-		"	return 3;",
-		"}"}), 
-		new CategorizedProblem[] {
-			newProblem(IProblem.FinallyMustCompleteNormally, ProblemSeverities.Warning, 40, 51, 5), 
-			newProblem(IProblem.FinallyMustCompleteNormally, ProblemSeverities.Warning, 66, 76, 8), 
-		},
-		"3".toCharArray());
-}
-/**
- * Tests the free return addition at the end of the code snippet
- * for an anonymous inner class.
- */
-public void testFreeReturnAnonymous() {
-	evaluateWithExpectedDisplayString(buildCharArray(new String[] {
-		"new Object() {",
-		"	public String toString() {",
-		"		return \"an object\";",
-		"	}",
-		"}"}), 
-		"an object".toCharArray());
-}
-/**
- * Tests the free return addition at the end of the code snippet
- * for a class declaration followed by an expression.
- */
-public void testFreeReturnClassDeclaration() {
-	evaluateWithExpectedDisplayString(buildCharArray(new String[] {
-		"class Point {",
-		"	int x;",
-		"	int y;",
-		"	Point(int x, int y) {",
-		"		this.x = x;",
-		"		this.y = y;",
-		"	}",
-		"}",
-		"new Point(56, 99).x"}), 
-		"56".toCharArray());
-}
-/**
- * Tests the free return addition at the end of the code snippet
- * for an expression.
- */
-public void testFreeReturnExpression() {
-	evaluateWithExpectedDisplayString("(1 + 2) * 3.0 / 4".toCharArray(), "2.25".toCharArray());
-}
-/**
- * Tests the free return addition at the end of the code snippet
- * for an integer.
- */
-public void testFreeReturnInteger() {
-	evaluateWithExpectedDisplayString("1".toCharArray(), "1".toCharArray());
-}
-/**
- * Tests the free return addition at the end of the code snippet
- * for a local variable declaration followed by an expression.
- */
-public void testFreeReturnLocalVar() {
-	evaluateWithExpectedDisplayString(buildCharArray(new String[] {
-		"int i = 99;",
-		"i + 4"}), 
-		"103".toCharArray());
-}
-/**
- * Tests the free return addition at the end of the code snippet
- * for a statement followed by an expression.
- */
-public void testFreeReturnStatement() {
-	evaluateWithExpectedDisplayString(buildCharArray(new String[] {
-		"int i = 2;",
-		"for (int j=0;j<10;j++) {",
-		"	i++;",
-		"}",
-		"i"}), 
-		"12".toCharArray());
-}
-/**
- * Tests code snippet that include a package import.
- */
-public void testImportPackage() {
-	try {
-		context.setImports(new char[][] {"java.io.*".toCharArray()});
-		evaluateWithExpectedDisplayString("return new File(\"!@#%\").exists();".toCharArray(), "false".toCharArray());
-	} finally {
-		// clean up
-		context.setImports(new char[0][]);
-	}
-}
-/**
- * Tests code snippet that include a type import.
- */
-public void testImportType() {
-	try {
-		context.setImports(new char[][] {"java.math.BigInteger".toCharArray()});
-		evaluateWithExpectedDisplayString("return new BigInteger(\"123456789012345678901234567890\");".toCharArray(), "123456789012345678901234567890".toCharArray());
-	} finally {
-		// clean up
-		context.setImports(new char[0][]);
-	}
-}
-/**
- * Tests code snippet that include a type import and a package import.
- */
-public void testImportTypeAndPackage() {
-	try {
-		context.setImports(new char[][] {"java.util.Enumeration".toCharArray(), "java.lang.reflect.*".toCharArray()});
-		evaluateWithExpectedDisplayString("Field[] fields = Enumeration.class.getDeclaredFields(); return fields.length;".toCharArray(), "0".toCharArray());
-	} finally {
-		// clean up
-		context.setImports(new char[0][]);
-	}
-}
-/**
- * Tests code snippet that include an anonymous inner class.
- */
-public void testInnerClassAnonymous() {
-	evaluateWithExpectedDisplayString(buildCharArray(new String[] {
-		"return new Object() {",
-		"	public String toString() {",
-		"		return \"an inner class\";",
-		"	}",
-		"};"}),
-		"an inner class".toCharArray());
-}
-/**
- * Tests code snippet that include a named inner class.
- */
-public void testInnerClassNamed() {
-	evaluateWithExpectedDisplayString(buildCharArray(new String[] {
-		"class X {",
-		"	int foo = 1;",
-		"}",
-		"return new X().foo;"}), 
-		"1".toCharArray());
-}
-/**
- * Tests code snippet that include a package declaration.
- */
-public void testPackage() {
-	if (isJRockitVM()) return;
-	// TBD: Test access to package private member
-	// TBD: Test access to package class and members in another package than a java.* package
-	try {
-		// declare that the code snippet is run in java.util.zip and access a package private class
-		context.setPackageName("java.util.zip".toCharArray());
-		evaluateWithExpectedDisplayString("return ZipConstants.LOCSIG;".toCharArray(), "67324752".toCharArray());
-	} finally {
-		// clean up
-		context.setPackageName(new char[0]);
-	}
-}
-/**
- * Tests the return value display strings for a boolean.
- */
-public void testReturnDisplayStringBoolean() {
-	evaluateWithExpectedDisplayString("return true;".toCharArray(), "true".toCharArray());
-}
-/**
- * Tests the return value display strings for a character.
- */
-public void testReturnDisplayStringCharacter() {
-	evaluateWithExpectedDisplayString("return 'c';".toCharArray(), "c".toCharArray());
-}
-/**
- * Tests the return value display strings for a double.
- */
-public void testReturnDisplayStringDouble() {
-	evaluateWithExpectedDisplayString("return 1.0;".toCharArray(), "1.0".toCharArray());
-}
-/**
- * Tests the return value display strings for no explicit returned value
- * because of an empty code snippet.
- */
-public void testReturnDisplayStringEmptyCodeSnippet() {
-	evaluateWithExpectedDisplayString(new char[0], null);
-}
-/**
- * Tests the return value display strings for a float.
- */
-public void testReturnDisplayStringFloat() {
-	evaluateWithExpectedDisplayString("return (float)1.0;".toCharArray(), "1.0".toCharArray());
-}
-/**
- * Tests the return value display strings for an integer.
- */
-public void testReturnDisplayStringInteger() {
-	evaluateWithExpectedDisplayString("return 1;".toCharArray(), "1".toCharArray());
-}
-/**
- * Tests the return value display strings for a long.
- */
-public void testReturnDisplayStringLong() {
-	evaluateWithExpectedDisplayString("return (long)1;".toCharArray(), "1".toCharArray());
-}
-/**
- * Tests the return value display strings for a code snippet
- * with no explicit returned value (implicitly the last expression is
- * wrapped inside a return statement).
- */
-public void testReturnDisplayStringNoExplicitReturnedValue() {
-	evaluateWithExpectedDisplayString("new String(\"hello\".toCharArray());".toCharArray(), "hello".toCharArray());
-}
-/**
- * Tests the return value display strings for an object.
- */
-public void testReturnDisplayStringObject() {
-	evaluateWithExpectedDisplayString(buildCharArray(new String[] {
-		"return new Object() {",
-		"	public String toString() {",
-		"		return \"an object\";",
-		"	}",
-		"};"}), 
-		"an object".toCharArray());
-}
-/**
- * Tests the return value display strings for a short.
- */
-public void testReturnDisplayStringShort() {
-	evaluateWithExpectedDisplayString("return (short)1;".toCharArray(), "1".toCharArray());
-}
-/**
- * Tests the return value display strings for a String.
- */
-public void testReturnDisplayStringString() {
-	evaluateWithExpectedDisplayString("return \"hello\";".toCharArray(), "hello".toCharArray());
-}
-/**
- * Tests the return value display strings for a code snippet
- * with a void returned value.
- */
-public void testReturnDisplayStringVoid() {
-	evaluateWithExpectedDisplayString("new Thread().start()".toCharArray(), null);
-}
-/**
- * Tests the return type for a boolean.
- */
-public void testReturnTypeBoolean() {
-	evaluateWithExpectedType("return true;".toCharArray(), "boolean".toCharArray());
-}
-/**
- * Tests the return type for a boolean array.
- */
-public void testReturnTypeBooleanArray() {
-	evaluateWithExpectedType("return new boolean[] {true};".toCharArray(), "[Z".toCharArray());
-}
-/**
- * Tests the return type for a Boolean object.
- */
-public void testReturnTypeBooleanObject() {
-	evaluateWithExpectedType("return new Boolean(true);".toCharArray(), "java.lang.Boolean".toCharArray());
-}
-/**
- * Tests the return type for a char.
- */
-public void testReturnTypeChar() {
-	evaluateWithExpectedType("return 'c';".toCharArray(), "char".toCharArray());
-}
-/**
- * Tests the return type for a Character object.
- */
-public void testReturnTypeCharacterObject() {
-	evaluateWithExpectedType("return new Character('c');".toCharArray(), "java.lang.Character".toCharArray());
-}
-/**
- * Tests the return type for a char array.
- */
-public void testReturnTypeCharArray() {
-	evaluateWithExpectedType("return new char[] {'c'};".toCharArray(), "[C".toCharArray());
-}
-/**
- * Tests the return type for a double.
- */
-public void testReturnTypeDouble() {
-	evaluateWithExpectedType("return 1.0;".toCharArray(), "double".toCharArray());
-}
-/**
- * Tests the return type for a double array.
- */
-public void testReturnTypeDoubleArray() {
-	evaluateWithExpectedType("return new double[] {1.0};".toCharArray(), "[D".toCharArray());
-}
-/**
- * Tests the return type for a Double object.
- */
-public void testReturnTypeDoubleObject() {
-	evaluateWithExpectedType("return new Double(1.0);".toCharArray(), "java.lang.Double".toCharArray());
-}
-/**
- * Tests the return type for an empty code snippet.
- */
-public void testReturnTypeEmptyCodeSnippet() {
-	evaluateWithExpectedType(new char[0], null);
-}
-/**
- * Tests the return type for a float.
- */
-public void testReturnTypeFloat() {
-	evaluateWithExpectedType("return (float)1.0;".toCharArray(), "float".toCharArray());
-}
-/**
- * Tests the return type for a float array.
- */
-public void testReturnTypeFloatArray() {
-	evaluateWithExpectedType("return new float[] {(float)1.0};".toCharArray(), "[F".toCharArray());
-}
-/**
- * Tests the return type for a Float object.
- */
-public void testReturnTypeFloatObject() {
-	evaluateWithExpectedType("return new Float(1.0);".toCharArray(), "java.lang.Float".toCharArray());
-}
-/**
- * Tests the return type for an int.
- */
-public void testReturnTypeInt() {
-	evaluateWithExpectedType("return 1;".toCharArray(), "int".toCharArray());
-}
-/**
- * Tests the return type for an Integer object.
- */
-public void testReturnTypeIntegerObject() {
-	evaluateWithExpectedType("return new Integer(1);".toCharArray(), "java.lang.Integer".toCharArray());
-}
-/**
- * Tests the return type for a long.
- */
-public void testReturnTypeLong() {
-	evaluateWithExpectedType("return (long)1;".toCharArray(), "long".toCharArray());
-}
-/**
- * Tests the return type for a long array.
- */
-public void testReturnTypeLongArray() {
-	evaluateWithExpectedType("return new long[] {(long)1};".toCharArray(), "[J".toCharArray());
-}
-/**
- * Tests the return type for a Long object.
- */
-public void testReturnTypeLongObject() {
-	evaluateWithExpectedType("return new Long(1);".toCharArray(), "java.lang.Long".toCharArray());
-}
-/**
- * Tests the return type for no explicit returned value.
- */
-public void testReturnTypeNoExplicitReturnedValue() {
-	evaluateWithExpectedType("new Object();".toCharArray(), "java.lang.Object".toCharArray());
-}
-/**
- * Tests the return type for an Object.
- */
-public void testReturnTypeObject() {
-	evaluateWithExpectedType("return new Object();".toCharArray(), "java.lang.Object".toCharArray());
-}
-/**
- * Tests the return type for an Object array.
- */
-public void testReturnTypeObjectArray() {
-	evaluateWithExpectedType("return new Object[] {new Object()};".toCharArray(), "[Ljava.lang.Object;".toCharArray());
-}
-/**
- * Tests the return type for a short.
- */
-public void testReturnTypeShort() {
-	evaluateWithExpectedType("return (short)1;".toCharArray(), "short".toCharArray());
-}
-/**
- * Tests the return type for a short array.
- */
-public void testReturnTypeShortArray() {
-	evaluateWithExpectedType("return new short[] {(short)1};".toCharArray(), "[S".toCharArray());
-}
-/**
- * Tests the return type for a Short object.
- */
-public void testReturnTypeShortObject() {
-	evaluateWithExpectedType("return new Short((short)1);".toCharArray(), "java.lang.Short".toCharArray());
-}
-/**
- * Tests the return type for an int array.
- */
-public void testReturnTypesIntArray() {
-	evaluateWithExpectedType("return new int[] {1};".toCharArray(), "[I".toCharArray());
-}
-/**
- * Tests the return type for a String.
- */
-public void testReturnTypeString() {
-	evaluateWithExpectedType("return \"hello\";".toCharArray(), "java.lang.String".toCharArray());
-}
-/**
- * Tests the return type for a String array.
- */
-public void testReturnTypeStringArray() {
-	evaluateWithExpectedType("return new String[] {\"hello\"};".toCharArray(), "[Ljava.lang.String;".toCharArray());
-}
-/**
- * Tests the return type for a void value.
- */
-public void testReturnTypeVoid() {
-	evaluateWithExpectedType("new Thread().start()".toCharArray(), null);
-}
-/**
- * Tests that the run() method defined in an anonymous class doesn't interfer with the
- * code snippet support (see PR #1G1C0HR).
- */
-public void testRunMethodInAnonymous() {
-	evaluateWithExpectedDisplayString(buildCharArray(new String[] {
-		"class X {",
-		"	public int i = 0;",
-		"   public boolean finished = false;",
-		"}",
-		"final X x = new X();",
-		"(new Thread() {",
-		"	public void run() {",
-		"		for (int i=0;i<10;i++) {",
-		"			try {",
-		"				Thread.currentThread().sleep(10);",
-		"			} catch (InterruptedException e) {",
-		"			}",
-		"			x.i++;",
-		"		}",
-		"       x.finished = true;",
-		"	}",
-		"}).start();",
-		"while (!x.finished) Thread.currentThread().sleep(100);",
-		"x.i"}), 
-		"10".toCharArray());
-}
-/**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=89632
- */
-public void testFor89632() {
-	if (this.complianceLevel.compareTo(COMPLIANCE_1_5) < 0) return;
-	try {
-		context.setImports(new char[][] {"java.util.*".toCharArray()});
-		evaluateWithExpectedDisplayString(
-				buildCharArray(new String[] {
-					"Collection<String> c = new ArrayList<String>();\n" +
-					"c.add(\"a\");\n" +
-					"c.add(\"b\");\n" +
-					"c.add(\"c\");  \n" +
-					"Iterator<String> i = c.iterator();\n" +
-					"StringBuffer buffer = new StringBuffer();\n" +
-					"while (i.hasNext()) {\n" +
-					"	buffer.append(i.next());\n" +
-					"}" +
-					"return String.valueOf(buffer);"
-				}), 
-				"abc".toCharArray());
-	} finally {
-		// clean up
-		context.setImports(new char[0][]);
-	}
-}
-}
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/eval/EvaluationSetup.java b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/eval/EvaluationSetup.java
deleted file mode 100644
index 65bda62..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/eval/EvaluationSetup.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *     IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.jsdt.core.tests.eval;
-
-import java.io.File;
-import java.io.InputStream;
-import java.io.PrintStream;
-
-import junit.framework.Test;
-
-import org.eclipse.wst.jsdt.core.tests.runtime.LocalVirtualMachine;
-
-import org.eclipse.wst.jsdt.core.tests.runtime.LocalVMLauncher;
-import org.eclipse.wst.jsdt.core.tests.runtime.TargetException;
-import org.eclipse.wst.jsdt.core.tests.runtime.TargetInterface;
-import org.eclipse.wst.jsdt.core.tests.util.CompilerTestSetup;
-import org.eclipse.wst.jsdt.core.tests.util.Util;
-import org.eclipse.wst.jsdt.internal.compiler.batch.FileSystem;
-import org.eclipse.wst.jsdt.internal.compiler.env.INameEnvironment;
-import org.eclipse.wst.jsdt.internal.eval.EvaluationContext;
-
-public class EvaluationSetup extends CompilerTestSetup {
-
-	public static final String EVAL_DIRECTORY = Util.getOutputDirectory() + File.separator + "evaluation";
-	public static final String JRE_PATH = Util.getJREDirectory();
-	
-	EvaluationContext context;
-	TargetInterface target;
-	LocalVirtualMachine launchedVM;
-	INameEnvironment env;
-
-	public EvaluationSetup(Test test, String complianceLevel) {
-		super(test, complianceLevel);
-	}
-
-	
-	protected void setUp() {
-		if (this.context == null) { // non null if called from subclass
-			
-			// Launch VM in evaluation mode
-			int evalPort;
-			if (EvaluationTest.JSDT_ENABLE) {
-				evalPort = Util.getFreePort();
-				try {
-					LocalVMLauncher launcher = LocalVMLauncher.getLauncher();
-					launcher.setVMPath(JRE_PATH);
-					launcher.setEvalPort(evalPort);
-					launcher.setEvalTargetPath(EVAL_DIRECTORY);
-					this.launchedVM = launcher.launch();
-				} catch (TargetException e) {
-					throw new Error(e.getMessage());
-				}
-				// Thread that read the stout of the VM so that the VM doesn't block
-				try {
-					startReader("VM's stdout reader", this.launchedVM
-							.getInputStream(), System.out);
-				} catch (TargetException e) {
-				}
-				// Thread that read the sterr of the VM so that the VM doesn't block
-				try {
-					startReader("VM's sterr reader", this.launchedVM
-							.getErrorStream(), System.err);
-				} catch (TargetException e) {
-				}
-			}			
-			// Create context
-			this.context = new EvaluationContext();
-
-			if (EvaluationTest.JSDT_ENABLE) {
-			// Create target
-			this.target = new TargetInterface();
-			this.target.connect("localhost", evalPort, 10000);
-			}
-
-			// Create name environment
-			this.env = new FileSystem(Util.getJavaClassLibs(), new String[0], null);
-		}
-		super.setUp();
-	}
-
-	protected void startReader(String name, final InputStream in, final PrintStream out) {
-		(new Thread(name) {
-			public void run() {
-				int read = 0;
-				while (read != -1) {
-					try {
-						read = in.read();
-					} catch (java.io.IOException e) {
-						read = -1;
-					}
-					if (read != -1) {
-						out.print((char)read);
-					}
-				}
-			}
-		}).start();
-	}
-
-	protected void tearDown() {
-		if (this.context != null) {
-			LocalVirtualMachine vm = this.launchedVM;
-			if (vm != null) {
-				try {
-					if (this.target != null) {
-						this.target.disconnect(); // Close the socket first so that the OS resource has a chance to be freed.
-					}
-					int retry = 0;
-					while (vm.isRunning() && (++retry < 20)) {
-						try {
-							Thread.sleep(retry * 100);
-						} catch (InterruptedException e) {
-						}
-					}
-					if (vm.isRunning()) {
-						vm.shutDown();
-					}
-					this.context = null;
-				} catch (TargetException e) {
-					throw new Error(e.getMessage());
-				}
-			}
-		}
-	}
-}
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/eval/EvaluationTest.java b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/eval/EvaluationTest.java
deleted file mode 100644
index 6ddffb4..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/eval/EvaluationTest.java
+++ /dev/null
@@ -1,566 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *     IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.jsdt.core.tests.eval;
-
-import java.io.File;
-import java.lang.reflect.Modifier;
-import java.util.ArrayList;
-import java.util.Map;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-import org.eclipse.wst.jsdt.core.compiler.CategorizedProblem;
-import org.eclipse.wst.jsdt.core.tests.junit.extension.StopableTestCase;
-import org.eclipse.wst.jsdt.core.tests.runtime.LocalVMLauncher;
-import org.eclipse.wst.jsdt.core.tests.runtime.LocalVirtualMachine;
-import org.eclipse.wst.jsdt.core.tests.runtime.TargetException;
-import org.eclipse.wst.jsdt.core.tests.runtime.TargetInterface;
-import org.eclipse.wst.jsdt.core.tests.util.*;
-import org.eclipse.wst.jsdt.internal.compiler.ClassFile;
-import org.eclipse.wst.jsdt.internal.compiler.IProblemFactory;
-import org.eclipse.wst.jsdt.internal.compiler.batch.FileSystem;
-import org.eclipse.wst.jsdt.internal.compiler.classfmt.ClassFileReader;
-import org.eclipse.wst.jsdt.internal.compiler.classfmt.ClassFormatException;
-import org.eclipse.wst.jsdt.internal.compiler.env.IBinaryField;
-import org.eclipse.wst.jsdt.internal.compiler.env.INameEnvironment;
-import org.eclipse.wst.jsdt.internal.compiler.impl.CompilerOptions;
-import org.eclipse.wst.jsdt.internal.compiler.problem.DefaultProblem;
-import org.eclipse.wst.jsdt.internal.compiler.problem.DefaultProblemFactory;
-import org.eclipse.wst.jsdt.core.compiler.CharOperation;
-import org.eclipse.wst.jsdt.internal.eval.EvaluationContext;
-import org.eclipse.wst.jsdt.internal.eval.EvaluationResult;
-import org.eclipse.wst.jsdt.internal.eval.GlobalVariable;
-import org.eclipse.wst.jsdt.internal.eval.IRequestor;
-import org.eclipse.wst.jsdt.internal.eval.InstallException;
-
-
-public class EvaluationTest extends AbstractCompilerTest implements StopableTestCase {
-	public static final boolean JSDT_ENABLE=false;
-
-	public class Requestor implements IRequestor {
-		public int resultIndex = -1;
-		public EvaluationResult[] results = new EvaluationResult[5];
-		public boolean acceptClassFiles(ClassFile[] classFiles, char[] codeSnippetClassName) {
-			try {
-				target.sendClasses(codeSnippetClassName != null, classFiles);
-			} catch (TargetException e) {
-				return false;
-			}
-			if (codeSnippetClassName != null) {
-				TargetInterface.Result result = target.getResult();
-				if (result.displayString == null) {
-					this.acceptResult(new EvaluationResult(null, EvaluationResult.T_CODE_SNIPPET, null, null));
-				} else {
-					this.acceptResult(new EvaluationResult(null, EvaluationResult.T_CODE_SNIPPET, result.displayString, result.typeName));
-				}
-			} else {
-				for (int i = 0, length = classFiles.length; i < length; i++) {
-					char[][] compoundName = classFiles[i].getCompoundName();
-					if (new String(compoundName[compoundName.length - 1]).startsWith("GlobalVariable")) {
-						try {
-							IBinaryField[] fields = new ClassFileReader(classFiles[i].getBytes(), null).getFields();
-							if (fields != null) {
-								for (int j = 0; j < fields.length; j++) {
-									IBinaryField field = fields[j];
-									if (Modifier.isPublic(field.getModifiers())) {
-										TargetInterface.Result result = target.getResult();
-										if (result.displayString == null) {
-											this.acceptResult(new EvaluationResult(field.getName(), EvaluationResult.T_VARIABLE, null, null));
-										} else {
-											this.acceptResult(new EvaluationResult(field.getName(), EvaluationResult.T_VARIABLE, result.displayString, result.typeName));
-										}
-									}
-								}
-							}
-						} catch (ClassFormatException e) {
-						}
-					}
-				}
-			}
-			return true;
-		}
-		public void acceptProblem(CategorizedProblem problem, char[] fragmentSource, int fragmentKind) {
-			this.acceptResult(new EvaluationResult(fragmentSource, fragmentKind, new CategorizedProblem[]{problem}));
-		}
-		public void acceptResult(EvaluationResult result) {
-			try {
-				this.results[++this.resultIndex] = result;
-			} catch (ArrayIndexOutOfBoundsException e) {
-				int oldResultLength = this.results.length;
-				System.arraycopy(this.results, 0, (this.results = new EvaluationResult[oldResultLength * 2]), 0, oldResultLength);
-				this.results[this.resultIndex] = result;
-			}
-		}
-	}
-	
-	String[] classPath;
-	public EvaluationContext context;
-	INameEnvironment env;
-	LocalVirtualMachine launchedVM;
-	TargetInterface target;
-	
-	/**
-	 * Creates a new EvaluationTest.
-	 */
-	public EvaluationTest(String name) {
-		super(name);
-	}
-	
-	public static Test setupSuite(Class clazz) {
-		ArrayList testClasses = new ArrayList();
-		testClasses.add(clazz);
-		return buildAllCompliancesTestSuite(clazz, EvaluationSetup.class, testClasses);
-	}
-	
-	public static Test suite(Class evaluationTestClass) {
-		TestSuite suite = new TestSuite(evaluationTestClass);
-		return suite;
-	}
-	
-	/**
-	 * Asserts that two char arrays are equal. If they are not an AssertionFailedError is thrown.
-	 * 
-	 * @param message
-	 *                 the detail message for this assertion
-	 * @param expected
-	 *                 the expected value of a char array
-	 * @param actual
-	 *                 the actual value of a char array
-	 */
-	public void assertEquals(String message, char[] expected, char[] actual) {
-		if (expected == null && actual == null)
-			return;
-		if (expected != null) {
-			if (actual == null) {
-				failNotEquals(message, expected, actual);
-				return;
-			}
-			if (expected.length == actual.length) {
-				for (int i = 0; i < expected.length; i++) {
-					if (expected[i] != actual[i]) {
-						failNotEquals(message, expected, actual);
-						return;
-					}
-				}
-				return;
-			}
-		}
-		failNotEquals(message, expected, actual);
-	}
-	
-	/**
-	 * Build a char array from the given lines
-	 */
-	protected char[] buildCharArray(String[] lines) {
-		StringBuffer buffer = new StringBuffer();
-		for (int i = 0; i < lines.length; i++) {
-			buffer.append(lines[i]);
-			if (i < lines.length - 1) {
-				buffer.append("\n");
-			}
-		}
-		int length = buffer.length();
-		char[] result = new char[length];
-		buffer.getChars(0, length, result, 0);
-		return result;
-	}
-
-	/**
-	 * Returns whether the 2 given problems are equals.
-	 */
-	public boolean equals(CategorizedProblem pb1, CategorizedProblem pb2) {
-		if ((pb1 == null) && (pb2 == null)) {
-			return true;
-		}
-		if ((pb1 == null) || (pb2 == null)) {
-			return false;
-		}
-		return (pb1.getID() == pb2.getID()) && (pb1.isError() == pb2.isError()) && (pb1.getSourceStart() == pb2.getSourceStart()) && (pb1.getSourceEnd() == pb2.getSourceEnd()) && (pb1.getSourceLineNumber() == pb2.getSourceLineNumber());
-	}
-	
-	/**
-	 * Evaluates the given code snippet and makes sure it returns a result with the given display string.
-	 */
-	public void evaluateWithExpectedDisplayString(Map compilerOptions, char[] codeSnippet, char[] displayString) {
-		Requestor requestor = new Requestor();
-		try {
-			context.evaluate(codeSnippet, getEnv(), compilerOptions, requestor, getProblemFactory());
-		} catch (InstallException e) {
-			assertTrue("Target exception " + e.getMessage(), false);
-		}
-		if (requestor.resultIndex != 0) {
-			for (int i = 0; i < requestor.resultIndex; i++) {
-				System.out.println("unexpected result[" + i + "]: " + requestor.results[i]);
-			}
-		}
-		assertTrue("Unexpected result", requestor.resultIndex == 0);
-		EvaluationResult result = requestor.results[0];
-		assertTrue("Has problem", !result.hasProblems());
-		assertTrue("Empty problem list", result.getProblems().length == 0);
-		if (displayString == null) {
-			assertTrue("Has value", !result.hasValue());
-		} else {
-			assertTrue("Has value", result.hasValue());
-			assertEquals("Evaluation type", EvaluationResult.T_CODE_SNIPPET, result.getEvaluationType());
-			//assertEquals("Evaluation id", codeSnippet, result.getEvaluationID());
-			assertEquals("Value display string", displayString, result.getValueDisplayString());
-		}
-	}
-	
-	/**
-	 * Evaluates the given code snippet and makes sure it returns a result with the given display string.
-	 */
-	public void evaluateWithExpectedDisplayString(char[] codeSnippet, char[] displayString) {
-		Requestor requestor = new Requestor();
-		try {
-			context.evaluate(codeSnippet, getEnv(), getCompilerOptions(), requestor, getProblemFactory());
-		} catch (InstallException e) {
-			assertTrue("Target exception " + e.getMessage(), false);
-		}
-		if (requestor.resultIndex != 0) {
-			for (int i = 0; i < requestor.resultIndex; i++) {
-				System.out.println("unexpected result[" + i + "]: " + requestor.results[i]);
-			}
-		}
-		assertTrue("Unexpected result", requestor.resultIndex == 0);
-		EvaluationResult result = requestor.results[0];
-		assertTrue("Has problem", !result.hasProblems());
-		assertTrue("Empty problem list", result.getProblems().length == 0);
-		if (displayString == null) {
-			assertTrue("Has value", !result.hasValue());
-		} else {
-			assertTrue("Has value", result.hasValue());
-			assertEquals("Evaluation type", EvaluationResult.T_CODE_SNIPPET, result.getEvaluationType());
-			//assertEquals("Evaluation id", codeSnippet, result.getEvaluationID());
-			assertEquals("Value display string", displayString, result.getValueDisplayString());
-		}
-	}
-	
-	/**
-	 * Evaluates the given code snippet and makes sure the evaluation result has at least the given problem on the given import.
-	 */
-	protected void evaluateWithExpectedImportProblem(char[] codeSnippet, char[] importDeclaration, CategorizedProblem expected) {
-		evaluateWithExpectedImportProblem(codeSnippet, importDeclaration, getCompilerOptions(), expected);
-	}
-	
-	/**
-	 * Evaluates the given code snippet and makes sure the evaluation result has at least the given problem on the given import.
-	 */
-	protected void evaluateWithExpectedImportProblem(char[] codeSnippet, char[] importDeclaration, Map options, CategorizedProblem expected) {
-		Requestor requestor = new Requestor();
-		try {
-			context.evaluate(codeSnippet, getEnv(), options, requestor, getProblemFactory());
-		} catch (InstallException e) {
-			assertTrue("Target exception " + e.getMessage(), false);
-		}
-		for (int i = 0; i <= requestor.resultIndex; i++) {
-			EvaluationResult result = requestor.results[i];
-			assertTrue("Has value", !result.hasValue());
-			assertTrue("Has problem", result.hasProblems());
-			assertEquals("Evaluation type", EvaluationResult.T_IMPORT, result.getEvaluationType());
-			assertEquals("Evaluation id", importDeclaration, result.getEvaluationID());
-			CategorizedProblem[] problems = result.getProblems();
-			if (equals(expected, problems[0])) {
-				return;
-			}
-		}
-		assertTrue("Expected problem not found", false);
-	}
-	
-	/**
-	 * Evaluates the given code snippet and makes sure the evaluation result has at least the given problem.
-	 */
-	protected void evaluateWithExpectedProblem(char[] codeSnippet, CategorizedProblem expected) {
-		Requestor requestor = new Requestor();
-		try {
-			context.evaluate(codeSnippet, getEnv(), getCompilerOptions(), requestor, getProblemFactory());
-		} catch (InstallException e) {
-			assertTrue("Target exception " + e.getMessage(), false);
-		}
-		for (int i = 0; i <= requestor.resultIndex; i++) {
-			EvaluationResult result = requestor.results[i];
-			assertTrue("Has value", !result.hasValue());
-			assertTrue("Has problem", result.hasProblems());
-			assertEquals("Evaluation type", EvaluationResult.T_CODE_SNIPPET, result.getEvaluationType());
-			assertEquals("Evaluation id", codeSnippet, result.getEvaluationID());
-			CategorizedProblem[] problems = result.getProblems();
-			if (equals(expected, problems[0])) {
-				return;
-			}
-		}
-		assertTrue("Expected problem not found", false);
-	}
-	
-	/**
-	 * Evaluates the given code snippet and makes sure the evaluation result has at least the given problem.
-	 */
-	protected void evaluateWithExpectedProblem(char[] codeSnippet, String problemsString) {
-		Requestor requestor = new Requestor();
-		try {
-			context.evaluate(codeSnippet, getEnv(), getCompilerOptions(), requestor, getProblemFactory());
-		} catch (InstallException e) {
-			assertTrue("Target exception " + e.getMessage(), false);
-		}
-		assertTrue("Got one result", requestor.resultIndex == 0);
-		EvaluationResult result = requestor.results[0];
-		assertTrue("Has value", !result.hasValue());
-		assertTrue("Has problem", result.hasProblems());
-		assertEquals("Evaluation type", EvaluationResult.T_CODE_SNIPPET, result.getEvaluationType());
-		assertEquals("Evaluation id", codeSnippet, result.getEvaluationID());
-		StringBuffer problemBuffer = new StringBuffer(20);
-		CategorizedProblem[] problems = result.getProblems();
-		for (int i = 0; i < problems.length; i++) {
-			problemBuffer.append(problems[i].getMessage()).append('\n');
-		}
-		assertEquals("Unexpected problems", problemsString, problemBuffer.toString());
-	}
-	
-	/**
-	 * Evaluates the given variable and makes sure the evaluation result has at least the given problem.
-	 */
-	protected void evaluateWithExpectedProblem(GlobalVariable var, CategorizedProblem expected) {
-		Requestor requestor = new Requestor();
-		try {
-			context.evaluateVariables(getEnv(), getCompilerOptions(), requestor, getProblemFactory());
-		} catch (InstallException e) {
-			assertTrue("Target exception " + e.getMessage(), false);
-		}
-		for (int i = 0; i <= requestor.resultIndex; i++) {
-			EvaluationResult result = requestor.results[i];
-			assertTrue("Has value", !result.hasValue());
-			assertTrue("Has problem", result.hasProblems());
-			assertEquals("Evaluation type", EvaluationResult.T_VARIABLE, result.getEvaluationType());
-			assertEquals("Evaluation id", var.getName(), result.getEvaluationID());
-			CategorizedProblem[] problems = result.getProblems();
-			if (equals(expected, problems[0])) {
-				return;
-			}
-		}
-		assertTrue("Expected problem not found", false);
-	}
-	
-	/**
-	 * Evaluates the given code snippet and makes sure it returns a result with the given type name.
-	 */
-	protected void evaluateWithExpectedType(char[] codeSnippet, char[] expectedTypeName) {
-		Requestor requestor = new Requestor();
-		try {
-			context.evaluate(codeSnippet, getEnv(), getCompilerOptions(), requestor, getProblemFactory());
-		} catch (InstallException e) {
-			assertTrue("Target exception " + e.getMessage(), false);
-		}
-		if (requestor.resultIndex != 0) {
-			for (int i = 0; i < requestor.resultIndex; i++) {
-				System.out.println("unexpected result[" + i + "]: " + requestor.results[i]);
-			}
-		}
-		assertTrue("Got one result", requestor.resultIndex == 0);
-		EvaluationResult result = requestor.results[0];
-		if (expectedTypeName == null) {
-			assertTrue("Has value", !result.hasValue());
-		} else {
-			assertTrue("Has value", result.hasValue());
-			assertEquals("Evaluation type", EvaluationResult.T_CODE_SNIPPET, result.getEvaluationType());
-			//assertEquals("Evaluation id", codeSnippet, result.getEvaluationID());
-			assertEquals("Value type name", expectedTypeName, result.getValueTypeName());
-		}
-	}
-	
-	/**
-	 * Evaluates the given code snippet and makes sure it returns a result with the given display string and type name.
-	 */
-	protected void evaluateWithExpectedValue(char[] codeSnippet, char[] displayString, char[] typeName) {
-		Requestor requestor = new Requestor();
-		try {
-			context.evaluate(codeSnippet, getEnv(), getCompilerOptions(), requestor, getProblemFactory());
-		} catch (InstallException e) {
-			assertTrue("Target exception " + e.getMessage(), false);
-		}
-		assertTrue("Got one result", requestor.resultIndex == 0);
-		EvaluationResult result = requestor.results[0];
-		if (displayString == null) {
-			assertTrue("Missing value", !result.hasValue());
-		} else {
-			assertTrue("Has value", result.hasValue());
-			assertEquals("Evaluation type", EvaluationResult.T_CODE_SNIPPET, result.getEvaluationType());
-			//assertEquals("Evaluation id", codeSnippet, result.getEvaluationID());
-			assertEquals("Value display string", displayString, result.getValueDisplayString());
-			assertEquals("Value type name", typeName, result.getValueTypeName());
-		}
-	}
-	
-	/**
-	 * Evaluates the given variable and makes sure it returns a result with the given display string and type name.
-	 */
-	protected void evaluateWithExpectedValue(GlobalVariable var, char[] displayString, char[] typeName) {
-		Requestor requestor = new Requestor();
-		try {
-			context.evaluateVariable(var, getEnv(), getCompilerOptions(), requestor, getProblemFactory());
-		} catch (InstallException e) {
-			assertTrue("Target exception " + e.getMessage(), false);
-		}
-		if (requestor.resultIndex != 0) {
-			for (int i = 0; i < requestor.resultIndex; i++) {
-				System.out.println("unexpected result[" + i + "]: " + requestor.results[i]);
-			}
-		}
-		assertTrue("Unexpected result", requestor.resultIndex == 0);
-		EvaluationResult result = requestor.results[0];
-		if (displayString == null) {
-			assertTrue("Has value", !result.hasValue());
-		} else {
-			assertTrue("Has value", result.hasValue());
-			assertEquals("Value display string", displayString, result.getValueDisplayString());
-			assertEquals("Value type name", typeName, result.getValueTypeName());
-		}
-	}
-	
-	/**
-	 * Evaluates the given code snippet and makes sure an evaluation result has at least the given warning, and that another evaluation result has the given display string.
-	 */
-	protected void evaluateWithExpectedWarningAndDisplayString(final char[] codeSnippet, final CategorizedProblem[] expected, final char[] displayString) {
-		class ResultRequestor extends Requestor {
-			ArrayList collectedProblems = new ArrayList();
-			boolean gotDisplayString = false;
-			public void acceptResult(EvaluationResult result) {
-				assertEquals("Evaluation type", EvaluationResult.T_CODE_SNIPPET, result.getEvaluationType());
-				//assertEquals("Evaluation id", codeSnippet, result.getEvaluationID());
-				if (result.hasValue()) {
-					if (CharOperation.equals(result.getValueDisplayString(), displayString)) {
-						gotDisplayString = true;
-					}
-				} else {
-					assertTrue("Has problem", result.hasProblems());
-					CategorizedProblem[] problems = result.getProblems();
-					for (int i = 0; i < problems.length; i++) {
-						collectedProblems.add(problems[i]);
-					}
-				}
-			}
-		}
-		ResultRequestor requestor = new ResultRequestor();
-		try {
-			context.evaluate(codeSnippet, getEnv(), getCompilerOptions(), requestor, getProblemFactory());
-		} catch (InstallException e) {
-			assertTrue("Target exception " + e.getMessage(), false);
-		}
-		if (expected.length == requestor.collectedProblems.size()) {
-			for (int i = 0; i < expected.length; i++) {
-				assertTrue("Problem mismatch" + requestor.collectedProblems.get(i), this.equals(expected[i], (CategorizedProblem)requestor.collectedProblems.get(i)));
-			}
-		} else {
-			assertTrue("Wrong problem count", false);
-		}
-		assertTrue("Expected display string", requestor.gotDisplayString);
-	}
-	
-	private void failNotEquals(String message, char[] expected, char[] actual) {
-		String formatted = "";
-		if (message != null)
-			formatted = message + " ";
-		String expectedString = expected == null ? "null" : new String(expected);
-		String actualString = actual == null ? "null" : new String(actual);
-		fail(formatted + "expected:<" + expectedString + "> but was:<" + actualString + ">");
-	}
-	
-	public Map getCompilerOptions() {
-		Map defaultOptions = super.getCompilerOptions();
-		defaultOptions.put(CompilerOptions.OPTION_LocalVariableAttribute, CompilerOptions.DO_NOT_GENERATE);
-		defaultOptions.put(CompilerOptions.OPTION_LineNumberAttribute, CompilerOptions.DO_NOT_GENERATE);
-		defaultOptions.put(CompilerOptions.OPTION_SourceFileAttribute, CompilerOptions.DO_NOT_GENERATE);
-		defaultOptions.put(CompilerOptions.OPTION_ReportUnusedLocal, CompilerOptions.WARNING);
-		defaultOptions.put(CompilerOptions.OPTION_ReportUnusedImport, CompilerOptions.IGNORE);
-		defaultOptions.put(CompilerOptions.OPTION_ReportUnusedParameter, CompilerOptions.WARNING);
-		defaultOptions.put(CompilerOptions.OPTION_ReportLocalVariableHiding, CompilerOptions.WARNING);
-		defaultOptions.put(CompilerOptions.OPTION_ReportUnusedPrivateMember, CompilerOptions.IGNORE);
-		defaultOptions.put(CompilerOptions.OPTION_ReportPossibleAccidentalBooleanAssignment, CompilerOptions.WARNING);
-		return defaultOptions;
-	}
-	
-	public INameEnvironment getEnv() {
-		return env;
-	}
-
-	public IProblemFactory getProblemFactory() {
-		return new DefaultProblemFactory(java.util.Locale.getDefault());
-	}
-	
-	public void initialize(CompilerTestSetup setUp) {
-		super.initialize(setUp);
-		EvaluationSetup evalSetUp = (EvaluationSetup)setUp;
-		this.context = evalSetUp.context;
-		this.target = evalSetUp.target;
-		this.launchedVM = evalSetUp.launchedVM;
-		this.env = evalSetUp.env;
-	}
-	
-	/**
-	 * Installs all the variables and check that the number of installed variables is the given number.
-	 */
-	protected void installVariables(final int expectedNumber) {
-		class InstallRequestor extends Requestor {
-			int count = 0;
-			public void acceptResult(EvaluationResult result) {
-				assertTrue("Has problems", !result.hasProblems());
-				assertTrue("Has value", result.hasValue());
-				this.count++;
-			}
-		}
-
-		InstallRequestor installRequestor = new InstallRequestor();
-		try {
-			context.evaluateVariables(getEnv(), getCompilerOptions(), installRequestor, getProblemFactory());
-		} catch (InstallException e) {
-			assertTrue("Target exception: " + e.getMessage(), false);
-		}
-		assertEquals("Number of installed variables", expectedNumber, installRequestor.count);
-	}
-	
-	public boolean isJRockitVM() {
-		final String vmName = System.getProperty("java.vm.name");
-		return vmName != null && vmName.indexOf("JRockit") != -1;
-	}
-	/**
-	 * Returns a new problem with the given id, severity, source positions and line number.
-	 */
-	protected DefaultProblem newProblem(int id, int severity, int startPos, int endPos, int line) {
-		return new DefaultProblem(null, null, id, null, severity, startPos, endPos, line, 0);
-	}
-	
-	public void resetEnv() {
-		String encoding = (String)getCompilerOptions().get(CompilerOptions.OPTION_Encoding);
-		if ("".equals(encoding))
-			encoding = null;
-		env = new FileSystem(Util.concatWithClassLibs(EvaluationSetup.EVAL_DIRECTORY + File.separator + LocalVMLauncher.REGULAR_CLASSPATH_DIRECTORY, false), new String[0], encoding);
-	}
-	
-	public void stop() {
-		if (this.target != null) {
-			this.target.disconnect(); // Close the socket first so that the OS resource has a chance to be freed.
-		}
-		if (this.launchedVM != null) {
-			try {
-				int retry = 0;
-				while (this.launchedVM.isRunning() && (++retry < 20)) {
-					try {
-						Thread.sleep(retry * 100);
-					} catch (InterruptedException e) {
-					}
-				}
-				if (this.launchedVM.isRunning()) {
-					this.launchedVM.shutDown();
-				}
-			} catch (TargetException e) {
-			}
-		}
-	}
-}
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/eval/NegativeCodeSnippetTest.java b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/eval/NegativeCodeSnippetTest.java
deleted file mode 100644
index 6af3642..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/eval/NegativeCodeSnippetTest.java
+++ /dev/null
@@ -1,366 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *     IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.jsdt.core.tests.eval;
-
-import java.util.Map;
-
-import junit.framework.Test;
-
-import org.eclipse.wst.jsdt.core.compiler.CategorizedProblem;
-import org.eclipse.wst.jsdt.core.compiler.IProblem;
-import org.eclipse.wst.jsdt.internal.compiler.impl.CompilerOptions;
-import org.eclipse.wst.jsdt.internal.compiler.lookup.ProblemReasons;
-import org.eclipse.wst.jsdt.internal.compiler.problem.ProblemSeverities;
-import org.eclipse.wst.jsdt.internal.eval.GlobalVariable;
-/**
- * Negative tests for code snippet. Only compilation problems should be reported in
- * these tests.
- */
-public class NegativeCodeSnippetTest extends EvaluationTest implements ProblemSeverities, ProblemReasons {
-/**
- * Creates a new NegativeCodeSnippetTest.
- */
-public NegativeCodeSnippetTest(String name) {
-	super(name);
-}
-public static Test suite() {
-	return setupSuite(testClass());
-}
-/**
- * Test a scenario where the change of the package declaration causes a problem in a code snippet.
- */
-public void testChangePackage() {
-	if (isJRockitVM()) return;
-	try {
-		// define the package
-		context.setPackageName("java.util.zip".toCharArray());
-		
-		// evaluate a code snippet that uses this variable
-		char[] codeSnippet = "new InflaterInputStream(new java.io.ByteArrayInputStream(new byte[0])).len".toCharArray();
-		evaluateWithExpectedDisplayString(
-			codeSnippet,
-			"0".toCharArray()); 
-
-		// back to the default package but with correct import
-		this.context.setPackageName(new char[0]);
-		this.context.setImports(new char[][] {"java.util.zip.*".toCharArray()});
-
-		// evaluate same code snippet
-		evaluateWithExpectedProblem(
-			codeSnippet,
-			newProblem(IProblem.NotVisibleField, Error, 71, 73, 1)); // The field len is not visible
-
-		// back to the default package and with no imports
-		this.context.setImports(new char[0][]);
-		
-		// evaluate same code snippet
-		evaluateWithExpectedProblem(
-			codeSnippet,
-			newProblem(IProblem.UndefinedType, Error, 4, 22, 1)); // The type InflaterInputStream is undefined
-	} finally {
-		// Clean up
-		this.context.setPackageName(new char[0]);
-		this.context.setImports(new char[0][]);
-	}
-}
-public static Class testClass() {
-	return NegativeCodeSnippetTest.class;
-}
-/**
- * Test a code snippet which declares a class that uses an expression as a returned statement
- * in one of its methods.
- */
-public void testExpressionInInnerClass() {
-	//TODO (david) Syntax error diagnose should be improved in this case.
-	evaluateWithExpectedProblem(buildCharArray(new String[] {
-		"class X {",
-		"	int foo() {",
-		"		1 + 1",
-		"	}",
-		"}",
-		"return new X().foo();"}), 
-		newProblem(IProblem.ParsingError, Error, 21, 21, 2)); // Syntax error on token "+"
-}
-/**
- * Test extra closing curly bracket.
- */
-public void testExtraClosingCurlyBracket() {
-	//TODO (david) Syntax error diagnose should be improved in this case.
-	// just an expression with an extra curly bracket
-	evaluateWithExpectedProblem(
-		"1 + 2}".toCharArray(), 
-		newProblem(IProblem.ParsingError, Error, 0, 0, 1)); // Unmatched bracket
-
-	// a statement followed by an unreachable expression with an extra curly bracket
-	evaluateWithExpectedProblem(buildCharArray(new String[] {
-		"return 1 + 1;",
-		" 2 + 2}"}), 
-		newProblem(IProblem.ParsingError, Error, 15, 15, 2)); // Unmatched bracket
-}
-/**
- * Test extra open round bracket.
- */
-public void testExtraOpenRoundBracket() {
-	evaluateWithExpectedProblem(
-		"foo((a);".toCharArray(), 
-		newProblem(IProblem.ParsingErrorInsertToComplete, Error, 6, 6, 1)); // Unmatched bracket
-}
-/**
- * Test a code snippet that contains an expression followed by a semi-colon.
- */
-public void testExtraSemiColonInExpression() {
-	evaluateWithExpectedProblem(
-		"1;".toCharArray(), 
-		newProblem(IProblem.ParsingErrorInsertToComplete, Error, 0, 0, 1)); // Syntax error on token EOF
-}
-/**
- * Test access to a non existing field.
- * (regression test for bug 25250 Scrapbook shows wrong error message)
- */
-public void testInvalidField() {
-	evaluateWithExpectedProblem(
-		("String s = \"\";\n" +
-		"s.length").toCharArray(), 
-		"s.length cannot be resolved or is not a field\n"); 
-}
-/**
- * Test a code snippet which is valid but the evaluation context imports have problems.
- */
-public void testInvalidImport() {
-	try {
-		// problem on the first import
-		context.setImports(new char[][] {"bar.Y".toCharArray()});
-		evaluateWithExpectedImportProblem(buildCharArray(new String[] {
-			"class X {",
-			"	Y foo = new Y();",
-			"}",
-			"return new X().foo;"}),
-			"bar.Y".toCharArray(),
-			newProblem(IProblem.ImportNotFound, Error, 0, 4, 1)); // The import bar.Y could not be resolved
-
-		// problem on the second import
-		context.setImports(new char[][] {"java.io.*".toCharArray(), "{".toCharArray()});
-		evaluateWithExpectedImportProblem(buildCharArray(new String[] {
-			"new File(\"c:\\temp\")"}),
-			"{".toCharArray(),
-			newProblem(IProblem.ParsingError, Error, 0, 0, 1)); // Syntax error on token "{", "Identifier" expected
-	} finally {
-		// Clean up
-		context.setImports(new char[0][]);
-	}
-}
-/**
- * Test use of this.
- */
-public void testInvalidUseOfThisInSnippet() {
-	evaluateWithExpectedProblem(
-		"this".toCharArray(), 
-		"Cannot use this in a static context \n"); 
-}
-/**
- * Test use of this.
- */
-public void testInvalidUseOfThisInSnippet2() {
-	// just an expression with an extra curly bracket
-	evaluateWithExpectedProblem(
-		"return this;".toCharArray(), 
-		"Cannot use this in a static context \n"); 
-}
-/**
- * Test a code snippet that misses a closing round bracket.
- */
-public void testMissingClosingRoundBracket() {
-	evaluateWithExpectedProblem(buildCharArray(new String[] {
-		"System.out.println(\"3 + 3\";"}), 
-		newProblem(IProblem.ParsingErrorInsertToComplete, Error, 19, 25, 1)); // Unmatched bracket
-}
-/**
- * Test a code snippet that contains a string that misses the closing double quote .
- */
-public void testMissingDoubleQuote() {
-	evaluateWithExpectedProblem(buildCharArray(new String[] {
-		"System.out.println(\"3 + 3 = );",
-		"3 + 3"}), 
-		newProblem(IProblem.UnterminatedString , Error, 19, 29, 1)); // String literal is not properly closed by a double-quote
-}
-/**
- * Test an expression which is not the last statement.
- */
-public void testNonLastExpressionStatement() {
-	evaluateWithExpectedProblem(buildCharArray(new String[] {
-		"1 == '1';",
-		"true"}), 
-		newProblem(IProblem.ParsingErrorInvalidToken, Error, 2, 3, 1)); // Syntax error on token "=="
-}
-/**
- * Test a problem in the returned expression.
- */
-public void testProblemInExpression() {
-	evaluateWithExpectedProblem(
-		"new Object(); 3 + ".toCharArray(), 
-		newProblem(IProblem.ParsingErrorDeleteToken, Error, 16, 16, 1)); // Syntax error on token '+'
-}
-/**
- * Test a problem in the returned expression.
- */
-public void testProblemInExpression2() {
-	evaluateWithExpectedProblem(
-		"new UnknownClass()".toCharArray(), 
-		newProblem(IProblem.UndefinedType, Error, 4, 15, 1)); // UnknownClass cannot be resolved to a type
-}
-/**
- * Test a code snippet which declares a class that has a problem.
- */
-public void testProblemInInnerClass() {
-	// class declared before the last expression
-	evaluateWithExpectedProblem(buildCharArray(new String[] {
-		"class X {",
-		"	Y foo = new Y();",
-		"}",
-		"return new X().foo;"}), 
-		newProblem(IProblem.UndefinedType, Error, 11, 11, 2)); // The type Y is undefined
-
-	// class declared as part of the last expression
-	evaluateWithExpectedWarningAndDisplayString(buildCharArray(new String[] {
-		"return new Object() {",
-		"	public String toString() {",
-		"		int i = 0;",
-		"		return \"an inner class\";",
-		"	}",
-		"};"}), 
-		new CategorizedProblem[] {
-			newProblem(IProblem.LocalVariableIsNeverUsed, Warning, 56, 56, 3), // The local variable i is never used
-		},
-		"an inner class".toCharArray()); 
-}
-/**
- * Test a problem in the statement before the returned expression.
- */
-public void testProblemInPreviousStatement() {
-	//TODO (david) Syntax error diagnose should be improved in this case.
-	evaluateWithExpectedProblem(buildCharArray(new String[] {
-		"return foo(a a);",
-		"1 + 3"}), 
-		newProblem(IProblem.ParsingErrorDeleteToken, Error, 13, 13, 1)); //  Syntax error on token "a"
-}
-/**
- * Test a code snippet that has a problem in a return statement.
- */
-public void testProblemInReturnStatement() {
-	evaluateWithExpectedProblem(
-		"return 1 ++ 1;".toCharArray(), 
-		newProblem(IProblem.InvalidUnaryExpression, Error, 7, 7, 1)); // Invalid argument to operation ++/--
-}
-/**
- * Test a scenario where the removal of an import causes a problem in a code snippet.
- */
-public void testRemoveImport() {
-	try {
-		// define the import
-		this.context.setImports(new char[][] {"java.io.*".toCharArray()});
-		
-		// evaluate a code snippet that uses this variable
-		char[] codeSnippet = "new File(\"c:\\\\temp\")".toCharArray();
-		evaluateWithExpectedDisplayString(
-			codeSnippet,
-			"c:\\temp".toCharArray()); 
-
-		// remove the import
-		this.context.setImports(new char[0][]);
-
-		// evaluate same code snippet
-		evaluateWithExpectedProblem(
-			codeSnippet,
-			newProblem(IProblem.UndefinedType, Error, 4, 7, 1)); // The type File is undefined
-	} finally {
-		// Clean up
-		this.context.setImports(new char[0][]);
-	}
-}
-/**
- * Test a scenario where the removal of a variable causes a problem in a code snippet.
- */
-public void testRemoveVariable() {
-	GlobalVariable var = null;
-	try {
-		// define the variable
-		var = this.context.newVariable("int".toCharArray(), "i".toCharArray(), "1".toCharArray());
-		installVariables(1);
-		
-		// evaluate a code snippet that uses this variable
-		char[] codeSnippet = "i".toCharArray();
-		evaluateWithExpectedDisplayString(
-			codeSnippet,
-			"1".toCharArray()); 
-
-		// remove the variable
-		this.context.deleteVariable(var);
-		installVariables(0);
-
-		// evaluate same code snippet
-		evaluateWithExpectedProblem(
-			codeSnippet,
-			newProblem(IProblem.UndefinedName, Error, 0, 0, 1)); // i cannot be resolved
-	} finally {
-		// Clean up
-		if (var != null) {
-			this.context.deleteVariable(var);
-		}
-	}
-}
-/**
- * Test a code snippet that contains an expression which is not reachable.
- */
-public void testUnreachableExpression() {
-	evaluateWithExpectedProblem(buildCharArray(new String[] {
-		"return 1 + 1;",
-		"2 + 2"}), 
-		newProblem(IProblem.CodeCannotBeReached, Error, 14, 18, 2)); // Unreachable code
-}
-/**
- * Test a code snippet which is valid but never uses the evaluation context imports.
- * (regression test for bug 18922 Scrapbook does not come back when errors in snippet)
- */
-public void testUnusedImport() {
-	try {
-		context.setImports(new char[][] {"java.util.*".toCharArray()});
-		
-		// evaluate with import as error
-		Map options = this.getCompilerOptions();
-		options.put(CompilerOptions.OPTION_ReportUnusedImport, CompilerOptions.ERROR);
-		
-		// force evaluation so that the following evaluation will use a CodeSnippetEvaluator instead
-		// of a VariableEvualator
-		evaluateWithExpectedValue("1".toCharArray(), "1".toCharArray(), "int".toCharArray());
-		
-		evaluateWithExpectedImportProblem(
-			"new String(\"NOPE\")".toCharArray(),
-			"java.util.*".toCharArray(),
-			options,
-			newProblem(IProblem.UnusedImport, Error, 0, 10, 1)); // The import java.util.* is unused
-	} finally {
-		// Clean up
-		context.setImports(new char[0][]);
-	}
-}
-/**
- * Test a code snippet that has warnings but no errors.
- */
-public void testWarning() {
-	evaluateWithExpectedWarningAndDisplayString(buildCharArray(new String[] {
-		"int i;",
-		"1 + 1"}), 
-		new CategorizedProblem[] {
-			newProblem(IProblem.LocalVariableIsNeverUsed, Warning, 4, 4, 1), // The local variable i is never used
-		},
-		"2".toCharArray());
-}
-}
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/eval/NegativeVariableTest.java b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/eval/NegativeVariableTest.java
deleted file mode 100644
index b57e336..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/eval/NegativeVariableTest.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *     IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.jsdt.core.tests.eval;
-
-import junit.framework.Test;
-
-import org.eclipse.wst.jsdt.core.compiler.IProblem;
-import org.eclipse.wst.jsdt.internal.compiler.lookup.ProblemReasons;
-import org.eclipse.wst.jsdt.internal.compiler.problem.ProblemSeverities;
-import org.eclipse.wst.jsdt.internal.eval.GlobalVariable;
-/**
- * Negative tests for variables. Only compilation problems should be reported in
- * these tests.
- */
-public class NegativeVariableTest extends EvaluationTest implements ProblemSeverities, ProblemReasons {
-/**
- * Creates a new NegativeVariableTest.
- */
-public NegativeVariableTest(String name) {
-	super(name);
-}
-public static Test suite() {
-	return setupSuite(testClass());
-}
-public static Class testClass() {
-	return NegativeVariableTest.class;
-}
-/**
- * Test a variable that has a problem in its initializer.
- */
-public void testInitializerProblem() {
-	// Problem in first variable
-	GlobalVariable var = null;
-	try {
-		var = context.newVariable("int".toCharArray(), "i".toCharArray(), buildCharArray(new String[] {
-			"(1 + 1) *",
-			"(j + 2)"}));
-		evaluateWithExpectedProblem(
-			var, 
-			newProblem(IProblem.UndefinedName, Error, 11, 11, 2)); // j cannot be resolved
-	} finally {
-		if (var != null) {
-			context.deleteVariable(var);
-		}
-	}
-
-	// Problem in second variable
-	GlobalVariable var1 = null;
-	GlobalVariable var2 = null;
-	try {
-		var1 = context.newVariable("Object".toCharArray(), "o".toCharArray(), "new Object()".toCharArray());
-		var2 = context.newVariable("int".toCharArray(), "i".toCharArray(), buildCharArray(new String[] {
-			"(1 + 1) *",
-			"(1 ++ 2)"}));
-		evaluateWithExpectedProblem(
-			var2, 
-			newProblem(IProblem.InvalidUnaryExpression, Error, 11, 11, 2)); // Invalid argument to operation ++/--
-	} finally {
-		if (var1 != null) {
-			context.deleteVariable(var1);
-		}
-		if (var2 != null) {
-			context.deleteVariable(var2);
-		}
-	}
-	
-}
-/**
- * Test a variable that has a problem in its name.
- * TODO (david) investigate why changes in enum recovery caused this test to fail
- */
-public void _testInvalidName() {
-	// Problem in first variable
-	GlobalVariable var = null;
-	try {
-		var = context.newVariable("int".toCharArray(), "!@#$%^&*()_".toCharArray(), "1".toCharArray());
-		evaluateWithExpectedProblem(
-			var, 
-			newProblem(IProblem.ParsingErrorDeleteTokens, Error, 0, 9, 0)); // Syntax error, delete these tokens
-	} finally {
-		if (var != null) {
-			context.deleteVariable(var);
-		}
-	}
-
-	// Problem in second variable
-	GlobalVariable var1 = null;
-	GlobalVariable var2 = null;
-	try {
-		var1 = context.newVariable("String".toCharArray(), "foo".toCharArray(), "\"bar\"".toCharArray());
-		var2 = context.newVariable("int".toCharArray(), "!@#$%^&*()_".toCharArray(), "1".toCharArray());
-		evaluateWithExpectedProblem(
-			var2, 
-			newProblem(IProblem.ParsingErrorDeleteTokens, Error, 0, 9, 0)); // Syntax error, delete these tokens
-	} finally {
-		if (var1 != null) {
-			context.deleteVariable(var1);
-		}
-		if (var2 != null) {
-			context.deleteVariable(var2);
-		}
-	}
-}
-/**
- * Test a variable that has a problem in its type declaration.
- */
-public void testUnknownType() {
-	// Problem in first variable
-	GlobalVariable var = null;
-	try {
-		var = context.newVariable("foo.Bar".toCharArray(), "var".toCharArray(), null);
-		evaluateWithExpectedProblem(
-			var, 
-			newProblem(IProblem.UndefinedType, Error, 0, 2, -1)); // The type foo is undefined
-	} finally {
-		if (var != null) {
-			context.deleteVariable(var);
-		}
-	}
-
-	// Problem in second variable
-	GlobalVariable var1 = null;
-	GlobalVariable var2 = null;
-	try {
-		var1 = context.newVariable("int".toCharArray(), "x".toCharArray(), null);
-		var2 = context.newVariable("foo.Bar".toCharArray(), "var".toCharArray(), null);
-		evaluateWithExpectedProblem(
-			var2, 
-			newProblem(IProblem.UndefinedType, Error, 0, 2, -1)); // The type foo is undefined
-	} finally {
-		if (var1 != null) {
-			context.deleteVariable(var1);
-		}
-		if (var2 != null) {
-			context.deleteVariable(var2);
-		}
-	}
-}
-}
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/eval/SanityTestEvaluationContext.java b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/eval/SanityTestEvaluationContext.java
deleted file mode 100644
index df700c4..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/eval/SanityTestEvaluationContext.java
+++ /dev/null
@@ -1,233 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *     IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.jsdt.core.tests.eval;
-
-import junit.framework.Test;
-
-import org.eclipse.wst.jsdt.internal.eval.EvaluationResult;
-import org.eclipse.wst.jsdt.internal.eval.GlobalVariable;
-import org.eclipse.wst.jsdt.internal.eval.IRequestor;
-import org.eclipse.wst.jsdt.internal.eval.InstallException;
-/**
- * Sanity test the IEvaluationContext interface.
- * For in depth tests, see VariableTest or CodeSnippetTest.
- */
-public class SanityTestEvaluationContext extends EvaluationTest {
-/**
- * Creates a new SanityEvaluationContextTest.
- */
-public SanityTestEvaluationContext(String name) {
-	super(name);
-}
-public static Test suite() {
-	return setupSuite(testClass());
-}
-/**
- * Sanity test of IEvaluationContext.allVariables()
- */
-public void testAllVariables() {
-	// No variables defined yet
-	GlobalVariable[] vars = context.allVariables();
-	assertEquals("No variables should be defined", 0, vars.length);
-
-	// Define 3 variables
-	context.newVariable("int".toCharArray(), "foo".toCharArray(), "1".toCharArray());
-	context.newVariable("Object".toCharArray(), "bar".toCharArray(), null);
-	context.newVariable("String".toCharArray(), "zip".toCharArray(), "\"abcdefg\"".toCharArray());
-	vars = context.allVariables();
-	assertEquals("3 variables should be defined", 3, vars.length);
-	assertEquals("1st variable", "foo".toCharArray(), vars[0].getName());
-	assertEquals("2nd variable", "bar".toCharArray(), vars[1].getName());
-	assertEquals("3rd variable", "zip".toCharArray(), vars[2].getName());
-
-	// Remove 2nd variable
-	context.deleteVariable(vars[1]);
-	vars = context.allVariables();
-	assertEquals("2 variables should be defined", 2, vars.length);
-	assertEquals("1st variable", "foo".toCharArray(), vars[0].getName());
-	assertEquals("2nd variable", "zip".toCharArray(), vars[1].getName());
-
-	// Remove last variable
-	context.deleteVariable(vars[1]);
-	vars = context.allVariables();
-	assertEquals("1 variable should be defined", 1, vars.length);
-	assertEquals("1st variable", "foo".toCharArray(), vars[0].getName());
-
-	// Remove 1st variable
-	context.deleteVariable(vars[0]);
-	vars = context.allVariables();
-	assertEquals("No variables should be defined", 0, vars.length);
-}
-public static Class testClass() {
-	return SanityTestEvaluationContext.class;
-}
-/**
- * Sanity test of IEvaluationContext.evaluate(char[], INameEnvironment, ConfigurableOption[], IRequestor , IProblemFactory)
- */
-public void testEvaluate() {
-	Requestor requestor = new Requestor();
-	char[] snippet = "return 1;".toCharArray();
-	try {
-		context.evaluate(snippet, getEnv(), getCompilerOptions(), requestor, getProblemFactory());
-	} catch (InstallException e) {
-		assertTrue("No targetException " + e.getMessage(), false);
-	}
-	assertTrue("Got one result", requestor.resultIndex == 0);
-	EvaluationResult result = requestor.results[0];
-	assertTrue("No problems with the code snippet", !result.hasProblems());
-	assertTrue("Result has a value", result.hasValue());
-	assertEquals("Value", "1".toCharArray(), result.getValueDisplayString());
-	assertEquals("Type", "int".toCharArray(), result.getValueTypeName());
-}
-/**
- * Sanity test of IEvaluationContext.evaluateImports(INameEnvironment, IRequestor , IProblemFactory)
- */
-public void testEvaluateImports() {
-	try {
-		// Define imports
-		context.setImports(new char[][] {"java.util.*".toCharArray(), "java.lang.reflect.Method".toCharArray()});
-
-		// Evaluate them
-		IRequestor requestor = new Requestor() {
-			public void acceptResult(EvaluationResult result) {
-				assertTrue("No problems with the imports", !result.hasProblems());
-			}
-		};
-		context.evaluateImports(getEnv(), requestor, getProblemFactory());
-	} finally {
-		// Clean up
-		context.setImports(new char[0][]);
-	}
-}
-/**
- * Sanity test of IEvaluationContext.evaluateVariable(IGlobalVariable, IRequestor)
- */
-public void testEvaluateVariable() {
-	GlobalVariable var = null;
-	try {
-		// Create the variable
-		var = context.newVariable("int".toCharArray(), "foo".toCharArray(), "1".toCharArray());
-
-		// Install it	
-		class NoPbRequestor extends Requestor {
-			public void acceptResult(EvaluationResult result) {
-				assertTrue("No problems with the variable", !result.hasProblems());
-			}
-		}
-		try {
-			context.evaluateVariables(getEnv(), getCompilerOptions(), new NoPbRequestor(), getProblemFactory());
-		} catch (InstallException e) {
-			assertTrue("No targetException " + e.getMessage(), false);
-		}
-
-		// Get its value
-		Requestor requestor = new Requestor();
-		try {
-			context.evaluateVariable(var, getEnv(), getCompilerOptions(), requestor, getProblemFactory());
-		} catch (InstallException e) {
-			assertTrue("No targetException " + e.getMessage(), false);
-		}
-		assertTrue("Got one result", requestor.resultIndex == 0);
-		EvaluationResult result = requestor.results[0];
-		assertTrue("Result has value", result.hasValue());
-		assertEquals("Value", "1".toCharArray(), result.getValueDisplayString());
-		assertEquals("Type", "int".toCharArray(), result.getValueTypeName());
-	} finally {
-		// Clean up
-		if (var != null) {
-			context.deleteVariable(var);
-		}
-	}
-}
-/**
- * Sanity test of IEvaluationContext.evaluateVariables(INameEnvironment, ConfigurableOption[], IRequestor, IProblemFactory)
- */
-public void testEvaluateVariables() {
-	GlobalVariable var = null;
-	try {
-		// Create 1 variable
-		var = context.newVariable("int".toCharArray(), "foo".toCharArray(), "1".toCharArray());
-
-		// Install it and get its value
-		Requestor requestor = new Requestor();
-		try {
-			context.evaluateVariables(getEnv(), getCompilerOptions(), requestor, getProblemFactory());
-		} catch (InstallException e) {
-			assertTrue("No targetException " + e.getMessage(), false);
-		}
-		assertTrue("Got one result", requestor.resultIndex == 0);
-		EvaluationResult result = requestor.results[0];
-		assertTrue("No problems with the variable", !result.hasProblems());
-		assertTrue("Result has value", result.hasValue());
-		assertEquals("Value", "1".toCharArray(), result.getValueDisplayString());
-		assertEquals("Type", "int".toCharArray(), result.getValueTypeName());
-	} finally {
-		// Clean up
-		if (var != null) {
-			context.deleteVariable(var);
-		}
-	}
-}
-/**
- * Sanity test of IEvaluationContext.getImports() and IEvaluationContext.setImports(char[][])
- */
-public void testGetSetImports() {
-	try {
-		// No imports
-		assertTrue("No imports defined", context.getImports().length == 0);
-
-		// Define some imports
-		char[][] imports = new char[][] {"java.util".toCharArray(), "java.lang.reflect.Method".toCharArray()};
-		context.setImports(imports);
-		char[][] storedImports = context.getImports();
-		assertEquals("Same length", imports.length, storedImports.length);
-		for (int i = 0; i < imports.length; i++){
-			assertEquals("Import #" + i, imports[i], storedImports[i]);
-		}
-	} finally {
-		// Clean up
-		context.setImports(new char[0][]);
-	}
-}
-/**
- * Sanity test of IEvaluationContext.getPackageName() and IEvaluationContext.setPackageName(char[])
- */
-public void testGetSetPackageName() {
-	try {
-		// Default package
-		assertTrue("Default package", context.getPackageName().length == 0);
-
-		// Define a package
-		char[] packageName = "x.y.z".toCharArray();
-		context.setPackageName(packageName);
-		char[] storedPackageName = context.getPackageName();
-		assertEquals("Same package name", packageName, storedPackageName);
-	} finally {
-		// Clean up
-		context.setPackageName(new char[0]);
-	}
-}
-/**
- * Sanity test of IEvaluationContext.newVariable(char[], char[], char[]) and
- * IEvaluationContext.deleteVariable(IGlobalVariable)
- */
-public void testNewDeleteVariable() {
-	// Define 1 variable
-	GlobalVariable var = context.newVariable("int".toCharArray(), "deleted".toCharArray(), null);
-
-	// Delete it
-	context.deleteVariable(var);
-	GlobalVariable[] vars = context.allVariables();
-	for (int i = 0; i < vars.length; i++) {
-		assertTrue("Variable should not exist", !var.getName().equals(vars[i].getName()));
-	}
-}
-}
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/eval/SanityTestEvaluationResult.java b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/eval/SanityTestEvaluationResult.java
deleted file mode 100644
index 82be84e..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/eval/SanityTestEvaluationResult.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *     IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.jsdt.core.tests.eval;
-
-import junit.framework.Test;
-
-import org.eclipse.wst.jsdt.core.compiler.CategorizedProblem;
-import org.eclipse.wst.jsdt.internal.eval.EvaluationResult;
-import org.eclipse.wst.jsdt.internal.eval.IRequestor;
-import org.eclipse.wst.jsdt.internal.eval.InstallException;
-/**
- * Sanity test the IEvaluationResult interface.
- * For in depth tests, see VariableTest or CodeSnippetTest.
- */
-public class SanityTestEvaluationResult extends EvaluationTest {
-	EvaluationResult result;
-/**
- * Creates a new SanityEvaluationResultTest.
- */
-public SanityTestEvaluationResult(String name) {
-	super(name);
-}
-/**
- * Initializes this test with an evaluation result coming from the
- * evaluation of the following code snippet: "return 1;".
- */
-protected void setUp() throws Exception {
-	super.setUp();
-	IRequestor requestor = new Requestor() {
-		public void acceptResult(EvaluationResult evalResult) {
-			SanityTestEvaluationResult.this.result = evalResult;
-		}
-	};
-	try {
-		this.context.evaluate("return 1;".toCharArray(), getEnv(), getCompilerOptions(), requestor, getProblemFactory());
-	} catch (InstallException e) {
-		throw new Error(e.getMessage());
-	}
-}
-public static Test suite() {
-	return setupSuite(testClass());
-}
-public static Class testClass() {
-	return SanityTestEvaluationResult.class;
-}
-/**
- * Sanity test of IEvaluationResult.getEvaluationType()
- */
-public void testGetEvaluationType() {
-	int evaluationType = result.getEvaluationType();
-	assertEquals("Evaluation type", EvaluationResult.T_CODE_SNIPPET, evaluationType);
-}
-/**
- * Sanity test of IEvaluationResult.getProblems()
- */
-public void testGetProblems() {
-	CategorizedProblem[] problems = result.getProblems();
-	assertTrue("Problems", problems == null || problems.length == 0);
-}
-/**
- * Sanity test of IEvaluationResult.getValue()
- */
-public void testGetValue() {
-	// TBD: Not implemented yet
-}
-/**
- * Sanity test of IEvaluationResult.getValueDisplayString()
- */
-public void testGetValueDisplayString() {
-	char[] displayString = this.result.getValueDisplayString();
-	assertEquals("Value display string", "1".toCharArray(), displayString);
-}
-/**
- * Sanity test of IEvaluationResult.getValueTypeName()
- */
-public void testGetValueTypeName() {
-	char[] typeName = this.result.getValueTypeName();
-	assertEquals("Value type name", "int".toCharArray(), typeName);
-}
-/**
- * Sanity test of IEvaluationResult.hasErrors()
- */
-public void testHasErrors() {
-	assertTrue("Result has no errors", !result.hasErrors());
-}
-/**
- * Sanity test of IEvaluationResult.hasProblems()
- */
-public void testHasProblems() {
-	assertTrue("Result has no problems", !result.hasProblems());
-}
-/**
- * Sanity test of IEvaluationResult.hasValue()
- */
-public void testHasValue() {
-	assertTrue("Result has a value", result.hasValue());
-}
-/**
- * Sanity test of IEvaluationResult.hasWarnings()
- */
-public void testHasWarnings() {
-	assertTrue("Result has no warnings", !result.hasWarnings());
-}
-}
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/eval/SimpleCodeSnippetTest.java b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/eval/SimpleCodeSnippetTest.java
deleted file mode 100644
index 02a068a..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/eval/SimpleCodeSnippetTest.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *     IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.jsdt.core.tests.eval;
-
-import org.eclipse.wst.jsdt.core.tests.runtime.TargetException;
-import org.eclipse.wst.jsdt.internal.compiler.env.INameEnvironment;
-import org.eclipse.wst.jsdt.internal.eval.InstallException;
-
-
-public class SimpleCodeSnippetTest
-    extends SimpleTest {
-    public char[] getCodeSnippetSource() {
-
-        return buildCharArray(new String[] { "1 + 1" });
-    }
-
-    public static void main(String[] args)
-                     throws TargetException, InstallException {
-
-        SimpleCodeSnippetTest test = new SimpleCodeSnippetTest();
-        test.runCodeSnippet();
-    }
-
-    void runCodeSnippet()
-                 throws TargetException, InstallException {
-        this.startEvaluationContext();
-
-        char[] snippet = getCodeSnippetSource();
-        INameEnvironment env = getEnv();
-        this.context.evaluate(snippet, env, null, this.requestor, 
-                              getProblemFactory());
-        this.stopEvaluationContext();
-    }
-}
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/eval/SimpleTest.java b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/eval/SimpleTest.java
deleted file mode 100644
index d55c7b9..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/eval/SimpleTest.java
+++ /dev/null
@@ -1,313 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *     IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.jsdt.core.tests.eval;
-
-import java.io.File;
-
-import org.eclipse.wst.jsdt.core.compiler.CategorizedProblem;
-import org.eclipse.wst.jsdt.core.tests.runtime.LocalVMLauncher;
-import org.eclipse.wst.jsdt.core.tests.runtime.LocalVirtualMachine;
-
-import org.eclipse.wst.jsdt.core.tests.runtime.TargetException;
-import org.eclipse.wst.jsdt.core.tests.runtime.TargetInterface;
-import org.eclipse.wst.jsdt.core.tests.util.Util;
-import org.eclipse.wst.jsdt.internal.compiler.ClassFile;
-import org.eclipse.wst.jsdt.internal.compiler.IProblemFactory;
-import org.eclipse.wst.jsdt.internal.compiler.batch.FileSystem;
-import org.eclipse.wst.jsdt.internal.compiler.classfmt.ClassFileReader;
-import org.eclipse.wst.jsdt.internal.compiler.classfmt.ClassFormatException;
-import org.eclipse.wst.jsdt.internal.compiler.env.IBinaryField;
-import org.eclipse.wst.jsdt.internal.compiler.env.INameEnvironment;
-import org.eclipse.wst.jsdt.internal.compiler.problem.DefaultProblem;
-import org.eclipse.wst.jsdt.internal.compiler.problem.DefaultProblemFactory;
-import org.eclipse.wst.jsdt.core.compiler.CharOperation;
-import org.eclipse.wst.jsdt.internal.eval.EvaluationContext;
-import org.eclipse.wst.jsdt.internal.eval.EvaluationResult;
-import org.eclipse.wst.jsdt.internal.eval.GlobalVariable;
-import org.eclipse.wst.jsdt.internal.eval.IRequestor;
-
-public class SimpleTest {
-	static final String JRE_PATH = Util.getJREDirectory();
-	static final String[] COMPILATION_CLASSPATH = Util.concatWithClassLibs(Util.getOutputDirectory(), false);
-	static final String[] RUNTIME_CLASSPATH =  new String[] {Util.getOutputDirectory()};
-	static final String TARGET_PATH = Util.getOutputDirectory() + File.separator + "evaluation";
-	protected EvaluationContext context;
-	protected LocalVirtualMachine launchedVM;
-	protected TargetInterface target;
-	protected Requestor requestor;
-
-	class Requestor implements IRequestor {
-		int globalProblemCount = 0;
-		public boolean acceptClassFiles(ClassFile[] classFiles, char[] codeSnippetClassName) {
-			try {
-				target.sendClasses(codeSnippetClassName != null, classFiles);
-			} catch (TargetException e) {
-				return false;
-			}
-			if (codeSnippetClassName != null) {
-				TargetInterface.Result result = target.getResult();
-				if (result.displayString == null) {
-					System.out.println("(No explicit return value)");
-				} else {
-					System.out.print("(");
-					System.out.print(result.typeName);
-					System.out.print(") ");
-					System.out.println(result.displayString);
-				}
-			} else {
-				for (int i = 0, length = classFiles.length; i < length; i++) {
-					char[][] compoundName = classFiles[i].getCompoundName();
-					if (new String(compoundName[compoundName.length-1]).startsWith("GlobalVariable")) {
-						try {
-							IBinaryField[] fields = new ClassFileReader(classFiles[i].getBytes(), null).getFields();
-							if (fields != null) {
-								for (int j = 0; j < fields.length; j++) {
-									TargetInterface.Result result = target.getResult();
-									if (result.displayString == null) {
-										System.out.println("(No explicit return value)");
-									} else {
-										System.out.print("(");
-										System.out.print(result.typeName);
-										System.out.print(") ");
-										System.out.println(result.displayString);
-									}
-								}
-							}
-						} catch (ClassFormatException e) {
-						}
-					}
-				}
-			} 
-			return true;
-		}
-		public void acceptProblem(CategorizedProblem problem, char[] fragmentSource, int fragmentKind) {
-			int localErrorCount = 0;
-			globalProblemCount++;
-			char[] source = fragmentSource;
-			if (localErrorCount == 0)
-				System.out.println("----------");
-			if (fragmentKind == EvaluationResult.T_INTERNAL) {
-				System.out.print(globalProblemCount + (problem.isError() ? ". INTERNAL ERROR" : ". INTERNAL WARNING"));
-				System.out.print(" in generated compilation unit");
-			} else {
-				System.out.print(globalProblemCount + (problem.isError() ? ". ERROR" : ". WARNING"));
-				System.out.print(" in ");
-				switch (fragmentKind) {
-					case EvaluationResult.T_PACKAGE:
-						System.out.print("package");
-						break;
-					case EvaluationResult.T_IMPORT:
-						System.out.print("import");
-						break;
-					case EvaluationResult.T_CODE_SNIPPET:
-						System.out.print("code snippet");
-						break;
-					case EvaluationResult.T_VARIABLE:
-						int line = problem.getSourceLineNumber();
-						if (line == -1) {
-							System.out.print("variable type");
-							source = findVar(fragmentSource).getTypeName();
-						} else if (line == 0) {
-							System.out.print("variable name");
-							source = findVar(fragmentSource).getName();
-						} else {
-							System.out.print("variable initializer");
-							source = findVar(fragmentSource).getInitializer();
-						}
-						break;
-				}
-			}
-			System.out.println(errorReportSource((DefaultProblem)problem, source));
-			System.out.println(problem.getMessage());
-			System.out.println("----------");
-			if (problem.isError())
-				localErrorCount++;
-		}
-	}
-/**
- * Build a char array from the given lines
- */
-protected char[] buildCharArray(String[] lines) {
-	StringBuffer buffer = new StringBuffer();
-	for (int i = 0; i < lines.length; i++) {
-		buffer.append(lines[i]);
-		if (i < lines.length -1) {
-			buffer.append("\n");
-		}
-	}
-	int length = buffer.length();
-	char[] result = new char[length];
-	buffer.getChars(0, length, result, 0);
-	return result;
-}
-protected String errorReportSource(DefaultProblem problem, char[] source) {
-	//extra from the source the innacurate     token
-	//and "highlight" it using some underneath ^^^^^
-	//put some context around too.
-
-	//this code assumes that the font used in the console is fixed size
-
-	//sanity .....
-	if ((problem.getSourceStart() > problem.getSourceEnd()) || ((problem.getSourceStart() < 0) && (problem.getSourceEnd() < 0)))
-		return "\n!! no source information available !!";
-
-	//regular behavior....(slow code)
-
-	final char SPACE = '\u0020';
-	final char MARK = '^';
-	final char TAB = '\t';
-	//the next code tries to underline the token.....
-	//it assumes (for a good display) that token source does not
-	//contain any \r \n. This is false on statements ! 
-	//(the code still works but the display is not optimal !)
-
-	//compute the how-much-char we are displaying around the inaccurate token
-	int begin = problem.getSourceStart() >= source.length ? source.length - 1 : problem.getSourceStart();
-	int relativeStart = 0;
-	int end = problem.getSourceEnd() >= source.length ? source.length - 1 : problem.getSourceEnd();
-	int relativeEnd = 0;
-	label : for (relativeStart = 0;; relativeStart++) {
-		if (begin == 0)
-			break label;
-		if ((source[begin - 1] == '\n') || (source[begin - 1] == '\r'))
-			break label;
-		begin--;
-	}
-	label : for (relativeEnd = 0;; relativeEnd++) {
-		if ((end + 1) >= source.length)
-			break label;
-		if ((source[end + 1] == '\r') || (source[end + 1] == '\n')) {
-			break label;
-		}
-		end++;
-	}
-	//extract the message form the source
-	char[] extract = new char[end - begin + 1];
-	System.arraycopy(source, begin, extract, 0, extract.length);
-	char c;
-	//remove all SPACE and TAB that begin the error message...
-	int trimLeftIndex = 0;
-	while (((c = extract[trimLeftIndex++]) == TAB) || (c == SPACE)) {
-	}
-	System.arraycopy(extract, trimLeftIndex - 1, extract = new char[extract.length - trimLeftIndex + 1], 0, extract.length);
-	relativeStart -= trimLeftIndex;
-	//buffer spaces and tabs in order to reach the error position
-	int pos = 0;
-	char[] underneath = new char[extract.length]; // can't be bigger
-	for (int i = 0; i <= relativeStart; i++) {
-		if (extract[i] == TAB) {
-			underneath[pos++] = TAB;
-		} else {
-			underneath[pos++] = SPACE;
-		}
-	}
-	//mark the error position
-	for (int i = problem.getSourceStart(); i <= (problem.getSourceEnd() >= source.length ? source.length - 1 : problem.getSourceEnd()); i++)
-		underneath[pos++] = MARK;
-	//resize underneathto remove 'null' chars
-	System.arraycopy(underneath, 0, underneath = new char[pos], 0, pos);
-	return 
-		((problem.getSourceLineNumber() > 0) ? 
-			(" (at line " + String.valueOf(problem.getSourceLineNumber()) + ")") :
-			""
-		) + 
-		"\n\t" + new String(extract) + "\n\t" + new String(underneath);
-}
-protected GlobalVariable findVar(char[] varName) {
-	GlobalVariable[] vars = this.context.allVariables();
-	for (int i = 0; i < vars.length; i++) {
-		GlobalVariable var = vars[i];
-		if (CharOperation.equals(var.getName(), varName)) {
-			return var;
-		}
-	}
-	return null;
-}
-protected INameEnvironment getEnv() {
-	
-	return new FileSystem(COMPILATION_CLASSPATH, new String[0], null);
-}
-protected IProblemFactory getProblemFactory() {
-	return new DefaultProblemFactory(java.util.Locale.getDefault());
-}
-protected void startEvaluationContext() throws TargetException {
-	LocalVMLauncher launcher = LocalVMLauncher.getLauncher();
-	launcher.setVMPath(JRE_PATH);
-	launcher.setClassPath(RUNTIME_CLASSPATH);
-	int evalPort = Util.getFreePort();
-	launcher.setEvalPort(evalPort);
-	launcher.setEvalTargetPath(TARGET_PATH);
-	this.launchedVM = launcher.launch();
-
-	(new Thread() {
-		public void run() {
-			try {
-				java.io.InputStream in = SimpleTest.this.launchedVM.getInputStream();
-				int read = 0;
-				while (read != -1) {
-					try {
-						read = in.read();
-					} catch (java.io.IOException e) {
-						read = -1;
-					}
-					if (read != -1) {
-						System.out.print((char)read);
-					}	
-				}
-			} catch (TargetException e) {
-			}
-		}
-	}).start();
-	
-	(new Thread() {
-		public void run() {
-			try {
-				java.io.InputStream in = SimpleTest.this.launchedVM.getErrorStream();
-				int read = 0;
-				while (read != -1) {
-					try {
-						read = in.read();
-					} catch (java.io.IOException e) {
-						read = -1;
-					}
-					if (read != -1) {
-						System.out.print((char)read);
-					}	
-				}
-			} catch (TargetException e) {
-			}
-		}
-	}).start();
-
-	this.requestor = new Requestor();
-	this.target = new TargetInterface();
-	this.target.connect("localhost", evalPort, 10000);
-	this.context = new EvaluationContext();
-}
-protected void stopEvaluationContext() {
-	try {
-		this.target.disconnect(); // Close the socket first so that the OS resource has a chance to be freed. 
-		int retry = 0;
-		while (this.launchedVM.isRunning() && (++retry < 20)) {
-			try {
-				Thread.sleep(retry * 100);
-			} catch (InterruptedException e) {
-			}
-		}
-		if (this.launchedVM.isRunning()) {
-			this.launchedVM.shutDown();
-		}
-		this.context = null;
-	} catch (TargetException e) {
-		throw new Error(e.getMessage());
-	}
-}
-}
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/eval/SimpleVariableTest.java b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/eval/SimpleVariableTest.java
deleted file mode 100644
index 8dbed11..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/eval/SimpleVariableTest.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *     IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.jsdt.core.tests.eval;
-
-import org.eclipse.wst.jsdt.core.tests.runtime.TargetException;
-import org.eclipse.wst.jsdt.internal.compiler.env.INameEnvironment;
-import org.eclipse.wst.jsdt.internal.eval.GlobalVariable;
-import org.eclipse.wst.jsdt.internal.eval.InstallException;
-
-public class SimpleVariableTest extends SimpleTest {
-void evaluateVariable() throws TargetException, InstallException {
-	startEvaluationContext();
-	GlobalVariable var = getVariable();
-	INameEnvironment env = getEnv();
-	this.context.evaluateVariables(env, null, this.requestor, getProblemFactory());
-	this.context.deleteVariable(var);
-	stopEvaluationContext();
-}
-public GlobalVariable getVariable() {
-	return this.context.newVariable(
-		"int".toCharArray(),
-		"var".toCharArray(),
-		"1".toCharArray());
-}
-public static void main(String[] args) throws TargetException, InstallException {
-	SimpleVariableTest test = new SimpleVariableTest();
-	test.evaluateVariable();
-}
-}
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/eval/TestAll.java b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/eval/TestAll.java
deleted file mode 100644
index b05428c..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/eval/TestAll.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *     IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.jsdt.core.tests.eval;
-
-import java.util.ArrayList;
-
-import org.eclipse.wst.jsdt.core.tests.util.AbstractCompilerTest;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-/**
- * Run all tests defined in this package.
- */
-public class TestAll extends EvaluationTest {
-public TestAll(String name) {
-	super(name);
-}
-public static Test suite() {
-	if (System.getProperty("os.name").indexOf("Linux") == -1) {//$NON-NLS-1$//$NON-NLS-2$
-		ArrayList testClasses = new ArrayList();
-		testClasses.add(SanityTestEvaluationContext.class);
-		testClasses.add(SanityTestEvaluationResult.class);
-		testClasses.add(VariableTest.class);
-		testClasses.add(CodeSnippetTest.class);
-		testClasses.add(NegativeCodeSnippetTest.class);
-		testClasses.add(NegativeVariableTest.class);
-//		testClasses.add(DebugEvaluationTest.class);
-		
-		return AbstractCompilerTest.buildAllCompliancesTestSuite(TestAll.class, EvaluationSetup.class, testClasses);
-	}
-	// Disable evaluation tests on Linux
-	return new TestSuite(TestAll.class.getName());
-}
-}
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/eval/VariableTest.java b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/eval/VariableTest.java
deleted file mode 100644
index 15dcf5b..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/eval/VariableTest.java
+++ /dev/null
@@ -1,295 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *     IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.jsdt.core.tests.eval;
-
-import junit.framework.Test;
-
-import org.eclipse.wst.jsdt.internal.eval.GlobalVariable;
-/**
- * Test the global variable evaluation.
- * This assumes that the EvaluationContext class and that the GlobalVariable class
- * are working correctly.
- */
-public class VariableTest extends EvaluationTest {
-/**
- * Creates a new EvaluationContextTest.
- */
-public VariableTest(String name) {
-	super(name);
-}
-public static Test suite() {
-	return setupSuite(testClass());
-}
-/**
- * Tests the individual evaluation of variables with expected values of all kind of types.
- */
-public void testAllKindOfValues() {
-	try {
-		// Creates the variables
-		GlobalVariable var1 = context.newVariable("int".toCharArray(), "var1".toCharArray(), "1".toCharArray());
-		GlobalVariable var2 = context.newVariable("boolean".toCharArray(), "var2".toCharArray(), "true".toCharArray());
-		GlobalVariable var3 = context.newVariable("char".toCharArray(), "var3".toCharArray(), "'c'".toCharArray());
-		GlobalVariable var4 = context.newVariable("float".toCharArray(), "var4".toCharArray(), "(float)1.0".toCharArray());
-		GlobalVariable var5 = context.newVariable("double".toCharArray(), "var5".toCharArray(), "1.0".toCharArray());
-		GlobalVariable var6 = context.newVariable("short".toCharArray(), "var6".toCharArray(), "(short)1".toCharArray());
-		GlobalVariable var7 = context.newVariable("long".toCharArray(), "var7".toCharArray(), "(long)1".toCharArray());
-		GlobalVariable var8 = context.newVariable("String".toCharArray(), "var8".toCharArray(), "\"hello\"".toCharArray());
-		GlobalVariable var9 = context.newVariable("Object".toCharArray(), "var9".toCharArray(), buildCharArray(new String[] {
-			"new Object() {", 
-			"	public String toString() {", 
-			"		return \"an object\";", 
-			"	}", 
-			"}"}));
-		GlobalVariable var10 = context.newVariable("Object".toCharArray(), "var10".toCharArray(), null);
-
-		// Install them
-		installVariables(10);
-
-		// Get values one by one
-		evaluateWithExpectedValue(var1, "1".toCharArray(), "int".toCharArray());
-		evaluateWithExpectedValue(var2, "true".toCharArray(), "boolean".toCharArray());
-		evaluateWithExpectedValue(var3, "c".toCharArray(), "char".toCharArray());
-		evaluateWithExpectedValue(var4, "1.0".toCharArray(), "float".toCharArray());
-		evaluateWithExpectedValue(var5, "1.0".toCharArray(), "double".toCharArray());
-		evaluateWithExpectedValue(var6, "1".toCharArray(), "short".toCharArray());
-		evaluateWithExpectedValue(var7, "1".toCharArray(), "long".toCharArray());
-		evaluateWithExpectedValue(var8, "hello".toCharArray(), "java.lang.String".toCharArray());
-		evaluateWithExpectedValue(var9, "an object".toCharArray(), "java.lang.Object".toCharArray());
-		evaluateWithExpectedValue(var10, "null".toCharArray(), "java.lang.Object".toCharArray());
-	} finally {
-		// Clean up
-		GlobalVariable[] vars = context.allVariables();
-		for (int i = 0; i < vars.length; i++) {
-			context.deleteVariable(vars[i]);
-		}
-	}
-}
-public static Class testClass() {
-	return VariableTest.class;
-}
-/**
- * Tests the assignment of a global variable in a code snippet.
- */
-public void testCodeSnippetVarAssign() {
-	try {
-		// Creates the variables
-		GlobalVariable var1 = context.newVariable("int".toCharArray(), "var1".toCharArray(), null);
-		GlobalVariable var2 = context.newVariable("boolean".toCharArray(), "var2".toCharArray(), null);
-		GlobalVariable var3 = context.newVariable("char".toCharArray(), "var3".toCharArray(), null);
-		GlobalVariable var4 = context.newVariable("float".toCharArray(), "var4".toCharArray(), null);
-		GlobalVariable var5 = context.newVariable("double".toCharArray(), "var5".toCharArray(), null);
-		GlobalVariable var6 = context.newVariable("short".toCharArray(), "var6".toCharArray(), null);
-		GlobalVariable var7 = context.newVariable("long".toCharArray(), "var7".toCharArray(), null);
-		GlobalVariable var8 = context.newVariable("String".toCharArray(), "var8".toCharArray(), null);
-		GlobalVariable var9 = context.newVariable("Object".toCharArray(), "var9".toCharArray(), null);
-		GlobalVariable var10 = context.newVariable("Object".toCharArray(), "var10".toCharArray(), null);
-
-		// Install them
-		installVariables(10);
-
-		// Assign each of the variable and get its value
-		evaluateWithExpectedDisplayString("var1 = 1;".toCharArray(), "1".toCharArray());
-		evaluateWithExpectedValue(var1, "1".toCharArray(), "int".toCharArray());
-		
-		evaluateWithExpectedDisplayString("var2 = true;".toCharArray(), "true".toCharArray());
-		evaluateWithExpectedValue(var2, "true".toCharArray(), "boolean".toCharArray());
-
-		evaluateWithExpectedDisplayString("var3 = 'c';".toCharArray(), "c".toCharArray());
-		evaluateWithExpectedValue(var3, "c".toCharArray(), "char".toCharArray());
-		
-		evaluateWithExpectedDisplayString("var4 = (float)1.0;".toCharArray(), "1.0".toCharArray());
-		evaluateWithExpectedValue(var4, "1.0".toCharArray(), "float".toCharArray());
-		
-		evaluateWithExpectedDisplayString("var5 = 1.0;".toCharArray(), "1.0".toCharArray());
-		evaluateWithExpectedValue(var5, "1.0".toCharArray(), "double".toCharArray());
-
-		evaluateWithExpectedDisplayString("var6 = (short)1;".toCharArray(), "1".toCharArray());
-		evaluateWithExpectedValue(var6, "1".toCharArray(), "short".toCharArray());
-		
-		evaluateWithExpectedDisplayString("var7 = (long)1;".toCharArray(), "1".toCharArray());
-		evaluateWithExpectedValue(var7, "1".toCharArray(), "long".toCharArray());
-		
-		evaluateWithExpectedDisplayString("var8 = \"hello\";".toCharArray(), "hello".toCharArray());
-		evaluateWithExpectedValue(var8, "hello".toCharArray(), "java.lang.String".toCharArray());
-		
-		evaluateWithExpectedDisplayString(buildCharArray(new String[] {
-			"var9 = new Object() {", 
-			"	public String toString() {", 
-			"		return \"an object\";", 
-			"	}", 
-			"};"}), "an object".toCharArray());
-		evaluateWithExpectedValue(var9, "an object".toCharArray(), "java.lang.Object".toCharArray());
-
-		evaluateWithExpectedDisplayString("var10 = null;".toCharArray(), "null".toCharArray());
-		evaluateWithExpectedValue(var10, "null".toCharArray(), "java.lang.Object".toCharArray());
-	} finally {
-		// Clean up
-		GlobalVariable[] vars = context.allVariables();
-		for (int i = 0; i < vars.length; i++) {
-			context.deleteVariable(vars[i]);
-		}
-	}
-}
-/**
- * Tests the retrieval of a global variable from a code snippet.
- */
-public void testCodeSnippetVarRetrieval() {
-	try {
-		// Creates the variables
-		GlobalVariable var1 = context.newVariable("int".toCharArray(), "var1".toCharArray(), "1".toCharArray());
-		GlobalVariable var2 = context.newVariable("boolean".toCharArray(), "var2".toCharArray(), "true".toCharArray());
-		GlobalVariable var3 = context.newVariable("char".toCharArray(), "var3".toCharArray(), "'c'".toCharArray());
-		GlobalVariable var4 = context.newVariable("float".toCharArray(), "var4".toCharArray(), "(float)1.0".toCharArray());
-		GlobalVariable var5 = context.newVariable("double".toCharArray(), "var5".toCharArray(), "1.0".toCharArray());
-		GlobalVariable var6 = context.newVariable("short".toCharArray(), "var6".toCharArray(), "(short)1".toCharArray());
-		GlobalVariable var7 = context.newVariable("long".toCharArray(), "var7".toCharArray(), "(long)1".toCharArray());
-		GlobalVariable var8 = context.newVariable("String".toCharArray(), "var8".toCharArray(), "\"hello\"".toCharArray());
-		GlobalVariable var9 = context.newVariable("Object".toCharArray(), "var9".toCharArray(), buildCharArray(new String[] {
-			"new Object() {", 
-			"	public String toString() {", 
-			"		return \"an object\";", 
-			"	}", 
-			"}"}));
-		GlobalVariable var10 = context.newVariable("Object".toCharArray(), "var10".toCharArray(), null);
-
-		// Install them
-		installVariables(10);
-
-		// Get values one by one
-		evaluateWithExpectedValue(var1, "1".toCharArray(), "int".toCharArray());
-		evaluateWithExpectedValue(var2, "true".toCharArray(), "boolean".toCharArray());
-		evaluateWithExpectedValue(var3, "c".toCharArray(), "char".toCharArray());
-		evaluateWithExpectedValue(var4, "1.0".toCharArray(), "float".toCharArray());
-		evaluateWithExpectedValue(var5, "1.0".toCharArray(), "double".toCharArray());
-		evaluateWithExpectedValue(var6, "1".toCharArray(), "short".toCharArray());
-		evaluateWithExpectedValue(var7, "1".toCharArray(), "long".toCharArray());
-		evaluateWithExpectedValue(var8, "hello".toCharArray(), "java.lang.String".toCharArray());
-		evaluateWithExpectedValue(var9, "an object".toCharArray(), "java.lang.Object".toCharArray());
-		evaluateWithExpectedValue(var10, "null".toCharArray(), "java.lang.Object".toCharArray());
-	} finally {
-		// Clean up
-		GlobalVariable[] vars = context.allVariables();
-		for (int i = 0; i < vars.length; i++) {
-			context.deleteVariable(vars[i]);
-		}
-	}
-}
-/**
- * Tests variables that include one or more imports.
- */
-public void testImports() {
-	try {
-		// import a package
-		context.setImports(new char[][] {"java.io.*".toCharArray()});
-		GlobalVariable file = context.newVariable("boolean".toCharArray(), "file".toCharArray(), "new File(\"!@#%\").exists()".toCharArray());
-		installVariables(1);
-		evaluateWithExpectedValue(file, "false".toCharArray(), "boolean".toCharArray());
-		context.deleteVariable(file);
-
-		// import a type
-		context.setImports(new char[][] {"java.math.BigInteger".toCharArray()});
-		GlobalVariable big = context.newVariable("BigInteger".toCharArray(), "big".toCharArray(), "new BigInteger(\"123456789012345678901234567890\")".toCharArray());
-		installVariables(1);
-		evaluateWithExpectedValue(big, "123456789012345678901234567890".toCharArray(), "java.math.BigInteger".toCharArray());
-		context.deleteVariable(big);
-
-		// import a type and a package
-		context.setImports(new char[][] {"java.util.Enumeration".toCharArray(), "java.lang.reflect.*".toCharArray()});
-		GlobalVariable fields = context.newVariable("Field[]".toCharArray(), "fields".toCharArray(), "Enumeration.class.getDeclaredFields()".toCharArray());
-		installVariables(1);
-		evaluateWithExpectedType("return fields;".toCharArray(), "[Ljava.lang.reflect.Field;".toCharArray());
-		context.deleteVariable(fields);
-	} finally {
-		// clean up
-		context.setImports(new char[0][]);
-	}
-}
-/**
- * Tests the additions and deletion of variables, installing them each time.
- */
-public void testSeveralVariableInstallations() {
-	try {
-		// Creates 6 variables
-		GlobalVariable var1 = context.newVariable("int".toCharArray(), "var1".toCharArray(), "1".toCharArray());
-		GlobalVariable var2 = context.newVariable("boolean".toCharArray(), "var2".toCharArray(), "true".toCharArray());
-		GlobalVariable var3 = context.newVariable("char".toCharArray(), "var3".toCharArray(), "'c'".toCharArray());
-		GlobalVariable var4 = context.newVariable("float".toCharArray(), "var4".toCharArray(), "(float)1.0".toCharArray());
-		GlobalVariable var5 = context.newVariable("double".toCharArray(), "var5".toCharArray(), "1.0".toCharArray());
-		GlobalVariable var6 = context.newVariable("short".toCharArray(), "var6".toCharArray(), "(short)1".toCharArray());
-
-		// Install the variables
-		installVariables(6);
-
-		// Get their values
-		evaluateWithExpectedValue(var1, "1".toCharArray(), "int".toCharArray());
-		evaluateWithExpectedValue(var2, "true".toCharArray(), "boolean".toCharArray());
-		evaluateWithExpectedValue(var3, "c".toCharArray(), "char".toCharArray());
-		evaluateWithExpectedValue(var4, "1.0".toCharArray(), "float".toCharArray());
-		evaluateWithExpectedValue(var5, "1.0".toCharArray(), "double".toCharArray());
-		evaluateWithExpectedValue(var6, "1".toCharArray(), "short".toCharArray());
-
-		// Delete 3 variables
-		context.deleteVariable(var2);
-		context.deleteVariable(var5);
-		context.deleteVariable(var6);
-		
-		// Install the variables
-		installVariables(3);
-
-		// Get their values
-		evaluateWithExpectedValue(var1, "1".toCharArray(), "int".toCharArray());
-		evaluateWithExpectedValue(var3, "c".toCharArray(), "char".toCharArray());
-		evaluateWithExpectedValue(var4, "1.0".toCharArray(), "float".toCharArray());
-
-		// Add 4 more variables
-		GlobalVariable var7 = context.newVariable("long".toCharArray(), "var7".toCharArray(), "(long)1".toCharArray());
-		GlobalVariable var8 = context.newVariable("String".toCharArray(), "var8".toCharArray(), "\"hello\"".toCharArray());
-		GlobalVariable var9 = context.newVariable("Object".toCharArray(), "var9".toCharArray(), buildCharArray(new String[] {
-			"new Object() {", 
-			"	public String toString() {", 
-			"		return \"an object\";", 
-			"	}", 
-			"}"}));
-		GlobalVariable var10 = context.newVariable("Object".toCharArray(), "var10".toCharArray(), null);
-
-		// Install the variables
-		installVariables(7);
-
-		// Change value of a variable using a code snippet and move it
-		evaluateWithExpectedValue("var3 = 'z'; return var3;".toCharArray(), "z".toCharArray(), "char".toCharArray());
-		context.deleteVariable(var3);
-
-		// Change the type of another variable to an incompatible type
-		context.deleteVariable(var4);
-		installVariables(5);
-
-		// Recreate the variables
-		var3 = context.newVariable(var3.getTypeName(), var3.getName(), var3.getInitializer());
-		var4 = context.newVariable("java.net.URL".toCharArray(), "var4".toCharArray(), "new java.net.URL(\"http://www.ibm.com/index.html\")".toCharArray());
-		installVariables(7);
-
-		// Get their values
-		evaluateWithExpectedValue(var1, "1".toCharArray(), "int".toCharArray());
-		evaluateWithExpectedValue(var3, "c".toCharArray(), "char".toCharArray());
-		evaluateWithExpectedValue(var4, "http://www.ibm.com/index.html".toCharArray(), "java.net.URL".toCharArray());
-		evaluateWithExpectedValue(var7, "1".toCharArray(), "long".toCharArray());
-		evaluateWithExpectedValue(var8, "hello".toCharArray(), "java.lang.String".toCharArray());
-		evaluateWithExpectedValue(var9, "an object".toCharArray(), "java.lang.Object".toCharArray());
-		evaluateWithExpectedValue(var10, "null".toCharArray(), "java.lang.Object".toCharArray());
-	} finally {
-		// Clean up
-		GlobalVariable[] vars = context.allVariables();
-		for (int i = 0; i < vars.length; i++) {
-			context.deleteVariable(vars[i]);
-		}
-	}
-}
-}
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/runtime/TargetInterface.java b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/runtime/TargetInterface.java
index e441613..24cfba3 100644
--- a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/runtime/TargetInterface.java
+++ b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/runtime/TargetInterface.java
@@ -10,9 +10,10 @@
  *******************************************************************************/
 package org.eclipse.wst.jsdt.core.tests.runtime;
 
-import org.eclipse.wst.jsdt.internal.compiler.ClassFile;
-import java.io.*;
-import java.net.*;
+import java.io.DataInputStream;
+import java.io.IOException;
+import java.net.Socket;
+import java.net.UnknownHostException;
 /**
  * This is the interface to the target VM. It connects to an IDEInterface on the target side 
  * using TCP/IO to send request for code snippet evaluation and to get the result back.
@@ -143,49 +144,5 @@
 /**
  * Sends the given class definitions to the target for loading and (if specified) for running.
  */
-public void sendClasses(boolean mustRun, ClassFile[] classes) throws TargetException {
-	if (DEBUG) {
-		for (int i = 0; i < classes.length; i++) {
-			String className = new String(classes[i].fileName()).replace('/', '\\') + ".class";
-			if ((i == 0) && (className.indexOf("CodeSnippet") != -1)) {
-				codeSnippetClassName = className;
-				try {
-					ClassFile.writeToDisk(true, "d:\\eval\\snippets", className, classes[0]);
-				} catch(IOException e) {
-				}
-			} else {
-				String dirName;
-				if (className.startsWith("java")) {
-					dirName = "d:\\eval\\" + LocalVMLauncher.BOOT_CLASSPATH_DIRECTORY;
-				} else {
-					dirName = "d:\\eval\\" + LocalVMLauncher.REGULAR_CLASSPATH_DIRECTORY;
-				}
-				try {
-					ClassFile.writeToDisk(true, dirName, className, classes[i]);
-				} catch(IOException e) {
-				}
-			}
-		}
-	} else {
-		if (TIMING) {
-			this.sentTime = System.currentTimeMillis();
-		}
-		if (!isConnected()) {
-			throw new TargetException("Connection to the target VM has been lost");
-		}
-		try {
-			DataOutputStream out = new DataOutputStream(this.socket.getOutputStream());
-			out.writeBoolean(mustRun);
-			out.writeInt(classes.length);
-			for (int i = 0; i < classes.length; i++) {
-				byte[] classDefinition = classes[i].getBytes();
-				out.writeInt(classDefinition.length);
-				out.write(classDefinition);
-			}
-		} catch (IOException e) {
-			// The socket has likely been closed on the other end. So the code snippet runner has stopped.
-			this.disconnect();
-		}
-	}
-}
+
 }
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/RunCompilerTests.java b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/RunCompilerTests.java
index e3e63d8..57434c9 100644
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/RunCompilerTests.java
+++ b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/RunCompilerTests.java
@@ -31,7 +31,7 @@
 	return new Class[] {
 		org.eclipse.wst.jsdt.core.tests.compiler.regression.TestAll.class,
 		org.eclipse.wst.jsdt.core.tests.compiler.parser.TestAll.class,
-		org.eclipse.wst.jsdt.core.tests.eval.TestAll.class,
+//		org.eclipse.wst.jsdt.core.tests.eval.TestAll.class,
 	};
 }
 public static Test suite() {
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/AttachSourceTests.java b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/AttachSourceTests.java
index 79d192c..481e8f8 100644
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/AttachSourceTests.java
+++ b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/AttachSourceTests.java
@@ -13,17 +13,28 @@
 import java.io.IOException;
 
 import junit.framework.Test;
+
 import org.eclipse.core.resources.IFile;
 import org.eclipse.core.resources.IProject;
 import org.eclipse.core.resources.IncrementalProjectBuilder;
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IPath;
 import org.eclipse.core.runtime.Path;
-import org.eclipse.wst.jsdt.core.*;
-import org.eclipse.wst.jsdt.core.dom.*;
-import org.eclipse.wst.jsdt.internal.compiler.classfmt.ClassFileConstants;
+import org.eclipse.wst.jsdt.core.IClassFile;
+import org.eclipse.wst.jsdt.core.IJavaElement;
+import org.eclipse.wst.jsdt.core.IJavaProject;
+import org.eclipse.wst.jsdt.core.IMember;
+import org.eclipse.wst.jsdt.core.IMethod;
+import org.eclipse.wst.jsdt.core.IPackageFragment;
+import org.eclipse.wst.jsdt.core.IPackageFragmentRoot;
+import org.eclipse.wst.jsdt.core.ISourceRange;
+import org.eclipse.wst.jsdt.core.IType;
+import org.eclipse.wst.jsdt.core.JavaCore;
+import org.eclipse.wst.jsdt.core.JavaModelException;
+import org.eclipse.wst.jsdt.core.dom.AST;
+import org.eclipse.wst.jsdt.core.dom.ASTNode;
+import org.eclipse.wst.jsdt.core.dom.ASTParser;
 import org.eclipse.wst.jsdt.internal.core.JarPackageFragmentRoot;
-import org.eclipse.wst.jsdt.internal.core.util.Util;
 
 /**
  * TO DO:
@@ -956,35 +967,35 @@
 	this.attachSource(root, null, null); // detach source
 	root.close();
 }
-/**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=35965
- */
-public void testRootPath11() throws JavaModelException {
-	IJavaProject project = this.getJavaProject("/AttachSourceTests");
-	IPackageFragmentRoot root = project.getPackageFragmentRoot(this.getFile("/AttachSourceTests/test4.jar"));
-	this.attachSource(root, "/AttachSourceTests/test4_src.zip", null);
-	
-	IClassFile cf = root.getPackageFragment("P1").getClassFile("D.class");
-	assertSourceEquals(
-		"Unexpected source for class file P1.D",
-		"package P1;\n" +
-		"\n" +
-		"public class D {}",
-		cf.getSource());
-
-	cf = root.getPackageFragment("P1.p2").getClassFile("A.class");
-	assertSourceEquals(
-		"Unexpected source for class file P1.p2.A",
-		"package P1.p2;\n" +
-		"\n" +
-		"public class A {}",
-		cf.getSource());	
-
-	assertTrue("Not a binary root", root.getKind() == IPackageFragmentRoot.K_BINARY);
-	assertEquals("wrong jdk level", ClassFileConstants.JDK1_2, Util.getJdkLevel(root.getResource()));
-	this.attachSource(root, null, null); // detach source
-	root.close();
-}
+///**
+// * http://bugs.eclipse.org/bugs/show_bug.cgi?id=35965
+// */
+//public void testRootPath11() throws JavaModelException {
+//	IJavaProject project = this.getJavaProject("/AttachSourceTests");
+//	IPackageFragmentRoot root = project.getPackageFragmentRoot(this.getFile("/AttachSourceTests/test4.jar"));
+//	this.attachSource(root, "/AttachSourceTests/test4_src.zip", null);
+//	
+//	IClassFile cf = root.getPackageFragment("P1").getClassFile("D.class");
+//	assertSourceEquals(
+//		"Unexpected source for class file P1.D",
+//		"package P1;\n" +
+//		"\n" +
+//		"public class D {}",
+//		cf.getSource());
+//
+//	cf = root.getPackageFragment("P1.p2").getClassFile("A.class");
+//	assertSourceEquals(
+//		"Unexpected source for class file P1.p2.A",
+//		"package P1.p2;\n" +
+//		"\n" +
+//		"public class A {}",
+//		cf.getSource());	
+//
+//	assertTrue("Not a binary root", root.getKind() == IPackageFragmentRoot.K_BINARY);
+//	assertEquals("wrong jdk level", ClassFileConstants.JDK1_2, Util.getJdkLevel(root.getResource()));
+//	this.attachSource(root, null, null); // detach source
+//	root.close();
+//}
 /**
  * Attach a jar with a source attachement that is itself. The jar contains 2 root paths for the same class file.
  * (regression test for bug 74014 prefix path for source attachements - automatic detection does not seem to work)
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/JavaProjectTests.java b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/JavaProjectTests.java
index 478bbe9..fdd6b3a 100644
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/JavaProjectTests.java
+++ b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/JavaProjectTests.java
@@ -16,18 +16,38 @@
 import junit.framework.Test;
 import junit.framework.TestSuite;
 
-import org.eclipse.core.resources.*;
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.IWorkspaceDescription;
+import org.eclipse.core.resources.IWorkspaceRunnable;
+import org.eclipse.core.resources.IncrementalProjectBuilder;
+import org.eclipse.core.resources.ResourcesPlugin;
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IPath;
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.Path;
 import org.eclipse.core.runtime.preferences.IEclipsePreferences;
-import org.eclipse.wst.jsdt.core.*;
-import org.eclipse.wst.jsdt.internal.compiler.classfmt.ClassFileConstants;
+import org.eclipse.wst.jsdt.core.IAccessRule;
+import org.eclipse.wst.jsdt.core.IClassFile;
+import org.eclipse.wst.jsdt.core.IClasspathAttribute;
+import org.eclipse.wst.jsdt.core.IClasspathEntry;
+import org.eclipse.wst.jsdt.core.ICompilationUnit;
+import org.eclipse.wst.jsdt.core.IJavaElement;
+import org.eclipse.wst.jsdt.core.IJavaModelStatusConstants;
+import org.eclipse.wst.jsdt.core.IJavaProject;
+import org.eclipse.wst.jsdt.core.IMethod;
+import org.eclipse.wst.jsdt.core.IPackageFragment;
+import org.eclipse.wst.jsdt.core.IPackageFragmentRoot;
+import org.eclipse.wst.jsdt.core.IType;
+import org.eclipse.wst.jsdt.core.JavaCore;
+import org.eclipse.wst.jsdt.core.JavaModelException;
 import org.eclipse.wst.jsdt.internal.core.JavaModelManager;
 import org.eclipse.wst.jsdt.internal.core.UserLibrary;
 import org.eclipse.wst.jsdt.internal.core.UserLibraryManager;
-import org.eclipse.wst.jsdt.internal.core.util.Util;
 
 public class JavaProjectTests extends ModifyingResourceTests {
 public JavaProjectTests(String name) {
@@ -1180,14 +1200,14 @@
 	IResource corr= methods[0].getCorrespondingResource();
 	assertTrue("incorrect corresponding resource", corr == null);
 }
-/**
- * Test the jdklevel of the package fragment root
- */
-public void testJdkLevelRoot() throws JavaModelException {
-	IPackageFragmentRoot root= getPackageFragmentRoot("JavaProjectLibTests", "lib/");
-	assertEquals("wrong type", IPackageFragmentRoot.K_BINARY, root.getKind());
-	assertEquals("wrong jdk level", ClassFileConstants.JDK1_1, Util.getJdkLevel(root.getResource()));
-}
+///**
+// * Test the jdklevel of the package fragment root
+// */
+//public void testJdkLevelRoot() throws JavaModelException {
+//	IPackageFragmentRoot root= getPackageFragmentRoot("JavaProjectLibTests", "lib/");
+//	assertEquals("wrong type", IPackageFragmentRoot.K_BINARY, root.getKind());
+//	assertEquals("wrong jdk level", ClassFileConstants.JDK1_1, Util.getJdkLevel(root.getResource()));
+//}
 /**
  * Test User Library preference. External jar file referenced in library entry does not exist.
  * It does not need to as we only test the preference value...
