Apply "type inference for generic instance creation" Java 7 feature

Change-Id: Ia14802c903ca67b9d94dc6038d70b0e9644bc621
This commit is contained in:
David Ostrovsky
2014-04-26 15:27:57 +02:00
parent 40a179b8ca
commit e73ae61339
224 changed files with 557 additions and 633 deletions

View File

@@ -154,13 +154,13 @@ public class PrologCompiler implements Callable<PrologCompiler.Status> {
}
DiagnosticCollector<JavaFileObject> diagnostics =
new DiagnosticCollector<JavaFileObject>();
new DiagnosticCollector<>();
StandardJavaFileManager fileManager =
compiler.getStandardFileManager(diagnostics, null, null);
try {
Iterable<? extends JavaFileObject> compilationUnits = fileManager
.getJavaFileObjectsFromFiles(getAllFiles(tempDir, ".java"));
ArrayList<String> options = new ArrayList<String>();
ArrayList<String> options = new ArrayList<>();
String classpath = getMyClasspath();
if (classpath != null) {
options.add("-classpath");
@@ -270,7 +270,7 @@ public class PrologCompiler implements Callable<PrologCompiler.Status> {
}
private List<File> getAllFiles(File dir, String extension) {
ArrayList<File> fileList = new ArrayList<File>();
ArrayList<File> fileList = new ArrayList<>();
getAllFiles(dir, extension, fileList);
return fileList;
}
@@ -287,7 +287,7 @@ public class PrologCompiler implements Callable<PrologCompiler.Status> {
}
private List<String> getRelativePaths(File dir, String extension) {
ArrayList<String> pathList = new ArrayList<String>();
ArrayList<String> pathList = new ArrayList<>();
getRelativePaths(dir, extension, "", pathList);
return pathList;
}

View File

@@ -73,8 +73,8 @@ public class PrologEnvironment extends BufferingPrologControl {
setMaxArity(MAX_ARITY);
setEnabled(EnumSet.allOf(Prolog.Feature.class), false);
args = a;
storedValues = new HashMap<StoredValue<Object>, Object>();
cleanup = new LinkedList<Runnable>();
storedValues = new HashMap<>();
cleanup = new LinkedList<>();
}
public Args getArgs() {

View File

@@ -80,11 +80,10 @@ public class RulesCache {
private static final List<String> PACKAGE_LIST = ImmutableList.of(
Prolog.BUILTIN, "gerrit");
private final Map<ObjectId, MachineRef> machineCache =
new HashMap<ObjectId, MachineRef>();
private final Map<ObjectId, MachineRef> machineCache = new HashMap<>();
private final ReferenceQueue<PrologMachineCopy> dead =
new ReferenceQueue<PrologMachineCopy>();
new ReferenceQueue<>();
private static final class MachineRef extends WeakReference<PrologMachineCopy> {
final ObjectId key;

View File

@@ -25,12 +25,12 @@ import com.googlecode.prolog_cafe.lang.SystemException;
public class StoredValue<T> {
/** Construct a new unique key that does not match any other key. */
public static <T> StoredValue<T> create() {
return new StoredValue<T>();
return new StoredValue<>();
}
/** Construct a key based on a Java Class object, useful for singletons. */
public static <T> StoredValue<T> create(Class<T> clazz) {
return new StoredValue<T>(clazz);
return new StoredValue<>(clazz);
}
private final Object key;