|
23 | 23 |
|
24 | 24 | /*
|
25 | 25 | * @test
|
26 |
| - * @bug 7073631 7159445 7156633 8028235 8065753 8205418 8205913 8228451 8237041 8253584 8246774 8256411 8256149 8259050 8266436 8267221 8271928 8275097 8293897 8295401 8304671 |
| 26 | + * @bug 7073631 7159445 7156633 8028235 8065753 8205418 8205913 8228451 8237041 8253584 8246774 8256411 8256149 8259050 8266436 8267221 8271928 8275097 8293897 8295401 8304671 8312093 |
27 | 27 | * @summary tests error and diagnostics positions
|
28 | 28 | * @author Jan Lahoda
|
29 | 29 | * @modules jdk.compiler/com.sun.tools.javac.api
|
@@ -2395,6 +2395,34 @@ public Void visitCase(CaseTree node, Void p) {
|
2395 | 2395 | codes);
|
2396 | 2396 | }
|
2397 | 2397 |
|
| 2398 | + @Test //JDK-8312093 |
| 2399 | + void testJavadoc() throws IOException { |
| 2400 | + String code = """ |
| 2401 | + public class Test { |
| 2402 | + /***/ |
| 2403 | + void main() { |
| 2404 | + } |
| 2405 | + } |
| 2406 | + """; |
| 2407 | + DiagnosticCollector<JavaFileObject> coll = |
| 2408 | + new DiagnosticCollector<>(); |
| 2409 | + JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, fm, coll, null, |
| 2410 | + null, Arrays.asList(new MyFileObject(code))); |
| 2411 | + Trees trees = Trees.instance(ct); |
| 2412 | + CompilationUnitTree cut = ct.parse().iterator().next(); |
| 2413 | + new TreePathScanner<Void, Void>() { |
| 2414 | + @Override |
| 2415 | + public Void visitMethod(MethodTree node, Void p) { |
| 2416 | + if (!node.getName().contentEquals("main")) { |
| 2417 | + return null; |
| 2418 | + } |
| 2419 | + String comment = trees.getDocComment(getCurrentPath()); |
| 2420 | + assertEquals("Expecting empty comment", "", comment); |
| 2421 | + return null; |
| 2422 | + } |
| 2423 | + }.scan(cut, null); |
| 2424 | + } |
| 2425 | + |
2398 | 2426 | void run(String[] args) throws Exception {
|
2399 | 2427 | int passed = 0, failed = 0;
|
2400 | 2428 | final Pattern p = (args != null && args.length > 0)
|
|
1 commit comments
openjdk-notifier[bot] commentedon Jul 18, 2023
Review
Issues