Skip to content

Commit cbf4281

Browse files
Ao-senXiongwmdietl
andauthored
Use new PolyInitialized qualifier (typetools#39)
Co-authored-by: Werner Dietl <[email protected]>
1 parent b6b6321 commit cbf4281

File tree

2 files changed

+29
-2
lines changed

2 files changed

+29
-2
lines changed

src/java.base/share/classes/java/lang/Throwable.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
package java.lang;
2727

28-
import org.checkerframework.checker.initialization.qual.UnknownInitialization;
28+
import org.checkerframework.checker.initialization.qual.PolyInitialized;
2929
import org.checkerframework.checker.interning.qual.UsesObjectEquals;
3030
import org.checkerframework.checker.lock.qual.GuardSatisfied;
3131
import org.checkerframework.checker.nullness.qual.Nullable;
@@ -474,7 +474,7 @@ protected Throwable(@Nullable String message, @Nullable Throwable cause,
474474
* been called on this throwable.
475475
* @since 1.4
476476
*/
477-
public synchronized @UnknownInitialization Throwable initCause(@UnknownInitialization Throwable this, @Nullable Throwable cause) {
477+
public synchronized @PolyInitialized Throwable initCause(@PolyInitialized Throwable this, @Nullable Throwable cause) {
478478
if (this.cause != this)
479479
throw new IllegalStateException("Can't overwrite cause with " +
480480
Objects.toString(cause, "a null"), this);
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package org.checkerframework.checker.initialization.qual;
2+
3+
import org.checkerframework.framework.qual.PolymorphicQualifier;
4+
5+
import java.lang.annotation.Documented;
6+
import java.lang.annotation.ElementType;
7+
import java.lang.annotation.Retention;
8+
import java.lang.annotation.RetentionPolicy;
9+
import java.lang.annotation.Target;
10+
11+
/**
12+
* A polymorphic qualifier for the freedom-before-commitment initialization tracking type-system.
13+
*
14+
* <p>Any method written using {@link PolyInitialized} conceptually has multiple versions: one in
15+
* which all instances of {@link PolyInitialized} in the method signature have been replaced by one
16+
* of the following qualifiers: {@link Initialized}; {@link UnknownInitialization} and {@link
17+
* UnderInitialization}, which take a class argument to represent different type frames; and {@link
18+
* FBCBottom}.
19+
*
20+
* @checker_framework.manual #initialization-checker Initialization Checker
21+
* @checker_framework.manual #qualifier-polymorphism Qualifier polymorphism
22+
*/
23+
@Documented
24+
@Retention(RetentionPolicy.RUNTIME)
25+
@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
26+
@PolymorphicQualifier(UnknownInitialization.class)
27+
public @interface PolyInitialized {}

0 commit comments

Comments
 (0)