Signed-off-by: Lars Grefer <eclipse@larsgrefer.de>tags/V1_9_7M1
@@ -61,7 +61,7 @@ public class BrowserManager { | |||
private UserPreferencesAdapter preferencesAdapter; | |||
private static TopFrame topFrame = null; | |||
private List<String> configFiles = new ArrayList<String>(); | |||
private List<String> configFiles = new ArrayList<>(); | |||
private JavaBuildOptions javaBuildOptions; | |||
public static BrowserManager getDefault() { | |||
@@ -182,7 +182,7 @@ public class BrowserManager { | |||
} | |||
private List<String> getConfigFilesList(String[] configFiles) { | |||
List<String> configs = new ArrayList<String>(); | |||
List<String> configs = new ArrayList<>(); | |||
for (String configFile : configFiles) { | |||
if (configFile.endsWith(BuildConfigManager.CONFIG_FILE_SUFFIX)) { | |||
configs.add(configFile); |
@@ -47,7 +47,7 @@ public class BrowserOutputLocationManager implements IOutputLocationManager { | |||
} | |||
public List<File> getAllOutputLocations() { | |||
List<File> outputDirs = new ArrayList<File>(); | |||
List<File> outputDirs = new ArrayList<>(); | |||
outputDirs.add(new File(getCommonOutputDir())); | |||
return outputDirs; | |||
} |
@@ -32,8 +32,8 @@ public class BrowserMessageHandler implements IUIBuildMessageHandler { | |||
private List<IMessage> messages; | |||
public BrowserMessageHandler() { | |||
ignoring = new ArrayList<IMessage.Kind>(); | |||
messages = new ArrayList<IMessage>(); | |||
ignoring = new ArrayList<>(); | |||
messages = new ArrayList<>(); | |||
ignore(IMessage.INFO); | |||
ignore(IMessage.WEAVEINFO); | |||
} |
@@ -43,8 +43,8 @@ public class EditorManager { | |||
private EditorAdapter editor = null; | |||
private BasicEditor basicEditor = null; | |||
private ArrayList<EditorListener> editorListeners = new ArrayList<EditorListener>(); | |||
private Vector<EditorAdapter> editors = new Vector<EditorAdapter>(); | |||
private ArrayList<EditorListener> editorListeners = new ArrayList<>(); | |||
private Vector<EditorAdapter> editors = new Vector<>(); | |||
private JPanel editor_panel = null; | |||
private Box editors_box = Box.createVerticalBox(); | |||
@@ -68,7 +68,7 @@ public final class JavaOptions { | |||
public static Map<String,String> getDefaultJavaOptions() { | |||
if (defaultOptionsMap != null) return defaultOptionsMap; | |||
defaultOptionsMap = new HashMap<String,String>(); | |||
defaultOptionsMap = new HashMap<>(); | |||
defaultOptionsMap.put(COMPLIANCE_LEVEL, VERSION_14); | |||
defaultOptionsMap.put(SOURCE_COMPATIBILITY_LEVEL, VERSION_13); | |||
defaultOptionsMap.put(PRESERVE_ALL_LOCALS, OPTIMIZE); |
@@ -272,7 +272,7 @@ public class AjdeCoreBuildManager { | |||
if (propcp != null && propcp.length() != 0) { | |||
StringTokenizer st = new StringTokenizer(propcp, File.pathSeparator); | |||
List<String> configClasspath = config.getClasspath(); | |||
ArrayList<String> toAdd = new ArrayList<String>(); | |||
ArrayList<String> toAdd = new ArrayList<>(); | |||
while (st.hasMoreTokens()) { | |||
String entry = st.nextToken(); | |||
if (!configClasspath.contains(entry)) { | |||
@@ -280,7 +280,7 @@ public class AjdeCoreBuildManager { | |||
} | |||
} | |||
if (0 < toAdd.size()) { | |||
ArrayList<String> both = new ArrayList<String>(configClasspath.size() + toAdd.size()); | |||
ArrayList<String> both = new ArrayList<>(configClasspath.size() + toAdd.size()); | |||
both.addAll(configClasspath); | |||
both.addAll(toAdd); | |||
config.setClasspath(both); | |||
@@ -376,7 +376,7 @@ public class AjdeCoreBuildManager { | |||
// Break a string into a string array of non-standard options. | |||
// Allows for one option to include a ' '. i.e. assuming it has been quoted, it | |||
// won't accidentally get treated as a pair of options (can be needed for xlint props file option) | |||
List<String> tokens = new ArrayList<String>(); | |||
List<String> tokens = new ArrayList<>(); | |||
int ind = nonStdOptions.indexOf('\"'); | |||
int ind2 = nonStdOptions.indexOf('\"', ind + 1); | |||
if ((ind > -1) && (ind2 > -1)) { // dont tokenize within double quotes | |||
@@ -404,7 +404,7 @@ public class AjdeCoreBuildManager { | |||
/** Local helper method for splitting option strings */ | |||
private List<String> tokenizeString(String str) { | |||
List<String> tokens = new ArrayList<String>(); | |||
List<String> tokens = new ArrayList<>(); | |||
StringTokenizer tok = new StringTokenizer(str); | |||
while (tok.hasMoreTokens()) { | |||
tokens.add(tok.nextToken()); |
@@ -139,7 +139,7 @@ public abstract class AjdeCoreTestCase extends TestCase { | |||
} | |||
public List<String> getSourceFileList(String[] files) { | |||
List<String> sourceFiles = new ArrayList<String>(); | |||
List<String> sourceFiles = new ArrayList<>(); | |||
for (String file : files) { | |||
sourceFiles.add(getAbsoluteProjectDir() + File.separator + file); | |||
} |
@@ -28,7 +28,7 @@ public class TestBuildProgressMonitor implements IBuildProgressMonitor { | |||
private String programmableString; | |||
private int count; | |||
private List<String> messagesReceived = new ArrayList<String>(); | |||
private List<String> messagesReceived = new ArrayList<>(); | |||
private int currentVal; | |||
private boolean isCancelRequested = false; | |||
@@ -39,7 +39,7 @@ public class TestCompilerConfiguration implements ICompilerConfiguration { | |||
private String outjar; | |||
private Map<String, String> javaOptions; | |||
private String nonStandardOptions; | |||
private List<String> projectSourceFiles = new ArrayList<String>(); | |||
private List<String> projectSourceFiles = new ArrayList<>(); | |||
private Map<String, File> sourcePathResources; | |||
private String srcDirName = "src"; | |||
@@ -76,7 +76,7 @@ public class TestCompilerConfiguration implements ICompilerConfiguration { | |||
public Map<String, String> getJavaOptionsMap() { | |||
if (javaOptions == null) { | |||
javaOptions = new Hashtable<String, String>(); | |||
javaOptions = new Hashtable<>(); | |||
javaOptions.put(JavaOptions.COMPLIANCE_LEVEL, JavaOptions.VERSION_13); | |||
javaOptions.put(JavaOptions.SOURCE_COMPATIBILITY_LEVEL, JavaOptions.VERSION_13); | |||
} | |||
@@ -111,7 +111,7 @@ public class TestCompilerConfiguration implements ICompilerConfiguration { | |||
public Map<String, File> getSourcePathResources() { | |||
if (sourcePathResources == null) { | |||
sourcePathResources = new HashMap<String, File>(); | |||
sourcePathResources = new HashMap<>(); | |||
/* Allow the user to override the testProjectPath by using sourceRoots */ | |||
File[] srcBase = new File[] { new File(projectPath + File.separator + srcDirName) }; |
@@ -29,9 +29,9 @@ public class TestMessageHandler implements IBuildMessageHandler { | |||
private List<TestMessage> errors; | |||
public TestMessageHandler() { | |||
ignoring = new ArrayList<Kind>(); | |||
messages = new ArrayList<TestMessage>(); | |||
errors = new ArrayList<TestMessage>(); | |||
ignoring = new ArrayList<>(); | |||
messages = new ArrayList<>(); | |||
errors = new ArrayList<>(); | |||
ignore(IMessage.INFO); | |||
ignore(IMessage.WEAVEINFO); | |||
} |
@@ -67,7 +67,7 @@ public class TestOutputLocationManager implements IOutputLocationManager { | |||
@Override | |||
public List<File> getAllOutputLocations() { | |||
if (allOutputLocations == null) { | |||
allOutputLocations = new ArrayList<File>(); | |||
allOutputLocations = new ArrayList<>(); | |||
initLocations(); | |||
allOutputLocations.add(classOutputLoc); | |||
if (!classOutputLoc.equals(resourceOutputLoc)) { |
@@ -60,7 +60,7 @@ public class AjConfigTest extends AjdeCoreTestCase { | |||
} | |||
public void testAspectPath() { | |||
Set<File> aspects = new HashSet<File>(); | |||
Set<File> aspects = new HashSet<>(); | |||
compilerConfig.setAspectPath(aspects); | |||
AjBuildConfig buildConfig = genAjBuildConfig(); | |||
List<File> aPath = buildConfig.getAspectpath(); | |||
@@ -83,7 +83,7 @@ public class AjConfigTest extends AjdeCoreTestCase { | |||
} | |||
public void testInpath() { | |||
Set<File> jars = new HashSet<File>(); | |||
Set<File> jars = new HashSet<>(); | |||
compilerConfig.setInpath(jars); | |||
AjBuildConfig buildConfig = genAjBuildConfig(); | |||
List<File> inJars = buildConfig.getInpath(); | |||
@@ -130,7 +130,7 @@ public class AjConfigTest extends AjdeCoreTestCase { | |||
} | |||
public void testSourcePathResources() { | |||
Map<String, File> m = new HashMap<String, File>(); | |||
Map<String, File> m = new HashMap<>(); | |||
m.put("newFile.txt", getWorkingDir()); | |||
compilerConfig.setSourcePathResources(m); | |||
AjBuildConfig buildConfig = genAjBuildConfig(); |
@@ -46,10 +46,10 @@ public class DuplicateManifestTest extends AjdeCoreTestCase { | |||
} | |||
public void testWeave() { | |||
Set<File> injars = new HashSet<File>(); | |||
Set<File> injars = new HashSet<>(); | |||
injars.add(openFile(injarName)); | |||
compilerConfig.setInpath(injars); | |||
Set<File> aspectpath = new HashSet<File>(); | |||
Set<File> aspectpath = new HashSet<>(); | |||
aspectpath.add(openFile(aspectjarName)); | |||
compilerConfig.setAspectPath(aspectpath); | |||
File outjar = openFile(outjarName); |
@@ -71,7 +71,7 @@ public class InpathTest extends AjdeCoreTestCase { | |||
* Expected result = output jar file contains contents of indir1 and class file for source that was in src | |||
*/ | |||
public void testInpathToOutjar() { | |||
Set<File> inpath = new HashSet<File>(); | |||
Set<File> inpath = new HashSet<>(); | |||
File indir1 = openFile(indir1Name); | |||
inpath.add(indir1); | |||
compilerConfig.setInpath(inpath); | |||
@@ -83,7 +83,7 @@ public class InpathTest extends AjdeCoreTestCase { | |||
doBuild(true); | |||
assertTrue("Expected no compiler errors or warnings but found " + handler.getMessages(), handler.getMessages().isEmpty()); | |||
Set<String> expectedOutputJarContents = new HashSet<String>(); | |||
Set<String> expectedOutputJarContents = new HashSet<>(); | |||
// From indir1 | |||
// If we don't copy resources, these next three files won't make it. | |||
// expectedOutputJarContents.add("META-INF/MANIFEST.MF"); | |||
@@ -100,7 +100,7 @@ public class InpathTest extends AjdeCoreTestCase { | |||
* | |||
*/ | |||
public void testInpathToBin() { | |||
Set<File> inpath = new HashSet<File>(); | |||
Set<File> inpath = new HashSet<>(); | |||
File indir1 = openFile(indir1Name); | |||
inpath.add(indir1); | |||
compilerConfig.setInpath(inpath); | |||
@@ -109,7 +109,7 @@ public class InpathTest extends AjdeCoreTestCase { | |||
doBuild(true); | |||
assertTrue("Expected no compiler errors or warnings but found " + handler.getMessages(), handler.getMessages().isEmpty()); | |||
Set<String> expectedBindirContents = new HashSet<String>(); | |||
Set<String> expectedBindirContents = new HashSet<>(); | |||
// From indir1 | |||
// If we don't copy resources, these next three files won't make it | |||
// expectedBindirContents.add("META-INF/MANIFEST.MF"); | |||
@@ -133,7 +133,7 @@ public class InpathTest extends AjdeCoreTestCase { | |||
* An extra check is done at the end of this test to verify that HelloWorld has changed size (due to the weaving). | |||
*/ | |||
public void testInpathToOutjar2() { | |||
Set<File> inpath = new HashSet<File>(); | |||
Set<File> inpath = new HashSet<>(); | |||
File indir2 = openFile(indir2Name); | |||
inpath.add(indir2); | |||
compilerConfig.setInpath(inpath); | |||
@@ -145,7 +145,7 @@ public class InpathTest extends AjdeCoreTestCase { | |||
doBuild(true); | |||
assertTrue("Expected no compiler errors or warnings but found " + handler.getMessages(), handler.getMessages().isEmpty()); | |||
Set<String> expectedOutputJarContents = new HashSet<String>(); | |||
Set<String> expectedOutputJarContents = new HashSet<>(); | |||
// From indir1 | |||
expectedOutputJarContents.add("example/HelloWorld.class"); | |||
@@ -181,7 +181,7 @@ public class InpathTest extends AjdeCoreTestCase { | |||
* | |||
*/ | |||
public void testInpathAndInjarToBin() { | |||
Set<File> inpath = new HashSet<File>(); | |||
Set<File> inpath = new HashSet<>(); | |||
File indir2 = openFile(indir2Name); | |||
inpath.add(indir2); | |||
inpath.add(openFile(injarName)); | |||
@@ -191,7 +191,7 @@ public class InpathTest extends AjdeCoreTestCase { | |||
doBuild(true); | |||
assertTrue("Expected no compiler errors or warnings but found " + handler.getMessages(), handler.getMessages().isEmpty()); | |||
Set<String> expectedBindirContents = new HashSet<String>(); | |||
Set<String> expectedBindirContents = new HashSet<>(); | |||
// From indir1 | |||
expectedBindirContents.add("example/HelloWorld.class"); |
@@ -112,7 +112,7 @@ public class OutxmlTest extends AjdeCoreTestCase { | |||
*/ | |||
public void testOutxmlToOutjarWithAop_xml () { | |||
File f = new File( getAbsoluteProjectDir() + File.separator + "src-resources" + File.separator + "testjar.jar"); | |||
Set<File> roots = new HashSet<File>(); | |||
Set<File> roots = new HashSet<>(); | |||
roots.add(f); | |||
compilerConfig.setInpath(roots); | |||
@@ -68,7 +68,7 @@ public class ResourceCopyTest extends AjdeCoreTestCase { | |||
} | |||
public void testInjarsToOutjar() { | |||
Set<File> injars = new HashSet<File>(); | |||
Set<File> injars = new HashSet<>(); | |||
File injar1 = openFile(injar1Name); | |||
injars.add(injar1); | |||
compilerConfig.setInpath(injars); | |||
@@ -81,7 +81,7 @@ public class ResourceCopyTest extends AjdeCoreTestCase { | |||
} | |||
public void testDuplicateResources() { | |||
Set<File> injars = new HashSet<File>(); | |||
Set<File> injars = new HashSet<>(); | |||
File injar1 = openFile(injar1Name); | |||
File injar2 = openFile(injar2Name); | |||
injars.add(injar1); | |||
@@ -110,7 +110,7 @@ public class ResourceCopyTest extends AjdeCoreTestCase { | |||
} | |||
public void testInjarsToBin() { | |||
Set<File> injars = new HashSet<File>(); | |||
Set<File> injars = new HashSet<>(); | |||
File injar1 = openFile(injar1Name); | |||
injars.add(injar1); | |||
compilerConfig.setInpath(injars); | |||
@@ -133,7 +133,7 @@ public class ResourceCopyTest extends AjdeCoreTestCase { | |||
// } | |||
public void testInjarsToOutjarOddNames() { | |||
Set<File> injars = new HashSet<File>(); | |||
Set<File> injars = new HashSet<>(); | |||
File injar1 = openFile("input1"); | |||
File outjar = openFile(outjarName + ".fozout"); | |||
injars.add(injar1); |
@@ -324,7 +324,7 @@ public class ReweavableTest extends AjdeCoreTestCase { | |||
Set<File> paths = new HashSet<>(); | |||
paths.add(openFile(binDir)); | |||
compilerConfig.setInpath(paths); | |||
compilerConfig.setProjectSourceFiles(new ArrayList<String>()); | |||
compilerConfig.setProjectSourceFiles(new ArrayList<>()); | |||
doBuild(true); | |||
String expMessage = "aspect tjp.GetInfo cannot be found when reweaving tjp.Demo"; | |||
@@ -356,7 +356,7 @@ public class ReweavableTest extends AjdeCoreTestCase { | |||
Set<File> paths = new HashSet<>(); | |||
paths.add(openFile(binDir)); | |||
compilerConfig.setInpath(paths); | |||
compilerConfig.setProjectSourceFiles(new ArrayList<String>()); | |||
compilerConfig.setProjectSourceFiles(new ArrayList<>()); | |||
doBuild(true); | |||
String expMessage = "successfully verified type tjp.GetInfo exists"; |
@@ -202,10 +202,10 @@ public class ShowWeaveMessagesTest extends AjdeCoreTestCase { | |||
public void testWeaveMessagesBinaryAdvice() { | |||
if (debugTests) | |||
System.out.println("\ntestWeaveMessagesBinaryAdvice: Simple.jar + AspectAdvice.jar"); | |||
Set<File> inpath = new HashSet<File>(); | |||
Set<File> inpath = new HashSet<>(); | |||
inpath.add(openFile("Simple.jar")); | |||
compilerConfig.setInpath(inpath); | |||
Set<File> aspectpath = new HashSet<File>(); | |||
Set<File> aspectpath = new HashSet<>(); | |||
aspectpath.add(openFile("AspectAdvice.jar")); | |||
compilerConfig.setAspectPath(aspectpath); | |||
doBuild(); | |||
@@ -216,10 +216,10 @@ public class ShowWeaveMessagesTest extends AjdeCoreTestCase { | |||
public void testWeaveMessagesBinaryITD() { | |||
if (debugTests) | |||
System.out.println("\ntestWeaveMessagesBinaryITD: Simple.jar + AspectITD.jar"); | |||
Set<File> inpath = new HashSet<File>(); | |||
Set<File> inpath = new HashSet<>(); | |||
inpath.add(openFile("Simple.jar")); | |||
compilerConfig.setInpath(inpath); | |||
Set<File> aspectpath = new HashSet<File>(); | |||
Set<File> aspectpath = new HashSet<>(); | |||
aspectpath.add(openFile("AspectITD.jar")); | |||
compilerConfig.setAspectPath(aspectpath); | |||
doBuild(); | |||
@@ -230,10 +230,10 @@ public class ShowWeaveMessagesTest extends AjdeCoreTestCase { | |||
public void testWeaveMessagesBinaryDeclare() { | |||
if (debugTests) | |||
System.out.println("\ntestWeaveMessagesBinaryDeclare: Simple.jar + AspectDeclare.jar"); | |||
Set<File> inpath = new HashSet<File>(); | |||
Set<File> inpath = new HashSet<>(); | |||
inpath.add(openFile("Simple.jar")); | |||
compilerConfig.setInpath(inpath); | |||
Set<File> aspectpath = new HashSet<File>(); | |||
Set<File> aspectpath = new HashSet<>(); | |||
aspectpath.add(openFile("AspectDeclare.jar")); | |||
compilerConfig.setAspectPath(aspectpath); | |||
doBuild(); | |||
@@ -247,10 +247,10 @@ public class ShowWeaveMessagesTest extends AjdeCoreTestCase { | |||
public void testWeaveMessagesBinaryDeclareSoft() { | |||
if (debugTests) | |||
System.out.println("\ntestWeaveMessagesBinaryDeclareSoft: Simple.jar + AspectDeclareSoft.jar"); | |||
Set<File> inpath = new HashSet<File>(); | |||
Set<File> inpath = new HashSet<>(); | |||
inpath.add(openFile("Simple.jar")); | |||
compilerConfig.setInpath(inpath); | |||
Set<File> aspectpath = new HashSet<File>(); | |||
Set<File> aspectpath = new HashSet<>(); | |||
aspectpath.add(openFile("AspectDeclareSoft.jar")); | |||
compilerConfig.setAspectPath(aspectpath); | |||
doBuild(); | |||
@@ -261,10 +261,10 @@ public class ShowWeaveMessagesTest extends AjdeCoreTestCase { | |||
public void testWeaveMessagesBinaryAdviceInPackageFromJar() { | |||
if (debugTests) | |||
System.out.println("\ntestWeaveMessagesBinaryAdviceInPackageFromJar: Simple.jar + AspectInPackage.jar"); | |||
Set<File> inpath = new HashSet<File>(); | |||
Set<File> inpath = new HashSet<>(); | |||
inpath.add(openFile("Simple.jar")); | |||
compilerConfig.setInpath(inpath); | |||
Set<File> aspectpath = new HashSet<File>(); | |||
Set<File> aspectpath = new HashSet<>(); | |||
aspectpath.add(openFile("AspectInPackage.jar")); | |||
compilerConfig.setAspectPath(aspectpath); | |||
doBuild(); | |||
@@ -275,10 +275,10 @@ public class ShowWeaveMessagesTest extends AjdeCoreTestCase { | |||
public void testWeaveMessagesBinaryAdviceInPackage() { | |||
if (debugTests) | |||
System.out.println("\ntestWeaveMessagesBinaryAdviceInPackage: Simple.jar + AspectInPackage.jar"); | |||
Set<File> inpath = new HashSet<File>(); | |||
Set<File> inpath = new HashSet<>(); | |||
inpath.add(openFile("Simple.jar")); | |||
compilerConfig.setInpath(inpath); | |||
Set<File> aspectpath = new HashSet<File>(); | |||
Set<File> aspectpath = new HashSet<>(); | |||
aspectpath.add(openFile("pkg")); | |||
compilerConfig.setAspectPath(aspectpath); | |||
doBuild(); | |||
@@ -291,10 +291,10 @@ public class ShowWeaveMessagesTest extends AjdeCoreTestCase { | |||
public void testWeaveMessagesBinaryAdviceNoDebugInfo() { | |||
if (debugTests) | |||
System.out.println("\ntestWeaveMessagesBinaryAdvice: Simple.jar + AspectAdvice.jar"); | |||
Set<File> inpath = new HashSet<File>(); | |||
Set<File> inpath = new HashSet<>(); | |||
inpath.add(openFile("Simple_nodebug.jar")); | |||
compilerConfig.setInpath(inpath); | |||
Set<File> aspectpath = new HashSet<File>(); | |||
Set<File> aspectpath = new HashSet<>(); | |||
aspectpath.add(openFile("AspectAdvice_nodebug.jar")); | |||
compilerConfig.setAspectPath(aspectpath); | |||
doBuild(); | |||
@@ -319,10 +319,10 @@ public class ShowWeaveMessagesTest extends AjdeCoreTestCase { | |||
public void testWeaveMessagesBinaryDeclareNoDebugInfo() { | |||
if (debugTests) | |||
System.out.println("\ntestWeaveMessagesBinaryDeclareNoDebugInfo: Simple.jar + AspectDeclare.jar"); | |||
Set<File> inpath = new HashSet<File>(); | |||
Set<File> inpath = new HashSet<>(); | |||
inpath.add(openFile("Simple_nodebug.jar")); | |||
compilerConfig.setInpath(inpath); | |||
Set<File> aspectpath = new HashSet<File>(); | |||
Set<File> aspectpath = new HashSet<>(); | |||
aspectpath.add(openFile("AspectDeclare_nodebug.jar")); | |||
compilerConfig.setAspectPath(aspectpath); | |||
doBuild(); | |||
@@ -336,10 +336,10 @@ public class ShowWeaveMessagesTest extends AjdeCoreTestCase { | |||
public void testWeaveMessagesBinaryDeclareSoftNoDebugInfo() { | |||
if (debugTests) | |||
System.out.println("\ntestWeaveMessagesBinaryDeclareSoftNoDebugInfo: Simple.jar + AspectDeclareSoft.jar"); | |||
Set<File> inpath = new HashSet<File>(); | |||
Set<File> inpath = new HashSet<>(); | |||
inpath.add(openFile("Simple_nodebug.jar")); | |||
compilerConfig.setInpath(inpath); | |||
Set<File> aspectpath = new HashSet<File>(); | |||
Set<File> aspectpath = new HashSet<>(); | |||
aspectpath.add(openFile("AspectDeclareSoft_nodebug.jar")); | |||
compilerConfig.setAspectPath(aspectpath); | |||
doBuild(); |
@@ -24,8 +24,8 @@ import org.aspectj.ajdt.ajc.ConfigParser; | |||
*/ | |||
public class LstBuildConfigFileParser extends ConfigParser { | |||
private List<File> importedFiles = new ArrayList<File>(); | |||
private List<String> problemEntries = new ArrayList<String>(); | |||
private List<File> importedFiles = new ArrayList<>(); | |||
private List<String> problemEntries = new ArrayList<>(); | |||
// private String currFilePath; | |||
@@ -100,7 +100,7 @@ class LstBuildConfigFileUpdater { | |||
null); | |||
Ajde.getDefault().getMessageHandler().handleMessage(msg); | |||
} | |||
List<String> fileContents = new ArrayList<String>(); | |||
List<String> fileContents = new ArrayList<>(); | |||
BufferedReader reader = new BufferedReader(new FileReader(configFile)); | |||
String line = reader.readLine(); | |||
while (line != null) { | |||
@@ -146,13 +146,13 @@ class LstBuildConfigFileUpdater { | |||
ConfigParser configParser = new ConfigParser(); | |||
configParser.parseConfigFile(new File(path)); | |||
List<File> files = configParser.getFiles(); | |||
List<String> relativeFiles = new ArrayList<String>(); | |||
List<String> relativeFiles = new ArrayList<>(); | |||
for (File file : files) { | |||
relativeFiles.add(relativizePath(file.getPath(), rootPath)); | |||
} | |||
return relativeFiles; | |||
} catch (ConfigParser.ParseException pe) { | |||
return new ArrayList<String>(); | |||
return new ArrayList<>(); | |||
} | |||
} | |||
@@ -39,7 +39,7 @@ public class LstBuildConfigManager implements BuildConfigManager { | |||
private List<String> allBuildConfigFiles; | |||
private List<BuildConfigListener> listeners = new ArrayList<BuildConfigListener>(); | |||
private List<BuildConfigListener> listeners = new ArrayList<>(); | |||
private LstBuildConfigFileUpdater fileUpdater = new LstBuildConfigFileUpdater(); | |||
protected String currConfigFilePath = null; | |||
@@ -63,8 +63,8 @@ public class LstBuildConfigManager implements BuildConfigManager { | |||
String rootPath = configFile.getParent(); | |||
String configFileName = configFile.getName(); | |||
BuildConfigModel model = new BuildConfigModel(configFilePath); | |||
List<File> configFiles = new ArrayList<File>(); | |||
List<File> importedFiles = new ArrayList<File>(); | |||
List<File> configFiles = new ArrayList<>(); | |||
List<File> importedFiles = new ArrayList<>(); | |||
List<String> badEntries = null; | |||
try { | |||
LstBuildConfigFileParser configParser = new LstBuildConfigFileParser(configFilePath); | |||
@@ -134,7 +134,7 @@ public class LstBuildConfigManager implements BuildConfigManager { | |||
} | |||
private List<String> relativizeFilePaths(List<File> configFiles, String rootPath) { | |||
List<String> relativePathsList = new ArrayList<String>(); | |||
List<String> relativePathsList = new ArrayList<>(); | |||
for (File file : configFiles) { | |||
relativePathsList.add(fileUpdater.relativizePath(file.getPath(), rootPath)); | |||
} | |||
@@ -308,7 +308,7 @@ public class LstBuildConfigManager implements BuildConfigManager { | |||
@Override | |||
public List<String> getAllBuildConfigFiles() { | |||
if (allBuildConfigFiles == null) { | |||
allBuildConfigFiles = new ArrayList<String>(); | |||
allBuildConfigFiles = new ArrayList<>(); | |||
if (getActiveConfigFile() != null) { | |||
allBuildConfigFiles.add(getActiveConfigFile()); | |||
} |
@@ -71,7 +71,7 @@ public class BuildConfigModel { | |||
} | |||
public List<BuildConfigNode> getActiveNodes(BuildConfigNode.Kind kind) { | |||
List<BuildConfigNode> nodes = new ArrayList<BuildConfigNode>(); | |||
List<BuildConfigNode> nodes = new ArrayList<>(); | |||
getActiveNodesHelper(root, kind, nodes); | |||
return nodes; | |||
} |
@@ -33,7 +33,7 @@ public class BuildConfigNode { | |||
protected String name = ""; | |||
protected Kind kind; | |||
// children.listIterator() should support remove() operation | |||
protected List<BuildConfigNode> children = new ArrayList<BuildConfigNode>(); | |||
protected List<BuildConfigNode> children = new ArrayList<>(); | |||
protected IMessage message = null; | |||
protected ISourceLocation sourceLocation = null; | |||
@@ -78,7 +78,7 @@ public class BuildConfigNode { | |||
public void addChild(BuildConfigNode child) { | |||
if (children == null) { | |||
children = new ArrayList<BuildConfigNode>(); | |||
children = new ArrayList<>(); | |||
} | |||
children.add(child); | |||
child.setParent(this); | |||
@@ -86,7 +86,7 @@ public class BuildConfigNode { | |||
public void addChild(int position, BuildConfigNode child) { | |||
if (children == null) { | |||
children = new ArrayList<BuildConfigNode>(); | |||
children = new ArrayList<>(); | |||
} | |||
children.add(position, child); | |||
child.setParent(this); |
@@ -103,7 +103,7 @@ public class JavaDebugOptionsPanel extends OptionsPanel { | |||
JComboBox<String> debug = null; | |||
if (javaOptionToSet.equals(JavaOptions.PRESERVE_ALL_LOCALS)) { | |||
debug = new JComboBox<String>(preserveOptions); | |||
debug = new JComboBox<>(preserveOptions); | |||
String value = javaBuildOptions.getJavaBuildOptionsMap().get(javaOptionToSet); | |||
if (value.equals(JavaOptions.PRESERVE)) { | |||
debug.setSelectedIndex(0); | |||
@@ -111,7 +111,7 @@ public class JavaDebugOptionsPanel extends OptionsPanel { | |||
debug.setSelectedIndex(1); | |||
} | |||
} else { | |||
debug = new JComboBox<String>(debugOptions); | |||
debug = new JComboBox<>(debugOptions); | |||
String value = javaBuildOptions.getJavaBuildOptionsMap().get(javaOptionToSet); | |||
if (value.equals(JavaOptions.GENERATE)) { | |||
debug.setSelectedIndex(0); |
@@ -48,7 +48,7 @@ class HtmlDecorator { | |||
private static final String ITD_FIELD_SUMMARY = "Inter-Type Field Summary"; | |||
private static final String ITD_CONSTRUCTOR_SUMMARY = "Inter-Type Constructor Summary"; | |||
static List<String> visibleFileList = new ArrayList<String>(); | |||
static List<String> visibleFileList = new ArrayList<>(); | |||
static Hashtable declIDTable = null; | |||
static File rootDir = null; | |||
static String docVisibilityModifier; | |||
@@ -295,9 +295,9 @@ class HtmlDecorator { | |||
} | |||
static void addAspectDocumentation(IProgramElement node, StringBuffer fileBuffer, int index) { | |||
List<IProgramElement> pointcuts = new ArrayList<IProgramElement>(); | |||
List<IProgramElement> advice = new ArrayList<IProgramElement>(); | |||
List<IProgramElement> declares = new ArrayList<IProgramElement>(); | |||
List<IProgramElement> pointcuts = new ArrayList<>(); | |||
List<IProgramElement> advice = new ArrayList<>(); | |||
List<IProgramElement> declares = new ArrayList<>(); | |||
List<IProgramElement> methodsDeclaredOn = StructureUtil.getDeclareInterTypeTargets(node, IProgramElement.Kind.INTER_TYPE_METHOD); | |||
if (methodsDeclaredOn != null && !methodsDeclaredOn.isEmpty()) { | |||
insertDeclarationsSummary(fileBuffer, methodsDeclaredOn, ITD_METHOD_SUMMARY, index); |
@@ -86,13 +86,13 @@ public class Main implements Config { | |||
private static String outputWorkingDir = Config.WORKING_DIR; | |||
public static void clearState() { | |||
options = new Vector<String>(); | |||
ajcOptions = new Vector<String>(); | |||
filenames = new Vector<String>(); | |||
fileList = new Vector<String>(); | |||
packageList = new Vector<String>(); | |||
options = new Vector<>(); | |||
ajcOptions = new Vector<>(); | |||
filenames = new Vector<>(); | |||
fileList = new Vector<>(); | |||
packageList = new Vector<>(); | |||
docModifier = "package"; | |||
sourcepath = new Vector<String>(); | |||
sourcepath = new Vector<>(); | |||
verboseMode = false; | |||
packageMode = false; | |||
rootDir = null; | |||
@@ -170,7 +170,7 @@ public class Main implements Config { | |||
* package-summary properly. | |||
*/ | |||
private static void packageHTML(AsmManager model, File[] inputFiles) throws IOException { | |||
ArrayList<String> dirList = new ArrayList<String>(); | |||
ArrayList<String> dirList = new ArrayList<>(); | |||
for (File inputFile : inputFiles) { | |||
String packageName = StructureUtil.getPackageDeclarationFromFile(model, inputFile); | |||
// Only copy the package.html file once. | |||
@@ -239,7 +239,7 @@ public class Main implements Config { | |||
System.out.println("> Calling javadoc..."); | |||
String[] javadocargs = null; | |||
List<String> files = new ArrayList<String>(); | |||
List<String> files = new ArrayList<>(); | |||
if (packageMode) { | |||
int numExtraArgs = 2; | |||
if (authorStandardDocletSwitch) | |||
@@ -268,7 +268,7 @@ public class Main implements Config { | |||
javadocargs[numExtraArgs + options.size() + packageList.size() + k] = fileList.elementAt(k); | |||
} | |||
if (LangUtil.is19VMOrGreater()) { | |||
options = new Vector<String>(); | |||
options = new Vector<>(); | |||
for (String a: javadocargs) { | |||
options.add(a); | |||
} | |||
@@ -362,7 +362,7 @@ public class Main implements Config { | |||
} | |||
static Vector<String> getSourcePath() { | |||
Vector<String> sourcePath = new Vector<String>(); | |||
Vector<String> sourcePath = new Vector<>(); | |||
boolean found = false; | |||
for (int i = 0; i < options.size(); i++) { | |||
String currOption = options.elementAt(i); | |||
@@ -471,7 +471,7 @@ public class Main implements Config { | |||
String line = ""; | |||
line = br.readLine(); | |||
StringTokenizer st = new StringTokenizer(line, " "); | |||
List<String> argList = new ArrayList<String>(); | |||
List<String> argList = new ArrayList<>(); | |||
while (st.hasMoreElements()) { | |||
argList.add(st.nextToken()); | |||
} | |||
@@ -490,7 +490,7 @@ public class Main implements Config { | |||
ioe.printStackTrace(); | |||
} | |||
} | |||
List<String> vargs = new LinkedList<String>(Arrays.asList(args)); | |||
List<String> vargs = new LinkedList<>(Arrays.asList(args)); | |||
vargs.add("-Xset:minimalModel=false"); | |||
parseArgs(vargs, new File(".")); // !!! | |||
@@ -722,7 +722,7 @@ public class Main implements Config { | |||
} | |||
static void expandAtSignFile(String filename, File currentWorkingDir) { | |||
List<String> result = new LinkedList<String>(); | |||
List<String> result = new LinkedList<>(); | |||
File atFile = qualifiedFile(filename, currentWorkingDir); | |||
String atFileParent = atFile.getParent(); |
@@ -42,7 +42,7 @@ public class StructureUtil { | |||
* @return null if a relationship of that kind is not found | |||
*/ | |||
public static List<String> getTargets(IProgramElement node, IRelationship.Kind kind, String relName) { | |||
List<IRelationship> relations = new ArrayList<IRelationship>(); | |||
List<IRelationship> relations = new ArrayList<>(); | |||
List<IRelationship> rels = node.getModel().getRelationshipMap().get(node); | |||
if (rels != null) { | |||
relations.addAll(rels); | |||
@@ -64,7 +64,7 @@ public class StructureUtil { | |||
} | |||
if (relations == null || relations.isEmpty()) | |||
return null; | |||
List<String> targets = new ArrayList<String>(); | |||
List<String> targets = new ArrayList<>(); | |||
for (IRelationship rtn : relations) { | |||
if (rtn.getKind().equals(kind) && ((relName != null && relName.equals(rtn.getName())) || relName == null)) { | |||
List<String> targs = rtn.getTargets(); | |||
@@ -79,7 +79,7 @@ public class StructureUtil { | |||
} | |||
static List<IProgramElement> getDeclareInterTypeTargets(IProgramElement node, IProgramElement.Kind kind) { | |||
List<IProgramElement> targets = new ArrayList<IProgramElement>(); | |||
List<IProgramElement> targets = new ArrayList<>(); | |||
List<String> stringTargets = StructureUtil.getTargets(node, IRelationship.Kind.DECLARE_INTER_TYPE); | |||
if (stringTargets == null) { | |||
return null; |
@@ -60,7 +60,7 @@ public class AjdocOutputChecker { | |||
* @throws Exception | |||
*/ | |||
public static List<String> getMissingStringsInFile(File htmlFile, String[] requiredStrings) throws Exception { | |||
List<String> missingStrings = new ArrayList<String>(); | |||
List<String> missingStrings = new ArrayList<>(); | |||
for (String string : requiredStrings) { | |||
if (!containsString(htmlFile, string)) { | |||
missingStrings.add(string); | |||
@@ -120,7 +120,7 @@ public class AjdocOutputChecker { | |||
*/ | |||
public static List<String> getMissingStringsInSection(File htmlFile, | |||
String[] requiredStrings, String sectionHeader) throws Exception { | |||
List<String> missingStrings = new ArrayList<String>(); | |||
List<String> missingStrings = new ArrayList<>(); | |||
for (String string : requiredStrings) { | |||
if (!containsStringWithinSection(htmlFile, string, sectionHeader)) { | |||
missingStrings.add(string); |
@@ -73,7 +73,7 @@ public class AsmManager implements IStructureModel { | |||
private static boolean completingTypeBindings = false; | |||
private final List<IHierarchyListener> structureListeners = new ArrayList<IHierarchyListener>(); | |||
private final List<IHierarchyListener> structureListeners = new ArrayList<>(); | |||
// The model is 'manipulated' by the AjBuildManager.setupModel() code which | |||
// trashes all the | |||
@@ -95,10 +95,10 @@ public class AsmManager implements IStructureModel { | |||
private final CanonicalFilePathMap canonicalFilePathMap = new CanonicalFilePathMap(); | |||
// Record the Set<File> for which the model has been modified during the | |||
// last incremental build | |||
private final Set<File> lastBuildChanges = new HashSet<File>(); | |||
private final Set<File> lastBuildChanges = new HashSet<>(); | |||
// Record the Set<File> of aspects that wove the files listed in lastBuildChanges | |||
final Set<File> aspectsWeavingInLastBuild = new HashSet<File>(); | |||
final Set<File> aspectsWeavingInLastBuild = new HashSet<>(); | |||
// static { | |||
// setReporting("c:/model.nfo",true,true,true,true); | |||
@@ -149,16 +149,16 @@ public class AsmManager implements IStructureModel { | |||
return null; | |||
} | |||
HashMap<Integer, List<IProgramElement>> annotations = new HashMap<Integer, List<IProgramElement>>(); | |||
HashMap<Integer, List<IProgramElement>> annotations = new HashMap<>(); | |||
IProgramElement node = hierarchy.findElementForSourceFile(sourceFile); | |||
if (node == IHierarchy.NO_STRUCTURE) { | |||
return null; | |||
} else { | |||
IProgramElement fileNode = node; | |||
ArrayList<IProgramElement> peNodes = new ArrayList<IProgramElement>(); | |||
ArrayList<IProgramElement> peNodes = new ArrayList<>(); | |||
getAllStructureChildren(fileNode, peNodes, showSubMember, showMemberAndType); | |||
for (IProgramElement peNode : peNodes) { | |||
List<IProgramElement> entries = new ArrayList<IProgramElement>(); | |||
List<IProgramElement> entries = new ArrayList<>(); | |||
entries.add(peNode); | |||
ISourceLocation sourceLoc = peNode.getSourceLocation(); | |||
if (null != sourceLoc) { | |||
@@ -296,7 +296,7 @@ public class AsmManager implements IStructureModel { | |||
private static class CanonicalFilePathMap { | |||
private static final int MAX_SIZE = 4000; | |||
private final Map<String, String> pathMap = new HashMap<String, String>(20); | |||
private final Map<String, String> pathMap = new HashMap<>(20); | |||
// // guards to ensure correctness and liveness | |||
// private boolean cacheInUse = false; | |||
@@ -549,7 +549,7 @@ public class AsmManager implements IStructureModel { | |||
boolean modelModified = false; | |||
Set<String> deletedNodes = new HashSet<String>(); | |||
Set<String> deletedNodes = new HashSet<>(); | |||
for (File fileForCompilation : files) { | |||
String correctedPath = getCanonicalFilePath(fileForCompilation); | |||
IProgramElement progElem = (IProgramElement) hierarchy.findInFileMap(correctedPath); | |||
@@ -690,15 +690,15 @@ public class AsmManager implements IStructureModel { | |||
return; | |||
} | |||
Set<String> sourcesToRemove = new HashSet<String>(); | |||
Map<String, String> handleToTypenameCache = new HashMap<String, String>(); | |||
Set<String> sourcesToRemove = new HashSet<>(); | |||
Map<String, String> handleToTypenameCache = new HashMap<>(); | |||
// Iterate over the source handles in the relationships map, the aim | |||
// here is to remove any 'affected by' | |||
// relationships where the source of the relationship is the specified | |||
// type (since it will be readded | |||
// when the type is woven) | |||
Set<String> sourcehandlesSet = mapper.getEntries(); | |||
List<IRelationship> relationshipsToRemove = new ArrayList<IRelationship>(); | |||
List<IRelationship> relationshipsToRemove = new ArrayList<>(); | |||
for (String hid : sourcehandlesSet) { | |||
if (isPhantomHandle(hid)) { | |||
// inpath handle - but for which type? | |||
@@ -780,7 +780,7 @@ public class AsmManager implements IStructureModel { | |||
continue; | |||
} | |||
List<String> targets = rel.getTargets(); | |||
List<String> targetsToRemove = new ArrayList<String>(); | |||
List<String> targetsToRemove = new ArrayList<>(); | |||
// find targets that target the type we are interested in, | |||
// they need removing | |||
@@ -928,8 +928,8 @@ public class AsmManager implements IStructureModel { | |||
// Now sort out the relationships map | |||
// IRelationshipMap irm = AsmManager.getDefault().getRelationshipMap(); | |||
Set<String> sourcesToRemove = new HashSet<String>(); | |||
Set<String> nonExistingHandles = new HashSet<String>(); // Cache of handles that we | |||
Set<String> sourcesToRemove = new HashSet<>(); | |||
Set<String> nonExistingHandles = new HashSet<>(); // Cache of handles that we | |||
// *know* are invalid | |||
// int srchandlecounter = 0; | |||
// int tgthandlecounter = 0; | |||
@@ -956,12 +956,12 @@ public class AsmManager implements IStructureModel { | |||
} else { | |||
// Ok, so the source is valid, what about the targets? | |||
List<IRelationship> relationships = mapper.get(hid); | |||
List<IRelationship> relationshipsToRemove = new ArrayList<IRelationship>(); | |||
List<IRelationship> relationshipsToRemove = new ArrayList<>(); | |||
// Iterate through the relationships against this source | |||
// handle | |||
for (IRelationship rel : relationships) { | |||
List<String> targets = rel.getTargets(); | |||
List<String> targetsToRemove = new ArrayList<String>(); | |||
List<String> targetsToRemove = new ArrayList<>(); | |||
// Iterate through the targets for this relationship | |||
for (String targethid : targets) { | |||
@@ -1168,7 +1168,7 @@ public class AsmManager implements IStructureModel { | |||
* A ModelInfo object captures basic information about the structure model. It is used for testing and producing debug info. | |||
*/ | |||
public static class ModelInfo { | |||
private final Hashtable<String, Integer> nodeTypeCount = new Hashtable<String, Integer>(); | |||
private final Hashtable<String, Integer> nodeTypeCount = new Hashtable<>(); | |||
private final Properties extraProperties = new Properties(); | |||
private ModelInfo(IHierarchy hierarchy, IRelationshipMap relationshipMap) { |
@@ -349,7 +349,7 @@ public interface IProgramElement extends Serializable { | |||
} | |||
public static List<Kind> getNonAJMemberKinds() { | |||
List<Kind> list = new ArrayList<Kind>(); | |||
List<Kind> list = new ArrayList<>(); | |||
list.add(METHOD); | |||
list.add(ENUM_VALUE); | |||
list.add(FIELD); |
@@ -43,7 +43,7 @@ public class AspectJElementHierarchy implements IHierarchy { | |||
// Access to the handleMap and typeMap are now synchronized - at least the find methods and the updateHandleMap function | |||
// see pr305788 | |||
private Map<String, IProgramElement> fileMap = null; | |||
private Map<String, IProgramElement> handleMap = new HashMap<String, IProgramElement>(); | |||
private Map<String, IProgramElement> handleMap = new HashMap<>(); | |||
private Map<String, IProgramElement> typeMap = null; | |||
public AspectJElementHierarchy(AsmManager asm) { | |||
@@ -84,8 +84,8 @@ public class AspectJElementHierarchy implements IHierarchy { | |||
public void setRoot(IProgramElement root) { | |||
this.root = root; | |||
handleMap = new HashMap<String, IProgramElement>(); | |||
typeMap = new HashMap<String, IProgramElement>(); | |||
handleMap = new HashMap<>(); | |||
typeMap = new HashMap<>(); | |||
} | |||
public void addToFileMap(String key, IProgramElement value) { | |||
@@ -230,7 +230,7 @@ public class AspectJElementHierarchy implements IHierarchy { | |||
if ((children.get(0)).getKind() == IProgramElement.Kind.SOURCE_FOLDER) { | |||
String searchPackageName = (packagename == null ? "" : packagename); // default package means match on "" | |||
// dealing with source folders | |||
List<IProgramElement> matchingPackageNodes = new ArrayList<IProgramElement>(); | |||
List<IProgramElement> matchingPackageNodes = new ArrayList<>(); | |||
for (IProgramElement sourceFolder : children) { | |||
List<IProgramElement> possiblePackageNodes = sourceFolder.getChildren(); | |||
for (IProgramElement possiblePackageNode : possiblePackageNodes) { | |||
@@ -248,11 +248,11 @@ public class AspectJElementHierarchy implements IHierarchy { | |||
// thing to return in the list | |||
if (packagename == null) { | |||
// default package | |||
List<IProgramElement> result = new ArrayList<IProgramElement>(); | |||
List<IProgramElement> result = new ArrayList<>(); | |||
result.add(root); | |||
return result; | |||
} | |||
List<IProgramElement> result = new ArrayList<IProgramElement>(); | |||
List<IProgramElement> result = new ArrayList<>(); | |||
for (IProgramElement possiblePackage : children) { | |||
if (possiblePackage.getKind() == IProgramElement.Kind.PACKAGE && possiblePackage.getName().equals(packagename)) { | |||
result.add(possiblePackage); | |||
@@ -643,7 +643,7 @@ public class AspectJElementHierarchy implements IHierarchy { | |||
// TODO rename this method ... it does more than just the handle map | |||
public void updateHandleMap(Set<String> deletedFiles) { | |||
// Only delete the entries we need to from the handle map - for performance reasons | |||
List<String> forRemoval = new ArrayList<String>(); | |||
List<String> forRemoval = new ArrayList<>(); | |||
Set<String> k = null; | |||
synchronized (this) { | |||
k = handleMap.keySet(); |
@@ -223,7 +223,7 @@ public class ProgramElement implements IProgramElement { | |||
} | |||
private static List<IProgramElement.Modifiers> genModifiers(int modifiers) { | |||
List<IProgramElement.Modifiers> modifiersList = new ArrayList<IProgramElement.Modifiers>(); | |||
List<IProgramElement.Modifiers> modifiersList = new ArrayList<>(); | |||
if ((modifiers & AccStatic) != 0) { | |||
modifiersList.add(IProgramElement.Modifiers.STATIC); | |||
} | |||
@@ -551,7 +551,7 @@ public class ProgramElement implements IProgramElement { | |||
public void addChild(IProgramElement child) { | |||
if (children == null || children == Collections.EMPTY_LIST) { | |||
children = new ArrayList<IProgramElement>(); | |||
children = new ArrayList<>(); | |||
} | |||
children.add(child); | |||
child.setParent(this); | |||
@@ -559,7 +559,7 @@ public class ProgramElement implements IProgramElement { | |||
public void addChild(int position, IProgramElement child) { | |||
if (children == null || children == Collections.EMPTY_LIST) { | |||
children = new ArrayList<IProgramElement>(); | |||
children = new ArrayList<>(); | |||
} | |||
children.add(position, child); | |||
child.setParent(this); | |||
@@ -750,7 +750,7 @@ public class ProgramElement implements IProgramElement { | |||
if (l == null || l.isEmpty()) { | |||
return Collections.emptyList(); | |||
} | |||
List<char[]> params = new ArrayList<char[]>(); | |||
List<char[]> params = new ArrayList<>(); | |||
for (char[] param : l) { | |||
params.add(NameConvertor.convertFromSignature(param)); | |||
} | |||
@@ -805,7 +805,7 @@ public class ProgramElement implements IProgramElement { | |||
private void fixMap() { | |||
if (kvpairs == Collections.EMPTY_MAP) { | |||
kvpairs = new HashMap<String, Object>(); | |||
kvpairs = new HashMap<>(); | |||
} | |||
} | |||
@@ -55,8 +55,8 @@ public class RelationshipMap extends HashMap<String, List<IRelationship>> implem | |||
if (!createIfMissing) { | |||
return null; | |||
} | |||
relationships = new ArrayList<IRelationship>(); | |||
IRelationship rel = new Relationship(relationshipName, kind, source, new ArrayList<String>(), runtimeTest); | |||
relationships = new ArrayList<>(); | |||
IRelationship rel = new Relationship(relationshipName, kind, source, new ArrayList<>(), runtimeTest); | |||
relationships.add(rel); | |||
super.put(source, relationships); | |||
@@ -70,7 +70,7 @@ public class RelationshipMap extends HashMap<String, List<IRelationship>> implem | |||
if (createIfMissing) { | |||
// At this point we did find some relationships for 'source' but not one that looks like what we are | |||
// after (either the kind or the name or the dynamictests setting don't match) | |||
IRelationship rel = new Relationship(relationshipName, kind, source, new ArrayList<String>(), runtimeTest); | |||
IRelationship rel = new Relationship(relationshipName, kind, source, new ArrayList<>(), runtimeTest); | |||
relationships.add(rel); | |||
return rel; | |||
} | |||
@@ -112,7 +112,7 @@ public class RelationshipMap extends HashMap<String, List<IRelationship>> implem | |||
List<IRelationship> existingRelationships = super.get(source); | |||
if (existingRelationships == null) { | |||
// new entry | |||
existingRelationships = new ArrayList<IRelationship>(); | |||
existingRelationships = new ArrayList<>(); | |||
existingRelationships.add(relationship); | |||
super.put(source, existingRelationships); | |||
} else { |
@@ -71,9 +71,9 @@ public class ConstantPool implements Node { | |||
private Constant[] pool; | |||
private int poolSize; // number of entries in the pool (could be < pool.length as the array is resized in 'chunks') | |||
private Map<String, Integer> utf8Cache = new HashMap<String, Integer>(); | |||
private Map<String, Integer> methodCache = new HashMap<String, Integer>(); | |||
private Map<String, Integer> fieldCache = new HashMap<String, Integer>(); | |||
private Map<String, Integer> utf8Cache = new HashMap<>(); | |||
private Map<String, Integer> methodCache = new HashMap<>(); | |||
private Map<String, Integer> fieldCache = new HashMap<>(); | |||
public int getSize() { | |||
return poolSize; |
@@ -167,7 +167,7 @@ public abstract class FieldOrMethod extends Modifiers implements Node { | |||
// remain there. | |||
if (annotations == null) { | |||
// Find attributes that contain annotation data | |||
List<AnnotationGen> accumulatedAnnotations = new ArrayList<AnnotationGen>(); | |||
List<AnnotationGen> accumulatedAnnotations = new ArrayList<>(); | |||
for (Attribute attribute : attributes) { | |||
if (attribute instanceof RuntimeAnnos) { | |||
RuntimeAnnos runtimeAnnotations = (RuntimeAnnos) attribute; |
@@ -286,7 +286,7 @@ public class JavaClass extends Modifiers implements Cloneable, Node { | |||
public AnnotationGen[] getAnnotations() { | |||
if (annotationsOutOfDate) { | |||
// Find attributes that contain annotation data | |||
List<AnnotationGen> accumulatedAnnotations = new ArrayList<AnnotationGen>(); | |||
List<AnnotationGen> accumulatedAnnotations = new ArrayList<>(); | |||
for (Attribute attribute : attributes) { | |||
if (attribute instanceof RuntimeAnnos) { | |||
RuntimeAnnos runtimeAnnotations = (RuntimeAnnos) attribute; | |||
@@ -742,7 +742,7 @@ public class JavaClass extends Modifiers implements Cloneable, Node { | |||
*/ | |||
public JavaClass[] getSuperClasses() { | |||
JavaClass clazz = this; | |||
List<JavaClass> vec = new ArrayList<JavaClass>(); | |||
List<JavaClass> vec = new ArrayList<>(); | |||
for (clazz = clazz.getSuperClass(); clazz != null; clazz = clazz.getSuperClass()) { | |||
vec.add(clazz); | |||
} | |||
@@ -772,8 +772,8 @@ public class JavaClass extends Modifiers implements Cloneable, Node { | |||
* Get all interfaces implemented by this JavaClass (transitively). | |||
*/ | |||
public Collection<JavaClass> getAllInterfaces() { | |||
Queue<JavaClass> queue = new LinkedList<JavaClass>(); | |||
List<JavaClass> interfaceList = new ArrayList<JavaClass>(); | |||
Queue<JavaClass> queue = new LinkedList<>(); | |||
List<JavaClass> interfaceList = new ArrayList<>(); | |||
queue.add(this); | |||
@@ -223,7 +223,7 @@ public final class Method extends FieldOrMethod { | |||
boolean foundSome = false; | |||
// Build a list of annotation arrays, one per argument | |||
if (parameterAnnotationsInvis != null || parameterAnnotationsVis != null) { | |||
List<AnnotationGen[]> annotationsForEachParameter = new ArrayList<AnnotationGen[]>(); | |||
List<AnnotationGen[]> annotationsForEachParameter = new ArrayList<>(); | |||
AnnotationGen[] visibleOnes = null; | |||
AnnotationGen[] invisibleOnes = null; | |||
for (int i = 0; i < parameterCount; i++) { |
@@ -606,7 +606,7 @@ public abstract class Utility { | |||
riaIndex = cp.addUtf8("RuntimeInvisibleAnnotations"); | |||
} | |||
List<RuntimeAnnos> newAttributes = new ArrayList<RuntimeAnnos>(); | |||
List<RuntimeAnnos> newAttributes = new ArrayList<>(); | |||
if (rvaData.length > 2) { | |||
newAttributes.add(new RuntimeVisAnnos(rvaIndex, rvaData.length, rvaData, cp)); | |||
} | |||
@@ -699,7 +699,7 @@ public abstract class Utility { | |||
riaIndex = cp.addUtf8("RuntimeInvisibleParameterAnnotations"); | |||
} | |||
List<RuntimeParamAnnos> newAttributes = new ArrayList<RuntimeParamAnnos>(); | |||
List<RuntimeParamAnnos> newAttributes = new ArrayList<>(); | |||
if (totalVisCount > 0) { | |||
newAttributes.add(new RuntimeVisParamAnnos(rvaIndex, rvaData.length, rvaData, cp)); |
@@ -44,7 +44,7 @@ public class AnnotationGen { | |||
} | |||
private List<NameValuePair> copyValues(List<NameValuePair> in, ConstantPool cpool, boolean copyPoolEntries) { | |||
List<NameValuePair> out = new ArrayList<NameValuePair>(); | |||
List<NameValuePair> out = new ArrayList<>(); | |||
for (NameValuePair nvp : in) { | |||
out.add(new NameValuePair(nvp, cpool, copyPoolEntries)); | |||
} | |||
@@ -89,7 +89,7 @@ public class AnnotationGen { | |||
public void addElementNameValuePair(NameValuePair evp) { | |||
if (pairs == Collections.EMPTY_LIST) { | |||
pairs = new ArrayList<NameValuePair>(); | |||
pairs = new ArrayList<>(); | |||
} | |||
pairs.add(evp); | |||
} |
@@ -34,13 +34,13 @@ public abstract class RuntimeAnnos extends Attribute { | |||
public RuntimeAnnos(byte attrid, boolean visible, int nameIdx, int len, ConstantPool cpool) { | |||
super(attrid, nameIdx, len, cpool); | |||
this.visible = visible; | |||
annotations = new ArrayList<AnnotationGen>(); | |||
annotations = new ArrayList<>(); | |||
} | |||
public RuntimeAnnos(byte attrid, boolean visible, int nameIdx, int len, byte[] data, ConstantPool cpool) { | |||
super(attrid, nameIdx, len, cpool); | |||
this.visible = visible; | |||
annotations = new ArrayList<AnnotationGen>(); | |||
annotations = new ArrayList<>(); | |||
annotation_data = data; | |||
} | |||
@@ -76,7 +76,7 @@ public abstract class RuntimeAnnos extends Attribute { | |||
DataInputStream dis = new DataInputStream(new ByteArrayInputStream(annotation_data)); | |||
int numberOfAnnotations = dis.readUnsignedShort(); | |||
if (numberOfAnnotations > 0) { | |||
List<AnnotationGen> inflatedAnnotations = new ArrayList<AnnotationGen>(); | |||
List<AnnotationGen> inflatedAnnotations = new ArrayList<>(); | |||
for (int i = 0; i < numberOfAnnotations; i++) { | |||
inflatedAnnotations.add(AnnotationGen.read(dis, getConstantPool(), visible)); | |||
} |
@@ -36,13 +36,13 @@ public abstract class RuntimeParamAnnos extends Attribute { | |||
int nameIdx, int len, ConstantPool cpool) { | |||
super(attrid,nameIdx,len,cpool); | |||
this.visible = visible; | |||
parameterAnnotations = new ArrayList<AnnotationGen[]>(); | |||
parameterAnnotations = new ArrayList<>(); | |||
} | |||
public RuntimeParamAnnos(byte attrid,boolean visible,int nameIdx,int len,byte[] data,ConstantPool cpool) { | |||
super(attrid,nameIdx,len,cpool); | |||
this.visible = visible; | |||
parameterAnnotations = new ArrayList<AnnotationGen[]>(); | |||
parameterAnnotations = new ArrayList<>(); | |||
annotation_data = data; | |||
} | |||
@@ -88,7 +88,7 @@ public abstract class RuntimeParamAnnos extends Attribute { | |||
DataInputStream dis = new DataInputStream(new ByteArrayInputStream(annotation_data)); | |||
int numParameters = dis.readUnsignedByte(); | |||
if (numParameters > 0) { | |||
List<AnnotationGen[]> inflatedParameterAnnotations = new ArrayList<AnnotationGen[]>(); | |||
List<AnnotationGen[]> inflatedParameterAnnotations = new ArrayList<>(); | |||
for (int i=0; i<numParameters; i++) { | |||
int numAnnotations = dis.readUnsignedShort(); | |||
if (numAnnotations == 0 ) { |
@@ -97,11 +97,11 @@ public class ClassGen extends Modifiers implements Cloneable { | |||
private int major = Constants.MAJOR_1_1; | |||
private int minor = Constants.MINOR_1_1; | |||
private ConstantPool cpool; | |||
private List<Field> fieldsList = new ArrayList<Field>(); | |||
private List<Method> methodsList = new ArrayList<Method>(); | |||
private List<Attribute> attributesList = new ArrayList<Attribute>(); | |||
private List<String> interfaceList = new ArrayList<String>(); | |||
private List<AnnotationGen> annotationsList = new ArrayList<AnnotationGen>(); | |||
private List<Field> fieldsList = new ArrayList<>(); | |||
private List<Method> methodsList = new ArrayList<>(); | |||
private List<Attribute> attributesList = new ArrayList<>(); | |||
private List<String> interfaceList = new ArrayList<>(); | |||
private List<AnnotationGen> annotationsList = new ArrayList<>(); | |||
public ClassGen(String classname, String superclassname, String filename, int modifiers, String[] interfacenames, | |||
ConstantPool cpool) { | |||
@@ -187,7 +187,7 @@ public class ClassGen extends Modifiers implements Cloneable { | |||
attributes = attributesList; | |||
} else { | |||
// TODO: Sometime later, trash any attributes called 'RuntimeVisibleAnnotations' or 'RuntimeInvisibleAnnotations' | |||
attributes = new ArrayList<Attribute>(); | |||
attributes = new ArrayList<>(); | |||
attributes.addAll(Utility.getAnnotationAttributes(cpool, annotationsList)); | |||
attributes.addAll(attributesList); | |||
} | |||
@@ -503,7 +503,7 @@ public class ClassGen extends Modifiers implements Cloneable { | |||
// (relevant modifiers are ACC_PUBLIC, ACC_PRIVATE, | |||
// ACC_PROTECTED, ACC_STATIC, ACC_FINAL, ACC_VOLATILE, | |||
// ACC_TRANSIENT) | |||
List<Field> relevantFields = new ArrayList<Field>(); | |||
List<Field> relevantFields = new ArrayList<>(); | |||
for (Field field : fieldsList) { | |||
if (!(field.isPrivate() && field.isStatic()) && !(field.isPrivate() && field.isTransient())) { | |||
relevantFields.add(field); | |||
@@ -519,8 +519,8 @@ public class ClassGen extends Modifiers implements Cloneable { | |||
} | |||
// some up front method processing: discover clinit, init and ordinary methods of interest: | |||
List<Method> relevantMethods = new ArrayList<Method>(); | |||
List<Method> relevantCtors = new ArrayList<Method>(); | |||
List<Method> relevantMethods = new ArrayList<>(); | |||
List<Method> relevantCtors = new ArrayList<>(); | |||
boolean hasClinit = false; | |||
for (Method m : methodsList) { | |||
boolean couldBeInitializer = m.getName().charAt(0) == '<'; |
@@ -76,8 +76,8 @@ public abstract class FieldGenOrMethodGen extends Modifiers { | |||
protected String name; | |||
protected Type type; | |||
protected ConstantPool cp; | |||
private ArrayList<Attribute> attributeList = new ArrayList<Attribute>(); | |||
protected ArrayList<AnnotationGen> annotationList = new ArrayList<AnnotationGen>(); | |||
private ArrayList<Attribute> attributeList = new ArrayList<>(); | |||
protected ArrayList<AnnotationGen> annotationList = new ArrayList<>(); | |||
protected FieldGenOrMethodGen() { | |||
} |
@@ -156,7 +156,7 @@ public class InstructionHandle implements java.io.Serializable { | |||
*/ | |||
public void addTargeter(InstructionTargeter t) { | |||
if (targeters == Collections.EMPTY_SET) { | |||
targeters = new HashSet<InstructionTargeter>(); | |||
targeters = new HashSet<>(); | |||
} | |||
targeters.add(t); | |||
} | |||
@@ -170,7 +170,7 @@ public class InstructionHandle implements java.io.Serializable { | |||
} | |||
public Set<InstructionTargeter> getTargetersCopy() { | |||
Set<InstructionTargeter> copy = new HashSet<InstructionTargeter>(); | |||
Set<InstructionTargeter> copy = new HashSet<>(); | |||
copy.addAll(targeters); | |||
return copy; | |||
} |
@@ -690,7 +690,7 @@ public class InstructionList implements Serializable { | |||
return; | |||
} | |||
ArrayList<InstructionHandle> target_vec = new ArrayList<InstructionHandle>(); | |||
ArrayList<InstructionHandle> target_vec = new ArrayList<>(); | |||
for (InstructionHandle ih = first; ih != null; ih = ih.next) { | |||
ih.getInstruction().dispose(); // e.g. BranchInstructions release their targets | |||
@@ -1003,7 +1003,7 @@ public class InstructionList implements Serializable { | |||
*/ | |||
public Instruction[] getInstructions() { | |||
ByteSequence bytes = new ByteSequence(getByteCode()); | |||
ArrayList<Instruction> instructions = new ArrayList<Instruction>(); | |||
ArrayList<Instruction> instructions = new ArrayList<>(); | |||
try { | |||
while (bytes.available() > 0) { | |||
@@ -1089,7 +1089,7 @@ public class InstructionList implements Serializable { | |||
* @return complete, i.e., deep copy of this list | |||
*/ | |||
public InstructionList copy() { | |||
HashMap<InstructionHandle, InstructionHandle> map = new HashMap<InstructionHandle, InstructionHandle>(); | |||
HashMap<InstructionHandle, InstructionHandle> map = new HashMap<>(); | |||
InstructionList il = new InstructionList(); | |||
/* |
@@ -103,11 +103,11 @@ public class MethodGen extends FieldGenOrMethodGen { | |||
private int highestLineNumber = 0; | |||
private ArrayList<LocalVariableGen> localVariablesList = new ArrayList<LocalVariableGen>(); | |||
private ArrayList<LineNumberGen> lineNumbersList = new ArrayList<LineNumberGen>(); | |||
private ArrayList<CodeExceptionGen> exceptionsList = new ArrayList<CodeExceptionGen>(); | |||
private ArrayList<String> exceptionsThrown = new ArrayList<String>(); | |||
private ArrayList<Attribute> codeAttributesList = new ArrayList<Attribute>(); | |||
private ArrayList<LocalVariableGen> localVariablesList = new ArrayList<>(); | |||
private ArrayList<LineNumberGen> lineNumbersList = new ArrayList<>(); | |||
private ArrayList<CodeExceptionGen> exceptionsList = new ArrayList<>(); | |||
private ArrayList<String> exceptionsThrown = new ArrayList<>(); | |||
private ArrayList<Attribute> codeAttributesList = new ArrayList<>(); | |||
private List<AnnotationGen>[] param_annotations; // Array of lists containing AnnotationGen objects | |||
private boolean hasParameterAnnotations = false; | |||
private boolean haveUnpackedParameterAnnotations = false; | |||
@@ -933,8 +933,8 @@ public class MethodGen extends FieldGenOrMethodGen { | |||
} | |||
static final class BranchStack { | |||
Stack<BranchTarget> branchTargets = new Stack<BranchTarget>(); | |||
Hashtable<InstructionHandle, BranchTarget> visitedTargets = new Hashtable<InstructionHandle, BranchTarget>(); | |||
Stack<BranchTarget> branchTargets = new Stack<>(); | |||
Hashtable<InstructionHandle, BranchTarget> visitedTargets = new Hashtable<>(); | |||
public void push(InstructionHandle target, int stackDepth) { | |||
if (visited(target)) { | |||
@@ -1106,7 +1106,7 @@ public class MethodGen extends FieldGenOrMethodGen { | |||
if (!hasParameterAnnotations) { | |||
param_annotations = new List[parameterTypes.length]; | |||
for (int j = 0; j < parameterTypes.length; j++) { | |||
param_annotations[j] = new ArrayList<AnnotationGen>(); | |||
param_annotations[j] = new ArrayList<>(); | |||
} | |||
} | |||
@@ -1139,7 +1139,7 @@ public class MethodGen extends FieldGenOrMethodGen { | |||
} | |||
private List /* AnnotationGen */<AnnotationGen> makeMutableVersion(AnnotationGen[] mutableArray) { | |||
List<AnnotationGen> result = new ArrayList<AnnotationGen>(); | |||
List<AnnotationGen> result = new ArrayList<>(); | |||
for (AnnotationGen annotationGen : mutableArray) { | |||
result.add(new AnnotationGen(annotationGen, getConstantPool(), false)); | |||
} | |||
@@ -1156,7 +1156,7 @@ public class MethodGen extends FieldGenOrMethodGen { | |||
if (existingAnnotations != null) { | |||
existingAnnotations.add(annotation); | |||
} else { | |||
List<AnnotationGen> l = new ArrayList<AnnotationGen>(); | |||
List<AnnotationGen> l = new ArrayList<>(); | |||
l.add(annotation); | |||
param_annotations[parameterIndex] = l; | |||
} |
@@ -113,7 +113,7 @@ public abstract class Type { | |||
public static final Type[] STRINGARRAY6 = new Type[] { STRING, STRING, STRING, STRING, STRING, STRING }; | |||
public static final Type[] STRINGARRAY7 = new Type[] { STRING, STRING, STRING, STRING, STRING, STRING, STRING }; | |||
private static Map<String, Type> commonTypes = new HashMap<String, Type>(); | |||
private static Map<String, Type> commonTypes = new HashMap<>(); | |||
static { | |||
commonTypes.put(STRING.getSignature(), STRING); | |||
@@ -314,7 +314,7 @@ public abstract class Type { | |||
*/ | |||
// OPTIMIZE crap impl | |||
public static Type[] getArgumentTypes(String signature) { | |||
List<Type> argumentTypes = new ArrayList<Type>(); | |||
List<Type> argumentTypes = new ArrayList<>(); | |||
int index; | |||
Type[] types; | |||
@@ -88,8 +88,8 @@ public class ClassLoaderRepository implements Repository { | |||
private ClassLoaderReference loaderRef; | |||
// Choice of cache... | |||
private WeakHashMap<URL, SoftReference<JavaClass>> localCache = new WeakHashMap<URL, SoftReference<JavaClass>>(); | |||
private static SoftHashMap /* <URL,JavaClass> */sharedCache = new SoftHashMap(Collections.synchronizedMap(new HashMap<Object, SpecialValue>())); | |||
private WeakHashMap<URL, SoftReference<JavaClass>> localCache = new WeakHashMap<>(); | |||
private static SoftHashMap /* <URL,JavaClass> */sharedCache = new SoftHashMap(Collections.synchronizedMap(new HashMap<>())); | |||
// For fast translation of the classname *intentionally not static* | |||
private SoftHashMap /* <String,URL> */nameMap = new SoftHashMap(new HashMap(), false); | |||
@@ -216,7 +216,7 @@ public class ClassLoaderRepository implements Repository { | |||
sharedCache.put(url, clazz); | |||
} else { | |||
clazz.setRepository(this); | |||
localCache.put(url, new SoftReference<JavaClass>(clazz)); | |||
localCache.put(url, new SoftReference<>(clazz)); | |||
} | |||
} | |||
@@ -106,7 +106,7 @@ public class ClassPath implements Serializable { | |||
public ClassPath(String class_path) { | |||
this.class_path = class_path; | |||
ArrayList<PathEntry> vec = new ArrayList<PathEntry>(); | |||
ArrayList<PathEntry> vec = new ArrayList<>(); | |||
for (StringTokenizer tok = new StringTokenizer(class_path, System.getProperty("path.separator")); tok | |||
.hasMoreTokens();) { | |||
@@ -193,12 +193,12 @@ public class ClassPath implements Serializable { | |||
String ext_path = System.getProperty("java.ext.dirs"); | |||
String vm_version = System.getProperty("java.version"); | |||
ArrayList<String> list = new ArrayList<String>(); | |||
ArrayList<String> list = new ArrayList<>(); | |||
getPathComponents(class_path, list); | |||
getPathComponents(boot_path, list); | |||
ArrayList<String> dirs = new ArrayList<String>(); | |||
ArrayList<String> dirs = new ArrayList<>(); | |||
getPathComponents(ext_path, dirs); | |||
for (String string : dirs) { |
@@ -96,7 +96,7 @@ public class NonCachingClassLoaderRepository implements Repository { | |||
} | |||
public SoftHashMap() { | |||
this(new HashMap<Object,SpecialValue>()); | |||
this(new HashMap<>()); | |||
} | |||
public SoftHashMap(Map<Object,SpecialValue> map, boolean b) { |
@@ -80,12 +80,12 @@ import org.aspectj.apache.bcel.classfile.JavaClass; | |||
public class SyntheticRepository implements Repository { | |||
private static final String DEFAULT_PATH = ClassPath.getClassPath(); | |||
private static HashMap<ClassPath, SyntheticRepository> _instances = new HashMap<ClassPath, SyntheticRepository>(); // CLASSPATH | |||
private static HashMap<ClassPath, SyntheticRepository> _instances = new HashMap<>(); // CLASSPATH | |||
// X | |||
// REPOSITORY | |||
private ClassPath _path = null; | |||
private WeakHashMap<String, JavaClass> _loadedClasses = new WeakHashMap<String, JavaClass>(); // CLASSNAME X JAVACLASS | |||
private WeakHashMap<String, JavaClass> _loadedClasses = new WeakHashMap<>(); // CLASSNAME X JAVACLASS | |||
private SyntheticRepository(ClassPath path) { | |||
_path = path; |
@@ -64,7 +64,7 @@ public class AnnotationGenTest extends BcelTestCase { | |||
ObjectType t = new ObjectType("SimpleAnnotation"); | |||
List<NameValuePair> elements = new ArrayList<NameValuePair>(); | |||
List<NameValuePair> elements = new ArrayList<>(); | |||
elements.add(nvGen); | |||
// Build an annotation of type 'SimpleAnnotation' with 'id=4' as the only value :) | |||
@@ -91,13 +91,13 @@ public class AnnotationGenTest extends BcelTestCase { | |||
ObjectType t = new ObjectType("SimpleAnnotation"); | |||
List<NameValuePair> elements = new ArrayList<NameValuePair>(); | |||
List<NameValuePair> elements = new ArrayList<>(); | |||
elements.add(nvGen); | |||
// Build a RV annotation of type 'SimpleAnnotation' with 'id=4' as the only value :) | |||
AnnotationGen a = new AnnotationGen(t, elements, true, cp); | |||
Vector<AnnotationGen> v = new Vector<AnnotationGen>(); | |||
Vector<AnnotationGen> v = new Vector<>(); | |||
v.add(a); | |||
Collection<RuntimeAnnos> attributes = Utility.getAnnotationAttributes(cp, v); | |||
boolean foundRV = false; | |||
@@ -113,7 +113,7 @@ public class AnnotationGenTest extends BcelTestCase { | |||
// Build a RIV annotation of type 'SimpleAnnotation' with 'id=4' as the only value :) | |||
AnnotationGen a2 = new AnnotationGen(t, elements, false, cp); | |||
Vector<AnnotationGen> v2 = new Vector<AnnotationGen>(); | |||
Vector<AnnotationGen> v2 = new Vector<>(); | |||
v2.add(a2); | |||
Collection<RuntimeAnnos> attributes2 = Utility.getAnnotationAttributes(cp, v2); | |||
boolean foundRIV = false; |
@@ -93,7 +93,7 @@ public abstract class BcelTestCase extends TestCase { | |||
protected Attribute[] findAttribute(String name, JavaClass clazz) { | |||
Attribute[] all = clazz.getAttributes(); | |||
List<Attribute> chosenAttrsList = new ArrayList<Attribute>(); | |||
List<Attribute> chosenAttrsList = new ArrayList<>(); | |||
for (Attribute attribute : all) { | |||
if (verbose) | |||
System.err.println("Attribute: " + attribute.getName()); | |||
@@ -104,7 +104,7 @@ public abstract class BcelTestCase extends TestCase { | |||
} | |||
protected Attribute findAttribute(String name, Attribute[] all) { | |||
List<Attribute> chosenAttrsList = new ArrayList<Attribute>(); | |||
List<Attribute> chosenAttrsList = new ArrayList<>(); | |||
for (Attribute attribute : all) { | |||
if (verbose) | |||
System.err.println("Attribute: " + attribute.getName()); | |||
@@ -158,7 +158,7 @@ public abstract class BcelTestCase extends TestCase { | |||
SimpleElementValue evg = new SimpleElementValue(ElementValue.STRING, cp, aFruit); | |||
NameValuePair nvGen = new NameValuePair("fruit", evg, cp); | |||
ObjectType t = new ObjectType("SimpleStringAnnotation"); | |||
List<NameValuePair> elements = new ArrayList<NameValuePair>(); | |||
List<NameValuePair> elements = new ArrayList<>(); | |||
elements.add(nvGen); | |||
return new AnnotationGen(t, elements, visibility, cp); | |||
} |
@@ -523,7 +523,7 @@ public class GeneratingAnnotatedClassesTest extends BcelTestCase { | |||
ObjectType t = new ObjectType("SimpleAnnotation"); | |||
List<NameValuePair> elements = new ArrayList<NameValuePair>(); | |||
List<NameValuePair> elements = new ArrayList<>(); | |||
elements.add(nvGen); | |||
AnnotationGen a = new AnnotationGen(t, elements, true, cp); | |||
@@ -534,7 +534,7 @@ public class GeneratingAnnotatedClassesTest extends BcelTestCase { | |||
SimpleElementValue evg = new SimpleElementValue(ElementValue.STRING, cp, aFruit); | |||
NameValuePair nvGen = new NameValuePair("fruit", evg, cp); | |||
ObjectType t = new ObjectType("SimpleStringAnnotation"); | |||
List<NameValuePair> elements = new ArrayList<NameValuePair>(); | |||
List<NameValuePair> elements = new ArrayList<>(); | |||
elements.add(nvGen); | |||
return new AnnotationGen(t, elements, true, cp); | |||
} | |||
@@ -545,7 +545,7 @@ public class GeneratingAnnotatedClassesTest extends BcelTestCase { | |||
ArrayElementValue array = new ArrayElementValue(cp); | |||
array.addElement(new AnnotationElementValue(a, cp)); | |||
NameValuePair nvp = new NameValuePair("value", array, cp); | |||
List<NameValuePair> elements = new ArrayList<NameValuePair>(); | |||
List<NameValuePair> elements = new ArrayList<>(); | |||
elements.add(nvp); | |||
return new AnnotationGen(new ObjectType("CombinedAnnotation"), elements, true, cp); | |||
} | |||
@@ -557,7 +557,7 @@ public class GeneratingAnnotatedClassesTest extends BcelTestCase { | |||
ObjectType t = new ObjectType("SimpleAnnotation"); | |||
List<NameValuePair> elements = new ArrayList<NameValuePair>(); | |||
List<NameValuePair> elements = new ArrayList<>(); | |||
elements.add(nvGen); | |||
AnnotationGen a = new AnnotationGen(t, elements, false, cp); |
@@ -415,7 +415,7 @@ public class GenericSignatureParsingTest extends BcelTestCase { | |||
* @return Array of argument types | |||
*/ | |||
public static final String[] methodSignatureArgumentTypes(String signature,boolean chopit) throws ClassFormatException { | |||
ArrayList<String> vec = new ArrayList<String>(); | |||
ArrayList<String> vec = new ArrayList<>(); | |||
int index; | |||
String[] types; | |||
@@ -121,7 +121,7 @@ public class NonCachingClassLoaderRepositoryTest extends TestCase { | |||
} | |||
public void testConcurrency() throws ClassNotFoundException, InterruptedException { | |||
List<DoneChecker> loaders = new ArrayList<DoneChecker>(); | |||
List<DoneChecker> loaders = new ArrayList<>(); | |||
int i1 = 1000; | |||
for (int i = 0; i < i1; i++) { | |||
DoneChecker loader = new Loader(); |
@@ -551,7 +551,7 @@ public class ParameterAnnotationsTest extends BcelTestCase { | |||
ObjectType t = new ObjectType("SimpleAnnotation"); | |||
List<NameValuePair> elements = new ArrayList<NameValuePair>(); | |||
List<NameValuePair> elements = new ArrayList<>(); | |||
elements.add(nvGen); | |||
AnnotationGen a = new AnnotationGen(t, elements,true, cp); | |||
@@ -564,7 +564,7 @@ public class ParameterAnnotationsTest extends BcelTestCase { | |||
ArrayElementValue array = new ArrayElementValue(cp); | |||
array.addElement(new AnnotationElementValue(a,cp)); | |||
NameValuePair nvp = new NameValuePair("value",array,cp); | |||
List<NameValuePair> elements = new ArrayList<NameValuePair>(); | |||
List<NameValuePair> elements = new ArrayList<>(); | |||
elements.add(nvp); | |||
return new AnnotationGen(new ObjectType("CombinedAnnotation"),elements,true,cp); | |||
} | |||
@@ -577,7 +577,7 @@ public class ParameterAnnotationsTest extends BcelTestCase { | |||
ObjectType t = new ObjectType("SimpleAnnotation"); | |||
List<NameValuePair> elements = new ArrayList<NameValuePair>(); | |||
List<NameValuePair> elements = new ArrayList<>(); | |||
elements.add(nvGen); | |||
AnnotationGen a = new AnnotationGen(t, elements,false, cp); |
@@ -383,7 +383,7 @@ public class RuntimeVisibleAnnotationAttributeTest extends BcelTestCase { | |||
public static List<String> getListOfAnnotationNames(AnnotationGen a) { | |||
List<NameValuePair> l = a.getValues(); | |||
List<String> names = new ArrayList<String>(); | |||
List<String> names = new ArrayList<>(); | |||
for (NameValuePair element : l) { | |||
names.add(element.getNameString()); | |||
} |
@@ -45,7 +45,7 @@ public class AbortException extends RuntimeException { // XXX move porters out, | |||
/** used when message text is null */ | |||
public static final String NO_MESSAGE_TEXT = "AbortException (no message)"; | |||
private static final ArrayList<AbortException> porters = new ArrayList<AbortException>(); | |||
private static final ArrayList<AbortException> porters = new ArrayList<>(); | |||
/** | |||
* Get a porter exception from the pool. Porter exceptions do <b>not</b> have valid stack traces. They are used only to avoid |
@@ -38,7 +38,7 @@ public class CountingMessageHandler implements IMessageHandler { | |||
public CountingMessageHandler(IMessageHandler delegate) { | |||
LangUtil.throwIaxIfNull(delegate, "delegate"); | |||
this.delegate = delegate; | |||
this.counters = new Hashtable<IMessage.Kind, IntHolder>(); | |||
this.counters = new Hashtable<>(); | |||
proxy = (delegate instanceof CountingMessageHandler ? (CountingMessageHandler) delegate : null); | |||
} | |||
@@ -48,8 +48,8 @@ public class MessageHandler implements IMessageHolder { | |||
* @param accumulateOnly the result of handleMessage (i.e., if true, then only accumulate messages - stop processing | |||
*/ | |||
public MessageHandler(boolean accumulateOnly) { | |||
messages = new ArrayList<IMessage>(); | |||
ignoring = new ArrayList<IMessage.Kind>(); | |||
messages = new ArrayList<>(); | |||
ignoring = new ArrayList<>(); | |||
init(accumulateOnly); | |||
ignore(IMessage.WEAVEINFO); // Off by default, need to explicitly be enabled (see -showWeaveInfo) | |||
} | |||
@@ -207,7 +207,7 @@ public class MessageHandler implements IMessageHolder { | |||
if (null == kind) { | |||
return messages.toArray(IMessage.RA_IMessage); | |||
} | |||
ArrayList<IMessage> result = new ArrayList<IMessage>(); | |||
ArrayList<IMessage> result = new ArrayList<>(); | |||
if (!orGreater) { | |||
for (IMessage m : messages) { | |||
if (kind == m.getKind()) { |
@@ -409,7 +409,7 @@ public class MessageUtil { | |||
if (null == kind) { | |||
return messages; | |||
} | |||
ArrayList<IMessage> result = new ArrayList<IMessage>(); | |||
ArrayList<IMessage> result = new ArrayList<>(); | |||
for (IMessage message : messages) { | |||
if (kind == message.getKind()) { | |||
result.add(message); | |||
@@ -478,7 +478,7 @@ public class MessageUtil { | |||
return IMessage.RA_IMessage; | |||
} | |||
LangUtil.throwIaxIfNull(visitor, "visitor"); | |||
ArrayList<IMessage> result = (accumulate ? new ArrayList<IMessage>() : null); | |||
ArrayList<IMessage> result = (accumulate ? new ArrayList<>() : null); | |||
for (IMessage m : messages) { | |||
if (visitor.handleMessage(m)) { | |||
if (accumulate) { |
@@ -87,13 +87,13 @@ public class CompilationAndWeavingContext { | |||
"type munging for @AspectJ aspectOf" }; | |||
// context stacks, one per thread | |||
private static ThreadLocal<Stack<ContextStackEntry>> contextMap = new ThreadLocal<Stack<ContextStackEntry>>(); | |||
private static ThreadLocal<Stack<ContextStackEntry>> contextMap = new ThreadLocal<>(); | |||
// single thread mode stack | |||
private static Stack<ContextStackEntry> contextStack = new Stack<ContextStackEntry>(); | |||
private static Stack<ContextStackEntry> contextStack = new Stack<>(); | |||
// formatters, by phase id | |||
private static Map<Integer, ContextFormatter> formatterMap = new HashMap<Integer, ContextFormatter>(); | |||
private static Map<Integer, ContextFormatter> formatterMap = new HashMap<>(); | |||
private static ContextFormatter defaultFormatter = new DefaultFormatter(); | |||
@@ -131,7 +131,7 @@ public class CompilationAndWeavingContext { | |||
*/ | |||
public static String getCurrentContext() { | |||
Stack<ContextStackEntry> contextStack = getContextStack(); | |||
Stack<String> explanationStack = new Stack<String>(); | |||
Stack<String> explanationStack = new Stack<>(); | |||
for (ContextStackEntry entry : contextStack) { | |||
Object data = entry.getData(); | |||
if (data != null) { | |||
@@ -150,7 +150,7 @@ public class CompilationAndWeavingContext { | |||
public static ContextToken enteringPhase(int phaseId, Object data) { | |||
Stack<ContextStackEntry> contextStack = getContextStack(); | |||
ContextTokenImpl nextToken = nextToken(); | |||
contextStack.push(new ContextStackEntry(nextToken, phaseId, new WeakReference<Object>(data))); | |||
contextStack.push(new ContextStackEntry(nextToken, phaseId, new WeakReference<>(data))); | |||
return nextToken; | |||
} | |||
@@ -183,7 +183,7 @@ public class CompilationAndWeavingContext { | |||
} else { | |||
Stack<ContextStackEntry> contextStack = contextMap.get(); | |||
if (contextStack == null) { | |||
contextStack = new Stack<ContextStackEntry>(); | |||
contextStack = new Stack<>(); | |||
contextMap.set(contextStack); | |||
} | |||
return contextStack; |
@@ -409,7 +409,7 @@ public class AntBuilder extends Builder { | |||
*/ | |||
@Override | |||
protected Result[] getAntecedantResults(Result moduleResult) { | |||
Hashtable<String,Target> targets = new Hashtable<String, Target>(); | |||
Hashtable<String,Target> targets = new Hashtable<>(); | |||
makeTargetsForResult(moduleResult, targets); | |||
String targetName = resultToTargetName(moduleResult); | |||
// bug: doc says topoSort returns String, but returns Target | |||
@@ -419,7 +419,7 @@ public class AntBuilder extends Builder { | |||
if (0 == result.size()) { | |||
return new Result[0]; | |||
} | |||
ArrayList<String> toReturn = new ArrayList<String>(); | |||
ArrayList<String> toReturn = new ArrayList<>(); | |||
for (Target target : result) { | |||
String name = target.getName(); | |||
if (null == name) { |
@@ -83,7 +83,7 @@ public class Checklics extends MatchingTask { | |||
License MPL_ONLY = new License(MPL_ONLY_TAG, LIC_MPL); | |||
License MPL_PARC = new License(MPL_PARC_TAG, LIC_MPL, PARC); | |||
License PARC_COPYRIGHT = new License(PARC_COPYRIGHT_TAG, null, PARC); | |||
LICENSES = new Hashtable<String,License>(); | |||
LICENSES = new Hashtable<>(); | |||
LICENSES.put(APL.tag, APL); | |||
LICENSES.put(MPL.tag, MPL); | |||
LICENSES.put(MPL_PARC.tag, MPL_PARC); | |||
@@ -469,7 +469,7 @@ class HeaderInfo { | |||
this.lastLine = lastLine; | |||
this.file = file; | |||
this.hasLicense = hasLicense; | |||
List<String> newYears = new ArrayList<String>(); | |||
List<String> newYears = new ArrayList<>(); | |||
newYears.addAll(years); | |||
Collections.sort(newYears); | |||
this.years = Collections.unmodifiableList(newYears); | |||
@@ -618,7 +618,7 @@ class Header { | |||
} | |||
public static HeaderInfo checkFile(final File file) { | |||
ArrayList<String> years = new ArrayList<String>(); | |||
ArrayList<String> years = new ArrayList<>(); | |||
int endLine = 0; | |||
BufferedReader input = null; | |||
int lineNum = 0; |
@@ -28,7 +28,7 @@ public abstract class ConditionalTask extends Task { | |||
private List<If> ifs; | |||
protected List<If> ifs() { | |||
return ifs != null ? ifs : (ifs = new Vector<If>()); | |||
return ifs != null ? ifs : (ifs = new Vector<>()); | |||
} | |||
public If createIf() { | |||
@@ -169,7 +169,7 @@ public abstract class ConditionalTask extends Task { | |||
protected List<String> getFalses() { | |||
Iterator<If> iter = ifs().iterator(); | |||
List<String> result = new Vector<String>(); | |||
List<String> result = new Vector<>(); | |||
while (iter.hasNext()) { | |||
If next = iter.next(); | |||
String name = next.getName(); |
@@ -149,7 +149,7 @@ public abstract class Builder { | |||
if ((null == text) || (0 == text.length())) { | |||
return Collections.EMPTY_LIST; | |||
} | |||
List<String> strings = new ArrayList<String>(); | |||
List<String> strings = new ArrayList<>(); | |||
StringTokenizer tok = new StringTokenizer(text, ","); | |||
while (tok.hasMoreTokens()) { | |||
String token = tok.nextToken().trim(); | |||
@@ -275,7 +275,7 @@ public abstract class Builder { | |||
return buildProduct(buildSpec); | |||
} | |||
Result result = specifyResultFor(buildSpec); | |||
ArrayList<String> errors = new ArrayList<String>(); | |||
ArrayList<String> errors = new ArrayList<>(); | |||
try { | |||
return buildAll(result, errors); | |||
} finally { | |||
@@ -340,7 +340,7 @@ public abstract class Builder { | |||
*/ | |||
protected final boolean buildAll(Result result, List<String> errors) { | |||
Result[] buildList = skipUptodate(getAntecedantResults(result)); | |||
ArrayList<String> doneList = new ArrayList<String>(); | |||
ArrayList<String> doneList = new ArrayList<>(); | |||
if ((null != buildList) && (0 < buildList.length)) { | |||
if (isLogging()) { | |||
handler.log("modules to build: " + Arrays.asList(buildList)); | |||
@@ -543,7 +543,7 @@ public abstract class Builder { | |||
* deliverables. | |||
*/ | |||
protected ProductModule[] discoverModules(File productDir, Modules modules) { | |||
final ArrayList<File> found = new ArrayList<File>(); | |||
final ArrayList<File> found = new ArrayList<>(); | |||
FileFilter filter = new FileFilter() {// empty jar files | |||
public boolean accept(File file) { | |||
if ((null != file) && file.canRead() | |||
@@ -555,7 +555,7 @@ public abstract class Builder { | |||
} | |||
}; | |||
Util.visitFiles(productDir, filter); | |||
ArrayList<ProductModule> results = new ArrayList<ProductModule>(); | |||
ArrayList<ProductModule> results = new ArrayList<>(); | |||
for (File file: found) { | |||
String jarName = moduleAliasFor(file.getName().toLowerCase()); | |||
if (jarName.endsWith(".jar") || jarName.endsWith(".zip")) { // XXXFileLiteral |
@@ -69,7 +69,7 @@ public class Module { | |||
/** @return all source files under srcDir */ | |||
private static Iterator<File> sourceFiles(File srcDir) { | |||
ArrayList<File> result = new ArrayList<File>(); | |||
ArrayList<File> result = new ArrayList<>(); | |||
sourceFiles(srcDir, result); | |||
return result.iterator(); | |||
} | |||
@@ -198,11 +198,11 @@ public class Module { | |||
Util.iaxIfNull(name, "name"); | |||
Util.iaxIfNull(modules, "modules"); | |||
this.moduleDir = moduleDir; | |||
this.libJars = new ArrayList<File>(); | |||
this.exportedLibJars = new ArrayList<File>(); | |||
this.requiredModules = new ArrayList<Module>(); | |||
this.srcDirs = new ArrayList<File>(); | |||
this.classpathVariables = new ArrayList<String>(); | |||
this.libJars = new ArrayList<>(); | |||
this.exportedLibJars = new ArrayList<>(); | |||
this.requiredModules = new ArrayList<>(); | |||
this.srcDirs = new ArrayList<>(); | |||
this.classpathVariables = new ArrayList<>(); | |||
this.properties = new Properties(); | |||
this.name = name; | |||
this.modules = modules; | |||
@@ -609,7 +609,7 @@ public class Module { | |||
String[] tokenize(String line) { | |||
final String DELIM = " \n\t\\<>\"="; | |||
StringTokenizer st = new StringTokenizer(line, DELIM, true); | |||
ArrayList<String> result = new ArrayList<String>(); | |||
ArrayList<String> result = new ArrayList<>(); | |||
StringBuffer quote = new StringBuffer(); | |||
boolean inQuote = false; | |||
while (st.hasMoreTokens()) { |
@@ -24,7 +24,7 @@ import java.util.Hashtable; | |||
*/ | |||
public class Modules { | |||
private final Hashtable<String,Module> modules = new Hashtable<String,Module>(); | |||
private final Hashtable<String,Module> modules = new Hashtable<>(); | |||
public final File baseDir; | |||
public final File jarDir; | |||
private final Messager handler; |
@@ -38,7 +38,7 @@ public class Result { | |||
private static final Kind[] KINDS = { RELEASE, TEST, RELEASE_ALL, TEST_ALL }; | |||
private static final HashMap<String,Result> nameToResult = new HashMap<String, Result>(); | |||
private static final HashMap<String,Result> nameToResult = new HashMap<>(); | |||
public static boolean isTestingJar(String name) { | |||
name = name.toLowerCase(); | |||
@@ -177,11 +177,11 @@ public class Result { | |||
Result(Kind kind, Module module, File jarDir) { | |||
this.kind = kind; | |||
this.module = module; | |||
this.libJars = new ArrayList<File>(); | |||
this.exportedLibJars = new ArrayList<File>(); | |||
this.srcDirs = new ArrayList<File>(); | |||
this.classpathVariables = new ArrayList<String>(); | |||
this.requiredResults = new ArrayList<Result>(); | |||
this.libJars = new ArrayList<>(); | |||
this.exportedLibJars = new ArrayList<>(); | |||
this.srcDirs = new ArrayList<>(); | |||
this.classpathVariables = new ArrayList<>(); | |||
this.requiredResults = new ArrayList<>(); | |||
String name = module.name; | |||
if (!kind.normal) { | |||
name += "-test"; | |||
@@ -217,7 +217,7 @@ public class Result { | |||
/** @return List (File) of jar's required */ | |||
public List<File> findJarRequirements() { | |||
ArrayList<File> result = new ArrayList<File>(); | |||
ArrayList<File> result = new ArrayList<>(); | |||
Module.doFindJarRequirements(this, result); | |||
return result; | |||
} |
@@ -404,7 +404,7 @@ class Sample { | |||
* type-safe Collection of samples. | |||
*/ | |||
class Samples { | |||
private ArrayList<Sample> samples = new ArrayList<Sample>(); | |||
private ArrayList<Sample> samples = new ArrayList<>(); | |||
int size() { | |||
return samples.size(); | |||
} | |||
@@ -419,7 +419,7 @@ class Samples { | |||
} | |||
List<Sample> getSortedSamples(Comparator<Sample> comparer) { | |||
ArrayList<Sample> result = new ArrayList<Sample>(); | |||
ArrayList<Sample> result = new ArrayList<>(); | |||
result.addAll(samples); | |||
Collections.sort(result, comparer); | |||
return result; | |||
@@ -966,7 +966,7 @@ class SampleUtil { | |||
} | |||
public static String[] splitAnchorName(String anchorName) { | |||
ArrayList<String> result = new ArrayList<String>(); | |||
ArrayList<String> result = new ArrayList<>(); | |||
int start = 0; | |||
int loc = anchorName.indexOf("-", start); | |||
String next; |
@@ -69,7 +69,7 @@ public class BuildModuleTests extends TestCase { | |||
* @return | |||
*/ | |||
private static File[] findSourceRoots(File moduleDir) { | |||
ArrayList<File> result = new ArrayList<File>(); | |||
ArrayList<File> result = new ArrayList<>(); | |||
for (String name: SOURCE_NAMES) { | |||
File srcDir = new File(moduleDir, name); | |||
if (srcDir.canRead() && srcDir.isDirectory()) { | |||
@@ -198,7 +198,7 @@ public class BuildModuleTests extends TestCase { | |||
// separate check to verify all file types (suffixes) are known | |||
if (!isTestFolder(srcDir)) { | |||
ArrayList<File> unknownFiles = new ArrayList<File>(); | |||
ArrayList<File> unknownFiles = new ArrayList<>(); | |||
UnknownFileCheck.SINGLETON.unknownFiles(srcDir, unknownFiles); | |||
System.out.println(unknownFiles); | |||
if (!unknownFiles.isEmpty()) { | |||
@@ -225,12 +225,12 @@ public class BuildModuleTests extends TestCase { | |||
*/ | |||
static class UnknownFileCheck implements FileFilter { | |||
private static final UnknownFileCheck SINGLETON = new UnknownFileCheck(); | |||
private static final ArrayList<String> STATIC_ERRORS = new ArrayList<String>(); | |||
private static final ArrayList<String> STATIC_ERRORS = new ArrayList<>(); | |||
// Builder.BINARY_SOURCE_PATTERN and Builder.RESOURCE_PATTERN | |||
public static final List<String> KNOWN_SUFFIXES; | |||
static { | |||
List<String> suffixes = new ArrayList<String>(); | |||
List<String> suffixes = new ArrayList<>(); | |||
// sources from org.aspectj.util.FileUtil.SOURCE_SUFFIXES | |||
suffixes.add(".aj"); | |||
suffixes.add(".java"); |
@@ -80,7 +80,7 @@ public class BuildModuleTest extends TestCase { | |||
} | |||
} | |||
ArrayList<File> tempFiles = new ArrayList<File>(); | |||
ArrayList<File> tempFiles = new ArrayList<>(); | |||
private File jarDir; | |||
private boolean deleteJars; | |||
boolean building; // must be enabled for tests to run | |||
@@ -343,7 +343,7 @@ public class BuildModuleTest extends TestCase { | |||
try { | |||
zipFile = new ZipFile(weaverAllJar); | |||
Enumeration e = zipFile.entries(); | |||
ArrayList<String> entryNames = new ArrayList<String>(); | |||
ArrayList<String> entryNames = new ArrayList<>(); | |||
while (e.hasMoreElements()) { | |||
ZipEntry entry = (ZipEntry) e.nextElement(); | |||
String name = entry.getName(); |
@@ -72,7 +72,7 @@ public class ModulesTest extends TestCase { | |||
} | |||
} | |||
ArrayList<File> tempFiles = new ArrayList<File>(); | |||
ArrayList<File> tempFiles = new ArrayList<>(); | |||
public ModulesTest(String name) { | |||
super(name); | |||
@@ -101,7 +101,7 @@ public class ModulesTest extends TestCase { | |||
} | |||
public void testAllModulesCreation() { | |||
ArrayList<Module> badModules = new ArrayList<Module>(); | |||
ArrayList<Module> badModules = new ArrayList<>(); | |||
for (String name: MODULE_NAMES) { | |||
File dir = new File(BASE_DIR, name); | |||
if (dir.isDirectory()) { |
@@ -265,7 +265,7 @@ public class Aj implements ClassPreProcessor { | |||
if (loadersToSkipProperty != null && loadersToSkip == null) { | |||
if (st.hasMoreTokens()) { | |||
// System.out.println("aj.weaving.loadersToSkip is set. Skipping loaders: '"+loadersToSkipProperty+"'"); | |||
loadersToSkip = new ArrayList<String>(); | |||
loadersToSkip = new ArrayList<>(); | |||
} | |||
while (st.hasMoreTokens()) { | |||
String nextLoader = st.nextToken(); | |||
@@ -283,7 +283,7 @@ public class Aj implements ClassPreProcessor { | |||
static class WeaverContainer { | |||
final static Map<AdaptorKey,ExplicitlyInitializedClassLoaderWeavingAdaptor> weavingAdaptors = | |||
Collections.synchronizedMap(new HashMap<AdaptorKey,ExplicitlyInitializedClassLoaderWeavingAdaptor>()); | |||
Collections.synchronizedMap(new HashMap<>()); | |||
static WeavingAdaptor getWeaver(ClassLoader loader, IWeavingContext weavingContext) { | |||
ExplicitlyInitializedClassLoaderWeavingAdaptor adaptor = null; |
@@ -69,33 +69,33 @@ public class ClassLoaderWeavingAdaptor extends WeavingAdaptor { | |||
private boolean initialized; | |||
private List<TypePattern> dumpTypePattern = new ArrayList<TypePattern>(); | |||
private List<TypePattern> dumpTypePattern = new ArrayList<>(); | |||
private boolean dumpBefore = false; | |||
private boolean dumpDirPerClassloader = false; | |||
private boolean hasExcludes = false; | |||
private List<TypePattern> excludeTypePattern = new ArrayList<TypePattern>(); // anything | |||
private List<String> excludeStartsWith = new ArrayList<String>(); // com.foo..* | |||
private List<String> excludeStarDotDotStar = new ArrayList<String>(); // *..*CGLIB* | |||
private List<String> excludeExactName = new ArrayList<String>(); // com.foo.Bar | |||
private List<String> excludeEndsWith = new ArrayList<String>(); // com.foo.Bar | |||
private List<String[]> excludeSpecial = new ArrayList<String[]>(); | |||
private List<TypePattern> excludeTypePattern = new ArrayList<>(); // anything | |||
private List<String> excludeStartsWith = new ArrayList<>(); // com.foo..* | |||
private List<String> excludeStarDotDotStar = new ArrayList<>(); // *..*CGLIB* | |||
private List<String> excludeExactName = new ArrayList<>(); // com.foo.Bar | |||
private List<String> excludeEndsWith = new ArrayList<>(); // com.foo.Bar | |||
private List<String[]> excludeSpecial = new ArrayList<>(); | |||
private boolean hasIncludes = false; | |||
private List<TypePattern> includeTypePattern = new ArrayList<TypePattern>(); | |||
private List<String> includeStartsWith = new ArrayList<String>(); | |||
private List<String> includeExactName = new ArrayList<String>(); | |||
private List<TypePattern> includeTypePattern = new ArrayList<>(); | |||
private List<String> includeStartsWith = new ArrayList<>(); | |||
private List<String> includeExactName = new ArrayList<>(); | |||
private boolean includeStar = false; | |||
private List<TypePattern> aspectExcludeTypePattern = new ArrayList<TypePattern>(); | |||
private List<String> aspectExcludeStartsWith = new ArrayList<String>(); | |||
private List<TypePattern> aspectIncludeTypePattern = new ArrayList<TypePattern>(); | |||
private List<String> aspectIncludeStartsWith = new ArrayList<String>(); | |||
private List<TypePattern> aspectExcludeTypePattern = new ArrayList<>(); | |||
private List<String> aspectExcludeStartsWith = new ArrayList<>(); | |||
private List<TypePattern> aspectIncludeTypePattern = new ArrayList<>(); | |||
private List<String> aspectIncludeStartsWith = new ArrayList<>(); | |||
private StringBuffer namespace; | |||
private IWeavingContext weavingContext; | |||
private List<ConcreteAspectCodeGen> concreteAspects = new ArrayList<ConcreteAspectCodeGen>(); | |||
private List<ConcreteAspectCodeGen> concreteAspects = new ArrayList<>(); | |||
private static Trace trace = TraceFactory.getTraceFactory().getTrace(ClassLoaderWeavingAdaptor.class); | |||
@@ -218,7 +218,7 @@ public class ClassLoaderWeavingAdaptor extends WeavingAdaptor { | |||
* @return | |||
*/ | |||
List<String> getAspectClassNames(List<Definition> definitions) { | |||
List<String> aspects = new LinkedList<String>(); | |||
List<String> aspects = new LinkedList<>(); | |||
for (Definition def : definitions) { | |||
List<String> defAspects = def.getAspectClassNames(); | |||
if (defAspects != null) { | |||
@@ -238,7 +238,7 @@ public class ClassLoaderWeavingAdaptor extends WeavingAdaptor { | |||
trace.enter("parseDefinitions", this); | |||
} | |||
List<Definition> definitions = new ArrayList<Definition>(); | |||
List<Definition> definitions = new ArrayList<>(); | |||
try { | |||
info("register classloader " + getClassLoaderName(loader)); | |||
// TODO av underoptimized: we will parse each XML once per CL that see it | |||
@@ -277,7 +277,7 @@ public class ClassLoaderWeavingAdaptor extends WeavingAdaptor { | |||
Enumeration<URL> xmls = weavingContext.getResources(nextDefinition); | |||
// System.out.println("? registerDefinitions: found-aop.xml=" + xmls.hasMoreElements() + ", loader=" + loader); | |||
Set<URL> seenBefore = new HashSet<URL>(); | |||
Set<URL> seenBefore = new HashSet<>(); | |||
while (xmls.hasMoreElements()) { | |||
URL xml = xmls.nextElement(); | |||
if (trace.isTraceEnabled()) { | |||
@@ -1002,7 +1002,7 @@ public class ClassLoaderWeavingAdaptor extends WeavingAdaptor { | |||
*/ | |||
public void flushGeneratedClasses() { | |||
// System.err.println("? ClassLoaderWeavingAdaptor.flushGeneratedClasses() generatedClasses=" + generatedClasses); | |||
generatedClasses = new HashMap<String, IUnwovenClassFile>(); | |||
generatedClasses = new HashMap<>(); | |||
} | |||
/** |
@@ -218,7 +218,7 @@ public class ConcreteAspectCodeGen { | |||
} | |||
// must have all abstractions defined | |||
List<String> elligibleAbstractions = new ArrayList<String>(); | |||
List<String> elligibleAbstractions = new ArrayList<>(); | |||
Collection<ResolvedMember> abstractMethods = getOutstandingAbstractMethods(parent); | |||
for (ResolvedMember method : abstractMethods) { | |||
@@ -254,7 +254,7 @@ public class ConcreteAspectCodeGen { | |||
} | |||
} | |||
} | |||
List<String> pointcutNames = new ArrayList<String>(); | |||
List<String> pointcutNames = new ArrayList<>(); | |||
for (Definition.Pointcut abstractPc : concreteAspect.pointcuts) { | |||
pointcutNames.add(abstractPc.name); | |||
} | |||
@@ -283,7 +283,7 @@ public class ConcreteAspectCodeGen { | |||
} | |||
private Collection<ResolvedMember> getOutstandingAbstractMethods(ResolvedType type) { | |||
Map<String, ResolvedMember> collector = new HashMap<String, ResolvedMember>(); | |||
Map<String, ResolvedMember> collector = new HashMap<>(); | |||
// let's get to the top of the hierarchy and then walk down ... | |||
// recording abstract methods then removing | |||
// them if they get defined further down the hierarchy | |||
@@ -411,7 +411,7 @@ public class ConcreteAspectCodeGen { | |||
cg.addAnnotation(ag); | |||
} else { | |||
// List elems = new ArrayList(); | |||
List<NameValuePair> elems = new ArrayList<NameValuePair>(); | |||
List<NameValuePair> elems = new ArrayList<>(); | |||
elems.add(new NameValuePair("value", | |||
new SimpleElementValue(ElementValue.STRING, cg.getConstantPool(), perclauseString), cg.getConstantPool())); | |||
AnnotationGen ag = new AnnotationGen(new ObjectType("org/aspectj/lang/annotation/Aspect"), elems, true, | |||
@@ -420,7 +420,7 @@ public class ConcreteAspectCodeGen { | |||
} | |||
if (concreteAspect.precedence != null) { | |||
SimpleElementValue svg = new SimpleElementValue(ElementValue.STRING, cg.getConstantPool(), concreteAspect.precedence); | |||
List<NameValuePair> elems = new ArrayList<NameValuePair>(); | |||
List<NameValuePair> elems = new ArrayList<>(); | |||
elems.add(new NameValuePair("value", svg, cg.getConstantPool())); | |||
AnnotationGen agprec = new AnnotationGen(new ObjectType("org/aspectj/lang/annotation/DeclarePrecedence"), elems, true, | |||
cg.getConstantPool()); | |||
@@ -440,7 +440,7 @@ public class ConcreteAspectCodeGen { | |||
// TODO AV - respect visibility instead of opening up as public? | |||
LazyMethodGen mg = new LazyMethodGen(Modifier.PUBLIC, Type.VOID, abstractPc.name, EMPTY_TYPES, EMPTY_STRINGS, cg); | |||
SimpleElementValue svg = new SimpleElementValue(ElementValue.STRING, cg.getConstantPool(), abstractPc.expression); | |||
List<NameValuePair> elems = new ArrayList<NameValuePair>(); | |||
List<NameValuePair> elems = new ArrayList<>(); | |||
elems.add(new NameValuePair("value", svg, cg.getConstantPool())); | |||
AnnotationGen mag = new AnnotationGen(new ObjectType("org/aspectj/lang/annotation/Pointcut"), elems, true, | |||
cg.getConstantPool()); | |||
@@ -462,7 +462,7 @@ public class ConcreteAspectCodeGen { | |||
FieldGen field = new FieldGen(Modifier.FINAL, ObjectType.STRING, "rule" + (counter++), cg.getConstantPool()); | |||
SimpleElementValue svg = new SimpleElementValue(ElementValue.STRING, cg.getConstantPool(), deow.pointcut); | |||
List<NameValuePair> elems = new ArrayList<NameValuePair>(); | |||
List<NameValuePair> elems = new ArrayList<>(); | |||
elems.add(new NameValuePair("value", svg, cg.getConstantPool())); | |||
AnnotationGen mag = new AnnotationGen(new ObjectType("org/aspectj/lang/annotation/Declare" | |||
+ (deow.isError ? "Error" : "Warning")), elems, true, cg.getConstantPool()); | |||
@@ -601,7 +601,7 @@ public class ConcreteAspectCodeGen { | |||
// Discover the name and name/value pairs | |||
String name = annotationString.substring(0,paren); | |||
// break the rest into pieces based on the commas | |||
List<String> values = new ArrayList<String>(); | |||
List<String> values = new ArrayList<>(); | |||
int pos = paren+1; | |||
int depth = 0; | |||
int len = annotationString.length(); | |||
@@ -776,7 +776,7 @@ public class ConcreteAspectCodeGen { | |||
reportError("declare is using an annotation type that does not have runtime retention: "+typename); | |||
return null; | |||
} | |||
List<NameValuePair> elems = new ArrayList<NameValuePair>(); | |||
List<NameValuePair> elems = new ArrayList<>(); | |||
return new AnnotationGen(new ObjectType(annoname), elems, true, cp); | |||
} | |||
@@ -820,8 +820,8 @@ public class ConcreteAspectCodeGen { | |||
} | |||
// Extract parameter types and names | |||
List<Type> paramTypes = new ArrayList<Type>(); | |||
List<String> paramNames = new ArrayList<String>(); | |||
List<Type> paramTypes = new ArrayList<>(); | |||
List<String> paramNames = new ArrayList<>(); | |||
if (signature.charAt(1) != ')') { | |||
// there are parameters to convert into a signature | |||
StringBuilder convertedSignature = new StringBuilder("("); | |||
@@ -968,7 +968,7 @@ public class ConcreteAspectCodeGen { | |||
*/ | |||
private AnnotationAJ buildAdviceAnnotation(LazyClassGen cg, PointcutAndAdvice paa) { | |||
SimpleElementValue svg = new SimpleElementValue(ElementValue.STRING, cg.getConstantPool(), paa.pointcut); | |||
List<NameValuePair> elems = new ArrayList<NameValuePair>(); | |||
List<NameValuePair> elems = new ArrayList<>(); | |||
elems.add(new NameValuePair("value", svg, cg.getConstantPool())); | |||
AnnotationGen mag = new AnnotationGen(new ObjectType("org/aspectj/lang/annotation/" + paa.adviceKind.toString()), elems, | |||
true, cg.getConstantPool()); |
@@ -686,7 +686,7 @@ public class ClassLoaderWeavingAdaptorTest extends TestCase { | |||
static class TestWeavingContext extends DefaultWeavingContext { | |||
List<Definition> testList = new ArrayList<Definition>(); | |||
List<Definition> testList = new ArrayList<>(); | |||
public TestWeavingContext(ClassLoader loader) { | |||
super(loader); |
@@ -152,10 +152,10 @@ public class BuildArgParser extends Main { | |||
boolean incrementalMode = buildConfig.isIncrementalMode() || buildConfig.isIncrementalFileMode(); | |||
List<File> xmlfileList = new ArrayList<File>(); | |||
List<File> xmlfileList = new ArrayList<>(); | |||
xmlfileList.addAll(parser.getXmlFiles()); | |||
List<File> fileList = new ArrayList<File>(); | |||
List<File> fileList = new ArrayList<>(); | |||
List<File> files = parser.getFiles(); | |||
if (!LangUtil.isEmpty(files)) { | |||
if (incrementalMode) { | |||
@@ -165,7 +165,7 @@ public class BuildArgParser extends Main { | |||
} | |||
} | |||
List<String> javaArgList = new ArrayList<String>(); | |||
List<String> javaArgList = new ArrayList<>(); | |||
// disable all special eclipse warnings by default - why??? | |||
// ??? might want to instead override getDefaultOptions() | |||
javaArgList.add("-warn:none"); | |||
@@ -280,7 +280,7 @@ public class BuildArgParser extends Main { | |||
} | |||
private ArrayList<String> toArrayList(java.util.List<File> files) { | |||
ArrayList<String> arrayList = new ArrayList<String>(); | |||
ArrayList<String> arrayList = new ArrayList<>(); | |||
for (File file: files) { | |||
arrayList.add(file.getAbsolutePath()); | |||
} | |||
@@ -363,7 +363,7 @@ public class BuildArgParser extends Main { | |||
} | |||
public List<String> getBootclasspath(AjcConfigParser parser) { | |||
List<String> ret = new ArrayList<String>(); | |||
List<String> ret = new ArrayList<>(); | |||
if (parser.bootclasspath == null) { | |||
if (LangUtil.is19VMOrGreater()) { | |||
@@ -378,13 +378,13 @@ public class BuildArgParser extends Main { | |||
} | |||
public List<String> getModulepath(AjcConfigParser parser) { | |||
List<String> ret = new ArrayList<String>(); | |||
List<String> ret = new ArrayList<>(); | |||
addClasspath(parser.modulepath, ret); | |||
return ret; | |||
} | |||
public List<String> getModulesourcepath(AjcConfigParser parser) { | |||
List<String> ret = new ArrayList<String>(); | |||
List<String> ret = new ArrayList<>(); | |||
addClasspath(parser.modulesourcepath, ret); | |||
return ret; | |||
} | |||
@@ -565,7 +565,7 @@ public class BuildArgParser extends Main { | |||
buildConfig.setMakeReflectable(true); | |||
} else if (arg.equals("-sourceroots")) { | |||
if (args.size() > nextArgIndex) { | |||
List<File> sourceRoots = new ArrayList<File>(); | |||
List<File> sourceRoots = new ArrayList<>(); | |||
StringTokenizer st = new StringTokenizer(args.get(nextArgIndex).getValue(), | |||
File.pathSeparator); | |||
while (st.hasMoreTokens()) { |
@@ -26,8 +26,8 @@ import java.util.StringTokenizer; | |||
public class ConfigParser { | |||
Location location; | |||
protected File relativeDirectory = null; | |||
protected List<File> files = new LinkedList<File>(); | |||
protected List<File> xmlfiles = new ArrayList<File>(); | |||
protected List<File> files = new LinkedList<>(); | |||
protected List<File> xmlfiles = new ArrayList<>(); | |||
private boolean fileParsed = false; | |||
protected static String CONFIG_MSG = "build config error: "; | |||
@@ -41,7 +41,7 @@ public class ConfigParser { | |||
public void parseCommandLine(String[] argsArray) throws ParseException { | |||
location = new CommandLineLocation(); | |||
LinkedList<Arg> args = new LinkedList<Arg>(); | |||
LinkedList<Arg> args = new LinkedList<>(); | |||
for (String s : argsArray) { | |||
args.add(new Arg(s, location)); | |||
} | |||
@@ -80,7 +80,7 @@ public class ConfigParser { | |||
return; | |||
} | |||
LinkedList<Arg> args = new LinkedList<Arg>(); | |||
LinkedList<Arg> args = new LinkedList<>(); | |||
int lineNum = 0; | |||
try { |
@@ -108,7 +108,7 @@ public class AjPipeliningCompilerAdapter extends AbstractCompilerAdapter { | |||
private IOutputClassFileNameProvider outputFileNameProvider; | |||
private IBinarySourceProvider binarySourceProvider; | |||
private WeaverMessageHandler weaverMessageHandler; | |||
private Map<String, List<UnwovenClassFile>> binarySourceSetForFullWeave = new HashMap<String, List<UnwovenClassFile>>(); | |||
private Map<String, List<UnwovenClassFile>> binarySourceSetForFullWeave = new HashMap<>(); | |||
private ContextToken processingToken = null; | |||
private ContextToken resolvingToken = null; | |||
@@ -118,7 +118,7 @@ public class AjPipeliningCompilerAdapter extends AbstractCompilerAdapter { | |||
private AjState incrementalCompilationState; | |||
// Maintains a list of whats weaving - whilst the pipeline is stalled, this accumulates aspects. | |||
List<InterimCompilationResult> resultsPendingWeave = new ArrayList<InterimCompilationResult>(); | |||
List<InterimCompilationResult> resultsPendingWeave = new ArrayList<>(); | |||
// pipelining info | |||
private boolean pipelineStalled = true; | |||
@@ -200,8 +200,8 @@ public class AjPipeliningCompilerAdapter extends AbstractCompilerAdapter { | |||
} | |||
// Break the units into two lists... | |||
List<CompilationUnitDeclaration> aspects = new ArrayList<CompilationUnitDeclaration>(); | |||
List<CompilationUnitDeclaration> nonaspects = new ArrayList<CompilationUnitDeclaration>(); | |||
List<CompilationUnitDeclaration> aspects = new ArrayList<>(); | |||
List<CompilationUnitDeclaration> nonaspects = new ArrayList<>(); | |||
for (CompilationUnitDeclaration unit : units) { | |||
if (containsAnAspect(unit)) { | |||
aspects.add(unit); | |||
@@ -255,7 +255,7 @@ public class AjPipeliningCompilerAdapter extends AbstractCompilerAdapter { | |||
} | |||
public void beforeCompiling(ICompilationUnit[] sourceUnits) { | |||
resultsPendingWeave = new ArrayList<InterimCompilationResult>(); | |||
resultsPendingWeave = new ArrayList<>(); | |||
reportedErrors = false; | |||
droppingBackToFullBuild = false; | |||
} | |||
@@ -475,7 +475,7 @@ public class AjPipeliningCompilerAdapter extends AbstractCompilerAdapter { | |||
private List<InterimCompilationResult> getBinarySourcesFrom(Map<String, List<UnwovenClassFile>> binarySourceEntries) { | |||
// Map is fileName |-> List<UnwovenClassFile> | |||
List<InterimCompilationResult> ret = new ArrayList<InterimCompilationResult>(); | |||
List<InterimCompilationResult> ret = new ArrayList<>(); | |||
for (String sourceFileName : binarySourceEntries.keySet()) { | |||
List<UnwovenClassFile> unwovenClassFiles = binarySourceEntries.get(sourceFileName); | |||
// XXX - see bugs 57432,58679 - final parameter on next call should be "compiler.options.maxProblemsPerUnit" |
@@ -209,7 +209,7 @@ public class WeaverMessageHandler implements IMessageHandler { | |||
private IProblem[] buildSeeAlsoProblems(IProblem originalProblem, List sourceLocations, CompilationResult problemSource, | |||
boolean usedBinarySourceFileName) { | |||
List<IProblem> ret = new ArrayList<IProblem>(); | |||
List<IProblem> ret = new ArrayList<>(); | |||
for (Object sourceLocation : sourceLocations) { | |||
ISourceLocation loc = (ISourceLocation) sourceLocation; |
@@ -66,7 +66,7 @@ public class AccessForInlineVisitor extends ASTVisitor { | |||
PrivilegedHandler handler; | |||
AspectDeclaration inAspect; | |||
EclipseFactory world; // alias for inAspect.world | |||
private Map<TypeBinding, Map<FieldBinding, ResolvedMember>> alreadyProcessedReceivers = new HashMap<TypeBinding, Map<FieldBinding, ResolvedMember>>(); | |||
private Map<TypeBinding, Map<FieldBinding, ResolvedMember>> alreadyProcessedReceivers = new HashMap<>(); | |||
// set to true for ClassLiteralAccess and AssertStatement | |||
// ??? A better answer would be to transform these into inlinable forms | |||
@@ -174,7 +174,7 @@ public class AccessForInlineVisitor extends ASTVisitor { | |||
// Avoid repeatedly building ResolvedMembers by using info on any done previously in this visitor | |||
Map<FieldBinding, ResolvedMember> alreadyResolvedMembers = alreadyProcessedReceivers.get(receiverType); | |||
if (alreadyResolvedMembers == null) { | |||
alreadyResolvedMembers = new HashMap<FieldBinding, ResolvedMember>(); | |||
alreadyResolvedMembers = new HashMap<>(); | |||
alreadyProcessedReceivers.put(receiverType, alreadyResolvedMembers); | |||
} | |||
ResolvedMember m = alreadyResolvedMembers.get(binding); |
@@ -65,7 +65,7 @@ public class AdviceDeclaration extends AjMethodDeclaration { | |||
public int adviceSequenceNumberInType; | |||
public MethodBinding proceedMethodBinding; // set during this.resolveStaments, referenced by Proceed | |||
public List<Proceed> proceedCalls = new ArrayList<Proceed>(2); // populated during Proceed.findEnclosingAround | |||
public List<Proceed> proceedCalls = new ArrayList<>(2); // populated during Proceed.findEnclosingAround | |||
private boolean proceedInInners; | |||
private ResolvedMember[] proceedCallSignatures; | |||
@@ -80,7 +80,7 @@ public class AdviceDeclaration extends AjMethodDeclaration { | |||
// override | |||
protected int generateInfoAttributes(ClassFile classFile) { | |||
List<EclipseAttributeAdapter> l = new ArrayList<EclipseAttributeAdapter>(1); | |||
List<EclipseAttributeAdapter> l = new ArrayList<>(1); | |||
l.add(new EclipseAttributeAdapter(makeAttribute())); | |||
addDeclarationStartLineAttribute(l, classFile); | |||
return classFile.generateMethodInfoAttributes(binding, l); |
@@ -84,8 +84,8 @@ public class AspectDeclaration extends TypeDeclaration { | |||
public ResolvedMember aspectOfMethod; | |||
public ResolvedMember ptwGetWithinTypeNameMethod; | |||
public ResolvedMember hasAspectMethod; | |||
public Map<ResolvedMember, Binding> accessForInline = new LinkedHashMap<ResolvedMember, Binding>(); | |||
public Map<ResolvedMember, AccessForInlineVisitor.SuperAccessMethodPair> superAccessForInline = new HashMap<ResolvedMember, AccessForInlineVisitor.SuperAccessMethodPair>(); | |||
public Map<ResolvedMember, Binding> accessForInline = new LinkedHashMap<>(); | |||
public Map<ResolvedMember, AccessForInlineVisitor.SuperAccessMethodPair> superAccessForInline = new HashMap<>(); | |||
public boolean isPrivileged; | |||
public EclipseSourceType concreteName; | |||
public ReferenceType typeX; | |||
@@ -418,7 +418,7 @@ public class AspectDeclaration extends TypeDeclaration { | |||
} | |||
protected List<EclipseAttributeAdapter> makeEffectiveSignatureAttribute(ResolvedMember sig, Shadow.Kind kind, boolean weaveBody) { | |||
List<EclipseAttributeAdapter> l = new ArrayList<EclipseAttributeAdapter>(1); | |||
List<EclipseAttributeAdapter> l = new ArrayList<>(1); | |||
l.add(new EclipseAttributeAdapter(new AjAttribute.EffectiveSignatureAttribute(sig, kind, weaveBody))); | |||
return l; | |||
} |
@@ -93,7 +93,7 @@ public class AjLookupEnvironment extends LookupEnvironment implements AnonymousC | |||
public EclipseFactory factory = null; | |||
// private boolean builtInterTypesAndPerClauses = false; | |||
private final List<SourceTypeBinding> pendingTypesToWeave = new ArrayList<SourceTypeBinding>(); | |||
private final List<SourceTypeBinding> pendingTypesToWeave = new ArrayList<>(); | |||
// Q: What are dangerousInterfaces? | |||
// A: An interface is considered dangerous if an ITD has been made upon it | |||
@@ -190,8 +190,8 @@ public class AjLookupEnvironment extends LookupEnvironment implements AnonymousC | |||
// need to build inter-type declarations for all AspectDeclarations at | |||
// this point | |||
// this MUST be done in order from super-types to subtypes | |||
List<SourceTypeBinding> typesToProcess = new ArrayList<SourceTypeBinding>(); | |||
List<SourceTypeBinding> aspectsToProcess = new ArrayList<SourceTypeBinding>(); | |||
List<SourceTypeBinding> typesToProcess = new ArrayList<>(); | |||
List<SourceTypeBinding> aspectsToProcess = new ArrayList<>(); | |||
for (int i = lastCompletedUnitIndex + 1; i <= lastUnitIndex; i++) { | |||
CompilationUnitScope cus = units[i].scope; | |||
SourceTypeBinding[] stbs = cus.topLevelTypes; | |||
@@ -250,7 +250,7 @@ public class AjLookupEnvironment extends LookupEnvironment implements AnonymousC | |||
boolean typeProcessingOrderIsImportant = declareParents.size() > 0 || declareAnnotationOnTypes.size() > 0; // DECAT | |||
if (typeProcessingOrderIsImportant) { | |||
typesToProcess = new ArrayList<SourceTypeBinding>(); | |||
typesToProcess = new ArrayList<>(); | |||
for (int i = lastCompletedUnitIndex + 1; i <= lastUnitIndex; i++) { | |||
CompilationUnitScope cus = units[i].scope; | |||
SourceTypeBinding[] stbs = cus.topLevelTypes; | |||
@@ -259,7 +259,7 @@ public class AjLookupEnvironment extends LookupEnvironment implements AnonymousC | |||
} | |||
} | |||
List<SourceTypeBinding> stb2 = new ArrayList<SourceTypeBinding>(); | |||
List<SourceTypeBinding> stb2 = new ArrayList<>(); | |||
stb2.addAll(typesToProcess); | |||
while (typesToProcess.size() > 0) { | |||
@@ -730,8 +730,8 @@ public class AjLookupEnvironment extends LookupEnvironment implements AnonymousC | |||
// not-exposed to weaver | |||
// messages... | |||
List<DeclareParents> decpToRepeat = new ArrayList<DeclareParents>(); | |||
List<DeclareAnnotation> decaToRepeat = new ArrayList<DeclareAnnotation>(); | |||
List<DeclareParents> decpToRepeat = new ArrayList<>(); | |||
List<DeclareAnnotation> decaToRepeat = new ArrayList<>(); | |||
boolean anyNewParents = false; | |||
boolean anyNewAnnotations = false; | |||
@@ -768,7 +768,7 @@ public class AjLookupEnvironment extends LookupEnvironment implements AnonymousC | |||
} | |||
} | |||
List<Object> forRemoval = new ArrayList<Object>(); | |||
List<Object> forRemoval = new ArrayList<>(); | |||
// now lets loop over and over until we have done all we can | |||
while ((anyNewAnnotations || anyNewParents) && (!decpToRepeat.isEmpty() || !decaToRepeat.isEmpty())) { | |||
anyNewParents = anyNewAnnotations = false; | |||
@@ -927,7 +927,7 @@ public class AjLookupEnvironment extends LookupEnvironment implements AnonymousC | |||
if ((bits & TagBits.AnnotationTargetMASK) == 0) { | |||
return ""; | |||
} | |||
Set<String> s = new HashSet<String>(); | |||
Set<String> s = new HashSet<>(); | |||
if ((bits & TagBits.AnnotationForAnnotationType) != 0) { | |||
s.add("ANNOTATION_TYPE"); | |||
} |
@@ -95,8 +95,8 @@ public class EclipseFactory { | |||
// We can get clashes if we don't treat raw types differently - we end up looking | |||
// up a raw and getting the generic type (pr115788) | |||
private final Map<UnresolvedType, TypeBinding> typexToBinding = new HashMap<UnresolvedType, TypeBinding>(); | |||
private final Map<UnresolvedType, TypeBinding> rawTypeXToBinding = new HashMap<UnresolvedType, TypeBinding>(); | |||
private final Map<UnresolvedType, TypeBinding> typexToBinding = new HashMap<>(); | |||
private final Map<UnresolvedType, TypeBinding> rawTypeXToBinding = new HashMap<>(); | |||
// XXX currently unused | |||
// private Map/*TypeBinding, ResolvedType*/ bindingToResolvedTypeX = new HashMap(); | |||
@@ -361,7 +361,7 @@ public class EclipseFactory { | |||
/** | |||
* Some type variables refer to themselves recursively, this enables us to avoid recursion problems. | |||
*/ | |||
private static Map<TypeVariableBinding,UnresolvedType> typeVariableBindingsInProgress = new HashMap<TypeVariableBinding,UnresolvedType>(); | |||
private static Map<TypeVariableBinding,UnresolvedType> typeVariableBindingsInProgress = new HashMap<>(); | |||
/** | |||
* Convert from the eclipse form of type variable (TypeVariableBinding) to the AspectJ form (TypeVariable). | |||
@@ -462,7 +462,7 @@ public class EclipseFactory { | |||
public void finishTypeMungers() { | |||
// make sure that type mungers are | |||
List<ConcreteTypeMunger> ret = new ArrayList<ConcreteTypeMunger>(); | |||
List<ConcreteTypeMunger> ret = new ArrayList<>(); | |||
List<ConcreteTypeMunger> baseTypeMungers = getWorld().getCrosscuttingMembersSet().getTypeMungers(); | |||
// XXX by Andy: why do we mix up the mungers here? it means later we know about two sets | |||
@@ -533,7 +533,7 @@ public class EclipseFactory { | |||
* Before converting the parts of a methodbinding (params, return type) we store the type variables in this structure, then | |||
* should any component of the method binding refer to them, we grab them from the map. | |||
*/ | |||
private final Map<String,UnresolvedType> typeVariablesForThisMember = new HashMap<String, UnresolvedType>(); | |||
private final Map<String,UnresolvedType> typeVariablesForThisMember = new HashMap<>(); | |||
/** | |||
* This is a map from typevariablebindings (eclipsey things) to the names the user originally specified in their ITD. For | |||
@@ -1003,7 +1003,7 @@ public class EclipseFactory { | |||
// map back to the same type binding - this is important later when Eclipse code is processing | |||
// a methodbinding trying to come up with possible bindings for the type variables. | |||
// key is currently the name of the type variable...is that ok? | |||
private final Map<String,TypeVariableBinding> typeVariableToTypeBinding = new HashMap<String,TypeVariableBinding>(); | |||
private final Map<String,TypeVariableBinding> typeVariableToTypeBinding = new HashMap<>(); | |||
// /** | |||
// * Converts from an TypeVariableReference to a TypeVariableBinding. A TypeVariableReference |
@@ -157,8 +157,8 @@ public class EclipseScope implements IScope { | |||
if (importedNames != null) | |||
return; | |||
List<String> importedNamesList = new ArrayList<String>(); | |||
List<String> importedPrefixesList = new ArrayList<String>(); | |||
List<String> importedNamesList = new ArrayList<>(); | |||
List<String> importedPrefixesList = new ArrayList<>(); | |||
Scope currentScope = scope; | |||
// add any enclosing types to this list |
@@ -101,8 +101,8 @@ public class EclipseSourceType extends AbstractReferenceTypeDelegate { | |||
protected ResolvedMember[] declaredMethods = null; | |||
protected ResolvedMember[] declaredFields = null; | |||
public List<Declare> declares = new ArrayList<Declare>(); | |||
public List<EclipseTypeMunger> typeMungers = new ArrayList<EclipseTypeMunger>(); | |||
public List<Declare> declares = new ArrayList<>(); | |||
public List<EclipseTypeMunger> typeMungers = new ArrayList<>(); | |||
private final EclipseFactory factory; | |||
@@ -258,9 +258,9 @@ public class EclipseSourceType extends AbstractReferenceTypeDelegate { | |||
} | |||
protected void fillDeclaredMembers() { | |||
List<ResolvedMember> declaredPointcuts = new ArrayList<ResolvedMember>(); | |||
List<ResolvedMember> declaredMethods = new ArrayList<ResolvedMember>(); | |||
List<ResolvedMember> declaredFields = new ArrayList<ResolvedMember>(); | |||
List<ResolvedMember> declaredPointcuts = new ArrayList<>(); | |||
List<ResolvedMember> declaredMethods = new ArrayList<>(); | |||
List<ResolvedMember> declaredFields = new ArrayList<>(); | |||
MethodBinding[] ms = binding.methods(); // the important side-effect of this call is to make | |||
// sure bindings are completed | |||
@@ -610,7 +610,7 @@ public class EclipseSourceType extends AbstractReferenceTypeDelegate { | |||
// } | |||
// return targetKind; | |||
if (isAnnotation()) { | |||
List<AnnotationTargetKind> targetKinds = new ArrayList<AnnotationTargetKind>(); | |||
List<AnnotationTargetKind> targetKinds = new ArrayList<>(); | |||
if ((binding.getAnnotationTagBits() & TagBits.AnnotationForAnnotationType) != 0) { | |||
targetKinds.add(AnnotationTargetKind.ANNOTATION_TYPE); |
@@ -30,7 +30,7 @@ import org.aspectj.weaver.UnresolvedType; | |||
public class HelperInterfaceBinding extends SourceTypeBinding { | |||
private UnresolvedType typeX; | |||
SourceTypeBinding enclosingType; | |||
List<MethodBinding> methods = new ArrayList<MethodBinding>(); | |||
List<MethodBinding> methods = new ArrayList<>(); | |||
public HelperInterfaceBinding(SourceTypeBinding enclosingType, UnresolvedType typeX) { | |||
super(); |
@@ -39,8 +39,8 @@ import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.TypeVariableBinding; | |||
* The member finder looks after intertype declared members on a type, there is one member finder per type that was hit by an ITD. | |||
*/ | |||
public class InterTypeMemberFinder implements IMemberFinder { | |||
private List<FieldBinding> interTypeFields = new ArrayList<FieldBinding>(); | |||
private List<MethodBinding> interTypeMethods = new ArrayList<MethodBinding>(); | |||
private List<FieldBinding> interTypeFields = new ArrayList<>(); | |||
private List<MethodBinding> interTypeMethods = new ArrayList<>(); | |||
public SourceTypeBinding sourceTypeBinding; | |||
@@ -254,7 +254,7 @@ public class InterTypeMemberFinder implements IMemberFinder { | |||
MethodBinding[] orig = sourceTypeBinding.methodsBase(); | |||
// if (interTypeMethods.isEmpty()) return orig; | |||
List<MethodBinding> ret = new ArrayList<MethodBinding>(Arrays.asList(orig)); | |||
List<MethodBinding> ret = new ArrayList<>(Arrays.asList(orig)); | |||
for (MethodBinding method : interTypeMethods) { | |||
ret.add(method); | |||
} | |||
@@ -299,7 +299,7 @@ public class InterTypeMemberFinder implements IMemberFinder { | |||
return orig; | |||
} | |||
Set<MethodBinding> ret = new HashSet<MethodBinding>(Arrays.asList(orig)); | |||
Set<MethodBinding> ret = new HashSet<>(Arrays.asList(orig)); | |||
// System.err.println("declared method: " + ret + " inters = " + interTypeMethods); | |||
for (MethodBinding method : interTypeMethods) { |
@@ -96,7 +96,7 @@ public class InterTypeScope extends ClassScope { | |||
TypeVariableBinding tvb = sourceType.typeVariables()[aliased]; | |||
tvb.fPackage = sourceType.fPackage; | |||
if (usedAliases == null) | |||
usedAliases = new HashMap<TypeVariableBinding, String>(); | |||
usedAliases = new HashMap<>(); | |||
usedAliases.put(tvb, variableName); | |||
return tvb; | |||
} else { |
@@ -32,7 +32,7 @@ public class IntertypeMemberTypeFinder implements ITypeFinder { | |||
public SourceTypeBinding targetTypeBinding; | |||
// The new types declared onto the target | |||
private Set<ReferenceBinding> intertypeMemberTypes = new HashSet<ReferenceBinding>(); | |||
private Set<ReferenceBinding> intertypeMemberTypes = new HashSet<>(); | |||
public void addInterTypeMemberType(ReferenceBinding binding) { | |||
intertypeMemberTypes.add(binding); |
@@ -65,16 +65,16 @@ public class PushinCollector { | |||
private String suffix; | |||
// This first collection stores the 'text' for the declarations. | |||
private Map<AbstractMethodDeclaration, RepresentationAndLocation> codeRepresentation = new HashMap<AbstractMethodDeclaration, RepresentationAndLocation>(); | |||
private Map<AbstractMethodDeclaration, RepresentationAndLocation> codeRepresentation = new HashMap<>(); | |||
// This stores the new annotations | |||
private Map<SourceTypeBinding, List<String>> additionalAnnotations = new HashMap<SourceTypeBinding, List<String>>(); | |||
private Map<SourceTypeBinding, List<String>> additionalAnnotations = new HashMap<>(); | |||
// This stores the new parents | |||
private Map<SourceTypeBinding, List<ExactTypePattern>> additionalParents = new HashMap<SourceTypeBinding, List<ExactTypePattern>>(); | |||
private Map<SourceTypeBinding, List<ExactTypePattern>> additionalParents = new HashMap<>(); | |||
// This indicates which types are affected by which intertype declarations | |||
private Map<SourceTypeBinding, List<AbstractMethodDeclaration>> newDeclarations = new HashMap<SourceTypeBinding, List<AbstractMethodDeclaration>>(); | |||
private Map<SourceTypeBinding, List<AbstractMethodDeclaration>> newDeclarations = new HashMap<>(); | |||
private PushinCollector(World world, Properties configuration) { | |||
this.world = world; | |||
@@ -255,7 +255,7 @@ public class PushinCollector { | |||
} | |||
List<AbstractMethodDeclaration> amds = newDeclarations.get(sourceType); | |||
if (amds == null) { | |||
amds = new ArrayList<AbstractMethodDeclaration>(); | |||
amds = new ArrayList<>(); | |||
newDeclarations.put(sourceType, amds); | |||
} | |||
amds.add(sourceMethod); | |||
@@ -264,7 +264,7 @@ public class PushinCollector { | |||
public void tagAsMunged(SourceTypeBinding sourceType, String annotationString) { | |||
List<String> annos = additionalAnnotations.get(sourceType); | |||
if (annos == null) { | |||
annos = new ArrayList<String>(); | |||
annos = new ArrayList<>(); | |||
additionalAnnotations.put(sourceType, annos); | |||
} | |||
annos.add(annotationString); | |||
@@ -322,7 +322,7 @@ public class PushinCollector { | |||
if (typePattern instanceof ExactTypePattern) { | |||
List<ExactTypePattern> annos = additionalParents.get(sourceType); | |||
if (annos == null) { | |||
annos = new ArrayList<ExactTypePattern>(); | |||
annos = new ArrayList<>(); | |||
additionalParents.put(sourceType, annos); | |||
} | |||
annos.add((ExactTypePattern) typePattern); |
@@ -55,27 +55,27 @@ public class AjBuildConfig implements CompilerConfigurationChangeFlags { | |||
private File outputJar; | |||
private String outxmlName; | |||
private CompilationResultDestinationManager compilationResultDestinationManager = null; | |||
private List<File> sourceRoots = new ArrayList<File>(); | |||
private List<File> sourceRoots = new ArrayList<>(); | |||
private List<File> changedFiles; | |||
private List<File> files = new ArrayList<File>(); | |||
private List<File> xmlfiles = new ArrayList<File>(); | |||
private List<File> files = new ArrayList<>(); | |||
private List<File> xmlfiles = new ArrayList<>(); | |||
private String processor; | |||
private String processorPath; | |||
private List<BinarySourceFile> binaryFiles = new ArrayList<BinarySourceFile>(); // .class files in indirs... | |||
private List<File> inJars = new ArrayList<File>(); | |||
private List<File> inPath = new ArrayList<File>(); | |||
private Map<String, File> sourcePathResources = new HashMap<String, File>(); | |||
private List<File> aspectpath = new ArrayList<File>(); | |||
private List<String> classpath = new ArrayList<String>(); | |||
private List<String> modulepath = new ArrayList<String>(); | |||
private List<BinarySourceFile> binaryFiles = new ArrayList<>(); // .class files in indirs... | |||
private List<File> inJars = new ArrayList<>(); | |||
private List<File> inPath = new ArrayList<>(); | |||
private Map<String, File> sourcePathResources = new HashMap<>(); | |||
private List<File> aspectpath = new ArrayList<>(); | |||
private List<String> classpath = new ArrayList<>(); | |||
private List<String> modulepath = new ArrayList<>(); | |||
// Expensive to compute (searching modules, parsing module-info) | |||
private ArrayList<Classpath> modulepathClasspathEntries = null; | |||
private List<String> modulesourcepath = new ArrayList<String>(); | |||
private List<String> modulesourcepath = new ArrayList<>(); | |||
// Expensive to compute (searching modules, parsing module-info) | |||
private ArrayList<Classpath> modulesourcepathClasspathEntries = null; | |||
private Classpath[] checkedClasspaths = null; | |||
private List<String> bootclasspath = new ArrayList<String>(); | |||
private List<String> cpElementsWithModifiedContents = new ArrayList<String>(); | |||
private List<String> bootclasspath = new ArrayList<>(); | |||
private List<String> cpElementsWithModifiedContents = new ArrayList<>(); | |||
private IModule moduleDesc; | |||
private File configFile; | |||
@@ -251,7 +251,7 @@ public class AjBuildConfig implements CompilerConfigurationChangeFlags { | |||
} | |||
private List<Classpath> processFilePath(List<File> path, java.lang.String encoding) { | |||
List<Classpath> entries = new ArrayList<Classpath>(); | |||
List<Classpath> entries = new ArrayList<>(); | |||
for (File file: path) { | |||
entries.add(FileSystem.getClasspath(file.getAbsolutePath(), encoding, null, ClasspathLocation.BINARY, null)); | |||
} | |||
@@ -259,7 +259,7 @@ public class AjBuildConfig implements CompilerConfigurationChangeFlags { | |||
} | |||
private List<Classpath> processStringPath(List<String> path, java.lang.String encoding) { | |||
List<Classpath> entries = new ArrayList<Classpath>(); | |||
List<Classpath> entries = new ArrayList<>(); | |||
for (String file: path) { | |||
entries.add(FileSystem.getClasspath(file, encoding, null, ClasspathLocation.BINARY, null)); | |||
} | |||
@@ -317,7 +317,7 @@ public class AjBuildConfig implements CompilerConfigurationChangeFlags { | |||
public void processInPath() { | |||
// remember all the class files in directories on the inpath | |||
binaryFiles = new ArrayList<BinarySourceFile>(); | |||
binaryFiles = new ArrayList<>(); | |||
FileFilter filter = new FileFilter() { | |||
@Override | |||
public boolean accept(File pathname) { | |||
@@ -377,7 +377,7 @@ public class AjBuildConfig implements CompilerConfigurationChangeFlags { | |||
* classpath), and output dir or jar | |||
*/ | |||
public List<String> getFullClasspath() { | |||
List<String> full = new ArrayList<String>(); | |||
List<String> full = new ArrayList<>(); | |||
full.addAll(getBootclasspath()); // XXX Is it OK that boot classpath overrides inpath/injars/aspectpath? | |||
for (File file: inJars) { | |||
full.add(file.getAbsolutePath()); | |||
@@ -581,7 +581,7 @@ public class AjBuildConfig implements CompilerConfigurationChangeFlags { | |||
// Possibly a name=value comma separated list of configurations | |||
if (lintMode.contains("=")) { | |||
this.lintMode = AJLINT_DEFAULT; | |||
lintOptionsMap = new HashMap<String,String>(); | |||
lintOptionsMap = new HashMap<>(); | |||
StringTokenizer tokenizer = new StringTokenizer(lintMode,","); | |||
while (tokenizer.hasMoreElements()) { | |||
String option = tokenizer.nextToken(); | |||
@@ -596,7 +596,7 @@ public class AjBuildConfig implements CompilerConfigurationChangeFlags { | |||
} | |||
if (lintValue != null || lintOptionsMap != null ) { | |||
Map<String, String> lintOptions = new HashMap<String, String>(); | |||
Map<String, String> lintOptions = new HashMap<>(); | |||
setOption(AjCompilerOptions.OPTION_ReportInvalidAbsoluteTypeName, lintValue, lintOptions); | |||
setOption(AjCompilerOptions.OPTION_ReportInvalidWildcardTypeName, lintValue, lintOptions); | |||
setOption(AjCompilerOptions.OPTION_ReportUnresolvableMember, lintValue, lintOptions); | |||
@@ -930,7 +930,7 @@ public class AjBuildConfig implements CompilerConfigurationChangeFlags { | |||
// What to do about bootclasspath on java 9? | |||
// ArrayList<Classpath> allPaths = handleBootclasspath(bootclasspaths, customEncoding); | |||
ArrayList<FileSystem.Classpath> allPaths = new ArrayList<FileSystem.Classpath>(); | |||
ArrayList<FileSystem.Classpath> allPaths = new ArrayList<>(); | |||
allPaths.addAll(processStringPath(bootclasspath, encoding)); | |||
allPaths.addAll(processFilePath(inJars, encoding)); | |||
allPaths.addAll(processFilePath(inPath, encoding)); |
@@ -138,7 +138,7 @@ public class AjBuildManager implements IOutputClassFileNameProvider, IBinarySour | |||
private boolean batchCompile = true; | |||
private INameEnvironment environment; | |||
private Map<String, List<UnwovenClassFile>> /* String -> List<UCF> */binarySourcesForTheNextCompile = new HashMap<String, List<UnwovenClassFile>>(); | |||
private Map<String, List<UnwovenClassFile>> /* String -> List<UCF> */binarySourcesForTheNextCompile = new HashMap<>(); | |||
// FIXME asc should this really be in here? | |||
// private AsmManager structureModel; | |||
@@ -708,7 +708,7 @@ public class AjBuildManager implements IOutputClassFileNameProvider, IBinarySour | |||
* aspects which are sent to that ouptut directory | |||
*/ | |||
private Map<File, List<String>> findOutputDirsForAspects() { | |||
Map<File, List<String>> outputDirsToAspects = new HashMap<File, List<String>>(); | |||
Map<File, List<String>> outputDirsToAspects = new HashMap<>(); | |||
Map<String, char[]> aspectNamesToFileNames = state.getAspectNamesToFileNameMap(); | |||
if (buildConfig.getCompilationResultDestinationManager() == null | |||
|| buildConfig.getCompilationResultDestinationManager().getAllOutputLocations().size() == 1) { | |||
@@ -717,7 +717,7 @@ public class AjBuildManager implements IOutputClassFileNameProvider, IBinarySour | |||
if (buildConfig.getCompilationResultDestinationManager() != null) { | |||
outputDir = buildConfig.getCompilationResultDestinationManager().getDefaultOutputLocation(); | |||
} | |||
List<String> aspectNames = new ArrayList<String>(); | |||
List<String> aspectNames = new ArrayList<>(); | |||
if (aspectNamesToFileNames != null) { | |||
Set<String> keys = aspectNamesToFileNames.keySet(); | |||
for (String name : keys) { | |||
@@ -729,7 +729,7 @@ public class AjBuildManager implements IOutputClassFileNameProvider, IBinarySour | |||
List outputDirs = buildConfig.getCompilationResultDestinationManager().getAllOutputLocations(); | |||
for (Object dir : outputDirs) { | |||
File outputDir = (File) dir; | |||
outputDirsToAspects.put(outputDir, new ArrayList<String>()); | |||
outputDirsToAspects.put(outputDir, new ArrayList<>()); | |||
} | |||
if (aspectNamesToFileNames != null) { | |||
Set<Map.Entry<String, char[]>> entrySet = aspectNamesToFileNames.entrySet(); | |||
@@ -739,7 +739,7 @@ public class AjBuildManager implements IOutputClassFileNameProvider, IBinarySour | |||
File outputDir = buildConfig.getCompilationResultDestinationManager().getOutputLocationForClass( | |||
new File(new String(fileName))); | |||
if (!outputDirsToAspects.containsKey(outputDir)) { | |||
outputDirsToAspects.put(outputDir, new ArrayList<String>()); | |||
outputDirsToAspects.put(outputDir, new ArrayList<>()); | |||
} | |||
((List) outputDirsToAspects.get(outputDir)).add(aspectName); | |||
} | |||
@@ -796,7 +796,7 @@ public class AjBuildManager implements IOutputClassFileNameProvider, IBinarySour | |||
} | |||
model.setRoot(new ProgramElement(structureModel, rootLabel, kind, new ArrayList())); | |||
model.setFileMap(new HashMap<String, IProgramElement>()); | |||
model.setFileMap(new HashMap<>()); | |||
// setStructureModel(model); | |||
state.setStructureModel(structureModel); | |||
// state.setRelationshipMap(AsmManager.getDefault().getRelationshipMap()); | |||
@@ -903,7 +903,7 @@ public class AjBuildManager implements IOutputClassFileNameProvider, IBinarySour | |||
File[] binSrcs = FileUtil.listFiles(inPathElement, binarySourceFilter); | |||
for (File binSrc : binSrcs) { | |||
UnwovenClassFile ucf = bcelWeaver.addClassFile(binSrc, inPathElement, outputDir); | |||
List<UnwovenClassFile> ucfl = new ArrayList<UnwovenClassFile>(); | |||
List<UnwovenClassFile> ucfl = new ArrayList<>(); | |||
ucfl.add(ucf); | |||
state.recordBinarySource(binSrc.getPath(), ucfl); | |||
} |
@@ -96,7 +96,7 @@ public class AjState implements CompilerConfigurationChangeFlags, TypeDelegateRe | |||
* When looking at changes on the classpath, this set accumulates files in our state instance that affected by those changes. | |||
* Then if we can do an incremental build - these must be compiled. | |||
*/ | |||
private final Set<File> affectedFiles = new HashSet<File>(); | |||
private final Set<File> affectedFiles = new HashSet<>(); | |||
// these are references created on a particular compile run - when looping round in | |||
// addAffectedSourceFiles(), if some have been created then we look at which source files | |||
@@ -110,7 +110,7 @@ public class AjState implements CompilerConfigurationChangeFlags, TypeDelegateRe | |||
private Set<BinarySourceFile> addedBinaryFiles; | |||
private Set<BinarySourceFile> deletedBinaryFiles; | |||
// For a particular build run, this set records the changes to classesFromName | |||
public final Set<String> deltaAddedClasses = new HashSet<String>(); | |||
public final Set<String> deltaAddedClasses = new HashSet<>(); | |||
// now follows non static, but transient state - no need to write out, DOES need reinitializing when read AjState instance | |||
// reloaded | |||
@@ -125,7 +125,7 @@ public class AjState implements CompilerConfigurationChangeFlags, TypeDelegateRe | |||
private boolean batchBuildRequiredThisTime = false; | |||
private AjBuildConfig buildConfig; | |||
private long lastSuccessfulFullBuildTime = -1; | |||
private final Hashtable<String, Long> structuralChangesSinceLastFullBuild = new Hashtable<String, Long>(); | |||
private final Hashtable<String, Long> structuralChangesSinceLastFullBuild = new Hashtable<>(); | |||
private long lastSuccessfulBuildTime = -1; | |||
private long currentBuildTime = -1; | |||
private AsmManager structureModel; | |||
@@ -134,18 +134,18 @@ public class AjState implements CompilerConfigurationChangeFlags, TypeDelegateRe | |||
* For a given source file, records the ClassFiles (which contain a fully qualified name and a file name) that were created when | |||
* the source file was compiled. Populated in noteResult and used in addDependentsOf(File) | |||
*/ | |||
private final Map<File, List<ClassFile>> fullyQualifiedTypeNamesResultingFromCompilationUnit = new HashMap<File, List<ClassFile>>(); | |||
private final Map<File, List<ClassFile>> fullyQualifiedTypeNamesResultingFromCompilationUnit = new HashMap<>(); | |||
/** | |||
* Source files defining aspects Populated in noteResult and used in processDeletedFiles | |||
*/ | |||
private final Set<File> sourceFilesDefiningAspects = new HashSet<File>(); | |||
private final Set<File> sourceFilesDefiningAspects = new HashSet<>(); | |||
/** | |||
* Populated in noteResult to record the set of types that should be recompiled if the given file is modified or deleted. | |||
* Referred to during addAffectedSourceFiles when calculating incremental compilation set. | |||
*/ | |||
private final Map<File, ReferenceCollection> references = new HashMap<File, ReferenceCollection>(); | |||
private final Map<File, ReferenceCollection> references = new HashMap<>(); | |||
/** | |||
* Holds UnwovenClassFiles (byte[]s) originating from the given file source. This could be a jar file, a directory, or an | |||
@@ -165,25 +165,25 @@ public class AjState implements CompilerConfigurationChangeFlags, TypeDelegateRe | |||
* input file has changed. | |||
* | |||
*/ | |||
private Map<String, List<UnwovenClassFile>> binarySourceFiles = new HashMap<String, List<UnwovenClassFile>>(); | |||
private Map<String, List<UnwovenClassFile>> binarySourceFiles = new HashMap<>(); | |||
/** | |||
* Initially a duplicate of the information held in binarySourceFiles, with the key difference that the values are ClassFiles | |||
* (type name, File) not UnwovenClassFiles (which also have all the byte code in them). After a batch build, binarySourceFiles | |||
* is cleared, leaving just this much lighter weight map to use in processing subsequent incremental builds. | |||
*/ | |||
private final Map<String, List<ClassFile>> inputClassFilesBySource = new HashMap<String, List<ClassFile>>(); | |||
private final Map<String, List<ClassFile>> inputClassFilesBySource = new HashMap<>(); | |||
/** | |||
* A list of the .class files created by this state that contain aspects. | |||
*/ | |||
private final List<String> aspectClassFiles = new ArrayList<String>(); | |||
private final List<String> aspectClassFiles = new ArrayList<>(); | |||
/** | |||
* Holds structure information on types as they were at the end of the last build. It would be nice to get rid of this too, but | |||
* can't see an easy way to do that right now. | |||
*/ | |||
private final Map<String, CompactTypeStructureRepresentation> resolvedTypeStructuresFromLastBuild = new HashMap<String, CompactTypeStructureRepresentation>(); | |||
private final Map<String, CompactTypeStructureRepresentation> resolvedTypeStructuresFromLastBuild = new HashMap<>(); | |||
/** | |||
* Populated in noteResult to record the set of UnwovenClassFiles (intermediate results) that originated from compilation of the | |||
@@ -193,7 +193,7 @@ public class AjState implements CompilerConfigurationChangeFlags, TypeDelegateRe | |||
* | |||
* Passed into StatefulNameEnvironment during incremental compilation to support findType lookups. | |||
*/ | |||
private final Map<String, File> classesFromName = new HashMap<String, File>(); | |||
private final Map<String, File> classesFromName = new HashMap<>(); | |||
/** | |||
* Populated by AjBuildManager to record the aspects with the file name in which they're contained. This is later used when | |||
@@ -203,8 +203,8 @@ public class AjState implements CompilerConfigurationChangeFlags, TypeDelegateRe | |||
*/ | |||
private Map<String, char[]> aspectsFromFileNames; | |||
private Set<File> compiledSourceFiles = new HashSet<File>(); | |||
private final Map<String, File> resources = new HashMap<String, File>(); | |||
private Set<File> compiledSourceFiles = new HashSet<>(); | |||
private final Map<String, File> resources = new HashMap<>(); | |||
SoftHashMap/* <baseDir,SoftHashMap<theFile,className>> */fileToClassNameMap = new SoftHashMap(); | |||
@@ -313,21 +313,21 @@ public class AjState implements CompilerConfigurationChangeFlags, TypeDelegateRe | |||
addedFiles = Collections.emptySet(); | |||
deletedFiles = Collections.emptySet(); | |||
} else { | |||
Set<File> oldFiles = new HashSet<File>(buildConfig.getFiles()); | |||
Set<File> newFiles = new HashSet<File>(newBuildConfig.getFiles()); | |||
Set<File> oldFiles = new HashSet<>(buildConfig.getFiles()); | |||
Set<File> newFiles = new HashSet<>(newBuildConfig.getFiles()); | |||
addedFiles = new HashSet<File>(newFiles); | |||
addedFiles = new HashSet<>(newFiles); | |||
addedFiles.removeAll(oldFiles); | |||
deletedFiles = new HashSet<File>(oldFiles); | |||
deletedFiles = new HashSet<>(oldFiles); | |||
deletedFiles.removeAll(newFiles); | |||
} | |||
Set<BinarySourceFile> oldBinaryFiles = new HashSet<BinarySourceFile>(buildConfig.getBinaryFiles()); | |||
Set<BinarySourceFile> newBinaryFiles = new HashSet<BinarySourceFile>(newBuildConfig.getBinaryFiles()); | |||
Set<BinarySourceFile> oldBinaryFiles = new HashSet<>(buildConfig.getBinaryFiles()); | |||
Set<BinarySourceFile> newBinaryFiles = new HashSet<>(newBuildConfig.getBinaryFiles()); | |||
addedBinaryFiles = new HashSet<BinarySourceFile>(newBinaryFiles); | |||
addedBinaryFiles = new HashSet<>(newBinaryFiles); | |||
addedBinaryFiles.removeAll(oldBinaryFiles); | |||
deletedBinaryFiles = new HashSet<BinarySourceFile>(oldBinaryFiles); | |||
deletedBinaryFiles = new HashSet<>(oldBinaryFiles); | |||
deletedBinaryFiles.removeAll(newBinaryFiles); | |||
boolean couldStillBeIncremental = processDeletedFiles(deletedFiles); | |||
@@ -376,7 +376,7 @@ public class AjState implements CompilerConfigurationChangeFlags, TypeDelegateRe | |||
} | |||
Collection<File> getModifiedFiles(long lastBuildTime) { | |||
Set<File> ret = new HashSet<File>(); | |||
Set<File> ret = new HashSet<>(); | |||
// Check if the build configuration knows what files have changed... | |||
List<File> modifiedFiles = buildConfig.getModifiedFiles(); | |||
@@ -408,7 +408,7 @@ public class AjState implements CompilerConfigurationChangeFlags, TypeDelegateRe | |||
} | |||
Collection<BinarySourceFile> getModifiedBinaryFiles(long lastBuildTime) { | |||
List<BinarySourceFile> ret = new ArrayList<BinarySourceFile>(); | |||
List<BinarySourceFile> ret = new ArrayList<>(); | |||
// not our job to account for new and deleted files | |||
for (BinarySourceFile bsfile : buildConfig.getBinaryFiles()) { | |||
File file = bsfile.binSrc; | |||
@@ -865,7 +865,7 @@ public class AjState implements CompilerConfigurationChangeFlags, TypeDelegateRe | |||
if ((changes & (CLASSPATH_CHANGED | ASPECTPATH_CHANGED | INPATH_CHANGED | OUTPUTDESTINATIONS_CHANGED | INJARS_CHANGED)) != 0) { | |||
List<File> oldOutputLocs = getOutputLocations(previousConfig); | |||
Set<String> alreadyAnalysedPaths = new HashSet<String>(); | |||
Set<String> alreadyAnalysedPaths = new HashSet<>(); | |||
List<String> oldClasspath = previousConfig.getClasspath(); | |||
List<String> newClasspath = newConfig.getClasspath(); | |||
@@ -926,7 +926,7 @@ public class AjState implements CompilerConfigurationChangeFlags, TypeDelegateRe | |||
* @return a list of file objects | |||
*/ | |||
private List<File> getOutputLocations(AjBuildConfig config) { | |||
List<File> outputLocs = new ArrayList<File>(); | |||
List<File> outputLocs = new ArrayList<>(); | |||
// Is there a default location? | |||
if (config.getOutputDir() != null) { | |||
try { | |||
@@ -1074,9 +1074,9 @@ public class AjState implements CompilerConfigurationChangeFlags, TypeDelegateRe | |||
} | |||
public Set<File> getFilesToCompile(boolean firstPass) { | |||
Set<File> thisTime = new HashSet<File>(); | |||
Set<File> thisTime = new HashSet<>(); | |||
if (firstPass) { | |||
compiledSourceFiles = new HashSet<File>(); | |||
compiledSourceFiles = new HashSet<>(); | |||
Collection<File> modifiedFiles = getModifiedFiles(); | |||
// System.out.println("modified: " + modifiedFiles); | |||
thisTime.addAll(modifiedFiles); | |||
@@ -1120,9 +1120,9 @@ public class AjState implements CompilerConfigurationChangeFlags, TypeDelegateRe | |||
return binarySourceFiles; | |||
} | |||
// else incremental... | |||
Map<String, List<UnwovenClassFile>> toWeave = new HashMap<String, List<UnwovenClassFile>>(); | |||
Map<String, List<UnwovenClassFile>> toWeave = new HashMap<>(); | |||
if (firstTime) { | |||
List<BinarySourceFile> addedOrModified = new ArrayList<BinarySourceFile>(); | |||
List<BinarySourceFile> addedOrModified = new ArrayList<>(); | |||
addedOrModified.addAll(addedBinaryFiles); | |||
addedOrModified.addAll(getModifiedBinaryFiles()); | |||
for (BinarySourceFile bsf : addedOrModified) { | |||
@@ -1130,11 +1130,11 @@ public class AjState implements CompilerConfigurationChangeFlags, TypeDelegateRe | |||
if (ucf == null) { | |||
continue; | |||
} | |||
List<UnwovenClassFile> ucfs = new ArrayList<UnwovenClassFile>(); | |||
List<UnwovenClassFile> ucfs = new ArrayList<>(); | |||
ucfs.add(ucf); | |||
recordTypeChanged(ucf.getClassName()); | |||
binarySourceFiles.put(bsf.binSrc.getPath(), ucfs); | |||
List<ClassFile> cfs = new ArrayList<ClassFile>(1); | |||
List<ClassFile> cfs = new ArrayList<>(1); | |||
cfs.add(getClassFileFor(ucf)); | |||
this.inputClassFilesBySource.put(bsf.binSrc.getPath(), cfs); | |||
toWeave.put(bsf.binSrc.getPath(), ucfs); | |||
@@ -1407,7 +1407,7 @@ public class AjState implements CompilerConfigurationChangeFlags, TypeDelegateRe | |||
* @param icr, the CompilationResult from compiling it | |||
*/ | |||
private void recordFQNsResultingFromCompilationUnit(File sourceFile, InterimCompilationResult icr) { | |||
List<ClassFile> classFiles = new ArrayList<ClassFile>(); | |||
List<ClassFile> classFiles = new ArrayList<>(); | |||
UnwovenClassFile[] types = icr.unwovenClassFiles(); | |||
for (UnwovenClassFile type : types) { | |||
classFiles.add(new ClassFile(type.getClassName(), new File(type.getFilename()))); | |||
@@ -2372,13 +2372,13 @@ public class AjState implements CompilerConfigurationChangeFlags, TypeDelegateRe | |||
} | |||
public void clearBinarySourceFiles() { | |||
this.binarySourceFiles = new HashMap<String, List<UnwovenClassFile>>(); | |||
this.binarySourceFiles = new HashMap<>(); | |||
} | |||
public void recordBinarySource(String fromPathName, List<UnwovenClassFile> unwovenClassFiles) { | |||
this.binarySourceFiles.put(fromPathName, unwovenClassFiles); | |||
if (this.maybeIncremental()) { | |||
List<ClassFile> simpleClassFiles = new LinkedList<ClassFile>(); | |||
List<ClassFile> simpleClassFiles = new LinkedList<>(); | |||
for (UnwovenClassFile ucf : unwovenClassFiles) { | |||
ClassFile cf = getClassFileFor(ucf); | |||
simpleClassFiles.add(cf); | |||
@@ -2489,7 +2489,7 @@ public class AjState implements CompilerConfigurationChangeFlags, TypeDelegateRe | |||
} | |||
public void initializeAspectNamesToFileNameMap() { | |||
this.aspectsFromFileNames = new HashMap<String, char[]>(); | |||
this.aspectsFromFileNames = new HashMap<>(); | |||
} | |||
// Will allow us to record decisions made during incremental processing, hopefully aid in debugging |
@@ -422,9 +422,9 @@ public class AsmElementFormatter { | |||
pe.setParameterNames(Collections.<String>emptyList()); | |||
pe.setParameterSignatures(Collections.<char[]>emptyList(), Collections.<String>emptyList()); | |||
} else { | |||
List<String> names = new ArrayList<String>(); | |||
List<char[]> paramSigs = new ArrayList<char[]>(); | |||
List<String> paramSourceRefs = new ArrayList<String>(); | |||
List<String> names = new ArrayList<>(); | |||
List<char[]> paramSigs = new ArrayList<>(); | |||
List<String> paramSourceRefs = new ArrayList<>(); | |||
boolean problemWithSourceRefs = false; | |||
for (Argument argument : argArray) { | |||
String argName = new String(argument.name); |
@@ -541,7 +541,7 @@ public class AsmHierarchyBuilder extends ASTVisitor { | |||
Declare decl = dDeclaration.declareDecl; | |||
if (decl instanceof DeclareParents) { | |||
TypePatternList tpl = ((DeclareParents) decl).getParents(); | |||
List<String> parents = new ArrayList<String>(); | |||
List<String> parents = new ArrayList<>(); | |||
for (int i = 0; i < tpl.size(); i++) { | |||
parents.add(tpl.get(i).getExactType().getName().replaceAll("\\$", ".")); | |||
} |