Skip to content

Commit ff5a33e

Browse files
committed
Merge branch 'main' into mutation-annotations-javadoc
2 parents ff92dba + 6817a41 commit ff5a33e

15 files changed

Lines changed: 167 additions & 69 deletions

File tree

‎README.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ If you see an error saying that `libjvm.so` has not been found, make sure that `
178178
Jazzer uses two main directories to store inputs: the *generated corpus directory* and the *inputs directory*.
179179

180180
> [!IMPORTANT]
181-
> If you are using Git and want to add the corpus directories to the repository, mark them as `binary` in your `.gitattributes` file:
181+
> If you are using Git and want to add the inputs and corpus directories to the repository, mark them as `binary` in your `.gitattributes` file:
182182
>
183183
> ```gitattributes
184184
> src/test/resources/** binary
@@ -188,7 +188,7 @@ Jazzer uses two main directories to store inputs: the *generated corpus director
188188
### Generated corpus directory
189189
190190
The *generated corpus directory* is where Jazzer saves inputs that generate new coverage during fuzzing.
191-
It is located in `.cifuzz-corpus/<package>/<FuzzTestClass>/<fuzzTestMethod>`, where `<package>`, `<FuzzTestClass>`, and `<fuzzTestMethod>` correspond to the package name, class name, and method name of the fuzz test, respectively.
191+
It is located in `.cifuzz-corpus/<package>.<FuzzTestClass>/<fuzzTestMethod>`, where `<package>`, `<FuzzTestClass>`, and `<fuzzTestMethod>` correspond to the package name, class name, and method name of the fuzz test, respectively.
192192
For example, if the fuzz test is in the class `src/test/java/com/example/ValidFuzzTests.java`, method `byteFuzz`, the corpus directory is located in `.cifuzz-corpus/com.example.ValidFuzzTests/byteFuzz`.
193193
194194

‎docs/mutation-framework.md‎

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ Currently supported types are:
5656
| Mutator | Type(s) | Notes |
5757
|--------------------------------|--------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
5858
| Boolean | `boolean`, `Boolean` | |
59-
| Integral | `byte`, `Byte`, `short`, `Short`, `int`, `Int`, `long`, `Long` | |
59+
| Integral | `byte`, `Byte`, `short`, `Short`, `int`, `Integer`, `long`, `Long` | |
6060
| Floating point | `float`, `Float`, `double`, `Double` | |
6161
| String | `java.lang.String` | |
6262
| Enum | `java.lang.Enum` | |
@@ -87,21 +87,22 @@ string. This is done using annotations directly on the parameters.
8787
All annotations reside in the `com.code_intelligence.jazzer.mutation.annotation`
8888
package.
8989

90-
| Annotation | Applies To | Notes |
91-
|-------------------|------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------|
92-
| `@Ascii` | `java.lang.String` | `String` should only contain ASCII characters |
93-
| `@InRange` | `byte`, `Byte`, `short`, `Short`, `int`, `Int`, `long`, `Long` | Specifies `min` and `max` values of generated integrals |
94-
| `@FloatInRange` | `float`, `Float` | Specifies `min` and `max` values of generated floats |
95-
| `@DoubleInRange` | `double`, `Double` | Specifies `min` and `max` values of generated doubles |
96-
| `Positive` | `byte`, `Byte`, `short`, `Short`, `int`, `Int`, `long`, `Long`, `float`, `Float`, `double`, `Double` | Specifies that only positive values are generated |
97-
| `Negative` | `byte`, `Byte`, `short`, `Short`, `int`, `Int`, `long`, `Long`, `float`, `Float`, `double`, `Double` | Specifies that only negative values are generated |
98-
| `NonPositive` | `byte`, `Byte`, `short`, `Short`, `int`, `Int`, `long`, `Long`, `float`, `Float`, `double`, `Double` | Specifies that only non-positive values are generated |
99-
| `NonNegative` | `byte`, `Byte`, `short`, `Short`, `int`, `Int`, `long`, `Long`, `float`, `Float`, `double`, `Double` | Specifies that only non-negative values are generated |
100-
| `@NotNull` | | Specifies that a reference type should not be `null` |
101-
| `@WithLength` | `byte[]` | Specifies the length of the generated byte array |
102-
| `@WithUtf8Length` | `java.lang.String` | Specifies the length of the generated string in UTF-8 bytes, see annotation Javadoc for further information |
103-
| `@WithSize` | `java.util.List`, `java.util.Map` | Specifies the size of the generated collection |
104-
| `@UrlSegment` | `java.lang.String` | `String` should only contain valid URL segment characters |
90+
| Annotation | Applies To | Notes |
91+
|-------------------|----------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------|
92+
| `@Ascii` | `java.lang.String` | `String` should only contain ASCII characters |
93+
| `@InRange` | `byte`, `Byte`, `short`, `Short`, `int`, `Integer`, `long`, `Long` | Specifies `min` and `max` values of generated integrals |
94+
| `@FloatInRange` | `float`, `Float` | Specifies `min` and `max` values of generated floats |
95+
| `@DoubleInRange` | `double`, `Double` | Specifies `min` and `max` values of generated doubles |
96+
| `@Positive` | `byte`, `Byte`, `short`, `Short`, `int`, `Integer`, `long`, `Long`, `float`, `Float`, `double`, `Double` | Specifies that only positive values are generated |
97+
| `@Negative` | `byte`, `Byte`, `short`, `Short`, `int`, `Integer`, `long`, `Long`, `float`, `Float`, `double`, `Double` | Specifies that only negative values are generated |
98+
| `@NonPositive` | `byte`, `Byte`, `short`, `Short`, `int`, `Integer`, `long`, `Long`, `float`, `Float`, `double`, `Double` | Specifies that only non-positive values are generated |
99+
| `@NonNegative` | `byte`, `Byte`, `short`, `Short`, `int`, `Integer`, `long`, `Long`, `float`, `Float`, `double`, `Double` | Specifies that only non-negative values are generated |
100+
| `@Finite` | `float`, `Float`, `double`, `Double` | Specifies that only finite values are generated |
101+
| `@NotNull` | | Specifies that a reference type should not be `null` |
102+
| `@WithLength` | `byte[]` | Specifies the length of the generated byte array |
103+
| `@WithUtf8Length` | `java.lang.String` | Specifies the length of the generated string in UTF-8 bytes, see annotation Javadoc for further information |
104+
| `@WithSize` | `java.util.List`, `java.util.Map` | Specifies the size of the generated collection |
105+
| `@UrlSegment` | `java.lang.String` | `String` should only contain valid URL segment characters |
105106

106107
The example below shows how Fuzz Test parameters can be annotated to provide
107108
additional information to the mutation framework.

‎renovate.json5‎

Lines changed: 28 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,47 @@
11
{
2-
$schema: "https://docs.renovatebot.com/renovate-schema.json",
2+
$schema: 'https://docs.renovatebot.com/renovate-schema.json',
33
extends: [
4-
"config:recommended",
5-
":dependencyDashboard",
6-
"group:all",
7-
"schedule:weekly"
4+
'config:recommended',
5+
':dependencyDashboard',
6+
'group:all',
7+
'schedule:weekly',
88
],
99
customManagers: [
1010
{
11-
description: "Maven dependencies managed by rules_jvm_external",
12-
customType: "regex",
13-
fileMatch: [
14-
"^MODULE.bazel$"
11+
description: 'Maven dependencies managed by rules_jvm_external',
12+
customType: 'regex',
13+
managerFilePatterns: [
14+
'/^MODULE.bazel$/',
1515
],
16-
matchStringsStrategy: "recursive",
16+
matchStringsStrategy: 'recursive',
1717
matchStrings: [
1818
// First narrow down the search to those dependencies in a Starlark list annotated with
1919
// a special comment.
20-
"# renovate: keep updated[^\\]]*]",
20+
'# renovate: keep updated[^\\]]*]',
2121
// Match all lines of the form:
2222
// "com.google.guava:guava:jar:28.2-jre",
23-
"\\n\\s*\"(?<depName>[^:]+:[^:]+):(?:jar:)?(?<currentValue>\\d[^\"]*)\","
23+
'\\n\\s*"(?<depName>[^:]+:[^:]+):(?:jar:)?(?<currentValue>\\d[^"]*)",',
2424
],
25-
datasourceTemplate: "maven"
26-
}
25+
datasourceTemplate: 'maven',
26+
},
2727
],
2828
packageRules: [
2929
{
3030
// Assign regex matches to a separate group since these PRs require manual lockfile updates.
31-
matchManagers: ["regex"],
32-
groupName: "Maven deps",
33-
groupSlug: "maven",
31+
matchManagers: [
32+
'custom.regex',
33+
],
34+
groupName: 'Maven deps',
35+
groupSlug: 'maven',
3436
},
3537
{
36-
// System scoped Maven dependencies are build locally.
37-
matchDepTypes: ["system"],
38-
matchManagers: ["maven"],
39-
enabled: false
40-
}
41-
]
38+
matchDepTypes: [
39+
'system',
40+
],
41+
matchManagers: [
42+
'maven',
43+
],
44+
enabled: false,
45+
},
46+
],
4247
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/*
2+
* Copyright 2024 Code Intelligence GmbH
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.code_intelligence.jazzer.mutation.annotation;
18+
19+
import static java.lang.annotation.ElementType.TYPE_USE;
20+
import static java.lang.annotation.RetentionPolicy.RUNTIME;
21+
22+
import com.code_intelligence.jazzer.mutation.utils.AppliesTo;
23+
import com.code_intelligence.jazzer.mutation.utils.PropertyConstraint;
24+
import java.lang.annotation.Retention;
25+
import java.lang.annotation.Target;
26+
27+
@Target(TYPE_USE)
28+
@Retention(RUNTIME)
29+
@AppliesTo({float.class, Float.class, double.class, Double.class})
30+
@PropertyConstraint
31+
public @interface Finite {
32+
/**
33+
* Defines the scope of the annotation. Possible values are defined in {@link
34+
* com.code_intelligence.jazzer.mutation.utils.PropertyConstraint}.
35+
*/
36+
String constraint() default PropertyConstraint.DECLARATION;
37+
}

