void (final InstrumentationClassFinder finder) { // we instrument every file, because we cannot find which files should not be instrumented without dependency storage final ArrayList<File> formsToInstrument = myFormFiles; if (formsToInstrument.isEmpty()) { log("No forms to instrument found", Project.MSG_VERBOSE); return; } final HashMap<String, File> class2form = new HashMap<String, File>(); for (File formFile : formsToInstrument) { log("compiling form " + formFile.getAbsolutePath(), Project.MSG_VERBOSE); final LwRootContainer rootContainer; try { rootContainer = Utils.getRootContainer(formFile.toURI().toURL(), new CompiledClassPropertiesProvider(finder.getLoader())); } catch (AlienFormFileException e) { // ignore non-IDEA forms continue; } catch (Exception e) { fireError("Cannot process form file " + formFile.getAbsolutePath() + ". Reason: " + e); continue; } final String classToBind = rootContainer.getClassToBind(); if (classToBind == null) { continue; } String name = classToBind.replace('.', '/'); File classFile = getClassFile(name); if (classFile == null) { log(formFile.getAbsolutePath() + ": Class to bind does not exist: " + classToBind, Project.MSG_WARN); continue; } final File alreadyProcessedForm = class2form.get(classToBind); if (alreadyProcessedForm != null) { fireError(formFile.getAbsolutePath() + ": " + "The form is bound to the class " + classToBind + ".\n" + "Another form " + alreadyProcessedForm.getAbsolutePath() + " is also bound to this class."); continue; } class2form.put(classToBind, formFile); try { int version; InputStream stream = new FileInputStream(classFile); try { version = InstrumenterClassWriter.getClassFileVersion(new ClassReader(stream)); } finally { stream.close(); } AntNestedFormLoader formLoader = new AntNestedFormLoader(finder.getLoader(), myNestedFormPathList); InstrumenterClassWriter classWriter = new InstrumenterClassWriter(InstrumenterClassWriter.getAsmClassWriterFlags(version), finder); final AsmCodeGenerator codeGenerator = new AsmCodeGenerator(rootContainer, finder, formLoader, false, classWriter); codeGenerator.patchFile(classFile); final FormErrorInfo[] warnings = codeGenerator.getWarnings(); for (FormErrorInfo warning : warnings) { log(formFile.getAbsolutePath() + ": " + warning.getErrorMessage(), Project.MSG_WARN); } final FormErrorInfo[] errors = codeGenerator.getErrors(); if (errors.length > 0) { StringBuilder message = new StringBuilder(); for (FormErrorInfo error : errors) { if (message.length() > 0) { message.append("\n"); } message.append(formFile.getAbsolutePath()).append(": ").append(error.getErrorMessage()); } fireError(message.toString()); } } catch (Exception e) { fireError("Forms instrumentation failed for " + formFile.getAbsolutePath() + ": " + e.toString()); } } }