List of usage examples for org.eclipse.jdt.internal.compiler.ast CastExpression tagAsNeedCheckCast
@Override public void tagAsNeedCheckCast()
From source file:org.eclipse.objectteams.otdt.internal.core.compiler.util.AstGenerator.java
License:Open Source License
/** * Create a cast expression from its elements (reference types only). * Perform necessary internal initializations without calling resolveType() * @param expr/*from ww w . j a v a 2s. c om*/ * @param type * @param kind one of CastExpression.{DO_WRAP,NEED_CLASS,RAW} * * @return null is used to signal no cast created (because expr is 'this'). */ public CastExpression resolvedCastExpression(Expression expr, TypeBinding type, int kind) { if (expr instanceof ThisReference) return null; // never useful to cast 'this'! TypeReference typeRef = typeReference(type); typeRef.sourceStart = this.sourceStart; typeRef.sourceEnd = this.sourceEnd; typeRef.resolvedType = type; CastExpression cast = new CastExpression(expr, typeRef, kind); typeRef.resolvedType = cast.resolvedType = type; cast.constant = Constant.NotAConstant; cast.tagAsNeedCheckCast(); return setPos(cast); }