This project is developed based on Checker Framework. To use this checker, below dependencies are required:
- checker framework
I have a
setup.sh to build these dependencies and also the Read Checker. This
setup.sh needs following tools to be ready in your machine before running it:
First, to have a better file structure, you may want to create a root directory called
jsr308, clone this project. In the clone, run
./setup.sh. This script will download and build all neccessary dependencies, followed by building Read Checker and running test suites of Read Checker.
It is suggested to further configure
JSR308 environment variable for your convenience:
In your bash profile file, export
JSR308as the absolute path of your
export JSR308=<the absolute path of your jsr308 dir in your machine>
JSR308 environment variable is required for using my version of do-like-javac to run Read Checker on a project with project's build command, and it also allows running Read Checker with a conciser command.
How to run Read Checker to check your Java code
Foo Project demo
ReadChecker clone, I've attached a
FooProject as a demo of ReadChecker. You can run Read Checker on this foo project in two ways:
running Read Checker directly on source files of FooProject
e.g. In dir
running Read Checker on FooProject by FooProject's build command (needs configure
e.g. In dir
ant clean ../run-dljc.sh ant
The subsections below introduce the details of each way of running Read Checker.
Running Read Checker on Java file(s)
I have written a simple script
read-check.sh to make this task easier. You could just passing java files to this script, and this script will check all the java files you passing through.
$JSR308/ReadChecker/read-check.sh <your java files> $JSR308/ReadChecker/read-check.sh aSingleFile.java $JSR308/ReadChecker/read-check.sh **/*.java $JSR308/ReadChecker/read-check.sh FileA.java FileB.java ... FileN.java
For the detailers, this script just a wrap-up of below command:
ReadChecker/../checker-framework/checker/bin-devel/javac -processor read.ReadChecker -cp ReadChecker/bin:ReadChecker/lib <your java files>
Running Read Checker on a project by do-like-javac
In your project, just run
run-dljc.sh with the build cmd of your project:
$JSR308/ReadChecker/run-dljc.sh <your build cmd, e.g. `ant build` or `mvn install`>
- running a Checker by
do-like-javacon a project needs this project is in a "clean" state. In other words, you should do a
cleancommand in your project before runnning Read Checker on it.
do-like-javac could be find here.