// where
 private String expr2String(JCExpression tree) {
   switch (tree.getTag()) {
     case PARENS:
       return expr2String(((JCParens) tree).expr);
     case LAMBDA:
     case REFERENCE:
     case CONDEXPR:
       return Pretty.toSimpleString(tree);
     default:
       Assert.error("unexpected tree kind " + tree.getKind());
       return null;
   }
 }
예제 #2
0
 /**
  * Static factory method; build a custom diagnostic key using given kind, prefix, code and args.
  */
 public static DiagnosticInfo of(
     DiagnosticType type, String prefix, String code, Object... args) {
   switch (type) {
     case ERROR:
       return new Error(prefix, code, args);
     case WARNING:
       return new Warning(prefix, code, args);
     case NOTE:
       return new Note(prefix, code, args);
     case FRAGMENT:
       return new Fragment(prefix, code, args);
     default:
       Assert.error("Wrong diagnostic type: " + type);
       return null;
   }
 }