New compiler level v_785_R33x
diff --git a/org.eclipse.jdt.core/antadapter/org/eclipse/jdt/core/CheckDebugAttributes.java b/org.eclipse.jdt.core/antadapter/org/eclipse/jdt/core/CheckDebugAttributes.java
index 6e2eb55..cd0f45e 100644
--- a/org.eclipse.jdt.core/antadapter/org/eclipse/jdt/core/CheckDebugAttributes.java
+++ b/org.eclipse.jdt.core/antadapter/org/eclipse/jdt/core/CheckDebugAttributes.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * 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
diff --git a/org.eclipse.jdt.core/antadapter/org/eclipse/jdt/core/JDTCompilerAdapter.java b/org.eclipse.jdt.core/antadapter/org/eclipse/jdt/core/JDTCompilerAdapter.java
index 5542abe..4d93e9e 100644
--- a/org.eclipse.jdt.core/antadapter/org/eclipse/jdt/core/JDTCompilerAdapter.java
+++ b/org.eclipse.jdt.core/antadapter/org/eclipse/jdt/core/JDTCompilerAdapter.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * 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
@@ -11,10 +11,16 @@
 package org.eclipse.jdt.core;
 
 import java.io.File;
+import java.io.IOException;
 import java.io.PrintWriter;
 import java.lang.reflect.Constructor;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 
 import org.apache.tools.ant.BuildException;
@@ -22,11 +28,14 @@
 import org.apache.tools.ant.taskdefs.Javac;
 import org.apache.tools.ant.taskdefs.compilers.DefaultCompilerAdapter;
 import org.apache.tools.ant.types.Commandline;
-import org.apache.tools.ant.types.FileSet;
 import org.apache.tools.ant.types.Path;
+import org.apache.tools.ant.types.Commandline.Argument;
 import org.apache.tools.ant.util.JavaEnvUtils;
+import org.eclipse.jdt.core.compiler.CharOperation;
 import org.eclipse.jdt.internal.antadapter.AntAdapterMessages;
 import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
