Remove compiler warnings from raw Expression.accept usage

This commit is contained in:
Ruben Dijkstra 2015-02-12 22:06:14 +01:00
parent 3928a8b6ff
commit 7754e1653d
4 changed files with 9 additions and 9 deletions

View File

@ -72,7 +72,7 @@ public final class PathsExtractor implements Visitor<Void, List<Path<?>>> {
public Path<?> visit(Collection<?> exprs, List<Path<?>> paths) {
for (Object e : exprs) {
if (e instanceof Expression) {
((Expression) e).accept(this, paths);
((Expression<?>) e).accept(this, paths);
}
}
return null;

View File

@ -69,7 +69,7 @@ public class ReplaceVisitor<C> implements Visitor<Expression<?>, C> {
Path<?> parent = (Path)metadata.getParent().accept(this, context);
Object element = metadata.getElement();
if (element instanceof Expression<?>) {
element = ((Expression) element).accept(this, context);
element = ((Expression<?>) element).accept(this, context);
}
if (parent.equals(metadata.getParent()) && Objects.equal(element, metadata.getElement())) {
return expr;
@ -138,7 +138,7 @@ public class ReplaceVisitor<C> implements Visitor<Expression<?>, C> {
ImmutableList.Builder builder = ImmutableList.builder();
for (Object arg : expr.getArgs()) {
if (arg instanceof Expression) {
builder.add(((Expression)arg).accept(this, context));
builder.add(((Expression<?>)arg).accept(this, context));
} else {
builder.add(arg);
}

View File

@ -101,7 +101,7 @@ public abstract class SerializerBase<S extends SerializerBase<S>> implements Vis
public final S handle(Object arg) {
if (arg instanceof Expression) {
((Expression)arg).accept(this, null);
((Expression<?>)arg).accept(this, null);
} else {
visitConstant(arg);
}
@ -136,7 +136,7 @@ public abstract class SerializerBase<S extends SerializerBase<S>> implements Vis
for (final Template.Element element : template.getElements()) {
final Object rv = element.convert(args);
if (rv instanceof Expression) {
((Expression)rv).accept(this, null);
((Expression<?>)rv).accept(this, null);
} else if (element.isString()) {
builder.append(rv.toString());
} else {

View File

@ -60,12 +60,12 @@ public final class ToStringVisitor implements Visitor<String,Templates> {
if (precedence > -1 && rv instanceof Operation) {
if (precedence < templates.getPrecedence(((Operation<?>)rv).getOperator())) {
builder.append("(");
builder.append(((Expression)rv).accept(this, templates));
builder.append(((Expression<?>)rv).accept(this, templates));
builder.append(")");
continue;
}
}
builder.append(((Expression)rv).accept(this, templates));
builder.append(((Expression<?>)rv).accept(this, templates));
} else {
builder.append(rv.toString());
}
@ -93,7 +93,7 @@ public final class ToStringVisitor implements Visitor<String,Templates> {
for (Template.Element element : pattern.getElements()) {
Object rv = element.convert(args);
if (rv instanceof Expression) {
builder.append(((Expression)rv).accept(this, templates));
builder.append(((Expression<?>)rv).accept(this, templates));
} else {
builder.append(rv.toString());
}
@ -118,7 +118,7 @@ public final class ToStringVisitor implements Visitor<String,Templates> {
for (Template.Element element : expr.getTemplate().getElements()) {
Object rv = element.convert(expr.getArgs());
if (rv instanceof Expression) {
builder.append(((Expression)rv).accept(this, templates));
builder.append(((Expression<?>)rv).accept(this, templates));
} else {
builder.append(rv.toString());
}