public interface CreatesObligationElementSupplier
AnnotationUtils.getElementValueArray(javax.lang.model.element.AnnotationMirror, java.lang.CharSequence, java.lang.Class<T>, boolean)
when getCreatesObligationExpressions(MethodInvocationNode, GenericAnnotatedTypeFactory,
CreatesObligationElementSupplier)
is called. This interface is needed so any type factory with
these elements can be used to call that method, not just the MustCallAnnotatedTypeFactory (in
particular, the consistency checker needs to be able to call that method with both the
ObjectConstruction/CalledMethods type factory and the MustCall type factory).Modifier and Type | Method and Description |
---|---|
static @Nullable JavaExpression |
getCreatesObligationExpression(AnnotationMirror createsObligation,
MethodInvocationNode n,
GenericAnnotatedTypeFactory<?,?,?,?> atypeFactory,
CreatesObligationElementSupplier supplier)
Parses a single CreatesObligation annotation.
|
static List<JavaExpression> |
getCreatesObligationExpressions(MethodInvocationNode n,
GenericAnnotatedTypeFactory<?,?,?,?> atypeFactory,
CreatesObligationElementSupplier supplier)
Returns the arguments of the @CreatesObligation annotation on the invoked method, as
JavaExpressions.
|
ExecutableElement |
getCreatesObligationListValueElement()
Returns the CreatesObligation.List.value field/element.
|
ExecutableElement |
getCreatesObligationValueElement()
Returns the CreatesObligation.value field/element.
|
static void |
issueUnparseableError(MethodInvocationNode n,
GenericAnnotatedTypeFactory<?,?,?,?> atypeFactory,
String unparseable)
Issues a createsobligation.target.unparseable error.
|
ExecutableElement getCreatesObligationValueElement()
ExecutableElement getCreatesObligationListValueElement()
static List<JavaExpression> getCreatesObligationExpressions(MethodInvocationNode n, GenericAnnotatedTypeFactory<?,?,?,?> atypeFactory, CreatesObligationElementSupplier supplier)
If any expression is unparseable, this method reports an error and returns the empty set.
n
- a method invocationatypeFactory
- the type factory to report errors and parse the expression stringsupplier
- a type factory that can supply the executable elements for CreatesObligation
and CreatesObligation.List's value elements. Usually, you should just pass atypeFactory
again. The arguments are different so that the given type factory's adherence to both
protocols are checked by the type system.static @Nullable JavaExpression getCreatesObligationExpression(AnnotationMirror createsObligation, MethodInvocationNode n, GenericAnnotatedTypeFactory<?,?,?,?> atypeFactory, CreatesObligationElementSupplier supplier)
getCreatesObligationExpressions(MethodInvocationNode, GenericAnnotatedTypeFactory,
CreatesObligationElementSupplier)
, which handles the possibility of multiple such annotations,
instead.createsObligation
- a @CreatesObligation annotationn
- the invocation of a reset methodatypeFactory
- the type factorysupplier
- a type factory that can supply the executable elements for CreatesObligation
and CreatesObligation.List's value elements. Usually, you should just pass atypeFactory
again. The arguments are different so that the given type factory's adherence to both
protocols are checked by the type system.static void issueUnparseableError(MethodInvocationNode n, GenericAnnotatedTypeFactory<?,?,?,?> atypeFactory, String unparseable)
n
- the nodeatypeFactory
- the type factory to use to issue the errorunparseable
- the unparseable string