+import org.eclipse.jdt.internal.compiler.util.SuffixConstants;
+import org.eclipse.jdt.internal.compiler.util.Util;
 
 /**
  * Ant 1.5 compiler adapter for the Eclipse Java compiler. This adapter permits the
@@ -42,9 +51,16 @@
  * @since 2.0
  */
 public class JDTCompilerAdapter extends DefaultCompilerAdapter {
+	private static final char[] SEPARATOR_CHARS = new char[] { '/', '\\' };
+	private static final char[] ADAPTER_PREFIX = "#ADAPTER#".toCharArray(); //$NON-NLS-1$
+	private static final char[] ADAPTER_ENCODING = "ENCODING#".toCharArray(); //$NON-NLS-1$
+	private static final char[] ADAPTER_ACCESS = "ACCESS#".toCharArray(); //$NON-NLS-1$
 	private static String compilerClass = "org.eclipse.jdt.internal.compiler.batch.Main"; //$NON-NLS-1$
 	String logFileName;
 	Map customDefaultOptions;
+	private Map fileEncodings = null;
+	private Map dirEncodings = null;
+	private List accessRules = null;
 	
 	/**
 	 * Performs a compile using the JDT batch compiler
@@ -63,7 +79,7 @@
 			Object result = compile.invoke(batchCompilerInstance, new Object[] { cmd.getArguments()});
 			final boolean resultValue = ((Boolean) result).booleanValue();
 			if (!resultValue && this.logFileName != null) {
-				System.out.println(AntAdapterMessages.getString("ant.jdtadapter.error.compilationFailed", this.logFileName)); //$NON-NLS-1$
+				this.attributes.log(AntAdapterMessages.getString("ant.jdtadapter.error.compilationFailed", this.logFileName)); //$NON-NLS-1$
 			}
 			return resultValue;
 		} catch (ClassNotFoundException cnfe) {
@@ -77,20 +93,30 @@
 	protected Commandline setupJavacCommand() throws BuildException {
 		Commandline cmd = new Commandline();
 		this.customDefaultOptions = new CompilerOptions().getMap();
+		
+		Class javacClass = Javac.class;
+		
+		/*
+		 * Read in the compiler arguments first since we might need to modify
+		 * the classpath if any access rules were specified
+		 */
+		String [] compilerArgs = processCompilerArguments(javacClass);
 
 		/*
 		 * This option is used to never exit at the end of the ant task. 
 		 */
 		cmd.createArgument().setValue("-noExit"); //$NON-NLS-1$
 
-        if (this.bootclasspath != null && this.bootclasspath.size() != 0) {
-			/*
-			 * Set the bootclasspath for the Eclipse compiler.
-			 */
+        if (this.bootclasspath != null) {
 			cmd.createArgument().setValue("-bootclasspath"); //$NON-NLS-1$
-			cmd.createArgument().setPath(this.bootclasspath);        	
-        } else {
-            this.includeJavaRuntime = true;
+        	if (this.bootclasspath.size() != 0) {
+    			/*
+    			 * Set the bootclasspath for the Eclipse compiler.
+    			 */
+    			cmd.createArgument().setPath(this.bootclasspath);
+        	} else {
+    			cmd.createArgument().setValue(Util.EMPTY_STRING);
+        	}
         }
 
         Path classpath = new Path(this.project);
@@ -100,7 +126,10 @@
          * It is emulated using the classpath. We add extdirs entries after the 
          * bootclasspath.
          */
-        addExtdirs(this.extdirs, classpath);
+        if (this.extdirs != null) {
+			cmd.createArgument().setValue("-extdirs"); //$NON-NLS-1$
+			cmd.createArgument().setPath(this.extdirs);        	
+        }
 
 		/*
 		 * The java runtime is already handled, so we simply want to retrieve the
@@ -114,7 +143,6 @@
         
         // retrieve the method getSourcepath() using reflect
         // This is done to improve the compatibility to ant 1.5
-        Class javacClass = Javac.class;
         Method getSourcepathMethod = null;
         try {
 	        getSourcepathMethod = javacClass.getMethod("getSourcepath", null); //$NON-NLS-1$
@@ -141,9 +169,10 @@
 		 * Set the classpath for the Eclipse compiler.
 		 */
 		cmd.createArgument().setValue("-classpath"); //$NON-NLS-1$
-		cmd.createArgument().setPath(classpath);
+		createClasspathArgument(cmd, classpath);
 
-        String memoryParameterPrefix = JavaEnvUtils.getJavaVersion().equals(JavaEnvUtils.JAVA_1_1) ? "-J-" : "-J-X";//$NON-NLS-1$//$NON-NLS-2$
+        final String javaVersion = JavaEnvUtils.getJavaVersion();
+		String memoryParameterPrefix = javaVersion.equals(JavaEnvUtils.JAVA_1_1) ? "-J-" : "-J-X";//$NON-NLS-1$//$NON-NLS-2$
         if (this.memoryInitialSize != null) {
             if (!this.attributes.isForkedJavac()) {
                 this.attributes.log(AntAdapterMessages.getString("ant.jdtadapter.info.ignoringMemoryInitialSize"), Project.MSG_WARN); //$NON-NLS-1$
@@ -183,14 +212,10 @@
 				}
         	}
 			if (debugLevel != null) {
-				if (debugLevel.length() == 0) {
-					this.customDefaultOptions.put(CompilerOptions.OPTION_LocalVariableAttribute, CompilerOptions.DO_NOT_GENERATE);
-					this.customDefaultOptions.put(CompilerOptions.OPTION_LineNumberAttribute, CompilerOptions.DO_NOT_GENERATE);
-					this.customDefaultOptions.put(CompilerOptions.OPTION_SourceFileAttribute , CompilerOptions.DO_NOT_GENERATE);
-				} else {
-					this.customDefaultOptions.put(CompilerOptions.OPTION_LocalVariableAttribute, CompilerOptions.DO_NOT_GENERATE);
-					this.customDefaultOptions.put(CompilerOptions.OPTION_LineNumberAttribute, CompilerOptions.DO_NOT_GENERATE);
-					this.customDefaultOptions.put(CompilerOptions.OPTION_SourceFileAttribute , CompilerOptions.DO_NOT_GENERATE);
+				this.customDefaultOptions.put(CompilerOptions.OPTION_LocalVariableAttribute, CompilerOptions.DO_NOT_GENERATE);
+				this.customDefaultOptions.put(CompilerOptions.OPTION_LineNumberAttribute, CompilerOptions.DO_NOT_GENERATE);
+				this.customDefaultOptions.put(CompilerOptions.OPTION_SourceFileAttribute , CompilerOptions.DO_NOT_GENERATE);
+				if (debugLevel.length() != 0) {
 					if (debugLevel.indexOf("vars") != -1) {//$NON-NLS-1$
 						this.customDefaultOptions.put(CompilerOptions.OPTION_LocalVariableAttribute, CompilerOptions.GENERATE);
 					}
@@ -211,26 +236,6 @@
 			this.customDefaultOptions.put(CompilerOptions.OPTION_LineNumberAttribute, CompilerOptions.DO_NOT_GENERATE);
 			this.customDefaultOptions.put(CompilerOptions.OPTION_SourceFileAttribute , CompilerOptions.DO_NOT_GENERATE);
         }
-        
-       // retrieve the method getCurrentCompilerArgs() using reflect
-        // This is done to improve the compatibility to ant 1.5
-        Method getCurrentCompilerArgsMethod = null;
-        try {
-	        getCurrentCompilerArgsMethod = javacClass.getMethod("getCurrentCompilerArgs", null); //$NON-NLS-1$
-        } catch(NoSuchMethodException e) {
-        	// if not found, then we cannot use this method (ant 1.5)
-        	// debug level is only available with ant 1.5.x
-        }
- 	    String[] compilerArgs = null;
-        if (getCurrentCompilerArgsMethod != null) {
-			try {
-				compilerArgs = (String[]) getCurrentCompilerArgsMethod.invoke(this.attributes, null);
-			} catch (IllegalAccessException e) {
-				// should never happen
-			} catch (InvocationTargetException e) {
-				// should never happen
-			}
-    	}
     	
 		/*
 		 * Handle the nowarn option. If none, then we generate all warnings.
@@ -248,7 +253,7 @@
 					this.customDefaultOptions.put(entry.getKey(), CompilerOptions.IGNORE);
 				}
 			}
-			this.customDefaultOptions.put(CompilerOptions.OPTION_TaskTags, ""); //$NON-NLS-1$
+			this.customDefaultOptions.put(CompilerOptions.OPTION_TaskTags, Util.EMPTY_STRING);
 			if (this.deprecation) {
 				this.customDefaultOptions.put(CompilerOptions.OPTION_ReportDeprecation, CompilerOptions.WARNING); 
 				this.customDefaultOptions.put(CompilerOptions.OPTION_ReportDeprecationInDeprecatedCode, CompilerOptions.ENABLED); 
@@ -273,40 +278,10 @@
 		}
 
 		/*
-		 * target option.
-		 */		
-		if (this.target != null) {
-			if (this.target.equals("1.1")) { //$NON-NLS-1$
-				this.customDefaultOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_1);
-			} else if (this.target.equals("1.2")) { //$NON-NLS-1$
-				this.customDefaultOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_2);
-			} else if (this.target.equals("1.3")) { //$NON-NLS-1$
-				this.customDefaultOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_3);
-			} else if (this.target.equals("1.4")) { //$NON-NLS-1$
-				this.customDefaultOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_4);
-			} else if (this.target.equals("1.5")) { //$NON-NLS-1$
-				this.customDefaultOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
-			} else {
-	            this.attributes.log(AntAdapterMessages.getString("ant.jdtadapter.info.unknownTarget", this.target), Project.MSG_WARN); //$NON-NLS-1$
-			}
-		}
-
-		/*
 		 * verbose option
 		 */
