From 0ee726ed0dfe352dc8362149ca80f4969088a607 Mon Sep 17 00:00:00 2001 From: Robert Muir Date: Thu, 19 May 2016 15:35:26 -0400 Subject: [PATCH] nuke eclipse warnings --- .../src/main/java/org/elasticsearch/painless/Def.java | 10 ++++++++++ .../painless/PainlessScriptEngineService.java | 2 +- .../java/org/elasticsearch/painless/node/EUnary.java | 1 - .../org/elasticsearch/painless/NeedsScoreTests.java | 1 + 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/modules/lang-painless/src/main/java/org/elasticsearch/painless/Def.java b/modules/lang-painless/src/main/java/org/elasticsearch/painless/Def.java index 7cc3d2f870e..e5967501664 100644 --- a/modules/lang-painless/src/main/java/org/elasticsearch/painless/Def.java +++ b/modules/lang-painless/src/main/java/org/elasticsearch/painless/Def.java @@ -72,14 +72,24 @@ public final class Def { private static final MethodHandle OBJECT_ARRAY_MH = ARRAY_TYPE_MH_MAPPING.get(Object[].class); + // NOTE: the following are actually used, javac just does not know :) + @SuppressWarnings("unused") static int getArrayLength(final boolean[] array) { return array.length; } + @SuppressWarnings("unused") static int getArrayLength(final byte[] array) { return array.length; } + @SuppressWarnings("unused") static int getArrayLength(final short[] array) { return array.length; } + @SuppressWarnings("unused") static int getArrayLength(final int[] array) { return array.length; } + @SuppressWarnings("unused") static int getArrayLength(final long[] array) { return array.length; } + @SuppressWarnings("unused") static int getArrayLength(final char[] array) { return array.length; } + @SuppressWarnings("unused") static int getArrayLength(final float[] array) { return array.length; } + @SuppressWarnings("unused") static int getArrayLength(final double[] array) { return array.length; } + @SuppressWarnings("unused") static int getArrayLength(final Object[] array) { return array.length; } static MethodHandle arrayLengthGetter(Class arrayType) { diff --git a/modules/lang-painless/src/main/java/org/elasticsearch/painless/PainlessScriptEngineService.java b/modules/lang-painless/src/main/java/org/elasticsearch/painless/PainlessScriptEngineService.java index 4c627d08eca..72a657cd7f0 100644 --- a/modules/lang-painless/src/main/java/org/elasticsearch/painless/PainlessScriptEngineService.java +++ b/modules/lang-painless/src/main/java/org/elasticsearch/painless/PainlessScriptEngineService.java @@ -204,7 +204,7 @@ public final class PainlessScriptEngineService extends AbstractComponent impleme * Action taken when the engine is closed. */ @Override - public void close() throws IOException { + public void close() { // Nothing to do. } } diff --git a/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/EUnary.java b/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/EUnary.java index 409d1081ae9..7e52790fa50 100644 --- a/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/EUnary.java +++ b/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/EUnary.java @@ -147,7 +147,6 @@ public final class EUnary extends AExpression { if (child.constant != null) { final Sort sort = promote.sort; - if (sort == Sort.INT) { constant = -(int)child.constant; } else if (sort == Sort.LONG) { diff --git a/modules/lang-painless/src/test/java/org/elasticsearch/painless/NeedsScoreTests.java b/modules/lang-painless/src/test/java/org/elasticsearch/painless/NeedsScoreTests.java index 4b56d9751b6..3fe071c5221 100644 --- a/modules/lang-painless/src/test/java/org/elasticsearch/painless/NeedsScoreTests.java +++ b/modules/lang-painless/src/test/java/org/elasticsearch/painless/NeedsScoreTests.java @@ -60,6 +60,7 @@ public class NeedsScoreTests extends ESSingleNodeTestCase { ss = service.search(new CompiledScript(ScriptType.INLINE, "randomName", "painless", compiled), lookup, Collections.emptyMap()); assertTrue(ss.needsScores()); + service.close(); } }