Bug 542090 - FilerException: Source file already created

Rollback the changes to report filer exception if the file already
exists.

Change-Id: I95bc355283dfdfe8a994956bc1a352d47ca6ca2a
Signed-off-by: jay <jarthana@in.ibm.com>
diff --git a/org.eclipse.jdt.apt.pluggable.core/src/org/eclipse/jdt/internal/apt/pluggable/core/filer/IdeFilerImpl.java b/org.eclipse.jdt.apt.pluggable.core/src/org/eclipse/jdt/internal/apt/pluggable/core/filer/IdeFilerImpl.java
index 4f6fa75..c066133 100644
--- a/org.eclipse.jdt.apt.pluggable.core/src/org/eclipse/jdt/internal/apt/pluggable/core/filer/IdeFilerImpl.java
+++ b/org.eclipse.jdt.apt.pluggable.core/src/org/eclipse/jdt/internal/apt/pluggable/core/filer/IdeFilerImpl.java
@@ -39,13 +39,9 @@
 import org.eclipse.jdt.apt.core.internal.AptCompilationParticipant;
 import org.eclipse.jdt.apt.core.internal.generatedfile.GeneratedSourceFolderManager;
 import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.core.compiler.CharOperation;
 import org.eclipse.jdt.internal.apt.pluggable.core.Apt6Plugin;
 import org.eclipse.jdt.internal.apt.pluggable.core.dispatch.IdeAnnotationProcessorManager;
 import org.eclipse.jdt.internal.apt.pluggable.core.dispatch.IdeProcessingEnvImpl;
-import org.eclipse.jdt.internal.compiler.lookup.ModuleBinding;
-import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding;
-import org.eclipse.jdt.internal.compiler.lookup.TagBits;
 
 /**
  * Implementation of the Filer interface that is used in IDE mode.
@@ -54,12 +50,12 @@
  */
 public class IdeFilerImpl implements Filer {
 	
-	private final IdeAnnotationProcessorManager _dispatchManager;
+	//private final IdeAnnotationProcessorManager _dispatchManager;
 	private final IdeProcessingEnvImpl _env;
 
 	public IdeFilerImpl(IdeAnnotationProcessorManager dispatchManager,
 			IdeProcessingEnvImpl env) {
-		_dispatchManager = dispatchManager;
+		//_dispatchManager = dispatchManager;
 		_env = env;
 	}
 
@@ -167,22 +163,22 @@
 		// TODO: is the following correct?
 		// JDK 9's createSourceFile API mentions '/' as separator for a module prefix. 
 		// Otherwise shouldn't <code>name</code> already be "."-separated?
-		name = name.toString().replace('/', '.');
-		
-		ModuleBinding m = _env._current_module;
-		if (m == null)
-			m = _env.getCompiler().lookupEnvironment.UnNamedModule;
-		ReferenceBinding type = m.environment.getType(CharOperation.splitOn('.', name.toString().toCharArray()), m);
-		if (type != null && (type.tagBits & TagBits.HasMissingType) == 0) {
-			IFile classFile = getFileFromOutputLocation(StandardLocation.CLASS_OUTPUT, CharOperation.toString(type.fPackage.compoundName), new String(type.sourceName()) + ".class");
-			String fileName = new String(type.getFileName());
-			if (fileName != null) {
-				String osString = classFile.getFullPath().toOSString();
-				if (!osString.equals(fileName) || !_dispatchManager._isFirstRound) {
-					throw new FilerException("Source file already exists : " + name); //$NON-NLS-1$
-				}
-			}
-		}
+//		name = name.toString().replace('/', '.');
+//		
+//		ModuleBinding m = _env._current_module;
+//		if (m == null)
+//			m = _env.getCompiler().lookupEnvironment.UnNamedModule;
+//		ReferenceBinding type = m.environment.getType(CharOperation.splitOn('.', name.toString().toCharArray()), m);
+//		if (type != null && (type.tagBits & TagBits.HasMissingType) == 0) {
+//			IFile classFile = getFileFromOutputLocation(StandardLocation.CLASS_OUTPUT, CharOperation.toString(type.fPackage.compoundName), new String(type.sourceName()) + ".class");
+//			String fileName = new String(type.getFileName());
+//			if (fileName != null) {
+//				String osString = classFile.getFullPath().toOSString();
+//				if (!osString.equals(fileName)) {
+//					throw new FilerException("Source file already exists : " + name); //$NON-NLS-1$
+//				}
+//			}
+//		}
 		Set<IFile> parentFiles = Collections.emptySet();
 		if (originatingElements != null && originatingElements.length > 0) {
 			parentFiles = new HashSet<IFile>(originatingElements.length);
diff --git a/org.eclipse.jdt.apt.pluggable.tests/src/org/eclipse/jdt/apt/pluggable/tests/FilerTests.java b/org.eclipse.jdt.apt.pluggable.tests/src/org/eclipse/jdt/apt/pluggable/tests/FilerTests.java
index 2d8659d..48e9511 100644
--- a/org.eclipse.jdt.apt.pluggable.tests/src/org/eclipse/jdt/apt/pluggable/tests/FilerTests.java
+++ b/org.eclipse.jdt.apt.pluggable.tests/src/org/eclipse/jdt/apt/pluggable/tests/FilerTests.java
@@ -360,7 +360,7 @@
 		assertTrue("Processor did not run", ProcessorTestStatus.processorRan());
 		assertEquals("Processor reported errors", ProcessorTestStatus.NO_ERRORS, ProcessorTestStatus.getErrors());
 	}
-	public void testBug534979() throws Throwable {
+	public void _testBug534979() throws Throwable {
 		ProcessorTestStatus.reset();
 		IJavaProject jproj = createJavaProject(_projectName);
 		disableJava5Factories(jproj);
@@ -380,7 +380,7 @@
 		assertEquals("Processor reported errors", "FilerException invoking test method testBug534979 - see console for details", ProcessorTestStatus.getErrors());
 	}
 
-	public void testCollisionInOtherModule() throws Throwable {
+	public void _testCollisionInOtherModule() throws Throwable {
 		if (!canRunJava9()) {
 			return;
 		}
@@ -404,7 +404,7 @@
 		fullBuild();
 		assertEquals("Processor reported errors", "FilerException invoking test method testBug534979 - see console for details", ProcessorTestStatus.getErrors());
 	}
-	public void testCollisionWithClassThatTriggers() throws Throwable {
+	public void _testCollisionWithClassThatTriggers() throws Throwable {
 		if (!canRunJava9()) {
 			return;
 		}
@@ -452,7 +452,7 @@
 		fullBuild();
 		assertEquals("Processor reported errors", ProcessorTestStatus.NO_ERRORS, ProcessorTestStatus.getErrors());
 	}
-	public void testBug542090() throws Throwable {
+	public void _testBug542090() throws Throwable {
 		if (!canRunJava9()) {
 			return;
 		}