Skip to content

Fixes #34: Add Error Prone, NullAway and JSpecify - #35

Merged
manoelcampos merged 1 commit into
masterfrom
add-errorprone-nullaway
Oct 19, 2026
Merged

manoelcampos merged 1 commit into
masterfrom
add-errorprone-nullaway

Conversation

@manoelcampos

@manoelcampos manoelcampos commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Closes #34

Changes

  • Build: maven-compiler-plugin runs Error Prone 2.50.0 with NullAway 0.14.2 at ERROR level. .mvn/jvm.config adds the JDK options Error Prone needs. StringConcatToTextBlock is disabled because it crashes on some code.
  • JSpecify: every package has a package-info.java with @NullMarked, and NullAway runs with OnlyNullMarked=true. This way only this project's code is checked; CloudSim Plus classes (some share package names, such as org.cloudsimplus.testbeds and org.cloudsimplus.heuristics) are seen as unannotated.
  • Null-safety fixes: default values, @Nullable where null is valid, and @SuppressWarnings("NullAway.Init") for fields set after construction (with a comment saying where).

Bugs and other changes from the tools

Where Change
HostFaultInjectionExample1 The format string had 3 placeholders for 4 values, so the source VM was never printed.
VmSchedulerTimeSharedExample %.0f was given a MipsShare object, throwing IllegalFormatConversionException at runtime. Now it prints totalMips().
NetworkVmExampleAbstract Math.round() on a long widened it to float, losing precision; replaced by an int cast.
Several examples Fields are now created where declared or in the constructor before being read (hostList, vmlist, cloudletList, allocationPolicy).

Tests

mvn -B package passes locally on JDK 25 (against a locally installed cloudsimplus:9.0.0-snapshot). CI fails before compiling because that snapshot is not published on Maven Central (the same failure already happens on master).

Related: cloudsimplus/cloudsimplus#570

🤖 Generated with Claude Code

- Run Error Prone and NullAway (as an Error Prone check) on compilation.
- Mark all packages as JSpecify @NullMarked, so NullAway checks just the
  project code (dependencies are seen as unannotated).
- Fix the issues the tools found.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@manoelcampos manoelcampos added the enhancement New feature or request label Oct 19, 2026
@manoelcampos manoelcampos self-assigned this Oct 19, 2026
@manoelcampos
manoelcampos merged commit 575ea5b into master Oct 19, 2026
1 check failed
@manoelcampos
manoelcampos deleted the add-errorprone-nullaway branch October 19, 2026 17:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Error Prone, NullAway and JSpecify

1 participant