From 80a15c7851c6690e7a795906fc29c5e42b8d25a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bendeg=C3=BAz=20Nagy?= Date: Thu, 17 Aug 2017 18:11:37 +0200 Subject: [PATCH] Java, typeres: fix PR comments --- .../net/sourceforge/pmd/lang/java/ast/ASTExpression.java | 4 +++- .../typeresolution/typeinference/TypeInferenceResolver.java | 5 ++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTExpression.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTExpression.java index 6eb42b49b1..37b3f49ab4 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTExpression.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTExpression.java @@ -40,10 +40,12 @@ public class ASTExpression extends AbstractJavaTypeNode { ASTLiteral literal = primaryPrefix.getFirstChildOfType(ASTLiteral.class); - if (literal == null || literal.jjtGetNumChildren() != 0) { + if (literal == null || literal.isStringLiteral() + || (literal.jjtGetNumChildren() != 0 && literal.jjtGetChild(0) instanceof ASTNullLiteral)) { return false; } + // byte, short, char, int, long, float, double, boolean return true; } } diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/typeresolution/typeinference/TypeInferenceResolver.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/typeresolution/typeinference/TypeInferenceResolver.java index f3fed397d0..40908b0353 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/typeresolution/typeinference/TypeInferenceResolver.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/typeresolution/typeinference/TypeInferenceResolver.java @@ -37,9 +37,8 @@ public final class TypeInferenceResolver { List newBounds = new ArrayList<>(); while (!constraints.isEmpty()) { - List reduceResult = constraints.get(constraints.size() - 1).reduce(); - constraints.remove(constraints.size() - 1); - + List reduceResult = constraints.remove(constraints.size() - 1).reduce(); + for (BoundOrConstraint boundOrConstraint : reduceResult) { if (boundOrConstraint instanceof Bound) { newBounds.add((Bound) boundOrConstraint);