|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.eclipse.jdt.internal.compiler.ast.ASTNode
org.eclipse.jdt.internal.compiler.ast.Statement
org.eclipse.jdt.internal.compiler.ast.Expression
org.eclipse.jdt.internal.compiler.ast.CastExpression
public class CastExpression
| Field Summary | |
|---|---|
TypeBinding |
expectedType
|
Expression |
expression
|
TypeReference |
type
|
| Fields inherited from class org.eclipse.jdt.internal.compiler.ast.Expression |
|---|
constant, implicitConversion, resolvedType, statementEnd |
| Fields inherited from class org.eclipse.jdt.internal.compiler.ast.Statement |
|---|
COMPLAINED_FAKE_REACHABLE, COMPLAINED_UNREACHABLE, NOT_COMPLAINED |
| Constructor Summary | |
|---|---|
CastExpression(Expression expression,
TypeReference type)
|
|
| Method Summary | |
|---|---|
FlowInfo |
analyseCode(BlockScope currentScope,
FlowContext flowContext,
FlowInfo flowInfo)
|
static void |
checkNeedForArgumentCast(BlockScope scope,
int operator,
int operatorSignature,
Expression expression,
int expressionTypeId)
Only complain for identity cast, since other type of casts may be useful: e.g. |
static void |
checkNeedForArgumentCasts(BlockScope scope,
Expression receiver,
TypeBinding receiverType,
MethodBinding binding,
Expression[] arguments,
TypeBinding[] argumentTypes,
InvocationSite invocationSite)
Cast expressions will considered as useful if removing them all would actually bind to a different method (no fine grain analysis on per casted argument basis, simply separate widening cast from narrowing ones) |
static void |
checkNeedForArgumentCasts(BlockScope scope,
int operator,
int operatorSignature,
Expression left,
int leftTypeId,
boolean leftIsCast,
Expression right,
int rightTypeId,
boolean rightIsCast)
Check binary operator casted arguments |
static void |
checkNeedForAssignedCast(BlockScope scope,
TypeBinding expectedType,
CastExpression rhs)
Complain if assigned expression is cast, but not actually used as such, e.g. |
static void |
checkNeedForCastCast(BlockScope scope,
CastExpression enclosingCast)
Complain if cast expression is cast, but not actually needed, int i = (int)(Integer) 12; Note that this (int) cast is however needed: Integer i = 0; char c = (char)((int) i); |
static void |
checkNeedForEnclosingInstanceCast(BlockScope scope,
Expression enclosingInstance,
TypeBinding enclosingInstanceType,
TypeBinding memberType)
Casting an enclosing instance will considered as useful if removing it would actually bind to a different type |
boolean |
checkUnsafeCast(Scope scope,
TypeBinding castType,
TypeBinding expressionType,
TypeBinding match,
boolean isNarrowing)
|
void |
generateCode(BlockScope currentScope,
CodeStream codeStream,
boolean valueRequired)
Cast expression code generation |
Expression |
innermostCastedExpression()
|
LocalVariableBinding |
localVariableBinding()
Returns the local variable referenced by this node. |
int |
nullStatus(FlowInfo flowInfo)
|
Constant |
optimizedBooleanConstant()
Constant usable for bytecode pattern optimizations, but cannot be inlined since it is not strictly equivalent to the definition of constant expressions. |
StringBuffer |
printExpression(int indent,
StringBuffer output)
|
TypeBinding |
resolveType(BlockScope scope)
Resolve the type of this expression in the context of a blockScope |
void |
setExpectedType(TypeBinding expectedType)
Record the type expectation before this expression is typechecked. |
void |
tagAsNeedCheckCast()
|
void |
tagAsUnnecessaryCast(Scope scope,
TypeBinding castType)
Record the fact a cast expression got detected as being unnecessary. |
void |
traverse(ASTVisitor visitor,
BlockScope blockScope)
Traverse an expression in the context of a blockScope |
| Methods inherited from class org.eclipse.jdt.internal.compiler.ast.Expression |
|---|
analyseCode, checkCastTypesCompatibility, checkNPE, computeConversion, forcedToBeRaw, generateCode, generateOptimizedBoolean, generateOptimizedStringConcatenation, generateOptimizedStringConcatenationCreation, getDirectBinding, isCompactableOperation, isConstantValueOfTypeAssignableToType, isConstantValueRepresentable, isTypeReference, markAsNonNull, postConversionType, print, printStatement, resolve, resolveType, resolveTypeExpecting, reusableJSRTarget, toTypeReference, traverse |
| Methods inherited from class org.eclipse.jdt.internal.compiler.ast.Statement |
|---|
branchChainTo, checkAgainstNullAnnotation, complainIfUnreachable, expectedType, generateArguments, isBoxingCompatible, isEmptyBlock, isKnowDeadCodePattern, isValidJavaStatement, resolveCase |
| Methods inherited from class org.eclipse.jdt.internal.compiler.ast.ASTNode |
|---|
checkInvocationArguments, concreteStatement, isFieldUseDeprecated, isImplicitThis, isMethodUseDeprecated, isSuper, isThis, isTypeUseDeprecated, printAnnotations, printIndent, printModifiers, resolveAnnotations, resolveDeprecatedAnnotations, sourceEnd, sourceStart, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public Expression expression
public TypeReference type
public TypeBinding expectedType
| Constructor Detail |
|---|
public CastExpression(Expression expression,
TypeReference type)
| Method Detail |
|---|
public FlowInfo analyseCode(BlockScope currentScope,
FlowContext flowContext,
FlowInfo flowInfo)
analyseCode in class Expression
public static void checkNeedForAssignedCast(BlockScope scope,
TypeBinding expectedType,
CastExpression rhs)
public static void checkNeedForCastCast(BlockScope scope,
CastExpression enclosingCast)
public static void checkNeedForEnclosingInstanceCast(BlockScope scope,
Expression enclosingInstance,
TypeBinding enclosingInstanceType,
TypeBinding memberType)
public static void checkNeedForArgumentCast(BlockScope scope,
int operator,
int operatorSignature,
Expression expression,
int expressionTypeId)
public static void checkNeedForArgumentCasts(BlockScope scope,
Expression receiver,
TypeBinding receiverType,
MethodBinding binding,
Expression[] arguments,
TypeBinding[] argumentTypes,
InvocationSite invocationSite)
public static void checkNeedForArgumentCasts(BlockScope scope,
int operator,
int operatorSignature,
Expression left,
int leftTypeId,
boolean leftIsCast,
Expression right,
int rightTypeId,
boolean rightIsCast)
public boolean checkUnsafeCast(Scope scope,
TypeBinding castType,
TypeBinding expressionType,
TypeBinding match,
boolean isNarrowing)
checkUnsafeCast in class Expression
public void generateCode(BlockScope currentScope,
CodeStream codeStream,
boolean valueRequired)
generateCode in class ExpressioncurrentScope - org.eclipse.jdt.internal.compiler.lookup.BlockScopecodeStream - org.eclipse.jdt.internal.compiler.codegen.CodeStreamvalueRequired - booleanpublic Expression innermostCastedExpression()
public LocalVariableBinding localVariableBinding()
Expression
localVariableBinding in class ExpressionExpression.localVariableBinding()public int nullStatus(FlowInfo flowInfo)
nullStatus in class Expressionpublic Constant optimizedBooleanConstant()
Expression
optimizedBooleanConstant in class ExpressionExpression.optimizedBooleanConstant()
public StringBuffer printExpression(int indent,
StringBuffer output)
printExpression in class Expressionpublic TypeBinding resolveType(BlockScope scope)
Expression
resolveType in class Expressionpublic void setExpectedType(TypeBinding expectedType)
Expression
setExpectedType in class ExpressionexpectedType - The type denoting an expectation in the context of an assignment conversionExpression.setExpectedType(org.eclipse.jdt.internal.compiler.lookup.TypeBinding)public void tagAsNeedCheckCast()
tagAsNeedCheckCast in class ExpressionExpression.tagAsNeedCheckCast()
public void tagAsUnnecessaryCast(Scope scope,
TypeBinding castType)
Expression
tagAsUnnecessaryCast in class ExpressionExpression.tagAsUnnecessaryCast(Scope, TypeBinding)
public void traverse(ASTVisitor visitor,
BlockScope blockScope)
Expression
traverse in class Expression
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||