add support for internal file import
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 03a600f..a32b990 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
@@ -400,6 +400,13 @@
 		this.classpaths = classPaths == null ? getDefaultClassPaths() : classPaths;
 		return new InMemoryNameEnvironment(testFiles, getClassLibs());
 	}
+
+	protected INameEnvironment getNameEnvironment(final String[] testFiles, String [] files, String[] classPaths) {
+		this.classpaths = classPaths == null ? getDefaultClassPaths() : classPaths;
+		InMemoryNameEnvironment inMemoryNameEnvironment = new InMemoryNameEnvironment(testFiles, getClassLibs());
+		return inMemoryNameEnvironment;
+	}
+
 	protected IProblemFactory getProblemFactory() {
 		return new DefaultProblemFactory(Locale.getDefault());
 	}
@@ -958,7 +965,8 @@
 			false /* do not show category */, 
 			false /* do not show warning token */, 
 			false  /* do not skip javac for this peculiar test */,
-			false  /* do not perform statements recovery */);
+			false  /* do not perform statements recovery */,
+			null);
 	}
 	/**
 	 * Log contains all problems (warnings+errors)
@@ -978,7 +986,8 @@
 			false /* do not show category */, 
 			false /* do not show warning token */, 
 			false  /* do not skip javac for this peculiar test */,
-			false  /* do not perform statements recovery */);
+			false  /* do not perform statements recovery */,
+			null);
 	} 
 	/**
 	 * Log contains all problems (warnings+errors)
@@ -999,7 +1008,8 @@
 			false /* do not show category */, 
 			false /* do not show warning token */, 
 			false  /* do not skip javac for this peculiar test */,
-			false  /* do not perform statements recovery */);
+			false  /* do not perform statements recovery */,
+			null);
 	}
 	/**
 	 * Log contains all problems (warnings+errors)
@@ -1023,7 +1033,8 @@
 		  showCategory,
 		  showWarningToken,
 		  false  /* do not skip javac for this peculiar test */,
-		  false  /* do not perform statements recovery */);
+		  false  /* do not perform statements recovery */,
+		  null);
 	}
 	 
 	/**
@@ -1039,12 +1050,16 @@
 		boolean showCategory,
 		boolean showWarningToken,
 		boolean skipJavac,
-		boolean performStatementsRecovery) {
+		boolean performStatementsRecovery,
+		String[] otherFiles 
+		) {
 		// Non-javac part
 		try {
 			if (shouldFlushOutputDirectory)
 				Util.flushDirectoryContent(new File(OUTPUT_DIR));
 	
+			if (otherFiles==null)
+				otherFiles = new String[]{};
 			IProblemFactory problemFactory = getProblemFactory();
 			Requestor requestor = 
 				new Requestor(
@@ -1063,7 +1078,7 @@
 			compilerOptions.performStatementsRecovery = performStatementsRecovery;
 			Compiler batchCompiler = 
 				new Compiler(
-					getNameEnvironment(new String[]{}, classLib), 
+					getNameEnvironment(otherFiles, classLib), 
 					getErrorHandlingPolicy(), 
 					compilerOptions,
 					requestor, 
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/ExternalizeStringLiteralsTest.java b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/ExternalizeStringLiteralsTest.java
index e274273..cf068ef 100644
--- a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/ExternalizeStringLiteralsTest.java
+++ b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/ExternalizeStringLiteralsTest.java
@@ -506,7 +506,8 @@
 		false,
 		false,
 		false,
-		true);	
+		true,
+		null);	
 }
 public static Class testClass() {
 	return ExternalizeStringLiteralsTest.class;
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/GenericTypeTest.java b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/GenericTypeTest.java
index 7840848..5b50c50 100644
--- a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/GenericTypeTest.java
+++ b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/GenericTypeTest.java
@@ -34599,7 +34599,8 @@
 		false /* do not show category */, 
 		false /* do not show warning token */, 
 		false  /* do not skip javac for this peculiar test */,
-		false  /* do not perform statements recovery */);
+		false  /* do not perform statements recovery */,
+		null);
 }
 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=167268
 public void test1094() {
@@ -34680,7 +34681,8 @@
 		false /* do not show category */, 
 		false /* do not show warning token */, 
 		false  /* do not skip javac for this peculiar test */,
-		false  /* do not perform statements recovery */);
+		false  /* do not perform statements recovery */,
+		null);
 }
 //https://bugs.eclipse.org/bugs/show_bug.cgi?id=167952
 //invalid bug - regression test only
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/InMemoryNameEnvironment.java b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/InMemoryNameEnvironment.java
index 467f5f3..d8389d7 100644
--- a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/InMemoryNameEnvironment.java
+++ b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/InMemoryNameEnvironment.java
@@ -31,7 +31,7 @@
 			dirName = fileName.substring(0, lastSlash);
 		}
 		char[] packageName = dirName.replace('/', '.').toCharArray();
