8274161: Cleanup redundant casts in jdk.compiler
Reviewed-by: vromero
This commit is contained in:
parent
951247c8cb
commit
077b2de088
@ -3954,14 +3954,14 @@ public class Attr extends JCTree.Visitor {
|
||||
: chk.checkNonVoid(tree.arg.pos(), attribExpr(tree.arg, env));
|
||||
|
||||
// Find operator.
|
||||
Symbol operator = tree.operator = operators.resolveUnary(tree, tree.getTag(), argtype);
|
||||
OperatorSymbol operator = tree.operator = operators.resolveUnary(tree, tree.getTag(), argtype);
|
||||
Type owntype = types.createErrorType(tree.type);
|
||||
if (operator != operators.noOpSymbol &&
|
||||
!argtype.isErroneous()) {
|
||||
owntype = (tree.getTag().isIncOrDecUnaryOp())
|
||||
? tree.arg.type
|
||||
: operator.type.getReturnType();
|
||||
int opc = ((OperatorSymbol)operator).opcode;
|
||||
int opc = operator.opcode;
|
||||
|
||||
// If the argument is constant, fold it.
|
||||
if (argtype.constValue() != null) {
|
||||
@ -4008,13 +4008,13 @@ public class Attr extends JCTree.Visitor {
|
||||
matchBindings = matchBindingsComputer.binary(tree, lhsBindings, matchBindings);
|
||||
|
||||
// Find operator.
|
||||
Symbol operator = tree.operator = operators.resolveBinary(tree, tree.getTag(), left, right);
|
||||
OperatorSymbol operator = tree.operator = operators.resolveBinary(tree, tree.getTag(), left, right);
|
||||
Type owntype = types.createErrorType(tree.type);
|
||||
if (operator != operators.noOpSymbol &&
|
||||
!left.isErroneous() &&
|
||||
!right.isErroneous()) {
|
||||
owntype = operator.type.getReturnType();
|
||||
int opc = ((OperatorSymbol)operator).opcode;
|
||||
int opc = operator.opcode;
|
||||
// If both arguments are constants, fold them.
|
||||
if (left.constValue() != null && right.constValue() != null) {
|
||||
Type ctype = cfolder.fold2(opc, left, right);
|
||||
@ -5498,11 +5498,11 @@ public class Attr extends JCTree.Visitor {
|
||||
c.owner.kind != PCK &&
|
||||
((c.flags() & STATIC) == 0 || c.name == names.empty) &&
|
||||
(TreeInfo.flags(l.head) & (STATIC | INTERFACE)) != 0) {
|
||||
Symbol sym = null;
|
||||
VarSymbol sym = null;
|
||||
if (l.head.hasTag(VARDEF)) sym = ((JCVariableDecl) l.head).sym;
|
||||
if (sym == null ||
|
||||
sym.kind != VAR ||
|
||||
((VarSymbol) sym).getConstValue() == null)
|
||||
sym.getConstValue() == null)
|
||||
log.error(l.head.pos(), Errors.IclsCantHaveStaticDecl(c));
|
||||
}
|
||||
}
|
||||
|
@ -424,14 +424,14 @@ public class LambdaToMethod extends TreeTranslator {
|
||||
//add captured locals
|
||||
for (Symbol fv : localContext.getSymbolMap(CAPTURED_VAR).keySet()) {
|
||||
if (fv != localContext.self) {
|
||||
JCTree captured_local = make.Ident(fv).setType(fv.type);
|
||||
syntheticInits.append((JCExpression) captured_local);
|
||||
JCExpression captured_local = make.Ident(fv).setType(fv.type);
|
||||
syntheticInits.append(captured_local);
|
||||
}
|
||||
}
|
||||
// add captured outer this instances (used only when `this' capture itself is illegal)
|
||||
for (Symbol fv : localContext.getSymbolMap(CAPTURED_OUTER_THIS).keySet()) {
|
||||
JCTree captured_local = make.QualThis(fv.type);
|
||||
syntheticInits.append((JCExpression) captured_local);
|
||||
JCExpression captured_local = make.QualThis(fv.type);
|
||||
syntheticInits.append(captured_local);
|
||||
}
|
||||
|
||||
//then, determine the arguments to the indy call
|
||||
@ -1184,13 +1184,13 @@ public class LambdaToMethod extends TreeTranslator {
|
||||
syms.stringType,
|
||||
syms.methodTypeType).appendList(staticArgs.map(types::constantType));
|
||||
|
||||
Symbol bsm = rs.resolveInternalMethod(pos, attrEnv, site,
|
||||
MethodSymbol bsm = rs.resolveInternalMethod(pos, attrEnv, site,
|
||||
bsmName, bsm_staticArgs, List.nil());
|
||||
|
||||
DynamicMethodSymbol dynSym =
|
||||
new DynamicMethodSymbol(methName,
|
||||
syms.noSymbol,
|
||||
((MethodSymbol)bsm).asHandle(),
|
||||
bsm.asHandle(),
|
||||
indyType,
|
||||
staticArgs.toArray(new LoadableConstant[staticArgs.length()]));
|
||||
JCFieldAccess qualifier = make.Select(make.QualIdent(site.tsym), bsmName);
|
||||
|
@ -2369,7 +2369,7 @@ public class Lower extends TreeTranslator {
|
||||
enumDefs.append(make.VarDef(valuesVar, make.App(make.QualIdent(valuesMethod))));
|
||||
tree.sym.members().enter(valuesVar);
|
||||
|
||||
Symbol valuesSym = lookupMethod(tree.pos(), names.values,
|
||||
MethodSymbol valuesSym = lookupMethod(tree.pos(), names.values,
|
||||
tree.type, List.nil());
|
||||
List<JCStatement> valuesBody;
|
||||
if (useClone()) {
|
||||
@ -2420,7 +2420,7 @@ public class Lower extends TreeTranslator {
|
||||
}
|
||||
|
||||
JCMethodDecl valuesDef =
|
||||
make.MethodDef((MethodSymbol)valuesSym, make.Block(0, valuesBody));
|
||||
make.MethodDef(valuesSym, make.Block(0, valuesBody));
|
||||
|
||||
enumDefs.append(valuesDef);
|
||||
|
||||
@ -2635,7 +2635,7 @@ public class Lower extends TreeTranslator {
|
||||
Name bootstrapName,
|
||||
Name argName,
|
||||
boolean isStatic) {
|
||||
Symbol bsm = rs.resolveInternalMethod(tree.pos(), attrEnv, site,
|
||||
MethodSymbol bsm = rs.resolveInternalMethod(tree.pos(), attrEnv, site,
|
||||
bootstrapName, staticArgTypes, List.nil());
|
||||
|
||||
MethodType indyType = msym.type.asMethodType();
|
||||
@ -2647,7 +2647,7 @@ public class Lower extends TreeTranslator {
|
||||
);
|
||||
DynamicMethodSymbol dynSym = new DynamicMethodSymbol(argName,
|
||||
syms.noSymbol,
|
||||
((MethodSymbol)bsm).asHandle(),
|
||||
bsm.asHandle(),
|
||||
indyType,
|
||||
staticArgValues);
|
||||
JCFieldAccess qualifier = make.Select(make.QualIdent(site.tsym), argName);
|
||||
|
@ -371,7 +371,7 @@ public class TransPatterns extends TreeTranslator {
|
||||
|
||||
boolean enumSelector = seltype.tsym.isEnum();
|
||||
Name bootstrapName = enumSelector ? names.enumSwitch : names.typeSwitch;
|
||||
Symbol bsm = rs.resolveInternalMethod(tree.pos(), env, syms.switchBootstrapsType,
|
||||
MethodSymbol bsm = rs.resolveInternalMethod(tree.pos(), env, syms.switchBootstrapsType,
|
||||
bootstrapName, staticArgTypes, List.nil());
|
||||
|
||||
MethodType indyType = new MethodType(
|
||||
@ -382,7 +382,7 @@ public class TransPatterns extends TreeTranslator {
|
||||
);
|
||||
DynamicMethodSymbol dynSym = new DynamicMethodSymbol(bootstrapName,
|
||||
syms.noSymbol,
|
||||
((MethodSymbol)bsm).asHandle(),
|
||||
bsm.asHandle(),
|
||||
indyType,
|
||||
staticArgValues);
|
||||
|
||||
|
@ -371,7 +371,7 @@ public abstract class StringConcat {
|
||||
syms.stringType,
|
||||
syms.methodTypeType);
|
||||
|
||||
Symbol bsm = rs.resolveInternalMethod(pos,
|
||||
MethodSymbol bsm = rs.resolveInternalMethod(pos,
|
||||
gen.getAttrEnv(),
|
||||
syms.stringConcatFactory,
|
||||
names.makeConcat,
|
||||
@ -380,7 +380,7 @@ public abstract class StringConcat {
|
||||
|
||||
Symbol.DynamicMethodSymbol dynSym = new Symbol.DynamicMethodSymbol(names.makeConcat,
|
||||
syms.noSymbol,
|
||||
((MethodSymbol)bsm).asHandle(),
|
||||
bsm.asHandle(),
|
||||
indyType,
|
||||
List.nil().toArray(new LoadableConstant[0]));
|
||||
|
||||
@ -487,7 +487,7 @@ public abstract class StringConcat {
|
||||
.append(syms.stringType)
|
||||
.appendList(constTypes);
|
||||
|
||||
Symbol bsm = rs.resolveInternalMethod(pos,
|
||||
MethodSymbol bsm = rs.resolveInternalMethod(pos,
|
||||
gen.getAttrEnv(),
|
||||
syms.stringConcatFactory,
|
||||
names.makeConcatWithConstants,
|
||||
@ -496,7 +496,7 @@ public abstract class StringConcat {
|
||||
|
||||
Symbol.DynamicMethodSymbol dynSym = new Symbol.DynamicMethodSymbol(names.makeConcatWithConstants,
|
||||
syms.noSymbol,
|
||||
((MethodSymbol)bsm).asHandle(),
|
||||
bsm.asHandle(),
|
||||
indyType,
|
||||
List.of(LoadableConstant.String(recipe))
|
||||
.appendList(constants).toArray(new LoadableConstant[constants.size()]));
|
||||
|
Loading…
Reference in New Issue
Block a user