Skip to content

Commit

Permalink
Compile the samples files as tests (samples-google-prototype-eisop) (
Browse files Browse the repository at this point in the history
  • Loading branch information
wmdietl committed Mar 26, 2024
1 parent 187c927 commit 45d2204
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
15 changes: 15 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,17 @@ apply from: "gradle/integration-test.gradle"
apply from: "gradle/format.gradle"
apply from: "gradle/publish.gradle"

sourceSets {
test {
java {
srcDirs = ['samples']
}
}
}

dependencies {
errorprone "com.google.errorprone:error_prone_core:${errorproneVersion}"
testImplementation 'com.google.guava:guava:31.1-jre'
}

java {
Expand All @@ -36,6 +45,12 @@ java {
}
}

compileTestJava {
options.errorprone.errorproneArgs = [
'-XepExcludedPaths:.*/samples/.*'
]
}

javadoc {
options.encoding = 'UTF-8'
}
Expand Down
4 changes: 3 additions & 1 deletion samples/ContainmentSuperVsExtendsSameType.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@
@NullMarked
class ContainmentSuperVsExtendsSameType {
void x() {
// `conflicting_annotations` b/c upper and lower bound of `? super Object` differ.
// :: error: jspecify_nullness_mismatch jspecify_but_expect_nothing
new Check<Lib<? extends Number>, Lib<? super Number>>();
// :: error: jspecify_conflicting_annotations
new Check<Lib<? extends Object>, Lib<? super Object>>();
}

interface Lib<T extends @Nullable Object> {}
Expand Down

0 comments on commit 45d2204

Please sign in to comment.