static class
TypeOps.Convertibility
A result for a convertibility check.
static Predicate<JMethodSymbol>
accessibleMethodFilter(String name, @NonNull JClassSymbol symbol)
static boolean
allArgsAreUnboundedWildcards(List<JTypeMirror> sargs)
static boolean
areOverrideEquivalent(JMethodSig m1, JMethodSig m2)
Two method signatures m1 and m2 are override-equivalent iff either m1 is a subsignature of m2 or m2 is a subsignature of m1.
static boolean
areRelated(@NonNull JTypeMirror t, JTypeMirror s)
Returns true if both types have a common supertype that is not Object.
static boolean
areSameTypes(List<JTypeMirror> ts, List<JTypeMirror> ss)
static boolean
areSameTypesInInference(List<JTypeMirror> ts, List<JTypeMirror> ss)
static @Nullable JClassType
asClassType(@Nullable JTypeMirror t)
Returns t if it is a class or interface type.
static List<JTypeMirror>
asList(JTypeMirror t)
Returns the components of t if it is an intersection type, otherwise returns t.
static @Nullable JClassType
asOuterSuper(JTypeMirror t, JClassSymbol sym)
Return the base type of t or any of its outer types that starts with the given type.
static @Nullable JTypeMirror
asSuper(@NonNull JTypeMirror t, @NonNull JClassSymbol s)
static List<JTypeMirror>
erase(Collection<? extends JTypeMirror> ts)
Returns a list with the erasures of the given types, may be unmodifiable.
static List<JMethodSig>
filterAccessible(List<JMethodSig> visible, @NonNull JClassSymbol accessSite)
static @Nullable JMethodSig
findFunctionalInterfaceMethod(@Nullable JTypeMirror type)
Finds the method of the given type that can be overridden as a lambda expression.
static @Nullable JTypeMirror
getArrayComponent(@Nullable JTypeMirror t)
static NameResolver<JVariableSig.FieldSig>
getMemberFieldResolver(JTypeMirror c, @NonNull String accessPackageName, @Nullable JClassSymbol access, String name)
static JTypeMirror
getMemberSource(JTypeMirror t)
Methods and fields of a type variable come from its upper bound, which must be captured.
static List<JMethodSig>
getMethodsOf(JTypeMirror type, String name, boolean staticOnly, @NonNull JClassSymbol enclosing)
static @Nullable JClassType
getReceiverType(@NonNull JClassType containerType, JClassSymbol sym)
Return the first enclosing type of the container type that has the given symbol in its supertypes.
static Set<JTypeMirror>
getSuperTypeSet(@NonNull JTypeMirror t)
Returns the set of all supertypes of the given type.
static boolean
hasUnresolvedSymbol(@Nullable JTypeMirror t)
Return true if the argument is a
JClassType
with
an unresolved symbol.
static boolean
hasUnresolvedSymbolOrArray(@Nullable JTypeMirror t)
Return true if the argument is a
JClassType
with
an unresolved symbol, or an array whose element type has an unresolved symbol.
static boolean
haveSameTypeParams(JMethodSig m1, JMethodSig m2)
static boolean
isContextDependent(JExecutableSymbol symbol)
Return true if the method is context dependent.
static boolean
isContextDependent(JMethodSig sig)
Deprecated. static TypeOps.Convertibility
isConvertible(@NonNull JTypeMirror t, @NonNull JTypeMirror s)
static TypeOps.Convertibility
isConvertible(@NonNull JTypeMirror t, @NonNull JTypeMirror s, boolean capture)
Deprecated.
static TypeOps.Convertibility
isConvertibleNoCapture(@NonNull JTypeMirror t, @NonNull JTypeMirror s)
static TypeOps.Convertibility
isConvertiblePure(JTypeMirror t, JTypeMirror s)
static boolean
isOverridableIn(JExecutableSymbol m, JTypeDeclSymbol origin)
Returns true if the given method can be overridden in the origin class.
static boolean
isReturnTypeSubstitutable(JMethodSig m1, JMethodSig m2)
Returns true if m1 is return-type substitutable with m2.
static boolean
isSameType(JMethodSig t, JMethodSig s)
Return true if t and s are the same method type.
static boolean
isSameType(JTypeMirror t, JTypeMirror s)
Return true if t and s are the same type, ignoring any type annotations appearing within them.
static boolean
isSameTypeWithSameAnnotations(JTypeMirror t, JTypeMirror s)
Return true if t and s are the same type, considering any type annotations appearing within them.
static boolean
isSpecialUnresolved(@NonNull JTypeMirror t)
Returns true if the type is
TypeSystem.UNKNOWN
, or
TypeSystem.ERROR
.
static boolean
isSpecialUnresolvedOrArray(@Nullable JTypeMirror t)
Returns true if the type is
TypeSystem.UNKNOWN
, or
TypeSystem.ERROR
, or an array of such types.
static boolean
isStrictSubtype(@NonNull JTypeMirror t, @NonNull JTypeMirror s)
static boolean
isSubSignature(JMethodSig m1, JMethodSig m2)
The signature of a method m1 is a subsignature of the signature of a method m2 if either: - m2 has the same signature as m1, or - the signature of m1 is the same as the erasure (§4.6) of the signature of m2.
static boolean
isUnresolved(@NonNull JTypeMirror t)
Returns true if the type is
TypeSystem.UNKNOWN
,
TypeSystem.ERROR
, or a class type with unresolved symbol.
static boolean
isUnresolvedOrArray(@NonNull JTypeMirror t)
Returns true if the type is
TypeSystem.UNKNOWN
, or
TypeSystem.ERROR
, or a class type with unresolved symbol, or an array of such types.
static boolean
isUnresolvedOrNull(@Nullable JTypeMirror t)
static Iterable<JMethodSig>
lazyFilterAccessible(List<JMethodSig> visible, @NonNull JClassSymbol accessSite)
static boolean
mentions(@NonNull JTypeVisitable type, @NonNull net.sourceforge.pmd.lang.java.types.internal.infer.InferenceVar parent)
static boolean
mentionsAny(JTypeVisitable t, Collection<? extends SubstVar> vars)
static Set<JTypeMirror>
mostSpecific(Collection<? extends JTypeMirror> set)
Returns a subset S of the parameter, whose components have no strict supertype in S.
static @Nullable JClassType
nonWildcardParameterization(@NonNull JClassType type)
Returns the non-wildcard parameterization of the given functional interface type.
static boolean
overrides(JMethodSig m1, JMethodSig m2, JTypeMirror origin)
Returns true if m1 overrides m2, when both are view as members of class origin. m1 and m2 may be declared in supertypes of origin, possibly unrelated (default methods), which is why we need that third parameter.
static JTypeMirror
projectUpwards(JTypeMirror t)
Returns the upwards projection of the given type, with respect to the set of capture variables that are found in it.
static JTypeMirror
subst(@Nullable JTypeMirror type, Function<? super SubstVar,? extends @NonNull JTypeMirror> subst)
Replace the type variables occurring in the given type to their image by the given function.
static List<JTypeMirror>
subst(List<? extends JTypeMirror> ts, Function<? super SubstVar,? extends @NonNull JTypeMirror> subst)
Substitute on a list of types.
static List<JClassType>
substClasses(List<JClassType> ts, Function<? super SubstVar,? extends @NonNull JTypeMirror> subst)
static List<JTypeVar>
substInBoundsOnly(List<JTypeVar> ts, Function<? super SubstVar,? extends @NonNull JTypeMirror> subst)
public static boolean isSameType(JMethodSig t, JMethodSig s)
Return true if t and s are the same method type. This compares their declaring type, and then their signature.
haveSameSignature(JMethodSig, JMethodSig)
public static boolean isSameType(JTypeMirror t, JTypeMirror s)
Return true if t and s are the same type, ignoring any type annotations appearing within them. This is the implementation of the equals method of
JTypeMirror
.
public static boolean isSameTypeWithSameAnnotations(JTypeMirror t, JTypeMirror s)
Return true if t and s are the same type, considering any type annotations appearing within them.
public static boolean areSameTypes(List<JTypeMirror> ts, List<JTypeMirror> ss)
public static boolean areSameTypesInInference(List<JTypeMirror> ts, List<JTypeMirror> ss)
public static Set<JTypeMirror> getSuperTypeSet(@NonNull JTypeMirror t)
Returns the set of all supertypes of the given type.
JTypeMirror.getSuperTypeSet()
public static TypeOps.Convertibility isConvertible(@NonNull JTypeMirror t, @NonNull JTypeMirror s)
@Deprecated public static TypeOps.Convertibility isConvertible(@NonNull JTypeMirror t, @NonNull JTypeMirror s, boolean capture)
Deprecated.
public static TypeOps.Convertibility isConvertibleNoCapture(@NonNull JTypeMirror t, @NonNull JTypeMirror s)
public static TypeOps.Convertibility isConvertiblePure(JTypeMirror t, JTypeMirror s)
public static boolean allArgsAreUnboundedWildcards(List<JTypeMirror> sargs)
public static boolean isStrictSubtype(@NonNull JTypeMirror t, @NonNull JTypeMirror s)
public static JTypeMirror subst(@Nullable JTypeMirror type, Function<? super SubstVar,? extends @NonNull JTypeMirror> subst)
Replace the type variables occurring in the given type to their image by the given function. Substitutions are not applied recursively.
type
- Type to substitute
subst
- Substitution function, eg a Substitution
public static List<JTypeMirror> subst(List<? extends JTypeMirror> ts, Function<? super SubstVar,? extends @NonNull JTypeMirror> subst)
Substitute on a list of types.
public static List<JClassType> substClasses(List<JClassType> ts, Function<? super SubstVar,? extends @NonNull JTypeMirror> subst)
public static List<JTypeVar> substInBoundsOnly(List<JTypeVar> ts, Function<? super SubstVar,? extends @NonNull JTypeMirror> subst)
public static JTypeMirror projectUpwards(JTypeMirror t)
Returns the upwards projection of the given type, with respect to the set of capture variables that are found in it. This is some supertype of T which does not mention those capture variables. This is used for local variable type inference. https://docs.oracle.com/javase/specs/jls/se11/html/jls-4.html#jls-4.10.5
public static boolean isReturnTypeSubstitutable(JMethodSig m1, JMethodSig m2)
Returns true if m1 is return-type substitutable with m2. The notion of return-type-substitutability supports covariant returns, that is, the specialization of the return type to a subtype. https://docs.oracle.com/javase/specs/jls/se9/html/jls-8.html#jls-8.4.5
public static boolean haveSameTypeParams(JMethodSig m1, JMethodSig m2)
public static boolean areOverrideEquivalent(JMethodSig m1, JMethodSig m2)
This is a prerequisite for one method to override the other, but not the only condition. See overrides(JMethodSig, JMethodSig, JTypeMirror)
. See JLS§8
public static boolean isSubSignature(JMethodSig m1, JMethodSig m2)
The signature of a method m1 is a subsignature of the signature of a method m2 if either: - m2 has the same signature as m1, or - the signature of m1 is the same as the erasure (§4.6) of the signature of m2.
public static boolean overrides(JMethodSig m1, JMethodSig m2, JTypeMirror origin)
This method ignores the static modifier. If both methods are static, then this method tests for hiding. Otherwise, this method properly tests for overriding. Note that it is an error for a static method to override an instance method, or the reverse.
public static boolean isOverridableIn(JExecutableSymbol m, JTypeDeclSymbol origin)
Like overrides(JMethodSig, JMethodSig, JTypeMirror)
, this does not check the static modifier, and tests for hiding if the method is static.
m
- Method to test
origin
- Site of the potential override
public static @Nullable JClassType nonWildcardParameterization(@NonNull JClassType type)
This is used to remove wildcards from the type of a functional interface. https://docs.oracle.com/javase/specs/jls/se9/html/jls-9.html#jls-9.9
type
- A parameterized functional interface type
public static @Nullable JMethodSig findFunctionalInterfaceMethod(@Nullable JTypeMirror type)
If the parameter is not mappable to a class type with asClassType(JTypeMirror)
, or if the functional method does not exist, returns null.
public static @Nullable JClassType asClassType(@Nullable JTypeMirror t)
Returns t if it is a class or interface type. If it is an intersection type, returns the induced class or interface type. Returns null otherwise, including if the parameter is null.
public static @Nullable JTypeMirror asSuper(@NonNull JTypeMirror t, @NonNull JClassSymbol s)
JTypeMirror.getAsSuper(JClassSymbol)
public static @Nullable JClassType asOuterSuper(JTypeMirror t, JClassSymbol sym)
Return the base type of t or any of its outer types that starts with the given type. If none exists, return null.
public static @Nullable JClassType getReceiverType(@NonNull JClassType containerType, JClassSymbol sym)
Return the first enclosing type of the container type that has the given symbol in its supertypes. Return null if this is not found.
public static Set<JTypeMirror> mostSpecific(Collection<? extends JTypeMirror> set)
Returns a subset S of the parameter, whose components have no strict supertype in S.
S = { V | V in set, and for all W â V in set, it is not the case that W <: V }
public static List<JTypeMirror> asList(JTypeMirror t)
Returns the components of t if it is an intersection type, otherwise returns t.
public static List<JTypeMirror> erase(Collection<? extends JTypeMirror> ts)
Returns a list with the erasures of the given types, may be unmodifiable.
public static boolean mentions(@NonNull JTypeVisitable type, @NonNull net.sourceforge.pmd.lang.java.types.internal.infer.InferenceVar parent)
public static boolean mentionsAny(JTypeVisitable t, Collection<? extends SubstVar> vars)
public static Predicate<JMethodSymbol> accessibleMethodFilter(String name, @NonNull JClassSymbol symbol)
public static Iterable<JMethodSig> lazyFilterAccessible(List<JMethodSig> visible, @NonNull JClassSymbol accessSite)
public static List<JMethodSig> filterAccessible(List<JMethodSig> visible, @NonNull JClassSymbol accessSite)
public static JTypeMirror getMemberSource(JTypeMirror t)
Methods and fields of a type variable come from its upper bound, which must be captured. Capturing a type var does NOT capture its upper bound, so we must treat this case here.
public static List<JMethodSig> getMethodsOf(JTypeMirror type, String name, boolean staticOnly, @NonNull JClassSymbol enclosing)
public static NameResolver<JVariableSig.FieldSig> getMemberFieldResolver(JTypeMirror c, @NonNull String accessPackageName, @Nullable JClassSymbol access, String name)
public static boolean areRelated(@NonNull JTypeMirror t, JTypeMirror s)
Returns true if both types have a common supertype that is not Object. Primitive types are only related to themselves.
t
- Non-null type
s
- Non-null type
NullPointerException
- if a parameter is null
public static boolean isUnresolved(@NonNull JTypeMirror t)
t
- Non-null type
NullPointerException
- if the parameter is null
public static boolean isUnresolvedOrArray(@NonNull JTypeMirror t)
t
- Non-null type
NullPointerException
- if the parameter is null
public static boolean isSpecialUnresolved(@NonNull JTypeMirror t)
t
- Non-null type
NullPointerException
- if the parameter is null
public static boolean isSpecialUnresolvedOrArray(@Nullable JTypeMirror t)
t
- Non-null type
NullPointerException
- if the parameter is null
public static boolean hasUnresolvedSymbol(@Nullable JTypeMirror t)
public static boolean hasUnresolvedSymbolOrArray(@Nullable JTypeMirror t)
public static boolean isUnresolvedOrNull(@Nullable JTypeMirror t)
public static @Nullable JTypeMirror getArrayComponent(@Nullable JTypeMirror t)
@Deprecated public static boolean isContextDependent(JMethodSig sig)
Return true if the method is context dependent. That means its return type is influenced by the surrounding context during type inference. Generic constructors are always context dependent.
public static boolean isContextDependent(JExecutableSymbol symbol)
Return true if the method is context dependent. That means its return type is influenced by the surrounding context during type inference. Generic constructors are always context dependent.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4