Skip to content
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

Typecheck Fix #35

Open
wants to merge 154 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
154 commits
Select commit Hold shift + click to select a range
8772985
adapt pico to CF and CFI master
baoruiz Mar 20, 2019
c8e412f
fix pico per changes in upstream CF and CFI
baoruiz Mar 28, 2019
9e27922
remove incorrect aliasing and unnecessary method check
baoruiz Apr 2, 2019
0298a5f
remove wrong test diagnostic
baoruiz Apr 18, 2019
5ddc6ae
adapt to upstream changes
baoruiz Apr 18, 2019
c4e9ed4
fix extends and implements check
baoruiz Apr 24, 2019
8b8bd6b
tweak travis build script
baoruiz Apr 30, 2019
e3bc7a5
Remove useless separators.
xingweitian Jul 3, 2019
21d2fae
Unify the name of test files.
xingweitian Jul 10, 2019
8b69770
Fix typo.
xingweitian Jul 24, 2019
dd4717a
Fix typo.
xingweitian Jul 24, 2019
e468c1e
Fix typo.
xingweitian Jul 26, 2019
0391e9d
Complete the messages.
xingweitian Jul 27, 2019
0ee8410
Merge pull request #3 from xingweitian/adapt-to-cf-master
wmdietl Jul 27, 2019
fb54eb2
Use all dirs and jar file to fix the issue that "messages.properties"…
xingweitian Jul 28, 2019
6a29832
Merge remote-tracking branch 'origin/adapt-to-cf-master' into adapt-t…
xingweitian Jul 28, 2019
6c07c6c
Tweaks.
xingweitian Jul 28, 2019
cab2d60
Merge remote-tracking branch 'upstream/adapt-to-cf-master' into adapt…
xingweitian Jul 28, 2019
10613ac
Use the correct error key.
xingweitian Jul 30, 2019
147db8d
Merge pull request #4 from xingweitian/adapt-to-cf-master
xingweitian Aug 17, 2019
505dcf8
Merge pull request #6 from xingweitian/xwt-fix-test-cases
xingweitian Aug 17, 2019
ab8af46
Fix typo (CompatabilityBEI2.java -> CompatibilityBEI2.java) and make …
xingweitian Aug 18, 2019
a19d94f
Update.
xingweitian Sep 10, 2019
236d0f4
Update.
xingweitian Sep 7, 2019
b74dc2a
api updates
Nov 21, 2019
32c6852
typo
Nov 21, 2019
e630ebd
Merge remote-tracking branch 'xwt/adapt-to-cf-master' into ls-dev
Nov 21, 2019
e6892fa
default-for annotator, default bottom on null, allow readonly as uppe…
lnsun Dec 2, 2019
de0969f
Implement super constructor call check.
xingweitian Jul 30, 2019
d823dcf
Improve code and javadoc.
xingweitian Aug 19, 2019
0676e7d
clean debug messages and comment
lnsun Dec 5, 2019
09f6f01
fixed HashCodeSafetyExample, addMissingAnnotations->replaceAnnotation
lnsun Dec 5, 2019
0b34f3a
fixed CompatibilityBEI2 + ReceiverTypeOutsideConstructor: pull defaul…
lnsun Dec 5, 2019
cfc4054
milestone: all typecheck tests passed
lnsun Dec 9, 2019
85d0945
add anno invalid check in local variables; add RDM extends/implements…
lnsun Dec 19, 2019
afff4ed
override cf default extends/implements checks
lnsun Dec 19, 2019
f514775
fix anonymous type of new clause and test case
lnsun Jan 17, 2020
3210749
reuse test cases for typecheck and infer initial typecheck
lnsun Jan 17, 2020
2087d9a
fix a accidentally disabled test case
lnsun Jan 20, 2020
257f732
fix additional tests' errors
lnsun Feb 28, 2020
d5909e9
test vpa over imp
lnsun Apr 6, 2020
9b33196
TODO: resolve path issues, remove this when fixed
lnsun Apr 6, 2020
2bd7c5e
default class bound and super clause
lnsun Apr 7, 2020
08d136f
default class bound and super clause enhanced
lnsun Apr 8, 2020
52fa126
implicit immutable class bound + cast.unsafe
lnsun Apr 15, 2020
45f4c0f
remove wrong cast.unsafe keys
lnsun Apr 15, 2020
90074b2
bound of array fixed to READONLY. VPA not needed here because any typ…
lnsun Apr 16, 2020
857050e
bottom workaround + vpa interface
lnsun Apr 17, 2020
4dab7b1
enum default immutable. TODO: fix constructor check in mutable enum decl
lnsun Apr 18, 2020
a42c289
fix enum default in inference
lnsun Apr 21, 2020
761655d
doc
lnsun Apr 23, 2020
bdcbb4c
relocate common interface and annotator
lnsun Apr 23, 2020
5c42ad4
bound
lnsun Apr 24, 2020
4e72db6
enum & super clause
lnsun May 5, 2020
ba48fda
test case update
lnsun May 5, 2020
b853156
tweaks on generic
lnsun May 6, 2020
2e1c6b0
fix anno
lnsun May 7, 2020
3f66342
Merge branch 'tmp' into typecheck-amend
lnsun May 7, 2020
461c86a
poly workaround
lnsun May 8, 2020
c7b7d08
update test cases (typecheck 100%, inference-init-tc 100%)
lnsun May 8, 2020
14ad936
API update: report
lnsun May 8, 2020
42cc297
API update: remove @DefaultInUncheckedCodeFor
lnsun May 8, 2020
765fc99
remove @SPM
lnsun May 12, 2020
54dc0de
Revert "remove @SPM"
lnsun May 13, 2020
9c31c35
@SPM for static moved to new api
lnsun May 18, 2020
adf2c17
exclude decl when checking static RDM (TC: 100%, INF: 6 fail)
lnsun May 18, 2020
2e2ffd0
small tweaks
lnsun May 18, 2020
6277e02
tc cast.unsafe (TC: 100%, INF: 4 fail)
lnsun May 19, 2020
b90d5f9
inf-> workaround for anonymous class
lnsun May 19, 2020
13555c6
a small tweak
lnsun May 19, 2020
a4339f9
update test cases (TC all pass)
lnsun May 19, 2020
5da659f
re-remove @SPM
lnsun May 21, 2020
a954e32
add CF all-systems test
lnsun May 22, 2020
e53f3fb
small tweaks on test drivers
lnsun May 22, 2020
d3e571c
interface
lnsun Jun 10, 2020
9879f05
isSubtype use native api
lnsun Jul 2, 2020
ab48c6a
infer atf + get bound
lnsun Jul 2, 2020
9885f10
tweaks
lnsun Jul 2, 2020
df3f2dd
checker.report update
lnsun Jul 3, 2020
a6df8de
checker.report update
lnsun Jul 3, 2020
0209864
tc
lnsun Oct 9, 2020
12e4a8c
tc
lnsun Oct 15, 2020
f04a5bb
ignore rdm on fields
lnsun Oct 15, 2020
aa240ec
rdm field logic + tc
lnsun Nov 20, 2020
06da98a
VPA post check
lnsun Nov 24, 2020
0d63613
vpa post check
lnsun Nov 24, 2020
d47daa5
field rdm default
lnsun Nov 26, 2020
ab44c1e
check anno
lnsun Dec 2, 2020
ef44406
tc update
lnsun Dec 2, 2020
5a67d2e
transitive (needs fix)
lnsun Dec 16, 2020
fc6cf0b
class bound != PM
lnsun Jan 14, 2021
d8e1195
receiver != BOTTOM
lnsun Jan 14, 2021
f5972fd
stop assign immutable constant slot to enum usage. enum could be mutable
lnsun Jan 15, 2021
f1acb77
PICO does not need existential slot on class decl anno
lnsun Jan 15, 2021
a2f5726
use constant slot for explicit class decl anno
lnsun Jan 20, 2021
10d1e17
update init bound extraction function
lnsun Jan 20, 2021
6c31de8
update call to init bound extraction function
lnsun Jan 20, 2021
0254063
prevent poly infer
lnsun Jan 20, 2021
31ff749
bound handling for anonymous class
lnsun Jan 22, 2021
4f41dc4
anonymous class method receiver workaround
lnsun Jan 22, 2021
a152323
workarounds for anonymous class for getTypeOfExtendsImplements
lnsun Jan 23, 2021
1c17437
extract method
lnsun Jan 25, 2021
cf64586
do not apply real anno to atm during infer
lnsun Jan 25, 2021
df55010
not apply immutable constant to enum during infer-typecheck
lnsun Jan 26, 2021
e4cbe5f
add init bound extraction function
lnsun Jan 27, 2021
50e3cea
update tc
lnsun Feb 23, 2021
5a9e8ca
array bound -> RDM (TC)
lnsun Feb 24, 2021
11834c1
exclude static inner class decl from static scope
lnsun Feb 27, 2021
75e7d94
don't check with default during inference
lnsun Feb 27, 2021
536326e
add immutable alias for real type factory
lnsun Feb 27, 2021
00c72b0
array decl method
lnsun Feb 28, 2021
1302fbd
implicit shallow immutable warning (TC)
lnsun Feb 28, 2021
e135891
tune up vpa
lnsun Mar 9, 2021
0dcb75a
better logic to check anonymous
lnsun Mar 9, 2021
8951f83
enum heck
lnsun Mar 9, 2021
a33647d
enforce check without refinement
lnsun Mar 23, 2021
2df57a3
workaround for implicit lib type param
lnsun Mar 23, 2021
ab295d5
disable alias
lnsun Mar 23, 2021
2758917
workaround: vpa decl w/o anno
lnsun Mar 23, 2021
b4fb4b3
consistency infer and tc
lnsun Mar 23, 2021
beae801
ext and imp clause logic
lnsun Mar 23, 2021
c0167a1
override base ext/imp clause check
lnsun Mar 23, 2021
d73db45
override base check on ext/imp clauses
lnsun Mar 23, 2021
ba2f6a0
anonymous class logic
lnsun Mar 23, 2021
b39968e
receiver cannot infer to poly
lnsun Mar 25, 2021
631d7fe
allow explicit poly on receiver
lnsun Mar 25, 2021
a634bfb
class bound for infer
lnsun Mar 25, 2021
afd4505
allow factory to get class decl slot
lnsun Mar 25, 2021
e834b11
annotator: handle decl bound
lnsun Mar 25, 2021
f1d8652
annotator: skip null
lnsun Mar 25, 2021
c5f3b1d
annotator: replace real anno
lnsun Mar 25, 2021
0462aff
annotator: not infer to poly
lnsun Mar 25, 2021
4158e72
annotator: drop super decl constraints
lnsun Mar 25, 2021
e0e742f
visitor: skip uses w/o slot
lnsun Mar 25, 2021
b5e214d
rdm-field: field uses be both rdm or mutable
lnsun Mar 25, 2021
c201bd5
comments
lnsun Mar 25, 2021
c060dc1
notes
lnsun Mar 25, 2021
c1c8703
tweaks
lnsun Mar 25, 2021
de054ce
stubs
lnsun Mar 25, 2021
78aef48
reim test cases
lnsun Mar 25, 2021
bb9678c
glacier test cases
lnsun Mar 25, 2021
64122f6
temp ignore all systems test
lnsun Mar 25, 2021
c96f3fa
stub path problem
lnsun Mar 25, 2021
34e9a74
+useOptimisticUncheckedDefaults
lnsun Apr 9, 2021
2cd3276
import issue
lnsun Apr 20, 2021
472e75c
import issue
lnsun Apr 20, 2021
6e4e3c6
update pico, fix CF api rename, update gradle version
Feb 9, 2022
e4ced88
commits for fixing PICO-TypeCheck and part of PICO-Infer
AndrewShf Jul 13, 2022
4d3e9b1
merge opprop master with all_commits
AndrewShf Jul 13, 2022
3b09267
merge with opprop master
AndrewShf Jul 14, 2022
c6dcc1b
resolve new array problems
AndrewShf Jul 17, 2022
8044c38
Merge remote-tracking branch 'opprop/master' into all_commits
AndrewShf Sep 8, 2022
fa7f0eb
override isSafeDowncast in PICO
AndrewShf Sep 21, 2022
d73d3c3
fix java.util.MissingFormatArgumentException in commonAssignmentCheck
AndrewShf Sep 21, 2022
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
19 changes: 11 additions & 8 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -46,23 +46,24 @@ repositories {
}

