-
Notifications
You must be signed in to change notification settings - Fork 2
Impurity annotation #83
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
Changes from all commits
7793d51
8f604c2
c69ea5d
8eda5bd
a7485fe
3ea8f45
2d08e1f
3d1d11a
5905a5a
ea2a440
37bbb96
8b7c211
cde99c4
12cea4d
5e6cc7d
5e6e92e
c5c5f91
a35c932
41297e7
0e3f50e
a9f0f73
659177e
dd22826
353d40c
260ce15
79545fd
4c6a19f
ceb5b82
5cc6053
cc23b13
7672dd7
035b0c1
be4b6c6
fab2301
66b6429
4635465
9fa1783
a26c382
89e1db0
aa39829
affffe7
8ead668
c9b3bb3
bd99141
a8ed0f7
59dde89
6a42cb6
462b22a
02da047
786ef0a
5e87351
41943cb
3bea3fc
c4c83e2
6f86438
d1253d1
e216c95
f73b8b2
50215bf
c5870ae
02b1993
e3465e2
c7b8867
1586c5c
fb4dce7
96ae8c4
b1e3bc7
a1c6d39
fd71729
1cf122d
3302aea
05fe800
96669df
43ecd7a
3194251
998c592
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| 3.14 | ||
| 3.10 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,7 @@ | ||
| [build-system] | ||
| requires = ["uv_build >= 0.9.11, <0.10.0"] | ||
| build-backend = "uv_build" | ||
|
|
||
| [project] | ||
| name = "grt-testing" | ||
| version = "0.1.0" | ||
|
|
@@ -13,5 +17,7 @@ dependencies = [ | |
| [dependency-groups] | ||
| dev = [ | ||
| "pymarkdownlnt>=0.9.33", | ||
| "pyyaml>=6.0.3", | ||
| "ty>=0.0.1a31", | ||
| ] | ||
| # dynamic = ["version"] | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick | 🔵 Trivial Consider removing or documenting the commented line. The commented 🤖 Prompt for AI Agents |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,80 @@ | ||
| # Annotated Subject Program JARs | ||
|
|
||
| This folder holds subject `.jar` files with purity annotations: `@Pure`, | ||
| `@SideEffectFree`, `@Impure`, and related qualifiers from | ||
| `org.checkerframework.framework.qual` Compared to `subject-programs/jars/`, the | ||
| compiled bytecode here is the same, but the class files have purity | ||
| annotations. No other code or resources are altered. | ||
|
|
||
| The annotations are produced by the Checker Framework whole-program inference. | ||
|
|
||
| ## Why the annotations matter | ||
|
|
||
| The `GRT_FUZZING` feature in `scripts/mutation-randoop.sh` prioritizes impure | ||
| calls to mutate an object's state before exercising additional API entry points. | ||
| The annotations provide the information it needs. | ||
|
|
||
| ## Rebuilding an annotated JAR | ||
|
|
||
| ### Setup | ||
|
|
||
| 1. **Fetch sources**: From the top level (`../../`), run | ||
| `scripts/get-all-subject-src.sh` to populate | ||
| `subject-programs/src/<subject-program>/`. | ||
|
|
||
| 2. **Set up inference tooling**: Point your environment at the local Checker | ||
| Framework build: | ||
|
|
||
| ```sh | ||
| export CHECKERFRAMEWORK=/path/to/grt-testing/scripts/build/checker-framework | ||
| export PATH="$CHECKERFRAMEWORK/annotation-file-utilities/bin:$PATH" | ||
| ``` | ||
|
|
||
| 3. **Build the plain JAR**: Run `subject-programs/buildall.sh`. | ||
| The resulting jar appears in `subject-programs/jars/` | ||
| or the subject's usual build folder. | ||
|
|
||
| ### Do the following per project | ||
|
|
||
| 1. **Create the classpath**: Create a file `wpi-classpath.txt` with the | ||
| project's dependencies, one per line. | ||
|
|
||
| This command tries `mvn`; if that doesn't work, assume that the Ant ships | ||
| extra JARs in a local `jars/` or `lib/` folder. | ||
|
|
||
| ```sh | ||
| if ! mvn -q dependency:build-classpath -Dmdep.outputFile=wpi-classpath.txt; then | ||
| find jars -name '*.jar' > wpi-classpath.txt | ||
| find lib -name '*.jar' >> wpi-classpath.txt | ||
| ``` | ||
|
|
||
| 2. **Run inference**: From the subject directory, execute: | ||
|
|
||
| ```sh | ||
| $CHECKERFRAMEWORK/checker/bin/infer-and-annotate.sh \ | ||
| "org.checkerframework.framework.util.PurityChecker" \ | ||
| "$RUNTIME_CLASSPATH" \ | ||
| $(find src -name "*.java") | ||
| ``` | ||
|
|
||
| The script rewrites the sources in place with the inferred annotations. | ||
|
|
||
| 3. **Rebuild**: Repeat the command from step 2 to produce an annotated JAR. | ||
| Copy it to this folder. | ||
|
|
||
| ### Worked example (a4j-1.0b) | ||
|
|
||
| ```sh | ||
| cd subject-programs/src/a4j-1.0b | ||
| ant createJar # build the baseline JAR | ||
| export CHECKERFRAMEWORK=... # reuse the env vars above | ||
| export PATH="$CHECKERFRAMEWORK/annotation-file-utilities/bin:$PATH" | ||
| export JAVAC_JAR="$CHECKERFRAMEWORK/checker/dist/javac.jar" | ||
| RUNTIME_CLASSPATH="../../jars/a4j-1.0b.jar:jars/jox116.jar:jars/log4j-1.2.4.jar" | ||
| $CHECKERFRAMEWORK/checker/bin/infer-and-annotate.sh \ | ||
| "org.checkerframework.framework.util.PurityChecker" \ | ||
| "$RUNTIME_CLASSPATH" \ | ||
| $(find src -name "*.java") | ||
| ant createJar # rebuild with annotations | ||
| cp dist/a4j.jar ../../annotated-jars/a4j-1.0b.jar | ||
| ``` |
Uh oh!
There was an error while loading. Please reload this page.