-		char[] cuName = fileName.substring(lastSlash == -1 ? 0 : lastSlash + 1, fileName.length() - 5).toCharArray(); // remove ".java"
+		char[] cuName = fileName.substring(lastSlash == -1 ? 0 : lastSlash + 1, fileName.length() - 3).toCharArray(); // remove ".java"
 		HashtableOfObject cus = (HashtableOfObject)this.compilationUnits.get(packageName);
 		if (cus == null) {
 			cus = new HashtableOfObject();
@@ -47,15 +47,28 @@
 		CharOperation.subarray(compoundTypeName, 0, compoundTypeName.length - 1),requestor);
 }
 public NameEnvironmentAnswer findBinding(char[] typeName, char[][] packageName, int type, ITypeRequestor requestor, boolean returnMultiple, String excludePath) {
-	HashtableOfObject cus = (HashtableOfObject)this.compilationUnits.get(CharOperation.concatWith(packageName, '.'));
-	if (cus == null) {
+  if ((type&Binding.COMPILATION_UNIT)!=0)
+  {
+			HashtableOfObject cus = (HashtableOfObject)this.compilationUnits.get(CharOperation.concatWith(packageName, '.'));
+			if (cus!=null)
+			{
+				CompilationUnit unit = (CompilationUnit)cus.get(typeName);
+				unit.packageName=packageName;
+				if (unit != null) 
+					return new NameEnvironmentAnswer(unit, null /*no access restriction*/);
+				
+			}
+  }
+	
+	//	HashtableOfObject cus = (HashtableOfObject)this.compilationUnits.get(CharOperation.concatWith(packageName, '.'));
+//	if (cus == null) {
 		return this.findTypeFromClassLibs(typeName, packageName,type,requestor);
-	}
-	CompilationUnit unit = (CompilationUnit)cus.get(typeName);
-	if (unit == null) {
-		return this.findTypeFromClassLibs(typeName, packageName,type,requestor);
-	}
-	return new NameEnvironmentAnswer(unit, null /*no access restriction*/);
+//	}
+//	CompilationUnit unit = (CompilationUnit)cus.get(typeName);
+//	if (unit == null) {
+//		return this.findTypeFromClassLibs(typeName, packageName,type,requestor);
+//	}
+//	return new NameEnvironmentAnswer(unit, null /*no access restriction*/);
 }
 
 public NameEnvironmentAnswer findType(char[] typeName, char[][] packageName, ITypeRequestor requestor) {
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 febe824..a4f043b 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
@@ -72,7 +72,8 @@
 		false /* do not show category */, 
 		false /* do not show warning token */, 
 		false  /* do not skip javac for this peculiar test */,
-		false  /* do not perform statements recovery */);
+		false  /* do not perform statements recovery */,
+		null);
 //	ClassFileReader reader = this.getClassFileReader(OUTPUT_DIR + File.separator  +"X$W.class", "X$W");
 //	IBinaryMethod[] methods = reader.getMethods();
 //	assertEquals("Wrong size", 2, methods.length);
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/util/Util.java b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/util/Util.java
index 1a0701c..56bedab 100644
--- a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/util/Util.java
+++ b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/util/Util.java
@@ -24,6 +24,7 @@
 import org.eclipse.core.runtime.Path;
 import org.eclipse.core.runtime.Platform;
 import org.eclipse.wst.jsdt.core.JavaCore;
+import org.eclipse.wst.jsdt.core.compiler.CharOperation;
 import org.eclipse.wst.jsdt.core.compiler.IProblem;
 import org.eclipse.wst.jsdt.core.compiler.libraries.SystemLibraryLocation;
 import org.eclipse.wst.jsdt.core.tests.compiler.regression.Requestor;
@@ -148,7 +149,15 @@
 	CompilationUnit[] result = new CompilationUnit[length];
 	int index = 0;
 	for (int i = 0; i < length; i++) {
-		result[i] = new CompilationUnit(testFiles[index + 1].toCharArray(), testFiles[index], null);
+		String fileName = testFiles[index];
+		result[i] = new CompilationUnit(testFiles[index + 1].toCharArray(), fileName, null);
+		char [] fileNameChars=fileName.toCharArray();
+		int lastIndexOf = CharOperation.lastIndexOf('/', fileNameChars);
+		if (lastIndexOf>=0)
+		{
+			char[] subarray = CharOperation.subarray(fileNameChars, 0, lastIndexOf);
+			result[i].packageName=CharOperation.splitOn('/', subarray);
+		}
 		index += 2;
 	}
 	return result;