RFR: 8261625: Add `Elements.isAutomaticModule(ModuleElement)`

Vicente Romero vromero at openjdk.java.net
Thu Apr 8 01:52:59 UTC 2021


On Wed, 7 Apr 2021 18:49:38 GMT, Joe Darcy <darcy at openjdk.org> wrote:

> Addition of a small convenience method, with a default implementation, to Elements.
> 
> Most of the change is testing infrastructure. The negative cases, such as named modules, are tested in the style of other annotation processing tests for Elements utilities.
> 
> An automatic module comes from a jar file, so an API reading from a jar file is needed. To avoid piping in the awkward plumbing needed to do that directly in the annotation processing tests, I updated an existing automatic modules test which uses the tool box facility. My additions to the tool box might not be the done in the most idiomatic style for that API; happy to have guidance on how to proceed better there.
> 
> Assuming this general approach is agreed to, I'll update the imports on AutomaticModules.java to condense the text of the annotation processor source.

test/langtools/tools/javac/modules/AutomaticModules.java line 694:

> 692:                      })
> 693:                 .writeAll()
> 694:                 .getOutputLines(Task.OutputKind.DIRECT);

I know this code predates your patch but now that you are here :) these two lines are unnecessary as the output is not kept. I mean you can remove:
           .writeAll()
           .getOutputLines(Task.OutputKind.DIRECT)

test/langtools/tools/javac/processing/model/util/elements/TestIsAutomaticMod.java line 2:

> 1: /*
> 2:  * Copyright (c) 2006, 2021, Oracle and/or its affiliates. All rights reserved.

2006 can be removed

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

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


More information about the compiler-dev mailing list