Java Code Examples for com.sun.source.tree.Tree.Kind#CHAR_LITERAL
The following examples show how to use
com.sun.source.tree.Tree.Kind#CHAR_LITERAL .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TypeTag.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
public Kind getKindLiteral() { switch (this) { case INT: return Kind.INT_LITERAL; case LONG: return Kind.LONG_LITERAL; case FLOAT: return Kind.FLOAT_LITERAL; case DOUBLE: return Kind.DOUBLE_LITERAL; case BOOLEAN: return Kind.BOOLEAN_LITERAL; case CHAR: return Kind.CHAR_LITERAL; case CLASS: return Kind.STRING_LITERAL; case BOT: return Kind.NULL_LITERAL; default: throw new AssertionError("unknown literal kind " + this); } }
Example 2
Source File: TypeTag.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
public Kind getKindLiteral() { switch (this) { case INT: return Kind.INT_LITERAL; case LONG: return Kind.LONG_LITERAL; case FLOAT: return Kind.FLOAT_LITERAL; case DOUBLE: return Kind.DOUBLE_LITERAL; case BOOLEAN: return Kind.BOOLEAN_LITERAL; case CHAR: return Kind.CHAR_LITERAL; case CLASS: return Kind.STRING_LITERAL; case BOT: return Kind.NULL_LITERAL; default: throw new AssertionError("unknown literal kind " + this); } }
Example 3
Source File: TypeTag.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
public Kind getKindLiteral() { switch (this) { case INT: return Kind.INT_LITERAL; case LONG: return Kind.LONG_LITERAL; case FLOAT: return Kind.FLOAT_LITERAL; case DOUBLE: return Kind.DOUBLE_LITERAL; case BOOLEAN: return Kind.BOOLEAN_LITERAL; case CHAR: return Kind.CHAR_LITERAL; case CLASS: return Kind.STRING_LITERAL; case BOT: return Kind.NULL_LITERAL; default: throw new AssertionError("unknown literal kind " + this); } }
Example 4
Source File: TypeTag.java From lua-for-android with BSD 3-Clause "New" or "Revised" License | 6 votes |
public Kind getKindLiteral() { switch (this) { case INT: return Kind.INT_LITERAL; case LONG: return Kind.LONG_LITERAL; case FLOAT: return Kind.FLOAT_LITERAL; case DOUBLE: return Kind.DOUBLE_LITERAL; case BOOLEAN: return Kind.BOOLEAN_LITERAL; case CHAR: return Kind.CHAR_LITERAL; case CLASS: return Kind.STRING_LITERAL; case BOT: return Kind.NULL_LITERAL; default: throw new AssertionError("unknown literal kind " + this); } }
Example 5
Source File: TypeTag.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
public Kind getKindLiteral() { switch (this) { case INT: return Kind.INT_LITERAL; case LONG: return Kind.LONG_LITERAL; case FLOAT: return Kind.FLOAT_LITERAL; case DOUBLE: return Kind.DOUBLE_LITERAL; case BOOLEAN: return Kind.BOOLEAN_LITERAL; case CHAR: return Kind.CHAR_LITERAL; case CLASS: return Kind.STRING_LITERAL; case BOT: return Kind.NULL_LITERAL; default: throw new AssertionError("unknown literal kind " + this); } }
Example 6
Source File: TypeTag.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
public Kind getKindLiteral() { switch (this) { case INT: return Kind.INT_LITERAL; case LONG: return Kind.LONG_LITERAL; case FLOAT: return Kind.FLOAT_LITERAL; case DOUBLE: return Kind.DOUBLE_LITERAL; case BOOLEAN: return Kind.BOOLEAN_LITERAL; case CHAR: return Kind.CHAR_LITERAL; case CLASS: return Kind.STRING_LITERAL; case BOT: return Kind.NULL_LITERAL; default: throw new AssertionError("unknown literal kind " + this); } }
Example 7
Source File: TypeTag.java From hottub with GNU General Public License v2.0 | 6 votes |
public Kind getKindLiteral() { switch (this) { case INT: return Kind.INT_LITERAL; case LONG: return Kind.LONG_LITERAL; case FLOAT: return Kind.FLOAT_LITERAL; case DOUBLE: return Kind.DOUBLE_LITERAL; case BOOLEAN: return Kind.BOOLEAN_LITERAL; case CHAR: return Kind.CHAR_LITERAL; case CLASS: return Kind.STRING_LITERAL; case BOT: return Kind.NULL_LITERAL; default: throw new AssertionError("unknown literal kind " + this); } }
Example 8
Source File: TypeTag.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
public Kind getKindLiteral() { switch (this) { case INT: return Kind.INT_LITERAL; case LONG: return Kind.LONG_LITERAL; case FLOAT: return Kind.FLOAT_LITERAL; case DOUBLE: return Kind.DOUBLE_LITERAL; case BOOLEAN: return Kind.BOOLEAN_LITERAL; case CHAR: return Kind.CHAR_LITERAL; case CLASS: return Kind.STRING_LITERAL; case BOT: return Kind.NULL_LITERAL; default: throw new AssertionError("unknown literal kind " + this); } }
Example 9
Source File: TypeTag.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
public Kind getKindLiteral() { switch (this) { case INT: return Kind.INT_LITERAL; case LONG: return Kind.LONG_LITERAL; case FLOAT: return Kind.FLOAT_LITERAL; case DOUBLE: return Kind.DOUBLE_LITERAL; case BOOLEAN: return Kind.BOOLEAN_LITERAL; case CHAR: return Kind.CHAR_LITERAL; case CLASS: return Kind.STRING_LITERAL; case BOT: return Kind.NULL_LITERAL; default: throw new AssertionError("unknown literal kind " + this); } }
Example 10
Source File: Utilities.java From netbeans with Apache License 2.0 | 5 votes |
public static boolean isConstantString(CompilationInfo info, TreePath tp, boolean acceptsChars) { if (tp.getLeaf().getKind() == Kind.STRING_LITERAL) return true; if (acceptsChars && tp.getLeaf().getKind() == Kind.CHAR_LITERAL) return true; Element el = info.getTrees().getElement(tp); if (el != null && (el.getKind() == ElementKind.FIELD || el.getKind() == ElementKind.LOCAL_VARIABLE) && ((VariableElement) el).getConstantValue() instanceof String) { return true; } if (tp.getLeaf().getKind() != Kind.PLUS) { return false; } List<List<TreePath>> sorted = splitStringConcatenationToElements(info, tp); if (sorted.size() != 1) { return false; } List<TreePath> part = sorted.get(0); for (TreePath c : part) { if (isConstantString(info, c, acceptsChars)) return true; } return false; }
Example 11
Source File: Utilities.java From netbeans with Apache License 2.0 | 4 votes |
public static boolean isStringOrCharLiteral(Tree t) { return t != null && (t.getKind() == Kind.STRING_LITERAL || t.getKind() == Kind.CHAR_LITERAL); }