int flags,
IProgressMonitor monitor) throws JavaModelException {
CompilationUnitDeclaration unit = null;
INameEnvironmentWithProgress environment = null;
CancelableProblemFactory problemFactory = null;
CompilationUnitResolver resolver = null;
try {
if (javaProject == null) {
Classpath[] allEntries = new Classpath[classpaths.size()];
classpaths.toArray(allEntries);
environment = new NameEnvironmentWithProgress(allEntries, null, monitor);
} else {
environment = new CancelableNameEnvironment((JavaProject) javaProject, owner, monitor);
}
problemFactory = new CancelableProblemFactory(monitor);
CompilerOptions compilerOptions = getCompilerOptions(options, (flags & ICompilationUnit.ENABLE_STATEMENTS_RECOVERY) != 0);
boolean ignoreMethodBodies = (flags & ICompilationUnit.IGNORE_METHOD_BODIES) != 0;
compilerOptions.ignoreMethodBodies = ignoreMethodBodies;
resolver =
new CompilationUnitResolver(