public interface CreatesMustCallForElementSupplier
AnnotationUtils.getElementValueArray(javax.lang.model.element.AnnotationMirror, java.lang.CharSequence, java.lang.Class<T>, boolean)
when getCreatesMustCallForExpressions(MethodInvocationNode, GenericAnnotatedTypeFactory,
CreatesMustCallForElementSupplier)
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
CalledMethods type factory and the MustCall type factory).Modifier and Type | Method and Description |
---|---|
static @Nullable JavaExpression |
getCreatesMustCallForExpression(AnnotationMirror createsMustCallFor,
MethodInvocationNode n,
GenericAnnotatedTypeFactory<?,?,?,?> atypeFactory,
CreatesMustCallForElementSupplier supplier)
Parses a single CreatesMustCallFor annotation.
|
static List<JavaExpression> |
getCreatesMustCallForExpressions(MethodInvocationNode n,
GenericAnnotatedTypeFactory<?,?,?,?> atypeFactory,
CreatesMustCallForElementSupplier supplier)
Returns the arguments of the @CreatesMustCallFor annotation on the invoked method, as
JavaExpressions.
|
ExecutableElement |
getCreatesMustCallForListValueElement()
Returns the CreatesMustCallFor.List.value field/element.
|
ExecutableElement |
getCreatesMustCallForValueElement()
Returns the CreatesMustCallFor.value field/element.
|
static void |
issueUnparseableError(MethodInvocationNode n,
GenericAnnotatedTypeFactory<?,?,?,?> atypeFactory,
String unparseable)
Issues a createsmustcallfor.target.unparseable error.
|
ExecutableElement getCreatesMustCallForValueElement()
ExecutableElement getCreatesMustCallForListValueElement()
static List<JavaExpression> getCreatesMustCallForExpressions(MethodInvocationNode n, GenericAnnotatedTypeFactory<?,?,?,?> atypeFactory, CreatesMustCallForElementSupplier 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 CreatesMustCallFor
and CreatesMustCallFor.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 getCreatesMustCallForExpression(AnnotationMirror createsMustCallFor, MethodInvocationNode n, GenericAnnotatedTypeFactory<?,?,?,?> atypeFactory, CreatesMustCallForElementSupplier supplier)
getCreatesMustCallForExpressions(MethodInvocationNode, GenericAnnotatedTypeFactory,
CreatesMustCallForElementSupplier)
, which handles the possibility of multiple such
annotations, instead.createsMustCallFor
- a @CreatesMustCallFor annotationn
- the invocation of a reset methodatypeFactory
- the type factorysupplier
- a type factory that can supply the executable elements for CreatesMustCallFor
and CreatesMustCallFor.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