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: Fix NPE due to duplicated package-info.java with setIgnoreDuplicateDeclarations(true) #3791

Merged

Conversation

slarse
Copy link
Collaborator

@slarse slarse commented Feb 10, 2021

Fix #3790

This PR fixes an NPE crash that occurs when the same project defines package-info.java files for the same package but in different places, and one has set env.setIgnoreDuplicateDeclarations(true). This appears quite a lot in the wild with multi-module projects.

As per my musings in #3790, I don't think the JLS actually allows for duplication of package-info files, and so I'm only allowing this when we are explicitly ignoring duplicated declarations.

@slarse slarse changed the title fix: Fix NPE crash on duplicated package-info.java with setIgnoreDuplicateDeclarations(true) fix: Fix NPE on duplicated package-info.java with setIgnoreDuplicateDeclarations(true) Feb 10, 2021
@slarse slarse changed the title fix: Fix NPE on duplicated package-info.java with setIgnoreDuplicateDeclarations(true) wip: fix: Fix NPE on duplicated package-info.java with setIgnoreDuplicateDeclarations(true) Feb 10, 2021
@slarse slarse changed the title wip: fix: Fix NPE on duplicated package-info.java with setIgnoreDuplicateDeclarations(true) review: fix: Fix NPE on duplicated package-info.java with setIgnoreDuplicateDeclarations(true) Feb 10, 2021
@monperrus
Copy link
Collaborator

LGTM, thanks @slarse

@monperrus monperrus changed the title review: fix: Fix NPE on duplicated package-info.java with setIgnoreDuplicateDeclarations(true) fix: Fix NPE due to duplicated package-info.java with setIgnoreDuplicateDeclarations(true) Feb 11, 2021
@monperrus monperrus merged commit 6488350 into INRIA:master Feb 11, 2021
@monperrus
Copy link
Collaborator

thanks @slarse

@slarse slarse deleted the issue/3890-allow-duplicate-package-info branch February 11, 2021 09:10
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.

bug: NPE on duplicate package-info.java when ignoring duplicate types
2 participants