From 5e616b2d88b3c00c220e7725a77fabef6c0bf9cc Mon Sep 17 00:00:00 2001 From: Graham Date: Sun, 11 Aug 2019 20:48:23 +0100 Subject: [PATCH] Use Preconditions.checkArgument() in NegateExprVisitor --- .../java/dev/openrs2/deob/ast/visitor/NegateExprVisitor.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/deob-ast/src/main/java/dev/openrs2/deob/ast/visitor/NegateExprVisitor.java b/deob-ast/src/main/java/dev/openrs2/deob/ast/visitor/NegateExprVisitor.java index 5a48ec3827..f9fc46d57a 100644 --- a/deob-ast/src/main/java/dev/openrs2/deob/ast/visitor/NegateExprVisitor.java +++ b/deob-ast/src/main/java/dev/openrs2/deob/ast/visitor/NegateExprVisitor.java @@ -8,14 +8,13 @@ import com.github.javaparser.ast.expr.EnclosedExpr; import com.github.javaparser.ast.expr.Expression; import com.github.javaparser.ast.expr.UnaryExpr; import com.github.javaparser.ast.visitor.GenericVisitorWithDefaults; +import com.google.common.base.Preconditions; // TODO(gpe): need to be careful about operator precedence/EnclosedExpr public final class NegateExprVisitor extends GenericVisitorWithDefaults { @Override public Expression defaultAction(Node n, Void arg) { - if (!(n instanceof Expression)) { - throw new IllegalArgumentException(); - } + Preconditions.checkArgument(n instanceof Expression); return new UnaryExpr((Expression) n, UnaryExpr.Operator.LOGICAL_COMPLEMENT); }