-		if (this.verbose && this.destDir != null) {
-			/*
-			 * if destDir is null, we don't generate any log.
-			 * See https://bugs.eclipse.org/bugs/show_bug.cgi?id=97744
-			 */
-			// Fix for https://bugs.eclipse.org/bugs/show_bug.cgi?id=96605
-			// cmd.createArgument().setValue("-verbose"); //$NON-NLS-1$
-			/*
-			 * extra option allowed by the Eclipse compiler
-			 */
-			cmd.createArgument().setValue("-log"); //$NON-NLS-1$
-			this.logFileName = this.destDir.getAbsolutePath() + ".log"; //$NON-NLS-1$
-			cmd.createArgument().setValue(this.logFileName);			
+		if (this.verbose) {
+			cmd.createArgument().setValue("-verbose"); //$NON-NLS-1$
 		}
 
 		/*
@@ -317,38 +292,20 @@
 		}
 
 		/*
+		 * target option.
+		 */
+		if (this.target != null) {
+			this.customDefaultOptions.put(CompilerOptions.OPTION_TargetPlatform, this.target);
+		}
+
+		/*
 		 * source option
 		 */
 		String source = this.attributes.getSource();
         if (source != null) {
-        	if (source.equals("1.3")) { //$NON-NLS-1$
-				this.customDefaultOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_3);
-			} else if (source.equals("1.4")) { //$NON-NLS-1$
-				this.customDefaultOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_4);
-			} else if (source.equals("1.5")) { //$NON-NLS-1$
-				this.customDefaultOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
-			} else {
-	            this.attributes.log(AntAdapterMessages.getString("ant.jdtadapter.info.unknownSource", source), Project.MSG_WARN); //$NON-NLS-1$
-			}
+			this.customDefaultOptions.put(CompilerOptions.OPTION_Source, source);
         }
