From 6f1dfd7761485989786efc4d342c6082bc7e5a46 Mon Sep 17 00:00:00 2001 From: aclement Date: Mon, 2 Nov 2009 21:01:16 +0000 Subject: [PATCH] remove @Override and timing support --- .../internal/core/builder/AjBuildConfig.java | 9 +++ .../internal/core/builder/AjBuildManager.java | 59 ++++++++++++------- .../core/builder/AjCompilerOptions.java | 38 ++++++++---- 3 files changed, 73 insertions(+), 33 deletions(-) diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildConfig.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildConfig.java index 625d41741..0d5ee2fca 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildConfig.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildConfig.java @@ -409,6 +409,7 @@ public class AjBuildConfig implements CompilerConfigurationChangeFlags { setXconfigurationInfo(global.getXconfigurationInfo()); setAddSerialVerUID(global.isAddSerialVerUID()); setXmlConfigured(global.isXmlConfigured()); + setTiming(global.isTiming()); } void join(Collection local, Collection global) { @@ -645,6 +646,14 @@ public class AjBuildConfig implements CompilerConfigurationChangeFlags { return options.behaveInJava5Way; } + public void setTiming(boolean b) { + options.timing = b; + } + + public boolean isTiming() { + return options.timing; + } + public void setTargetAspectjRuntimeLevel(String level) { options.targetAspectjRuntimeLevel = level; } diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java index 43a7dc0fe..46aacd01f 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java @@ -80,7 +80,6 @@ import org.aspectj.org.eclipse.jdt.internal.compiler.batch.FileSystem; 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; @@ -212,8 +211,9 @@ public class AjBuildManager implements IOutputClassFileNameProvider, IBinarySour 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); @@ -296,10 +296,11 @@ public class AjBuildManager implements IOutputClassFileNameProvider, IBinarySour } 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()) @@ -309,8 +310,9 @@ public class AjBuildManager implements IOutputClassFileNameProvider, IBinarySour } if (state.requiresFullBatchBuild()) { - if (state.listenerDefined()) + if (state.listenerDefined()) { state.getListener().recordInformation(" Dropping back to full build"); + } return batchBuild(buildConfig, baseHandler); } @@ -323,9 +325,11 @@ public class AjBuildManager implements IOutputClassFileNameProvider, IBinarySour // 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()) { @@ -380,12 +384,14 @@ public class AjBuildManager implements IOutputClassFileNameProvider, IBinarySour 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; } @@ -468,8 +474,9 @@ public class AjBuildManager implements IOutputClassFileNameProvider, IBinarySour 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 +"'"); @@ -483,14 +490,16 @@ public class AjBuildManager implements IOutputClassFileNameProvider, IBinarySour 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) { @@ -509,8 +518,9 @@ public class AjBuildManager implements IOutputClassFileNameProvider, IBinarySour } 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); @@ -519,8 +529,9 @@ public class AjBuildManager implements IOutputClassFileNameProvider, IBinarySour writeResource(filename, bytes, src); } finally { - if (fis != null) + if (fis != null) { fis.close(); + } } } @@ -629,8 +640,9 @@ public class AjBuildManager implements IOutputClassFileNameProvider, IBinarySour } private void writeOutxmlFile() throws IOException { - if (ignoreOutxml) + if (ignoreOutxml) { return; + } String filename = buildConfig.getOutxmlName(); // System.err.println("? AjBuildManager.writeOutxmlFile() outxml=" + filename); @@ -813,6 +825,7 @@ public class AjBuildManager implements IOutputClassFileNameProvider, IBinarySour // 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()); @@ -1073,8 +1086,9 @@ public class AjBuildManager implements IOutputClassFileNameProvider, IBinarySour } 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); @@ -1206,8 +1220,9 @@ public class AjBuildManager implements IOutputClassFileNameProvider, IBinarySour } 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();) { @@ -1233,8 +1248,9 @@ public class AjBuildManager implements IOutputClassFileNameProvider, IBinarySour 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();) { @@ -1279,8 +1295,9 @@ public class AjBuildManager implements IOutputClassFileNameProvider, IBinarySour } } - 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); } diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjCompilerOptions.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjCompilerOptions.java index cca9aa49d..506f2e123 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjCompilerOptions.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjCompilerOptions.java @@ -74,6 +74,8 @@ public class AjCompilerOptions extends CompilerOptions { // 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; @@ -112,8 +114,9 @@ public class AjCompilerOptions extends CompilerOptions { */ public AjCompilerOptions(Map settings) { setAspectJWarningDefaults(); - if (settings == null) + if (settings == null) { return; + } set(settings); } @@ -161,28 +164,39 @@ public class AjCompilerOptions extends CompilerOptions { 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)) { -- 2.39.5