Package org.eclipse.jdt.core.dom

Examples of org.eclipse.jdt.core.dom.CastExpression


     *
     * @param type result type
     * @return expression
     */
    public CastBuilder buildCast(Type type) {
        CastExpression castex = getAST().newCastExpression();
        castex.setType(type);
        return new CastBuilder(this, castex);
    }
View Full Code Here


        MethodInvocation extraSetCheckpoint = ast.newMethodInvocation();
        extraSetCheckpoint.setExpression(newNode);
        extraSetCheckpoint.setName(ast.newSimpleName(setCheckpointName));
        extraSetCheckpoint.arguments().add(ast.newSimpleName(CHECKPOINT_NAME));

        CastExpression typeCast = ast.newCastExpression();
        typeCast.setExpression(extraSetCheckpoint);
        typeCast.setType(createType(ast, getClassName(type.getName(), state,
                root)));
        replaceNode(node, typeCast);
    }
View Full Code Here

                    Expression rightHandSide;

                    if (fieldType.isPrimitive()) {
                        rightHandSide = restoreMethodCall;
                    } else {
                        CastExpression castExpression = ast.newCastExpression();
                        String typeName = getClassName(fieldType.getName(),
                                state, root);
                        castExpression.setType(createType(ast, typeName));
                        castExpression.setExpression(restoreMethodCall);
                        rightHandSide = castExpression;
                    }

                    Assignment assignment = ast.newAssignment();
                    assignment.setLeftHandSide(ast.newSimpleName(fieldName));
View Full Code Here

        // Add the right-hand side expression to the argument list.
        Type rightHandType = Type.getType(rightHand);

        if (!isSpecial && type.isPrimitive() && !type.equals(rightHandType)) {
            // Require an explicit conversion.
            CastExpression castExpression = ast.newCastExpression();
            castExpression.setType(createType(ast, type.getName()));
            castExpression.setExpression((Expression) ASTNode.copySubtree(ast,
                    rightHand));
            rightHand = castExpression;
        } else {
            rightHand = (Expression) ASTNode.copySubtree(ast, rightHand);
View Full Code Here

    else if(e instanceof ParenthesizedExpression){
      ParenthesizedExpression ex=(ParenthesizedExpression)e;
      processExpression(parent, ex.getExpression(), cu, resource, stack, monitor, HistoryDefinitionLocation.UNDEFINED,false);
    }
    else if(e instanceof CastExpression){
      CastExpression cex=(CastExpression)e;
      processExpression(parent, cex.getExpression(), cu, resource, stack, monitor, HistoryDefinitionLocation.UNDEFINED,false);
    }
    else if(e instanceof ArrayAccess) {
      ArrayAccess ae=(ArrayAccess)e;
     
      HistoryDefinitionLocation arrAccess;
View Full Code Here

       
        refresh();
       
      }
       else if(covering instanceof CastExpression) {
         CastExpression ae=(CastExpression)covering;
         HistoryDefinitionLocation dl = new HistoryDefinitionLocation(
              ae.toString(),
              (IFile)resource,
              unit.getLineNumber(0),
              covering,null, HistoryDefinitionLocation.INITIAL);
          processExpression(dl, ae, unit, resource, new LinkedList<MethodInvocation>(), monitor, HistoryDefinitionLocation.CALL,true);
          setCurrentInput(dl);
          addHistoryEntry(dl);
          fContentProvider.addElement(dl);
          refresh();
        }
       else if(covering instanceof ClassInstanceCreation) {
         ClassInstanceCreation ae=(ClassInstanceCreation)covering;
         HistoryDefinitionLocation dl = new HistoryDefinitionLocation(
              ae.toString(),
              (IFile)resource,
              unit.getLineNumber(0),
              covering,null, HistoryDefinitionLocation.CLASS_INSTANCE_CREATION);
          processExpression(dl, ae, unit, resource, new LinkedList<MethodInvocation>(), monitor, HistoryDefinitionLocation.CALL,true);
          setCurrentInput(dl);
View Full Code Here

      // dead expression, it's valid just goes no where.
      break;
    }

    case ASTNode.CAST_EXPRESSION: {
      final CastExpression cast = (CastExpression) node;
      throw new NonEnumerizableCastExpression(Messages.ASTNodeProcessor_IllegalNodeContext,
          node, cast.getExpression().resolveTypeBinding(), cast
              .getType().resolveBinding());
    }

    case ASTNode.ENUM_CONSTANT_DECLARATION:
    case ASTNode.IF_STATEMENT:
View Full Code Here

      }
      break;
    }

    case ASTNode.CAST_EXPRESSION: {
      final CastExpression cast = (CastExpression) node;
      throw new NonEnumerizableCastExpression(Messages.ASTNodeProcessor_IllegalNodeContext,
          node, cast.getExpression().resolveTypeBinding(), cast
              .getType().resolveBinding());
    }

    case ASTNode.ENUM_CONSTANT_DECLARATION:
    case ASTNode.IF_STATEMENT:
View Full Code Here

        MethodInvocation cloneInvoke = invokeClone(workingUnit, original);



        // cast the result to the right type
        CastExpression castRet = workingUnit.getAST().newCastExpression();
        castRet.setExpression(cloneInvoke);
        Type retType = (Type) ASTNode.copySubtree(castRet.getAST(), method.getReturnType2());
        castRet.setType(retType);


        ConditionalExpression conditionalExpression = workingUnit.getAST().newConditionalExpression();
        conditionalExpression.setElseExpression(castRet);
        conditionalExpression.setThenExpression(workingUnit.getAST().newNullLiteral() );
View Full Code Here

TOP

Related Classes of org.eclipse.jdt.core.dom.CastExpression

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.