dependencies {
compile fileTree(dir: "${cfPath}/checker/dist", include: "checker.jar")
compile fileTree(dir: "${cfiPath}/dist", include: "checker-framework-inference.jar")
implementation fileTree(dir: "${cfPath}/checker/dist", include: "checker.jar")
implementation fileTree(dir: "${cfiPath}/dist", include: "checker-framework-inference.jar")
// sat4j solver dependency
compile 'org.ow2.sat4j:org.ow2.sat4j.core:2.3.6'
compile 'org.ow2.sat4j:org.ow2.sat4j.maxsat:2.3.6'
implementation 'org.ow2.sat4j:org.ow2.sat4j.core:2.3.5'
implementation 'org.ow2.sat4j:org.ow2.sat4j.maxsat:2.3.5'
// The production code uses the SLF4J logging API at compile time
compile 'org.slf4j:slf4j-api:1.7.30'

implementation 'org.slf4j:slf4j-api:1.7.29'
// CF test lib dependency
testCompile fileTree(dir: "${cfPath}/framework-test/build/libs", include: "framework-test-*.jar")
testCompile 'junit:junit:4.13.2'
testImplementation fileTree(dir: "${cfPath}/framework-test/build/libs", include: "framework-test-*.jar")
testImplementation 'junit:junit:4.12'
}

