equal
deleted
inserted
replaced
21 * questions. |
21 * questions. |
22 */ |
22 */ |
23 |
23 |
24 /** |
24 /** |
25 * @test |
25 * @test |
26 * @bug 8133884 8162711 8133896 8172158 8172262 8173636 8175119 |
26 * @bug 8133884 8162711 8133896 8172158 8172262 8173636 8175119 8189747 |
27 * @summary Verify that annotation processing works. |
27 * @summary Verify that annotation processing works. |
28 * @library /tools/lib |
28 * @library /tools/lib |
29 * @modules |
29 * @modules |
30 * jdk.compiler/com.sun.tools.javac.api |
30 * jdk.compiler/com.sun.tools.javac.api |
31 * jdk.compiler/com.sun.tools.javac.main |
31 * jdk.compiler/com.sun.tools.javac.main |
1387 .outdir(cpClasses) |
1387 .outdir(cpClasses) |
1388 .files(findJavaFiles(src)) |
1388 .files(findJavaFiles(src)) |
1389 .run() |
1389 .run() |
1390 .writeAll(); |
1390 .writeAll(); |
1391 |
1391 |
|
1392 //from source: |
|
1393 new JavacTask(tb) |
|
1394 .options("--module-source-path", moduleSrc.toString(), |
|
1395 "--source-path", src.toString(), |
|
1396 "-processorpath", System.getProperty("test.class.path"), |
|
1397 "-processor", UnboundLookupGenerate.class.getName(), |
|
1398 "-XDrawDiagnostics") |
|
1399 .outdir(classes) |
|
1400 .files(findJavaFiles(moduleSrc)) |
|
1401 .run() |
|
1402 .writeAll() |
|
1403 .getOutput(OutputKind.DIRECT); |
|
1404 |
1392 } |
1405 } |
1393 |
1406 |
1394 @SupportedAnnotationTypes("*") |
1407 @SupportedAnnotationTypes("*") |
1395 public static final class UnboundLookup extends AbstractProcessor { |
1408 public static final class UnboundLookup extends AbstractProcessor { |
1396 |
1409 |
1484 return SourceVersion.latest(); |
1497 return SourceVersion.latest(); |
1485 } |
1498 } |
1486 |
1499 |
1487 } |
1500 } |
1488 |
1501 |
|
1502 @SupportedAnnotationTypes("*") |
|
1503 public static final class UnboundLookupGenerate extends AbstractProcessor { |
|
1504 |
|
1505 @Override |
|
1506 public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) { |
|
1507 if (processingEnv.getElementUtils().getTypeElement("nue.Nue") == null) { |
|
1508 try (Writer w = processingEnv.getFiler().createSourceFile("m1x/nue.Nue").openWriter()) { |
|
1509 w.write("package nue; public class Nue {}"); |
|
1510 } catch (IOException ex) { |
|
1511 throw new IllegalStateException(ex); |
|
1512 } |
|
1513 } |
|
1514 |
|
1515 return false; |
|
1516 } |
|
1517 |
|
1518 @Override |
|
1519 public SourceVersion getSupportedSourceVersion() { |
|
1520 return SourceVersion.latest(); |
|
1521 } |
|
1522 |
|
1523 } |
|
1524 |
1489 @Test |
1525 @Test |
1490 public void testWrongDefaultTargetModule(Path base) throws Exception { |
1526 public void testWrongDefaultTargetModule(Path base) throws Exception { |
1491 Path src = base.resolve("src"); |
1527 Path src = base.resolve("src"); |
1492 |
1528 |
1493 tb.writeJavaFiles(src, |
1529 tb.writeJavaFiles(src, |