-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Add checkerframework and errorprone #2941
base: master
Are you sure you want to change the base?
Changes from 2 commits
4822292
a566d2c
b96fab6
d6fbea3
0c765e8
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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import org.checkerframework.gradle.plugin.CheckerFrameworkExtension | ||
|
||
plugins { | ||
id("org.checkerframework") | ||
} | ||
|
||
dependencies { | ||
checkerFramework("org.checkerframework:checker:3.36.0") | ||
} | ||
|
||
plugins.withId("org.checkerframework") { | ||
configure<CheckerFrameworkExtension> { | ||
checkers = listOf( | ||
"org.checkerframework.checker.nullness.NullnessChecker", | ||
"org.checkerframework.checker.optional.OptionalChecker" | ||
) | ||
} | ||
} | ||
|
||
tasks.withType<JavaCompile>().configureEach { | ||
// Don't run the checker on generated code. | ||
if (name.startsWith("compileMainGenerated")) { | ||
checkerFramework { | ||
skipCheckerFramework = true | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import net.ltgt.gradle.errorprone.errorprone | ||
|
||
plugins { | ||
id("net.ltgt.errorprone") | ||
} | ||
|
||
dependencies { | ||
errorprone("com.google.errorprone:error_prone_core:2.20.0") | ||
} | ||
|
||
tasks.withType<JavaCompile>().configureEach { | ||
options.errorprone.disableWarningsInGeneratedCode.set(true) | ||
} |
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
plugins { | ||
id("testng.java-library") | ||
} | ||
|
||
dependencies { | ||
implementation("org.checkerframework:checker-qual:3.36.0") | ||
implementation("com.google.errorprone:error_prone_annotations:2.20.0") | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
package org.testng; | ||
|
||
import org.checkerframework.checker.nullness.qual.NonNull; | ||
|
||
/** | ||
* Factory used to create all test instances. This object factory only receives the class in | ||
* parameter. | ||
|
@@ -17,7 +19,7 @@ public interface IObjectFactory2 extends ITestObjectFactory { | |
* @return - The newly created object. | ||
*/ | ||
@Deprecated | ||
default Object newInstance(Class<?> cls) { | ||
default Object newInstance(@NonNull Class<?> cls) { | ||
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. It would be better to use package-level "default not null" annotation rather than See explanation in https://checkerframework.org/manual/#climb-to-top |
||
return newInstance(cls, new Object[0]); | ||
} | ||
} |
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.
plugins { id("org.checkerframework") }
addscheckerframework
plugin, soplugins.withId(..)
is not needed here.Something like
checkerframework {...}
should do.