コード例 #1
0
 private AnnotatedTypeMirror getPostFixAnno(UnaryTree tree, AnnotatedTypeMirror anno) {
   if (anno.hasAnnotation(DoubleVal.class)) {
     return postFixDouble(anno, tree.getKind() == Tree.Kind.POSTFIX_INCREMENT);
   } else if (anno.hasAnnotation(IntVal.class)) {
     return postFixInt(anno, tree.getKind() == Tree.Kind.POSTFIX_INCREMENT);
   }
   return anno;
 }
コード例 #2
0
 @Override
 protected void checkMethodInvocability(
     AnnotatedExecutableType method, MethodInvocationTree node) {
   if (!TreeUtils.isSelfAccess(node)
       &&
       // Static methods don't have a receiver
       method.getReceiverType() != null) {
     // TODO: should all or some constructors be excluded?
     // method.getElement().getKind() != ElementKind.CONSTRUCTOR) {
     Set<AnnotationMirror> recvAnnos = atypeFactory.getReceiverType(node).getAnnotations();
     AnnotatedTypeMirror methodReceiver = method.getReceiverType().getErased();
     AnnotatedTypeMirror treeReceiver = methodReceiver.shallowCopy(false);
     AnnotatedTypeMirror rcv = atypeFactory.getReceiverType(node);
     treeReceiver.addAnnotations(rcv.getEffectiveAnnotations());
     // If receiver is Nullable, then we don't want to issue a warning
     // about method invocability (we'd rather have only the
     // "dereference.of.nullable" message).
     if (treeReceiver.hasAnnotation(NULLABLE) || recvAnnos.contains(MONOTONIC_NONNULL)) {
       return;
     }
   }
   super.checkMethodInvocability(method, node);
 }