本文整理汇总了Java中org.eclipse.jdt.core.dom.CharacterLiteral类的典型用法代码示例。如果您正苦于以下问题:Java CharacterLiteral类的具体用法?Java CharacterLiteral怎么用?Java CharacterLiteral使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CharacterLiteral类属于org.eclipse.jdt.core.dom包,在下文中一共展示了CharacterLiteral类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: repairBug
import org.eclipse.jdt.core.dom.CharacterLiteral; //导入依赖的package包/类
@Override
protected void repairBug(ASTRewrite rewrite, CompilationUnit workingUnit, BugInstance bug) throws BugResolutionException {
ASTNode node = getASTNode(workingUnit, bug.getPrimarySourceLineAnnotation());
node = TraversalUtil.backtrackToBlock(node);
StringToCharVisitor visitor = new StringToCharVisitor();
node.accept(visitor);
AST ast = rewrite.getAST();
if (useStringBuilder) {
MethodInvocation toString = buildChainedToString(rewrite, visitor, ast);
rewrite.replace(visitor.infixExpression, toString, null);
} else {
handleSimpleConcat(rewrite, visitor, ast);
}
// replaces all non-concatenation StringLiterals
for (Map.Entry<StringLiteral, Character> entry : visitor.replacements.entrySet()) {
CharacterLiteral charLiteral = ast.newCharacterLiteral();
charLiteral.setCharValue(entry.getValue());
rewrite.replace(entry.getKey(), charLiteral, null);
}
}
开发者ID:kjlubick,项目名称:fb-contrib-eclipse-quick-fixes,代码行数:24,代码来源:UseCharacterParameterizedMethodResolution.java
示例2: match
import org.eclipse.jdt.core.dom.CharacterLiteral; //导入依赖的package包/类
@Override
public boolean match(CharacterLiteral node, Object other) {
if (!(other instanceof CharacterLiteral)) {
return false;
}
CharacterLiteral o = (CharacterLiteral) other;
return safeRenamedEquals(node.getEscapedValue(), o.getEscapedValue(),
oldName, newName);
}
示例3: retrieveVariableReference
import org.eclipse.jdt.core.dom.CharacterLiteral; //导入依赖的package包/类
private VariableReference retrieveVariableReference(CharacterLiteral characterLiteral) {
char character = characterLiteral.charValue();
PrimitiveStatement<Character> charAssignment = new CharPrimitiveStatement(
testCase.getReference(), character);
testCase.addStatement(charAssignment);
return charAssignment.getReturnValue();
}
示例4: fixSingleLengthString
import org.eclipse.jdt.core.dom.CharacterLiteral; //导入依赖的package包/类
private static Expression fixSingleLengthString(Expression expr, AST ast) {
if (expr instanceof StringLiteral) {
String literalValue = ((StringLiteral) expr).getLiteralValue();
if (literalValue.length() == 1) {
CharacterLiteral charLiteral = ast.newCharacterLiteral();
charLiteral.setCharValue(literalValue.charAt(0));
return charLiteral;
}
}
return expr;
}
开发者ID:kjlubick,项目名称:fb-contrib-eclipse-quick-fixes,代码行数:12,代码来源:UseCharacterParameterizedMethodResolution.java
示例5: visit
import org.eclipse.jdt.core.dom.CharacterLiteral; //导入依赖的package包/类
@Override
public boolean visit(CharacterLiteral node) {
String chr = node.getEscapedValue();
// It would seem a lot of the text manipulation stuff
// in java uses invalid unicode characters, so we use
// this hack to get around it.
if (chr.startsWith("'\\u")) {
chr = "0x" + chr.substring(3, chr.length() - 1);
}
print(chr);
return false;
}
示例6: endVisit
import org.eclipse.jdt.core.dom.CharacterLiteral; //导入依赖的package包/类
@Override
public void endVisit(CharacterLiteral node) {
// Leaf node.
}
示例7: endVisit
import org.eclipse.jdt.core.dom.CharacterLiteral; //导入依赖的package包/类
@Override
public void endVisit(CharacterLiteral node) {
ITypeBinding typeBinding = node.resolveTypeBinding();
ImmutableTypeVariable2 cv = fTCModel.makeImmutableTypeVariable(typeBinding, node);
setConstraintVariable(node, cv);
}
示例8: visit
import org.eclipse.jdt.core.dom.CharacterLiteral; //导入依赖的package包/类
@Override
public boolean visit(CharacterLiteral node) {
return visitLiteral(node);
}
示例9: getEscapedCharacterLiteral
import org.eclipse.jdt.core.dom.CharacterLiteral; //导入依赖的package包/类
private static String getEscapedCharacterLiteral(char ch) {
CharacterLiteral characterLiteral= AST.newAST(AST.JLS8).newCharacterLiteral();
characterLiteral.setCharValue(ch);
return characterLiteral.getEscapedValue();
}
示例10: endVisit
import org.eclipse.jdt.core.dom.CharacterLiteral; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
public void endVisit(CharacterLiteral node) {
logger.warn("Method endVisitCharacterLiteral for " + node + " for " + node + " not implemented!");
super.endVisit(node);
}
示例11: visit
import org.eclipse.jdt.core.dom.CharacterLiteral; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
public boolean visit(CharacterLiteral node) {
logger.warn("Method visitCharacterLiteral for " + node + " for " + node + " not implemented!");
return super.visit(node);
}
示例12: visit
import org.eclipse.jdt.core.dom.CharacterLiteral; //导入依赖的package包/类
@Override
public boolean visit(final CharacterLiteral node) {
return false;
}
示例13: visit
import org.eclipse.jdt.core.dom.CharacterLiteral; //导入依赖的package包/类
@Override
public boolean visit(final CharacterLiteral node) {
// not instrumentable, contains no instrumentable nodes
return false;
}
示例14: endVisit
import org.eclipse.jdt.core.dom.CharacterLiteral; //导入依赖的package包/类
@Override
public void endVisit(CharacterLiteral node) {
ITypeBinding typeBinding= node.resolveTypeBinding();
ImmutableTypeVariable2 cv= fTCModel.makeImmutableTypeVariable(typeBinding, node);
setConstraintVariable(node, cv);
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:7,代码来源:InferTypeArgumentsConstraintCreator.java
示例15: visit
import org.eclipse.jdt.core.dom.CharacterLiteral; //导入依赖的package包/类
@Override
public boolean visit(CharacterLiteral node) {
if (node.subtreeMatch(fMatcher, fNodeToMatch))
return matches(node);
return super.visit(node);
}