Skip to content

Enable Error Prone and fail builds on unclosed @MustBeClosed resources and leaked streams - #1565

Merged
labkey-adam merged 3 commits into
developfrom
fb_enable_errorprone
Nov 28, 2026
Merged

labkey-adam merged 3 commits into
developfrom
fb_enable_errorprone

Conversation

@labkey-adam

@labkey-adam labkey-adam commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Rationale

Turn on Error Prone for every build and make unclosed @MustBeClosed resources and unclosed Files streams compile errors, so leaked result sets and file handles are caught at build time instead of in production. Error Prone was previously off by default, and both checks were configured only as warnings.

Related Pull Requests

Changes

  • Enable Error Prone by default
  • Make MustBeClosedChecker and StreamResourceLeak errors; downgrade CompileTimeConstant to a warning
  • Add IntelliJ inspections that mirror both checks so violations show up in the editor

…s and leaked streams

Adds matching IntelliJ inspections and downgrades CompileTimeConstant to a warning.
labkey-adam added a commit to LabKey/MacCossLabModules that referenced this pull request Nov 27, 2026
## Rationale
Make panoramapublic compile under the newly enforced Error Prone
`StreamResourceLeak` check.

## Related Pull Requests
- LabKey/server#1565
- LabKey/platform#8392
- LabKey/premiumModules#885
- LabKey/limsModules#2640

## Changes
- Close the file stream used to read the DIA-NN report header

@labkey-jeckels labkey-jeckels left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where did the IntelliJ inspection version of the checks come from? We will presumably be wanting more in the future, so it would be good to have a reference for how to add or update them

@labkey-adam

labkey-adam commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor Author

Where did the IntelliJ inspection version of the checks come from? We will presumably be wanting more in the future, so it would be good to have a reference for how to add or update them

Claude created them based on the pattern @labkey-matthewb set with his @CompileTimeConstant inspection

@labkey-adam labkey-adam self-assigned this Nov 28, 2026
labkey-adam added a commit to LabKey/platform that referenced this pull request Nov 28, 2026
## Rationale
Make platform compile under the newly enforced Error Prone
`MustBeClosedChecker` and `StreamResourceLeak` checks.

## Related Pull Requests
- LabKey/server#1565
- LabKey/premiumModules#885
- LabKey/limsModules#2640
- LabKey/MacCossLabModules#700

## Changes
- Annotate methods that return result-set-backed streams with
`@MustBeClosed`
- Close streams that were left open
- Fix a variable-name typo in sample search indexing
@labkey-adam
labkey-adam merged commit 5898ba1 into develop Nov 28, 2026
8 checks passed
@labkey-adam
labkey-adam deleted the fb_enable_errorprone branch November 28, 2026 16:38
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