summaryrefslogtreecommitdiffstats
path: root/vespajlib
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 /vespajlib
parentf7c70472da91c7708d041e68aee29877b25ad30a (diff)
Remove vespajlib:Util
- Vespa no longer supports Java 6 or older.
Diffstat (limited to 'vespajlib')
-rw-r--r--vespajlib/src/main/java/com/yahoo/java7compat/Util.java37
-rw-r--r--vespajlib/src/test/java/com/yahoo/java7compat/UtilTest.java29
2 files changed, 0 insertions, 66 deletions
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");
- }
-
-}