|
||||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||
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
| 字段摘要 | |
|---|---|
TypeBinding |
expectedType
|
Expression |
expression
|
TypeReference |
type
|
| 从类 org.eclipse.jdt.internal.compiler.ast.Expression 继承的字段 |
|---|
constant, implicitConversion, resolvedType, statementEnd |
| 从类 org.eclipse.jdt.internal.compiler.ast.Statement 继承的字段 |
|---|
COMPLAINED_FAKE_REACHABLE, COMPLAINED_UNREACHABLE, NOT_COMPLAINED |
| 构造方法摘要 | |
|---|---|
CastExpression(Expression expression,
TypeReference type)
|
|
| 方法摘要 | |
|---|---|
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 |
| 从类 org.eclipse.jdt.internal.compiler.ast.Statement 继承的方法 |
|---|
branchChainTo, checkAgainstNullAnnotation, complainIfUnreachable, expectedType, generateArguments, isBoxingCompatible, isEmptyBlock, isKnowDeadCodePattern, isValidJavaStatement, resolveCase |
| 从类 org.eclipse.jdt.internal.compiler.ast.ASTNode 继承的方法 |
|---|
checkInvocationArguments, concreteStatement, isFieldUseDeprecated, isImplicitThis, isMethodUseDeprecated, isSuper, isThis, isTypeUseDeprecated, printAnnotations, printIndent, printModifiers, resolveAnnotations, resolveDeprecatedAnnotations, sourceEnd, sourceStart, toString |
| 从类 java.lang.Object 继承的方法 |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| 字段详细信息 |
|---|
public Expression expression
public TypeReference type
public TypeBinding expectedType
| 构造方法详细信息 |
|---|
public CastExpression(Expression expression,
TypeReference type)
| 方法详细信息 |
|---|
public FlowInfo analyseCode(BlockScope currentScope,
FlowContext flowContext,
FlowInfo flowInfo)
Expression 中的 analyseCode
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)
Expression 中的 checkUnsafeCast
public void generateCode(BlockScope currentScope,
CodeStream codeStream,
boolean valueRequired)
Expression 中的 generateCodecurrentScope - org.eclipse.jdt.internal.compiler.lookup.BlockScopecodeStream - org.eclipse.jdt.internal.compiler.codegen.CodeStreamvalueRequired - booleanpublic Expression innermostCastedExpression()
public LocalVariableBinding localVariableBinding()
Expression 复制的描述
Expression 中的 localVariableBindingExpression.localVariableBinding()public int nullStatus(FlowInfo flowInfo)
Expression 中的 nullStatuspublic Constant optimizedBooleanConstant()
Expression 复制的描述
Expression 中的 optimizedBooleanConstantExpression.optimizedBooleanConstant()
public StringBuffer printExpression(int indent,
StringBuffer output)
Expression 中的 printExpressionpublic TypeBinding resolveType(BlockScope scope)
Expression 复制的描述
Expression 中的 resolveTypepublic void setExpectedType(TypeBinding expectedType)
Expression 复制的描述
Expression 中的 setExpectedTypeexpectedType - The type denoting an expectation in the context of an assignment conversionExpression.setExpectedType(org.eclipse.jdt.internal.compiler.lookup.TypeBinding)public void tagAsNeedCheckCast()
Expression 中的 tagAsNeedCheckCastExpression.tagAsNeedCheckCast()
public void tagAsUnnecessaryCast(Scope scope,
TypeBinding castType)
Expression 复制的描述
Expression 中的 tagAsUnnecessaryCastExpression.tagAsUnnecessaryCast(Scope, TypeBinding)
public void traverse(ASTVisitor visitor,
BlockScope blockScope)
Expression 复制的描述
Expression 中的 traverse
|
||||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||