-        
-		if (JavaEnvUtils.getJavaVersion().equals(JavaEnvUtils.JAVA_1_0)
-				|| JavaEnvUtils.getJavaVersion().equals(JavaEnvUtils.JAVA_1_1)
-				|| JavaEnvUtils.getJavaVersion().equals(JavaEnvUtils.JAVA_1_2)
-				|| JavaEnvUtils.getJavaVersion().equals(JavaEnvUtils.JAVA_1_3)) {
-			this.customDefaultOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_3);
-		} else if (JavaEnvUtils.getJavaVersion().equals(JavaEnvUtils.JAVA_1_4)) {
-			if (this.target != null && this.target.equals("1.1")) {			   //$NON-NLS-1$	
-				this.customDefaultOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_3);
-			} else {
-				this.customDefaultOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_4);
-			}
-		} else if (JavaEnvUtils.getJavaVersion().equals(JavaEnvUtils.JAVA_1_5)) {
-			this.customDefaultOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
-		} else {
-            this.attributes.log(AntAdapterMessages.getString("ant.jdtadapter.info.unknownVmVersion", JavaEnvUtils.getJavaVersion()), Project.MSG_WARN); //$NON-NLS-1$
-		}
-		
+
 		/*
 		 * encoding option
 		 */
@@ -361,8 +318,15 @@
 	        /*
 			 * Add extra argument on the command line
 			 */
