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:**
> 
> Use a local `HashSet` while parsing each directive and report an error when 
> `add()` 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).

I think this looks right. I'm just curious if you ran into this issue (maybe 
experimenting with JDK and accidentally put duplicates into 
module-info.java.extra?) or it's just that you spotted the issue in JBS.

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

PR Comment: https://git.openjdk.org/jdk/pull/32698#issuecomment-5559556639

Reply via email to