From 870082c246d6f54d2edcc0a6889022c18cb1e248 Mon Sep 17 00:00:00 2001 From: Rory Hunter Date: Mon, 3 Feb 2020 11:20:02 +0000 Subject: [PATCH] Forbid equality checks against 'true' Add a Checkstyle rule to forbid equality checks against a literal 'true' value, since this is redundant. Follow up to #51723. --- buildSrc/src/main/resources/checkstyle.xml | 28 ++++++++++++++++++- .../xpack/sql/jdbc/JdbcResultSetMetaData.java | 4 +-- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/buildSrc/src/main/resources/checkstyle.xml b/buildSrc/src/main/resources/checkstyle.xml index c603edc353d5f..7a59ee5e0fa8b 100644 --- a/buildSrc/src/main/resources/checkstyle.xml +++ b/buildSrc/src/main/resources/checkstyle.xml @@ -18,7 +18,7 @@ - + + + + + + + + + + + + + + + diff --git a/x-pack/plugin/sql/jdbc/src/main/java/org/elasticsearch/xpack/sql/jdbc/JdbcResultSetMetaData.java b/x-pack/plugin/sql/jdbc/src/main/java/org/elasticsearch/xpack/sql/jdbc/JdbcResultSetMetaData.java index d860c6daaa1ab..75e03a240bc96 100644 --- a/x-pack/plugin/sql/jdbc/src/main/java/org/elasticsearch/xpack/sql/jdbc/JdbcResultSetMetaData.java +++ b/x-pack/plugin/sql/jdbc/src/main/java/org/elasticsearch/xpack/sql/jdbc/JdbcResultSetMetaData.java @@ -72,7 +72,7 @@ public int getColumnDisplaySize(int column) throws SQLException { @Override public String getColumnLabel(int column) throws SQLException { JdbcColumnInfo info = column(column); - return true == EMPTY.equals(info.label) ? info.name : info.label; + return EMPTY.equals(info.label) ? info.name : info.label; } @Override @@ -158,4 +158,4 @@ private JdbcColumnInfo column(int column) throws SQLException { public String toString() { return format(Locale.ROOT, "%s(%s)", getClass().getSimpleName(), columns); } -} \ No newline at end of file +}