JDK-8264865 : Add `Elements.isAutomaticModule(ModuleElement)`
  • Type: CSR
  • Component: core-libs
  • Sub-Component: javax.lang.model
  • Priority: P3
  • Status: Closed
  • Resolution: Approved
  • Fix Versions: 17
  • Submitted: 2021-04-07
  • Updated: 2021-08-04
  • Resolved: 2021-04-08
Related Reports
Blocks :  
CSR :  
Duplicate :  
Duplicate :  
Relates :  
Description
Summary
-------
Add a convenience predicate to `javax.lang.model.util.Elements` to test for automatic modules.

Problem
-------

No API in `javax.lang.model` to determine of a module is automatic or not.

Solution
--------

Add a method providing the functionality in question.

Specification
-------------
New method added to `javax.lang.model.util.Elements`:

    /**
     * {@return {@code true} if the module element is an automatic
     * module, {@code false} otherwise}
     *
     * @implSpec
     * The default implementation of this method returns {@code
     * false}.
     *
     * @param module the module element being examined
     * @jls 7.7.1 Dependences
     * @since 17
     */
    default boolean isAutomaticModule(ModuleElement module)
Comments
Moving to Approved.
08-04-2021

Added [~vromero] as a reviewer per external communication.
08-04-2021