Class TypeCompatibilityBound
java.lang.Object
de.monticore.types3.generics.bounds.Bound
de.monticore.types3.generics.bounds.TypeCompatibilityBound
- All Implemented Interfaces:
Comparable<Bound>
Specifies, that either
A) the inference variable is compatible to the SymTypeExpression, or
B) the specified SymTypeExpression is compatible to inference variable.
s.a.
TypeCompatibilityConstraint
s.a. SubTypingBound
This bound does not exist in the Java language specification.
Instead, the corresponding TypeCompatibilityConstraint in Java
is reduced to a SubTypingBound.
As our Type System is (slightly) less restrictive with
A) what types can be used as type arguments, and
B) which types are compatible to another,
using a SubTypingBound would be too restrictive, e.g.,
(Bad example, only used for simplicity)
List<Integer> l1 = [1];
List<int> l2 = [1];
The above example cannot be type-checked with the standard JLS algorithm.
Note: As of writing, replacing every creation of these with the creation of a SubTypingBound, the implementation should behave very comparable to JLS 21 chapter 18.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionTypeCompatibilityBound(SymTypeExpression targetType, SymTypeExpression sourceType) -
Method Summary
Modifier and TypeMethodDescriptionbooleandeepEquals(Bound other) Helper function;booleanprint()returns a human-readable String, e.g., for the logMethods inherited from class de.monticore.types3.generics.bounds.Bound
asCaptureBound, asSubTypingBound, asTypeEqualityBound, asUnsatisfiableBound, compareTo, isCaptureBound, isSubTypingBound, isTypeEqualityBound, isUnsatisfiableBound
-
Field Details
-
sourceType
-
targetType
-
-
Constructor Details
-
TypeCompatibilityBound
-
-
Method Details
-
getSourceType
-
getTargetType
-
isTypeCompatibilityBound
public boolean isTypeCompatibilityBound()- Overrides:
isTypeCompatibilityBoundin classBound
-
asTypeCompatibilityBound
- Overrides:
asTypeCompatibilityBoundin classBound
-
deepEquals
- Specified by:
deepEqualsin classBound
-
print
Description copied from class:Boundreturns a human-readable String, e.g., for the log -
getIncludedTypes
Description copied from class:BoundHelper function;- Specified by:
getIncludedTypesin classBound- Returns:
- the types included in the bounds (most have two).
-