Skip to content

Commit e3066f8

Browse files
authored
typetools/checker-framework 3.40.0 release (#626)
2 parents 4d6329e + 0b3ca99 commit e3066f8

File tree

145 files changed

+4768
-817
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

145 files changed

+4768
-817
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ framework/tests/returnsreceiverdelomboked/
156156

157157
dataflow/tests/busyexpr/Out.txt
158158
dataflow/tests/busyexpr/*.class
159+
dataflow/tests/cfgconstruction/*.class
159160
dataflow/tests/constant-propagation/Out.txt
160161
dataflow/tests/constant-propagation/*.class
161162
dataflow/tests/issue3447/Out.txt

.travis-build.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ SCRIPTDIR=$ROOTDIR/checker/bin-devel/
3737

3838
# For debugging
3939
(cd "$CHECKERFRAMEWORK" && ./gradlew getPlumeScripts)
40-
"${SCRIPTDIR}/plume-scripts/ci-info" typetools
41-
eval $("${SCRIPTDIR}/plume-scripts/ci-info" typetools)
40+
"${SCRIPTDIR}/plume-scripts/ci-info" eisop
41+
eval $("${SCRIPTDIR}/plume-scripts/ci-info" eisop)
4242

43-
source "$SCRIPTDIR/build.sh"
43+
source "$SCRIPTDIR/clone-related.sh"
4444

4545
###
4646
### Run the test

build.gradle

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ allprojects {
159159
// * any new checkers have been added, or
160160
// * backward-incompatible changes have been made to APIs or elsewhere.
161161
// To make a snapshot release: ./gradlew publish
162-
version '3.39.0-eisop2-SNAPSHOT'
162+
version '3.40.0'
163163

164164
tasks.withType(JavaCompile).configureEach {
165165
options.fork = true
@@ -326,6 +326,11 @@ allprojects {
326326
}
327327
}
328328

329+
test {
330+
minHeapSize = "256m" // initial heap size
331+
maxHeapSize = "4g" // maximum heap size
332+
}
333+
329334
// After all the tasks have been created, modify some of them.
330335
afterEvaluate {
331336
configurations {
@@ -533,11 +538,6 @@ allprojects {
533538
} // end afterEvaluate
534539
} // end allProjects
535540

536-
task cloneAndBuildDependencies(type: Exec, group: 'Build') {
537-
description 'Clones (or updates) and builds all dependencies'
538-
executable 'checker/bin-devel/build.sh'
539-
}
540-
541541
task version(group: 'Documentation') {
542542
description 'Print Checker Framework version'
543543
doLast {
@@ -971,6 +971,9 @@ subprojects {
971971
createCheckTypeTask(project.name, 'Signature',
972972
'org.checkerframework.checker.signature.SignatureChecker')
973973

974+
// The checkNullness task runs on all code, but it only *checks* the following code:
975+
// * All files outside the 'framework' and 'checker' subprojects.
976+
// * In the 'framework' and 'checker' subprojects, files with `@AnnotatedFor("nullness")`.
974977
if (project.name.is('framework') || project.name.is('checker')) {
975978
createCheckTypeTask(project.name, 'Nullness',
976979
'org.checkerframework.checker.nullness.NullnessChecker',

checker-qual/src/main/java/org/checkerframework/checker/calledmethods/qual/EnsuresCalledMethods.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
@PostconditionAnnotation(qualifier = CalledMethods.class)
4646
@Target({ElementType.METHOD, ElementType.CONSTRUCTOR})
4747
@Repeatable(EnsuresCalledMethods.List.class)
48+
@InheritedAnnotation
4849
public @interface EnsuresCalledMethods {
4950
/**
5051
* The Java expressions that will have methods called on them.
@@ -73,6 +74,7 @@
7374
@Retention(RetentionPolicy.RUNTIME)
7475
@Target({ElementType.METHOD, ElementType.CONSTRUCTOR})
7576
@InheritedAnnotation
77+
@PostconditionAnnotation(qualifier = CalledMethods.class)
7678
public static @interface List {
7779
/**
7880
* Return the repeatable annotations.

checker-qual/src/main/java/org/checkerframework/checker/calledmethods/qual/EnsuresCalledMethodsIf.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,13 @@
2626
@InheritedAnnotation
2727
@Repeatable(EnsuresCalledMethodsIf.List.class)
2828
public @interface EnsuresCalledMethodsIf {
29+
/**
30+
* Returns the return value of the method under which the postcondition holds.
31+
*
32+
* @return the return value of the method under which the postcondition holds
33+
*/
34+
boolean result();
35+
2936
/**
3037
* Returns Java expressions that have had the given methods called on them after the method
3138
* returns {@link #result}.
@@ -35,13 +42,6 @@
3542
*/
3643
String[] expression();
3744

38-
/**
39-
* Returns the return value of the method under which the postcondition holds.
40-
*
41-
* @return the return value of the method under which the postcondition holds
42-
*/
43-
boolean result();
44-
4545
/**
4646
* The methods guaranteed to be invoked on the expressions if the result of the method is {@link
4747
* #result}.

checker-qual/src/main/java/org/checkerframework/checker/calledmethods/qual/RequiresCalledMethods.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
import java.lang.annotation.Documented;
77
import java.lang.annotation.ElementType;
8+
import java.lang.annotation.Repeatable;
89
import java.lang.annotation.Retention;
910
import java.lang.annotation.RetentionPolicy;
1011
import java.lang.annotation.Target;
@@ -23,6 +24,7 @@
2324
@Retention(RetentionPolicy.RUNTIME)
2425
@PreconditionAnnotation(qualifier = CalledMethods.class)
2526
@Target({ElementType.METHOD, ElementType.CONSTRUCTOR})
27+
@Repeatable(RequiresCalledMethods.List.class)
2628
public @interface RequiresCalledMethods {
2729
/**
2830
* The Java expressions that must have had methods called on them.
@@ -49,6 +51,7 @@
4951
*/
5052
@Documented
5153
@Retention(RetentionPolicy.RUNTIME)
54+
@PreconditionAnnotation(qualifier = CalledMethods.class)
5255
@Target({ElementType.METHOD, ElementType.CONSTRUCTOR})
5356
public static @interface List {
5457
/**

checker-qual/src/main/java/org/checkerframework/checker/index/qual/EnsuresLTLengthOfIf.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,17 +59,23 @@
5959
@InheritedAnnotation
6060
@Repeatable(EnsuresLTLengthOfIf.List.class)
6161
public @interface EnsuresLTLengthOfIf {
62+
/**
63+
* The return value of the method that needs to hold for the postcondition to hold.
64+
*
65+
* @return the return value of the method that needs to hold for the postcondition to hold
66+
*/
67+
boolean result();
68+
6269
/**
6370
* Java expression(s) that are less than the length of the given sequences after the method
6471
* returns the given result.
6572
*
73+
* @return Java expression(s) that are less than the length of the given sequences after the
74+
* method returns the given result
6675
* @checker_framework.manual #java-expressions-as-arguments Syntax of Java expressions
6776
*/
6877
String[] expression();
6978

70-
/** The return value of the method that needs to hold for the postcondition to hold. */
71-
boolean result();
72-
7379
/**
7480
* Sequences, each of which is longer than each of the expressions' value after the method
7581
* returns the given result.

checker-qual/src/main/java/org/checkerframework/checker/lock/qual/EnsuresLockHeldIf.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,13 @@
2525
@InheritedAnnotation
2626
@Repeatable(EnsuresLockHeldIf.List.class)
2727
public @interface EnsuresLockHeldIf {
28+
/**
29+
* Returns the return value of the method under which the postconditions hold.
30+
*
31+
* @return the return value of the method under which the postconditions hold
32+
*/
33+
boolean result();
34+
2835
/**
2936
* Returns Java expressions whose values are locks that are held after the method returns the
3037
* given result.
@@ -39,13 +46,6 @@
3946
// assumes that conditional postconditions have a field named "expression".
4047
String[] expression();
4148

42-
/**
43-
* Returns the return value of the method under which the postconditions hold.
44-
*
45-
* @return the return value of the method under which the postconditions hold
46-
*/
47-
boolean result();
48-
4949
/**
5050
* A wrapper annotation that makes the {@link EnsuresLockHeldIf} annotation repeatable.
5151
*

checker-qual/src/main/java/org/checkerframework/checker/mustcall/qual/MustCallAlias.java

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111
* always be used in pairs. On a method, it is written on some formal parameter type and on the
1212
* method return type. On a constructor, it is written on some formal parameter type and on the
1313
* result type. Fulfilling the must-call obligation of one is equivalent to fulfilling the must-call
14-
* obligation of the other.
14+
* obligation of the other. Beyond its impact as a polymorphic annotation on {@code MustCall} types,
15+
* the Resource Leak Checker uses {@link MustCallAlias} annotations to more precisely determine when
16+
* a must-call obligation has been satisfied.
1517
*
1618
* <p>This annotation is useful for wrapper objects. For example, consider the declaration of {@code
1719
* java.net.Socket#getOutputStream}:
@@ -25,6 +27,25 @@
2527
* Calling {@code close()} on the returned {@code OutputStream} will close the underlying socket,
2628
* but the Socket may also be closed directly, which has the same effect.
2729
*
30+
* <h2>Type system semantics</h2>
31+
*
32+
* Within the Must Call Checker's type system, {@code @MustCallAlias} annotations have a semantics
33+
* different from a standard polymorphic annotation, in that the relevant actual parameter type and
34+
* return type at a call site are not equated in all cases. Given an actual parameter {@code p}
35+
* passed in a {@code @MustCallAlias} position at a call site, the return type of the call is
36+
* defined as follows:
37+
*
38+
* <ul>
39+
* <li>If the base return type has a non-empty {@code @InheritableMustCall("m")} annotation on its
40+
* declaration, and {@code p} has a non-empty {@code @MustCall} type, then the return type is
41+
* {@code @MustCall("m")}.
42+
* <li>In all other cases, the return type has the same {@code @MustCall} type as {@code p}.
43+
* </ul>
44+
*
45+
* {@link PolyMustCall} has an identical type system semantics. This special treatment is required
46+
* to allow for a wrapper object to have a must-call method with a different name than the must-call
47+
* method name for the wrapped object.
48+
*
2849
* <h2>Verifying {@code @MustCallAlias} annotations</h2>
2950
*
3051
* Suppose that {@code @MustCallAlias} is written on the type of formal parameter {@code p}.
@@ -47,7 +68,10 @@
4768
* </ul>
4869
*
4970
* When the -AnoResourceAliases command-line argument is passed to the checker, this annotation is
50-
* treated identically to {@link PolyMustCall}.
71+
* treated identically to {@link PolyMustCall}. That is, the annotation still impacts {@link
72+
* MustCall} types as a polymorphic annotation (see "Type system semantics" above), but it is not
73+
* used by the Resource Leak Checker to more precisely reason about when obligations have been
74+
* satisfied.
5175
*
5276
* @checker_framework.manual #resource-leak-checker Resource Leak Checker
5377
* @checker_framework.manual #qualifier-polymorphism Qualifier polymorphism

checker-qual/src/main/java/org/checkerframework/checker/mustcall/qual/PolyMustCall.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@
99
import java.lang.annotation.Target;
1010

1111
/**
12-
* The polymorphic qualifier for the Must Call type system.
12+
* The polymorphic qualifier for the Must Call type system. The semantics of this qualifier differ
13+
* from that of a standard polymorphic qualifier; see {@link MustCallAlias} for documentation of its
14+
* semantics.
1315
*
1416
* @checker_framework.manual #must-call-checker Must Call Checker
1517
* @checker_framework.manual #qualifier-polymorphism Qualifier polymorphism

0 commit comments

Comments
 (0)