Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Add 'requires transitive' to fix compiler warning #358

Merged
merged 1 commit into from
Jan 7, 2025

Conversation

sebthom
Copy link
Contributor

@sebthom sebthom commented Jan 5, 2025

This fixes the compiler warning "The type Extension from module org.commonmark may not be accessible to clients due to missing 'requires transitive'"

This fixes the compiler warning "The type Extension from module
org.commonmark may not be accessible to clients due to missing 'requires
transitive'"
@robinst
Copy link
Collaborator

robinst commented Jan 6, 2025

Where does the compiler warning show up?

(If a consumer depends on one of the extensions, they will also need to depend on the core. Using just the extension without any core types doesn't make any sense.)

@sebthom
Copy link
Contributor Author

sebthom commented Jan 6, 2025

I am seeing this in Eclipse. The reason is that the extensions leak/expose classes from their transitive dependency (commonmark).

For example:

public class AutolinkExtension implements Parser.ParserExtension {

    private AutolinkExtension() {
    }

    public static Extension create() {
        return new AutolinkExtension();
    }

    @Override
    public void extend(Parser.Builder parserBuilder) {
        parserBuilder.postProcessor(new AutolinkPostProcessor());
    }

}

When I do AutolinkExtension.create() I get an instance of type Extension. But Extension is not part of the jar providing class AutolinkExtension it is a transitive dependency of that jar thus the transitive keyword is required.

@robinst
Copy link
Collaborator

robinst commented Jan 7, 2025

Right, I see. Maybe it was a mistake for create to return Extension (instead of the more specific type AutolinkExtension). But anyway, no reason to change that now. Will go ahead and merge the PR.

@robinst robinst merged commit 9d1647f into commonmark:main Jan 7, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants