Java 类org.eclipse.jdt.internal.compiler.ast.StringLiteral 实例源码

项目:incubator-datafu    文件:EcjMultilineProcessor.java   
@Override
public boolean process(final Set<? extends TypeElement> annotations, final RoundEnvironment roundEnv) {
  Set<? extends Element> fields = roundEnv.getElementsAnnotatedWith(Multiline.class);

  for (Element field : fields) {
    String docComment = elementUtils.getDocComment(field);

    if (null != docComment) {
      VariableElementImpl fieldElem = (VariableElementImpl) field;
      FieldBinding biding = (FieldBinding) fieldElem._binding;
      FieldDeclaration decl = biding.sourceField();
      StringLiteral string = new StringLiteral(docComment.toCharArray(), decl.sourceStart, decl.sourceEnd, decl.sourceStart);
      decl.initialization = string;
    }
  }
  return true;
}
项目:lombok    文件:EclipseHandlerUtil.java   
public static Annotation[] createSuppressWarningsAll(ASTNode source, Annotation[] originalAnnotationArray) {
    int pS = source.sourceStart, pE = source.sourceEnd;
    long p = (long)pS << 32 | pE;
    long[] poss = new long[3];
    Arrays.fill(poss, p);
    QualifiedTypeReference suppressWarningsType = new QualifiedTypeReference(TypeConstants.JAVA_LANG_SUPPRESSWARNINGS, poss);
    setGeneratedBy(suppressWarningsType, source);
    SingleMemberAnnotation ann = new SingleMemberAnnotation(suppressWarningsType, pS);
    ann.declarationSourceEnd = pE;
    ann.memberValue = new StringLiteral(ALL, pS, pE, 0);
    setGeneratedBy(ann, source);
    setGeneratedBy(ann.memberValue, source);
    if (originalAnnotationArray == null) return new Annotation[] { ann };
    Annotation[] newAnnotationArray = new Annotation[originalAnnotationArray.length + 1];
    System.arraycopy(originalAnnotationArray, 0, newAnnotationArray, 0, originalAnnotationArray.length);
    newAnnotationArray[originalAnnotationArray.length] = ann;
    return newAnnotationArray;
}
项目:lombok    文件:EclipseHandlerUtil.java   
/**
 * Generates a new statement that checks if the given variable is null, and if so, throws a {@code NullPointerException} with the
 * variable name as message.
 */
public static Statement generateNullCheck(AbstractVariableDeclaration variable, ASTNode source) {
    int pS = source.sourceStart, pE = source.sourceEnd;
    long p = (long)pS << 32 | pE;

    if (isPrimitive(variable.type)) return null;
    AllocationExpression exception = new AllocationExpression();
    setGeneratedBy(exception, source);
    exception.type = new QualifiedTypeReference(fromQualifiedName("java.lang.NullPointerException"), new long[]{p, p, p});
    setGeneratedBy(exception.type, source);
    exception.arguments = new Expression[] { new StringLiteral(variable.name, pS, pE, 0)};
    setGeneratedBy(exception.arguments[0], source);
    ThrowStatement throwStatement = new ThrowStatement(exception, pS, pE);
    setGeneratedBy(throwStatement, source);

    SingleNameReference varName = new SingleNameReference(variable.name, p);
    setGeneratedBy(varName, source);
    NullLiteral nullLiteral = new NullLiteral(pS, pE);
    setGeneratedBy(nullLiteral, source);
    EqualExpression equalExpression = new EqualExpression(varName, nullLiteral, OperatorIds.EQUAL_EQUAL);
    equalExpression.sourceStart = pS; equalExpression.statementEnd = equalExpression.sourceEnd = pE;
    setGeneratedBy(equalExpression, source);
    IfStatement ifStatement = new IfStatement(equalExpression, throwStatement, 0, 0);
    setGeneratedBy(ifStatement, source);
    return ifStatement;
}
项目:lombok-ianchiu    文件:HandleConstructor.java   
public static Annotation[] createConstructorProperties(ASTNode source, Collection<EclipseNode> fields) {
    if (fields.isEmpty()) return null;

    int pS = source.sourceStart, pE = source.sourceEnd;
    long p = (long) pS << 32 | pE;
    long[] poss = new long[3];
    Arrays.fill(poss, p);
    QualifiedTypeReference constructorPropertiesType = new QualifiedTypeReference(JAVA_BEANS_CONSTRUCTORPROPERTIES, poss);
    setGeneratedBy(constructorPropertiesType, source);
    SingleMemberAnnotation ann = new SingleMemberAnnotation(constructorPropertiesType, pS);
    ann.declarationSourceEnd = pE;

    ArrayInitializer fieldNames = new ArrayInitializer();
    fieldNames.sourceStart = pS;
    fieldNames.sourceEnd = pE;
    fieldNames.expressions = new Expression[fields.size()];

    int ctr = 0;
    for (EclipseNode field : fields) {
        char[] fieldName = removePrefixFromField(field);
        fieldNames.expressions[ctr] = new StringLiteral(fieldName, pS, pE, 0);
        setGeneratedBy(fieldNames.expressions[ctr], source);
        ctr++;
    }

    ann.memberValue = fieldNames;
    setGeneratedBy(ann, source);
    setGeneratedBy(ann.memberValue, source);
    return new Annotation[] { ann };
}
项目:lombok-ianchiu    文件:HandleUtilityClass.java   
private void createPrivateDefaultConstructor(EclipseNode typeNode, EclipseNode sourceNode) {
    ASTNode source = sourceNode.get();

    TypeDeclaration typeDeclaration = ((TypeDeclaration) typeNode.get());
    long p = (long) source.sourceStart << 32 | source.sourceEnd;

    ConstructorDeclaration constructor = new ConstructorDeclaration(((CompilationUnitDeclaration) typeNode.top().get()).compilationResult);

    constructor.modifiers = ClassFileConstants.AccPrivate;
    constructor.selector = typeDeclaration.name;
    constructor.constructorCall = new ExplicitConstructorCall(ExplicitConstructorCall.ImplicitSuper);
    constructor.constructorCall.sourceStart = source.sourceStart;
    constructor.constructorCall.sourceEnd = source.sourceEnd;
    constructor.thrownExceptions = null;
    constructor.typeParameters = null;
    constructor.bits |= ECLIPSE_DO_NOT_TOUCH_FLAG;
    constructor.bodyStart = constructor.declarationSourceStart = constructor.sourceStart = source.sourceStart;
    constructor.bodyEnd = constructor.declarationSourceEnd = constructor.sourceEnd = source.sourceEnd;
    constructor.arguments = null;

    AllocationExpression exception = new AllocationExpression();
    setGeneratedBy(exception, source);
    long[] ps = new long[JAVA_LANG_UNSUPPORTED_OPERATION_EXCEPTION.length];
    Arrays.fill(ps, p);
    exception.type = new QualifiedTypeReference(JAVA_LANG_UNSUPPORTED_OPERATION_EXCEPTION, ps);
    setGeneratedBy(exception.type, source);
    exception.arguments = new Expression[] {
            new StringLiteral(UNSUPPORTED_MESSAGE, source.sourceStart, source.sourceEnd, 0)
    };
    setGeneratedBy(exception.arguments[0], source);
    ThrowStatement throwStatement = new ThrowStatement(exception, source.sourceStart, source.sourceEnd);
    setGeneratedBy(throwStatement, source);

    constructor.statements = new Statement[] {throwStatement};

    injectMethod(typeNode, constructor);
}
项目:lombok-ianchiu    文件:EclipseHandlerUtil.java   
public static Annotation[] addSuppressWarningsAll(EclipseNode node, ASTNode source, Annotation[] originalAnnotationArray) {
    Annotation[] anns = addAnnotation(source, originalAnnotationArray, TypeConstants.JAVA_LANG_SUPPRESSWARNINGS, new StringLiteral(ALL, 0, 0, 0));

    if (Boolean.TRUE.equals(node.getAst().readConfiguration(ConfigurationKeys.ADD_FINDBUGS_SUPPRESSWARNINGS_ANNOTATIONS))) {
        MemberValuePair mvp = new MemberValuePair(JUSTIFICATION, 0, 0, new StringLiteral(GENERATED_CODE, 0, 0, 0));
        anns = addAnnotation(source, anns, EDU_UMD_CS_FINDBUGS_ANNOTATIONS_SUPPRESSFBWARNINGS, mvp);
    }

    return anns;
}
项目:EasyMPermission    文件:HandleConstructor.java   
public static Annotation[] createConstructorProperties(ASTNode source, Collection<EclipseNode> fields) {
    if (fields.isEmpty()) return null;

    int pS = source.sourceStart, pE = source.sourceEnd;
    long p = (long)pS << 32 | pE;
    long[] poss = new long[3];
    Arrays.fill(poss, p);
    QualifiedTypeReference constructorPropertiesType = new QualifiedTypeReference(JAVA_BEANS_CONSTRUCTORPROPERTIES, poss);
    setGeneratedBy(constructorPropertiesType, source);
    SingleMemberAnnotation ann = new SingleMemberAnnotation(constructorPropertiesType, pS);
    ann.declarationSourceEnd = pE;

    ArrayInitializer fieldNames = new ArrayInitializer();
    fieldNames.sourceStart = pS;
    fieldNames.sourceEnd = pE;
    fieldNames.expressions = new Expression[fields.size()];

    int ctr = 0;
    for (EclipseNode field : fields) {
        char[] fieldName = removePrefixFromField(field);
        fieldNames.expressions[ctr] = new StringLiteral(fieldName, pS, pE, 0);
        setGeneratedBy(fieldNames.expressions[ctr], source);
        ctr++;
    }

    ann.memberValue = fieldNames;
    setGeneratedBy(ann, source);
    setGeneratedBy(ann.memberValue, source);
    return new Annotation[] { ann };
}
项目:EasyMPermission    文件:HandleUtilityClass.java   
private void createPrivateDefaultConstructor(EclipseNode typeNode, EclipseNode sourceNode) {
    ASTNode source = sourceNode.get();

    TypeDeclaration typeDeclaration = ((TypeDeclaration) typeNode.get());
    long p = (long) source.sourceStart << 32 | source.sourceEnd;

    ConstructorDeclaration constructor = new ConstructorDeclaration(((CompilationUnitDeclaration) typeNode.top().get()).compilationResult);

    constructor.modifiers = ClassFileConstants.AccPrivate;
    constructor.selector = typeDeclaration.name;
    constructor.constructorCall = new ExplicitConstructorCall(ExplicitConstructorCall.ImplicitSuper);
    constructor.constructorCall.sourceStart = source.sourceStart;
    constructor.constructorCall.sourceEnd = source.sourceEnd;
    constructor.thrownExceptions = null;
    constructor.typeParameters = null;
    constructor.bits |= ECLIPSE_DO_NOT_TOUCH_FLAG;
    constructor.bodyStart = constructor.declarationSourceStart = constructor.sourceStart = source.sourceStart;
    constructor.bodyEnd = constructor.declarationSourceEnd = constructor.sourceEnd = source.sourceEnd;
    constructor.arguments = null;

    AllocationExpression exception = new AllocationExpression();
    setGeneratedBy(exception, source);
    long[] ps = new long[JAVA_LANG_UNSUPPORTED_OPERATION_EXCEPTION.length];
    Arrays.fill(ps, p);
    exception.type = new QualifiedTypeReference(JAVA_LANG_UNSUPPORTED_OPERATION_EXCEPTION, ps);
    setGeneratedBy(exception.type, source);
    exception.arguments = new Expression[] {
            new StringLiteral(UNSUPPORTED_MESSAGE, source.sourceStart, source.sourceEnd, 0)
    };
    setGeneratedBy(exception.arguments[0], source);
    ThrowStatement throwStatement = new ThrowStatement(exception, source.sourceStart, source.sourceEnd);
    setGeneratedBy(throwStatement, source);

    constructor.statements = new Statement[] {throwStatement};

    injectMethod(typeNode, constructor);
}
项目:EasyMPermission    文件:EclipseHandlerUtil.java   
public static Annotation[] addSuppressWarningsAll(EclipseNode node, ASTNode source, Annotation[] originalAnnotationArray) {
    Annotation[] anns = addAnnotation(source, originalAnnotationArray, TypeConstants.JAVA_LANG_SUPPRESSWARNINGS, new StringLiteral(ALL, 0, 0, 0));

    if (Boolean.TRUE.equals(node.getAst().readConfiguration(ConfigurationKeys.ADD_FINDBUGS_SUPPRESSWARNINGS_ANNOTATIONS))) {
        MemberValuePair mvp = new MemberValuePair(JUSTIFICATION, 0, 0, new StringLiteral(GENERATED_CODE, 0, 0, 0));
        anns = addAnnotation(source, anns, EDU_UMD_CS_FINDBUGS_ANNOTATIONS_SUPPRESSFBWARNINGS, mvp);
    }

    return anns;
}
项目:android-retrolambda-lombok    文件:EcjTreeOperations.java   
private static void dodgeExtendedStringLiterals(EcjTreePrinter printer) {
    printer.skipProperty(StringLiteral.class, "lineNumber");
    printer.skipPropertyIfHasValue(ExtendedStringLiteral.class, "lineNumber", -1);
    printer.skipPropertyIfHasValue(ExtendedStringLiteral.class, "lineNumber", -2);
    printer.skipPropertyIfHasValue(StringLiteral.class, "lineNumber", -1);
    printer.skipPropertyIfHasValue(StringLiteral.class, "lineNumber", -2);
    printer.stringReplace("ExtendedStringLiteral", "StringLiteral");
}
项目:Eclipse-Postfix-Code-Completion    文件:CodeFormatterVisitor.java   
/**
 * @see org.eclipse.jdt.internal.compiler.ASTVisitor#visit(org.eclipse.jdt.internal.compiler.ast.StringLiteral, org.eclipse.jdt.internal.compiler.lookup.BlockScope)
 */
