RFR: JDK-8278795: Create test library and tests for langtools snippets

Hannes Wallnöfer hannesw at openjdk.java.net
Thu Dec 16 16:10:02 UTC 2021


On Tue, 14 Dec 2021 19:58:47 GMT, Jonathan Gibbons <jjg at openjdk.org> wrote:

> Please review a test-only fix to provide a new test library for analyzing snippets, and two tests that use that library to test snippets in the `jdk.javadoc` and `jdk.compiler` modules.
> 
> It is expected that the library may evolve in future updates as we explore additional ways to analyze snippets.

Very impressive how much functionality you managed to pack into this first version of SnippetUtils!

The snippet kind inferral code is (as is usual with regex-based solutions) not especially nice to look at but seems to solve the problem with very few lines.

test/langtools/tools/lib/snippets/SnippetUtils.java line 310:

> 308:             switch (ve.getKind()) {
> 309:                 case ENUM_CONSTANT, FIELD -> scanDocComment(ve, treeScanner);
> 310:                 default -> defaultAction(ve, treeScanner);

What kinds of elements are handled by the default branch?

-------------

Marked as reviewed by hannesw (Reviewer).

PR: https://git.openjdk.java.net/jdk/pull/6839


More information about the compiler-dev mailing list