-			if (compilerArgs.length != 0) {
-		        cmd.addArguments(compilerArgs);
+			final int length = compilerArgs.length;
+			if (length != 0) {
+				for (int i = 0, max = length; i < max; i++) {
+					String arg = compilerArgs[i];
+					if (this.logFileName == null && "-log".equals(arg) && ((i + 1) < max)) { //$NON-NLS-1$
+						this.logFileName = compilerArgs[i + 1];
+					}
+			        cmd.createArgument().setValue(arg);
+				}
 			}
 	   	}
      	/*
@@ -374,32 +338,238 @@
         return cmd;
 	}
 	
-    /**
-     * Emulation of extdirs feature in java >= 1.2.
-     * This method adds all files in the given
-     * directories (but not in sub-directories!) to the classpath,
-     * so that you don't have to specify them all one by one.
-     * @param extDirs - Path to append files to
-     */
-    private void addExtdirs(Path extDirs, Path classpath) {
-        if (extDirs == null) {
-            String extProp = System.getProperty("java.ext.dirs"); //$NON-NLS-1$
-            if (extProp != null) {
-                extDirs = new Path(classpath.getProject(), extProp);
-            } else {
-                return;
-            }
-        }
+	/**
+	 * Get the compiler arguments
+	 * @param javacClass
+	 * @return String[] the array of arguments
+	 */
+	private String[] processCompilerArguments(Class javacClass) {
+		// retrieve the method getCurrentCompilerArgs() using reflect
+		// This is done to improve the compatibility to ant 1.5
+		Method getCurrentCompilerArgsMethod = null;
+		try {
+			getCurrentCompilerArgsMethod = javacClass.getMethod("getCurrentCompilerArgs", null); //$NON-NLS-1$
+		} catch (NoSuchMethodException e) {
+			// if not found, then we cannot use this method (ant 1.5)
+			// debug level is only available with ant 1.5.x
+		}
+		String[] compilerArgs = null;
+		if (getCurrentCompilerArgsMethod != null) {
+			try {
+				compilerArgs = (String[]) getCurrentCompilerArgsMethod.invoke(this.attributes, null);
+			} catch (IllegalAccessException e) {
+				// should never happen
+			} catch (InvocationTargetException e) {
+				// should never happen
+			}
+		}
+		//check the compiler arguments for anything requiring extra processing
+		if (compilerArgs != null) checkCompilerArgs(compilerArgs);
+		return compilerArgs;
+	}
+	/**
+	 * check the compiler arguments.
+	 * Extract from files specified using @, lines marked with ADAPTER_PREFIX
+	 * These lines specify information that needs to be interpreted by us.
+	 * @param args compiler arguments to process
+	 */
+	private void checkCompilerArgs(String[] args) {
+		for (int i = 0; i < args.length; i++) {
+			if (args[i].charAt(0) == '@') {
+				try {
+					char[] content = Util.getFileCharContent(new File(args[i].substring(1)), null);
+					int offset = 0;
+					int prefixLength = ADAPTER_PREFIX.length;
+					while ((offset = CharOperation.indexOf(ADAPTER_PREFIX, content, true, offset)) > -1) {
+						int start = offset + prefixLength;
+						int end = CharOperation.indexOf('\n', content, start);
+						if (end == -1)
+							end = content.length;
+						while (CharOperation.isWhitespace(content[end])) {
+							end--;
+						}
+						
+						// end is inclusive, but in the API end is exclusive 
+						if (CharOperation.equals(ADAPTER_ENCODING, content, start, start + ADAPTER_ENCODING.length)) {
+							CharOperation.replace(content, SEPARATOR_CHARS, File.separatorChar, start, end + 1);
+							// file or folder level custom encoding
+							start += ADAPTER_ENCODING.length;
+							int encodeStart = CharOperation.lastIndexOf('[', content, start, end);
+							if (start < encodeStart && encodeStart < end) {
+								boolean isFile = CharOperation.equals(SuffixConstants.SUFFIX_java, content, encodeStart - 5, encodeStart, false);
 
-        String[] dirs = extDirs.list();
-        for (int i = 0; i < dirs.length; i++) {
-            File dir = classpath.getProject().resolveFile(dirs[i]);
-            if (dir.exists() && dir.isDirectory()) {
-                FileSet fs = new FileSet();
-                fs.setDir(dir);
-                fs.setIncludes("*"); //$NON-NLS-1$
-                classpath.addFileset(fs);
-            }
-        }
-    }
+								String str = String.valueOf(content, start, encodeStart - start);
+								String enc = String.valueOf(content, encodeStart, end - encodeStart + 1);
+								if (isFile) {
+									if (fileEncodings == null)
+										fileEncodings = new HashMap();
+									//use File to translate the string into a path with the correct File.seperator
+									fileEncodings.put(str, enc);
+								} else {
+									if (dirEncodings == null)
+										dirEncodings = new HashMap();
+									dirEncodings.put(str, enc);
+								}
+							}
+						} else if (CharOperation.equals(ADAPTER_ACCESS, content, start, start + ADAPTER_ACCESS.length)) {
+							// access rules for the classpath
+							start += ADAPTER_ACCESS.length;
+							int accessStart = CharOperation.indexOf('[', content, start, end);
+							CharOperation.replace(content, SEPARATOR_CHARS, File.separatorChar, start, accessStart);
+							if (start < accessStart && accessStart < end) {
+								String path = String.valueOf(content, start, accessStart - start);
+								String access = String.valueOf(content, accessStart, end - accessStart + 1);
+								if (accessRules == null)
+									accessRules = new ArrayList();
+								accessRules.add(path);
+								accessRules.add(access);
+							}
+						}
+						offset = end;
+					}
+				} catch (IOException e) {
+					//ignore
+				}
+			}
+		}
+
+	}
+	
+	/**
+	 * Copy the classpath to the command line with access rules included.
+	 * @param cmd the given command line
+	 * @param classpath the given classpath entry
+	 */
+	private void createClasspathArgument(Commandline cmd, Path classpath) {
+		Argument arg = cmd.createArgument();
+		final String[] pathElements = classpath.list();
+
+		// empty path return empty string
+		if (pathElements.length == 0) {
+			arg.setValue(Util.EMPTY_STRING);
+			return;
+		}
+
+		// no access rules, can set the path directly
+		if (accessRules == null) {
+			arg.setPath(classpath);
+			return;
+		}
+
+		int rulesLength = accessRules.size();
+		String[] rules = (String[]) accessRules.toArray(new String[rulesLength]);
+		int nextRule = 0;
+		final StringBuffer result = new StringBuffer();
+
+		//access rules are expected in the same order as the classpath, but there could
+		//be elements in the classpath not in the access rules or access rules not in the classpath
+		for (int i = 0, max = pathElements.length; i < max; i++) {
+			if (i > 0)
+				result.append(File.pathSeparatorChar);
+			String pathElement = pathElements[i];
+			result.append(pathElement);
+			//the rules list is [path, rule, path, rule, ...]
+			for (int j = nextRule; j < rulesLength; j += 2) {
+				String rule = rules[j];
+				if (pathElement.endsWith(rule)) {
+					result.append(rules[j + 1]);
+					nextRule = j + 2;
+					break;
+				}
+				// if the path doesn't match, it could be due to a trailing file separatorChar in the rule
+				if (rule.endsWith(File.separator)) {
+					// rule ends with the File.separator, but pathElement might not
+					// otherwise it would match on the first endsWith
+					int ruleLength = rule.length();
+					if (pathElement.regionMatches(false, pathElement.length() - ruleLength + 1, rule, 0, ruleLength - 1)) {
+						result.append(rules[j + 1]);
+						nextRule = j + 2;
+						break;
+					}
+				} else if (pathElement.endsWith(File.separator)) {
+					// rule doesn't end with the File.separator, but pathElement might
+					int ruleLength = rule.length();
+					if (pathElement.regionMatches(false, pathElement.length() - ruleLength - 1, rule, 0, ruleLength)) {
+						result.append(rules[j + 1]);
+						nextRule = j + 2;
+						break;
+					}
+				}
+			}
+		}
+
+		arg.setValue(result.toString());
+	}
+	/**
+	 * Modified from base class, Logs the compilation parameters, adds the files 
+	 * to compile and logs the &quot;niceSourceList&quot;
+	 * Appends encoding information at the end of arguments
+	 * 
+	 * @param cmd the given command line
+	 */
+	protected void logAndAddFilesToCompile(Commandline cmd) {
+		attributes.log("Compilation " + cmd.describeArguments(), //$NON-NLS-1$
+				Project.MSG_VERBOSE);
+
+		StringBuffer niceSourceList = new StringBuffer("File"); //$NON-NLS-1$
+		if (compileList.length != 1) {
+			niceSourceList.append("s"); //$NON-NLS-1$
+		}
+		niceSourceList.append(" to be compiled:"); //$NON-NLS-1$
+		niceSourceList.append(lSep);
+
+		String[] encodedFiles = null, encodedDirs = null;
+		int encodedFilesLength = 0, encodedDirsLength = 0;
+		if (fileEncodings != null) {
+			encodedFilesLength = fileEncodings.size();
+			encodedFiles = new String[encodedFilesLength];
+			fileEncodings.keySet().toArray(encodedFiles);
+		}
+		if (dirEncodings != null) {
+			encodedDirsLength = dirEncodings.size();
+			encodedDirs = new String[encodedDirsLength];
+			dirEncodings.keySet().toArray(encodedDirs);
+			//we need the directories sorted, longest first,since sub directories can
+			//override encodings for their parent directories
+			Comparator comparator = new Comparator() {
+				public int compare(Object o1, Object o2) {
+					return ((String) o2).length() - ((String) o1).length();
+				}
+			};
+			Arrays.sort(encodedDirs, comparator);
+		}
+
+		for (int i = 0; i < compileList.length; i++) {
+			String arg = compileList[i].getAbsolutePath();
+			boolean encoded = false;
+			if (encodedFiles != null) {
+				//check for file level custom encoding
+				for (int j = 0; j < encodedFilesLength; j++) {
+					if (arg.endsWith(encodedFiles[j])) {
+						//found encoding, remove it from the list to speed things up next time around
+						arg = arg + (String) fileEncodings.get(encodedFiles[j]);
+						if (j < encodedFilesLength - 1) {
+							System.arraycopy(encodedFiles, j + 1, encodedFiles, j, encodedFilesLength - j - 1);
+						}
+						encodedFiles[--encodedFilesLength] = null;
+						encoded = true;
+						break;
+					}
+				}
+			}
+			if (!encoded && encodedDirs != null) {
+				//check folder level custom encoding
+				for (int j = 0; j < encodedDirsLength; j++) {
+					if (arg.lastIndexOf(encodedDirs[j]) != -1) {
+						arg = arg + (String) dirEncodings.get(encodedDirs[j]);
+						break;
+					}
+				}
+			}
+			cmd.createArgument().setValue(arg);
+			niceSourceList.append("    " + arg + lSep); //$NON-NLS-1$
+		}
+
+		attributes.log(niceSourceList.toString(), Project.MSG_VERBOSE);
+	}
 }