private boolean tryAsString(Node val, Class<?> expectedType, List<Object> returnValues) { if (expectedType != String.class) return false; if (val instanceof StringLiteral) { returnValues.add(((StringLiteral)val).astValue()); return true; } throw new ResolutionException(val, "Expected string literal"); }
@CopyMethod static String getDescription(StringLiteral self) { String v = self.astValue(); if (v == null) return null; if (v.length() > 17) return v.substring(0, 8) + "\u2026" + v.substring(v.length() - 8); return v; }
private boolean tryAsString(Node val, Class<?> expectedType, List<Object> returnValues) { if (expectedType != String.class) return false; if (val instanceof StringLiteral) { returnValues.add(((StringLiteral)val).astValue()); return true; } throw new ResolutionException(val, "Expected string literal"); }
@CopyMethod static String getDescription(StringLiteral self) { String v = self.astValue(); if (v == null) return null; if (v.length() > 17) return v.substring(0, 8) + "\u2026" + v.substring(v.length() - 8); return v; }
@CopyMethod static String getDescription(StringLiteral self) { String v = self.astValue(); if (v == null) return null; if (v.length() > 17) return v.substring(0, 8) + "\u2026" + v.substring(v.length() - 8); return v; }
private boolean tryAsString(Node val, Class<?> expectedType, List<Object> returnValues) { if (expectedType != String.class) return false; if (val instanceof StringLiteral) { returnValues.add(((StringLiteral)val).astValue()); return true; } throw new ResolutionException(val, "Expected string literal"); }
@Override public boolean visitStringLiteral(StringLiteral node) { return posSet(node, treeMaker.Literal(TypeTags.CLASS, node.astValue())); }
@Override public boolean visitStringLiteral(StringLiteral node) { return posSet(node, treeMaker.Literal(TypeTags.CLASS, node.astValue())); }
@Override public boolean visitStringLiteral(StringLiteral node) { return posSet(node, treeMaker.Literal(TypeTags.CLASS, node.astValue())); }
@Override public boolean visitStringLiteral(StringLiteral stringLiteral) { String patternStr = "[\\u4e00-\\u9fa5]"; Pattern pattern = Pattern.compile(patternStr); Matcher matcher = pattern.matcher(stringLiteral.astValue()); if (matcher.find()) { context.report( ISSUE, stringLiteral, context.getLocation(stringLiteral), "chinese string:" + stringLiteral.astValue() ); } return false; }
@Override public boolean visitStringLiteral(lombok.ast.StringLiteral node) { return set(node, new StringLiteral(node.astValue().toCharArray(), start(node), end(node), 0)); }
@Override public boolean visitStringLiteral(lombok.ast.StringLiteral node) { return set(node, new StringLiteral(node.astValue().toCharArray(), start(node), end(node), 0)); }
@Override public boolean visitStringLiteral(lombok.ast.StringLiteral node) { return set(node, new StringLiteral(node.astValue().toCharArray(), start(node), end(node), 0)); }
private void property(String rel, Object val) { printIndent(); if (rel != null) output.append(rel).append(": "); if (val instanceof JCTree) output.append("!!JCTree-AS-PROP!!"); if (val == null) { output.append("[NULL]\n"); } else { String content; if (val instanceof String) { content = new StringLiteral().astValue(val.toString()).rawValue(); } else { content = String.valueOf(val); } output.append("[").append(val.getClass().getSimpleName()).append(" ").append(content).append("]\n"); } }
private void property(String rel, Object val) { printIndent(); if (rel != null) output.append(rel).append(": "); if (val instanceof JCTree) output.append("!!JCTree-AS-PROP!!"); if (val == null) { output.append("[NULL]\n"); } else { String content; if (val instanceof String) { content = new StringLiteral().astValue(val.toString()).rawValue(); } else { content = String.valueOf(val); } output.append("[").append(val.getClass().getSimpleName()).append(" ").append(content).append("]\n"); } }
private void property(String rel, Object val) { printIndent(); if (rel != null) output.append(rel).append(": "); if (val instanceof JCTree) output.append("!!JCTree-AS-PROP!!"); if (val == null) { output.append("[NULL]\n"); } else { String content; if (val instanceof String) { content = new StringLiteral().astValue(val.toString()).rawValue(); } else { content = String.valueOf(val); } output.append("[").append(val.getClass().getSimpleName()).append(" ").append(content).append("]\n"); } }
@Override public void visitStringLiteral(StringLiteral node) { set(node, setPosition(node, new lombok.ast.StringLiteral().astValue(String.valueOf(node.source())))); }
@Override public void visitStringLiteral(StringLiteral node) { set(node, setPosition(node, new lombok.ast.StringLiteral().astValue(String.valueOf(node.source())))); }
@Override public void visitStringLiteral(StringLiteral node) { set(node, setPosition(node, new lombok.ast.StringLiteral().astValue(String.valueOf(node.source())))); }
@Override public void visitMethod(@NonNull JavaContext context, @Nullable AstVisitor visitor, @NonNull MethodInvocation node) { assert node.astName().astValue().equals("sendTextMessage") || //$NON-NLS-1$ node.astName().astValue().equals("sendMultipartTextMessage"); //$NON-NLS-1$ if (node.astOperand() == null) { // "sendTextMessage"/"sendMultipartTextMessage" in the code with no operand return; } StrictListAccessor<Expression, MethodInvocation> args = node.astArguments(); if (args.size() == 5) { Expression destinationAddress = args.first(); if (destinationAddress instanceof StringLiteral) { String number = ((StringLiteral) destinationAddress).astValue(); if (!number.startsWith("+")) { //$NON-NLS-1$ context.report(ISSUE, node, context.getLocation(destinationAddress), "To make sure the SMS can be sent by all users, please start the SMS number " + "with a + and a country code or restrict the code invocation to people in the country " + "you are targeting."); } } } } }