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() {
}
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);
}
public List<File> getAllOutputLocations() {
- List<File> outputDirs = new ArrayList<File>();
+ List<File> outputDirs = new ArrayList<>();
outputDirs.add(new File(getCommonOutputDir()));
return outputDirs;
}
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);
}
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();
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);
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)) {
}
}
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);
// 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
/** 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());
}
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);
}
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;
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";
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);
}
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) };
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);
}
@Override
public List<File> getAllOutputLocations() {
if (allOutputLocations == null) {
- allOutputLocations = new ArrayList<File>();
+ allOutputLocations = new ArrayList<>();
initLocations();
allOutputLocations.add(classOutputLoc);
if (!classOutputLoc.equals(resourceOutputLoc)) {
}
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();
}
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();
}
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();
}
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);
* 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);
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");
*
*/
public void testInpathToBin() {
- Set<File> inpath = new HashSet<File>();
+ Set<File> inpath = new HashSet<>();
File indir1 = openFile(indir1Name);
inpath.add(indir1);
compilerConfig.setInpath(inpath);
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");
* 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);
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");
*
*/
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));
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");
*/
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);
}
public void testInjarsToOutjar() {
- Set<File> injars = new HashSet<File>();
+ Set<File> injars = new HashSet<>();
File injar1 = openFile(injar1Name);
injars.add(injar1);
compilerConfig.setInpath(injars);
}
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);
}
public void testInjarsToBin() {
- Set<File> injars = new HashSet<File>();
+ Set<File> injars = new HashSet<>();
File injar1 = openFile(injar1Name);
injars.add(injar1);
compilerConfig.setInpath(injars);
// }
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);
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";
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";
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();
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();
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();
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();
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();
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();
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();
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();
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();
*/
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;
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) {
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<>();
}
}
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;
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);
}
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));
}
@Override
public List<String> getAllBuildConfigFiles() {
if (allBuildConfigFiles == null) {
- allBuildConfigFiles = new ArrayList<String>();
+ allBuildConfigFiles = new ArrayList<>();
if (getActiveConfigFile() != null) {
allBuildConfigFiles.add(getActiveConfigFile());
}
}
public List<BuildConfigNode> getActiveNodes(BuildConfigNode.Kind kind) {
- List<BuildConfigNode> nodes = new ArrayList<BuildConfigNode>();
+ List<BuildConfigNode> nodes = new ArrayList<>();
getActiveNodesHelper(root, kind, nodes);
return nodes;
}
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;
public void addChild(BuildConfigNode child) {
if (children == null) {
- children = new ArrayList<BuildConfigNode>();
+ children = new ArrayList<>();
}
children.add(child);
child.setParent(this);
public void addChild(int position, BuildConfigNode child) {
if (children == null) {
- children = new ArrayList<BuildConfigNode>();
+ children = new ArrayList<>();
}
children.add(position, child);
child.setParent(this);
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);
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);
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;
}
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);
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;
* 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.
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)
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);
}
}
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);
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());
}
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(".")); // !!!
}
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();
* @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);
}
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();
}
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;
* @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);
*/
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);
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
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);
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) {
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;
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);
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?
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
// 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;
} 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) {
* 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) {
}
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);
// 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) {
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) {
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) {
// 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);
// 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();
}
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);
}
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);
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);
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));
}
private void fixMap() {
if (kvpairs == Collections.EMPTY_MAP) {
- kvpairs = new HashMap<String, Object>();
+ kvpairs = new HashMap<>();
}
}
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);
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;
}
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 {
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;
// 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;
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;
*/
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);
}
* 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);
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++) {
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));
}
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));
}
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));
}
public void addElementNameValuePair(NameValuePair evp) {
if (pairs == Collections.EMPTY_LIST) {
- pairs = new ArrayList<NameValuePair>();
+ pairs = new ArrayList<>();
}
pairs.add(evp);
}
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;
}
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));
}
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;
}
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 ) {
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) {
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);
}
// (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);
}
// 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) == '<';
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() {
}
*/
public void addTargeter(InstructionTargeter t) {
if (targeters == Collections.EMPTY_SET) {
- targeters = new HashSet<InstructionTargeter>();
+ targeters = new HashSet<>();
}
targeters.add(t);
}
}
public Set<InstructionTargeter> getTargetersCopy() {
- Set<InstructionTargeter> copy = new HashSet<InstructionTargeter>();
+ Set<InstructionTargeter> copy = new HashSet<>();
copy.addAll(targeters);
return copy;
}
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
*/
public Instruction[] getInstructions() {
ByteSequence bytes = new ByteSequence(getByteCode());
- ArrayList<Instruction> instructions = new ArrayList<Instruction>();
+ ArrayList<Instruction> instructions = new ArrayList<>();
try {
while (bytes.available() > 0) {
* @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();
/*
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;
}
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)) {
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<>();
}
}
}
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));
}
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;
}
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);
*/
// OPTIMIZE crap impl
public static Type[] getArgumentTypes(String signature) {
- List<Type> argumentTypes = new ArrayList<Type>();
+ List<Type> argumentTypes = new ArrayList<>();
int index;
Type[] types;
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);
sharedCache.put(url, clazz);
} else {
clazz.setRepository(this);
- localCache.put(url, new SoftReference<JavaClass>(clazz));
+ localCache.put(url, new SoftReference<>(clazz));
}
}
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();) {
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) {
}
public SoftHashMap() {
- this(new HashMap<Object,SpecialValue>());
+ this(new HashMap<>());
}
public SoftHashMap(Map<Object,SpecialValue> map, boolean b) {
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;
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 :)
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;
// 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;
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());
}
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());
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);
}
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);
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);
}
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);
}
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);
* @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;
}
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();
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);
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);
}
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);
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());
}
/** 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
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);
}
* @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)
}
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()) {
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);
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) {
"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();
*/
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) {
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;
}
} else {
Stack<ContextStackEntry> contextStack = contextMap.get();
if (contextStack == null) {
- contextStack = new Stack<ContextStackEntry>();
+ contextStack = new Stack<>();
contextMap.set(contextStack);
}
return contextStack;
*/
@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
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) {
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);
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);
}
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;
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() {
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();
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();
return buildProduct(buildSpec);
}
Result result = specifyResultFor(buildSpec);
- ArrayList<String> errors = new ArrayList<String>();
+ ArrayList<String> errors = new ArrayList<>();
try {
return buildAll(result, errors);
} finally {
*/
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));
* 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()
}
};
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
/** @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();
}
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;
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()) {
*/
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;
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();
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";
/** @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;
}
* 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();
}
}
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;
}
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;
* @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()) {
// 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()) {
*/
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");
}
}
- 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
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();
}
}
- ArrayList<File> tempFiles = new ArrayList<File>();
+ ArrayList<File> tempFiles = new ArrayList<>();
public ModulesTest(String name) {
super(name);
}
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()) {
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();
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;
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);
* @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) {
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
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()) {
*/
public void flushGeneratedClasses() {
// System.err.println("? ClassLoaderWeavingAdaptor.flushGeneratedClasses() generatedClasses=" + generatedClasses);
- generatedClasses = new HashMap<String, IUnwovenClassFile>();
+ generatedClasses = new HashMap<>();
}
/**
}
// 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) {
}
}
}
- List<String> pointcutNames = new ArrayList<String>();
+ List<String> pointcutNames = new ArrayList<>();
for (Definition.Pointcut abstractPc : concreteAspect.pointcuts) {
pointcutNames.add(abstractPc.name);
}
}
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
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,
}
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());
// 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());
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());
// 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();
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);
}
}
// 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("(");
*/
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());
static class TestWeavingContext extends DefaultWeavingContext {
- List<Definition> testList = new ArrayList<Definition>();
+ List<Definition> testList = new ArrayList<>();
public TestWeavingContext(ClassLoader loader) {
super(loader);
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) {
}
}
- 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");
}
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());
}
}
public List<String> getBootclasspath(AjcConfigParser parser) {
- List<String> ret = new ArrayList<String>();
+ List<String> ret = new ArrayList<>();
if (parser.bootclasspath == null) {
if (LangUtil.is19VMOrGreater()) {
}
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;
}
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()) {
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: ";
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));
}
return;
}
- LinkedList<Arg> args = new LinkedList<Arg>();
+ LinkedList<Arg> args = new LinkedList<>();
int lineNum = 0;
try {
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;
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;
}
// 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);
}
public void beforeCompiling(ICompilationUnit[] sourceUnits) {
- resultsPendingWeave = new ArrayList<InterimCompilationResult>();
+ resultsPendingWeave = new ArrayList<>();
reportedErrors = false;
droppingBackToFullBuild = false;
}
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"
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;
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
// 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);
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;
// 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);
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;
}
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;
}
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
// 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;
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;
}
}
- List<SourceTypeBinding> stb2 = new ArrayList<SourceTypeBinding>();
+ List<SourceTypeBinding> stb2 = new ArrayList<>();
stb2.addAll(typesToProcess);
while (typesToProcess.size() > 0) {
// 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;
}
}
- 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;
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");
}
// 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();
/**
* 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).
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
* 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
// 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
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
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;
}
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
// }
// 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);
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();
* 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;
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);
}
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) {
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 {
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);
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;
}
List<AbstractMethodDeclaration> amds = newDeclarations.get(sourceType);
if (amds == null) {
- amds = new ArrayList<AbstractMethodDeclaration>();
+ amds = new ArrayList<>();
newDeclarations.put(sourceType, amds);
}
amds.add(sourceMethod);
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);
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);
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;
}
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));
}
}
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));
}
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) {
* 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());
// 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();
}
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);
// 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));
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;
* 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) {
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) {
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();
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);
}
}
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());
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);
}
* 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
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
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;
* 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
* 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
*
* 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
*/
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();
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);
}
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();
}
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;
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();
* @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 {
}
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);
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) {
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);
* @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())));
}
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);
}
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
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);
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("\\$", "."));
}
// SECRETAPI will consume more memory, so turn on at your own risk ;) Set to 'true' when memory usage is understood
public static boolean recordIncrementalStates = false;
public static boolean debugIncrementalStates = false;
- private static Hashtable<String, AjState> incrementalStates = new Hashtable<String, AjState>();
+ private static Hashtable<String, AjState> incrementalStates = new Hashtable<>();
public static void recordSuccessfulBuild(String buildConfig, AjState state) {
if (!recordIncrementalStates) {
public StatefulNameEnvironment(IModuleAwareNameEnvironment baseEnvironment, Map<String,File> classesFromName, AjState state) {
this.classesFromName = classesFromName;
- this.inflatedClassFilesCache = new HashMap<String,NameEnvironmentAnswer>();
+ this.inflatedClassFilesCache = new HashMap<>();
this.baseEnvironment = baseEnvironment;
this.state = state;
- packageNames = new HashSet<String>();
+ packageNames = new HashSet<>();
for (String className: classesFromName.keySet()) {
addAllPackageNames(className);
}
}
public static void checkCompile(String source, String[] extraArgs, int[] expectedErrors, String sandboxName) {
- List<String> args = new ArrayList<String>();
+ List<String> args = new ArrayList<>();
args.add("-verbose");
args.add("-d");
}
public void checkMultipleCompile(String source) throws InterruptedException {
- List<String> args = new ArrayList<String>();
+ List<String> args = new ArrayList<>();
args.add("-verbose");
args.add("-d");
"-d",
classesDir.getAbsolutePath()};
return Collections.unmodifiableList(
- new ArrayList<String>(Arrays.asList(input)));
+ new ArrayList<>(Arrays.asList(input)));
}
protected File makeDir(
public void testMissingJavadoc() {
String[] args = new String[] { "World.java", "-warn:allJavadoc", "-1.4" };
- List<Message> warningMessages = new ArrayList<Message>();
+ List<Message> warningMessages = new ArrayList<>();
// These warnings are against public textX() methods declared in the World.java
// type. These test methods are spread between AJ constructs, meaning
// if someone messes up and the javadoc is not associated with the aspectj
static class TestMessageHandler implements IMessageHandler {
- List<IMessage> messages = new ArrayList<IMessage>();
+ List<IMessage> messages = new ArrayList<>();
@Override
public boolean isIgnoring(Kind kind) {
});
oldConfig = new AjBuildConfig(parser);
newConfig = new AjBuildConfig(parser);
- List<String> cp = new ArrayList<String>();
+ List<String> cp = new ArrayList<>();
cp.add("adir");
cp.add("ajar.jar");
oldConfig.setClasspath(cp);
- newConfig.setClasspath(new ArrayList<String>(cp));
- List<File> ap = new ArrayList<File>();
+ newConfig.setClasspath(new ArrayList<>(cp));
+ List<File> ap = new ArrayList<>();
ap.add(new File("aLib.jar"));
ap.add(new File("anotherLib.jar"));
oldConfig.setAspectpath(ap);
- newConfig.setAspectpath(new ArrayList<File>(ap));
- List<File> ip = new ArrayList<File>();
+ newConfig.setAspectpath(new ArrayList<>(ap));
+ List<File> ip = new ArrayList<>();
ip.add(new File("adir"));
ip.add(new File("ajar.jar"));
oldConfig.setInPath(ip);
- newConfig.setInPath(new ArrayList<File>(ip));
- List<File> ij = new ArrayList<File>();
+ newConfig.setInPath(new ArrayList<>(ip));
+ List<File> ij = new ArrayList<>();
ij.add(new File("aLib.jar"));
ij.add(new File("anotherLib.jar"));
oldConfig.setInJars(ij);
- newConfig.setInJars(new ArrayList<File>(ij));
+ newConfig.setInJars(new ArrayList<>(ij));
aRightState.prepareForNextBuild(oldConfig);
aRightState.successfulCompile(oldConfig, true);
}
private void checkJLS3(String source, String expectedOutput) {
ASTParser parser = ASTParser.newParser(AST.JLS3);
- HashMap<String,String> options = new HashMap<String,String>();
+ HashMap<String,String> options = new HashMap<>();
options.put(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_5);
parser.setCompilerOptions(options);
parser.setSource(source.toCharArray());
}
class TypePatternSourceRangeVisitor extends AjASTVisitor {
- private List<SourceRange> sourceRanges = new ArrayList<SourceRange>();
+ private List<SourceRange> sourceRanges = new ArrayList<>();
public List<SourceRange> getVisitedSourceRanges() {
return sourceRanges;
protected List<SourceRange> getSourceRanges(int[][] sourceRanges) {
- List<SourceRange> convertedRanges = new ArrayList<SourceRange>();
+ List<SourceRange> convertedRanges = new ArrayList<>();
for (int[] sourceRange : sourceRanges) {
convertedRanges.add(new SourceRange(sourceRange[0],
System.setOut(pout);
System.setErr(perr);
- List<IMessage> fails = new ArrayList<IMessage>();
- List<IMessage> errors = new ArrayList<IMessage>();
- List<IMessage> warnings = new ArrayList<IMessage>();
- List<IMessage> infos = new ArrayList<IMessage>();
- List<IMessage> weaves = new ArrayList<IMessage>();
+ List<IMessage> fails = new ArrayList<>();
+ List<IMessage> errors = new ArrayList<>();
+ List<IMessage> warnings = new ArrayList<>();
+ List<IMessage> infos = new ArrayList<>();
+ List<IMessage> weaves = new ArrayList<>();
try {
if (!isIncremental && shouldEmptySandbox) {
* Helper method to build a new message list for passing to a MessageSpec.
*/
protected List<Message> newMessageList(Message m1) {
- List<Message> ret = new ArrayList<Message>();
+ List<Message> ret = new ArrayList<>();
ret.add(m1);
return ret;
}
* Helper method to build a new message list for passing to a MessageSpec.
*/
protected List<Message> newMessageList(Message m1, Message m2) {
- List<Message> ret = new ArrayList<Message>();
+ List<Message> ret = new ArrayList<>();
ret.add(m1);
ret.add(m2);
return ret;
* Helper method to build a new message list for passing to a MessageSpec.
*/
protected List<Message> newMessageList(Message m1, Message m2, Message m3) {
- List<Message> ret = new ArrayList<Message>();
+ List<Message> ret = new ArrayList<>();
ret.add(m1);
ret.add(m2);
ret.add(m3);
private List<String >tokenizeCommand(String command) {
StringTokenizer st = new StringTokenizer(command," ", false);
- ArrayList<String> arguments = new ArrayList<String>();
+ ArrayList<String> arguments = new ArrayList<>();
while(st.hasMoreElements()){
String nextToken =st.nextToken();
arguments.add(nextToken);
if (in == Collections.EMPTY_LIST)
return in;
- List<T> out = new ArrayList<T>();
+ List<T> out = new ArrayList<>();
for (T t : in) {
out.add(t);
}
public class MainTest extends AjcTestCase {
public void testMainbare() {
- ArrayList<String> list = new ArrayList<String>();
+ ArrayList<String> list = new ArrayList<>();
// Usage now printed by Eclipse compiler so doesn't appear here in our message list
// Main.bareMain(new String[] {"-help"}, false, list, null, null, null);
// assertTrue(1 == list.size());
}
protected GenericSignature.FormalTypeParameter[] getFormalTypeParametersFromOuterClass() {
- List<GenericSignature.FormalTypeParameter> typeParameters = new ArrayList<GenericSignature.FormalTypeParameter>();
+ List<GenericSignature.FormalTypeParameter> typeParameters = new ArrayList<>();
ResolvedType outerClassType = getOuterClass();
if (!(outerClassType instanceof ReferenceType)) {
if (outerClassType == null) {
private PerClause perClause;
- private List<ShadowMunger> shadowMungers = new ArrayList<ShadowMunger>(4);
- private List<ConcreteTypeMunger> typeMungers = new ArrayList<ConcreteTypeMunger>(4);
- private List<ConcreteTypeMunger> lateTypeMungers = new ArrayList<ConcreteTypeMunger>(0);
+ private List<ShadowMunger> shadowMungers = new ArrayList<>(4);
+ private List<ConcreteTypeMunger> typeMungers = new ArrayList<>(4);
+ private List<ConcreteTypeMunger> lateTypeMungers = new ArrayList<>(0);
- private Set<DeclareParents> declareParents = new HashSet<DeclareParents>();
- private Set<DeclareSoft> declareSofts = new HashSet<DeclareSoft>();
- private List<Declare> declareDominates = new ArrayList<Declare>(4);
+ private Set<DeclareParents> declareParents = new HashSet<>();
+ private Set<DeclareSoft> declareSofts = new HashSet<>();
+ private List<Declare> declareDominates = new ArrayList<>(4);
// These are like declare parents type mungers
- private Set<DeclareAnnotation> declareAnnotationsOnType = new LinkedHashSet<DeclareAnnotation>();
- private Set<DeclareAnnotation> declareAnnotationsOnField = new LinkedHashSet<DeclareAnnotation>();
- private Set<DeclareAnnotation> declareAnnotationsOnMethods = new LinkedHashSet<DeclareAnnotation>();
+ private Set<DeclareAnnotation> declareAnnotationsOnType = new LinkedHashSet<>();
+ private Set<DeclareAnnotation> declareAnnotationsOnField = new LinkedHashSet<>();
+ private Set<DeclareAnnotation> declareAnnotationsOnMethods = new LinkedHashSet<>();
// declareAnnotationsOnMethods includes constructors too
- private Set<DeclareTypeErrorOrWarning> declareTypeEow = new HashSet<DeclareTypeErrorOrWarning>();
+ private Set<DeclareTypeErrorOrWarning> declareTypeEow = new HashSet<>();
private boolean shouldConcretizeIfNeeded = true;
this.shouldConcretizeIfNeeded = shouldConcretizeIfNeeded;
}
- private final Hashtable<String, Object> cflowFields = new Hashtable<String, Object>();
- private final Hashtable<String, Object> cflowBelowFields = new Hashtable<String, Object>();
+ private final Hashtable<String, Object> cflowFields = new Hashtable<>();
+ private final Hashtable<String, Object> cflowBelowFields = new Hashtable<>();
// public void addConcreteShadowMungers(Collection c) {
// shadowMungers.addAll(c);
}
public Collection<ShadowMunger> getCflowEntries() {
- List<ShadowMunger> ret = new ArrayList<ShadowMunger>();
+ List<ShadowMunger> ret = new ArrayList<>();
for (ShadowMunger m : shadowMungers) {
if (m instanceof Advice) {
Advice a = (Advice) m;
if (careAboutShadowMungers) {
// bug 129163: use set equality rather than list equality
- Set<ShadowMunger> theseShadowMungers = new HashSet<ShadowMunger>();
- Set<ShadowMunger> theseInlinedAroundMungers = new HashSet<ShadowMunger>();
+ Set<ShadowMunger> theseShadowMungers = new HashSet<>();
+ Set<ShadowMunger> theseInlinedAroundMungers = new HashSet<>();
for (ShadowMunger munger : shadowMungers) {
if (munger instanceof Advice) {
Advice adviceMunger = (Advice) munger;
theseShadowMungers.add(munger);
}
}
- Set<ShadowMunger> tempSet = new HashSet<ShadowMunger>();
+ Set<ShadowMunger> tempSet = new HashSet<>();
tempSet.addAll(other.shadowMungers);
- Set<ShadowMunger> otherShadowMungers = new HashSet<ShadowMunger>();
- Set<ShadowMunger> otherInlinedAroundMungers = new HashSet<ShadowMunger>();
+ Set<ShadowMunger> otherShadowMungers = new HashSet<>();
+ Set<ShadowMunger> otherInlinedAroundMungers = new HashSet<>();
for (ShadowMunger munger : tempSet) {
if (munger instanceof Advice) {
Advice adviceMunger = (Advice) munger;
// if we dont care about shadow mungers then ignore those
// typeMungers which are created to help with the implementation
// of shadowMungers
- Set<Object> theseTypeMungers = new HashSet<Object>();
- Set<Object> otherTypeMungers = new HashSet<Object>();
+ Set<Object> theseTypeMungers = new HashSet<>();
+ Set<Object> otherTypeMungers = new HashSet<>();
if (!careAboutShadowMungers) {
for (Object o : typeMungers) {
if (o instanceof ConcreteTypeMunger) {
// the up front comparison
if (!careAboutShadowMungers) {
// this means we are in front end compilation and if the differences are purely mixin parents, we can continue OK
- Set<DeclareParents> trimmedThis = new HashSet<DeclareParents>();
+ Set<DeclareParents> trimmedThis = new HashSet<>();
for (DeclareParents decp : declareParents) {
if (!decp.isMixin()) {
trimmedThis.add(decp);
}
}
- Set<DeclareParents> trimmedOther = new HashSet<DeclareParents>();
+ Set<DeclareParents> trimmedOther = new HashSet<>();
for (DeclareParents decp : other.declareParents) {
if (!decp.isMixin()) {
trimmedOther.add(decp);
private transient World world;
// FIXME AV - ? we may need a sequencedHashMap there to ensure source based precedence for @AJ advice
- private final Map<ResolvedType, CrosscuttingMembers> members = new HashMap<ResolvedType, CrosscuttingMembers>();
+ private final Map<ResolvedType, CrosscuttingMembers> members = new HashMap<>();
// List of things to be verified once the type system is 'complete'
private transient List<IVerificationRequired> verificationList = null;
private boolean addOrReplaceDescendantsOf(ResolvedType aspectType, boolean inWeavePhase) {
// System.err.println("Looking at descendants of "+aspectType.getName());
Set<ResolvedType> knownAspects = members.keySet();
- Set<ResolvedType> toBeReplaced = new HashSet<ResolvedType>();
+ Set<ResolvedType> toBeReplaced = new HashSet<>();
for (ResolvedType candidateDescendant : knownAspects) {
// allowMissing = true - if something is missing, it really probably is not a descendant
if ((candidateDescendant != aspectType) && (aspectType.isAssignableFrom(candidateDescendant, true))) {
public List<ShadowMunger> getShadowMungers() {
if (shadowMungers == null) {
- List<ShadowMunger> ret = new ArrayList<ShadowMunger>();
+ List<ShadowMunger> ret = new ArrayList<>();
for (CrosscuttingMembers crosscuttingMembers : members.values()) {
ret.addAll(crosscuttingMembers.getShadowMungers());
}
public List<ConcreteTypeMunger> getTypeMungers() {
if (typeMungers == null) {
- List<ConcreteTypeMunger> ret = new ArrayList<ConcreteTypeMunger>();
+ List<ConcreteTypeMunger> ret = new ArrayList<>();
for (CrosscuttingMembers xmembers : members.values()) {
// With 1.6.9 there is a change that enables use of more optimal accessors (accessors for private fields).
// Here is where we determine if two aspects are asking for access to the same field. If they are
for (ConcreteTypeMunger typeMunger : typeMungers) {
if (typeMunger.getMunger() != null && typeMunger.getMunger().getKind() == kind) {
if (collected == null) {
- collected = new ArrayList<ConcreteTypeMunger>();
+ collected = new ArrayList<>();
}
collected.add(typeMunger);
}
public List<ConcreteTypeMunger> getLateTypeMungers() {
if (lateTypeMungers == null) {
- List<ConcreteTypeMunger> ret = new ArrayList<ConcreteTypeMunger>();
+ List<ConcreteTypeMunger> ret = new ArrayList<>();
for (CrosscuttingMembers crosscuttingMembers : members.values()) {
ret.addAll(crosscuttingMembers.getLateTypeMungers());
}
public List<DeclareSoft> getDeclareSofts() {
if (declareSofts == null) {
- Set<DeclareSoft> ret = new HashSet<DeclareSoft>();
+ Set<DeclareSoft> ret = new HashSet<>();
for (CrosscuttingMembers crosscuttingMembers : members.values()) {
ret.addAll(crosscuttingMembers.getDeclareSofts());
}
- declareSofts = new ArrayList<DeclareSoft>();
+ declareSofts = new ArrayList<>();
declareSofts.addAll(ret);
}
return declareSofts;
public List<DeclareParents> getDeclareParents() {
if (declareParents == null) {
- Set<DeclareParents> ret = new HashSet<DeclareParents>();
+ Set<DeclareParents> ret = new HashSet<>();
for (CrosscuttingMembers crosscuttingMembers : members.values()) {
ret.addAll(crosscuttingMembers.getDeclareParents());
}
- declareParents = new ArrayList<DeclareParents>();
+ declareParents = new ArrayList<>();
declareParents.addAll(ret);
}
return declareParents;
*/
public List<DeclareAnnotation> getDeclareAnnotationOnTypes() {
if (declareAnnotationOnTypes == null) {
- Set<DeclareAnnotation> ret = new LinkedHashSet<DeclareAnnotation>();
+ Set<DeclareAnnotation> ret = new LinkedHashSet<>();
for (CrosscuttingMembers crosscuttingMembers : members.values()) {
ret.addAll(crosscuttingMembers.getDeclareAnnotationOnTypes());
}
- declareAnnotationOnTypes = new ArrayList<DeclareAnnotation>();
+ declareAnnotationOnTypes = new ArrayList<>();
declareAnnotationOnTypes.addAll(ret);
}
return declareAnnotationOnTypes;
*/
public List<DeclareAnnotation> getDeclareAnnotationOnFields() {
if (declareAnnotationOnFields == null) {
- Set<DeclareAnnotation> ret = new LinkedHashSet<DeclareAnnotation>();
+ Set<DeclareAnnotation> ret = new LinkedHashSet<>();
for (CrosscuttingMembers crosscuttingMembers : members.values()) {
ret.addAll(crosscuttingMembers.getDeclareAnnotationOnFields());
}
- declareAnnotationOnFields = new ArrayList<DeclareAnnotation>();
+ declareAnnotationOnFields = new ArrayList<>();
declareAnnotationOnFields.addAll(ret);
}
return declareAnnotationOnFields;
*/
public List<DeclareAnnotation> getDeclareAnnotationOnMethods() {
if (declareAnnotationOnMethods == null) {
- Set<DeclareAnnotation> ret = new LinkedHashSet<DeclareAnnotation>();
+ Set<DeclareAnnotation> ret = new LinkedHashSet<>();
for (CrosscuttingMembers crosscuttingMembers : members.values()) {
ret.addAll(crosscuttingMembers.getDeclareAnnotationOnMethods());
}
- declareAnnotationOnMethods = new ArrayList<DeclareAnnotation>();
+ declareAnnotationOnMethods = new ArrayList<>();
declareAnnotationOnMethods.addAll(ret);
// world.sortDeclareAnnotations(declareAnnotationOnMethods);
}
*/
public List<DeclareTypeErrorOrWarning> getDeclareTypeEows() {
if (declareTypeEows == null) {
- Set<DeclareTypeErrorOrWarning> ret = new HashSet<DeclareTypeErrorOrWarning>();
+ Set<DeclareTypeErrorOrWarning> ret = new HashSet<>();
for (CrosscuttingMembers crosscuttingMembers : members.values()) {
ret.addAll(crosscuttingMembers.getDeclareTypeErrorOrWarning());
}
- declareTypeEows = new ArrayList<DeclareTypeErrorOrWarning>();
+ declareTypeEows = new ArrayList<>();
declareTypeEows.addAll(ret);
}
return declareTypeEows;
public List<Declare> getDeclareDominates() {
if (declareDominates == null) {
- List<Declare> ret = new ArrayList<Declare>();
+ List<Declare> ret = new ArrayList<>();
for (CrosscuttingMembers crosscuttingMembers : members.values()) {
ret.addAll(crosscuttingMembers.getDeclareDominates());
}
*/
public void recordNecessaryCheck(IVerificationRequired verification) {
if (verificationList == null) {
- verificationList = new ArrayList<IVerificationRequired>();
+ verificationList = new ArrayList<>();
}
verificationList.add(verification);
}
// XXX begin hack to avoid a signature refactoring in Pointcut
private ResolvedType concreteAspect;
private ShadowMunger enclosingAdvice;
- private List<ResolvedPointcutDefinition> enclosingDefinition = new ArrayList<ResolvedPointcutDefinition>();
+ private List<ResolvedPointcutDefinition> enclosingDefinition = new ArrayList<>();
public void pushEnclosingDefinition(ResolvedPointcutDefinition def) {
enclosingDefinition.add(def);
*/
public static <T> Filter<T> dupFilter() {
return new Filter<T>() {
- final Set<T> seen = new HashSet<T>(); // should have weak ptrs?
+ final Set<T> seen = new HashSet<>(); // should have weak ptrs?
public Iterator<T> filter(final Iterator<T> in) {
return new Iterator<T>() {
private Member signaturesOfMember;
private ResolvedMember firstDefiningMember;
private World world;
- private List<JoinPointSignature> discoveredSignatures = new ArrayList<JoinPointSignature>();
+ private List<JoinPointSignature> discoveredSignatures = new ArrayList<>();
private List<JoinPointSignature> additionalSignatures = Collections.emptyList();
private Iterator<JoinPointSignature> discoveredSignaturesIterator = null;
private Iterator<ResolvedType> superTypeIterator = null;
private boolean isProxy = false;
- private Set<ResolvedType> visitedSuperTypes = new HashSet<ResolvedType>();
+ private Set<ResolvedType> visitedSuperTypes = new HashSet<>();
private List<SearchPair> yetToBeProcessedSuperMembers = null;
private boolean iteratingOverDiscoveredSignatures = true;
// a common case
discoveredSignatures.add(new JoinPointSignature(firstDefiningMember, originalDeclaringType));
} else {
- List<ResolvedType> declaringTypes = new ArrayList<ResolvedType>();
+ List<ResolvedType> declaringTypes = new ArrayList<>();
accumulateTypesInBetween(originalDeclaringType, firstDefiningType, declaringTypes);
for (ResolvedType declaringType : declaringTypes) {
discoveredSignatures.add(new JoinPointSignature(firstDefiningMember, declaringType));
ResolvedMemberImpl foundMember = (ResolvedMemberImpl) superType.lookupResolvedMember(firstDefiningMember, true,
isProxy);
if (foundMember != null && isVisibleTo(firstDefiningMember, foundMember)) {
- List<ResolvedType> declaringTypes = new ArrayList<ResolvedType>();
+ List<ResolvedType> declaringTypes = new ArrayList<>();
// declaring type can be unresolved if the member can from an ITD...
ResolvedType resolvedDeclaringType = foundMember.getDeclaringType().resolve(world);
accumulateTypesInBetween(superType, resolvedDeclaringType, declaringTypes);
member = new JoinPointSignature(foundMember, declaringType);
discoveredSignatures.add(member); // for next time we are reset
if (additionalSignatures == Collections.EMPTY_LIST) {
- additionalSignatures = new ArrayList<JoinPointSignature>();
+ additionalSignatures = new ArrayList<>();
}
additionalSignatures.add(member); // for this time
}
foundMember.declaringType.resolve(world));
discoveredSignatures.add(member); // for next time we are reset
if (additionalSignatures == Collections.EMPTY_LIST) {
- additionalSignatures = new ArrayList<JoinPointSignature>();
+ additionalSignatures = new ArrayList<>();
}
additionalSignatures.add(member); // for this time
}
if (yetToBeProcessedSuperMembers == null) {
- yetToBeProcessedSuperMembers = new ArrayList<SearchPair>();
+ yetToBeProcessedSuperMembers = new ArrayList<>();
}
yetToBeProcessedSuperMembers.add(new SearchPair(foundMember, superType));
return true;
import org.aspectj.weaver.tools.TraceFactory;
public class Lint {
- Map<String, Lint.Kind> kinds = new HashMap<String, Lint.Kind>();
+ Map<String, Lint.Kind> kinds = new HashMap<>();
/* private */World world;
public final Kind invalidAbsoluteTypeName = new Kind("invalidAbsoluteTypeName", "no match for this type name: {0}");
private static Object[] signatureToTypes(String sig) {
boolean hasParameters = sig.charAt(1) != ')';
if (hasParameters) {
- List<UnresolvedType> l = new ArrayList<UnresolvedType>();
+ List<UnresolvedType> l = new ArrayList<>();
int i = 1;
boolean hasAnyAnglies = sig.indexOf('<') != -1;
while (true) {
public Collection<ResolvedType> getDeclaringTypes(World world) {
ResolvedType myType = getDeclaringType().resolve(world);
- Collection<ResolvedType> ret = new HashSet<ResolvedType>();
+ Collection<ResolvedType> ret = new HashSet<>();
if (kind == CONSTRUCTOR) {
// this is wrong if the member doesn't exist, but that doesn't
// matter
* swapped during incremental compilation, the delegate of the derivatives
* is swapped also.
*/
- private final List<WeakReference<ReferenceType>> derivativeTypes = new ArrayList<WeakReference<ReferenceType>>();
+ private final List<WeakReference<ReferenceType>> derivativeTypes = new ArrayList<>();
/**
* For parameterized types (or the raw type) - this field points to the
ResolvedMember[] parameterizedMethods = null;
ResolvedMember[] parameterizedFields = null;
ResolvedMember[] parameterizedPointcuts = null;
- WeakReference<ResolvedType[]> parameterizedInterfaces = new WeakReference<ResolvedType[]>(
+ WeakReference<ResolvedType[]> parameterizedInterfaces = new WeakReference<>(
null);
Collection<Declare> parameterizedDeclares = null;
// Collection parameterizedTypeMungers = null;
// checkDuplicates(dependent);
synchronized (derivativeTypes) {
this.derivativeTypes
- .add(new WeakReference<ReferenceType>(dependent));
+ .add(new WeakReference<>(dependent));
}
}
public void checkDuplicates(ReferenceType newRt) {
synchronized (derivativeTypes) {
- List<WeakReference<ReferenceType>> forRemoval = new ArrayList<WeakReference<ReferenceType>>();
+ List<WeakReference<ReferenceType>> forRemoval = new ArrayList<>();
for (WeakReference<ReferenceType> derivativeTypeReference : derivativeTypes) {
ReferenceType derivativeType = derivativeTypeReference.get();
if (derivativeType == null) {
interfaces[i] = delegateInterfaces[i];
}
}
- parameterizedInterfaces = new WeakReference<ResolvedType[]>(
+ parameterizedInterfaces = new WeakReference<>(
interfaces);
return interfaces;
} else if (isRawType()) {
.parameterizedWith(toUseForParameterization);
}
}
- parameterizedInterfaces = new WeakReference<ResolvedType[]>(
+ parameterizedInterfaces = new WeakReference<>(
interfaces);
return interfaces;
}
if (getDelegate().isCacheable()) {
- parameterizedInterfaces = new WeakReference<ResolvedType[]>(
+ parameterizedInterfaces = new WeakReference<>(
delegateInterfaces);
}
return delegateInterfaces;
Collection<Declare> declares = null;
if (ajMembersNeedParameterization()) {
Collection<Declare> genericDeclares = getDelegate().getDeclares();
- parameterizedDeclares = new ArrayList<Declare>();
+ parameterizedDeclares = new ArrayList<>();
Map<String, UnresolvedType> parameterizationMap = getAjMemberParameterizationMap();
for (Declare declareStatement : genericDeclares) {
parameterizedDeclares.add(declareStatement.parameterizeWith(
return getDelegate().getModifiers();
}
- WeakReference<ResolvedType> superclassReference = new WeakReference<ResolvedType>(
+ WeakReference<ResolvedType> superclassReference = new WeakReference<>(
null);
@Override
getMemberParameterizationMap()).resolve(getWorld());
}
if (getDelegate().isCacheable()) {
- superclassReference = new WeakReference<ResolvedType>(ret);
+ superclassReference = new WeakReference<>(ret);
}
return newSuperclass;
}
getWorld());
}
if (getDelegate().isCacheable()) {
- superclassReference = new WeakReference<ResolvedType>(ret);
+ superclassReference = new WeakReference<>(ret);
}
return ret;
}
}
this.delegate = delegate;
synchronized (derivativeTypes) {
- List<WeakReference<ReferenceType>> forRemoval = new ArrayList<WeakReference<ReferenceType>>();
+ List<WeakReference<ReferenceType>> forRemoval = new ArrayList<>();
for (WeakReference<ReferenceType> derivativeRef : derivativeTypes) {
ReferenceType derivative = derivativeRef.get();
if (derivative != null) {
parameterizedInterfaces.clear();
parameterizedMethods = null;
parameterizedPointcuts = null;
- superclassReference = new WeakReference<ResolvedType>(null);
+ superclassReference = new WeakReference<>(null);
}
public int getEndPos() {
newInterfaces = null;
typeVariables = null;
parameterizedInterfaces.clear();
- superclassReference = new WeakReference<ResolvedType>(null);
+ superclassReference = new WeakReference<>(null);
if (getDelegate() != null) {
delegate.ensureConsistent();
}
}
if (newParent.isClass()) {
newSuperclass = newParent;
- superclassReference = new WeakReference<ResolvedType>(null);
+ superclassReference = new WeakReference<>(null);
} else {
if (newInterfaces == null) {
newInterfaces = new ResolvedType[1];
*/
public ReferenceType findDerivativeType(ResolvedType[] typeParameters) {
synchronized (derivativeTypes) {
- List<WeakReference<ReferenceType>> forRemoval = new ArrayList<WeakReference<ReferenceType>>();
+ List<WeakReference<ReferenceType>> forRemoval = new ArrayList<>();
for (WeakReference<ReferenceType> derivativeTypeRef : derivativeTypes) {
ReferenceType derivativeType = derivativeTypeRef.get();
if (derivativeType == null) {
// }
}
- List<ResolvedType> declaringTypes = new ArrayList<ResolvedType>();
+ List<ResolvedType> declaringTypes = new ArrayList<>();
accumulateTypesInBetween(originalDeclaringType, firstDefiningType, declaringTypes);
- Set<ResolvedMember> memberSignatures = new LinkedHashSet<ResolvedMember>();
+ Set<ResolvedMember> memberSignatures = new LinkedHashSet<>();
for (ResolvedType declaringType : declaringTypes) {
memberSignatures.add(new JoinPointSignature(firstDefiningMember, declaringType));
}
// every type between the firstDefiningMember and the root defining
// member.
Iterator<ResolvedType> superTypeIterator = firstDefiningType.getDirectSupertypes();
- List<ResolvedType> typesAlreadyVisited = new ArrayList<ResolvedType>();
+ List<ResolvedType> typesAlreadyVisited = new ArrayList<>();
accumulateMembersMatching(firstDefiningMember, superTypeIterator, typesAlreadyVisited, memberSignatures, false);
}
ResolvedMemberImpl foundMember = (ResolvedMemberImpl) toLookIn.lookupResolvedMember(memberToMatch, true,
ignoreGenerics);
if (foundMember != null && isVisibleTo(memberToMatch, foundMember)) {
- List<ResolvedType> declaringTypes = new ArrayList<ResolvedType>();
+ List<ResolvedType> declaringTypes = new ArrayList<>();
// declaring type can be unresolved if the member can from
// an ITD...
ResolvedType resolvedDeclaringType = foundMember.getDeclaringType().resolve(toLookIn.getWorld());
if (isParameterized && (typeVariables.length != typeParameters.length)) {
throw new IllegalStateException("Wrong number of type parameters supplied");
}
- Map<String, UnresolvedType> typeMap = new HashMap<String, UnresolvedType>();
+ Map<String, UnresolvedType> typeMap = new HashMap<>();
boolean typeParametersSupplied = typeParameters != null && typeParameters.length > 0;
if (typeVariables != null) {
// If no 'replacements' were supplied in the typeParameters array
StringBuffer sig = new StringBuffer();
UnresolvedType[] myParameterTypes = getGenericParameterTypes();
for (UnresolvedType myParameterType : myParameterTypes) {
- appendSigWithTypeVarBoundsRemoved(myParameterType, sig, new HashSet<UnresolvedType>());
+ appendSigWithTypeVarBoundsRemoved(myParameterType, sig, new HashSet<>());
}
myParameterSignatureWithBoundsRemoved = sig.toString();
return myParameterSignatureWithBoundsRemoved;
// This set contains pairs of types whose signatures are concatenated
// together, this means with a fast lookup we can tell if two types
// are equivalent.
- protected static Set<String> validBoxing = new HashSet<String>();
+ protected static Set<String> validBoxing = new HashSet<>();
static {
validBoxing.add("Ljava/lang/Byte;B");
public Iterator<ResolvedType> getHierarchy(final boolean wantGenerics, final boolean wantDeclaredParents) {
final Iterators.Getter<ResolvedType, ResolvedType> interfaceGetter = new Iterators.Getter<ResolvedType, ResolvedType>() {
- List<String> alreadySeen = new ArrayList<String>(); // Strings are signatures (ResolvedType.getSignature())
+ List<String> alreadySeen = new ArrayList<>(); // Strings are signatures (ResolvedType.getSignature())
@Override
public Iterator<ResolvedType> get(ResolvedType type) {
// relatively expensive but hopefully uncommon
if (!wantDeclaredParents && type.hasNewParentMungers()) {
// Throw away interfaces from that array if they were decp'd onto here
- List<Integer> forRemoval = new ArrayList<Integer>();
+ List<Integer> forRemoval = new ArrayList<>();
for (ConcreteTypeMunger munger : type.interTypeMungers) {
if (munger.getMunger() != null) {
ResolvedTypeMunger m = munger.getMunger();
* declared on the superinterfaces. This is expensive - use the getMethods() method if you can!
*/
public List<ResolvedMember> getMethodsWithoutIterator(boolean includeITDs, boolean allowMissing, boolean genericsAware) {
- List<ResolvedMember> methods = new ArrayList<ResolvedMember>();
- Set<String> knowninterfaces = new HashSet<String>();
+ List<ResolvedMember> methods = new ArrayList<>();
+ Set<String> knowninterfaces = new HashSet<>();
addAndRecurse(knowninterfaces, methods, this, includeITDs, allowMissing, genericsAware);
return methods;
}
* @return list of resolvedtypes in this types hierarchy, including this type first
*/
public List<ResolvedType> getHierarchyWithoutIterator(boolean includeITDs, boolean allowMissing, boolean genericsAware) {
- List<ResolvedType> types = new ArrayList<ResolvedType>();
- Set<String> visited = new HashSet<String>();
+ List<ResolvedType> types = new ArrayList<>();
+ Set<String> visited = new HashSet<>();
recurseHierarchy(visited, types, this, includeITDs, allowMissing, genericsAware);
return types;
}
* process interfaces multiple times.
*/
public ResolvedMember lookupMethod(Member m) {
- List<ResolvedType> typesTolookat = new ArrayList<ResolvedType>();
+ List<ResolvedType> typesTolookat = new ArrayList<>();
typesTolookat.add(this);
int pos = 0;
while (pos < typesTolookat.size()) {
return Collections.emptyList();
}
- List<Declare> ret = new ArrayList<Declare>();
+ List<Declare> ret = new ArrayList<>();
// if (this.isAbstract()) {
// for (Iterator i = getDeclares().iterator(); i.hasNext();) {
// Declare dec = (Declare) i.next();
return Collections.emptyList();
}
- List<ShadowMunger> acc = new ArrayList<ShadowMunger>();
+ List<ShadowMunger> acc = new ArrayList<>();
final Iterators.Filter<ResolvedType> dupFilter = Iterators.dupFilter();
Iterators.Getter<ResolvedType, ResolvedType> typeGetter = new Iterators.Getter<ResolvedType, ResolvedType>() {
@Override
return Collections.emptyMap();
}
TypeVariable[] tvs = getGenericType().getTypeVariables();
- Map<String, UnresolvedType> parameterizationMap = new HashMap<String, UnresolvedType>();
+ Map<String, UnresolvedType> parameterizationMap = new HashMap<>();
if (tvs.length != typeParameters.length) {
world.getMessageHandler()
.handleMessage(
}
public List<ShadowMunger> getDeclaredAdvice() {
- List<ShadowMunger> l = new ArrayList<ShadowMunger>();
+ List<ShadowMunger> l = new ArrayList<>();
ResolvedMember[] methods = getDeclaredMethods();
if (isParameterizedType()) {
methods = getGenericType().getDeclaredMethods();
}
private ResolvedMember[] filterInJavaVisible(ResolvedMember[] ms) {
- List<ResolvedMember> l = new ArrayList<ResolvedMember>();
+ List<ResolvedMember> l = new ArrayList<>();
for (ResolvedMember m : ms) {
if (!m.isAjSynthetic() && m.getAssociatedShadowMunger() == null) {
l.add(m);
return ret;
}
- protected List<ConcreteTypeMunger> interTypeMungers = new ArrayList<ConcreteTypeMunger>();
+ protected List<ConcreteTypeMunger> interTypeMungers = new ArrayList<>();
public List<ConcreteTypeMunger> getInterTypeMungers() {
return interTypeMungers;
}
public List<ConcreteTypeMunger> getInterTypeParentMungers() {
- List<ConcreteTypeMunger> l = new ArrayList<ConcreteTypeMunger>();
+ List<ConcreteTypeMunger> l = new ArrayList<>();
for (ConcreteTypeMunger element : interTypeMungers) {
if (element.getMunger() instanceof NewParentTypeMunger) {
l.add(element);
* ??? This method is O(N*M) where N = number of methods and M is number of inter-type declarations in my super
*/
public List<ConcreteTypeMunger> getInterTypeMungersIncludingSupers() {
- ArrayList<ConcreteTypeMunger> ret = new ArrayList<ConcreteTypeMunger>();
+ ArrayList<ConcreteTypeMunger> ret = new ArrayList<>();
collectInterTypeMungers(ret);
return ret;
}
public List<ConcreteTypeMunger> getInterTypeParentMungersIncludingSupers() {
- ArrayList<ConcreteTypeMunger> ret = new ArrayList<ConcreteTypeMunger>();
+ ArrayList<ConcreteTypeMunger> ret = new ArrayList<>();
collectInterTypeParentMungers(ret);
return ret;
}
private Getter<ResolvedType, ResolvedType> ifaceGetter;
Iterator<ResolvedType> delegate = null;
- public Queue<ResolvedType> toPersue = new LinkedList<ResolvedType>();
- public Set<ResolvedType> visited = new HashSet<ResolvedType>();
+ public Queue<ResolvedType> toPersue = new LinkedList<>();
+ public Set<ResolvedType> visited = new HashSet<>();
SuperInterfaceWalker(Iterators.Getter<ResolvedType, ResolvedType> ifaceGetter) {
this.ifaceGetter = ifaceGetter;
}
// interTypeMungers.clear();
// BUG? Why can't this be clear() instead: 293620 c6
- interTypeMungers = new ArrayList<ConcreteTypeMunger>();
+ interTypeMungers = new ArrayList<>();
}
public boolean isTopmostImplementor(ResolvedType interfaceType) {
}
public List<ResolvedMember> getExposedPointcuts() {
- List<ResolvedMember> ret = new ArrayList<ResolvedMember>();
+ List<ResolvedMember> ret = new ArrayList<>();
if (getSuperclass() != null) {
ret.addAll(getSuperclass().getExposedPointcuts());
}
}
protected static Set<ResolvedMember> readSuperMethodsCalled(VersionedDataInputStream s) throws IOException {
- Set<ResolvedMember> ret = new HashSet<ResolvedMember>();
+ Set<ResolvedMember> ret = new HashSet<>();
int n = -1;
if (s.isAtLeast169()) {
n = s.readByte();
s.writeByte(0);
return;
}
- List<ResolvedMember> ret = new ArrayList<ResolvedMember>(superMethodsCalled);
+ List<ResolvedMember> ret = new ArrayList<>(superMethodsCalled);
Collections.sort(ret);
int n = ret.size();
s.writeByte(n);
count = s.readInt();
}
if (count != 0) {
- List<String> aliases = new ArrayList<String>();
+ List<String> aliases = new ArrayList<>();
for (int i = 0; i < count; i++) {
aliases.add(s.readUTF());
}
public void addMunger(ShadowMunger munger) {
if (checkMunger(munger)) {
if (mungers == Collections.EMPTY_LIST) {
- mungers = new ArrayList<ShadowMunger>();
+ mungers = new ArrayList<>();
}
this.mungers.add(munger);
}
// Stores a set of strings of the form 'aspect1:aspect2' which indicates there is no
// precedence specified between the two aspects at this shadow.
- Set<String> clashingAspects = new HashSet<String>();
+ Set<String> clashingAspects = new HashSet<>();
int max = mungers.size();
// Compare every pair of advice mungers
* manipulation!
*/
public static Set<Kind> toSet(int i) {
- Set<Kind> results = new HashSet<Kind>();
+ Set<Kind> results = new HashSet<>();
for (int j = 0; j < Shadow.SHADOW_KINDS.length; j++) {
Kind k = Shadow.SHADOW_KINDS[j];
if (k.isSet(i)) {
+ "' due to scope exclusion in XML definition"));
}
if (excludedTypes == null) {
- excludedTypes = new HashSet<ResolvedType>();
+ excludedTypes = new HashSet<>();
excludedTypes.add(type);
world.getExclusionMap().put(declaringType, excludedTypes);
} else {
AnnotationNameValuePair nvp = nvPairs.get(0);
ArrayAnnotationValue aav = (ArrayAnnotationValue) nvp.getValue();
AnnotationValue[] avs = aav.getValues();
- Set<String> targets = new HashSet<String>();
+ Set<String> targets = new HashSet<>();
for (AnnotationValue av : avs) {
EnumAnnotationValue value = (EnumAnnotationValue) av;
targets.add(value.getValue());
public void addNameValuePair(AnnotationNameValuePair pair) {
if (nvPairs == null) {
- nvPairs = new ArrayList<AnnotationNameValuePair>();
+ nvPairs = new ArrayList<>();
}
nvPairs.add(pair);
}
private static UnresolvedType[] createTypeParams(String typeParameterSpecification) {
String remainingToProcess = typeParameterSpecification;
- List<UnresolvedType> types = new ArrayList<UnresolvedType>();
+ List<UnresolvedType> types = new ArrayList<>();
while (remainingToProcess.length() != 0) {
int endOfSig = 0;
int anglies = 0;
}
public WeaverStateInfo(boolean reweavable) {
- this(new ArrayList<Entry>(), false, reweavable, reweavableCompressedModeDefault, reweavableDiffModeDefault);
+ this(new ArrayList<>(), false, reweavable, reweavableCompressedModeDefault, reweavableDiffModeDefault);
}
private WeaverStateInfo(List<Entry> typeMungers, boolean oldStyle, boolean reweavableMode, boolean reweavableCompressedMode,
this.reweavable = reweavableMode;
this.reweavableCompressedMode = reweavableCompressedMode;
this.reweavableDiffMode = reweavableMode ? reweavableDiffMode : false;
- this.aspectsAffectingType = new HashSet<String>();
+ this.aspectsAffectingType = new HashSet<>();
this.unwovenClassFile = null;
}
}
int n = s.readShort();
- List<Entry> l = new ArrayList<Entry>();
+ List<Entry> l = new ArrayList<>();
for (int i = 0; i < n; i++) {
// conditional on version
UnresolvedType aspectType = null;
public List<ConcreteTypeMunger> getTypeMungers(ResolvedType onType) {
World world = onType.getWorld();
- List<ConcreteTypeMunger> ret = new ArrayList<ConcreteTypeMunger>();
+ List<ConcreteTypeMunger> ret = new ArrayList<>();
for (Entry entry : typeMungers) {
ResolvedType aspectType = world.resolve(entry.aspectType, true);
if (aspectType.isMissing()) {
// MessageUtil.error(messageHandler,
// WeaverMessages.format(WeaverMessages.CANT_FIND_TYPE,ty.getName()));
if (dumpState_cantFindTypeExceptions == null) {
- dumpState_cantFindTypeExceptions = new ArrayList<RuntimeException>();
+ dumpState_cantFindTypeExceptions = new ArrayList<>();
}
if (dumpState_cantFindTypeExceptions.size() < 100) { // limit growth
dumpState_cantFindTypeExceptions.add(new RuntimeException("Can't find type " + ty.getName()));
public int policy = USE_WEAK_REFS;
// Map of types that never get thrown away
- final Map<String, ResolvedType> tMap = new HashMap<String, ResolvedType>();
+ final Map<String, ResolvedType> tMap = new HashMap<>();
// Map of types that may be ejected from the cache if we need space
final Map<String, Reference<ResolvedType>> expendableMap = Collections
- .synchronizedMap(new WeakHashMap<String, Reference<ResolvedType>>());
+ .synchronizedMap(new WeakHashMap<>());
private final World w;
private boolean memoryProfiling = false;
private int maxExpendableMapSize = -1;
private int collectedTypes = 0;
- private final ReferenceQueue<ResolvedType> rq = new ReferenceQueue<ResolvedType>();
+ private final ReferenceQueue<ResolvedType> rq = new ReferenceQueue<>();
TypeMap(World w) {
// Demotion activated when switched on and loadtime weaving or in AJDT
demotionSystemActive = w.isDemotionActive() && (w.isLoadtimeWeaving() || w.couldIncrementalCompileFollow());
- addedSinceLastDemote = new ArrayList<String>();
- writtenClasses = new ArrayList<String>();
+ addedSinceLastDemote = new ArrayList<>();
+ writtenClasses = new ArrayList<>();
this.w = w;
memoryProfiling = false;// !w.getMessageHandler().isIgnoring(Message.INFO);
}
addedSinceLastDemote.clear();
} else {
// Compile time demotion strategy
- List<String> forRemoval = new ArrayList<String>();
+ List<String> forRemoval = new ArrayList<>();
for (String key : addedSinceLastDemote) {
ResolvedType type = tMap.get(key);
if (type == null) {
// might be GC'd independently.
expendableMap.remove(key);
if (policy == USE_SOFT_REFS) {
- expendableMap.put(key, new SoftReference<ResolvedType>(type));
+ expendableMap.put(key, new SoftReference<>(type));
} else {
- expendableMap.put(key, new WeakReference<ResolvedType>(type));
+ expendableMap.put(key, new WeakReference<>(type));
}
}
}
// Dont use reference queue for tracking if not profiling...
if (policy == USE_WEAK_REFS) {
if (memoryProfiling) {
- expendableMap.put(key, new WeakReference<ResolvedType>(type, rq));
+ expendableMap.put(key, new WeakReference<>(type, rq));
} else {
- expendableMap.put(key, new WeakReference<ResolvedType>(type));
+ expendableMap.put(key, new WeakReference<>(type));
}
} else if (policy == USE_SOFT_REFS) {
if (memoryProfiling) {
- expendableMap.put(key, new SoftReference<ResolvedType>(type, rq));
+ expendableMap.put(key, new SoftReference<>(type, rq));
} else {
- expendableMap.put(key, new SoftReference<ResolvedType>(type));
+ expendableMap.put(key, new SoftReference<>(type));
}
// } else {
// expendableMap.put(key, type);
public AspectPrecedenceCalculator(World forSomeWorld) {
world = forSomeWorld;
- cachedResults = new HashMap<PrecedenceCacheKey, Integer>();
+ cachedResults = new HashMap<>();
}
/**
// --- I would rather stash this against a reference type - but we don't
// guarantee referencetypes are unique for
// so we can't :(
- private final Map<Class<?>, TypeVariable[]> workInProgress1 = new HashMap<Class<?>, TypeVariable[]>();
+ private final Map<Class<?>, TypeVariable[]> workInProgress1 = new HashMap<>();
public TypeVariable[] getTypeVariablesCurrentlyBeingProcessed(Class<?> baseClass) {
return workInProgress1.get(baseClass);
*/
public void registerPointcutHandler(PointcutDesignatorHandler designatorHandler) {
if (pointcutDesignators == null) {
- pointcutDesignators = new HashSet<PointcutDesignatorHandler>();
+ pointcutDesignators = new HashSet<>();
}
pointcutDesignators.add(designatorHandler);
}
// map from aspect > excluded types
// memory issue here?
- private Map<ResolvedType, Set<ResolvedType>> exclusionMap = new HashMap<ResolvedType, Set<ResolvedType>>();
+ private Map<ResolvedType, Set<ResolvedType>> exclusionMap = new HashMap<>();
public Map<ResolvedType, Set<ResolvedType>> getExclusionMap() {
return exclusionMap;
long typeCount;
long perJoinpointCount;
long perTypes;
- Map<String, Long> joinpointsPerPointcut = new HashMap<String, Long>();
- Map<String, Long> timePerPointcut = new HashMap<String, Long>();
- Map<String, Long> fastMatchTimesPerPointcut = new HashMap<String, Long>();
- Map<String, Long> fastMatchTypesPerPointcut = new HashMap<String, Long>();
+ Map<String, Long> joinpointsPerPointcut = new HashMap<>();
+ Map<String, Long> timePerPointcut = new HashMap<>();
+ Map<String, Long> fastMatchTimesPerPointcut = new HashMap<>();
+ Map<String, Long> fastMatchTypesPerPointcut = new HashMap<>();
TimeCollector(World world) {
this.perJoinpointCount = world.timersPerJoinpoint;
this.world = world;
this.joinpointCount = 0;
this.typeCount = 0;
- this.joinpointsPerPointcut = new HashMap<String, Long>();
- this.timePerPointcut = new HashMap<String, Long>();
+ this.joinpointsPerPointcut = new HashMap<>();
+ this.timePerPointcut = new HashMap<>();
}
public void report() {
public List<ExactTypePattern> getExactDeclaringTypes() {
if (exactDeclaringTypes == null) {
- exactDeclaringTypes = new ArrayList<ExactTypePattern>();
+ exactDeclaringTypes = new ArrayList<>();
exactDeclaringTypes.addAll(leftSp.getExactDeclaringTypes());
exactDeclaringTypes.addAll(rightSp.getExactDeclaringTypes());
}
@Override
public List<BindingPattern> getBindingAnnotationTypePatterns() {
if (annotationTypePattern instanceof BindingPattern) { // BindingAnnotationTypePattern) {
- List<BindingPattern> l = new ArrayList<BindingPattern>();
+ List<BindingPattern> l = new ArrayList<>();
l.add((BindingPattern)annotationTypePattern);
return l;
} else {
}
public List<BindingPattern> getBindingAnnotationTypePatterns() {
- List<BindingPattern> l = new ArrayList<BindingPattern>();
+ List<BindingPattern> l = new ArrayList<>();
AnnotationTypePattern[] pats = arguments.getAnnotationPatterns();
for (AnnotationTypePattern pat : pats) {
if (pat instanceof BindingAnnotationTypePattern) {
}
public List<BindingTypePattern> getBindingTypePatterns() {
- List<BindingTypePattern> l = new ArrayList<BindingTypePattern>();
+ List<BindingTypePattern> l = new ArrayList<>();
TypePattern[] pats = arguments.getTypePatterns();
for (TypePattern pat : pats) {
if (pat instanceof BindingTypePattern) {
char[] chars = input.toCharArray();
int i = 0;
- List<BasicToken> tokens = new ArrayList<BasicToken>();
+ List<BasicToken> tokens = new ArrayList<>();
while (i < chars.length) {
char ch = chars[i++];
entryBindings.popEnclosingDefinitition();
}
- List<ShadowMunger> innerCflowEntries = new ArrayList<ShadowMunger>(xcut.getCflowEntries());
+ List<ShadowMunger> innerCflowEntries = new ArrayList<>(xcut.getCflowEntries());
innerCflowEntries.removeAll(previousCflowEntries);
// Four routes of interest through this code (did I hear someone say
return ret;
} else {
- List<Slot> slots = new ArrayList<Slot>();
+ List<Slot> slots = new ArrayList<>();
for (int i = 0, len = freeVars.length; i < len; i++) {
int freeVar = freeVars[i];
}
private void init() {
- this.annotationMethods = new ArrayList<String>();
+ this.annotationMethods = new ArrayList<>();
annotationMethods.add("unknown");
- this.annotationStrings = new ArrayList<String>();
+ this.annotationStrings = new ArrayList<>();
annotationStrings.add("@<annotation>");
}
return Collections.emptyList();
}
- List<ResolvedType> ret = new ArrayList<ResolvedType>();
+ List<ResolvedType> ret = new ArrayList<>();
for (int i = 0; i < parents.size(); i++) {
ResolvedType t = maybeGetNewParent(onType, parents.get(i), onType.getWorld(), reportErrors);
if (t != null) {
if (s.getMajorVersion() >= WeaverVersionInfo.WEAVER_VERSION_MAJOR_AJ160M2) {
int annotationValueCount = s.readInt();
if (annotationValueCount > 0) {
- Map<String, String> aValues = new HashMap<String, String>();
+ Map<String, String> aValues = new HashMap<>();
for (int i = 0; i < annotationValueCount; i++) {
String key = s.readUTF();
String val = s.readUTF();
private static final Map<String, Class<?>> boxedTypesMap;
static {
- primitiveTypesMap = new HashMap<String, Class<?>>();
+ primitiveTypesMap = new HashMap<>();
primitiveTypesMap.put("int", int.class);
primitiveTypesMap.put("short", short.class);
primitiveTypesMap.put("long", long.class);
primitiveTypesMap.put("float", float.class);
primitiveTypesMap.put("double", double.class);
- boxedPrimitivesMap = new HashMap<String, Class<?>>();
+ boxedPrimitivesMap = new HashMap<>();
boxedPrimitivesMap.put("java.lang.Integer", Integer.class);
boxedPrimitivesMap.put("java.lang.Short", Short.class);
boxedPrimitivesMap.put("java.lang.Long", Long.class);
boxedPrimitivesMap.put("java.lang.Float", Float.class);
boxedPrimitivesMap.put("java.lang.Double", Double.class);
- boxedTypesMap = new HashMap<String, Class<?>>();
+ boxedTypesMap = new HashMap<>();
boxedTypesMap.put("int", Integer.class);
boxedTypesMap.put("short", Short.class);
boxedTypesMap.put("long", Long.class);
}
Test ret = Literal.TRUE;
- List<Var> args = new ArrayList<Var>();
+ List<Var> args = new ArrayList<>();
// code style
if (extraParameterFlags >= 0) {
private static Map<String, Integer> modifierFlags = null;
static {
- modifierFlags = new HashMap<String, Integer>();
+ modifierFlags = new HashMap<>();
int flag = 1;
while (flag <= Modifier.STRICT) {
String flagName = Modifier.toString(flag);
public List<ExactTypePattern> getExactDeclaringTypes() {
if (exactDeclaringTypes == null) {
- exactDeclaringTypes = new ArrayList<ExactTypePattern>();
+ exactDeclaringTypes = new ArrayList<>();
exactDeclaringTypes.addAll(leftSp.getExactDeclaringTypes());
exactDeclaringTypes.addAll(rightSp.getExactDeclaringTypes());
}
}
public DeclarePrecedence parseDominates() {
- List<TypePattern> l = new ArrayList<TypePattern>();
+ List<TypePattern> l = new ArrayList<>();
do {
l.add(parseTypePattern());
} while (maybeEat(","));
}
boolean isExtends = t.getString().equals("extends");
- List<TypePattern> l = new ArrayList<TypePattern>();
+ List<TypePattern> l = new ArrayList<>();
do {
l.add(parseTypePattern());
} while (maybeEat(","));
}
public List<String> parseDottedIdentifier() {
- List<String> ret = new ArrayList<String>();
+ List<String> ret = new ArrayList<>();
ret.add(parseIdentifier());
while (maybeEat(".")) {
ret.add(parseIdentifier());
// Parse annotation values. In an expression in @A(a=b,c=d) this method will be
// parsing the a=b,c=d.)
public Map<String, String> parseAnnotationValues() {
- Map<String, String> values = new HashMap<String, String>();
+ Map<String, String> values = new HashMap<>();
boolean seenDefaultValue = false;
do {
String possibleKeyString = parseAnnotationNameValuePattern();
}
public TypePattern parseGenericsWildcardTypePattern() {
- List<NamePattern> names = new ArrayList<NamePattern>();
+ List<NamePattern> names = new ArrayList<>();
names.add(new NamePattern("?"));
TypePattern upperBound = null;
TypePattern[] additionalInterfaceBounds = new TypePattern[0];
// }
public List<NamePattern> parseDottedNamePattern() {
- List<NamePattern> names = new ArrayList<NamePattern>();
+ List<NamePattern> names = new ArrayList<>();
StringBuffer buf = new StringBuffer();
IToken previous = null;
boolean justProcessedEllipsis = false; // Remember if we just dealt with an ellipsis (PR61536)
}
public TypePatternList parseArgumentsPattern(boolean parameterAnnotationsPossible) {
- List<TypePattern> patterns = new ArrayList<TypePattern>();
+ List<TypePattern> patterns = new ArrayList<>();
eat("(");
// ()
}
public AnnotationPatternList parseArgumentsAnnotationPattern() {
- List<AnnotationTypePattern> patterns = new ArrayList<AnnotationTypePattern>();
+ List<AnnotationTypePattern> patterns = new ArrayList<>();
eat("(");
if (maybeEat(")")) {
return new AnnotationPatternList();
IToken t = tokenSource.peek();
if (t.isIdentifier() && t.getString().equals("throws")) {
tokenSource.next();
- List<TypePattern> required = new ArrayList<TypePattern>();
- List<TypePattern> forbidden = new ArrayList<TypePattern>();
+ List<TypePattern> required = new ArrayList<>();
+ List<TypePattern> forbidden = new ArrayList<>();
do {
boolean isForbidden = maybeEat("!");
// ???might want an error for a second ! without a paren
if (!maybeEat("<")) {
return null;
}
- List<TypeVariablePattern> typeVars = new ArrayList<TypeVariablePattern>();
+ List<TypeVariablePattern> typeVars = new ArrayList<>();
TypeVariablePattern t = parseTypeVariable();
typeVars.add(t);
while (maybeEat(",")) {
if (!maybeEat("<")) {
return null;
}
- List<String> typeVarNames = new ArrayList<String>();
+ List<String> typeVarNames = new ArrayList<>();
do {
typeVarNames.add(parseIdentifier());
} while (maybeEat(","));
if (!maybeEat("<")) {
return null;
}
- List<TypePattern> typePats = new ArrayList<TypePattern>();
+ List<TypePattern> typePats = new ArrayList<>();
do {
TypePattern tp = parseTypePattern(true, false);
typePats.add(tp);
}
private TypePattern[] maybeParseAdditionalInterfaceBounds() {
- List<TypePattern> boundsList = new ArrayList<TypePattern>();
+ List<TypePattern> boundsList = new ArrayList<>();
while (maybeEat("&")) {
TypePattern tp = parseTypePattern();
boundsList.add(tp);
// EMPTY
// )
// ;
- List<ShadowMunger> innerCflowEntries = new ArrayList<ShadowMunger>(xcut.getCflowEntries());
+ List<ShadowMunger> innerCflowEntries = new ArrayList<>(xcut.getCflowEntries());
innerCflowEntries.removeAll(previousCflowEntries);
xcut.addConcreteShadowMunger(Advice.makePerCflowEntry(world, concreteEntry, isBelow, cflowStackField, inAspect,
}
private Pointcut simplifyAnd(AndPointcut apc) {
- SortedSet<Pointcut> nodes = new TreeSet<Pointcut>(new PointcutEvaluationExpenseComparator());
+ SortedSet<Pointcut> nodes = new TreeSet<>(new PointcutEvaluationExpenseComparator());
collectAndNodes(apc, nodes);
// look for A and !A, or IfFalse
for (Pointcut element : nodes) {
}
private Pointcut sortOrs(Pointcut pc) {
- SortedSet<Pointcut> nodes = new TreeSet<Pointcut>(new PointcutEvaluationExpenseComparator());
+ SortedSet<Pointcut> nodes = new TreeSet<>(new PointcutEvaluationExpenseComparator());
collectOrNodes(pc, nodes);
// write out with cheapest on left
Iterator<Pointcut> iter = nodes.iterator();
if (onType.isParameterizedType()) {
// build a type map mapping type variable names in the generic type to
// the type parameters presented
- typeVariableMap = new HashMap<String, UnresolvedType>();
+ typeVariableMap = new HashMap<>();
ResolvedType underlyingGenericType = ((ResolvedType) onType).getGenericType();
TypeVariable[] tVars = underlyingGenericType.getTypeVariables();
ResolvedType[] typeParams = ((ResolvedType) onType).getResolvedTypeParameters();
if (searchStart.isParameterizedType()) {
// build a type map mapping type variable names in the generic type to
// the type parameters presented
- typeVariableMap = new HashMap<String, UnresolvedType>();
+ typeVariableMap = new HashMap<>();
ResolvedType underlyingGenericType = searchStart.getGenericType();
TypeVariable[] tVars = underlyingGenericType.getTypeVariables();
ResolvedType[] typeParams = searchStart.getResolvedTypeParameters();
private class TypePatternVisitor extends AbstractPatternNodeVisitor {
private IScope scope;
- private Map<ExactAnnotationTypePattern, AnnotationTargetKind[]> incorrectTargetKinds = new HashMap<ExactAnnotationTypePattern, AnnotationTargetKind[]>();
+ private Map<ExactAnnotationTypePattern, AnnotationTargetKind[]> incorrectTargetKinds = new HashMap<>();
private boolean targetsOtherThanTypeAllowed;
private boolean parameterTargettingAnnotationsAllowed;
if (targetKinds == null) {
return data;
}
- List<AnnotationTargetKind> incorrectTargets = new ArrayList<AnnotationTargetKind>();
+ List<AnnotationTargetKind> incorrectTargets = new ArrayList<>();
for (AnnotationTargetKind targetKind : targetKinds) {
if (targetKind.getName().equals(kind.getName())
|| (targetKind.getName().equals("PARAMETER") && node.isForParameterAnnotationMatch())) {
@Override
public List<ExactTypePattern> getExactDeclaringTypes() {
if (declaringType instanceof ExactTypePattern) {
- List<ExactTypePattern> l = new ArrayList<ExactTypePattern>();
+ List<ExactTypePattern> l = new ArrayList<>();
l.add((ExactTypePattern) declaringType);
return l;
} else {
@Override
public List<BindingPattern> getBindingAnnotationTypePatterns() {
if (annotationTypePattern instanceof BindingAnnotationTypePattern) {
- List<BindingPattern> l = new ArrayList<BindingPattern>();
+ List<BindingPattern> l = new ArrayList<>();
l.add((BindingPattern)annotationTypePattern);
return l;
} else {
@Override
public List<BindingTypePattern> getBindingTypePatterns() {
if (typePattern instanceof BindingTypePattern) {
- List<BindingTypePattern> l = new ArrayList<BindingTypePattern>();
+ List<BindingTypePattern> l = new ArrayList<>();
l.add((BindingTypePattern)typePattern);
return l;
} else {
}
public List<UnresolvedType> getExactTypes() {
- List<UnresolvedType> ret = new ArrayList<UnresolvedType>();
+ List<UnresolvedType> ret = new ArrayList<>();
for (TypePattern typePattern : typePatterns) {
UnresolvedType t = typePattern.getExactType();
if (!ResolvedType.isMissing(t)) {
public class TypePatternQuestions {
- private Map<Question,FuzzyBoolean> questionsAndAnswers = new HashMap<Question,FuzzyBoolean>();
+ private Map<Question,FuzzyBoolean> questionsAndAnswers = new HashMap<>();
public FuzzyBoolean askQuestion(TypePattern pattern, ResolvedType type,
TypePattern.MatchKind kind)
// - the value names are for valid annotation fields
// - the specified values are of the correct type
// - for enums, check the specified values can be resolved in the specified scope
- Map<String,String> replacementValues = new HashMap<String,String>();
+ Map<String,String> replacementValues = new HashMap<>();
Set<String> keys = annotationValues.keySet();
ResolvedMember[] ms = annotationType.getDeclaredMethods();
for (String k: keys) {
if (s.getMajorVersion() >= WeaverVersionInfo.WEAVER_VERSION_MAJOR_AJ160M2) {
int annotationValueCount = s.readInt();
if (annotationValueCount > 0) {
- Map<String, String> aValues = new HashMap<String, String>();
+ Map<String, String> aValues = new HashMap<>();
for (int i = 0; i < annotationValueCount; i++) {
String key = s.readUTF();
String val = s.readUTF();
// part of the declared type name (generated code often uses $s in type
// names). More work required on our part to get this right...
public static char[][] splitNames(String s, boolean convertDollar) {
- List<char[]> ret = new ArrayList<char[]>();
+ List<char[]> ret = new ArrayList<>();
int startIndex = 0;
while (true) {
int breakIndex = s.indexOf('.', startIndex); // what about /
private boolean innerMatchesExactly(String s, boolean isAnonymous, boolean convertDollar /* isNested */) {
- List<char[]> ret = new ArrayList<char[]>();
+ List<char[]> ret = new ArrayList<>();
int startIndex = 0;
while (true) {
int breakIndex = s.indexOf('.', startIndex); // what about /
private String[] preMatch(String[] possibleMatches) {
// if (namePatterns.length != 1) return CollectionUtil.NO_STRINGS;
- List<String> ret = new ArrayList<String>();
+ List<String> ret = new ArrayList<>();
for (String possibleMatch : possibleMatches) {
char[][] names = splitNames(possibleMatch, true); // ??? not most efficient
if (namePatterns[0].matches(names[names.length - 1])) {
@Override
public List<BindingPattern> getBindingAnnotationTypePatterns() {
if (annotationTypePattern instanceof BindingAnnotationTypePattern) {
- List<BindingPattern> l = new ArrayList<BindingPattern>();
+ List<BindingPattern> l = new ArrayList<>();
l.add((BindingPattern)annotationTypePattern);
return l;
} else {
public List<BindingPattern> getBindingAnnotationTypePatterns() {
if (annotationTypePattern instanceof BindingAnnotationTypePattern) {
- List<BindingPattern> l = new ArrayList<BindingPattern>();
+ List<BindingPattern> l = new ArrayList<>();
l.add((BindingPattern)annotationTypePattern);
return l;
} else {
*/
public class ReflectionWorld extends World implements IReflectionWorld {
- private static Map<WeakClassLoaderReference, ReflectionWorld> rworlds = Collections.synchronizedMap(new HashMap<WeakClassLoaderReference, ReflectionWorld>());
+ private static Map<WeakClassLoaderReference, ReflectionWorld> rworlds = Collections.synchronizedMap(new HashMap<>());
private WeakClassLoaderReference classLoaderReference;
private AnnotationFinder annotationFinder;
private boolean mustUseOneFourDelegates = false; // for testing
- private Map<String,Class<?>> inProgressResolutionClasses = new HashMap<String,Class<?>>();
+ private Map<String,Class<?>> inProgressResolutionClasses = new HashMap<>();
public static ReflectionWorld getReflectionWorldFor(WeakClassLoaderReference classLoaderReference) {
private ReflectionWorld world;
private WeakClassLoaderReference classLoaderReference;
private final Set<PointcutPrimitive> supportedPrimitives;
- private final Set<PointcutDesignatorHandler> pointcutDesignators = new HashSet<PointcutDesignatorHandler>();
+ private final Set<PointcutDesignatorHandler> pointcutDesignators = new HashSet<>();
/**
* @return a Set containing every PointcutPrimitive except if, cflow, and cflowbelow (useful for passing to PointcutParser
* constructor).
*/
public static Set<PointcutPrimitive> getAllSupportedPointcutPrimitives() {
- Set<PointcutPrimitive> primitives = new HashSet<PointcutPrimitive>();
+ Set<PointcutPrimitive> primitives = new HashSet<>();
primitives.add(PointcutPrimitive.ADVICE_EXECUTION);
primitives.add(PointcutPrimitive.ARGS);
primitives.add(PointcutPrimitive.CALL);
private World world;
private final Set<PointcutPrimitive> supportedPrimitives;
- private final Set<PointcutDesignatorHandler> pointcutDesignators = new HashSet<PointcutDesignatorHandler>();
+ private final Set<PointcutDesignatorHandler> pointcutDesignators = new HashSet<>();
/**
* @return a Set containing every PointcutPrimitive except if, cflow, and cflowbelow (useful for passing to PointcutParser
* constructor).
*/
public static Set<PointcutPrimitive> getAllSupportedPointcutPrimitives() {
- Set<PointcutPrimitive> primitives = new HashSet<PointcutPrimitive>();
+ Set<PointcutPrimitive> primitives = new HashSet<>();
primitives.add(PointcutPrimitive.ADVICE_EXECUTION);
primitives.add(PointcutPrimitive.ARGS);
primitives.add(PointcutPrimitive.CALL);
ResolvedType ty = world.resolve(tx, true);
assertTrue("Couldnt find type " + tx, !ty.isMissing());
ResolvedType[] lowerTyArray = world.resolve(UnresolvedType.forSignatures(lowers));
- List<ResolvedType> lowerTys = new ArrayList<ResolvedType>(Arrays.asList(lowerTyArray));
+ List<ResolvedType> lowerTys = new ArrayList<>(Arrays.asList(lowerTyArray));
lowerTys.add(ty);
- Set<ResolvedType> allLowerTys = new HashSet<ResolvedType>(lowerTys);
- Set<ResolvedType> allUpperTys = new HashSet<ResolvedType>(Arrays.asList(primitives));
+ Set<ResolvedType> allLowerTys = new HashSet<>(lowerTys);
+ Set<ResolvedType> allUpperTys = new HashSet<>(Arrays.asList(primitives));
allUpperTys.removeAll(allLowerTys);
for (ResolvedType other : allLowerTys) {
public static String[] parseIds(String str) {
if (str.length() == 0)
return ZERO_STRINGS;
- List<String> l = new ArrayList<String>();
+ List<String> l = new ArrayList<>();
int start = 0;
while (true) {
int i = str.indexOf(',', start);
import org.aspectj.weaver.ConstantPoolWriter;
public class ConstantPoolSimulator implements ConstantPoolWriter, ConstantPoolReader {
- List<String> list = new ArrayList<String>();
+ List<String> list = new ArrayList<>();
public int writeUtf8(String string) {
int i = list.indexOf(string);
WildAnnotationTypePattern watp = (WildAnnotationTypePattern) atp;
Map<String,String> m = watp.annotationValues;
Set<String> keys = m.keySet();
- List<String> orderedKeys = new ArrayList<String>();
+ List<String> orderedKeys = new ArrayList<>();
orderedKeys.addAll(keys);
Collections.sort(orderedKeys);
StringBuffer sb = new StringBuffer();
*/
public Field[] getDeclaredFields() {
Field[] fields = clazz.getDeclaredFields();
- List<Field> filteredFields = new ArrayList<Field>();
+ List<Field> filteredFields = new ArrayList<>();
for (Field field : fields)
if (!field.getName().startsWith(ajcMagic)
&& !field.isAnnotationPresent(DeclareWarning.class)
*/
public Field[] getFields() {
Field[] fields = clazz.getFields();
- List<Field> filteredFields = new ArrayList<Field>();
+ List<Field> filteredFields = new ArrayList<>();
for (Field field : fields)
if (!field.getName().startsWith(ajcMagic)
&& !field.isAnnotationPresent(DeclareWarning.class)
*/
public Method[] getDeclaredMethods() {
Method[] methods = clazz.getDeclaredMethods();
- List<Method> filteredMethods = new ArrayList<Method>();
+ List<Method> filteredMethods = new ArrayList<>();
for (Method method : methods) {
if (isReallyAMethod(method)) filteredMethods.add(method);
}
*/
public Method[] getMethods() {
Method[] methods = clazz.getMethods();
- List<Method> filteredMethods = new ArrayList<Method>();
+ List<Method> filteredMethods = new ArrayList<>();
for (Method method : methods) {
if (isReallyAMethod(method)) filteredMethods.add(method);
}
*/
public Pointcut[] getDeclaredPointcuts() {
if (declaredPointcuts != null) return declaredPointcuts;
- List<Pointcut> pointcuts = new ArrayList<Pointcut>();
+ List<Pointcut> pointcuts = new ArrayList<>();
Method[] methods = clazz.getDeclaredMethods();
for (Method method : methods) {
Pointcut pc = asPointcut(method);
*/
public Pointcut[] getPointcuts() {
if (pointcuts != null) return pointcuts;
- List<Pointcut> pcuts = new ArrayList<Pointcut>();
+ List<Pointcut> pcuts = new ArrayList<>();
Method[] methods = clazz.getMethods();
for (Method method : methods) {
Pointcut pc = asPointcut(method);
*/
private Advice[] getDeclaredAdvice(Set ofAdviceTypes) {
if (declaredAdvice == null) initDeclaredAdvice();
- List<Advice> adviceList = new ArrayList<Advice>();
+ List<Advice> adviceList = new ArrayList<>();
for (Advice a : declaredAdvice) {
if (ofAdviceTypes.contains(a.getKind())) adviceList.add(a);
}
private void initDeclaredAdvice() {
Method[] methods = clazz.getDeclaredMethods();
- List<Advice> adviceList = new ArrayList<Advice>();
+ List<Advice> adviceList = new ArrayList<>();
for (Method method : methods) {
Advice advice = asAdvice(method);
if (advice != null) adviceList.add(advice);
*/
private Advice[] getAdvice(Set ofAdviceTypes) {
if (advice == null) initAdvice();
- List<Advice> adviceList = new ArrayList<Advice>();
+ List<Advice> adviceList = new ArrayList<>();
for (Advice a : advice) {
if (ofAdviceTypes.contains(a.getKind())) adviceList.add(a);
}
private void initAdvice() {
Method[] methods = clazz.getMethods();
- List<Advice> adviceList = new ArrayList<Advice>();
+ List<Advice> adviceList = new ArrayList<>();
for (Method method : methods) {
Advice advice = asAdvice(method);
if (advice != null) adviceList.add(advice);
*/
public InterTypeMethodDeclaration[] getDeclaredITDMethods() {
if (this.declaredITDMethods == null) {
- List<InterTypeMethodDeclaration> itdms = new ArrayList<InterTypeMethodDeclaration>();
+ List<InterTypeMethodDeclaration> itdms = new ArrayList<>();
Method[] baseMethods = clazz.getDeclaredMethods();
for (Method m : baseMethods) {
if (!m.getName().contains("ajc$interMethodDispatch1$")) continue;
public InterTypeMethodDeclaration[] getITDMethods() {
if (this.itdMethods == null) {
- List<InterTypeMethodDeclaration> itdms = new ArrayList<InterTypeMethodDeclaration>();
+ List<InterTypeMethodDeclaration> itdms = new ArrayList<>();
Method[] baseMethods = clazz.getDeclaredMethods();
for (Method m : baseMethods) {
if (!m.getName().contains("ajc$interMethod$")) continue;
public InterTypeConstructorDeclaration[] getDeclaredITDConstructors() {
if (this.declaredITDCons == null) {
- List<InterTypeConstructorDeclaration> itdcs = new ArrayList<InterTypeConstructorDeclaration>();
+ List<InterTypeConstructorDeclaration> itdcs = new ArrayList<>();
Method[] baseMethods = clazz.getDeclaredMethods();
for (Method m : baseMethods) {
if (!m.getName().contains("ajc$postInterConstructor")) continue;
public InterTypeConstructorDeclaration[] getITDConstructors() {
if (this.itdCons == null) {
- List<InterTypeConstructorDeclaration> itdcs = new ArrayList<InterTypeConstructorDeclaration>();
+ List<InterTypeConstructorDeclaration> itdcs = new ArrayList<>();
Method[] baseMethods = clazz.getMethods();
for (Method m : baseMethods) {
if (!m.getName().contains("ajc$postInterConstructor")) continue;
}
public InterTypeFieldDeclaration[] getDeclaredITDFields() {
- List<InterTypeFieldDeclaration> itdfs = new ArrayList<InterTypeFieldDeclaration>();
+ List<InterTypeFieldDeclaration> itdfs = new ArrayList<>();
if (this.declaredITDFields == null) {
Method[] baseMethods = clazz.getDeclaredMethods();
for(Method m : baseMethods) {
}
public InterTypeFieldDeclaration[] getITDFields() {
- List<InterTypeFieldDeclaration> itdfs = new ArrayList<InterTypeFieldDeclaration>();
+ List<InterTypeFieldDeclaration> itdfs = new ArrayList<>();
if (this.itdFields == null) {
Method[] baseMethods = clazz.getMethods();
for(Method m : baseMethods) {
}
public DeclareErrorOrWarning[] getDeclareErrorOrWarnings() {
- List<DeclareErrorOrWarning> deows = new ArrayList<DeclareErrorOrWarning>();
+ List<DeclareErrorOrWarning> deows = new ArrayList<>();
for (Field field : clazz.getDeclaredFields()) {
try {
if (field.isAnnotationPresent(DeclareWarning.class)) {
}
public DeclareParents[] getDeclareParents() {
- List<DeclareParents> decps = new ArrayList<DeclareParents>();
+ List<DeclareParents> decps = new ArrayList<>();
for (Method method : clazz.getDeclaredMethods()) {
if (method.isAnnotationPresent(ajcDeclareParents.class)) {
ajcDeclareParents decPAnn = method.getAnnotation(ajcDeclareParents.class);
}
public DeclareSoft[] getDeclareSofts() {
- List<DeclareSoft> decs = new ArrayList<DeclareSoft>();
+ List<DeclareSoft> decs = new ArrayList<>();
for (Method method : clazz.getDeclaredMethods()) {
if (method.isAnnotationPresent(ajcDeclareSoft.class)) {
ajcDeclareSoft decSAnn = method.getAnnotation(ajcDeclareSoft.class);
}
public DeclareAnnotation[] getDeclareAnnotations() {
- List<DeclareAnnotation> decAs = new ArrayList<DeclareAnnotation>();
+ List<DeclareAnnotation> decAs = new ArrayList<>();
for (Method method : clazz.getDeclaredMethods()) {
if (method.isAnnotationPresent(ajcDeclareAnnotation.class)) {
ajcDeclareAnnotation decAnn = method.getAnnotation(ajcDeclareAnnotation.class);
}
public DeclarePrecedence[] getDeclarePrecedence() {
- List<DeclarePrecedence> decps = new ArrayList<DeclarePrecedence>();
+ List<DeclarePrecedence> decps = new ArrayList<>();
// @AspectJ Style
if (clazz.isAnnotationPresent(org.aspectj.lang.annotation.DeclarePrecedence.class)) {
public class AjTypeSystem {
private static Map<Class, WeakReference<AjType>> ajTypes =
- Collections.synchronizedMap(new WeakHashMap<Class,WeakReference<AjType>>());
+ Collections.synchronizedMap(new WeakHashMap<>());
/**
* Return the AspectJ runtime type representation of the given Java type.
if (theAjType != null) {
return theAjType;
} else {
- theAjType = new AjTypeImpl<T>(fromClass);
- ajTypes.put(fromClass, new WeakReference<AjType>(theAjType));
+ theAjType = new AjTypeImpl<>(fromClass);
+ ajTypes.put(fromClass, new WeakReference<>(theAjType));
return theAjType;
}
}
// neither key nor value was found
- AjType<T> theAjType = new AjTypeImpl<T>(fromClass);
- ajTypes.put(fromClass, new WeakReference<AjType>(theAjType));
+ AjType<T> theAjType = new AjTypeImpl<>(fromClass);
+ ajTypes.put(fromClass, new WeakReference<>(theAjType));
return theAjType;
}
}
public void stack$AroundClosure(AroundClosure arc) {
// If input parameter arc is null this is the 'unlink' call from AroundClosure
if (arcs == null) {
- arcs = new Stack<AroundClosure>();
+ arcs = new Stack<>();
}
if (arc==null) {
this.arcs.pop();
public CompilerArg createCompilerarg() {
CompilerArg compilerArg = new CompilerArg();
if (compilerArgs == null) {
- compilerArgs = new ArrayList<CompilerArg>();
+ compilerArgs = new ArrayList<>();
}
compilerArgs.add(compilerArg);
return compilerArg;
private boolean fork;
private String source;
private Html bottom;
- private Vector<FileSet> fileSets = new Vector<FileSet>();
+ private Vector<FileSet> fileSets = new Vector<>();
/** reset all to initial values - permit gc if Ajdoc is held */
public Ajdoc() {
reset();
internalclasspath = null;
argfiles = null;
docletpath = null;
- links = new ArrayList<Link>();
- groups = new ArrayList<Group>();
+ links = new ArrayList<>();
+ groups = new ArrayList<>();
doclet = null;
failonerror = false;
fork = false;
private void addFileSets() {
if(sourcefiles == null)
- sourcefiles = new ArrayList<String>();
+ sourcefiles = new ArrayList<>();
Enumeration<FileSet> e = fileSets.elements();
while (e.hasMoreElements()) {
public void setPackagenames(String list) {
(packagenames == null ?
- packagenames = new ArrayList<String>() :
+ packagenames = new ArrayList<>() :
packagenames).addAll(strings(list, true));
}
public List<File> createArgfiles() {
return (argfiles == null ?
- argfiles = new ArrayList<File>() :
+ argfiles = new ArrayList<>() :
argfiles);
}
public class Doclet {
protected String name;
protected Path path;
- protected List<Param> params = new ArrayList<Param>();
+ protected List<Param> params = new ArrayList<>();
public Doclet() {}
public void setName(String name) {
this.name = name;
}
}
}
- Map<String,List<String>> groupMap = new HashMap<String,List<String>>();
+ Map<String,List<String>> groupMap = new HashMap<>();
for (Group group: groups) {
if (group.title == null) {
throw new BuildException("Group names cannot be null!",
}
List<String> packages = groupMap.get(group.title);
if (packages == null) {
- packages = new ArrayList<String>();
+ packages = new ArrayList<>();
}
packages.addAll(group.packages);
groupMap.put(group.title, packages);
protected final <T> List<T> list(String str, Mapper<T> mapper) {
if (str == null) return Collections.emptyList();
- List<T> list = new ArrayList<T>();
+ List<T> list = new ArrayList<>();
for (StringTokenizer t = new StringTokenizer(str, ",", false);
t.hasMoreTokens();) {
list.add(mapper.map(t.nextToken().trim()));
"-encoding", "-target" });
private static List<String> finalList(String[] args) {
- List<String> result = new ArrayList<String>();
+ List<String> result = new ArrayList<>();
result.addAll(Arrays.asList(args));
return Collections.unmodifiableList(result);
}
private List<List<Arg>> combinations(List<Argument> arglist) {
List<List<Arg>> result = new Vector<>();
- result.add(new Vector<Arg>());
+ result.add(new Vector<>());
for (Argument arg : arglist) {
int N = result.size();
for (int i = 0; i < N; i++) {
is14VMOrGreater = LangUtil.is14VMOrGreater();
}
- private List<ITestStep> testSteps = new ArrayList<ITestStep>();
+ private List<ITestStep> testSteps = new ArrayList<>();
private String dir;
private String pr;
*/
public abstract class AutowiredXMLBasedAjcTestCase extends XMLBasedAjcTestCase {
- private Map<String,AjcTest> testMap = new HashMap<String,AjcTest>();
+ private Map<String,AjcTest> testMap = new HashMap<>();
public void addTest(AjcTest test) {
testMap.put(test.getTitle(), test);
*/
public class CompileSpec implements ITestStep {
- private List<ExpectedMessageSpec> expected = new ArrayList<ExpectedMessageSpec>();
+ private List<ExpectedMessageSpec> expected = new ArrayList<>();
private String files;
private boolean includeClassesDir;
args.append(getExtdirs());
args.append(" ");
}
- List<String> fileList = new ArrayList<String>();
- List<String> jarList = new ArrayList<String>();
+ List<String> fileList = new ArrayList<>();
+ List<String> jarList = new ArrayList<>();
// convention that any jar on file list should be added to inpath
String files = getFiles();
if (files == null) files = "";
protected AjcTestCase.MessageSpec buildMessageSpec() {
List<AjcTestCase.Message> infos = null;
- List<AjcTestCase.Message> warnings = new ArrayList<AjcTestCase.Message>();
- List<AjcTestCase.Message> errors = new ArrayList<AjcTestCase.Message>();
- List<AjcTestCase.Message> fails = new ArrayList<AjcTestCase.Message>();
- List<AjcTestCase.Message> weaveInfos = new ArrayList<AjcTestCase.Message>();
+ List<AjcTestCase.Message> warnings = new ArrayList<>();
+ List<AjcTestCase.Message> errors = new ArrayList<>();
+ List<AjcTestCase.Message> fails = new ArrayList<>();
+ List<AjcTestCase.Message> weaveInfos = new ArrayList<>();
for (ExpectedMessageSpec exMsg: expected) {
String kind = exMsg.getKind();
if (kind.equals("info")) {
- if (infos == null) infos = new ArrayList<AjcTestCase.Message>();
+ if (infos == null) infos = new ArrayList<>();
infos.add(exMsg.toMessage());
} else if (kind.equals("warning")) {
warnings.add(exMsg.toMessage());
private static final String FOOTER =
"}\n";
- private List<AjcTest> tests = new ArrayList<AjcTest>();
+ private List<AjcTest> tests = new ArrayList<>();
private String className;
private String suiteFile;
public class OutputSpec {
- private List<String> expectedOutputLines = new ArrayList<String>();
+ private List<String> expectedOutputLines = new ArrayList<>();
public void addLine(OutputLine line) {
if (line.getVm() == null || matchesThisVm(line.getVm())) {
createFailureMessage(output, -1, outputFound.size());
return;
}
- List<String> expected = new ArrayList<String>();
+ List<String> expected = new ArrayList<>();
expected.addAll(expectedOutputLines);
- List<String> found = new ArrayList<String>();
+ List<String> found = new ArrayList<>();
found.addAll(outputFound);
for (String lineFound : outputFound) {
for (String lineExpected : expectedOutputLines) {
}
private List<String> getOutputFound(String output) {
- List<String> found = new ArrayList<String>();
+ List<String> found = new ArrayList<>();
StringTokenizer strTok = new StringTokenizer(output,"\n");
while(strTok.hasMoreTokens()) {
String outputLine = strTok.nextToken().trim();
*/
public class RunSpec implements ITestStep {
- private List<ExpectedMessageSpec> expected = new ArrayList<ExpectedMessageSpec>();
+ private List<ExpectedMessageSpec> expected = new ArrayList<>();
private String classToRun;
private String moduleToRun; // alternative to classToRun on JDK9+
private String baseDir;
String failMessage = "test \"" + getTest().getTitle() + "\" failed";
try {
File base = new File(getBaseDir());
- classFilesFromClasses = new ArrayList<File>();
+ classFilesFromClasses = new ArrayList<>();
setFiles(classesFiles);
String[] args = buildArgs();
CompilationResult result = inTestCase.ajc(base,args);
File outJar = new File(inDir,name);
FileOutputStream fos = new FileOutputStream(outJar);
JarOutputStream jarOut = new JarOutputStream(fos);
- List<File> classFiles = new ArrayList<File>();
+ List<File> classFiles = new ArrayList<>();
List<File> toExclude = isClasses ? Collections.<File>emptyList() : classFilesFromClasses;
collectClassFiles(inDir,classFiles,toExclude);
if (isClasses) classFilesFromClasses = classFiles;
*/
public abstract class XMLBasedAjcTestCase extends AjcTestCase {
- private static Map<String,AjcTest> testMap = new HashMap<String,AjcTest>();
+ private static Map<String,AjcTest> testMap = new HashMap<>();
private static boolean suiteLoaded = false;
private AjcTest currentTest = null;
- private Stack<Boolean> clearTestAfterRun = new Stack<Boolean>();
+ private Stack<Boolean> clearTestAfterRun = new Stack<>();
public XMLBasedAjcTestCase() {
}
protected void setUp() throws Exception {
super.setUp();
if (!suiteLoaded) {
- testMap = new HashMap<String,AjcTest>();
+ testMap = new HashMap<>();
System.out.println("LOADING SUITE: " + getSpecFile().getPath());
Digester d = getDigester();
try {
* Sort it by name then start position
*/
public List<LocalVariable> sortedLocalVariables(LocalVariableTable lvt) {
- List<LocalVariable> l = new ArrayList<LocalVariable>();
+ List<LocalVariable> l = new ArrayList<>();
LocalVariable lv[] = lvt.getLocalVariableTable();
for (LocalVariable lvEntry : lv) {
l.add(lvEntry);
}
this.xmlElementName = xmlElementName;
messages = new MessageHandler(true);
- options = new ArrayList<String>();
- paths = new ArrayList<String>();
+ options = new ArrayList<>();
+ paths = new ArrayList<>();
// XXXXXunused sourceLocations = new ArrayList();
- keywords = new ArrayList<String>();
- children = new ArrayList<IRunSpec>();
+ keywords = new ArrayList<>();
+ children = new ArrayList<>();
dirChanges = new ArrayList<>();
xmlNames = XMLNames.DEFAULT;
runtime = new RT();
/** @return copy of children list without children to skip */
public ArrayList<IRunSpec> getWorkingChildren() {
if (skipAll) {
- return new ArrayList<IRunSpec>();
+ return new ArrayList<>();
}
if (null == skipSet) {
return getChildren();
}
- ArrayList<IRunSpec> result = new ArrayList<IRunSpec>();
+ ArrayList<IRunSpec> result = new ArrayList<>();
int i = 0;
for (Iterator<IRunSpec> iter = children.listIterator(); iter.hasNext(); i++) {
IRunSpec child = iter.next();
}
private <T> ArrayList<T> makeList(List<T> list) {
- ArrayList<T> result = new ArrayList<T>();
+ ArrayList<T> result = new ArrayList<>();
if (null != list) {
result.addAll(list);
}
final private ArrayList<String> parentOptions;
public RT() {
- parentOptions = new ArrayList<String>();
+ parentOptions = new ArrayList<>();
}
public boolean isVerbose() {
if (LangUtil.isEmpty(validOptions) || LangUtil.isEmpty(parentOptions)) {
return new String[0];
}
- ArrayList<String> result = new ArrayList<String>();
+ ArrayList<String> result = new ArrayList<>();
// boolean haveOption = false;
for (String option : validOptions) {
if (LangUtil.isEmpty(option)) {
REQUIRE_KEYWORDS, SKIP_KEYWORDS, PICK_PR }));
/** Map String titlesName to List (String) of titles to accept */
- private static final Map<String,List<String>> TITLES = new HashMap<String,List<String>>();
+ private static final Map<String,List<String>> TITLES = new HashMap<>();
private static List<String> getTitles(String titlesName) {
return getTitles(titlesName, false);
* @return the unmodifiable List of titles (maybe empty, never null)
*/
private static List<String> parseTitlesList(String titlesList) {
- ArrayList<String> result = new ArrayList<String>();
+ ArrayList<String> result = new ArrayList<>();
String last = null;
StringTokenizer st = new StringTokenizer(titlesList, ",");
while (st.hasMoreTokens()) {
* @return the unmodifiable List of titles (maybe empty, never null)
*/
private static List<String> readTitlesFile(File titlesFile, boolean fail) {
- ArrayList<String> result = new ArrayList<String>();
+ ArrayList<String> result = new ArrayList<>();
Reader reader = null;
try {
reader = new FileReader(titlesFile);
public class AjcTaskCompileCommandTest extends TestCase {
static boolean loggedWarning = false;
static boolean runAllTests = true;
- static ArrayList<File> tempFiles = new ArrayList<File>();
+ static ArrayList<File> tempFiles = new ArrayList<>();
private static File getClassesDir() {
File tempDir = FileUtil.getTempDir("AjcTaskCompileCommandTest-classes");
void runSimpleTest(String path, int expectedErrors) {
File file = new File(path);
assertTrue(path, file.canRead());
- ArrayList<String> list = new ArrayList<String>();
+ ArrayList<String> list = new ArrayList<>();
addCommonArgs(list);
if (path.endsWith(".lst")) {
list.add("-argfile");
* accumulated.
*/
public class AccumulatingFileFilter extends ValidFileFilter {
- Vector<File> files = new Vector<File>();
+ Vector<File> files = new Vector<>();
public final boolean accept(File f) {
if (super.accept(f) && (accumulate(f))) {
files.add(f);
private static ArrayList getExcept(
IMessage[] source,
IMessage.Kind[] skip) {
- ArrayList<IMessage> sink = new ArrayList<IMessage>();
+ ArrayList<IMessage> sink = new ArrayList<>();
if (LangUtil.isEmpty(source)) {
return sink;
}
LangUtil.throwIaxIfNull(checkExists, "checkExists");
LangUtil.throwIaxIfNull(checkContents, "checkContents");
this.messages = new Messages(handler);
- linksToCheck = new ArrayList<Link>();
- checkedUrls = new ArrayList<String>();
- refsToCheck = new ArrayList<String>();
- validRefs = new ArrayList<String>();
+ linksToCheck = new ArrayList<>();
+ checkedUrls = new ArrayList<>();
+ refsToCheck = new ArrayList<>();
+ validRefs = new ArrayList<>();
parser = new HTMLEditorKit() {
public HTMLEditorKit.Parser getParser() {
return super.getParser();
}
public synchronized void run() {
- ArrayList<Link> list = new ArrayList<Link>();
+ ArrayList<Link> list = new ArrayList<>();
while (0 < linksToCheck.size()) {
messages.checkingLinks(linksToCheck.size());
list.clear();
} else {
packageContents = packageNode.getChildren();
}
- List<IProgramElement> files = new ArrayList<IProgramElement>();
+ List<IProgramElement> files = new ArrayList<>();
for (IProgramElement packageItem : packageContents) {
if (packageItem.getKind() == IProgramElement.Kind.FILE_JAVA
|| packageItem.getKind() == IProgramElement.Kind.FILE_ASPECTJ) {
*/
public class AjcSpecXmlReaderTest extends TestCase {
- ArrayList<File> tempFiles = new ArrayList<File>();
+ ArrayList<File> tempFiles = new ArrayList<>();
/**
* Constructor for AjcSpecXmlReaderTest.
* @param name
String xml2Path = path + ".tmp.xml";
final File file1 = new File(xmlPath);
- final ArrayList<File> toDelete = new ArrayList<File>();
+ final ArrayList<File> toDelete = new ArrayList<>();
final AjcSpecXmlReader writer = AjcSpecXmlReader.getReader();
assertTrue("" + file1, file1.canRead());
AjcSpecXmlReader writer = AjcSpecXmlReader.getReader();
File file0 = new File(txtPath);
File file1 = new File(xmlPath);
- ArrayList<File> toDelete = new ArrayList<File>();
+ ArrayList<File> toDelete = new ArrayList<>();
AjcTest.Suite.Spec suite0 = null;
if (file0.canRead()) {
System.out.println("reading " + file0);
}
class DumbCustomMungerFactory implements CustomMungerFactory {
- Collection<ShadowMunger> allShadowMungers = new ArrayList<ShadowMunger>();
- Collection<ConcreteTypeMunger> allTypeMungers = new ArrayList<ConcreteTypeMunger>();
+ Collection<ShadowMunger> allShadowMungers = new ArrayList<>();
+ Collection<ConcreteTypeMunger> allTypeMungers = new ArrayList<>();
public Collection<ShadowMunger> createCustomShadowMungers(ResolvedType aspectType) {
- List<ShadowMunger> mungers = new ArrayList<ShadowMunger>();
+ List<ShadowMunger> mungers = new ArrayList<>();
Pointcut pointcut = new IfPointcut("abc");
mungers.add(new DumbShadowMunger(new DeclareErrorOrWarning(false, pointcut, "")));
allShadowMungers.addAll(mungers);
}
public Collection<ConcreteTypeMunger> createCustomTypeMungers(ResolvedType aspectType) {
- List<ConcreteTypeMunger> mungers = new ArrayList<ConcreteTypeMunger>();
+ List<ConcreteTypeMunger> mungers = new ArrayList<>();
mungers.add(new DumbTypeMunger(null, aspectType));
allTypeMungers.addAll(mungers);
return mungers;
private void constructUpToDateLstFile(String pname, String configname) {
File projectBase = new File(sandboxDir, pname);
File toConstruct = new File(projectBase, configname);
- List<String> filesForCompilation = new ArrayList<String>();
+ List<String> filesForCompilation = new ArrayList<>();
collectUpFiles(projectBase, projectBase, filesForCompilation);
try {
}
public void addXmlConfigFile(String projectName, String xmlfile) {
- List<String> l = new ArrayList<String>();
+ List<String> l = new ArrayList<>();
l.add(xmlfile);
AjCompiler compiler = CompilerFactory.getCompilerForProjectWithDir(sandboxDir + File.separator + projectName);
((MultiProjTestCompilerConfiguration) compiler.getCompilerConfiguration()).setProjectXmlConfigFiles(l);
public void configureAspectPath(String projectName, File aspectpath) {
AjCompiler compiler = CompilerFactory.getCompilerForProjectWithDir(sandboxDir + File.separator + projectName);
- Set<File> s = new HashSet<File>();
+ Set<File> s = new HashSet<>();
s.add(aspectpath);
((MultiProjTestCompilerConfiguration) compiler.getCompilerConfiguration()).setAspectPath(s);
}
}
public static void configureInPath(String projectName, File inpath) {
- Set<File> s = new HashSet<File>();
+ Set<File> s = new HashSet<>();
s.add(inpath);
AjCompiler compiler = CompilerFactory.getCompilerForProjectWithDir(sandboxDir + File.separator + projectName);
((MultiProjTestCompilerConfiguration) compiler.getCompilerConfiguration()).setInpath(s);
File projectBase = new File(sandboxDir, pname);
ICompilerConfiguration icc = compiler.getCompilerConfiguration();
List<String> currentFiles = icc.getProjectSourceFiles();
- List<String> filesForCompilation = new ArrayList<String>();
+ List<String> filesForCompilation = new ArrayList<>();
collectUpFiles(projectBase, projectBase, filesForCompilation);
boolean changed = false;
for (String s : filesForCompilation) {
File projectBase = new File(sandboxDir, pname);
ICompilerConfiguration icc = compiler.getCompilerConfiguration();
List<String> currentXmlFiles = icc.getProjectXmlConfigFiles();
- List<String> collector = new ArrayList<String>();
+ List<String> collector = new ArrayList<>();
collectUpXmlFiles(projectBase, projectBase, collector);
boolean changed = false;
for (String s : collector) {
public static boolean informedAboutKindOfBuild;
public static boolean fullBuildOccurred;
- public static List<String> detectedDeletions = new ArrayList<String>();
+ public static List<String> detectedDeletions = new ArrayList<>();
public static StringBuffer decisions = new StringBuffer();
public static void reset() {
configureProcessorOptions("ProcessorConsumer1","DemoProcessor");
configureNonStandardCompileOptions("ProcessorConsumer1", "-showWeaveInfo");
- Hashtable<String, String> javaOptions = new Hashtable<String, String>();
+ Hashtable<String, String> javaOptions = new Hashtable<>();
javaOptions.put("org.eclipse.jdt.core.compiler.compliance", "1.6");
javaOptions.put("org.eclipse.jdt.core.compiler.codegen.targetPlatform", "1.6");
javaOptions.put("org.eclipse.jdt.core.compiler.source", "1.6");
configureProcessorPath("ProcessorConsumer2", getCompilerForProjectWithName("ProcessorProject2").getCompilerConfiguration().getOutputLocationManager().getDefaultOutputLocation().toString()+File.pathSeparator+
new File(testdataSrcDir + File.separatorChar + "ProcessorProject2" + File.separatorChar + "base"+File.separatorChar+"src").toString());
- Hashtable<String, String> javaOptions = new Hashtable<String, String>();
+ Hashtable<String, String> javaOptions = new Hashtable<>();
javaOptions.put("org.eclipse.jdt.core.compiler.compliance", "1.6");
javaOptions.put("org.eclipse.jdt.core.compiler.codegen.targetPlatform", "1.6");
javaOptions.put("org.eclipse.jdt.core.compiler.source", "1.6");
configureNonStandardCompileOptions("ProcessorConsumer1", "-showWeaveInfo");
- Hashtable<String, String> javaOptions = new Hashtable<String, String>();
+ Hashtable<String, String> javaOptions = new Hashtable<>();
javaOptions.put("org.eclipse.jdt.core.compiler.compliance", "1.6");
javaOptions.put("org.eclipse.jdt.core.compiler.codegen.targetPlatform", "1.6");
javaOptions.put("org.eclipse.jdt.core.compiler.source", "1.6");
}
private void checkCompiledFiles(String projectName, String... expectedCompiledFiles) {
- List<String> compiledFiles = new ArrayList<String>(getCompiledFiles(projectName));
+ List<String> compiledFiles = new ArrayList<>(getCompiledFiles(projectName));
if (compiledFiles.size()!=expectedCompiledFiles.length) {
fail("Expected #"+expectedCompiledFiles.length+" files to be compiled but found that #"+compiledFiles.size()+" files were compiled.\nCompiled="+compiledFiles);
}
public boolean VERBOSE = false;
- private List<String> compiledFiles = new ArrayList<String>();
- private List<String> wovenClasses = new ArrayList<String>();
+ private List<String> compiledFiles = new ArrayList<>();
+ private List<String> wovenClasses = new ArrayList<>();
private long starttime = 0;
private long totaltimetaken = 0;
if (javaOptionsMap != null && !javaOptionsMap.isEmpty())
return javaOptionsMap;
- Hashtable<String, String> ht = new Hashtable<String, String>();
+ Hashtable<String, String> ht = new Hashtable<>();
ht.put("org.eclipse.jdt.core.compiler.compliance", "1.5");
ht.put("org.eclipse.jdt.core.compiler.codegen.targetPlatform", "1.5");
ht.put("org.eclipse.jdt.core.compiler.source", "1.5");
public void addDependancy(String projectItDependsOn) {
if (dependants == null) {
- dependants = new ArrayList<String>();
+ dependants = new ArrayList<>();
}
dependants.add(projectItDependsOn);
}
public void addProjectSourceFileChanged(File f) {
if (this.modifiedFiles == null) {
- this.modifiedFiles = new ArrayList<File>();
+ this.modifiedFiles = new ArrayList<>();
}
if (f != null) {
modifiedFiles.add(f);
public void addClasspathEntryChanged(String f) {
if (this.modifiedDirs == null) {
- this.modifiedDirs = new ArrayList<String>();
+ this.modifiedDirs = new ArrayList<>();
}
if (f != null) {
modifiedDirs.add(f);
public MultiProjTestMessageHandler() {
ignoring = new ArrayList<>();
- errorMessages = new ArrayList<IMessage>();
- warningMessages = new ArrayList<IMessage>();
- weavingMessages = new ArrayList<IMessage>();
+ errorMessages = new ArrayList<>();
+ warningMessages = new ArrayList<>();
+ weavingMessages = new ArrayList<>();
compilerErrors = new ArrayList<>();
ignore(IMessage.INFO);
ignore(IMessage.WEAVEINFO);
public void testOutputLocationCallbacks2() {
String p = "pr268827_ol_res";
initialiseProject(p);
- Map<String,File> m = new HashMap<String,File>();
+ Map<String,File> m = new HashMap<>();
m.put("a.txt", new File(getFile(p, "src/a.txt")));
configureResourceMap(p, m);
CustomOLM olm = new CustomOLM(getProjectRelativePath(p, ".").toString());
String p = "pr266420";
initialiseProject(p);
- Hashtable<String,String> javaOptions = new Hashtable<String,String>();
+ Hashtable<String,String> javaOptions = new Hashtable<>();
javaOptions.put("org.eclipse.jdt.core.compiler.compliance", "1.6");
javaOptions.put("org.eclipse.jdt.core.compiler.codegen.targetPlatform", "1.6");
javaOptions.put("org.eclipse.jdt.core.compiler.source", "1.6");
public void testInvalidAspectpath_pr121395() {
initialiseProject("P1");
File f = new File("foo.jar");
- Set<File> s = new HashSet<File>();
+ Set<File> s = new HashSet<>();
s.add(f);
configureAspectPath("P1", s);
build("P1"); // This first build will be batch
List<String> viaIteratorList = exhaustTypeIterator(typeA.getHierarchy(wantGenerics, false));
List<ResolvedType> typeDirectlyList = typeA.getHierarchyWithoutIterator(true, true, wantGenerics);
assertFalse(viaIteratorList.isEmpty());
- List<String> directlyList = new ArrayList<String>();
+ List<String> directlyList = new ArrayList<>();
for (ResolvedType type : typeDirectlyList) {
String n = type.getName();
if (!directlyList.contains(n)) {
}
private List<ResolvedMember> getThemAll(Iterator<ResolvedMember> methods) {
- List<ResolvedMember> allOfThem = new ArrayList<ResolvedMember>();
+ List<ResolvedMember> allOfThem = new ArrayList<>();
while (methods.hasNext()) {
allOfThem.add(methods.next());
}
}
private List<String> exhaustTypeIterator(Iterator<ResolvedType> types) {
- List<String> allOfThem = new ArrayList<String>();
+ List<String> allOfThem = new ArrayList<>();
while (types.hasNext()) {
allOfThem.add(types.next().getName());
}
public void testPR164384_1() {
initialiseProject("PR164384");
- Hashtable<String, String> javaOptions = new Hashtable<String, String>();
+ Hashtable<String, String> javaOptions = new Hashtable<>();
javaOptions.put("org.eclipse.jdt.core.compiler.compliance", "1.6");
javaOptions.put("org.eclipse.jdt.core.compiler.codegen.targetPlatform", "1.6");
javaOptions.put("org.eclipse.jdt.core.compiler.source", "1.6");
public void testPR164384_2() {
initialiseProject("PR164384");
- Hashtable<String, String> javaOptions = new Hashtable<String, String>();
+ Hashtable<String, String> javaOptions = new Hashtable<>();
javaOptions.put("org.eclipse.jdt.core.compiler.compliance", "1.6");
javaOptions.put("org.eclipse.jdt.core.compiler.codegen.targetPlatform", "1.5");
javaOptions.put("org.eclipse.jdt.core.compiler.source", "1.5");
public void testPR164384_3() {
initialiseProject("PR164384");
- Hashtable<String, String> javaOptions = new Hashtable<String, String>();
+ Hashtable<String, String> javaOptions = new Hashtable<>();
javaOptions.put("org.eclipse.jdt.core.compiler.compliance", "1.6");
javaOptions.put("org.eclipse.jdt.core.compiler.codegen.targetPlatform", "1.6");
javaOptions.put("org.eclipse.jdt.core.compiler.source", "1.5");
// set up the inpath to have the directory on it's path
File f = new File(inpathDir);
- Set<File> s = new HashSet<File>();
+ Set<File> s = new HashSet<>();
s.add(f);
configureInPath("inpathTesting", s);
build("inpathTesting");
// set up the inpath to have the directory on it's path
System.out.println(inpathDir);
File f = new File(inpathDir);
- Set<File> s = new HashSet<File>();
+ Set<File> s = new HashSet<>();
s.add(f);
configureInPath(p, s);
build(p);
// set up the inpath to have the directory on it's path
File f = new File(inpathDir);
- Set<File> s = new HashSet<File>();
+ Set<File> s = new HashSet<>();
s.add(f);
configureInPath(p, s);
// set up the inpath to have the directory on it's path
System.out.println(inpathDir);
File f = new File(inpathDir);
- Set<File> s = new HashSet<File>();
+ Set<File> s = new HashSet<>();
s.add(f);
- Map<File, String> m = new HashMap<File, String>();
+ Map<File, String> m = new HashMap<>();
m.put(f, "wibble");
configureOutputLocationManager(p, new TestOutputLocationManager(getProjectRelativePath(p, ".").toString(), m));
for (IRelationship element : rels) {
List<String> targets = element.getTargets();
if (output == null) {
- output = new ArrayList<String>();
+ output = new ArrayList<>();
}
output.addAll(targets);
}
private void compareModel(File expectedF) {
if (debugTest)
System.out.println("comparing with model in file " + expectedF.getAbsolutePath());
- List<String> fileContents = new ArrayList<String>();
+ List<String> fileContents = new ArrayList<>();
try {
// String sandboxDir = ajc.getSandboxDirectory().getAbsolutePath();
String modelOutput = modelFilename;
while ((expectedLine = expect.readLine()) != null) {
fileContents.add(expectedLine);
}
- List<String> expectedFileContents = new ArrayList<String>();
+ List<String> expectedFileContents = new ArrayList<>();
expectedFileContents.addAll(fileContents);
// Load the file with the output from this test run
BufferedReader found = new BufferedReader(new FileReader(new File(modelOutput)));
String foundLine = null;
- List<String> foundFileContents = new ArrayList<String>();
+ List<String> foundFileContents = new ArrayList<>();
while ((foundLine = found.readLine()) != null) {
// int i = foundLine.indexOf(sandboxDir);
// if (i == -1) {
* @return ArrayList with String paths of File under srcDir (relative to srcDir)
*/
public static String[] listFiles(File srcDir) {
- ArrayList<String> result = new ArrayList<String>();
+ ArrayList<String> result = new ArrayList<>();
if ((null != srcDir) && srcDir.canRead()) {
listFiles(srcDir, null, result);
}
* @return ArrayList with String paths of File under srcDir (relative to srcDir)
*/
public static File[] listFiles(File srcDir, FileFilter fileFilter) {
- ArrayList<File> result = new ArrayList<File>();
+ ArrayList<File> result = new ArrayList<>();
if ((null != srcDir) && srcDir.canRead()) {
listFiles(srcDir, result, fileFilter);
}
* @return List of File objects
*/
public static List<File> listClassFiles(File dir) {
- ArrayList<File> result = new ArrayList<File>();
+ ArrayList<File> result = new ArrayList<>();
if ((null != dir) && dir.canRead()) {
listClassFiles(dir, result);
}
LangUtil.throwIaxIfNull(paths, "paths");
File[] result = null;
if (!LangUtil.isEmpty(suffixes)) {
- ArrayList<File> list = new ArrayList<File>();
+ ArrayList<File> list = new ArrayList<>();
for (String path : paths) {
for (String suffix : suffixes) {
if (path.endsWith(suffix)) {
if (LangUtil.isEmpty(sought) || LangUtil.isEmpty(sources)) {
return Collections.emptyList();
}
- ArrayList<String> result = new ArrayList<String>();
+ ArrayList<String> result = new ArrayList<>();
for (String path : sources) {
String error = lineSeek(sought, path, listAll, result);
if ((null != error) && (null != errorSink)) {
}
public static List<String> makeClasspath(URL[] urls) {
- List<String> ret = new LinkedList<String>();
+ List<String> ret = new LinkedList<>();
if (urls != null) {
for (URL url : urls) {
ret.add(toPathString(url));
GenericSignature.ClassSignature classSig = new GenericSignature.ClassSignature();
// FormalTypeParameters-opt
if (maybeEat("<")) {
- List<FormalTypeParameter> formalTypeParametersList = new ArrayList<FormalTypeParameter>();
+ List<FormalTypeParameter> formalTypeParametersList = new ArrayList<>();
do {
formalTypeParametersList.add(parseFormalTypeParameter());
} while (!maybeEat(">"));
formalTypeParametersList.toArray(classSig.formalTypeParameters);
}
classSig.superclassSignature = parseClassTypeSignature();
- List<ClassTypeSignature> superIntSigs = new ArrayList<ClassTypeSignature>();
+ List<ClassTypeSignature> superIntSigs = new ArrayList<>();
while (tokenIndex < tokenStream.length) {
superIntSigs.add(parseClassTypeSignature());
}
TypeSignature returnType = null;
// FormalTypeParameters-opt
if (maybeEat("<")) {
- List<FormalTypeParameter> formalTypeParametersList = new ArrayList<FormalTypeParameter>();
+ List<FormalTypeParameter> formalTypeParametersList = new ArrayList<>();
do {
formalTypeParametersList.add(parseFormalTypeParameter());
} while (!maybeEat(">"));
}
// Parameters
eat("(");
- List<TypeSignature> paramList = new ArrayList<TypeSignature>();
+ List<TypeSignature> paramList = new ArrayList<>();
while (!maybeEat(")")) {
FieldTypeSignature fsig = parseFieldTypeSignature(true);
if (fsig != null) {
if (returnType == null)
returnType = new GenericSignature.BaseTypeSignature(eatIdentifier());
// throws
- List<FieldTypeSignature> throwsList = new ArrayList<FieldTypeSignature>();
+ List<FieldTypeSignature> throwsList = new ArrayList<>();
while (maybeEat("^")) {
FieldTypeSignature fsig = parseFieldTypeSignature(false);
throwsList.add(fsig);
ftp.classBound = new ClassTypeSignature("Ljava/lang/Object;", "Ljava/lang/Object");
}
// Optional InterfaceBounds
- List<FieldTypeSignature> optionalBounds = new ArrayList<FieldTypeSignature>();
+ List<FieldTypeSignature> optionalBounds = new ArrayList<>();
while (maybeEat(":")) {
optionalBounds.add(parseFieldTypeSignature(false));
}
private SimpleClassTypeSignature[] parseNestedTypesHelper(StringBuffer ret) {
boolean brokenSignature = false;
SimpleClassTypeSignature[] nestedTypes;
- List<SimpleClassTypeSignature> nestedTypeList = new ArrayList<SimpleClassTypeSignature>();
+ List<SimpleClassTypeSignature> nestedTypeList = new ArrayList<>();
while (maybeEat(".")) {
ret.append(".");
SimpleClassTypeSignature sig = parseSimpleClassTypeSignature();
private TypeArgument[] maybeParseTypeArguments() {
if (maybeEat("<")) {
- List<TypeArgument> typeArgs = new ArrayList<TypeArgument>();
+ List<TypeArgument> typeArgs = new ArrayList<>();
do {
TypeArgument arg = parseTypeArgument();
typeArgs.add(arg);
public String[] tokenize(String signatureString) {
char[] chars = signatureString.toCharArray();
int index = 0;
- List<String> tokens = new ArrayList<String>();
+ List<String> tokens = new ArrayList<>();
StringBuffer identifier = new StringBuffer();
boolean inParens = false;
boolean inArray = false;
}
private static List<Integer> getFirstNumbers(String vm) {
- List<Integer> result = new ArrayList<Integer>();
+ List<Integer> result = new ArrayList<>();
StringTokenizer st = new StringTokenizer(vm,".-_");
try {
result.add(Integer.parseInt(st.nextToken()));
return new String[0];
}
StringTokenizer st = new StringTokenizer(classpath, File.pathSeparator);
- ArrayList<String> result = new ArrayList<String>(st.countTokens());
+ ArrayList<String> result = new ArrayList<>(st.countTokens());
while (st.hasMoreTokens()) {
String entry = st.nextToken();
if (!LangUtil.isEmpty(entry)) {
if (null == input) {
return Collections.emptyList();
}
- ArrayList<String> result = new ArrayList<String>();
+ ArrayList<String> result = new ArrayList<>();
if (LangUtil.isEmpty(delim) || (!input.contains(delim))) {
result.add(input.trim());
if (LangUtil.isEmpty(text)) {
return Collections.emptyList();
}
- List<String> strings = new ArrayList<String>();
+ List<String> strings = new ArrayList<>();
StringTokenizer tok = new StringTokenizer(text);
while (tok.hasMoreTokens()) {
strings.add(tok.nextToken());
if (0 == sourceLength) {
resultSize = 0;
} else {
- result = new ArrayList<Object>(sourceLength);
+ result = new ArrayList<>(sourceLength);
for (int i = 0; i < sourceLength; i++) {
if ((null != source[i]) && (sinkType.isAssignableFrom(source[i].getClass()))) {
result.add(source[i]);
if (null == checker || (null == stack) || (0 == stack.length())) {
return;
}
- final LinkedList<String> lines = new LinkedList<String>();
+ final LinkedList<String> lines = new LinkedList<>();
StringTokenizer st = new StringTokenizer(stack.toString(), "\n\r");
while (st.hasMoreTokens() && (0 < --maxLines)) {
lines.add(st.nextToken());
if ((null == array) || (1 > array.length)) {
return Collections.emptyList();
}
- ArrayList<T> list = new ArrayList<T>();
+ ArrayList<T> list = new ArrayList<>();
list.addAll(Arrays.asList(array));
return list;
}
*/
public static ProcessController makeProcess(ProcessController controller, String classpath, String mainClass, String[] args) {
File java = LangUtil.getJavaExecutable();
- ArrayList<String> cmd = new ArrayList<String>();
+ ArrayList<String> cmd = new ArrayList<>();
cmd.add(java.getAbsolutePath());
cmd.add("-classpath");
cmd.add(classpath);
LangUtil.throwIaxIfNull(java, "java");
LangUtil.throwIaxIfNull(mainClass, "mainClass");
LangUtil.throwIaxIfNull(args, "args");
- ArrayList<String> cmd = new ArrayList<String>();
+ ArrayList<String> cmd = new ArrayList<>();
cmd.add(java.getAbsolutePath());
cmd.add("-classpath");
cmd.add(classpath);
private static class SortObject<T extends PartialComparable> {
T object;
- List<SortObject<T>> smallerObjects = new LinkedList<SortObject<T>>();
- List<SortObject<T>> biggerObjects = new LinkedList<SortObject<T>>();
+ List<SortObject<T>> smallerObjects = new LinkedList<>();
+ List<SortObject<T>> biggerObjects = new LinkedList<>();
public SortObject(T o) {
object = o;
}
private static <T extends PartialComparable> void addNewPartialComparable(List<SortObject<T>> graph, T o) {
- SortObject<T> so = new SortObject<T>(o);
+ SortObject<T> so = new SortObject<>(o);
for (SortObject<T> other : graph) {
so.addDirectedLinks(other);
}
// ??? I don't like creating this data structure, but it does give good
// ??? separation of concerns.
- List<SortObject<T>> sortList = new LinkedList<SortObject<T>>();
+ List<SortObject<T>> sortList = new LinkedList<>();
for (T object : objects) {
addNewPartialComparable(sortList, object);
}
}
public static void main(String[] args) {
- List<Token> l = new ArrayList<Token>();
+ List<Token> l = new ArrayList<>();
l.add(new Token("a1"));
l.add(new Token("c2"));
l.add(new Token("b3"));
runMainInSameVM(mainClass, args);
return;
}
- ArrayList<File> dirs = new ArrayList<File>();
- ArrayList<File> libs = new ArrayList<File>();
- ArrayList<URL> urls = new ArrayList<URL>();
+ ArrayList<File> dirs = new ArrayList<>();
+ ArrayList<File> libs = new ArrayList<>();
+ ArrayList<URL> urls = new ArrayList<>();
String[] entries = LangUtil.splitClasspath(classpath);
for (String entry : entries) {
URL url = makeURL(entry);
private ReferenceQueue<? super V> rq = new ReferenceQueue();
public SoftHashMap() {
- this.map = new HashMap<K,SpecialValue>();
+ this.map = new HashMap<>();
}
class SpecialValue extends SoftReference<V> {
@Override
public java.util.Set<Map.Entry<K,V>> entrySet() {
if (map.isEmpty()) { return Collections.<K,V>emptyMap().entrySet(); }
- Map<K,V> currentContents = new HashMap<K,V>();
+ Map<K,V> currentContents = new HashMap<>();
for (Map.Entry<K,SpecialValue> entry: map.entrySet()) {
V currentValueForEntry = entry.getValue().get();
if (currentValueForEntry != null) {
super(urls);
LangUtil.throwIaxIfNotAssignable(dirs, File.class, "dirs");
this.urlsForDebugString = urls;
- ArrayList<File> dcopy = new ArrayList<File>();
+ ArrayList<File> dcopy = new ArrayList<>();
if (!LangUtil.isEmpty(dirs)) {
dcopy.addAll(Arrays.asList(dirs));
* @return sorted String[] of all paths to all files under dir ending with one of the listed suffixes but not starting with "."
*/
public static String[] dirPaths(File dir, String[] suffixes) {
- ArrayList<String> result = new ArrayList<String>();
+ ArrayList<String> result = new ArrayList<>();
doDirPaths(dir, result);
// if suffixes required, remove those without suffixes
if (!LangUtil.isEmpty(suffixes)) {
public FileUtilTest(String s) {
super(s);
- tempFiles = new ArrayList<File>();
+ tempFiles = new ArrayList<>();
}
public void tearDown() {
contents += contents;
FileUtil.writeAsString(file, contents);
tempFiles.add(file);
- List<String> sourceList = new ArrayList<String>();
+ List<String> sourceList = new ArrayList<>();
sourceList.add(file.getPath());
- final ArrayList<String> errors = new ArrayList<String>();
+ final ArrayList<String> errors = new ArrayList<>();
final PrintStream errorSink = new PrintStream(System.err, true) {
public void println(String error) {
errors.add(error);
/**
* The list of AjAttribute.XXX that we are populating from the @AJ read
*/
- List<AjAttribute> ajAttributes = new ArrayList<AjAttribute>();
+ List<AjAttribute> ajAttributes = new ArrayList<>();
/**
* The resolved type (class) for which we are reading @AJ for (be it class, method, field annotations)
FormalBinding[] bindings = new org.aspectj.weaver.patterns.FormalBinding[0];
IScope binding = new BindingScope(struct.enclosingType, struct.context, bindings);
// first add the declare implements like
- List<TypePattern> parents = new ArrayList<TypePattern>(1);
+ List<TypePattern> parents = new ArrayList<>(1);
parents.add(parent);
DeclareParents dp = new DeclareParents(typePattern, parents, false);
dp.resolve(binding); // resolves the parent and child parts of the decp
// supplied as just the class return value of the annotated method
NameValuePair interfaceListSpecified = getAnnotationElement(declareMixinAnnotation, "interfaces");
- List<TypePattern> newParents = new ArrayList<TypePattern>(1);
- List<ResolvedType> newInterfaceTypes = new ArrayList<ResolvedType>(1);
+ List<TypePattern> newParents = new ArrayList<>(1);
+ List<ResolvedType> newInterfaceTypes = new ArrayList<>(1);
if (interfaceListSpecified != null) {
ArrayElementValue arrayOfInterfaceTypes = (ArrayElementValue) interfaceListSpecified.getValue();
int numberOfTypes = arrayOfInterfaceTypes.getElementValuesArraySize();
throw new UnreadableDebugInfoException();
}
- List<FormalBinding> bindings = new ArrayList<FormalBinding>();
+ List<FormalBinding> bindings = new ArrayList<>();
for (int i = 0; i < argumentNames.length; i++) {
String argumentName = argumentNames[i];
UnresolvedType argumentType = UnresolvedType.forSignature(method.getArgumentTypes()[i].getSignature());
}
final int startAtStackIndex = method.isStatic() ? 0 : 1;
- final List<MethodArgument> arguments = new ArrayList<MethodArgument>();
+ final List<MethodArgument> arguments = new ArrayList<>();
LocalVariableTable lt = method.getLocalVariableTable();
if (lt != null) {
LocalVariable[] lvt = lt.getLocalVariableTable();
private static String[] extractArgNamesFromAnnotationValue(Method method, String argNamesFromAnnotation,
AjAttributeMethodStruct methodStruct) {
StringTokenizer st = new StringTokenizer(argNamesFromAnnotation, " ,");
- List<String> args = new ArrayList<String>();
+ List<String> args = new ArrayList<>();
while (st.hasMoreTokens()) {
args.add(st.nextToken());
}
private static void setIgnoreUnboundBindingNames(Pointcut pointcut, FormalBinding[] bindings) {
// register ImplicitBindings as to be ignored since unbound
// TODO is it likely to fail in a bad way if f.e. this(jp) etc ?
- List<String> ignores = new ArrayList<String>();
+ List<String> ignores = new ArrayList<>();
for (FormalBinding formalBinding : bindings) {
if (formalBinding instanceof FormalBinding.ImplicitFormalBinding) {
ignores.add(formalBinding.getName());
@Override
public boolean munge(BcelClassWeaver weaver) {
aspectGen = weaver.getLazyClassGen();
- inlineAccessors = new HashMap<String, ResolvedMember>(0);
- inlineAccessorMethodGens = new HashSet<LazyMethodGen>();
+ inlineAccessors = new HashMap<>(0);
+ inlineAccessorMethodGens = new HashSet<>();
// look for all @Around advices
for (LazyMethodGen methodGen : aspectGen.getMethodGens()) {
InstructionFactory factory = aspectGen.getFactory();
LazyMethodGen method = makeMethodGen(aspectGen, inlineAccessor);
method.makeSynthetic();
- List<AjAttribute> methodAttributes = new ArrayList<AjAttribute>();
+ List<AjAttribute> methodAttributes = new ArrayList<>();
methodAttributes.add(new AjAttribute.AjSynthetic());
methodAttributes.add(new AjAttribute.EffectiveSignatureAttribute(resolvedMember, Shadow.MethodCall, false));
method.addAttribute(Utility.bcelAttribute(methodAttributes.get(0), aspectGen.getConstantPool()));
LazyMethodGen method = makeMethodGen(aspectGen, inlineAccessor);
// flag it synthetic, AjSynthetic
method.makeSynthetic();
- List<AjAttribute> methodAttributes = new ArrayList<AjAttribute>();
+ List<AjAttribute> methodAttributes = new ArrayList<>();
methodAttributes.add(new AjAttribute.AjSynthetic());
methodAttributes.add(new AjAttribute.EffectiveSignatureAttribute(resolvedMember, Shadow.MethodCall, false));
method.addAttribute(Utility.bcelAttribute(methodAttributes.get(0), aspectGen.getConstantPool()));
LazyMethodGen method = makeMethodGen(aspectGen, inlineAccessor);
// flag it synthetic, AjSynthetic
method.makeSynthetic();
- List<AjAttribute> methodAttributes = new ArrayList<AjAttribute>();
+ List<AjAttribute> methodAttributes = new ArrayList<>();
methodAttributes.add(new AjAttribute.AjSynthetic());
methodAttributes.add(new AjAttribute.EffectiveSignatureAttribute(resolvedMember, Shadow.FieldGet, false));
// flag the effective signature, so that we can deobfuscate the signature to apply method call pointcut
LazyMethodGen method = makeMethodGen(aspectGen, inlineAccessor);
// flag it synthetic, AjSynthetic
method.makeSynthetic();
- List<AjAttribute> methodAttributes = new ArrayList<AjAttribute>();
+ List<AjAttribute> methodAttributes = new ArrayList<>();
methodAttributes.add(new AjAttribute.AjSynthetic());
methodAttributes.add(new AjAttribute.EffectiveSignatureAttribute(resolvedMember, Shadow.FieldSet, false));
method.addAttribute(Utility.bcelAttribute(methodAttributes.get(0), aspectGen.getConstantPool()));
return Collections.emptyList();
}
- Collection<ResolvedType> ret = new ArrayList<ResolvedType>();
+ Collection<ResolvedType> ret = new ArrayList<>();
World world = concreteAspect.getWorld();
ResolvedType runtimeException = world.getCoreType(UnresolvedType.RUNTIME_EXCEPTION);
ResolvedType error = world.getCoreType(UnresolvedType.ERROR);
NameValuePair envp = values.get(0);
ArrayElementValue aev = (ArrayElementValue) envp.getValue();
ElementValue[] evs = aev.getElementValuesArray();
- Set<String> targets = new HashSet<String>();
+ Set<String> targets = new HashSet<>();
for (ElementValue elementValue : evs) {
EnumElementValue ev = (EnumElementValue) elementValue;
targets.add(ev.getEnumValueString());
private final ConstantPool cpg; // alias of clazz.getConstantPoolGen()
private final InstructionFactory fact; // alias of clazz.getFactory();
- private final List<LazyMethodGen> addedLazyMethodGens = new ArrayList<LazyMethodGen>();
- private final Set<ResolvedMember> addedDispatchTargets = new HashSet<ResolvedMember>();
+ private final List<LazyMethodGen> addedLazyMethodGens = new ArrayList<>();
+ private final Set<ResolvedMember> addedDispatchTargets = new HashSet<>();
private boolean inReweavableMode = false;
private List<IfaceInitList> addedSuperInitializersAsList = null;
- private final Map<ResolvedType, IfaceInitList> addedSuperInitializers = new HashMap<ResolvedType, IfaceInitList>();
- private final List<ConcreteTypeMunger> addedThisInitializers = new ArrayList<ConcreteTypeMunger>();
- private final List<ConcreteTypeMunger> addedClassInitializers = new ArrayList<ConcreteTypeMunger>();
+ private final Map<ResolvedType, IfaceInitList> addedSuperInitializers = new HashMap<>();
+ private final List<ConcreteTypeMunger> addedThisInitializers = new ArrayList<>();
+ private final List<ConcreteTypeMunger> addedClassInitializers = new ArrayList<>();
- private final Map<ResolvedMember, ResolvedMember> mapToAnnotationHolder = new HashMap<ResolvedMember, ResolvedMember>();
+ private final Map<ResolvedMember, ResolvedMember> mapToAnnotationHolder = new HashMap<>();
// private BcelShadow clinitShadow = null;
* This holds the initialization and pre-initialization shadows for this class that were actually matched by mungers (if no
* match, then we don't even create the shadows really).
*/
- private final List<BcelShadow> initializationShadows = new ArrayList<BcelShadow>();
+ private final List<BcelShadow> initializationShadows = new ArrayList<>();
private BcelClassWeaver(BcelWorld world, LazyClassGen clazz, List<ShadowMunger> shadowMungers,
List<ConcreteTypeMunger> typeMungers, List<ConcreteTypeMunger> lateTypeMungers) {
if (kind.isSet(couldMatchKinds)) {
byte k = kind.getKey();
if (indexedShadowMungers[k] == null) {
- indexedShadowMungers[k] = new ArrayList<ShadowMunger>();
+ indexedShadowMungers[k] = new ArrayList<>();
if (!kind.isEnclosingKind()) {
canMatchBodyShadows = true;
}
private static class IfaceInitList implements PartialOrder.PartialComparable {
final ResolvedType onType;
- List<ConcreteTypeMunger> list = new ArrayList<ConcreteTypeMunger>();
+ List<ConcreteTypeMunger> list = new ArrayList<>();
IfaceInitList(ResolvedType onType) {
this.onType = onType;
Set<String> aspectsAffectingType = null;
if (inReweavableMode || clazz.getType().isAspect()) {
- aspectsAffectingType = new HashSet<String>();
+ aspectsAffectingType = new HashSet<>();
}
boolean isChanged = false;
// sort according to: Major: type hierarchy
// within each list: dominates
// don't forget to sort addedThisInitialiers according to dominates
- addedSuperInitializersAsList = new ArrayList<IfaceInitList>(addedSuperInitializers.values());
+ addedSuperInitializersAsList = new ArrayList<>(addedSuperInitializers.values());
addedSuperInitializersAsList = PartialOrder.sort(addedSuperInitializersAsList);
if (addedSuperInitializersAsList == null) {
throw new BCException("circularity in inter-types");
// now go through each method, and match against each method. This
// sets up each method's {@link LazyMethodGen#matchedShadows} field,
// and it also possibly adds to {@link #initializationShadows}.
- List<LazyMethodGen> methodGens = new ArrayList<LazyMethodGen>(clazz.getMethodGens());
+ List<LazyMethodGen> methodGens = new ArrayList<>(clazz.getMethodGens());
for (LazyMethodGen member : methodGens) {
if (!member.hasBody()) {
continue;
// Repeat next step until nothing left to inline...cant go on
// infinetly as compiler will have detected and reported
// "Recursive constructor invocation"
- List<LazyMethodGen> recursiveCtors = new ArrayList<LazyMethodGen>();
+ List<LazyMethodGen> recursiveCtors = new ArrayList<>();
while (inlineSelfConstructors(methodGens, recursiveCtors)) {
}
positionAndImplement(initializationShadows);
// Keep a set of all methods from this type - it'll help us to check if bridge methods
// have already been created, we don't want to do it twice!
- Set<String> methodsSet = new HashSet<String>();
+ Set<String> methodsSet = new HashSet<>();
for (LazyMethodGen aMethod : methods) {
StringBuilder sb = new StringBuilder(aMethod.getName());
sb.append(aMethod.getSignature());
}
String pkgName = clazz.getPackageName();
UnresolvedType[] bm = BcelWorld.fromBcel(bridgeToCandidate.getArgumentTypes());
- List<ResolvedMember> overriddenMethodsCollector = new ArrayList<ResolvedMember>();
+ List<ResolvedMember> overriddenMethodsCollector = new ArrayList<>();
checkForOverride(theSuperclass, name, psig, rsig, bridgeToCandidate.getAccessFlags(), pkgName, bm, overriddenMethodsCollector);
if (overriddenMethodsCollector.size() != 0) {
for (ResolvedMember overriddenMethod : overriddenMethodsCollector) {
* Weave any declare @method/@ctor statements into the members of the supplied class
*/
private boolean weaveDeclareAtMethodCtor(LazyClassGen clazz) {
- List<Integer> reportedProblems = new ArrayList<Integer>();
+ List<Integer> reportedProblems = new ArrayList<>();
List<DeclareAnnotation> allDecams = world.getDeclareAnnotationOnMethods();
if (allDecams.isEmpty()) {
return false; // nothing to do
}
- Set<DeclareAnnotation> unusedDecams = new HashSet<DeclareAnnotation>();
+ Set<DeclareAnnotation> unusedDecams = new HashSet<>();
unusedDecams.addAll(decaMs);
// These methods may have been targeted with declare annotation. Example: ITD on an interface
resolvedmember.setAnnotationTypes(method.getAnnotationTypes());
resolvedmember.setAnnotations(method.getAnnotations());
- List<DeclareAnnotation> worthRetrying = new ArrayList<DeclareAnnotation>();
+ List<DeclareAnnotation> worthRetrying = new ArrayList<>();
boolean modificationOccured = false;
for (DeclareAnnotation decam: decaMs) {
if (decam.matches(resolvedmember, world)) {
while (!worthRetrying.isEmpty() && modificationOccured) {
modificationOccured = false;
// lets have another go
- List<DeclareAnnotation> forRemoval = new ArrayList<DeclareAnnotation>();
+ List<DeclareAnnotation> forRemoval = new ArrayList<>();
for (DeclareAnnotation decam : worthRetrying) {
if (decam.matches(resolvedmember, world)) {
if (doesAlreadyHaveAnnotation(resolvedmember, decam, reportedProblems,false)) {
if (!mg.getName().startsWith(NameMangler.PREFIX)) {
// Single first pass
- List<DeclareAnnotation> worthRetrying = new ArrayList<DeclareAnnotation>();
+ List<DeclareAnnotation> worthRetrying = new ArrayList<>();
boolean modificationOccured = false;
List<AnnotationGen> annotationsToAdd = null;
for (DeclareAnnotation decaM : decaMs) {
}
if (annotationsToAdd == null) {
- annotationsToAdd = new ArrayList<AnnotationGen>();
+ annotationsToAdd = new ArrayList<>();
}
AnnotationGen a = ((BcelAnnotation) decaM.getAnnotation()).getBcelAnnotation();
AnnotationGen ag = new AnnotationGen(a, clazz.getConstantPool(), true);
while (!worthRetrying.isEmpty() && modificationOccured) {
modificationOccured = false;
// lets have another go
- List<DeclareAnnotation> forRemoval = new ArrayList<DeclareAnnotation>();
+ List<DeclareAnnotation> forRemoval = new ArrayList<>();
for (DeclareAnnotation decaM : worthRetrying) {
if (decaM.matches(mg.getMemberView(), world)) {
if (doesAlreadyHaveAnnotation(mg.getMemberView(), decaM, reportedProblems,true)) {
}
if (annotationsToAdd == null) {
- annotationsToAdd = new ArrayList<AnnotationGen>();
+ annotationsToAdd = new ArrayList<>();
}
AnnotationGen a = ((BcelAnnotation) decaM.getAnnotation()).getBcelAnnotation();
// create copy to get the annotation type into the right constant pool
* in type.
*/
private List<DeclareAnnotation> getMatchingSubset(List<DeclareAnnotation> declareAnnotations, ResolvedType type) {
- List<DeclareAnnotation> subset = new ArrayList<DeclareAnnotation>();
+ List<DeclareAnnotation> subset = new ArrayList<>();
for (DeclareAnnotation da : declareAnnotations) {
if (da.couldEverMatch(type)) {
subset.add(da);
* Get a subset of all the type mungers defined on this aspect
*/
private List<ConcreteTypeMunger> getITDSubset(LazyClassGen clazz, ResolvedTypeMunger.Kind wantedKind) {
- List<ConcreteTypeMunger> subset = new ArrayList<ConcreteTypeMunger>();
+ List<ConcreteTypeMunger> subset = new ArrayList<>();
for (ConcreteTypeMunger typeMunger : clazz.getBcelObjectType().getTypeMungers()) {
if (typeMunger.getMunger().getKind() == wantedKind) {
subset.add(typeMunger);
for (ConcreteTypeMunger itdField : itdFields) {
BcelTypeMunger fieldMunger = (BcelTypeMunger) itdField;
ResolvedMember itdIsActually = fieldMunger.getSignature();
- Set<DeclareAnnotation> worthRetrying = new LinkedHashSet<DeclareAnnotation>();
+ Set<DeclareAnnotation> worthRetrying = new LinkedHashSet<>();
boolean modificationOccured = false;
for (DeclareAnnotation decaF : decaFs) {
while (!worthRetrying.isEmpty() && modificationOccured) {
modificationOccured = false;
- List<DeclareAnnotation> forRemoval = new ArrayList<DeclareAnnotation>();
+ List<DeclareAnnotation> forRemoval = new ArrayList<>();
for (DeclareAnnotation decaF : worthRetrying) {
if (decaF.matches(itdIsActually, world)) {
if (decaF.isRemover()) {
// for (Iterator iter = itdsForMethodAndConstructor.iterator(); iter.hasNext();) {
// BcelTypeMunger methodctorMunger = (BcelTypeMunger) iter.next();
ResolvedMember unMangledInterMethod = methodctorMunger.getSignature();
- List<DeclareAnnotation> worthRetrying = new ArrayList<DeclareAnnotation>();
+ List<DeclareAnnotation> worthRetrying = new ArrayList<>();
boolean modificationOccured = false;
for (DeclareAnnotation decaMC : decaMCs) {
while (!worthRetrying.isEmpty() && modificationOccured) {
modificationOccured = false;
- List<DeclareAnnotation> forRemoval = new ArrayList<DeclareAnnotation>();
+ List<DeclareAnnotation> forRemoval = new ArrayList<>();
for (DeclareAnnotation decaMC : worthRetrying) {
if (decaMC.matches(unMangledInterMethod, world)) {
LazyMethodGen annotationHolder = locateAnnotationHolderForFieldMunger(clazz, methodctorMunger);
* as well as on the interfieldinit method.
*/
private boolean weaveDeclareAtField(LazyClassGen clazz) {
- List<Integer> reportedProblems = new ArrayList<Integer>();
+ List<Integer> reportedProblems = new ArrayList<>();
List<DeclareAnnotation> allDecafs = world.getDeclareAnnotationOnFields();
if (allDecafs.isEmpty()) {
return false;
List<BcelField> fields = clazz.getFieldGens();
if (fields != null) {
- Set<DeclareAnnotation> unusedDecafs = new HashSet<DeclareAnnotation>();
+ Set<DeclareAnnotation> unusedDecafs = new HashSet<>();
unusedDecafs.addAll(decafs);
for (BcelField field : fields) {
if (!field.getName().startsWith(NameMangler.PREFIX)) {
// Single first pass
- Set<DeclareAnnotation> worthRetrying = new LinkedHashSet<DeclareAnnotation>();
+ Set<DeclareAnnotation> worthRetrying = new LinkedHashSet<>();
boolean modificationOccured = false;
AnnotationAJ[] dontAddMeTwice = field.getAnnotations();
while (!worthRetrying.isEmpty() && modificationOccured) {
modificationOccured = false;
// lets have another go with any remaining ones
- List<DeclareAnnotation> forRemoval = new ArrayList<DeclareAnnotation>();
+ List<DeclareAnnotation> forRemoval = new ArrayList<>();
for (DeclareAnnotation decaF : worthRetrying) {
if (decaF.matches(field, world)) {
if (decaF.isRemover()) {
}
private Set<String> findAspectsForMungers(LazyMethodGen mg) {
- Set<String> aspectsAffectingType = new HashSet<String>();
+ Set<String> aspectsAffectingType = new HashSet<>();
for (BcelShadow shadow : mg.matchedShadows) {
for (ShadowMunger munger : shadow.getMungers()) {
if (munger instanceof BcelAdvice) {
private boolean inlineSelfConstructors(List<LazyMethodGen> methodGens, List<LazyMethodGen> recursiveCtors) {
boolean inlinedSomething = false;
- List<LazyMethodGen> newRecursiveCtors = new ArrayList<LazyMethodGen>();
+ List<LazyMethodGen> newRecursiveCtors = new ArrayList<>();
for (LazyMethodGen methodGen : methodGens) {
if (!methodGen.getName().equals("<init>")) {
continue;
// search for 'returns' and make them jump to the
// aload_<n>,monitorexit
InstructionHandle walker = body.getStart();
- List<InstructionHandle> rets = new ArrayList<InstructionHandle>();
+ List<InstructionHandle> rets = new ArrayList<>();
while (walker != null) {
if (walker.getInstruction().isReturnInstruction()) {
rets.add(walker);
// search for 'returns' and make them to the
// aload_<n>,monitorexit
InstructionHandle walker = body.getStart();
- List<InstructionHandle> rets = new ArrayList<InstructionHandle>();
+ List<InstructionHandle> rets = new ArrayList<>();
while (walker != null) { // !walker.equals(body.getEnd())) {
if (walker.getInstruction().isReturnInstruction()) {
rets.add(walker);
// search for 'returns' and make them to the aload_<n>,monitorexit
InstructionHandle walker = body.getStart();
- List<InstructionHandle> rets = new ArrayList<InstructionHandle>();
+ List<InstructionHandle> rets = new ArrayList<>();
while (walker != null) { // !walker.equals(body.getEnd())) {
if (walker.getInstruction().isReturnInstruction()) {
rets.add(walker);
InstructionList ret = new InstructionList();
InstructionList sourceList = donor.getBody();
- Map<InstructionHandle, InstructionHandle> srcToDest = new HashMap<InstructionHandle, InstructionHandle>();
+ Map<InstructionHandle, InstructionHandle> srcToDest = new HashMap<>();
ConstantPool donorCpg = donor.getEnclosingClass().getConstantPool();
ConstantPool recipientCpg = recipient.getEnclosingClass().getConstantPool();
}
// second pass: retarget branch instructions, copy ranges and tags
- Map<Tag, Tag> tagMap = new HashMap<Tag, Tag>();
- Map<BcelShadow, BcelShadow> shadowMap = new HashMap<BcelShadow, BcelShadow>();
+ Map<Tag, Tag> tagMap = new HashMap<>();
+ Map<BcelShadow, BcelShadow> shadowMap = new HashMap<>();
for (InstructionHandle dest = ret.getStart(), src = sourceList.getStart(); dest != null; dest = dest.getNext(), src = src
.getNext()) {
Instruction inst = dest.getInstruction();
private boolean match(LazyMethodGen mg) {
BcelShadow enclosingShadow;
- List<BcelShadow> shadowAccumulator = new ArrayList<BcelShadow>();
+ List<BcelShadow> shadowAccumulator = new ArrayList<>();
boolean isOverweaving = world.isOverWeaving();
boolean startsAngly = mg.getName().charAt(0) == '<';
// we want to match ajsynthetic constructors...
*/
private ResolvedMember findResolvedMemberNamed(ResolvedType type, String methodName, UnresolvedType[] params) {
ResolvedMember[] allMethods = type.getDeclaredMethods();
- List<ResolvedMember> candidates = new ArrayList<ResolvedMember>();
+ List<ResolvedMember> candidates = new ArrayList<>();
for (ResolvedMember candidate : allMethods) {
if (candidate.getName().equals(methodName)) {
if (candidate.getArity() == params.length) {
public static ResolvedType classTypeSignature2TypeX(GenericSignature.ClassTypeSignature aClassTypeSignature,
GenericSignature.FormalTypeParameter[] typeParams, World world) throws GenericSignatureFormatException {
- Map<GenericSignature.FormalTypeParameter, ReferenceType> typeMap = new HashMap<GenericSignature.FormalTypeParameter, ReferenceType>();
+ Map<GenericSignature.FormalTypeParameter, ReferenceType> typeMap = new HashMap<>();
ResolvedType ret = classTypeSignature2TypeX(aClassTypeSignature, typeParams, world, typeMap);
fixUpCircularDependencies(ret, typeMap);
return ret;
public static ResolvedType fieldTypeSignature2TypeX(GenericSignature.FieldTypeSignature aFieldTypeSignature,
GenericSignature.FormalTypeParameter[] typeParams, World world) throws GenericSignatureFormatException {
- Map<GenericSignature.FormalTypeParameter, ReferenceType> typeMap = new HashMap<GenericSignature.FormalTypeParameter, ReferenceType>();
+ Map<GenericSignature.FormalTypeParameter, ReferenceType> typeMap = new HashMap<>();
ResolvedType ret = fieldTypeSignature2TypeX(aFieldTypeSignature, typeParams, world, typeMap);
fixUpCircularDependencies(ret, typeMap);
return ret;
public static TypeVariable formalTypeParameter2TypeVariable(GenericSignature.FormalTypeParameter aFormalTypeParameter,
GenericSignature.FormalTypeParameter[] typeParams, World world) throws GenericSignatureFormatException {
- Map<GenericSignature.FormalTypeParameter, ReferenceType> typeMap = new HashMap<GenericSignature.FormalTypeParameter, ReferenceType>();
+ Map<GenericSignature.FormalTypeParameter, ReferenceType> typeMap = new HashMap<>();
return formalTypeParameter2TypeVariable(aFormalTypeParameter, typeParams, world, typeMap);
}
public static ResolvedType typeSignature2TypeX(GenericSignature.TypeSignature aTypeSig,
GenericSignature.FormalTypeParameter[] typeParams, World world) throws GenericSignatureFormatException {
- Map<GenericSignature.FormalTypeParameter, ReferenceType> typeMap = new HashMap<GenericSignature.FormalTypeParameter, ReferenceType>();
+ Map<GenericSignature.FormalTypeParameter, ReferenceType> typeMap = new HashMap<>();
ResolvedType ret = typeSignature2TypeX(aTypeSig, typeParams, world, typeMap);
fixUpCircularDependencies(ret, typeMap);
return ret;
if (nvPair.getNameString().equals("argNames")) {
String argNames = nvPair.getValue().stringifyValue();
StringTokenizer argNameTokenizer = new StringTokenizer(argNames, " ,");
- List<String> argsList = new ArrayList<String>();
+ List<String> argsList = new ArrayList<>();
while (argNameTokenizer.hasMoreTokens()) {
argsList.add(argNameTokenizer.nextToken());
}
// for testing - use with the method above
public String[] getAttributeNames(boolean onlyIncludeAjOnes) {
Attribute[] as = method.getAttributes();
- List<String> names = new ArrayList<String>();
+ List<String> names = new ArrayList<>();
// String[] strs = new String[as.length];
for (Attribute a : as) {
if (!onlyIncludeAjOnes || a.getName().startsWith(AjAttribute.AttributePrefix)) {
private boolean isCodeStyleAspect = false; // not redundant with field
// above!
- private WeakReference<ResolvedType> superTypeReference = new WeakReference<ResolvedType>(null);
- private WeakReference<ResolvedType[]> superInterfaceReferences = new WeakReference<ResolvedType[]>(null);
+ private WeakReference<ResolvedType> superTypeReference = new WeakReference<>(null);
+ private WeakReference<ResolvedType[]> superInterfaceReferences = new WeakReference<>(null);
private int bitflag = 0x0000;
}
World world = getResolvedTypeX().getWorld();
supertype = world.resolve(UnresolvedType.forSignature(superclassSignature));
- superTypeReference = new WeakReference<ResolvedType>(supertype);
+ superTypeReference = new WeakReference<>(supertype);
}
return supertype;
}
interfaceTypes[i] = getResolvedTypeX().getWorld().resolve(UnresolvedType.forSignature(interfaceSignatures[i]));
}
}
- superInterfaceReferences = new WeakReference<ResolvedType[]>(interfaceTypes);
+ superInterfaceReferences = new WeakReference<>(interfaceTypes);
return interfaceTypes;
} else {
return cachedInterfaceTypes;
} catch (RuntimeException re) {
throw new RuntimeException("Problem processing attributes in " + javaClass.getFileName(), re);
}
- List<ResolvedPointcutDefinition> pointcuts = new ArrayList<ResolvedPointcutDefinition>();
- typeMungers = new ArrayList<ConcreteTypeMunger>();
- declares = new ArrayList<Declare>();
+ List<ResolvedPointcutDefinition> pointcuts = new ArrayList<>();
+ typeMungers = new ArrayList<>();
+ declares = new ArrayList<>();
processAttributes(l, pointcuts, false);
ReferenceType type = getResolvedTypeX();
AsmManager asmManager = ((BcelWorld) type.getWorld()).getModelAsAsmManager();
bitflag |= DISCOVERED_ANNOTATION_TARGET_KINDS;
annotationTargetKinds = null; // null means we have no idea or the
// @Target annotation hasn't been used
- List<AnnotationTargetKind> targetKinds = new ArrayList<AnnotationTargetKind>();
+ List<AnnotationTargetKind> targetKinds = new ArrayList<>();
if (isAnnotation()) {
AnnotationAJ[] annotationsOnThisType = getAnnotations();
for (AnnotationAJ a : annotationsOnThisType) {
// proceeding with resolution.
GenericSignature.FormalTypeParameter[] extraFormals = getFormalTypeParametersFromOuterClass();
if (extraFormals.length > 0) {
- List<FormalTypeParameter> allFormals = new ArrayList<FormalTypeParameter>();
+ List<FormalTypeParameter> allFormals = new ArrayList<>();
for (FormalTypeParameter formalTypeParameter : formalsForResolution) {
allFormals.add(formalTypeParameter);
}
if (mungers.size() > 0) {
List<ShadowMunger> src = mungers;
if (s.mungers == Collections.EMPTY_LIST) {
- s.mungers = new ArrayList<ShadowMunger>();
+ s.mungers = new ArrayList<>();
}
List<ShadowMunger> dest = s.mungers;
for (ShadowMunger shadowMunger : src) {
public void addAdvicePreventingLazyTjp(BcelAdvice advice) {
if (badAdvice == null) {
- badAdvice = new ArrayList<BcelAdvice>();
+ badAdvice = new ArrayList<>();
}
badAdvice.add(advice);
}
if (thisAnnotationVars != null) {
return;
}
- thisAnnotationVars = new HashMap<ResolvedType, TypeAnnotationAccessVar>();
+ thisAnnotationVars = new HashMap<>();
// populate..
}
}
targetAnnotationVars = thisAnnotationVars;
} else {
- targetAnnotationVars = new HashMap<ResolvedType, TypeAnnotationAccessVar>();
+ targetAnnotationVars = new HashMap<>();
ResolvedType[] rtx = this.getTargetType().resolve(world).getAnnotationTypes(); // what about annotations we havent
// gotten yet but we will get in
// subclasses?
if (kindedAnnotationVars != null) {
return;
}
- kindedAnnotationVars = new HashMap<ResolvedType, AnnotationAccessVar>();
+ kindedAnnotationVars = new HashMap<>();
ResolvedType[] annotations = null;
Member shadowSignature = getSignature();
if (withinAnnotationVars != null) {
return;
}
- withinAnnotationVars = new HashMap<ResolvedType, AnnotationAccessVar>();
+ withinAnnotationVars = new HashMap<>();
ResolvedType[] annotations = getEnclosingType().resolve(world).getAnnotationTypes();
for (ResolvedType ann : annotations) {
if (withincodeAnnotationVars != null) {
return;
}
- withincodeAnnotationVars = new HashMap<ResolvedType, AnnotationAccessVar>();
+ withincodeAnnotationVars = new HashMap<>();
// For some shadow we are interested in annotations on the method containing that shadow.
ResolvedType[] annotations = getEnclosingMethod().getMemberView().getAnnotationTypes();
* @return a list of all the return instructions in the range of this shadow
*/
private List<InstructionHandle> findReturnInstructions() {
- List<InstructionHandle> returns = new ArrayList<InstructionHandle>();
+ List<InstructionHandle> returns = new ArrayList<>();
for (InstructionHandle ih = range.getStart(); ih != range.getEnd(); ih = ih.getNext()) {
if (ih.getInstruction().isReturnInstruction()) {
returns.add(ih);
// Parameters are: this if there is one, target if there is one and its different to this, then original arguments
// at the shadow, then tjp
String extractedShadowMethodName = NameMangler.aroundShadowMethodName(getSignature(), shadowClass.getNewGeneratedNameTag());
- List<String> parameterNames = new ArrayList<String>();
+ List<String> parameterNames = new ArrayList<>();
boolean shadowClassIsInterface = shadowClass.isInterface();
LazyMethodGen extractedShadowMethod = extractShadowInstructionsIntoNewMethod(extractedShadowMethodName,
shadowClassIsInterface?Modifier.PUBLIC:Modifier.PRIVATE,
munger.getSourceLocation(), parameterNames,shadowClassIsInterface);
- List<BcelVar> argsToCallLocalAdviceMethodWith = new ArrayList<BcelVar>();
- List<BcelVar> proceedVarList = new ArrayList<BcelVar>();
+ List<BcelVar> argsToCallLocalAdviceMethodWith = new ArrayList<>();
+ List<BcelVar> proceedVarList = new ArrayList<>();
int extraParamOffset = 0;
// Create the extra parameters that are needed for passing to proceed
boolean shadowClassIsInterface = getEnclosingClass().isInterface();
LazyMethodGen callbackMethod = extractShadowInstructionsIntoNewMethod(
NameMangler.aroundShadowMethodName(getSignature(), getEnclosingClass().getNewGeneratedNameTag()), shadowClassIsInterface?Modifier.PUBLIC:0,
- munger.getSourceLocation(), new ArrayList<String>(),shadowClassIsInterface);
+ munger.getSourceLocation(), new ArrayList<>(),shadowClassIsInterface);
BcelVar[] adviceVars = munger.getExposedStateAsBcelVars(true);
thisAspect.getClassName());
Map<String, List<String>> declareParentsMap = thisAspectNode.getDeclareParentsMap();
if (declareParentsMap == null) {
- declareParentsMap = new HashMap<String, List<String>>();
+ declareParentsMap = new HashMap<>();
thisAspectNode.setDeclareParentsMap(declareParentsMap);
}
String tname = target.getName();
String pname = newParent.getName();
List<String> newparents = declareParentsMap.get(tname);
if (newparents == null) {
- newparents = new ArrayList<String>();
+ newparents = new ArrayList<>();
declareParentsMap.put(tname, newparents);
}
newparents.add(pname);
} else {
annotationsOnRealMember = realMember.getAnnotations();
}
- Set<ResolvedType> addedAnnotations = new HashSet<ResolvedType>();
+ Set<ResolvedType> addedAnnotations = new HashSet<>();
if (annotationsOnRealMember != null) {
for (AnnotationAJ anno : annotationsOnRealMember) {
AnnotationGen a = ((BcelAnnotation) anno).getBcelAnnotation();
private boolean inReweavableMode = false;
- private transient List<UnwovenClassFile> addedClasses = new ArrayList<UnwovenClassFile>();
- private transient List<String> deletedTypenames = new ArrayList<String>();
+ private transient List<UnwovenClassFile> addedClasses = new ArrayList<>();
+ private transient List<String> deletedTypenames = new ArrayList<>();
// These four are setup by prepareForWeave
private transient List<ShadowMunger> shadowMungerList = null;
private List<ResolvedType> addAspectsFromJarFile(File inFile) throws FileNotFoundException, IOException {
ZipInputStream inStream = new ZipInputStream(new FileInputStream(inFile)); // ??? buffered
- List<ResolvedType> addedAspects = new ArrayList<ResolvedType>();
+ List<ResolvedType> addedAspects = new ArrayList<>();
try {
while (true) {
ZipEntry entry = inStream.getNextEntry();
* @throws IOException
*/
private List<ResolvedType> addAspectsFromDirectory(File directory) throws FileNotFoundException, IOException {
- List<ResolvedType> addedAspects = new ArrayList<ResolvedType>();
+ List<ResolvedType> addedAspects = new ArrayList<>();
File[] classFiles = FileUtil.listFiles(directory, new FileFilter() {
public boolean accept(File pathname) {
return pathname.getName().endsWith(".class");
*
*/
public List<UnwovenClassFile> addDirectoryContents(File inFile, File outDir) throws IOException {
- List<UnwovenClassFile> addedClassFiles = new ArrayList<UnwovenClassFile>();
+ List<UnwovenClassFile> addedClassFiles = new ArrayList<>();
// Get a list of all files (i.e. everything that isnt a directory)
File[] files = FileUtil.listFiles(inFile, new FileFilter() {
*/
public List<UnwovenClassFile> addJarFile(File inFile, File outDir, boolean canBeDirectory) {
// System.err.println("? addJarFile(" + inFile + ", " + outDir + ")");
- List<UnwovenClassFile> addedClassFiles = new ArrayList<UnwovenClassFile>();
+ List<UnwovenClassFile> addedClassFiles = new ArrayList<>();
needToReweaveWorld = true;
JarFile inJar = null;
// across the set of pointcuts....
// Use a map from key based on pc equality, to value based on
// pc identity.
- Map<Pointcut, Pointcut> pcMap = new HashMap<Pointcut, Pointcut>();
+ Map<Pointcut, Pointcut> pcMap = new HashMap<>();
for (ShadowMunger munger: shadowMungers) {
Pointcut p = munger.getPointcut();
Pointcut newP = shareEntriesFromMap(p, pcMap);
if (kindsInCommon != Shadow.NO_SHADOW_KINDS_BITS && couldEverMatchSameJoinPoints(left, right)) {
// we know that every branch binds every formal, so there is no
// ambiguity if each branch binds it in exactly the same way...
- List<String> ambiguousNames = new ArrayList<String>();
+ List<String> ambiguousNames = new ArrayList<>();
for (int i = 0; i < numFormals; i++) {
if (leftBindings[i] == null) {
if (rightBindings[i] != null) {
trace.enter("weave", this, input);
}
ContextToken weaveToken = CompilationAndWeavingContext.enteringPhase(CompilationAndWeavingContext.WEAVING, "");
- Collection<String> wovenClassNames = new ArrayList<String>();
+ Collection<String> wovenClassNames = new ArrayList<>();
IWeaveRequestor requestor = input.getRequestor();
if (world.getModel() != null && world.isMinimalModel()) {
- candidatesForRemoval = new HashSet<IProgramElement>();
+ candidatesForRemoval = new HashSet<>();
}
if (world.getModel() != null && !isBatchWeave) {
AsmManager manager = world.getModelAsAsmManager();
// encountered).
// For class A, the order is superclasses of A then superinterfaces of A
// (and this mechanism is applied recursively)
- List<String> typesToProcess = new ArrayList<String>();
+ List<String> typesToProcess = new ArrayList<>();
for (Iterator<UnwovenClassFile> iter = input.getClassFileIterator(); iter.hasNext();) {
UnwovenClassFile clf = iter.next();
if (clf.shouldBeWoven()) {
// put out a warning
if (world.isInJava5Mode() && world.getLint().adviceDidNotMatch.isEnabled()) {
List l = world.getCrosscuttingMembersSet().getShadowMungers();
- Set<AdviceLocation> alreadyWarnedLocations = new HashSet<AdviceLocation>();
+ Set<AdviceLocation> alreadyWarnedLocations = new HashSet<>();
for (Object o : l) {
ShadowMunger element = (ShadowMunger) o;
Set<String> aspectsPreviouslyInWorld = wsi.getAspectsAffectingType();
// keep track of them just to ensure unique missing aspect error
// reporting
- Set<String> alreadyConfirmedReweavableState = new HashSet<String>();
+ Set<String> alreadyConfirmedReweavableState = new HashSet<>();
for (String requiredTypeSignature : aspectsPreviouslyInWorld) {
// for (Iterator iter = aspectsPreviouslyInWorld.iterator(); iter.hasNext();) {
// String requiredTypeName = (String) iter.next();
}
onType.clearInterTypeMungers();
- List<DeclareParents> decpToRepeat = new ArrayList<DeclareParents>();
+ List<DeclareParents> decpToRepeat = new ArrayList<>();
boolean aParentChangeOccurred = false;
boolean anAnnotationChangeOccurred = false;
while ((aParentChangeOccurred || anAnnotationChangeOccurred) && !decpToRepeat.isEmpty()) {
anAnnotationChangeOccurred = aParentChangeOccurred = false;
- List<DeclareParents> decpToRepeatNextTime = new ArrayList<DeclareParents>();
+ List<DeclareParents> decpToRepeatNextTime = new ArrayList<>();
for (DeclareParents decp : decpToRepeat) {
boolean typeChanged = applyDeclareParents(decp, onType);
if (typeChanged) {
// weaving
FastMatchInfo info = new FastMatchInfo(type, null, world);
- List<ShadowMunger> result = new ArrayList<ShadowMunger>();
+ List<ShadowMunger> result = new ArrayList<>();
if (world.areInfoMessagesEnabled() && world.isTimingEnabled()) {
for (ShadowMunger munger : list) {
}
private static List<String> makeDefaultClasspath(String cp) {
- List<String> classPath = new ArrayList<String>();
+ List<String> classPath = new ArrayList<>();
classPath.addAll(getPathEntries(cp));
classPath.addAll(getPathEntries(ClassPath.getClassPath()));
return classPath;
}
private static List<String> getPathEntries(String s) {
- List<String> ret = new ArrayList<String>();
+ List<String> ret = new ArrayList<>();
StringTokenizer tok = new StringTokenizer(s, File.pathSeparator);
while (tok.hasMoreTokens()) {
ret.add(tok.nextToken());
}
onType.clearInterTypeMungers();
- List<DeclareParents> decpToRepeat = new ArrayList<DeclareParents>();
+ List<DeclareParents> decpToRepeat = new ArrayList<>();
boolean aParentChangeOccurred = false;
boolean anAnnotationChangeOccurred = false;
while ((aParentChangeOccurred || anAnnotationChangeOccurred) && !decpToRepeat.isEmpty()) {
anAnnotationChangeOccurred = aParentChangeOccurred = false;
- List<DeclareParents> decpToRepeatNextTime = new ArrayList<DeclareParents>();
+ List<DeclareParents> decpToRepeatNextTime = new ArrayList<>();
for (DeclareParents decp: decpToRepeat) {
if (applyDeclareParents(decp, onType)) {
aParentChangeOccurred = true;
}
anythingMissing = true;
if (aspectRequiredTypes == null) {
- aspectRequiredTypes = new HashMap<String,String>();
+ aspectRequiredTypes = new HashMap<>();
}
// Record that it has an invalid type reference
aspectRequiredTypes.put(aspectName,requiredTypeName);
return aspectRequiredTypes.containsKey(aspectName);
}
- private List<String> aspectRequiredTypesProcessed = new ArrayList<String>();
+ private List<String> aspectRequiredTypesProcessed = new ArrayList<>();
private Map<String, String> aspectRequiredTypes = null;
public void addAspectRequires(String aspectClassName, String requiredType) {
if (aspectRequiredTypes == null) {
- aspectRequiredTypes = new HashMap<String, String>();
+ aspectRequiredTypes = new HashMap<>();
}
aspectRequiredTypes.put(aspectClassName,requiredType);
}
private int mode;
private boolean initialized = false; // Lazily done
- private List<Definition> definitions = new ArrayList<Definition>();
+ private List<Definition> definitions = new ArrayList<>();
- private List<String> resolvedIncludedAspects = new ArrayList<String>();
- private Map<String, TypePattern> scopes = new HashMap<String, TypePattern>();
+ private List<String> resolvedIncludedAspects = new ArrayList<>();
+ private Map<String, TypePattern> scopes = new HashMap<>();
// these are not set for LTW mode (exclusion of these fast match patterns is handled before the weaver/world are used)
private List<String> includedFastMatchPatterns = Collections.emptyList();
public void ensureInitialized() {
if (!initialized) {
try {
- resolvedIncludedAspects = new ArrayList<String>();
+ resolvedIncludedAspects = new ArrayList<>();
// Process the definitions into something more optimal
for (Definition definition : definitions) {
List<String> aspectNames = definition.getAspectClassNames();
try {
List<String> includePatterns = definition.getIncludePatterns();
if (includePatterns.size() > 0) {
- includedPatterns = new ArrayList<TypePattern>();
- includedFastMatchPatterns = new ArrayList<String>();
+ includedPatterns = new ArrayList<>();
+ includedFastMatchPatterns = new ArrayList<>();
}
for (String includePattern : includePatterns) {
if (includePattern.endsWith("..*")) {
}
List<String> excludePatterns = definition.getExcludePatterns();
if (excludePatterns.size() > 0) {
- excludedPatterns = new ArrayList<TypePattern>();
- excludedFastMatchPatterns = new ArrayList<String>();
+ excludedPatterns = new ArrayList<>();
+ excludedFastMatchPatterns = new ArrayList<>();
}
for (String excludePattern : excludePatterns) {
if (excludePattern.endsWith("..*")) {
public void addTypeDelegateResolver(TypeDelegateResolver typeDelegateResolver) {
if (typeDelegateResolvers == null) {
- typeDelegateResolvers = new ArrayList<TypeDelegateResolver>();
+ typeDelegateResolvers = new ArrayList<>();
}
typeDelegateResolvers.add(typeDelegateResolver);
}
// The max number is configured through the property:
// org.aspectj.weaver.openarchives
// and it defaults to 1000
- private List<ZipFile> openArchives = new ArrayList<ZipFile>();
+ private List<ZipFile> openArchives = new ArrayList<>();
static {
String openzipsString = getSystemPropertyWithoutSecurityException("org.aspectj.weaver.openarchives",
if (trace.isTraceEnabled()) {
trace.enter("<init>", this, new Object[] { classpath==null?"null":classpath.toString(), handler });
}
- entries = new ArrayList<Entry>();
+ entries = new ArrayList<>();
for (String classpathEntry: classpath) {
addPath(classpathEntry,handler);
}
static class JImageState {
private final String jrtFsPath;
private final FileSystem fs;
- Map<String,Path> fileCache = new SoftHashMap<String, Path>();
+ Map<String,Path> fileCache = new SoftHashMap<>();
boolean packageCacheInitialized = false;
- Map<String,Path> packageCache = new HashMap<String, Path>();
+ Map<String,Path> packageCache = new HashMap<>();
public JImageState(String jrtFsPath, FileSystem fs) {
this.jrtFsPath = jrtFsPath;
public List<ZipEntryClassFile> getAllClassFiles() throws IOException {
ensureOpen();
- List<ZipEntryClassFile> ret = new ArrayList<ZipEntryClassFile>();
+ List<ZipEntryClassFile> ret = new ArrayList<>();
for (Enumeration<? extends ZipEntry> e = zipFile.entries(); e.hasMoreElements();) {
ZipEntry entry = e.nextElement();
String name = entry.getName();
int highestLineNumber = 0; // ---- JSR 45 info
- private final SortedMap<String, InlinedSourceFileInfo> inlinedFiles = new TreeMap<String, InlinedSourceFileInfo>();
+ private final SortedMap<String, InlinedSourceFileInfo> inlinedFiles = new TreeMap<>();
private boolean regenerateGenericSignatureAttribute = false;
private final World world;
private final String packageName = null;
- private final List<BcelField> fields = new ArrayList<BcelField>();
- private final List<LazyMethodGen> methodGens = new ArrayList<LazyMethodGen>();
- private final List<LazyClassGen> classGens = new ArrayList<LazyClassGen>();
- private final List<AnnotationGen> annotations = new ArrayList<AnnotationGen>();
+ private final List<BcelField> fields = new ArrayList<>();
+ private final List<LazyMethodGen> methodGens = new ArrayList<>();
+ private final List<LazyClassGen> classGens = new ArrayList<>();
+ private final List<AnnotationGen> annotations = new ArrayList<>();
private int childCounter = 0;
private final InstructionFactory fact;
// non-recursive, may be a bug, ha ha.
private List<LazyClassGen> getClassGens() {
- List<LazyClassGen> ret = new ArrayList<LazyClassGen>();
+ List<LazyClassGen> ret = new ArrayList<>();
ret.add(this);
ret.addAll(classGens);
return ret;
if (classGens.isEmpty()) {
return Collections.emptyList();
}
- List<UnwovenClassFile.ChildClass> ret = new ArrayList<UnwovenClassFile.ChildClass>();
+ List<UnwovenClassFile.ChildClass> ret = new ArrayList<>();
for (LazyClassGen clazz : classGens) {
byte[] bytes = clazz.getJavaClass(world).getBytes();
String name = clazz.getName();
//
// reflective thisJoinPoint support
- private Map<BcelShadow, Field> tjpFields = new HashMap<BcelShadow, Field>();
- Map<CacheKey, Field> annotationCachingFieldCache = new HashMap<CacheKey, Field>();
+ private Map<BcelShadow, Field> tjpFields = new HashMap<>();
+ Map<CacheKey, Field> annotationCachingFieldCache = new HashMap<>();
private int tjpFieldsCounter = -1; // -1 means not yet initialized
private int annoFieldsCounter = 0;
public static final ObjectType proceedingTjpType = new ObjectType("org.aspectj.lang.ProceedingJoinPoint");
}
private InstructionList[] initializeAllTjps() {
- Vector<InstructionList> lists = new Vector<InstructionList>();
+ Vector<InstructionList> lists = new Vector<>();
InstructionList list = initInstructionList();
lists.add(list);
- List<Map.Entry<BcelShadow, Field>> entries = new ArrayList<Map.Entry<BcelShadow, Field>>(tjpFields.entrySet());
+ List<Map.Entry<BcelShadow, Field>> entries = new ArrayList<>(tjpFields.entrySet());
Collections.sort(entries, new Comparator<Map.Entry<BcelShadow, Field>>() {
@Override
public int compare(Map.Entry<BcelShadow, Field> a, Map.Entry<BcelShadow, Field> b) {
} else {
body = null;
}
- this.attributes = new ArrayList<Attribute>();
+ this.attributes = new ArrayList<>();
this.enclosingClass = enclosingClass;
assertGoodBody();
this.originalMethodHasLocalVariableTable = true; // it is a new method, we want an lvar table
if (memberView == null) {
// If member view is null, we manage them in newAnnotations
if (newAnnotations == null) {
- newAnnotations = new ArrayList<AnnotationAJ>();
+ newAnnotations = new ArrayList<>();
}
newAnnotations.add(ax);
} else {
if (memberView == null) {
// If member view is null, we manage them in newAnnotations
if (annotationsForRemoval == null) {
- annotationsForRemoval = new ArrayList<ResolvedType>();
+ annotationsForRemoval = new ArrayList<>();
}
annotationsForRemoval.add(annotationType);
} else {
}
private class BodyPrinter {
- Map<InstructionHandle, String> labelMap = new HashMap<InstructionHandle, String>();
+ Map<InstructionHandle, String> labelMap = new HashMap<>();
InstructionList body;
PrintStream out;
// label assignment
void assignLabels() {
- LinkedList<ExceptionRange> exnTable = new LinkedList<ExceptionRange>();
+ LinkedList<ExceptionRange> exnTable = new LinkedList<>();
String pendingLabel = null;
// boolean hasPendingTargeters = false;
int lcounter = 0;
*/
InstructionHandle oldInstructionHandle = getBody().getStart();
InstructionHandle newInstructionHandle = fresh.getStart();
- LinkedList<ExceptionRange> exceptionList = new LinkedList<ExceptionRange>();
+ LinkedList<ExceptionRange> exceptionList = new LinkedList<>();
- Map<LocalVariableTag, LVPosition> localVariables = new HashMap<LocalVariableTag, LVPosition>();
+ Map<LocalVariableTag, LVPosition> localVariables = new HashMap<>();
int currLine = -1;
int lineNumberOffset = (fromFilename == null) ? 0 : getEnclosingClass().getSourceDebugExtensionOffset(fromFilename);
int currLine = -1;
int lineNumberOffset = (fromFilename == null) ? 0 : getEnclosingClass().getSourceDebugExtensionOffset(fromFilename);
- Map<LocalVariableTag, LVPosition> localVariables = new HashMap<LocalVariableTag, LVPosition>();
- LinkedList<ExceptionRange> exceptionList = new LinkedList<ExceptionRange>();
- Set<InstructionHandle> forDeletion = new HashSet<InstructionHandle>();
- Set<BranchHandle> branchInstructions = new HashSet<BranchHandle>();
+ Map<LocalVariableTag, LVPosition> localVariables = new HashMap<>();
+ LinkedList<ExceptionRange> exceptionList = new LinkedList<>();
+ Set<InstructionHandle> forDeletion = new HashSet<>();
+ Set<BranchHandle> branchInstructions = new HashSet<>();
// OPTIMIZE sort out in here: getRange()/insertHandler() and type of
// exceptionList
while (iHandle != null) {
paramSlots = -1;
}
- Map<InstructionHandle, Set<Integer>> duplicatedLocalMap = new HashMap<InstructionHandle, Set<Integer>>();
+ Map<InstructionHandle, Set<Integer>> duplicatedLocalMap = new HashMap<>();
for (LocalVariableTag tag : localVariables.keySet()) {
// have we already added one with the same slot number and start
// location?
InstructionHandle end = (tag.getSlot() < paramSlots ? methodEnd : lvpos.end);
Set<Integer> slots = duplicatedLocalMap.get(start);
if (slots == null) {
- slots = new HashSet<Integer>();
+ slots = new HashSet<>();
duplicatedLocalMap.put(start, slots);
} else if (slots.contains(tag.getSlot())) {
// we already have a var starting at this tag with this slot
* i.e., a 1:1 mapping.
*/
private Map<InstructionHandle, InstructionHandle> copyAllInstructionsExceptRangeInstructionsInto(InstructionList intoList) {
- Map<InstructionHandle, InstructionHandle> map = new HashMap<InstructionHandle, InstructionHandle>();
+ Map<InstructionHandle, InstructionHandle> map = new HashMap<>();
for (InstructionHandle ih = getBody().getStart(); ih != null; ih = ih.getNext()) {
if (Range.isRangeHandle(ih)) {
continue;
public static List<AjAttribute> readAjAttributes(String classname, Attribute[] as, ISourceContext context, World w,
AjAttribute.WeaverVersionInfo version, ConstantPoolReader dataDecompressor) {
- List<AjAttribute> attributes = new ArrayList<AjAttribute>();
+ List<AjAttribute> attributes = new ArrayList<>();
// first pass, look for version
- List<Unknown> forSecondPass = new ArrayList<Unknown>();
+ List<Unknown> forSecondPass = new ArrayList<>();
for (int i = as.length - 1; i >= 0; i--) {
Attribute a = as[i];
if (a instanceof Unknown) {
// Lookup table, for converting between pairs of types, it gives
// us the method name in the Conversions class
- private static Hashtable<String, String> validBoxing = new Hashtable<String, String>();
+ private static Hashtable<String, String> validBoxing = new Hashtable<>();
static {
validBoxing.put("Ljava/lang/Byte;B", "byteObject");
return Collections.emptyList();
}
// Go through the annotation types
- List<Lint.Kind> suppressedWarnings = new ArrayList<Lint.Kind>();
+ List<Lint.Kind> suppressedWarnings = new ArrayList<>();
boolean found = false;
for (int i = 0; !found && i < anns.length; i++) {
// Check for the SuppressAjWarnings annotation
weaverOptions = new StringBuffer();
dumpBefore = false;
perClassloaderDumpDir = false;
- dumpPatterns = new ArrayList<String>();
- includePatterns = new ArrayList<String>();
- excludePatterns = new ArrayList<String>();
- aspectClassNames = new ArrayList<String>();
- aspectExcludePatterns = new ArrayList<String>();
- aspectIncludePatterns = new ArrayList<String>();
- concreteAspects = new ArrayList<Definition.ConcreteAspect>();
- scopedAspects = new HashMap<String, String>();
- requiredTypesForAspects = new HashMap<String, String>();
+ dumpPatterns = new ArrayList<>();
+ includePatterns = new ArrayList<>();
+ excludePatterns = new ArrayList<>();
+ aspectClassNames = new ArrayList<>();
+ aspectExcludePatterns = new ArrayList<>();
+ aspectIncludePatterns = new ArrayList<>();
+ concreteAspects = new ArrayList<>();
+ scopedAspects = new HashMap<>();
+ requiredTypesForAspects = new HashMap<>();
}
public String getWeaverOptions() {
this.extend = extend;
}
this.precedence = precedence;
- this.pointcuts = new ArrayList<Definition.Pointcut>();
- this.declareAnnotations = new ArrayList<Definition.DeclareAnnotation>();
- this.pointcutsAndAdvice = new ArrayList<Definition.PointcutAndAdvice>();
- this.deows = new ArrayList<Definition.DeclareErrorOrWarning>();
+ this.pointcuts = new ArrayList<>();
+ this.declareAnnotations = new ArrayList<>();
+ this.pointcutsAndAdvice = new ArrayList<>();
+ this.deows = new ArrayList<>();
this.perclause = perclause;
}
}
private Definition.ConcreteAspect activeConcreteAspectDefinition;
- private static Hashtable<String, Definition> parsedFiles = new Hashtable<String, Definition>();
+ private static Hashtable<String, Definition> parsedFiles = new Hashtable<>();
private static boolean CACHE;
private static final boolean LIGHTPARSER;
private char pushedBackChar;
private Reader reader;
- private static Map<String, char[]> entities = new HashMap<String, char[]>();
+ private static Map<String, char[]> entities = new HashMap<>();
static {
entities.put("amp", new char[] { '&' });
public LightXMLParser() {
this.name = null;
- this.attributes = new HashMap<String, Object>();
+ this.attributes = new HashMap<>();
this.children = new ArrayList();
}
public void parseFromReader(Reader reader) throws Exception {
this.pushedBackChar = NULL_CHAR;
- this.attributes = new HashMap<String, Object>();
+ this.attributes = new HashMap<>();
this.name = null;
this.children = new ArrayList();
this.reader = reader;
IProgramElement root = model.getHierarchy().getRoot();
IProgramElement binaries = model.getHierarchy().findElementForLabel(root, IProgramElement.Kind.SOURCE_FOLDER, "binaries");
if (binaries == null) {
- binaries = new ProgramElement(model, "binaries", IProgramElement.Kind.SOURCE_FOLDER, new ArrayList<IProgramElement>());
+ binaries = new ProgramElement(model, "binaries", IProgramElement.Kind.SOURCE_FOLDER, new ArrayList<>());
root.addChild(binaries);
}
// if (aspect.getPackageName() != null) {
IProgramElement pkgNode = model.getHierarchy().findElementForLabel(binaries, IProgramElement.Kind.PACKAGE, packagename);
// note packages themselves have no source location
if (pkgNode == null) {
- pkgNode = new ProgramElement(model, packagename, IProgramElement.Kind.PACKAGE, new ArrayList<IProgramElement>());
+ pkgNode = new ProgramElement(model, packagename, IProgramElement.Kind.PACKAGE, new ArrayList<>());
binaries.addChild(pkgNode);
pkgNode.addChild(classFileNode);
} else {
IProgramElement root = asm.getHierarchy().getRoot();
IProgramElement binaries = asm.getHierarchy().findElementForLabel(root, IProgramElement.Kind.SOURCE_FOLDER, "binaries");
if (binaries == null) {
- binaries = new ProgramElement(asm, "binaries", IProgramElement.Kind.SOURCE_FOLDER, new ArrayList<IProgramElement>());
+ binaries = new ProgramElement(asm, "binaries", IProgramElement.Kind.SOURCE_FOLDER, new ArrayList<>());
root.addChild(binaries);
}
// if (aspect.getPackageName() != null) {
IProgramElement pkgNode = asm.getHierarchy().findElementForLabel(binaries, IProgramElement.Kind.PACKAGE, packagename);
// note packages themselves have no source location
if (pkgNode == null) {
- pkgNode = new ProgramElement(asm, packagename, IProgramElement.Kind.PACKAGE, new ArrayList<IProgramElement>());
+ pkgNode = new ProgramElement(asm, packagename, IProgramElement.Kind.PACKAGE, new ArrayList<>());
binaries.addChild(pkgNode);
pkgNode.addChild(classFileNode);
} else {
if (ts == null) {
pe.setParameterSignatures(Collections.<char[]>emptyList(), Collections.<String>emptyList());
} else {
- List<char[]> paramSigs = new ArrayList<char[]>();
+ List<char[]> paramSigs = new ArrayList<>();
for (UnresolvedType t : ts) {
paramSigs.add(t.getSignature().toCharArray());
}
private static void setParentTypesOnDeclareParentsNode(DeclareParents decp, IProgramElement decpElement) {
TypePatternList tpl = decp.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("\\$", "."));
}
public class JavaLangTypeToResolvedTypeConverter {
// Used to prevent recursion - we record what we are working on and return it if asked again *whilst* working on it
- private Map<Type, TypeVariableReferenceType> typeVariablesInProgress = new HashMap<Type, TypeVariableReferenceType>();
+ private Map<Type, TypeVariableReferenceType> typeVariablesInProgress = new HashMap<>();
private final World world;
public JavaLangTypeToResolvedTypeConverter(World aWorld) {
private WeavingAdaptorMessageHolder messageHolder;
private boolean abortOnError = false;
protected GeneratedClassHandler generatedClassHandler;
- protected Map<String, IUnwovenClassFile> generatedClasses = new HashMap<String, IUnwovenClassFile>();
+ protected Map<String, IUnwovenClassFile> generatedClasses = new HashMap<>();
public BcelObjectType delegateForCurrentClass; // lazily initialized, should be used to prevent parsing bytecode multiple
// times
protected ProtectionDomain activeProtectionDomain;
}
protected List<String> getFullClassPath(ClassLoader loader) {
- List<String> list = new LinkedList<String>();
+ List<String> list = new LinkedList<>();
for (; loader != null; loader = loader.getParent()) {
if (loader instanceof URLClassLoader) {
URL[] urls = ((URLClassLoader) loader).getURLs();
}
private List<String> getFullAspectPath(ClassLoader loader) {
- List<String> list = new LinkedList<String>();
+ List<String> list = new LinkedList<>();
for (; loader != null; loader = loader.getParent()) {
if (loader instanceof WeavingClassLoader) {
URL[] urls = ((WeavingClassLoader) loader).getAspectURLs();
}
private static List<String> makeClasspath(String cp) {
- List<String> ret = new ArrayList<String>();
+ List<String> ret = new ArrayList<>();
if (cp != null) {
StringTokenizer tok = new StringTokenizer(cp, File.pathSeparator);
while (tok.hasMoreTokens()) {
public void flushMessages() {
if (savedMessages == null) {
- savedMessages = new ArrayList<IMessage>();
+ savedMessages = new ArrayList<>();
savedMessages.addAll(super.getUnmodifiableListView());
clearMessages();
for (IMessage message : savedMessages) {
@Override
public List<IMessage> getUnmodifiableListView() {
// System.err.println("? WeavingAdaptorMessageHolder.getUnmodifiableListView() savedMessages=" + savedMessages);
- List<IMessage> allMessages = new ArrayList<IMessage>();
+ List<IMessage> allMessages = new ArrayList<>();
allMessages.addAll(savedMessages);
allMessages.addAll(super.getUnmodifiableListView());
return allMessages;
protected class WeavingAdaptorMessageWriter extends MessageWriter {
- private final Set<IMessage.Kind> ignoring = new HashSet<IMessage.Kind>();
+ private final Set<IMessage.Kind> ignoring = new HashSet<>();
private final IMessage.Kind failKind;
public WeavingAdaptorMessageWriter(PrintWriter writer) {
private class WeavingClassFileProvider implements IClassFileProvider {
private final UnwovenClassFile unwovenClass;
- private final List<UnwovenClassFile> unwovenClasses = new ArrayList<UnwovenClassFile>();
+ private final List<UnwovenClassFile> unwovenClasses = new ArrayList<>();
private IUnwovenClassFile wovenClass;
private boolean isApplyAtAspectJMungersOnly = false;
return EMPTY_KEYS;
}
- Collection<String> matches=new LinkedList<String>();
+ Collection<String> matches= new LinkedList<>();
synchronized(index) {
for (String key : index.keySet()) {
if (key.matches(regex)) {
protected abstract Map<String, IndexEntry> getIndex ();
protected Map<String, IndexEntry> readIndex (File cacheDir, File cacheFile) {
- Map<String, IndexEntry> indexMap=new TreeMap<String, IndexEntry>();
+ Map<String, IndexEntry> indexMap= new TreeMap<>();
IndexEntry[] idxValues=readIndex(cacheFile);
if (LangUtil.isEmpty(idxValues)) {
if ((logger != null) && logger.isTraceEnabled()) {
* The actual persistence is implemented by the <U>concrete</U> classes
*/
public abstract class AsynchronousFileCacheBacking extends AbstractIndexedFileCacheBacking {
- private static final BlockingQueue<AsyncCommand> commandsQ=new LinkedBlockingQueue<AsyncCommand>();
+ private static final BlockingQueue<AsyncCommand> commandsQ= new LinkedBlockingQueue<>();
private static final ExecutorService execService=Executors.newSingleThreadExecutor();
private static Future<?> commandsRunner;
if (index.isEmpty()) {
return Collections.emptyList();
} else {
- return new ArrayList<IndexEntry>(index.values());
+ return new ArrayList<>(index.values());
}
}
}
public String createClassLoaderScope(ClassLoader cl, List<String> aspects) {
String name = cl != null ? cl.getClass().getSimpleName() : "unknown";
- List<String> hashableStrings = new LinkedList<String>();
+ List<String> hashableStrings = new LinkedList<>();
StringBuilder hashable = new StringBuilder(256);
// Add the list of loader urls to the hash list
}
protected Map<String, byte[]> readClassBytes (Map<String,IndexEntry> indexMap, File[] files) {
- Map<String, byte[]> result=new TreeMap<String, byte[]>();
+ Map<String, byte[]> result= new TreeMap<>();
if (LangUtil.isEmpty(files)) {
return result;
}
private final CacheKeyResolver resolver;
private final String name;
- private static final List<WeavedClassCache> cacheRegistry = new LinkedList<WeavedClassCache>();
+ private static final List<WeavedClassCache> cacheRegistry = new LinkedList<>();
protected WeavedClassCache(GeneratedClassHandler existingClassHandler,
IMessageHandler messageHandler,
*/
public static List<WeavedClassCache> getCaches() {
synchronized (cacheRegistry) {
- return new LinkedList<WeavedClassCache>(cacheRegistry);
+ return new LinkedList<>(cacheRegistry);
}
}
e);
}
- entriesMap = new TreeMap<String,byte[]>();
+ entriesMap = new TreeMap<>();
okEntries = false;
}
}
if (toDelete == null) {
- toDelete = new TreeSet<String>();
+ toDelete = new TreeSet<>();
}
toDelete.add(key);
}
return Collections.emptyMap();
}
- Map<String,byte[]> result=new TreeMap<String,byte[]>();
+ Map<String,byte[]> result= new TreeMap<>();
byte[] copyBuf=new byte[4096];
ByteArrayOutputStream out=new ByteArrayOutputStream(copyBuf.length);
ZipFile zipFile=new ZipFile(file);
public static Map<String, List<String>> expectedResults = new HashMap<>();
static {
- List<String> sigs = new ArrayList<String>();
+ List<String> sigs = new ArrayList<>();
sigs.add("java.lang.Object $Proxy1.get1(java.io.Serializable)");
sigs.add("java.lang.Object MessageService.get1(java.io.Serializable)");
sigs.add("java.lang.Object GenericService.get1(java.io.Serializable)");
sigs.add("java.lang.Object GenericService.get1(java.io.Serializable)");
expectedResults.put("java.lang.Object $Proxy1.get1(java.io.Serializable)", sigs);
- sigs = new ArrayList<String>();
+ sigs = new ArrayList<>();
sigs.add("java.lang.Object $Proxy1.get2(java.io.Serializable)");
sigs.add("java.lang.Object MessageService.get2(java.io.Serializable)");
sigs.add("java.lang.Object GenericService.get2(java.io.Serializable)");
sigs.add("java.lang.Object GenericService.get2(java.io.Serializable)");
expectedResults.put("java.lang.Object $Proxy1.get2(java.io.Serializable)", sigs);
- sigs = new ArrayList<String>();
+ sigs = new ArrayList<>();
sigs.add("java.lang.Object $Proxy1.get1(java.lang.Long)");
expectedResults.put("java.lang.Object $Proxy1.get1(java.lang.Long)", sigs);
- sigs = new ArrayList<String>();
+ sigs = new ArrayList<>();
sigs.add("java.lang.Object GenericService.get1(java.io.Serializable)");
expectedResults.put("java.lang.Object GenericService.get1(java.io.Serializable)", sigs);
- sigs = new ArrayList<String>();
+ sigs = new ArrayList<>();
sigs.add("java.lang.Object GenericService.get2(java.io.Serializable)");
expectedResults.put("java.lang.Object GenericService.get2(java.io.Serializable)", sigs);
}
public void testAssignable01() {
List list = new ArrayList();
- List<String> listOfString = new ArrayList<String>();
+ List<String> listOfString = new ArrayList<>();
List<?> listOfSomething = new ArrayList<Integer>();
List<? extends Number> listOfSomethingNumberish = new ArrayList<Integer>();
List<? super Double> listOfSomethingSuperDouble = new ArrayList<Number>();
public void testAssignable02() {
List list = new ArrayList();
ArrayList arraylist = null;
- List<String> listOfString = new ArrayList<String>();
+ List<String> listOfString = new ArrayList<>();
List<?> listOfSomething = new ArrayList<Integer>();
ArrayList<?> arrayListOfSomething = null;
List<Number> listOfNumber = null;
ArrayList<? extends Number> arrayListOfSomethingNumberish = null;
List<? extends Number> listOfSomethingNumberish = new ArrayList<Integer>();
List<? super Double> listOfSomethingSuperDouble = new ArrayList<Number>();
- List<Integer> listOfInteger = new ArrayList<Integer>();
+ List<Integer> listOfInteger = new ArrayList<>();
ArrayList<String> arrayListOfString;
ArrayList<Integer> arraylistOfInteger;
// interfaces too List<? extends A,B>
public void testAssignable03_method_m2() {
List list = new ArrayList();
ArrayList arraylist = null;
- List<String> listOfString = new ArrayList<String>();
+ List<String> listOfString = new ArrayList<>();
List<?> listOfSomething = new ArrayList<Integer>();
ArrayList<?> arrayListOfSomething = null;
List<Number> listOfNumber = null;
ArrayList<? extends Number> arrayListOfSomethingNumberish = null;
List<? extends Number> listOfSomethingNumberish = new ArrayList<Integer>();
List<? super Double> listOfSomethingSuperDouble = new ArrayList<Number>();
- List<Integer> listOfInteger = new ArrayList<Integer>();
+ List<Integer> listOfInteger = new ArrayList<>();
ArrayList<String> arrayListOfString;
ArrayList<Integer> arraylistOfInteger;
// interfaces too List<? extends A,B>
public void testAssignable04_method_m3() {
List list = new ArrayList();
ArrayList arraylist = null;
- List<String> listOfString = new ArrayList<String>();
+ List<String> listOfString = new ArrayList<>();
List<?> listOfSomething = new ArrayList<Integer>();
ArrayList<?> arrayListOfSomething = null;
List<Number> listOfNumber = null;
ArrayList<? extends Number> arrayListOfSomethingNumberish = null;
List<? extends Number> listOfSomethingNumberish = new ArrayList<Integer>();
List<? super Double> listOfSomethingSuperDouble = new ArrayList<Number>();
- List<Integer> listOfInteger = new ArrayList<Integer>();
+ List<Integer> listOfInteger = new ArrayList<>();
ArrayList arrayList = null;
ArrayList<String> arrayListOfString;
ArrayList<Integer> arraylistOfInteger;
public void testAssignable03_method_m4() {
List list = new ArrayList();
ArrayList arraylist = null;
- List<String> listOfString = new ArrayList<String>();
+ List<String> listOfString = new ArrayList<>();
List<?> listOfSomething = new ArrayList<Integer>();
ArrayList<?> arrayListOfSomething = null;
List<Number> listOfNumber = null;
ArrayList<? extends Number> arrayListOfSomethingNumberish = null;
List<? extends Number> listOfSomethingNumberish = new ArrayList<Integer>();
List<? super Double> listOfSomethingSuperDouble = new ArrayList<Number>();
- List<Integer> listOfInteger = new ArrayList<Integer>();
+ List<Integer> listOfInteger = new ArrayList<>();
ArrayList<String> arrayListOfString;
ArrayList<Integer> arraylistOfInteger;
// interfaces too List<? extends A,B>
// copy of the real one in BcelClassWeaver
public static class IfaceInitList implements PartialOrder.PartialComparable {
final ResolvedType onType;
- List<ConcreteTypeMunger> list = new ArrayList<ConcreteTypeMunger>();
+ List<ConcreteTypeMunger> list = new ArrayList<>();
IfaceInitList(ResolvedType onType) {
this.onType = onType;
Class<?> wmClass = WeaverMessages.class;
Field[] fields = wmClass.getDeclaredFields();
- List<String> fieldList = new ArrayList<String>();
+ List<String> fieldList = new ArrayList<>();
for (Field f : fields) {
if (f.getType() == String.class) {
try {
}
public List<ShadowMunger> getShadowMungers() {
- List<ShadowMunger> ret = new ArrayList<ShadowMunger>();
+ List<ShadowMunger> ret = new ArrayList<>();
ret.add(makeConcreteAdvice("before" + "(): call(* *.println(..)) -> static void fluffy.Aspect.before_method_call()"));
ret.add(makeConcreteAdvice("afterReturning"
+ "(): call(* *.println(..)) -> static void fluffy.Aspect.afterReturning_method_call()"));
}
public void weaveTest(String name, String outName, ShadowMunger planner) throws IOException {
- List<ShadowMunger> l = new ArrayList<ShadowMunger>(1);
+ List<ShadowMunger> l = new ArrayList<>(1);
l.add(planner);
weaveTest(name, outName, l);
}
}
public List<ShadowMunger> makeAdviceAll(String kind, boolean matchOnlyPrintln) {
- List<ShadowMunger> ret = new ArrayList<ShadowMunger>();
+ List<ShadowMunger> ret = new ArrayList<>();
if (matchOnlyPrintln) {
ret.add(makeConcreteAdvice(kind + "(): call(* *.println(..)) -> static void Aspect.ajc_" + kind + "_method_execution()"));
} else {
}
static class MyMessageHandler implements IMessageHandler {
- public List<IMessage> messages = new ArrayList<IMessage>();
+ public List<IMessage> messages = new ArrayList<>();
public boolean handleMessage(IMessage message) throws AbortException {
messages.add(message);
}
- private static final Set<PointcutPrimitive> DEFAULT_SUPPORTED_PRIMITIVES = new HashSet<PointcutPrimitive>();
+ private static final Set<PointcutPrimitive> DEFAULT_SUPPORTED_PRIMITIVES = new HashSet<>();
static {
DEFAULT_SUPPORTED_PRIMITIVES.add(PointcutPrimitive.EXECUTION);
tps[parameterNumber].getAnnotationPattern().toString();
// parameter type annotation checking
- Set<String> expected = new HashSet<String>();
+ Set<String> expected = new HashSet<>();
expected.addAll(mpnv.getParameterTypeAnnotations());
StringTokenizer st = new StringTokenizer(expectedParameterTypeAnnotations==null?"":expectedParameterTypeAnnotations);
}
// parameter annotation checking
- expected = new HashSet<String>();
+ expected = new HashSet<>();
expected.addAll(mpnv.getParameterAnnotations());
st = new StringTokenizer(expectedParameterAnnotations==null?"":expectedParameterAnnotations);
static class MyPatternNodeVisitor extends AbstractPatternNodeVisitor {
private StringBuffer stringRep = new StringBuffer();
- private List<String> parameterAnnotations = new ArrayList<String>();
- private List<String> parameterTypeAnnotations = new ArrayList<String>();
+ private List<String> parameterAnnotations = new ArrayList<>();
+ private List<String> parameterTypeAnnotations = new ArrayList<>();
public String getStringRepresentation() { return stringRep.toString(); }
public List<String> getParameterAnnotations() { return parameterAnnotations; }
.getPointcutParserSupportingSpecifiedPrimitivesAndUsingSpecifiedClassLoaderForResolution(p, this.getClass()
.getClassLoader());
assertEquals("Should use the set we pass in", p, parser.getSupportedPrimitives());
- Set<PointcutPrimitive> q = new HashSet<PointcutPrimitive>();
+ Set<PointcutPrimitive> q = new HashSet<>();
q.add(PointcutPrimitive.ARGS);
parser = PointcutParser.getPointcutParserSupportingSpecifiedPrimitivesAndUsingSpecifiedClassLoaderForResolution(q, this
.getClass().getClassLoader());
return Collections.emptyMap();
}
- Map<String, File> files=new TreeMap<String, File>();
+ Map<String, File> files= new TreeMap<>();
for (IndexEntry entry : entries) {
File file=createDataFile(entry);
if (file != null) {
long newCrc = generateNewBytes();
assertTrue("Bad new CRC", newCrc != (-1L));
- Map<String, File> badFiles = new TreeMap<String, File>();
+ Map<String, File> badFiles = new TreeMap<>();
for (IndexEntry entry : entries) {
String key = entry.key;
if (key.startsWith("badData")) {
File indexFile = getIndexFile();
writeIndex(indexFile, entries);
- Map<String, File> dataFiles = new TreeMap<String, File>();
+ Map<String, File> dataFiles = new TreeMap<>();
for (IndexEntry entry : entries) {
String key = entry.key;
if (key.startsWith("withData")) {
}
public class MemoryCacheBacking implements CacheBacking {
- HashMap<String, CachedClassEntry> cache = new HashMap<String, CachedClassEntry>();
+ HashMap<String, CachedClassEntry> cache = new HashMap<>();
public String[] getKeys(String regex) {
Set<String> keys = cache.keySet();
- List<String> matches = new LinkedList<String>();
+ List<String> matches = new LinkedList<>();
for (String key : keys) {
if (key.matches(regex)) {
matches.add(key);
public class TestGeneratedClassHandler implements GeneratedClassHandler {
public int accepts = 0;
- public List<String> classesISaw = new LinkedList<String>();
+ public List<String> classesISaw = new LinkedList<>();
public void acceptClass (String name, byte[] originalBytes, byte[] wovenBytes) {
accepts++;
File indexFile=getIndexFile();
writeIndex(indexFile, entries);
- Map<String,byte[]> entriesMap=new TreeMap<String,byte[]>();
+ Map<String,byte[]> entriesMap= new TreeMap<>();
for (IndexEntry ie : entries) {
if (ie.ignored) {
continue;
}
public void testReadWriteZipClassBytes () throws IOException {
- Map<String,byte[]> entriesMap=new TreeMap<String,byte[]>();
+ Map<String,byte[]> entriesMap= new TreeMap<>();
for (int index=0; index < Byte.SIZE; index++) {
String name="classBytes#" + index;
random.nextBytes(bytes);
long newCrc=generateNewBytes();
assertTrue("Bad new CRC", newCrc != (-1L));
- Map<String,byte[]> entriesMap=new TreeMap<String,byte[]>();
+ Map<String,byte[]> entriesMap= new TreeMap<>();
for (IndexEntry ie : entries) {
if (ie.ignored) {
continue;