javaparser / javaparser/javaparser

Multiple providers for single SPI in module-info.java is not treated as an error

Open
#3,942 29 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Question (JP usage)
Dominant language
Java
Stars
6.2k
Forks
1.3k
Avg merge
17h 36m
Merged PRs (30d)
28

Description

The following module-info.java source is invalid

module com.example {
  exports com.example;
  provides com.example.Service with com.example.Provider1;
  provides com.example.Service with com.example.Provider2;
}

But v3.25.1 does not flag it as an error. Affects https://github.com/moditect/moditect/issues/173

The correct syntax is

module com.example {
  exports com.example;
  provides com.example.Service with com.example.Provider1, com.example.Provider2;
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the module-info.java example and reproduce how the parser handles two separate provides declarations for the same service. Confirm that the repeated-provider form is rejected as invalid while the comma-separated form remains accepted.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.