org.checkerframework.checker.mustcall.qual.MustCall Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of checker-qual Show documentation
Show all versions of checker-qual Show documentation
checker-qual contains annotations (type qualifiers) that a programmer
writes to specify Java code for type-checking by the Checker Framework.
The newest version!
package org.checkerframework.checker.mustcall.qual;
import org.checkerframework.framework.qual.DefaultFor;
import org.checkerframework.framework.qual.DefaultQualifierInHierarchy;
import org.checkerframework.framework.qual.SubtypeOf;
import org.checkerframework.framework.qual.TypeUseLocation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* An expression of type {@code @MustCall({"m1", "m2"})} may be obligated to call {@code m1()}
* and/or {@code m2()} before it is deallocated, but it is not obligated to call any other methods.
*
* This annotation is enforced by the Object Construction Checker's {@code -AcheckMustCall} mode.
* It enforces that the methods {@code m1()} and {@code m2()} are called on the annotated expression
* before it is deallocated.
*
*
The subtyping relationship is:
*
*
{@code @MustCall({"m1"}) <: @MustCall({"m1", "m2"})}
*
* @checker_framework.manual #must-call-checker Must Call Checker
*/
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
@SubtypeOf({MustCallUnknown.class})
@DefaultQualifierInHierarchy
@DefaultFor({TypeUseLocation.EXCEPTION_PARAMETER, TypeUseLocation.UPPER_BOUND})
public @interface MustCall {
/**
* Methods that might need to be called on the expression whose type is annotated.
*
* @return methods that might need to be called
*/
public String[] value() default {};
}