aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgjoranv <gv@oath.com>2018-04-26 14:45:27 +0200
committergjoranv <gv@oath.com>2018-04-26 15:05:38 +0200
commit103e97d69d05fd005228ceffaa97ff61a80b551c (patch)
treeb1aea157ffaa6ea77e1e7afd424343109592aafd
parentf7c70472da91c7708d041e68aee29877b25ad30a (diff)
Remove vespajlib:Util
- Vespa no longer supports Java 6 or older.
-rw-r--r--container-search/src/test/java/com/yahoo/prelude/query/parser/UnicodePropertyDumpTestCase.java10
-rwxr-xr-xsearchlib/src/main/java/com/yahoo/searchlib/treenet/rule/ComparisonCondition.java4
-rwxr-xr-xsearchlib/src/main/java/com/yahoo/searchlib/treenet/rule/SetMembershipCondition.java2
-rwxr-xr-xvespaclient-container-plugin/src/test/java/com/yahoo/storage/searcher/GetSearcherTestCase.java5
-rw-r--r--vespajlib/src/main/java/com/yahoo/java7compat/Util.java37
-rw-r--r--vespajlib/src/test/java/com/yahoo/java7compat/UtilTest.java29
6 files changed, 4 insertions, 83 deletions
diff --git a/container-search/src/test/java/com/yahoo/prelude/query/parser/UnicodePropertyDumpTestCase.java b/container-search/src/test/java/com/yahoo/prelude/query/parser/UnicodePropertyDumpTestCase.java
index 4c07a0ca59a..55be36abd62 100644
--- a/container-search/src/test/java/com/yahoo/prelude/query/parser/UnicodePropertyDumpTestCase.java
+++ b/container-search/src/test/java/com/yahoo/prelude/query/parser/UnicodePropertyDumpTestCase.java
@@ -7,7 +7,6 @@ import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.PrintStream;
-import com.yahoo.java7compat.Util;
import org.junit.Test;
/**
@@ -33,14 +32,7 @@ public class UnicodePropertyDumpTestCase {
toCheck.flush();
final String result = toCheck.toString("UTF-8");
- String expected;
-
- if (Util.isJava7Compatible()) {
- expected = "0000002e 0000 24\n000000c5 0002 1\n0001d7d3 0006 5\n";
- } else {
- expected = "0000002e 0000 24\n000000c5 0002 1\n0001d7d3 0010 0\n";
- }
-
+ String expected = "0000002e 0000 24\n000000c5 0002 1\n0001d7d3 0006 5\n";
assertEquals(expected, result);
}
}
diff --git a/searchlib/src/main/java/com/yahoo/searchlib/treenet/rule/ComparisonCondition.java b/searchlib/src/main/java/com/yahoo/searchlib/treenet/rule/ComparisonCondition.java
index af01c906f9a..174cf21d684 100755
--- a/searchlib/src/main/java/com/yahoo/searchlib/treenet/rule/ComparisonCondition.java
+++ b/searchlib/src/main/java/com/yahoo/searchlib/treenet/rule/ComparisonCondition.java
@@ -1,8 +1,6 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.searchlib.treenet.rule;
-import com.yahoo.java7compat.Util;
-
/**
* Represents a condition which comparing two values
*
@@ -34,6 +32,6 @@ public class ComparisonCondition extends Condition {
@Override
public String conditionToRankingExpression() {
- return "< " + Util.toJava7String(rhs);
+ return "< " + String.valueOf(rhs);
}
}
diff --git a/searchlib/src/main/java/com/yahoo/searchlib/treenet/rule/SetMembershipCondition.java b/searchlib/src/main/java/com/yahoo/searchlib/treenet/rule/SetMembershipCondition.java
index 3decfe920e4..b10452a7b32 100755
--- a/searchlib/src/main/java/com/yahoo/searchlib/treenet/rule/SetMembershipCondition.java
+++ b/searchlib/src/main/java/com/yahoo/searchlib/treenet/rule/SetMembershipCondition.java
@@ -1,8 +1,6 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.searchlib.treenet.rule;
-import com.yahoo.java7compat.Util;
-
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
diff --git a/vespaclient-container-plugin/src/test/java/com/yahoo/storage/searcher/GetSearcherTestCase.java b/vespaclient-container-plugin/src/test/java/com/yahoo/storage/searcher/GetSearcherTestCase.java
index 8da09bc78ad..2424ce596a3 100755
--- a/vespaclient-container-plugin/src/test/java/com/yahoo/storage/searcher/GetSearcherTestCase.java
+++ b/vespaclient-container-plugin/src/test/java/com/yahoo/storage/searcher/GetSearcherTestCase.java
@@ -15,7 +15,6 @@ import com.yahoo.documentapi.messagebus.protocol.GetDocumentMessage;
import com.yahoo.documentapi.messagebus.protocol.GetDocumentReply;
import com.yahoo.feedapi.FeedContext;
import com.yahoo.feedapi.MessagePropertyProcessor;
-import com.yahoo.java7compat.Util;
import com.yahoo.messagebus.Message;
import com.yahoo.messagebus.routing.Route;
import com.yahoo.prelude.templates.SearchRendererAdaptor;
@@ -431,9 +430,9 @@ public class GetSearcherTestCase {
"<errors>\n" +
"<error type=\"searcher\" code=\"3\" message=\"Illegal query: " +
"java.lang.IllegalArgumentException: No enum const" +
- (Util.isJava7Compatible() ? "ant " : " class ") +
+ "ant " +
"com.yahoo.documentapi.messagebus.protocol.DocumentProtocol" +
- (Util.isJava7Compatible() ? "." : "$") +
+ "." +
"Priority.onkel_jubalon\"/>\n" +
"</errors>\n" +
"</result>\n", result);
diff --git a/vespajlib/src/main/java/com/yahoo/java7compat/Util.java b/vespajlib/src/main/java/com/yahoo/java7compat/Util.java
deleted file mode 100644
index a70688d7c3e..00000000000
--- a/vespajlib/src/main/java/com/yahoo/java7compat/Util.java
+++ /dev/null
@@ -1,37 +0,0 @@
-// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-package com.yahoo.java7compat;
-
-/**
- * @author baldersheim
- * @since 5.2
- */
-
-public class Util {
- private static final int javaVersion = Integer.valueOf(System.getProperty("java.version").substring(2,3));
- public static boolean isJava7Compatible() { return javaVersion >= 7; }
- /**
- * Takes the double value and prints it in a way that is compliant with the way java7 prints them.
- * This is due to java7 finally fixing the trailing zero problem
- * @param d the double value
- * @return string representation of the double value
- */
- public static String toJava7String(double d) {
- String s = String.valueOf(d);
- if ( ! isJava7Compatible() ) {
- s = nonJava7CompatibleString(s);
- }
- return s;
- }
-
- static String nonJava7CompatibleString(String s) {
- if ((s.length() >= 3) && s.contains(".")) {
- int l = s.length();
- for(; l > 2 && (s.charAt(l-1) == '0') && (s.charAt(l-2) >= '0') && (s.charAt(l-1) <= '9'); l--);
- if (l != s.length()) {
- s = s.substring(0, l);
- }
- }
- return s;
- }
-
-}
diff --git a/vespajlib/src/test/java/com/yahoo/java7compat/UtilTest.java b/vespajlib/src/test/java/com/yahoo/java7compat/UtilTest.java
deleted file mode 100644
index b2be19494bf..00000000000
--- a/vespajlib/src/test/java/com/yahoo/java7compat/UtilTest.java
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-package com.yahoo.java7compat;
-
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
-
-/**
- * @author baldersheim
- * @since 5.2
- */
-
-public class UtilTest {
-
- @Test
- public void requireJava7CompatibleDoublePrinting() {
- if (Util.isJava7Compatible()) {
- assertEquals("0.004", String.valueOf(0.0040));
- }else {
- assertEquals("0.0040", String.valueOf(0.0040));
- }
- assertEquals("0.004", Util.toJava7String(0.0040) );
- }
-
- @Test
- public void nonCompatible() {
- assertEquals(Util.nonJava7CompatibleString("0.0040"), "0.004");
- }
-
-}