JDK 12 RFR of JDK-8212718: Refactor some annotation processor tests to better use collections
joe darcy
joe.darcy at oracle.com
Sat Oct 20 21:42:05 UTC 2018
Hello,
Please review a fix for
JDK-8212718: Refactor some annotation processor tests to better use
collections
http://cr.openjdk.java.net/~darcy/8212718.0/
Patch below.
Thanks,
-Joe
---
old/test/langtools/tools/javac/processing/model/element/TestAnonClassNames.java
2018-10-20 14:37:36.166001000 -0700
+++
new/test/langtools/tools/javac/processing/model/element/TestAnonClassNames.java
2018-10-20 14:37:35.990001000 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights
reserved.
+ * Copyright (c) 2010, 2018, Oracle and/or its affiliates. All rights
reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -129,22 +129,17 @@
static void testClassNames(List<String> classNames) {
System.out.println("test: " + classNames);
- List<String> options = new ArrayList<String>();
- options.add("-proc:only");
- options.add("-classpath");
- options.add(System.getProperty("test.classes"));
-
JavaCompiler javaCompiler = ToolProvider.getSystemJavaCompiler();
JavaCompiler.CompilationTask compileTask =
javaCompiler.getTask(null, // Output
null, // File manager
null, // Diagnostics
- options,
+ List.of("-proc:only", // options
+ "-classpath",
+ System.getProperty("test.classes")),
classNames,
null); // Sources
- List<Processor> processors = new ArrayList<Processor>();
- processors.add(new ClassNameProber());
- compileTask.setProcessors(processors);
+ compileTask.setProcessors(List.of(new ClassNameProber()));
Boolean goodResult = compileTask.call();
if (!goodResult) {
error("Errors found during compile.");
---
old/test/langtools/tools/javac/processing/model/element/TypeParamBounds.java
2018-10-20 14:37:36.574001000 -0700
+++
new/test/langtools/tools/javac/processing/model/element/TypeParamBounds.java
2018-10-20 14:37:36.402001000 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights
reserved.
+ * Copyright (c) 2006, 2018, Oracle and/or its affiliates. All rights
reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -84,16 +84,12 @@
// The names of the bounds of each type parameter of Gen.
static Map<String, String[]> boundNames =
- new HashMap<String, String[]>();
-
- static {
- boundNames.put("T", new String[] {"Object"});
- boundNames.put("U", new String[] {"Object"});
- boundNames.put("V", new String[] {"Number"});
- boundNames.put("W", new String[] {"U"});
- boundNames.put("X", new String[] {"Runnable"});
- boundNames.put("Y", new String[] {"CharSequence", "Runnable"});
- boundNames.put("Z", new String[] {"Object", "Runnable"});
- }
+ Map.of("T", new String[] {"Object"},
+ "U", new String[] {"Object"},
+ "V", new String[] {"Number"},
+ "W", new String[] {"U"},
+ "X", new String[] {"Runnable"},
+ "Y", new String[] {"CharSequence", "Runnable"},
+ "Z", new String[] {"Object", "Runnable"});
}
}
More information about the compiler-dev
mailing list