1#!/bin/bash 2 3declare -A INNER 4declare -A PARAMETER 5declare -A IMPORT 6 7ANNOTATIONS=( 8 org.checkerframework.checker.nullness.qual.Nullable 9 org.checkerframework.checker.nullness.compatqual.NullableDecl 10) 11 12for a in ${ANNOTATIONS[@]}; do 13 package=${a%.*} 14 class=${a##*.} 15 dir=$(dirname $0)/src/${package//.//} 16 file=${class}.java 17 inner=${INNER[$a]} 18 parameter=${PARAMETER[$a]} 19 import= 20 21 if [ -n "${parameter}" ]; then 22 parameter="${parameter} value();" 23 fi 24 25 for i in ${IMPORT[$a]}; do 26 import="${import}import ${i};" 27 done 28 29 mkdir -p ${dir} 30 sed -e"s/__PACKAGE__/${package}/" \ 31 -e"s/__CLASS__/${class}/" \ 32 -e"s/__INNER__/${inner}/" \ 33 -e"s/__PARAMETER__/${parameter}/" \ 34 -e"s/__IMPORT__/${import}/" \ 35 $(dirname $0)/tmpl.java > ${dir}/${file} 36 google-java-format -i ${dir}/${file} 37done 38