|
||||||||||
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
|
Expression |
type
|
Fields inherited from class org.eclipse.jdt.internal.compiler.ast.Expression |
---|
constant, implicitConversion, resolvedType, statementEnd |
Constructor Summary | |
---|---|
CastExpression(Expression expression,
Expression 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()
|
boolean |
isDeclaredMonoNonNull()
|
boolean |
isDeclaredNonNull()
|
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. |
java.lang.StringBuffer |
printExpression(int indent,
java.lang.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, generateCode, generateOptimizedBoolean, generateOptimizedStringConcatenation, generateOptimizedStringConcatenationCreation, 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, complainIfUnreachable, generateArguments, isEmptyBlock, 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 |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public Expression expression
public Expression type
public TypeBinding expectedType
Constructor Detail |
---|
public CastExpression(Expression expression, Expression 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 Expression
currentScope
- org.eclipse.jdt.internal.compiler.lookup.BlockScopecodeStream
- org.eclipse.jdt.internal.compiler.codegen.CodeStreamvalueRequired
- booleanpublic Expression innermostCastedExpression()
public LocalVariableBinding localVariableBinding()
Expression
localVariableBinding
in class Expression
Expression.localVariableBinding()
public int nullStatus(FlowInfo flowInfo)
nullStatus
in class Expression
public Constant optimizedBooleanConstant()
Expression
optimizedBooleanConstant
in class Expression
Expression.optimizedBooleanConstant()
public java.lang.StringBuffer printExpression(int indent, java.lang.StringBuffer output)
printExpression
in class Expression
public TypeBinding resolveType(BlockScope scope)
Expression
resolveType
in class Expression
public void setExpectedType(TypeBinding expectedType)
Expression
setExpectedType
in class Expression
expectedType
- 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 Expression
Expression.tagAsNeedCheckCast()
public void tagAsUnnecessaryCast(Scope scope, TypeBinding castType)
Expression
tagAsUnnecessaryCast
in class Expression
Expression.tagAsUnnecessaryCast(Scope, TypeBinding)
public void traverse(ASTVisitor visitor, BlockScope blockScope)
Expression
traverse
in class Expression
public boolean isDeclaredNonNull()
isDeclaredNonNull
in class Expression
public boolean isDeclaredMonoNonNull()
isDeclaredMonoNonNull
in class Expression
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |