Browse Source

Polish generics

tags/V1_8_3
Andy Clement 9 years ago
parent
commit
48eac479f6

+ 1
- 1
ajbrowser/src/org/aspectj/tools/ajbrowser/core/BrowserCompilerConfiguration.java View File

@@ -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();
}


+ 4
- 4
ajde.core/src/org/aspectj/ajde/core/ICompilerConfiguration.java View File

@@ -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();

//
// /**

+ 3
- 3
ajde.core/src/org/aspectj/ajde/core/JavaOptions.java View File

@@ -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);

+ 2
- 2
ajde.core/src/org/aspectj/ajde/core/internal/AjdeCoreBuildManager.java View File

@@ -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)) {

+ 2
- 2
ajde.core/src/org/aspectj/ajde/core/internal/OutputLocationAdapter.java View File

@@ -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();
}


+ 5
- 7
ajde.core/testsrc/org/aspectj/ajde/core/AjdeCoreTestCase.java View File

@@ -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);
}
}

+ 3
- 7
ajde.core/testsrc/org/aspectj/ajde/core/TestBuildProgressMonitor.java View File

@@ -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);
}
}

}

+ 3
- 3
ajde.core/testsrc/org/aspectj/ajde/core/TestCompilerConfiguration.java View File

@@ -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;
}


+ 6
- 6
ajde.core/testsrc/org/aspectj/ajde/core/TestMessageHandler.java View File

@@ -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;
}


+ 2
- 2
ajde.core/testsrc/org/aspectj/ajde/core/TestOutputLocationManager.java View File

@@ -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)) {

+ 1
- 1
ajde.core/testsrc/org/aspectj/ajde/core/tests/AjConfigTests.java View File

@@ -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();

+ 3
- 2
ajde.core/testsrc/org/aspectj/ajde/core/tests/CompilerMessagesTests.java View File

@@ -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());

+ 2
- 2
ajde.core/testsrc/org/aspectj/ajde/core/tests/DuplicateManifestTests.java View File

@@ -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);

+ 3
- 3
ajde.core/testsrc/org/aspectj/ajde/core/tests/InpathTests.java View File

@@ -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(

+ 3
- 2
ajde.core/testsrc/org/aspectj/ajde/core/tests/OutxmlTests.java View File

@@ -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));

+ 1
- 1
ajde.core/testsrc/org/aspectj/ajde/core/tests/ResourceCopyTests.java View File

@@ -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);

+ 5
- 4
asm/src/org/aspectj/asm/AsmManager.java View File

@@ -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) {

+ 1
- 0
asm/src/org/aspectj/asm/internal/ProgramElement.java View File

@@ -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;

+ 1
- 1
runtime/testsrc/org/aspectj/runtime/reflect/RuntimePerformanceTest.java View File

@@ -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;

Loading…
Cancel
Save