RFR: 8224922: Access JavaFileObject from Element(s) [v16]

Jonathan Gibbons jjg at openjdk.java.net
Thu Nov 18 19:54:43 UTC 2021


On Thu, 18 Nov 2021 18:16:21 GMT, Joe Darcy <darcy at openjdk.org> wrote:

>> Initial review to get some comments on the shape of the API. Tests are needed of course, as well as some tuning of the spec to better describe differences in behavior when class files rather than source files are the backing file type.
>
> Joe Darcy has updated the pull request incrementally with two additional commits since the last revision:
> 
>  - Merge pull request #7 from lahodaj/JDK-8224922-5
>    
>    Fixing a test on Windows.
>  - Attempting to fix a Windows test.

Nice to see at least partial cleanup of the `Symbol.classfile` field.

src/java.compiler/share/classes/javax/lang/model/element/package-info.java line 39:

> 37:  * anonymous classes.
> 38:  *
> 39:  * <p><a id="accurate_model">When used in the context of annotation processing, an accurate

It would be more correct to just put the id on the `<p>` tag and drop the `<a>`.

src/java.compiler/share/classes/javax/lang/model/util/Elements.java line 798:

> 796:      * the creation of source or class files in that package.  An
> 797:      * {@linkplain PackageElement#isUnnamed unnamed package} will have
> 798:      * a null file since it cannot be declared in a compilation unit.

`{@code }` around  null ??

src/java.compiler/share/classes/javax/lang/model/util/Elements.java line 802:

> 800:      * <p>If it has a file object, the file object for a module will
> 801:      * be a {@code module-info} file.  An {@linkplain
> 802:      * ModuleElement#isUnnamed unnamed module} will have a null file

another null.

src/java.compiler/share/classes/javax/lang/model/util/Elements.java line 805:

> 803:      * since it cannot be declared in a compilation unit.  An
> 804:      * {@linkplain #isAutomaticModule automatic module} will have a
> 805:      * null file since it is implicitly declared.

I guess you're consistent!

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

Marked as reviewed by jjg (Reviewer).

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


More information about the compiler-dev mailing list