On Fri, 4 Sep 2026 08:25:47 GMT, Yunbo Zhang <[email protected]> wrote:

> Please review this small fix.
> 
> **Problem:**
> 
> `Statement.targets` is a `LinkedHashSet`, so duplicate targets in directives 
> such as `exports p1 to m1, m2, m1;` are silently ignored. As a result, 
> `GenModuleInfoSource` accepts invalid input instead of reporting an error.
> 
> **Fix:**
> 
> Make `Statement.addTarget()` return whether `targets.add()` succeeded. While 
> parsing a directive, report an error if it returns `false`.
> 
> **Testing:**
> 
> - Added tests for duplicate targets in `exports`, `opens`, and `provides`
> - `ModuleInfoExtraTest`: passed
> - `make test-make`: passed
> 
> 
> 
> ---------
> - [x] I confirm that I make this contribution in accordance with the [OpenJDK 
> Interim AI Policy](https://openjdk.org/legal/ai).

This pull request has now been integrated.

Changeset: a8c574a6
Author:    Yunbo Zhang <[email protected]>
Committer: Alan Bateman <[email protected]>
URL:       
https://git.openjdk.org/jdk/commit/a8c574a6bd3f8a7f55ea0105d2c019bbc2a49754
Stats:     22 lines in 2 files changed: 14 ins; 1 del; 7 mod

8371851: Build tool GenModuleInfoSource does not report duplicate targets of 
export

Reviewed-by: alanb

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

PR: https://git.openjdk.org/jdk/pull/32698

Reply via email to