Skip to content

Commit a0caae9

Browse files
authored
Merge pull request #43 from typetools/copy-edit
Copy-edit
2 parents ee8fccc + 7a54af6 commit a0caae9

10 files changed

Lines changed: 101 additions & 99 deletions

File tree

‎.gitignore‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
# Mobile Tools for Java (J2ME)
1111
.mtj.tmp/
1212

13-
# Package Files #
13+
# Package files
1414
*.jar
1515
*.war
1616
*.nar
@@ -19,7 +19,7 @@
1919
*.tar.gz
2020
*.rar
2121

22-
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
22+
# Virtual machine crash logs; see http://www.java.com/en/download/help/error_hotspot.xml
2323
hs_err_pid*
2424
replay_pid*
2525

‎README.md‎

Lines changed: 42 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,10 @@ plugins {
1717
If you are upgrading from plugin version 0.x to 1.x, see the [migration
1818
guide](#migrating-from-0x-to-1x).
1919

20-
The plugin supports Gradle versions 7.3 and above, which requires Java 17 and
21-
above. Although you must compile your project using at least Java 17, the
22-
compiled classfiles can be compatible with, and can run on, any version of Java.
20+
The plugin supports Gradle version 7.3 and later, and it requires Java 17 or
21+
later. Although you must compile your project using at least Java 17, the
22+
compiled class files can be compatible with, and can run on, any version of
23+
Java.
2324

2425
The plugin is compatible with Gradle's [configuration
2526
cache](https://docs.gradle.org/current/userguide/configuration_cache.html).
@@ -32,7 +33,7 @@ You must specify which
3233
[version](https://github.com/typetools/checker-framework/releases) of the
3334
Checker Framework to use.
3435

35-
* The Gradle developers recommend to modify two files. Add this to `build.gradle`:
36+
* The Gradle developers recommend modifying two files. Add this to `build.gradle`:
3637

3738
```groovy
3839
checkerFramework {
@@ -47,24 +48,25 @@ Checker Framework to use.
4748
checker-framework = "org.checkerframework:checker:4.2.3"
4849
```
4950

50-
* Alternately, you can edit just one file. Add this to `build.gradle`:
51+
* Alternatively, you can edit just one file. Add this to `build.gradle`:
5152

5253
```groovy
5354
checkerFramework {
5455
version = "4.2.3"
5556
}
5657
```
5758

58-
The special value **"local"** means to use a locally-built version of the
59-
Checker Framework, found at environment variable `$CHECKERFRAMEWORK`.
59+
The special value **"local"** means to use a locally built version of the
60+
Checker Framework, in the directory named by the `CHECKERFRAMEWORK` environment
61+
variable.
6062

6163
The command-line argument **`-PcfVersion=...`** (where "..." is a version number
62-
or "local") overrides settings in gradle buildfiles.
64+
or "local") overrides settings in Gradle build files.
6365

6466
#### Checker Framework jar files
6567

66-
Alternately, you can directly specify which checker and checker-qual jars to
67-
use. You must also set the Checker Framework version to the special value
68+
Alternatively, you can directly specify which checker and checker-qual jar files
69+
to use. You must also set the Checker Framework version to the special value
6870
**`"dependencies"`**. Put the following in your `build.gradle` file:
6971

7072
```groovy
@@ -86,7 +88,8 @@ dependencies {
8688

8789
### Which checkers to run
8890

89-
You must specify which checkers to run using `checkerFramework.checkers` property.
91+
You must specify which checkers to run, using the `checkerFramework.checkers`
92+
property.
9093

9194
For example, using Groovy syntax in a `build.gradle` file:
9295

@@ -167,9 +170,9 @@ checkerFramework {
167170
}
168171
```
169172

170-
From the command line, add `-PskipCheckerFramework` to your gradle invocation. You can also pass
171-
`-PskipCheckerFramework=false` to enable the Checker Framework even if the configuration has
172-
`skipCheckerFramework = true`.
173+
From the command line, add `-PskipCheckerFramework` to your Gradle invocation.
174+
You can also pass `-PskipCheckerFramework=false` to enable the Checker Framework
175+
even if the configuration has `skipCheckerFramework = true`.
173176

174177
### Disabling the Checker Framework for tests
175178

@@ -240,12 +243,12 @@ for different subprojects (for instance, if you want to run different checkers).
240243

241244
## Modules
242245

243-
The Checker Framework inserts inferred annotations into bytecode even if none
244-
appear in source code, so you must make them known to the compiler even if you
245-
write no annotations in your code. When running the plugin on a Java project
246-
that uses modules, you need to add annotations to the module path.
246+
When running the plugin on a Java project that uses modules, you need to add the
247+
annotations to the module path. This is necessary even if you write no
248+
annotations in your code, because the Checker Framework inserts inferred
249+
annotations into the bytecode.
247250

248-
Add following to your `module-info.java`:
251+
Add the following to your `module-info.java`:
249252

250253
```java
251254
requires org.checkerframework.checker.qual;
@@ -254,7 +257,7 @@ requires org.checkerframework.checker.qual;
254257
The addition of `requires` is typically enough.
255258

256259
If it does not fix your compilation issues, you can additionally add the `checker-qual.jar`
257-
artifact (which only contains annotations) to the module path:
260+
artifact (which contains only annotations) to the module path:
258261

259262
```groovy
260263
checkerFramework {
@@ -272,36 +275,36 @@ the [Lombok Gradle Plugin](https://plugins.gradle.org/plugin/io.freefair.lombok)
272275
to delombok your source code before it is passed to the Checker Framework
273276
for type-checking. This plugin does not support any other use of Lombok.
274277

275-
For the Checker Framework to work properly on delombok'd source code,
278+
For the Checker Framework to work properly on delomboked source code,
276279
you must include the following key in your project's `lombok.config` file:
277280

278281
```config
279282
lombok.addLombokGeneratedAnnotation = true
280283
```
281284

282285
By default, Lombok suppresses all warnings in the code it generates. If you
283-
want to typecheck the code that Lombok generates, set the `addSuppressWarnings`
284-
to false:
286+
want to typecheck the code that Lombok generates, set `addSuppressWarnings` to
287+
false:
285288

286289
```config
287290
lombok.addSuppressWarnings = false
288291
```
289292

290-
Note that doing so will cause *all* tools (including Javac itself) to begin issuing
293+
Note that doing so will cause *all* tools (including javac itself) to begin issuing
291294
warnings in the code that Lombok generates.
292295

293-
## Using a locally-built plugin
296+
## Using a locally built plugin
294297

295-
To use a locally-modified version of this plugin:
298+
To use a locally modified version of this plugin:
296299

297300
1. Publish the plugin to your local Maven repository:
298301

299302
```sh
300303
./gradlew publishToMavenLocal
301304
```
302305

303-
2. Add the following to the `settings.gradle` file in
304-
the Gradle project that you want to use the plugin:
306+
2. Add the following to the `settings.gradle` file of the Gradle project in
307+
which you want to use the plugin:
305308

306309
```groovy
307310
pluginManagement {
@@ -336,7 +339,7 @@ you need to make some changes in order to use version 1.x.
336339
to configure interaction with Lombok.
337340

338341
* **`skipVersionCheck`**: There is no longer a version check that might cause
339-
"zip file too large" error. Remove the `-PskipVersionCheck` command-line
342+
a "zip file too large" error. Remove the `-PskipVersionCheck` command-line
340343
argument and remove Gradle code like
341344

342345
```groovy
@@ -345,34 +348,34 @@ you need to make some changes in order to use version 1.x.
345348
}
346349
```
347350
348-
* **`cfLocal`**: Set the version to `"local"` to use a locally-built version
351+
* **`cfLocal`**: Set the version to `"local"` to use a locally built version
349352
of the Checker Framework. Change command-line argument `-PcfLocal` to
350353
`-PcfVersion=local`. (Note: The `cfLocal` functionality was not an
351354
official part of the plugin, but a number of projects use it.)
352355
353-
4. If you want to use a non-standard Checker Framework jar file (such as that of
354-
eisop) see [Checker Framework jar files](#checker-framework-jar-files).
356+
4. If you want to use a nonstandard Checker Framework jar file (such as that of
357+
eisop), see [Checker Framework jar files](#checker-framework-jar-files).
355358
356359
## Troubleshooting
357360
358361
### ClassCastException for a javac class
359362
360363
If you encounter a crash with a `ClassCastException` referencing some internal
361-
Javac class, disable incremental compilation in your build using the following
364+
javac class, disable incremental compilation in your build using the following
362365
code in your `checkerFramework` configuration block:
363366
364367
```groovy
365-
checkerFramework {
366-
incrementalize = false
367-
}
368+
checkerFramework {
369+
incrementalize = false
370+
}
368371
```
369372

370373
Background: By default, the plugin assumes that all checkers are ["isolating
371374
incremental annotation
372375
processors"](https://docs.gradle.org/current/userguide/java_plugin.html#sec:incremental_annotation_processing).
373376
This assumption speeds up builds by enabling incremental compilation. Gradle's
374377
documentation warns that incremental compilation with the Checker Framework
375-
plugin (or any other plugin that uses internal Javac APIs) may crash, because
378+
plugin (or any other plugin that uses internal javac APIs) may crash, because
376379
Gradle wraps some of those APIs.
377380

378381
### Incompatibility with Error Prone 2.3.4 and earlier
@@ -382,9 +385,9 @@ you need to use Error Prone version 2.4.0 (released in May 2020) or later.
382385

383386
<!--
384387
LocalWords: JavaCompile gradle checkerframework checkerFramework toml lombok
385-
LocalWords: PcfVersion buildfiles qual eisopVersion eisop1 checkerQual config
388+
LocalWords: PcfVersion qual eisopVersion eisop1 checkerQual config delomboked
386389
LocalWords: kotlin CheckerFrameworkExtension listOf extraJavacArgs Multi eisop
387-
LocalWords: Werror Astubs testCompileJava excludeTests camelCase classfiles
390+
LocalWords: Werror Astubs testCompileJava excludeTests camelCase
388391
LocalWords: withType configureEach compileMainGeneratedDataTemplateJava
389392
LocalWords: compileMainGeneratedRestJava subprojects allprojects mavenLocal
390393
LocalWords: delombok addLombokGeneratedAnnotation addSuppressWarnings cfLocal

‎gradle/libs.versions.toml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ ktlint = "1.8.0"
55
[libraries]
66
truth = "com.google.truth:truth:1.4.5"
77

8-
# Versions used in build script, libraries added here for Dependabot
9-
junitJupiter-api = { module = "org.junit.jupiter:junit-jupiter-api", version.ref="junitJupiter" }
8+
# Versions used in the build script; the libraries are listed here so that Dependabot updates them.
9+
junitJupiter-api = { module = "org.junit.jupiter:junit-jupiter-api", version.ref = "junitJupiter" }
1010
ktlint = { module = "com.pinterest.ktlint:ktlint-cli", version.ref = "ktlint" }
1111

1212
[plugins]

‎src/functionalTest/kotlin/org/checkerframework/plugin/gradle/CFGroovyPluginFunctionalTest.kt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class CFGroovyPluginFunctionalTest : GroovyPluginFunctionalTest() {
1717
}
1818
repositories {
1919
mavenCentral()
20-
}
20+
}
2121
2222
"""
2323
.trimIndent()

‎src/functionalTest/kotlin/org/checkerframework/plugin/gradle/CFPluginFunctionalTest.kt‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class CfPluginFunctionalTest : KotlinPluginFunctionalTest() {
1919
}
2020
repositories {
2121
mavenCentral()
22-
}
22+
}
2323
2424
"""
2525
.trimIndent()
@@ -435,9 +435,9 @@ class CfPluginFunctionalTest : KotlinPluginFunctionalTest() {
435435

436436
@Test
437437
fun `test checkerFramework configuration`() {
438-
// This tests that the version of the Checker Framework in the checker framework configuration
439-
// is used instead of the version in 'version'. Both versions are pinned rather than tracking
440-
// TEST_CF_VERSION: 'version' supplies checker-qual, and a checker-qual older than checker.jar
438+
// This tests that the version of the Checker Framework in the `checkerFramework` configuration
439+
// is used instead of the version in `version`. Both versions are pinned rather than tracking
440+
// TEST_CF_VERSION: `version` supplies checker-qual, and a checker-qual older than checker.jar
441441
// may lack qualifiers that checker.jar refers to, which fails for a reason unrelated to which
442442
// version this test expects to win.
443443
val configurationVersion = "3.53.0"

‎src/functionalTest/kotlin/org/checkerframework/plugin/gradle/Fixtures.kt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ fun File.writeLombokExample() {
173173
}
174174
}
175175

176-
/** Writes a class that uses lombok and that the Nullness Checker issues no warning about. */
176+
/** Writes a class that uses Lombok and that the Nullness Checker issues no warning about. */
177177
fun File.writeCorrectLombokExample() {
178178
File(this.resolve("src/main/java/lib").apply { mkdirs() }, "Correct.java").apply {
179179
createNewFile()

‎src/functionalTest/kotlin/org/checkerframework/plugin/gradle/OtherPluginsFunctionalTest.kt‎

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,26 +12,26 @@ class OtherPluginsFunctionalTest : KotlinPluginFunctionalTest() {
1212
"""
1313
repositories {
1414
mavenCentral()
15-
}
15+
}
1616
"""
1717
.trimIndent()
1818
)
1919
}
2020

2121
@Test
2222
fun `test lombok 8 12 1`() {
23-
// Lombok 8.12.1 does not support Java 25 and later.
23+
// Version 8.12.1 of the Lombok plugin does not support Java 25 and later.
2424
if (testJavaVersion >= 25) {
2525
return
2626
}
2727
buildFile.appendText(
2828
"""
29-
plugins {
29+
plugins {
3030
`java-library`
3131
id("org.checkerframework")
3232
id("io.freefair.lombok").version("8.12.1")
3333
}
34-
34+
3535
configure<CheckerFrameworkExtension> {
3636
version = "$TEST_CF_VERSION"
3737
checkers = listOf("org.checkerframework.checker.nullness.NullnessChecker")
@@ -59,12 +59,12 @@ class OtherPluginsFunctionalTest : KotlinPluginFunctionalTest() {
5959
fun `test lombok latest`() {
6060
buildFile.appendText(
6161
"""
62-
plugins {
62+
plugins {
6363
`java-library`
6464
id("org.checkerframework")
6565
id("io.freefair.lombok").version("9.5.0")
6666
}
67-
67+
6868
configure<CheckerFrameworkExtension> {
6969
version = "$TEST_CF_VERSION"
7070
checkers = listOf("org.checkerframework.checker.nullness.NullnessChecker")
@@ -92,7 +92,7 @@ class OtherPluginsFunctionalTest : KotlinPluginFunctionalTest() {
9292
fun `test forking is visible at configuration time with lombok`() {
9393
buildFile.appendText(
9494
"""
95-
plugins {
95+
plugins {
9696
`java-library`
9797
id("org.checkerframework")
9898
id("io.freefair.lombok").version("9.5.0")
@@ -121,15 +121,15 @@ class OtherPluginsFunctionalTest : KotlinPluginFunctionalTest() {
121121
}
122122

123123
@Test
124-
fun `test disabling CF with lombok `() {
124+
fun `test disabling CF with lombok`() {
125125
buildFile.appendText(
126126
"""
127-
plugins {
127+
plugins {
128128
`java-library`
129129
id("org.checkerframework")
130130
id("io.freefair.lombok").version("9.5.0")
131131
}
132-
132+
133133
configure<CheckerFrameworkExtension> {
134134
version = "$TEST_CF_VERSION"
135135
checkers = listOf("org.checkerframework.checker.nullness.NullnessChecker")
@@ -158,7 +158,7 @@ class OtherPluginsFunctionalTest : KotlinPluginFunctionalTest() {
158158
fun `test disabling CF for compileJava only, with lombok`() {
159159
buildFile.appendText(
160160
"""
161-
plugins {
161+
plugins {
162162
`java-library`
163163
id("org.checkerframework")
164164
id("io.freefair.lombok").version("9.5.0")
@@ -202,7 +202,7 @@ class OtherPluginsFunctionalTest : KotlinPluginFunctionalTest() {
202202
fun `test disabling CF for the delombok task only`() {
203203
buildFile.appendText(
204204
"""
205-
plugins {
205+
plugins {
206206
`java-library`
207207
id("org.checkerframework")
208208
id("io.freefair.lombok").version("9.5.0")

0 commit comments

Comments
 (0)