Example #1
0
 private void emitDefault(TypeElement baseType, Log log, Message message) {
   TypeElement rootEnclosing = Utils.findRootEnclosingType(getMessageElement());
   if (rootEnclosing != null
       && Utils.typeEquals(baseType.asType(), rootEnclosing.asType())
       && this == message.getOriginalContainer()) {
     log.message(
         message.getKind(),
         getMessageElement(),
         getMessageAnnotation(),
         getMessageAnnotationValue(),
         message.getText());
   } else {
     MessageContainer original = message.getOriginalContainer();
     log.message(
         message.getKind(),
         baseType,
         null,
         null,
         wrapText(
             original.getMessageElement(), original.getMessageAnnotation(), message.getText()));
   }
 }
Example #2
0
  private static String wrapText(Element element, AnnotationMirror mirror, String text) {
    StringBuilder b = new StringBuilder();
    if (element != null) {
      b.append("Element " + element.toString());
    }
    if (mirror != null) {
      b.append(" at annotation @" + Utils.getSimpleName(mirror.getAnnotationType()));
    }

    if (b.length() > 0) {
      b.append(" is erroneous: ").append(text);
      return b.toString();
    } else {
      return text;
    }
  }