Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,10 @@ docs/examples/BazelExample/bazel-testlogs
docs/examples/BazelExample/Out.txt
docs/examples/MavenExample/Out.txt
docs/examples/MavenExample-framework-all/Out.txt
docs/examples/errorprone/.gradle/
docs/examples/errorprone/Out.txt
docs/examples/nullaway/.gradle/
docs/examples/Wrong-Checker-Qual/Out.txt
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
docs/examples/Wrong-Checker-Qual/Out.txt
docs/examples/mismatched-checker-qual/Out.txt

docs/examples/nullaway/Out.txt
docs/examples/jspecify/.gradle/
docs/examples/jspecify/Out.txt
docs/examples/lombok/.gradle/
docs/examples/lombok/Out.txt
docs/examples/lombok/lombok.config
docs/manual/*.png
Expand All @@ -124,9 +121,9 @@ target/
*.ipr
*.iws
*.iml
/.gradle/
# TODO: why this second gradle directory?
/buildSrc/.gradle/

# Gradle files
.gradle/
Comment thread
ShahriarAhnaf marked this conversation as resolved.

## Tests

Expand Down
3 changes: 3 additions & 0 deletions docs/examples/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -31,3 +33,4 @@ clean:
$(MAKE) -C BazelExample clean
$(MAKE) -C nullaway clean
$(MAKE) -C jspecify clean
$(MAKE) -C mismatched-checker-qual clean
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$(MAKE) -C mismatched-checker-qual clean
$(MAKE) -C mismatched-checker-qual clean

17 changes: 17 additions & 0 deletions docs/examples/mismatched-checker-qual/Makefile
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)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The 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
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The 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
40 changes: 40 additions & 0 deletions docs/examples/mismatched-checker-qual/build.gradle
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',
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
eisopVersion: '3.49.3-eisop1',
eisopVersion: '3.49.3-eisop1',
typetoolsVersion: '3.49.1',

]
}

apply plugin: 'org.checkerframework'

dependencies {
// Without the same checker qualifiers, Nullness Checker should gracefully issue warnings
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The 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
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// Use Typetools checker-qual (original) for qualifiers
// Mismatch between `checker-qual` and `checker` artifacts.

compileOnly "org.checkerframework:checker-qual:3.49.1"
testCompileOnly "org.checkerframework:checker-qual:3.49.1"
Comment on lines +24 to +25
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The 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"
compileOnly "org.checkerframework:checker-qual:${versions.typetoolsVersion}"
testCompileOnly "org.checkerframework:checker-qual:${versions.typetoolsVersion}"

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']
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
}
}

Empty file.
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
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The 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
}
}
1 change: 1 addition & 0 deletions docs/manual/contributors.tex
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,
Expand Down
Loading