KEMBAR78
docs: add Javadoc to mutation annotations by Marcono1234 · Pull Request #976 · CodeIntelligenceTesting/jazzer · GitHub
Skip to content

Conversation

@Marcono1234
Copy link
Contributor

Adds Javadoc to the mutation annotations to hopefully make them a bit easier to use.

Have marked this as Draft for now because I saw that there are other mutation annotation related PRs open, so it might make sense to wait for them to be merged first.

@Marcono1234 Marcono1234 force-pushed the mutation-annotations-javadoc branch from aeb8b51 to a99703c Compare October 10, 2025 19:40
@Marcono1234
Copy link
Contributor Author

Marcono1234 commented Oct 10, 2025

I am not completely sure regarding -0.0 handling for float and double for @Negative and @NonNegative. Just based on the min and max values used by RangeSupport it seems that:

  • @Negative cannot yield -0.0 (due to max = -MIN_VALUE)
  • @NonNegative can yield -0.0 (due to min = 0.0 and (-0.0 >= 0.0) == true)

But I am not sure if the underlying number generation logic can actually create -0.0 in the first place.

@Marcono1234 Marcono1234 marked this pull request as ready for review October 14, 2025 07:40
@simonresch
Copy link
Contributor

I am not completely sure regarding -0.0 handling for float and double for @Negative and @NonNegative. Just based on the min and max values used by RangeSupport it seems that:

* `@Negative` cannot yield -0.0 (due to `max = -MIN_VALUE`)

* `@NonNegative` can yield -0.0 (due to `min = 0.0` and `(-0.0 >= 0.0) == true`)

But I am not sure if the underlying number generation logic can actually create -0.0 in the first place.

You are right regarding the behavior of @Negative and @NonNegative regarding -0.0. Those values will be produced by the mutator quite frequently since -0.0 is included in the specialValues array, even if min = 0.0.

https://github.com/CodeIntelligenceTesting/jazzer/blob/main/src/main/java/com/code_intelligence/jazzer/mutation/mutator/lang/FloatingPointMutatorFactory.java#L409

It might make sense to switch to Double.compare or Float.compare instead of <, > for the comparisons. But I'm not really sure what the most intuitive behavior would be.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds comprehensive Javadoc documentation to mutation annotation classes to improve their usability and discoverability. The documentation clarifies the purpose of each annotation, describes parameter behavior (inclusive bounds), and includes cross-references to related annotations.

Key changes:

  • Added class-level Javadoc to all mutation annotations explaining their purpose
  • Documented annotation parameters with details about inclusive bounds and special cases
  • Added @see tags to link related annotations (e.g., WithSize, WithLength, WithUtf8Length)

Reviewed Changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated no comments.

Show a summary per file
File Description
WithUtf8Length.java Added Javadoc for min/max parameters describing UTF-8 encoding length bounds
WithSize.java Added class-level Javadoc explaining List/Map size generation with cross-references
WithLength.java Added class-level Javadoc explaining array length generation with cross-references
Positive.java Added class-level Javadoc clarifying positive number generation (> 0) and NaN exclusion
NotNull.java Added class-level Javadoc explaining non-null value generation behavior
NonPositive.java Added class-level Javadoc clarifying non-positive number generation (<= 0) and NaN exclusion
NonNegative.java Added class-level Javadoc clarifying non-negative number generation (>= 0) and NaN exclusion
Negative.java Added class-level Javadoc clarifying negative number generation (< 0) excluding -0.0 and NaN
InRange.java Added class-level Javadoc for integral range generation with cross-references and parameter docs
FloatInRange.java Added class-level and parameter Javadoc including allowNaN documentation
Finite.java Added class-level Javadoc explaining finite float/double generation (no NaN/Infinity)
DoubleInRange.java Added class-level and parameter Javadoc including allowNaN documentation
Ascii.java Added class-level Javadoc explaining ASCII string generation including control characters

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link
Contributor

@simonresch simonresch left a comment

Choose a reason for hiding this comment

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

Thanks a lot! Looks good to me.

@simonresch simonresch force-pushed the mutation-annotations-javadoc branch from 9e22eac to 4d3e556 Compare October 15, 2025 15:00
@simonresch simonresch enabled auto-merge (rebase) October 15, 2025 15:01
@simonresch simonresch merged commit d57e869 into CodeIntelligenceTesting:main Oct 15, 2025
10 checks passed
@Marcono1234
Copy link
Contributor Author

Marcono1234 commented Oct 15, 2025

Thanks for merging! And sorry for not having squashed the commits. Feel free to do that on merge (I wouldn't mind if my commits are not preserved as is), or let me know next time and I will do it.

@Marcono1234 Marcono1234 deleted the mutation-annotations-javadoc branch October 15, 2025 16:09
@simonresch
Copy link
Contributor

Thanks for merging! And sorry for not having squashed the commits.

Ah, my bad. I was to trigger happy and didn't look at the individual commits.

Feel free to do that on merge (I wouldn't mind if my commits are not preserved as is), or let me know next time and I will do it.

Both is fine for me. I'm happy to merge multiple commits if they add value.

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