-
Notifications
You must be signed in to change notification settings - Fork 161
feat: add additional number annotations #959
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
Conversation
19982d2
to
6b0f6bc
Compare
f82b7be
to
027e7d5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work!
Since all these new annotations can be used to annotate the same type, I think we really should enforce that only one of them is allowed, because all of them essentially map to @(Float|Double)InRange
equivalent.
For example, currently, this results in the domain [0:200]
:
@FuzzTest
public void fuzz_int(@Positive @InRange(min=-100, max=200) @NonNegative int i) {
However, the Java type system does not let you add two @InRange
annotations to the same type (because it is not annotated by @Repeatable
).
TBH, I don't think we should be adding these annotations, because they add large complexity (especially if we want to add uniqueness enforcement for all annotation types that map to some other annotation type) with only little upside for the users (we can already specify these domains using @InRange
, @FloatInRange
, and @DoubleInRange
). But we should discuss that.
src/main/java/com/code_intelligence/jazzer/mutation/support/RangeSupport.java
Show resolved
Hide resolved
...in/java/com/code_intelligence/jazzer/mutation/mutator/lang/PrimitiveArrayMutatorFactory.java
Outdated
Show resolved
Hide resolved
...in/java/com/code_intelligence/jazzer/mutation/mutator/lang/PrimitiveArrayMutatorFactory.java
Show resolved
Hide resolved
...in/java/com/code_intelligence/jazzer/mutation/mutator/lang/PrimitiveArrayMutatorFactory.java
Outdated
Show resolved
Hide resolved
src/test/java/com/code_intelligence/jazzer/mutation/support/TypeSupportTest.java
Outdated
Show resolved
Hide resolved
027e7d5
to
ab80cc2
Compare
dc7d816
to
13eef21
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, with some comments!
src/main/java/com/code_intelligence/jazzer/mutation/support/RangeSupport.java
Outdated
Show resolved
Hide resolved
src/main/java/com/code_intelligence/jazzer/mutation/support/RangeSupport.java
Outdated
Show resolved
Hide resolved
src/main/java/com/code_intelligence/jazzer/mutation/support/RangeSupport.java
Outdated
Show resolved
Hide resolved
src/main/java/com/code_intelligence/jazzer/mutation/support/RangeSupport.java
Outdated
Show resolved
Hide resolved
13eef21
to
106e0a3
Compare
106e0a3
to
6ea835a
Compare
An addition in the mutation framework docs could make sense for the new annotations. |
This PR adds support for these additional number annotations:
@Positive
,@Negative
,@NonPositive
,@NonNegative
.Note that it is not checked if multiple annotations contain contradicting information.