forked from jspecify/jspecify-reference-checker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
demo
executable file
·34 lines (30 loc) · 1.55 KB
/
demo
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/sh
# A quick and easy way to run the reference checker on some standalone code.
# If you set the CLASSPATH environment variable it will use it, adding its own entries to that list.
# To integrate the checker into a more complex build, reading the below should give you what you need to know.
dir=$(dirname $0)
jspecify="${dir}/../jspecify/build/libs/jspecify-0.0.0-SNAPSHOT.jar"
if [ ! -e "${jspecify}" ]; then
version=1.0.0
jspecify="${dir}/build/jspecify-${version}.jar"
if [ ! -e "${jspecify}" ]; then
echo "Downloading $(basename "${jspecify}") from Maven central"
mvn -q org.apache.maven.plugins:maven-dependency-plugin:3.7.1:copy \
-Dartifact="org.jspecify:jspecify:${version}" \
-DoutputDirectory="$(dirname "${jspecify}")"
fi
fi
jspecify_reference_checker="${dir}/build/libs/jspecify-reference-checker-0.0.0-SNAPSHOT.jar"
if [ ! -e "${jspecify_reference_checker}" ]; then
echo "Assembling jspecify-reference-checker"
./gradlew assemble
fi
ourclasspath="${jspecify}:${jspecify_reference_checker}"
export CLASSPATH="${ourclasspath}:$CLASSPATH"
$dir/../checker-framework/checker/bin/javac \
-processorpath "${ourclasspath}" \
-processor com.google.jspecify.nullness.NullSpecChecker \
-AcheckImpl \
-AassumePure \
-AsuppressWarnings=contracts.conditional.postcondition.false.methodref,contracts.conditional.postcondition.false.override,contracts.conditional.postcondition.true.methodref,contracts.conditional.postcondition.true.override,purity.methodref,purity.overriding,type.anno.before.decl.anno,type.anno.before.modifier \
"$@"