‎src/main/java/com/code_intelligence/jazzer/mutation/mutator/collection/BUILD.bazel‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ java_library(
22
name = "collection",
33
srcs = glob(["*.java"]),
44
visibility = [
5-
"//src/main/java/com/code_intelligence/jazzer/mutation/mutator:__pkg__",
5+
"//src/main/java/com/code_intelligence/jazzer/mutation/mutator:__subpackages__",
66
"//src/test/java/com/code_intelligence/jazzer/mutation/mutator:__subpackages__",
77
],
88
deps = [

‎src/main/java/com/code_intelligence/jazzer/mutation/mutator/lang/BUILD.bazel‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ java_library(
22
name = "lang",
33
srcs = glob(["*.java"]),
44
visibility = [
5-
"//src/main/java/com/code_intelligence/jazzer/mutation/mutator:__pkg__",
5+
"//src/main/java/com/code_intelligence/jazzer/mutation/mutator:__subpackages__",
66
"//src/test/java/com/code_intelligence/jazzer/mutation/mutator:__subpackages__",
77
],
88
deps = [

‎src/main/java/com/code_intelligence/jazzer/mutation/mutator/proto/BUILD.bazel‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ java_library(
1313
"//src/main/java/com/code_intelligence/jazzer/mutation/api",
1414
"//src/main/java/com/code_intelligence/jazzer/mutation/combinator",
1515
"//src/main/java/com/code_intelligence/jazzer/mutation/engine",
16+
"//src/main/java/com/code_intelligence/jazzer/mutation/mutator/collection",
17+
"//src/main/java/com/code_intelligence/jazzer/mutation/mutator/lang",
1618
"//src/main/java/com/code_intelligence/jazzer/mutation/support",
1719
"//src/main/java/com/code_intelligence/jazzer/mutation/utils",
1820
],

0 commit comments

Comments
 (0)