-
Notifications
You must be signed in to change notification settings - Fork 29
Mismatched checker-qual artifact example
#1318
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
base: master
Are you sure you want to change the base?
Changes from all commits
021f7bd
325cb6a
5c3da59
0cb6d74
863cc48
a2c359c
42024f8
45b117f
3a311f5
444f157
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 | ||||
|---|---|---|---|---|---|---|
|
|
@@ -16,6 +16,8 @@ compile: | |||||
| $(MAKE) -C BazelExample | ||||||
| $(MAKE) -C nullaway | ||||||
| $(MAKE) -C jspecify | ||||||
| $(MAKE) -C mismatched-checker-qual | ||||||
|
|
||||||
|
|
||||||
| # TODO: type check the different files with the right checker; | ||||||
| # some tests expect errors, compare against expected errors. | ||||||
|
|
@@ -31,3 +33,4 @@ clean: | |||||
| $(MAKE) -C BazelExample clean | ||||||
| $(MAKE) -C nullaway clean | ||||||
| $(MAKE) -C jspecify clean | ||||||
| $(MAKE) -C mismatched-checker-qual clean | ||||||
|
Member
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.
Suggested change
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| JAVA_VER := $(shell java -version 2>&1 | head -1 | cut -d'"' -f2 | sed '/^1\./s///' | cut -d'.' -f1 | sed 's/-ea//' | sed 's/-beta//') | ||
|
|
||
| .PHONY: all clean | ||
|
|
||
| ifeq ($(shell test $(JAVA_VER) -lt 17; echo $$?),0) | ||
|
Member
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. This test isn't using errorprone, so this can be simplified. |
||
| all: | ||
| @echo "Skipping test because errorprone does not work under Java ${JAVA_VER}" | ||
| else | ||
| all: | ||
| - ../../../gradlew build > Out.txt 2>&1 | ||
| # Check for crash due to mismatched Checker Qualifiers | ||
|
Member
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. Add a TODO, here or somewhere else, that explains that we would want more graceful behavior. |
||
| grep -qF "Exception: org.checkerframework.javacutil.BugInCF:" Out.txt | ||
| endif | ||
|
|
||
| clean: | ||
| - ../../../gradlew clean | ||
| rm -f Out.txt | ||
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,40 @@ | ||||||||||
| // /////////////////////////////////////////////////////////////////////////// | ||||||||||
| // Checker Framework pluggable type-checking | ||||||||||
| // Mismatched Checker Qualifiers Example | ||||||||||
| // Having the Wrong qualifiers in the classpath will cause a crash | ||||||||||
| // | ||||||||||
|
|
||||||||||
| plugins { | ||||||||||
| id 'java' | ||||||||||
| // Checker Framework pluggable type-checking | ||||||||||
| id 'org.checkerframework' version '0.6.53' apply false | ||||||||||
| } | ||||||||||
|
|
||||||||||
| ext { | ||||||||||
| versions = [ | ||||||||||
| eisopVersion: '3.49.3-eisop1', | ||||||||||
|
Member
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.
Suggested change
|
||||||||||
| ] | ||||||||||
| } | ||||||||||
|
|
||||||||||
| apply plugin: 'org.checkerframework' | ||||||||||
|
|
||||||||||
| dependencies { | ||||||||||
| // Without the same checker qualifiers, Nullness Checker should gracefully issue warnings | ||||||||||
|
Member
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. Move this to the beginning of the file, where it is currently not clear what the intended behavior is. |
||||||||||
| // Use Typetools checker-qual (original) for qualifiers | ||||||||||
|
Member
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.
Suggested change
|
||||||||||
| compileOnly "org.checkerframework:checker-qual:3.49.1" | ||||||||||
| testCompileOnly "org.checkerframework:checker-qual:3.49.1" | ||||||||||
|
Comment on lines
+24
to
+25
Member
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.
Suggested change
|
||||||||||
| checkerFramework "io.github.eisop:checker-qual:${versions.eisopVersion}" | ||||||||||
| checkerFramework "io.github.eisop:checker:${versions.eisopVersion}" | ||||||||||
| } | ||||||||||
|
|
||||||||||
| repositories { | ||||||||||
| // mavenLocal() // Use local Maven repository first for testing | ||||||||||
| mavenCentral() | ||||||||||
| } | ||||||||||
|
|
||||||||||
| checkerFramework { | ||||||||||
| checkers = [ | ||||||||||
| 'org.checkerframework.checker.nullness.NullnessChecker', | ||||||||||
| ] | ||||||||||
| extraJavacArgs = ['-Aversion'] | ||||||||||
| } | ||||||||||
|
Member
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.
Suggested change
|
||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| package com.example; | ||
|
|
||
| import java.util.Set; | ||
|
|
||
| public class Demo { | ||
| void demo(Set<Short> s, short i) { | ||
| s.remove(i - 1); // Error Prone error | ||
|
Member
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. This test doesn't use errorprone, so we can simplify this. Keep just a Nullness Checker example, for which we can test once the "graceful" behavior is implemented. |
||
| s.add(null); // Nullness Checker error | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,7 @@ | ||
| Abraham Lin, | ||
| Adian Qian, | ||
| Aditya Singh, | ||
| Ahnaf Shahriar, | ||
| Akash Srivastava, | ||
| Alex Cook, | ||
| Alex Liu, | ||
|
|
||
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.