public abstract class NullableNotNullManager
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected static Logger |
LOG |
protected Project |
myProject |
Modifier | Constructor and Description |
---|---|
protected |
NullableNotNullManager(Project project) |
Modifier and Type | Method and Description |
---|---|
PsiAnnotation |
copyNotNullAnnotation(PsiModifierListOwner owner)
|
PsiAnnotation |
copyNotNullAnnotation(PsiModifierListOwner original,
PsiModifierListOwner generated) |
PsiAnnotation |
copyNullableAnnotation(PsiModifierListOwner original,
PsiModifierListOwner generated) |
PsiAnnotation |
copyNullableOrNotNullAnnotation(PsiModifierListOwner original,
PsiModifierListOwner generated) |
NullabilityAnnotationInfo |
findEffectiveNullabilityInfo(PsiModifierListOwner owner)
Returns nullability annotation info which has effect for given element.
|
NullabilityAnnotationInfo |
findExplicitNullability(PsiModifierListOwner owner)
Returns information about explicit nullability annotation (without looking into external/inferred annotations,
but looking into container annotations).
|
PsiAnnotation |
findExplicitNullabilityAnnotation(PsiModifierListOwner owner,
Nullability nullability) |
NullabilityAnnotationInfo |
findOwnNullabilityInfo(PsiModifierListOwner owner)
Returns own nullability annotation info for given element.
|
protected java.util.Set<java.lang.String> |
getAllNullabilityAnnotationsWithNickNames() |
abstract java.lang.String |
getDefaultNotNull() |
abstract java.lang.String |
getDefaultNullable() |
static NullableNotNullManager |
getInstance(Project project) |
abstract java.util.List<java.lang.String> |
getInstrumentedNotNulls() |
PsiAnnotation |
getNotNullAnnotation(PsiModifierListOwner owner,
boolean checkBases)
Returns an annotation which marks given element as NotNull, if any.
|
abstract java.util.List<java.lang.String> |
getNotNulls() |
protected java.util.List<java.lang.String> |
getNotNullsWithNickNames() |
static Nullability |
getNullability(PsiModifierListOwner owner)
Returns nullability of given element defined by annotations.
|
PsiAnnotation |
getNullableAnnotation(PsiModifierListOwner owner,
boolean checkBases)
Returns an annotation which marks given element as Nullable, if any.
|
abstract java.util.List<java.lang.String> |
getNullables() |
protected java.util.List<java.lang.String> |
getNullablesWithNickNames() |
protected boolean |
hasHardcodedContracts(PsiElement element) |
boolean |
hasNullability(PsiModifierListOwner owner) |
static boolean |
isNotNull(PsiModifierListOwner owner)
Returns true if given element is known to be non-nullable
|
boolean |
isNotNull(PsiModifierListOwner owner,
boolean checkBases) |
static boolean |
isNullabilityAnnotation(PsiAnnotation annotation)
Checks if given annotation specifies the nullability (either nullable or not-null)
|
static boolean |
isNullable(PsiModifierListOwner owner)
Returns true if given element is known to be nullable
|
boolean |
isNullable(PsiModifierListOwner owner,
boolean checkBases) |
abstract void |
setDefaultNotNull(java.lang.String defaultNotNull) |
abstract void |
setDefaultNullable(java.lang.String defaultNullable) |
abstract void |
setInstrumentedNotNulls(java.util.List<java.lang.String> names) |
abstract void |
setNotNulls(java.lang.String... annotations) |
abstract void |
setNullables(java.lang.String... annotations) |
protected NullableNotNullManager(Project project)
public static NullableNotNullManager getInstance(Project project)
public boolean hasNullability(PsiModifierListOwner owner)
public abstract void setNotNulls(java.lang.String... annotations)
public abstract void setNullables(java.lang.String... annotations)
public abstract java.lang.String getDefaultNullable()
public PsiAnnotation getNullableAnnotation(PsiModifierListOwner owner, boolean checkBases)
findEffectiveNullabilityInfo(PsiModifierListOwner)
instead.public abstract void setDefaultNullable(java.lang.String defaultNullable)
public abstract java.lang.String getDefaultNotNull()
public PsiAnnotation getNotNullAnnotation(PsiModifierListOwner owner, boolean checkBases)
findEffectiveNullabilityInfo(PsiModifierListOwner)
instead.public PsiAnnotation copyNotNullAnnotation(PsiModifierListOwner original, PsiModifierListOwner generated)
public PsiAnnotation copyNullableAnnotation(PsiModifierListOwner original, PsiModifierListOwner generated)
public PsiAnnotation copyNullableOrNotNullAnnotation(PsiModifierListOwner original, PsiModifierListOwner generated)
@Deprecated public PsiAnnotation copyNotNullAnnotation(PsiModifierListOwner owner)
public abstract void setDefaultNotNull(java.lang.String defaultNotNull)
public NullabilityAnnotationInfo findOwnNullabilityInfo(PsiModifierListOwner owner)
owner
- element to find a nullability info forpublic NullabilityAnnotationInfo findExplicitNullability(PsiModifierListOwner owner)
owner
- element to get the info aboutpublic NullabilityAnnotationInfo findEffectiveNullabilityInfo(PsiModifierListOwner owner)
owner
- element to find an annotation forpublic PsiAnnotation findExplicitNullabilityAnnotation(PsiModifierListOwner owner, Nullability nullability)
protected java.util.List<java.lang.String> getNullablesWithNickNames()
protected java.util.List<java.lang.String> getNotNullsWithNickNames()
protected java.util.Set<java.lang.String> getAllNullabilityAnnotationsWithNickNames()
protected boolean hasHardcodedContracts(PsiElement element)
public boolean isNullable(PsiModifierListOwner owner, boolean checkBases)
public boolean isNotNull(PsiModifierListOwner owner, boolean checkBases)
public abstract java.util.List<java.lang.String> getNullables()
public abstract java.util.List<java.lang.String> getNotNulls()
public static boolean isNullable(PsiModifierListOwner owner)
owner
- element to checkpublic static boolean isNotNull(PsiModifierListOwner owner)
owner
- element to checkpublic static Nullability getNullability(PsiModifierListOwner owner)
owner
- element to find nullability forNullability.UNKNOWN
if not specified or non-applicablepublic abstract java.util.List<java.lang.String> getInstrumentedNotNulls()
public abstract void setInstrumentedNotNulls(java.util.List<java.lang.String> names)
public static boolean isNullabilityAnnotation(PsiAnnotation annotation)
annotation
- annotation to check