public boolean visit(StringLiteral stringLiteral, BlockScope scope) {
    final int numberOfParens = (stringLiteral.bits & ASTNode.ParenthesizedMASK) >> ASTNode.ParenthesizedSHIFT;
    if (numberOfParens > 0) {
        manageOpeningParenthesizedExpression(stringLiteral, numberOfParens);
    }
    this.scribe.checkNLSTag(stringLiteral.sourceStart);
    this.scribe.printNextToken(TerminalTokens.TokenNameStringLiteral);
    this.scribe.printComment(CodeFormatter.K_UNKNOWN, Scribe.BASIC_TRAILING_COMMENT);
    if (numberOfParens > 0) {
        manageClosingParenthesizedExpression(stringLiteral, numberOfParens);
    }
    return false;
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:CodeFormatterVisitor.java   
/**
 * @see org.eclipse.jdt.internal.compiler.ASTVisitor#visit(org.eclipse.jdt.internal.compiler.ast.StringLiteral, org.eclipse.jdt.internal.compiler.lookup.BlockScope)
 */
public boolean visit(StringLiteral stringLiteral, BlockScope scope) {
    final int numberOfParens = (stringLiteral.bits & ASTNode.ParenthesizedMASK) >> ASTNode.ParenthesizedSHIFT;
    if (numberOfParens > 0) {
        manageOpeningParenthesizedExpression(stringLiteral, numberOfParens);
    }
    this.scribe.checkNLSTag(stringLiteral.sourceStart);
    this.scribe.printNextToken(TerminalTokens.TokenNameStringLiteral);
    this.scribe.printComment(CodeFormatter.K_UNKNOWN, Scribe.BASIC_TRAILING_COMMENT);
    if (numberOfParens > 0) {
        manageClosingParenthesizedExpression(stringLiteral, numberOfParens);
    }
    return false;
}
项目:xapi    文件:GwtAstBuilder.java   
@Override
public void endVisit(StringLiteral x, BlockScope scope) {
  try {
    SourceInfo info = makeSourceInfo(x);
    push(getStringLiteral(info, x.constant.stringValue()));
  } catch (Throwable e) {
    throw translateException(x, e);
  }
}
项目:lombok    文件:HandleConstructor.java   
private static Annotation[] createConstructorProperties(ASTNode source, Collection<EclipseNode> fields) {
    if (fields.isEmpty()) return null;

    int pS = source.sourceStart, pE = source.sourceEnd;
    long p = (long)pS << 32 | pE;
    long[] poss = new long[3];
    Arrays.fill(poss, p);
    QualifiedTypeReference constructorPropertiesType = new QualifiedTypeReference(JAVA_BEANS_CONSTRUCTORPROPERTIES, poss);
    setGeneratedBy(constructorPropertiesType, source);
    SingleMemberAnnotation ann = new SingleMemberAnnotation(constructorPropertiesType, pS);
    ann.declarationSourceEnd = pE;

    ArrayInitializer fieldNames = new ArrayInitializer();
    fieldNames.sourceStart = pS;
    fieldNames.sourceEnd = pE;
    fieldNames.expressions = new Expression[fields.size()];

    int ctr = 0;
    for (EclipseNode field : fields) {
        fieldNames.expressions[ctr] = new StringLiteral(field.getName().toCharArray(), pS, pE, 0);
        setGeneratedBy(fieldNames.expressions[ctr], source);
        ctr++;
    }

    ann.memberValue = fieldNames;
    setGeneratedBy(ann, source);
    setGeneratedBy(ann.memberValue, source);
    return new Annotation[] { ann };
}
项目:lombok-ianchiu    文件:EclipseHandlerUtil.java   
public static Annotation[] addGenerated(EclipseNode node, ASTNode source, Annotation[] originalAnnotationArray) {
    if (Boolean.FALSE.equals(node.getAst().readConfiguration(ConfigurationKeys.ADD_GENERATED_ANNOTATIONS))) return originalAnnotationArray;
    return addAnnotation(source, originalAnnotationArray, JAVAX_ANNOTATION_GENERATED, new StringLiteral(LOMBOK, 0, 0, 0));
}
项目:lombok-ianchiu    文件:EclipseHandlerUtil.java   
/**
 * Generates a new statement that checks if the given variable is null, and if so, throws a specified exception with the
 * variable name as message.
 * 
 * @param exName The name of the exception to throw; normally {@code java.lang.NullPointerException}.
 */
public static Statement generateNullCheck(AbstractVariableDeclaration variable, EclipseNode sourceNode) {
    NullCheckExceptionType exceptionType = sourceNode.getAst().readConfiguration(ConfigurationKeys.NON_NULL_EXCEPTION_TYPE);
    if (exceptionType == null) exceptionType = NullCheckExceptionType.NULL_POINTER_EXCEPTION;

    ASTNode source = sourceNode.get();

    int pS = source.sourceStart, pE = source.sourceEnd;
    long p = (long)pS << 32 | pE;

    if (isPrimitive(variable.type)) return null;
    AllocationExpression exception = new AllocationExpression();
    setGeneratedBy(exception, source);
    int partCount = 1;
    String exceptionTypeStr = exceptionType.getExceptionType();
    for (int i = 0; i < exceptionTypeStr.length(); i++) if (exceptionTypeStr.charAt(i) == '.') partCount++;
    long[] ps = new long[partCount];
    Arrays.fill(ps, 0L);
    exception.type = new QualifiedTypeReference(fromQualifiedName(exceptionTypeStr), ps);
    setGeneratedBy(exception.type, source);
    exception.arguments = new Expression[] {
            new StringLiteral(exceptionType.toExceptionMessage(new String(variable.name)).toCharArray(), pS, pE, 0)
    };
    setGeneratedBy(exception.arguments[0], source);
    ThrowStatement throwStatement = new ThrowStatement(exception, pS, pE);
    setGeneratedBy(throwStatement, source);

    SingleNameReference varName = new SingleNameReference(variable.name, p);
    setGeneratedBy(varName, source);
    NullLiteral nullLiteral = new NullLiteral(pS, pE);
    setGeneratedBy(nullLiteral, source);
    EqualExpression equalExpression = new EqualExpression(varName, nullLiteral, OperatorIds.EQUAL_EQUAL);
    equalExpression.sourceStart = pS; equalExpression.statementEnd = equalExpression.sourceEnd = pE;
    setGeneratedBy(equalExpression, source);
    Block throwBlock = new Block(0);
    throwBlock.statements = new Statement[] {throwStatement};
    throwBlock.sourceStart = pS; throwBlock.sourceEnd = pE;
    setGeneratedBy(throwBlock, source);
    IfStatement ifStatement = new IfStatement(equalExpression, throwBlock, 0, 0);
    setGeneratedBy(ifStatement, source);
    return ifStatement;
}
项目:lombok-ianchiu    文件:SetGeneratedByVisitor.java   
@Override public boolean visit(StringLiteral node, BlockScope scope) {
    fixPositions(setGeneratedBy(node, source));
    return super.visit(node, scope);
}
项目:EasyMPermission    文件:EclipseHandlerUtil.java   
public static Annotation[] addGenerated(EclipseNode node, ASTNode source, Annotation[] originalAnnotationArray) {
    if (Boolean.FALSE.equals(node.getAst().readConfiguration(ConfigurationKeys.ADD_GENERATED_ANNOTATIONS))) return originalAnnotationArray;
    return addAnnotation(source, originalAnnotationArray, JAVAX_ANNOTATION_GENERATED, new StringLiteral(LOMBOK, 0, 0, 0));
}
项目:EasyMPermission    文件:EclipseHandlerUtil.java   
/**
 * Generates a new statement that checks if the given variable is null, and if so, throws a specified exception with the
 * variable name as message.
 * 
 * @param exName The name of the exception to throw; normally {@code java.lang.NullPointerException}.
 */
public static Statement generateNullCheck(AbstractVariableDeclaration variable, EclipseNode sourceNode) {
    NullCheckExceptionType exceptionType = sourceNode.getAst().readConfiguration(ConfigurationKeys.NON_NULL_EXCEPTION_TYPE);
    if (exceptionType == null) exceptionType = NullCheckExceptionType.NULL_POINTER_EXCEPTION;

    ASTNode source = sourceNode.get();

    int pS = source.sourceStart, pE = source.sourceEnd;
    long p = (long)pS << 32 | pE;

    if (isPrimitive(variable.type)) return null;
    AllocationExpression exception = new AllocationExpression();
    setGeneratedBy(exception, source);
    int partCount = 1;
    String exceptionTypeStr = exceptionType.getExceptionType();
    for (int i = 0; i < exceptionTypeStr.length(); i++) if (exceptionTypeStr.charAt(i) == '.') partCount++;
    long[] ps = new long[partCount];
    Arrays.fill(ps, 0L);
    exception.type = new QualifiedTypeReference(fromQualifiedName(exceptionTypeStr), ps);
    setGeneratedBy(exception.type, source);
    exception.arguments = new Expression[] {
            new StringLiteral(exceptionType.toExceptionMessage(new String(variable.name)).toCharArray(), pS, pE, 0)
    };
    setGeneratedBy(exception.arguments[0], source);
    ThrowStatement throwStatement = new ThrowStatement(exception, pS, pE);
    setGeneratedBy(throwStatement, source);

    SingleNameReference varName = new SingleNameReference(variable.name, p);
    setGeneratedBy(varName, source);
    NullLiteral nullLiteral = new NullLiteral(pS, pE);
    setGeneratedBy(nullLiteral, source);
    EqualExpression equalExpression = new EqualExpression(varName, nullLiteral, OperatorIds.EQUAL_EQUAL);
    equalExpression.sourceStart = pS; equalExpression.statementEnd = equalExpression.sourceEnd = pE;
    setGeneratedBy(equalExpression, source);
    Block throwBlock = new Block(0);
    throwBlock.statements = new Statement[] {throwStatement};
    throwBlock.sourceStart = pS; throwBlock.sourceEnd = pE;
    setGeneratedBy(throwBlock, source);
    IfStatement ifStatement = new IfStatement(equalExpression, throwBlock, 0, 0);
    setGeneratedBy(ifStatement, source);
    return ifStatement;
}
项目:EasyMPermission    文件:SetGeneratedByVisitor.java   
@Override public boolean visit(StringLiteral node, BlockScope scope) {
    fixPositions(setGeneratedBy(node, source));
    return super.visit(node, scope);
}
项目:Eclipse-Postfix-Code-Completion    文件:BinaryExpressionFragmentBuilder.java   
public boolean visit(StringLiteral stringLiteral, BlockScope scope) {
    addRealFragment(stringLiteral);
    return false;
}
项目:Eclipse-Postfix-Code-Completion    文件:Parser.java   
protected StringLiteral createStringLiteral(char[] token, int start, int end, int lineNumber) {
    return new StringLiteral(token, start, end, lineNumber);
}
项目:Eclipse-Postfix-Code-Completion    文件:Parser.java   
public void recoveryTokenCheck() {
    switch (this.currentToken) {
        case TokenNameStringLiteral :
            if (this.recordStringLiterals &&
                    this.checkExternalizeStrings &&
                    this.lastPosistion < this.scanner.currentPosition &&
                    !this.statementRecoveryActivated) {
                StringLiteral stringLiteral = createStringLiteral(
                    this.scanner.getCurrentTokenSourceString(),
                    this.scanner.startPosition,
                    this.scanner.currentPosition - 1,
                    Util.getLineNumber(this.scanner.startPosition, this.scanner.lineEnds, 0, this.scanner.linePtr));
                this.compilationUnit.recordStringLiteral(stringLiteral, this.currentElement != null);
            }
            break;
        case TokenNameLBRACE :
            RecoveredElement newElement = null;
            if(!this.ignoreNextOpeningBrace) {
                newElement = this.currentElement.updateOnOpeningBrace(this.scanner.startPosition - 1, this.scanner.currentPosition - 1);
            }
            this.lastCheckPoint = this.scanner.currentPosition;
            if (newElement != null){ // null means nothing happened
                this.restartRecovery = true; // opening brace detected
                this.currentElement = newElement;
            }
            break;

        case TokenNameRBRACE :
            this.rBraceStart = this.scanner.startPosition - 1;
            this.rBraceEnd = this.scanner.currentPosition - 1;
            this.endPosition = flushCommentsDefinedPriorTo(this.rBraceEnd);
            newElement =
                this.currentElement.updateOnClosingBrace(this.scanner.startPosition, this.rBraceEnd);
                this.lastCheckPoint = this.scanner.currentPosition;
            if (newElement != this.currentElement){
                this.currentElement = newElement;
//              if (newElement instanceof RecoveredField && this.dietInt <= 0) {
//                  if (((RecoveredField)newElement).fieldDeclaration.type == null) { // enum constant
//                      this.isInsideEnumConstantPart = true; // restore status
//                  }
//              }
            }
            break;
        case TokenNameSEMICOLON :
            this.endStatementPosition = this.scanner.currentPosition - 1;
            this.endPosition = this.scanner.startPosition - 1;
            RecoveredType currentType = currentRecoveryType();
            if(currentType != null) {
                currentType.insideEnumConstantPart = false;
            }
            //$FALL-THROUGH$
        default : {
            if (this.rBraceEnd > this.rBraceSuccessorStart && this.scanner.currentPosition != this.scanner.startPosition){
                this.rBraceSuccessorStart = this.scanner.startPosition;
            }
            break;
        }
    }
    this.ignoreNextOpeningBrace = false;
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:BinaryExpressionFragmentBuilder.java   
public boolean visit(StringLiteral stringLiteral, BlockScope scope) {
    addRealFragment(stringLiteral);
    return false;
}
项目:xapi    文件:GwtAstBuilder.java   
@Override
public void endVisit(ExtendedStringLiteral x, BlockScope scope) {
  endVisit((StringLiteral) x, scope);
}
项目:lombok    文件:SetGeneratedByVisitor.java   
@Override public boolean visit(StringLiteral node, BlockScope scope) {
    setGeneratedBy(node, source);
    applyOffsetExpression(node);
    return super.visit(node, scope);
}