c = Class.forName("org.eclipse.jdt.internal.compiler.tool.EclipseCompilerImpl"); //$NON-NLS-1$
} catch (ClassNotFoundException e) {
// ignore
}
Field field = null;
JavaFileManager javaFileManager = null;
if (c != null) {
try {
field = c.getField("fileManager"); //$NON-NLS-1$
} catch (SecurityException e) {
// ignore
} catch (IllegalArgumentException e) {
// ignore
} catch (NoSuchFieldException e) {
// ignore
}
}
if (field != null) {
try {
javaFileManager = (JavaFileManager) field.get(batchCompiler);
} catch (IllegalArgumentException e) {
// ignore
} catch (IllegalAccessException e) {
// ignore
}
}
if (javaFileManager != null) {
_fileManager = javaFileManager;
} else {
String encoding = (String) batchCompiler.options.get(CompilerOptions.OPTION_Encoding);
Charset charset = encoding != null ? Charset.forName(encoding) : null;
JavaFileManager manager = new EclipseFileManager(batchCompiler.compilerLocale, charset);
ArrayList<String> options = new ArrayList<String>();
for (String argument : commandLineArguments) {
options.add(argument);
}
for (Iterator<String> iterator = options.iterator(); iterator.hasNext(); ) {
manager.handleOption(iterator.next(), iterator);
}
_fileManager = manager;
}
_processorOptions = Collections.unmodifiableMap(parseProcessorOptions(commandLineArguments));
_filer = new BatchFilerImpl(_dispatchManager, this);