Skip to content

FindBugsViewerTask improvements - #4165

Merged
hazendaz merged 4 commits into
spotbugs:masterfrom
richardfearn:FindBugsViewerTask-improvements
Jul 5, 2026
Merged

hazendaz merged 4 commits into
spotbugs:masterfrom
richardfearn:FindBugsViewerTask-improvements

Conversation

@richardfearn

@richardfearn richardfearn commented Jun 10, 2026 •

Copy link
Copy Markdown
Contributor
  • Extend AbstractFindBugsTask to reduce duplicate code (FindBugs issue #73)

  • Use default look and feel by default

  • Added an entry into CHANGELOG.md if you have changed SpotBugs code

Copilot AI review requested due to automatic review settings June 10, 2026 17:38

Copilot AI 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.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Refactors the Ant “viewer” task to reuse the shared AbstractFindBugsTask execution pipeline, and adjusts timeout handling so negative/disabled timeouts aren’t propagated to Ant’s Java task.

Changes:

  • Switch FindBugsViewerTask to extend AbstractFindBugsTask and move execution responsibilities into the base hooks.
  • Initialize viewer task with the shared “launch UI” main class and default timeout behavior.
  • Only apply Java#setTimeout(...) when timeout > 0 in AbstractFindBugsTask.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
spotbugs-ant/src/main/java/edu/umd/cs/findbugs/anttask/FindBugsViewerTask.java Migrates viewer task onto AbstractFindBugsTask hooks and removes duplicated execution setup.
spotbugs-ant/src/main/java/edu/umd/cs/findbugs/anttask/AbstractFindBugsTask.java Guards timeout application to avoid setting non-positive timeouts on the Ant Java task.

Comment thread spotbugs-ant/src/main/java/edu/umd/cs/findbugs/anttask/FindBugsViewerTask.java Outdated
Comment thread spotbugs-ant/src/main/java/edu/umd/cs/findbugs/anttask/FindBugsViewerTask.java Outdated
Comment thread spotbugs-ant/src/main/java/edu/umd/cs/findbugs/anttask/FindBugsViewerTask.java Outdated
@richardfearn
richardfearn force-pushed the FindBugsViewerTask-improvements branch from 4182eb9 to 9f57b96 Compare June 10, 2026 17:48
Comment thread spotbugs-ant/src/main/java/edu/umd/cs/findbugs/anttask/FindBugsViewerTask.java Outdated
Comment thread CHANGELOG.md
Comment thread spotbugs-ant/src/main/java/edu/umd/cs/findbugs/anttask/FindBugsViewerTask.java Outdated
Comment thread spotbugs-ant/src/main/java/edu/umd/cs/findbugs/anttask/FindBugsViewerTask.java Outdated
…te code

Fixes FindBugs issue spotbugs#73 (findbugsproject/findbugs#73).

Since the GUI stays open, the return code when it finally exits isn't very
useful. So instead of trying to interpret that return code, just use the
default `afterExecuteJavaProcess` implementation from `AbstractFindBugsTask`,
that throws a `BuildException` for any non-zero return code.
Change the default value of the `look` property in `FindBugsViewerTask` from
`"native"` to `null`, meaning the default L&F is used.

`GUI2CommandLine` only allows the options `plastic`, `gtk` and `native`; it is
possible to get the default L&F by specifying `look=""`, for example, but that
causes `GUI2CommandLine` to emit an error.

This change also makes the default L&F match what you get when running
SpotBugs standalone.
`AbstractFindBugsTask` already has a `DEFAULT_TIMEOUT` constant. Rename this
one, which also removes the need for the comment.
@richardfearn
richardfearn force-pushed the FindBugsViewerTask-improvements branch from 9f57b96 to bc3b4fa Compare June 24, 2026 17:15
@richardfearn
richardfearn requested a review from JuditKnoll June 24, 2026 17:19
@hazendaz
hazendaz merged commit db96e2e into spotbugs:master Jul 5, 2026
3 checks passed
@hazendaz hazendaz self-assigned this Jul 5, 2026
@hazendaz hazendaz added this to the Spotbugs 4.10.3 milestone Jul 5, 2026
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.

5 participants