sourceSets {
main {
java {
srcDirs = ["src/main/java"]
exclude "pico/inference/**"

}

resources {
Expand All @@ -75,6 +76,8 @@ sourceSets {
java {
// TODO: we shouldn't need source level dependency on CFITest
srcDirs = ["src/test/java", "${cfiPath}/tests/checkers/inference/test"]
exclude "pico/ImmutabilityInferenceInitialTypecheckTest.java","pico/ImmutabilityReImInferenceTest.java",
"pico/ImmutabilityInferenceTest.java"
}
}
}
Expand Down
7 changes: 4 additions & 3 deletions check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ export JAVAC=$CF/checker/bin/javac
export PICO=$(cd $(dirname "$0") && pwd)

# Dependencies
export CLASSPATH=$PICO/build/classes/java/main:$CFI/dist/checker-framework-inference.jar
export CLASSPATH=$PICO/build/classes/java/main:$PICO/build/resources/main:\
$PICO/build/libs/immutability.jar:$CFI/dist/checker-framework-inference.jar

# Command
DEBUG=""
Expand All @@ -35,9 +36,9 @@ done
cmd=""

if [ "$DEBUG" == "" ]; then
cmd="$JAVAC -cp "${CLASSPATH}" -processor "${CHECKER}" "${ARGS[@]}""
cmd="$JAVAC -cp "${CLASSPATH}" -processor "${CHECKER}" "${ARGS[@]}""
else
cmd="$JAVAC "$DEBUG" -cp "${CLASSPATH}" -processor "${CHECKER}" -AatfDoNotCache "${ARGS[@]}""
cmd="$JAVAC "$DEBUG" -cp "${CLASSPATH}" -processor "${CHECKER}" -AatfDoNotCache "${ARGS[@]}""
fi

eval "$cmd"
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.5-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
3 changes: 3 additions & 0 deletions infer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ CHECKER=pico.inference.PICOInferenceChecker

SOLVER=pico.inference.solver.PICOSolverEngine

STUBS="src/main/java/pico/inference/jdk.astub"

declare -a ARGS
for i in "$@" ; do
if [[ $i == "-ds" ]] ; then
Expand All @@ -38,4 +40,5 @@ IS_HACK=true
# Start the inference
$CFI/scripts/inference-dev -m ROUNDTRIP --checker "$CHECKER" --solver "$SOLVER" \
--solverArgs="useGraph=false,collectStatistic=true" --hacks="$IS_HACK" \
--cfArgs="-Astubs=$STUBS" \
-afud ./annotated "${ARGS[@]}"
5 changes: 3 additions & 2 deletions run-dljc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export AFU="$JSR308"/annotation-tools/annotation-file-utilities
export PATH="$PATH":"$AFU"/scripts
export CFI="$JSR308"/checker-framework-inference

export CLASSPATH="$JSR308"/immutability/build/classes/main:$CHECKERFRAMEWORK/dataflow/build:$CHECKERFRAMEWORK/javacutil/build:$CHECKERFRAMEWORK/stubparser/build:$CHECKERFRAMEWORK/framework/build:$CHECKERFRAMEWORK/checker/build:$SOLVER/bin:$CHECKERFRAMEWORK/framework/tests/junit-4.12.jar:$CHECKERFRAMEWORK/framework/tests/hamcrest-core-1.3.jar:$CFI/dist/checker-framework-inference.jar:$CFI/dist/org.ow2.sat4j.core-2.3.4.jar:$CFI/dist/commons-logging-1.2.jar:$CFI/dist/log4j-1.2.16.jar:$JSR308/jsr308-langtools/build/classes:$CLASSPATH
export CLASSPATH="$JSR308"/immutability/build/classes/java/main:$CHECKERFRAMEWORK/dataflow/build:$CHECKERFRAMEWORK/javacutil/build:$CHECKERFRAMEWORK/stubparser/build:$CHECKERFRAMEWORK/framework/build:$CHECKERFRAMEWORK/checker/build:$SOLVER/bin:$CHECKERFRAMEWORK/framework/tests/junit-4.12.jar:$CHECKERFRAMEWORK/framework/tests/hamcrest-core-1.3.jar:$CFI/dist/checker-framework-inference.jar:$CFI/dist/org.ow2.sat4j.core-2.3.4.jar:$CFI/dist/commons-logging-1.2.jar:$CFI/dist/log4j-1.2.16.jar:$JSR308/jsr308-langtools/build/classes:$CLASSPATH

#parsing build command of the target program
build_cmd="$2"
Expand All @@ -30,8 +30,9 @@ elif [[ "$1" = "-i" ]] ; then
rm -rf logs annotated
echo "Cleaning Done."
CHECKER="pico.inference.PICOInferenceChecker"
# SOLVER="checkers.inference.solver.DebugSolver"
SOLVER="pico.inference.solver.PICOSolverEngine"
running_cmd="python $DLJC/dljc -t inference --checker "${CHECKER}" --cfArgs=\"-AoptimalSolution\" --solver "${SOLVER}" --solverArgs=\"collectStatistic=true,useGraph=false\" --mode ROUNDTRIP -afud $WORKING_DIR/annotated -o logs -- $build_cmd "
running_cmd="python $DLJC/dljc -t inference --checker "${CHECKER}" --cfArgs=\"-AoptimalSolution -Astubs=/home/l82sun/workspace/opprop/immutability/src/main/java/pico/inference/jdk.astub\" --solver "${SOLVER}" --solverArgs=\"collectStatistic=true,useGraph=false\" --guess --stubs="/home/l82sun/workspace/opprop/immutability/src/main/java/pico/inference/jdk.astub" --mode ROUNDTRIP -afud $WORKING_DIR/annotated -o logs -- $build_cmd "
else
echo "Unknown tool: should be either -t|-i but found: ${1}"
exit 1
Expand Down
11 changes: 11 additions & 0 deletions src/main/java/pico/common/ExtendedViewpointAdapter.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package pico.common;

import org.checkerframework.framework.type.AnnotatedTypeMirror;
import org.checkerframework.framework.type.ViewpointAdapter;

import javax.lang.model.element.AnnotationMirror;

public interface ExtendedViewpointAdapter extends ViewpointAdapter {
AnnotatedTypeMirror rawCombineAnnotationWithType(AnnotationMirror anno, AnnotatedTypeMirror type);
AnnotationMirror rawCombineAnnotationWithAnnotation(AnnotationMirror anno, AnnotationMirror type);
}
Loading