import org.aspectj.org.eclipse.jdt.internal.compiler.env.ICompilationUnit;
import org.aspectj.org.eclipse.jdt.internal.compiler.env.INameEnvironment;
import org.aspectj.org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
-import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment;
import org.aspectj.org.eclipse.jdt.internal.compiler.parser.Parser;
import org.aspectj.org.eclipse.jdt.internal.compiler.problem.AbortCompilation;
import org.aspectj.org.eclipse.jdt.internal.compiler.problem.DefaultProblemFactory;
boolean canIncremental = state.prepareForNextBuild(buildConfig);
if (!canIncremental && !isFullBuild) { // retry as batch?
CompilationAndWeavingContext.leavingPhase(ct);
- if (state.listenerDefined())
+ if (state.listenerDefined()) {
state.getListener().recordDecision("Falling back to batch compilation");
+ }
return performBuild(buildConfig, baseHandler, true);
}
this.handler = CountingMessageHandler.makeCountingMessageHandler(baseHandler);
}
boolean hereWeGoAgain = !(files.isEmpty() && binarySourcesForTheNextCompile.isEmpty());
for (int i = 0; (i < 5) && hereWeGoAgain; i++) {
- if (state.listenerDefined())
+ if (state.listenerDefined()) {
state.getListener()
.recordInformation("Starting incremental compilation loop " + (i + 1) + " of possibly 5");
- // System.err.println("XXXX inc: " + files);
+ // System.err.println("XXXX inc: " + files);
+ }
performCompilation(files);
if ((!proceedOnError() && handler.hasErrors())
}
if (state.requiresFullBatchBuild()) {
- if (state.listenerDefined())
+ if (state.listenerDefined()) {
state.getListener().recordInformation(" Dropping back to full build");
+ }
return batchBuild(buildConfig, baseHandler);
}
// again because in compiling something we found something else we needed to
// rebuild. But what case causes this?
if (hereWeGoAgain) {
- if (buildConfig.isEmacsSymMode() || buildConfig.isGenerateModelMode())
- if (AsmManager.attemptIncrementalModelRepairs)
+ if (buildConfig.isEmacsSymMode() || buildConfig.isGenerateModelMode()) {
+ if (AsmManager.attemptIncrementalModelRepairs) {
state.getStructureModel().processDelta(files, state.getAddedFiles(), state.getDeletedFiles());
+ }
+ }
}
}
if (!files.isEmpty()) {
closeOutputStream(buildConfig.getOutputJar());
}
ret = !handler.hasErrors();
- if (getBcelWorld() != null)
+ if (getBcelWorld() != null) {
getBcelWorld().tidyUp();
- if (getWeaver() != null)
+ }
+ if (getWeaver() != null) {
getWeaver().tidyUp();
- // bug 59895, don't release reference to handler as may be needed by a nested call
- // handler = null;
+ // bug 59895, don't release reference to handler as may be needed by a nested call
+ // handler = null;
+ }
}
return ret;
}
inStream = new JarInputStream(new FileInputStream(jarFile));
while (true) {
ZipEntry entry = inStream.getNextEntry();
- if (entry == null)
+ if (entry == null) {
break;
+ }
String filename = entry.getName();
// System.out.println("? copyResourcesFromJarFile() filename='" + filename +"'");
inStream.closeEntry();
}
} finally {
- if (inStream != null)
+ if (inStream != null) {
inStream.close();
+ }
}
}
private void copyResourcesFromDirectory(File dir) throws IOException {
- if (!COPY_INPATH_DIR_RESOURCES)
+ if (!COPY_INPATH_DIR_RESOURCES) {
return;
+ }
// Get a list of all files (i.e. everything that isnt a directory)
File[] files = FileUtil.listFiles(dir, new FileFilter() {
public boolean accept(File f) {
}
private void copyResourcesFromFile(File f, String filename, File src) throws IOException {
- if (!acceptResource(filename, true))
+ if (!acceptResource(filename, true)) {
return;
+ }
FileInputStream fis = null;
try {
fis = new FileInputStream(f);
writeResource(filename, bytes, src);
} finally {
- if (fis != null)
+ if (fis != null) {
fis.close();
+ }
}
}
}
private void writeOutxmlFile() throws IOException {
- if (ignoreOutxml)
+ if (ignoreOutxml) {
return;
+ }
String filename = buildConfig.getOutxmlName();
// System.err.println("? AjBuildManager.writeOutxmlFile() outxml=" + filename);
// cp.addAll(buildConfig.getClasspath());
BcelWorld bcelWorld = new BcelWorld(cp, handler, null);
bcelWorld.setBehaveInJava5Way(buildConfig.getBehaveInJava5Way());
+ bcelWorld.setTiming(buildConfig.isTiming());
bcelWorld.setAddSerialVerUID(buildConfig.isAddSerialVerUID());
bcelWorld.setXmlConfigured(buildConfig.isXmlConfigured());
bcelWorld.setXmlFiles(buildConfig.getXmlFiles());
} else {
writeZipEntry(classFile, filename);
}
- if (shouldAddAspectName && !classname.endsWith("$ajcMightHaveAspect"))
+ if (shouldAddAspectName && !classname.endsWith("$ajcMightHaveAspect")) {
addAspectName(classname, unitResult.getFileName());
+ }
} catch (IOException ex) {
IMessage message = EclipseAdapterUtils.makeErrorMessage(new String(unitResult.fileName),
CANT_WRITE_RESULT, ex);
}
String makeClasspathString(AjBuildConfig buildConfig) {
- if (buildConfig == null || buildConfig.getFullClasspath() == null)
+ if (buildConfig == null || buildConfig.getFullClasspath() == null) {
return "";
+ }
StringBuffer buf = new StringBuffer();
boolean first = true;
for (Iterator it = buildConfig.getFullClasspath().iterator(); it.hasNext();) {
return null;
}
- if (buildConfig == null || buildConfig.getFullClasspath() == null)
+ if (buildConfig == null || buildConfig.getFullClasspath() == null) {
return "no classpath specified";
+ }
String ret = null;
for (Iterator it = buildConfig.getFullClasspath().iterator(); it.hasNext();) {
}
}
- if (ret != null)
+ if (ret != null) {
return ret; // last error found in potentially matching jars...
+ }
return "couldn't find aspectjrt.jar on classpath, checked: " + makeClasspathString(buildConfig);
}
// If true - autoboxing behaves differently ...
public boolean behaveInJava5Way = false;
+ public boolean timing = false;
+
// Specifies the level of the aspectjrt.jar we are targetting
public String targetAspectjRuntimeLevel = Constants.RUNTIME_LEVEL_DEFAULT;
*/
public AjCompilerOptions(Map settings) {
setAspectJWarningDefaults();
- if (settings == null)
+ if (settings == null) {
return;
+ }
set(settings);
}
public void set(Map optionsMap) {
super.set(optionsMap);
Object optionValue;
- if ((optionValue = optionsMap.get(OPTION_ReportUnusedPrivateMember)) != null)
+ if ((optionValue = optionsMap.get(OPTION_ReportUnusedPrivateMember)) != null) {
updateSeverity(UnusedPrivateMember, optionValue);
- if ((optionValue = optionsMap.get(OPTION_ReportInvalidAbsoluteTypeName)) != null)
+ }
+ if ((optionValue = optionsMap.get(OPTION_ReportInvalidAbsoluteTypeName)) != null) {
updateSeverity(InvalidAbsoluteTypeName, optionValue);
- if ((optionValue = optionsMap.get(OPTION_ReportInvalidWildcardTypeName)) != null)
+ }
+ if ((optionValue = optionsMap.get(OPTION_ReportInvalidWildcardTypeName)) != null) {
updateSeverity(InvalidWildCardTypeName, optionValue);
- if ((optionValue = optionsMap.get(OPTION_ReportUnresolvableMember)) != null)
+ }
+ if ((optionValue = optionsMap.get(OPTION_ReportUnresolvableMember)) != null) {
updateSeverity(UnresolvableMember, optionValue);
- if ((optionValue = optionsMap.get(OPTION_ReportTypeNotExposedToWeaver)) != null)
+ }
+ if ((optionValue = optionsMap.get(OPTION_ReportTypeNotExposedToWeaver)) != null) {
updateSeverity(TypeNotExposedToWeaver, optionValue);
- if ((optionValue = optionsMap.get(OPTION_ReportShadowNotInStructure)) != null)
+ }
+ if ((optionValue = optionsMap.get(OPTION_ReportShadowNotInStructure)) != null) {
updateSeverity(ShadowNotInStructure, optionValue);
- if ((optionValue = optionsMap.get(OPTION_ReportUnmatchedSuperTypeInCall)) != null)
+ }
+ if ((optionValue = optionsMap.get(OPTION_ReportUnmatchedSuperTypeInCall)) != null) {
updateSeverity(UnmatchedSuperTypeInCall, optionValue);
- if ((optionValue = optionsMap.get(OPTION_ReportCannotImplementLazyTJP)) != null)
+ }
+ if ((optionValue = optionsMap.get(OPTION_ReportCannotImplementLazyTJP)) != null) {
updateSeverity(CannotImplementLazyTJP, optionValue);
- if ((optionValue = optionsMap.get(OPTION_ReportNeedSerialVersionUIDField)) != null)
+ }
+ if ((optionValue = optionsMap.get(OPTION_ReportNeedSerialVersionUIDField)) != null) {
updateSeverity(NeedSerialVersionUIDField, optionValue);
- if ((optionValue = optionsMap.get(OPTION_ReportIncompatibleSerialVersion)) != null)
+ }
+ if ((optionValue = optionsMap.get(OPTION_ReportIncompatibleSerialVersion)) != null) {
updateSeverity(IncompatibleSerialVersion, optionValue);
- if ((optionValue = optionsMap.get(CompilerOptions.OPTION_ReportSwallowedExceptionInCatchBlock)) != null)
+ }
+ if ((optionValue = optionsMap.get(CompilerOptions.OPTION_ReportSwallowedExceptionInCatchBlock)) != null) {
updateSeverity(CompilerOptions.SwallowedExceptionInCatchBlock, optionValue);
+ }
if ((optionValue = optionsMap.get(OPTION_TerminateAfterCompilation)) != null) {
if (ENABLED.equals(optionValue)) {