diff options
19 files changed, 51 insertions, 53 deletions
diff --git a/ajbrowser/src/org/aspectj/tools/ajbrowser/core/BrowserCompilerConfiguration.java b/ajbrowser/src/org/aspectj/tools/ajbrowser/core/BrowserCompilerConfiguration.java index 403ebb731..26f20bef2 100644 --- a/ajbrowser/src/org/aspectj/tools/ajbrowser/core/BrowserCompilerConfiguration.java +++ b/ajbrowser/src/org/aspectj/tools/ajbrowser/core/BrowserCompilerConfiguration.java @@ -52,7 +52,7 @@ public class BrowserCompilerConfiguration implements ICompilerConfiguration { return classpath.toString(); } - public Map getJavaOptionsMap() { + public Map<String,String> getJavaOptionsMap() { return BrowserManager.getDefault().getJavaBuildOptions().getJavaBuildOptionsMap(); } diff --git a/ajde.core/src/org/aspectj/ajde/core/ICompilerConfiguration.java b/ajde.core/src/org/aspectj/ajde/core/ICompilerConfiguration.java index b9684aa09..ef3a56e69 100644 --- a/ajde.core/src/org/aspectj/ajde/core/ICompilerConfiguration.java +++ b/ajde.core/src/org/aspectj/ajde/core/ICompilerConfiguration.java @@ -33,7 +33,7 @@ public interface ICompilerConfiguration extends CompilerConfigurationChangeFlags * @see org.aspectj.ajde.core.JavaOptions#getDefaultJavaOptions or * org.aspectj.org.eclipse.jdt.core.IJavaProject#getOptions(boolean) */ - public Map /* String --> String */getJavaOptionsMap(); + public Map<String,String> getJavaOptionsMap(); /** * The non-standard options, typically prefaced with -X when used with a command line compiler. The default is no non-standard @@ -59,7 +59,7 @@ public interface ICompilerConfiguration extends CompilerConfigurationChangeFlags * * @return a subset of those files that would be returned on getProjectSourceFiles() that have actually *changed* */ - public List /* File */getProjectSourceFilesChanged(); + public List<File> getProjectSourceFilesChanged(); /** * @return the classpath to use @@ -95,7 +95,7 @@ public interface ICompilerConfiguration extends CompilerConfigurationChangeFlags * * @return map from unique resource name to absolute path to source resource (String to File) */ - public Map /* String --> java.io.File */getSourcePathResources(); + public Map<String,File> getSourcePathResources(); /** * Returns a set of bit flags indicating what has changed in the configuration since it was previously read. This allows the @@ -122,7 +122,7 @@ public interface ICompilerConfiguration extends CompilerConfigurationChangeFlags * @return a list of modified elements that should be checked (can be empty) or null if unknown (and in which case every * classpath element will be checked) */ - public List getClasspathElementsWithModifiedContents(); + public List<String> getClasspathElementsWithModifiedContents(); // // /** diff --git a/ajde.core/src/org/aspectj/ajde/core/JavaOptions.java b/ajde.core/src/org/aspectj/ajde/core/JavaOptions.java index caf2f05ea..5de225339 100644 --- a/ajde.core/src/org/aspectj/ajde/core/JavaOptions.java +++ b/ajde.core/src/org/aspectj/ajde/core/JavaOptions.java @@ -60,15 +60,15 @@ public final class JavaOptions { public static final String GENERATE = CompilerOptions.GENERATE; public static final String DO_NOT_GENERATE = CompilerOptions.DO_NOT_GENERATE; - private static Map defaultOptionsMap; + private static Map<String,String> defaultOptionsMap; /** * @return the java options map with the default settings */ - public static Map getDefaultJavaOptions() { + public static Map<String,String> getDefaultJavaOptions() { if (defaultOptionsMap != null) return defaultOptionsMap; - defaultOptionsMap = new HashMap(); + defaultOptionsMap = new HashMap<String,String>(); defaultOptionsMap.put(COMPLIANCE_LEVEL, VERSION_14); defaultOptionsMap.put(SOURCE_COMPATIBILITY_LEVEL, VERSION_13); defaultOptionsMap.put(PRESERVE_ALL_LOCALS, OPTIMIZE); diff --git a/ajde.core/src/org/aspectj/ajde/core/internal/AjdeCoreBuildManager.java b/ajde.core/src/org/aspectj/ajde/core/internal/AjdeCoreBuildManager.java index 531e9b01d..4ab05c968 100644 --- a/ajde.core/src/org/aspectj/ajde/core/internal/AjdeCoreBuildManager.java +++ b/ajde.core/src/org/aspectj/ajde/core/internal/AjdeCoreBuildManager.java @@ -187,7 +187,7 @@ public class AjdeCoreBuildManager { return formattedOptions.toString(); } - private String formatMap(Map options) { + private String formatMap(Map<String,? extends Object> options) { if (options == null) { return "<default>"; } @@ -309,7 +309,7 @@ public class AjdeCoreBuildManager { mergeInto(config.getAspectpath(), compilerConfig.getAspectPath()); // Process the JAVA OPTIONS MAP - Map jom = compilerConfig.getJavaOptionsMap(); + Map<String,String> jom = compilerConfig.getJavaOptionsMap(); if (jom != null) { String version = (String) jom.get(CompilerOptions.OPTION_Compliance); if (version != null && !version.equals(CompilerOptions.VERSION_1_4)) { diff --git a/ajde.core/src/org/aspectj/ajde/core/internal/OutputLocationAdapter.java b/ajde.core/src/org/aspectj/ajde/core/internal/OutputLocationAdapter.java index a944de996..7fe6a9cb1 100644 --- a/ajde.core/src/org/aspectj/ajde/core/internal/OutputLocationAdapter.java +++ b/ajde.core/src/org/aspectj/ajde/core/internal/OutputLocationAdapter.java @@ -42,7 +42,7 @@ public class OutputLocationAdapter implements CompilationResultDestinationManage return this.locationManager.getOutputLocationForResource(resource); } - public List getAllOutputLocations() { + public List<File> getAllOutputLocations() { return this.locationManager.getAllOutputLocations(); } @@ -67,7 +67,7 @@ public class OutputLocationAdapter implements CompilationResultDestinationManage * * @return a map from inpath entries (jars/dirs) to handle components. */ - public Map getInpathMap() { + public Map<File,String> getInpathMap() { return this.locationManager.getInpathMap(); } diff --git a/ajde.core/testsrc/org/aspectj/ajde/core/AjdeCoreTestCase.java b/ajde.core/testsrc/org/aspectj/ajde/core/AjdeCoreTestCase.java index 680d19065..e24e85217 100644 --- a/ajde.core/testsrc/org/aspectj/ajde/core/AjdeCoreTestCase.java +++ b/ajde.core/testsrc/org/aspectj/ajde/core/AjdeCoreTestCase.java @@ -13,12 +13,12 @@ package org.aspectj.ajde.core; import java.io.File; import java.io.IOException; import java.util.ArrayList; -import java.util.Iterator; import java.util.List; import junit.framework.AssertionFailedError; import junit.framework.TestCase; +import org.aspectj.ajde.core.TestMessageHandler.TestMessage; import org.aspectj.tools.ajc.Ajc; /** @@ -124,9 +124,8 @@ public class AjdeCoreTestCase extends TestCase { } public boolean checkFor(String what) { - List ll = ((TestMessageHandler) compiler.getMessageHandler()).getMessages(); - for (Iterator iter = ll.iterator(); iter.hasNext();) { - Object element = iter.next(); + List<TestMessage> ll = ((TestMessageHandler) compiler.getMessageHandler()).getMessages(); + for (TestMessage element: ll) { if (element.toString().indexOf(what) != -1) return true; } @@ -134,9 +133,8 @@ public class AjdeCoreTestCase extends TestCase { } public void dumpTaskData() { - List ll = ((TestMessageHandler) compiler.getMessageHandler()).getMessages(); - for (Iterator iter = ll.iterator(); iter.hasNext();) { - Object element = iter.next(); + List<TestMessage> ll = ((TestMessageHandler) compiler.getMessageHandler()).getMessages(); + for (TestMessage element: ll) { System.out.println("RecordedMessage>" + element); } } diff --git a/ajde.core/testsrc/org/aspectj/ajde/core/TestBuildProgressMonitor.java b/ajde.core/testsrc/org/aspectj/ajde/core/TestBuildProgressMonitor.java index 8d9f4dcc1..2a293b626 100644 --- a/ajde.core/testsrc/org/aspectj/ajde/core/TestBuildProgressMonitor.java +++ b/ajde.core/testsrc/org/aspectj/ajde/core/TestBuildProgressMonitor.java @@ -11,7 +11,6 @@ package org.aspectj.ajde.core; import java.util.ArrayList; -import java.util.Iterator; import java.util.List; /** @@ -29,7 +28,7 @@ public class TestBuildProgressMonitor implements IBuildProgressMonitor { private String programmableString; private int count; - private List messagesReceived = new ArrayList(); + private List<String> messagesReceived = new ArrayList<String>(); private int currentVal; private boolean isCancelRequested = false; @@ -75,8 +74,7 @@ public class TestBuildProgressMonitor implements IBuildProgressMonitor { } public boolean containsMessage(String prefix,String distinguishingMarks) { - for (Iterator iter = messagesReceived.iterator(); iter.hasNext();) { - String element = (String) iter.next(); + for (String element: messagesReceived) { if (element.startsWith(prefix) && element.indexOf(distinguishingMarks)!=-1) return true; } @@ -85,11 +83,9 @@ public class TestBuildProgressMonitor implements IBuildProgressMonitor { public void dumpMessages() { System.out.println("ProgressMonitorMessages"); - for (Iterator iter = messagesReceived.iterator(); iter.hasNext();) { - String element = (String) iter.next(); + for (String element: messagesReceived) { System.out.println(element); } } - } diff --git a/ajde.core/testsrc/org/aspectj/ajde/core/TestCompilerConfiguration.java b/ajde.core/testsrc/org/aspectj/ajde/core/TestCompilerConfiguration.java index 1070da969..c3a46c047 100644 --- a/ajde.core/testsrc/org/aspectj/ajde/core/TestCompilerConfiguration.java +++ b/ajde.core/testsrc/org/aspectj/ajde/core/TestCompilerConfiguration.java @@ -94,7 +94,7 @@ public class TestCompilerConfiguration implements ICompilerConfiguration { return projectSourceFiles; } - public List getProjectSourceFilesChanged() { + public List<File> getProjectSourceFilesChanged() { return null; } @@ -139,7 +139,7 @@ public class TestCompilerConfiguration implements ICompilerConfiguration { this.outjar = outjar; } - public void setJavaOptions(Map javaOptions) { + public void setJavaOptions(Map<String,String> javaOptions) { this.javaOptions = javaOptions; } @@ -163,7 +163,7 @@ public class TestCompilerConfiguration implements ICompilerConfiguration { return ICompilerConfiguration.EVERYTHING; } - public List getClasspathElementsWithModifiedContents() { + public List<String> getClasspathElementsWithModifiedContents() { return null; } diff --git a/ajde.core/testsrc/org/aspectj/ajde/core/TestMessageHandler.java b/ajde.core/testsrc/org/aspectj/ajde/core/TestMessageHandler.java index a2e3efd1d..6cc8b8a8d 100644 --- a/ajde.core/testsrc/org/aspectj/ajde/core/TestMessageHandler.java +++ b/ajde.core/testsrc/org/aspectj/ajde/core/TestMessageHandler.java @@ -25,13 +25,13 @@ import org.aspectj.bridge.IMessage.Kind; public class TestMessageHandler implements IBuildMessageHandler { private List<Kind> ignoring; - private List messages; - private List errors; + private List<TestMessage> messages; + private List<TestMessage> errors; public TestMessageHandler() { ignoring = new ArrayList<Kind>(); - messages = new ArrayList(); - errors = new ArrayList(); + messages = new ArrayList<TestMessage>(); + errors = new ArrayList<TestMessage>(); ignore(IMessage.INFO); ignore(IMessage.WEAVEINFO); } @@ -70,11 +70,11 @@ public class TestMessageHandler implements IBuildMessageHandler { } } - public List getMessages() { + public List<TestMessage> getMessages() { return messages; } - public List getErrors() { + public List<TestMessage> getErrors() { return errors; } diff --git a/ajde.core/testsrc/org/aspectj/ajde/core/TestOutputLocationManager.java b/ajde.core/testsrc/org/aspectj/ajde/core/TestOutputLocationManager.java index d8396a59d..a8732f92d 100644 --- a/ajde.core/testsrc/org/aspectj/ajde/core/TestOutputLocationManager.java +++ b/ajde.core/testsrc/org/aspectj/ajde/core/TestOutputLocationManager.java @@ -61,9 +61,9 @@ public class TestOutputLocationManager implements IOutputLocationManager { resourceOutputLoc = f; } - public List getAllOutputLocations() { + public List<File> getAllOutputLocations() { if (allOutputLocations == null) { - allOutputLocations = new ArrayList(); + allOutputLocations = new ArrayList<File>(); initLocations(); allOutputLocations.add(classOutputLoc); if (!classOutputLoc.equals(resourceOutputLoc)) { diff --git a/ajde.core/testsrc/org/aspectj/ajde/core/tests/AjConfigTests.java b/ajde.core/testsrc/org/aspectj/ajde/core/tests/AjConfigTests.java index b49b514ab..04de37a65 100644 --- a/ajde.core/testsrc/org/aspectj/ajde/core/tests/AjConfigTests.java +++ b/ajde.core/testsrc/org/aspectj/ajde/core/tests/AjConfigTests.java @@ -49,7 +49,7 @@ public class AjConfigTests extends AjdeCoreTestCase { } public void testJavaOptionsMap() { - Map options = JavaOptions.getDefaultJavaOptions(); + Map<String,String> options = JavaOptions.getDefaultJavaOptions(); options.put(JavaOptions.WARN_DEPRECATION, JavaOptions.WARNING); compilerConfig.setJavaOptions(options); Map found = genAjBuildConfig().getOptions().getMap(); diff --git a/ajde.core/testsrc/org/aspectj/ajde/core/tests/CompilerMessagesTests.java b/ajde.core/testsrc/org/aspectj/ajde/core/tests/CompilerMessagesTests.java index 220276101..7ff298ae5 100644 --- a/ajde.core/testsrc/org/aspectj/ajde/core/tests/CompilerMessagesTests.java +++ b/ajde.core/testsrc/org/aspectj/ajde/core/tests/CompilerMessagesTests.java @@ -19,6 +19,7 @@ import java.util.List; import org.aspectj.ajde.core.AjdeCoreTestCase; import org.aspectj.ajde.core.TestCompilerConfiguration; import org.aspectj.ajde.core.TestMessageHandler; +import org.aspectj.ajde.core.TestMessageHandler.TestMessage; import org.aspectj.bridge.IMessage; public class CompilerMessagesTests extends AjdeCoreTestCase { @@ -47,7 +48,7 @@ public class CompilerMessagesTests extends AjdeCoreTestCase { // bug 33474 // The build has happened, what messages did the compiler give, and do they // contain the information we expect? - List msgs = handler.getMessages(); + List<TestMessage> msgs = handler.getMessages(); if (2 != msgs.size()) { assertTrue("not two messages: " + msgs, false); } @@ -69,7 +70,7 @@ public class CompilerMessagesTests extends AjdeCoreTestCase { } public void testDeclareMessageContents() { - List msgs = handler.getMessages(); + List<TestMessage> msgs = handler.getMessages(); IMessage msg = ((TestMessageHandler.TestMessage)msgs.get(1)).getContainedMessage(); assertEquals( "Please don't call setters" , msg.getMessage()); assertEquals("field-set(int apackage.SomeClass.x)", msg.getDetails()); diff --git a/ajde.core/testsrc/org/aspectj/ajde/core/tests/DuplicateManifestTests.java b/ajde.core/testsrc/org/aspectj/ajde/core/tests/DuplicateManifestTests.java index 997c49d72..24286d6bd 100644 --- a/ajde.core/testsrc/org/aspectj/ajde/core/tests/DuplicateManifestTests.java +++ b/ajde.core/testsrc/org/aspectj/ajde/core/tests/DuplicateManifestTests.java @@ -46,10 +46,10 @@ public class DuplicateManifestTests extends AjdeCoreTestCase { } public void testWeave() { - Set injars = new HashSet(); + Set<File> injars = new HashSet<File>(); injars.add(openFile(injarName)); compilerConfig.setInpath(injars); - Set aspectpath = new HashSet(); + Set<File> aspectpath = new HashSet<File>(); aspectpath.add(openFile(aspectjarName)); compilerConfig.setAspectPath(aspectpath); File outjar = openFile(outjarName); diff --git a/ajde.core/testsrc/org/aspectj/ajde/core/tests/InpathTests.java b/ajde.core/testsrc/org/aspectj/ajde/core/tests/InpathTests.java index dce1dd9c9..b39d8513a 100644 --- a/ajde.core/testsrc/org/aspectj/ajde/core/tests/InpathTests.java +++ b/ajde.core/testsrc/org/aspectj/ajde/core/tests/InpathTests.java @@ -97,7 +97,7 @@ public class InpathTests extends AjdeCoreTestCase { * */ public void testInpathToBin() { - Set inpath = new HashSet(); + Set<File> inpath = new HashSet<File>(); File indir1 = openFile(indir1Name); inpath.add(indir1); compilerConfig.setInpath(inpath); @@ -106,7 +106,7 @@ public class InpathTests extends AjdeCoreTestCase { doBuild(true); assertTrue("Expected no compiler errors or warnings but found " + handler.getMessages(), handler.getMessages().isEmpty()); - Set expectedBindirContents = new HashSet(); + Set<String> expectedBindirContents = new HashSet<String>(); // From indir1 // If we don't copy resources, these next three files won't make it // expectedBindirContents.add("META-INF/MANIFEST.MF"); @@ -224,7 +224,7 @@ public class InpathTests extends AjdeCoreTestCase { /* * Ensure -outjar contains all non-Java resouces from injars */ - public void compareJars(File dirFile, String sourceDir, File outjarFile, Set expectedOutputJarContents) { + public void compareJars(File dirFile, String sourceDir, File outjarFile, Set<String> expectedOutputJarContents) { try { assertTrue( diff --git a/ajde.core/testsrc/org/aspectj/ajde/core/tests/OutxmlTests.java b/ajde.core/testsrc/org/aspectj/ajde/core/tests/OutxmlTests.java index 28768722d..f21ba941e 100644 --- a/ajde.core/testsrc/org/aspectj/ajde/core/tests/OutxmlTests.java +++ b/ajde.core/testsrc/org/aspectj/ajde/core/tests/OutxmlTests.java @@ -22,6 +22,7 @@ import java.util.jar.JarFile; import org.aspectj.ajde.core.AjdeCoreTestCase; import org.aspectj.ajde.core.TestCompilerConfiguration; import org.aspectj.ajde.core.TestMessageHandler; +import org.aspectj.ajde.core.TestMessageHandler.TestMessage; import org.aspectj.bridge.Constants; public class OutxmlTests extends AjdeCoreTestCase { @@ -111,7 +112,7 @@ public class OutxmlTests extends AjdeCoreTestCase { */ public void testOutxmlToOutjarWithAop_xml () { File f = new File( getAbsoluteProjectDir() + File.separator + "src-resources" + File.separator + "testjar.jar"); - Set roots = new HashSet(); + Set<File> roots = new HashSet<File>(); roots.add(f); compilerConfig.setInpath(roots); @@ -122,7 +123,7 @@ public class OutxmlTests extends AjdeCoreTestCase { assertFalse("Expected compiler errors or warnings but didn't find any " + handler.getMessages(), handler.getMessages().isEmpty()); - List msgs = handler.getMessages(); + List<TestMessage> msgs = handler.getMessages(); String msg = ((TestMessageHandler.TestMessage)msgs.get(0)).getContainedMessage().getMessage(); String exp = "-outxml/-outxmlfile option ignored because resource already exists:"; assertTrue("Expected message to start with : " + exp + " but found message " + msg,msg.startsWith(exp)); diff --git a/ajde.core/testsrc/org/aspectj/ajde/core/tests/ResourceCopyTests.java b/ajde.core/testsrc/org/aspectj/ajde/core/tests/ResourceCopyTests.java index d70ef7cf0..57d220be8 100644 --- a/ajde.core/testsrc/org/aspectj/ajde/core/tests/ResourceCopyTests.java +++ b/ajde.core/testsrc/org/aspectj/ajde/core/tests/ResourceCopyTests.java @@ -108,7 +108,7 @@ public class ResourceCopyTests extends AjdeCoreTestCase { } public void testInjarsToBin() { - Set injars = new HashSet(); + Set<File> injars = new HashSet<File>(); File injar1 = openFile(injar1Name); injars.add(injar1); compilerConfig.setInpath(injars); diff --git a/asm/src/org/aspectj/asm/AsmManager.java b/asm/src/org/aspectj/asm/AsmManager.java index 20579df40..2ab34c862 100644 --- a/asm/src/org/aspectj/asm/AsmManager.java +++ b/asm/src/org/aspectj/asm/AsmManager.java @@ -256,6 +256,7 @@ public class AsmManager implements IStructureModel { ((AspectJElementHierarchy) hierarchy).setAsmManager(this); hierarchyReadOK = true; mapper = (RelationshipMap) s.readObject(); + s.close(); } } catch (FileNotFoundException fnfe) { // That is OK @@ -931,13 +932,13 @@ public class AsmManager implements IStructureModel { Set<String> sourcesToRemove = new HashSet<String>(); Set<String> nonExistingHandles = new HashSet<String>(); // Cache of handles that we // *know* are invalid - int srchandlecounter = 0; - int tgthandlecounter = 0; +// int srchandlecounter = 0; +// int tgthandlecounter = 0; // Iterate over the source handles in the relationships map Set<String> keyset = mapper.getEntries(); // These are source handles for (String hid : keyset) { - srchandlecounter++; +// srchandlecounter++; // Do we already know this handle points to nowhere? if (nonExistingHandles.contains(hid)) { @@ -967,7 +968,7 @@ public class AsmManager implements IStructureModel { // Iterate through the targets for this relationship for (Iterator<String> targetIter = targets.iterator(); targetIter.hasNext();) { String targethid = targetIter.next(); - tgthandlecounter++; +// tgthandlecounter++; // Do we already know it doesn't exist? if (nonExistingHandles.contains(targethid)) { if (dumpDeltaProcessing) { diff --git a/asm/src/org/aspectj/asm/internal/ProgramElement.java b/asm/src/org/aspectj/asm/internal/ProgramElement.java index 497b25028..51aafd936 100644 --- a/asm/src/org/aspectj/asm/internal/ProgramElement.java +++ b/asm/src/org/aspectj/asm/internal/ProgramElement.java @@ -830,6 +830,7 @@ public class ProgramElement implements IProgramElement { } } + @SuppressWarnings("unchecked") public Map<String, List<String>> getDeclareParentsMap() { Map<String, List<String>> s = (Map<String, List<String>>) kvpairs.get("declareparentsmap"); return s; diff --git a/runtime/testsrc/org/aspectj/runtime/reflect/RuntimePerformanceTest.java b/runtime/testsrc/org/aspectj/runtime/reflect/RuntimePerformanceTest.java index fe2a7483a..ac487539a 100644 --- a/runtime/testsrc/org/aspectj/runtime/reflect/RuntimePerformanceTest.java +++ b/runtime/testsrc/org/aspectj/runtime/reflect/RuntimePerformanceTest.java @@ -24,7 +24,7 @@ public class RuntimePerformanceTest extends TestCase { private static final long TIMEOUT = 10000; private static final long ITERATIONS = 1000000; private static final long WARMUP_ITERATIONS = 10000; - private static final long EXPECTED_RATIO = 10; + private static final long EXPECTED_RATIO = 8; private static final Factory factory = new Factory("RutimePerformanceTest.java",RuntimePerformanceTest.class); private boolean savedUseCaches; |