use of org.checkerframework.dataflow.cfg.node.StringLiteralNode in project checker-framework by typetools.
the class CFGTranslationPhaseOne method visitLiteral.
@Override
public Node visitLiteral(LiteralTree tree, Void p) {
Node r = null;
switch(tree.getKind()) {
case BOOLEAN_LITERAL:
r = new BooleanLiteralNode(tree);
break;
case CHAR_LITERAL:
r = new CharacterLiteralNode(tree);
break;
case DOUBLE_LITERAL:
r = new DoubleLiteralNode(tree);
break;
case FLOAT_LITERAL:
r = new FloatLiteralNode(tree);
break;
case INT_LITERAL:
r = new IntegerLiteralNode(tree);
break;
case LONG_LITERAL:
r = new LongLiteralNode(tree);
break;
case NULL_LITERAL:
r = new NullLiteralNode(tree);
break;
case STRING_LITERAL:
r = new StringLiteralNode(tree);
break;
default:
throw new BugInCF("unexpected literal tree");
}
assert r != null : "unexpected literal tree";
extendWithNode(r);
return r;
}
use of org.checkerframework.dataflow.cfg.node.StringLiteralNode in project checker-framework by typetools.
the class I18nFormatterTreeUtil method makeFormatCallCategories.
public Result<I18nConversionCategory[]> makeFormatCallCategories(MethodInvocationNode node, I18nFormatterAnnotatedTypeFactory atypeFactory) {
Map<String, String> translations = atypeFactory.translations;
Node firstParam = node.getArgument(0);
Result<I18nConversionCategory[]> ret = new Result<>(null, node.getTree());
// Now only work with a literal string
if (firstParam instanceof StringLiteralNode) {
String s = ((StringLiteralNode) firstParam).getValue();
if (translations.containsKey(s)) {
String value = translations.get(s);
ret = new Result<>(I18nFormatUtil.formatParameterCategories(value), node.getTree());
}
}
return ret;
}
Aggregations