diff options
author | gjoranv <gv@oath.com> | 2018-04-30 15:52:31 +0200 |
---|---|---|
committer | gjoranv <gv@oath.com> | 2018-04-30 16:05:34 +0200 |
commit | 276cbbcee9d38d5a92df6ff66a0e4f06351cb679 (patch) | |
tree | 48f509eb985e8ac0d7b807824e4ceebf8977f999 /jdisc_core/src | |
parent | a1383ffe9f5d0731139bf3c1fa82636f1e765939 (diff) |
Allow building with Java 9.
- Must suppress deprecation warning for unit tests because
LogRecord.setInstant() is new for Java 9.
Diffstat (limited to 'jdisc_core/src')
3 files changed, 12 insertions, 8 deletions
diff --git a/jdisc_core/src/main/java/com/yahoo/jdisc/handler/ContentInputStream.java b/jdisc_core/src/main/java/com/yahoo/jdisc/handler/ContentInputStream.java index 3f89ba04aa5..04be3c1e3d4 100644 --- a/jdisc_core/src/main/java/com/yahoo/jdisc/handler/ContentInputStream.java +++ b/jdisc_core/src/main/java/com/yahoo/jdisc/handler/ContentInputStream.java @@ -19,6 +19,7 @@ public final class ContentInputStream extends UnsafeContentInputStream { } @Override + @SuppressWarnings("deprecation") // finalize() is deprecated from Java 9 public void finalize() throws Throwable { try { close(); diff --git a/jdisc_core/src/test/java/com/yahoo/jdisc/core/ApplicationEnvironmentModuleTestCase.java b/jdisc_core/src/test/java/com/yahoo/jdisc/core/ApplicationEnvironmentModuleTestCase.java index e8fb53892f0..965a132cd92 100644 --- a/jdisc_core/src/test/java/com/yahoo/jdisc/core/ApplicationEnvironmentModuleTestCase.java +++ b/jdisc_core/src/test/java/com/yahoo/jdisc/core/ApplicationEnvironmentModuleTestCase.java @@ -1,22 +1,25 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.jdisc.core; -import com.google.inject.*; +import com.google.inject.Binding; +import com.google.inject.Guice; +import com.google.inject.Injector; +import com.google.inject.Key; import com.yahoo.jdisc.application.ContainerActivator; import com.yahoo.jdisc.application.ContainerBuilder; import com.yahoo.jdisc.application.OsgiFramework; import com.yahoo.jdisc.service.CurrentContainer; import com.yahoo.jdisc.test.NonWorkingOsgiFramework; +import org.junit.Test; -import java.util.Collections; import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.concurrent.ThreadFactory; -import org.junit.Test; -import static org.junit.Assert.assertTrue; +import static java.util.Collections.emptyList; import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; /** * @author <a href="mailto:simon@yahoo-inc.com">Simon Thoresen</a> @@ -37,8 +40,7 @@ public class ApplicationEnvironmentModuleTestCase { expected.add(entry.getKey().getTypeLiteral().getRawType()); } - ApplicationLoader loader = new ApplicationLoader(new NonWorkingOsgiFramework(), - Collections.<Module>emptyList()); + ApplicationLoader loader = new ApplicationLoader(new NonWorkingOsgiFramework(), emptyList()); injector = Guice.createInjector(new ApplicationEnvironmentModule(loader)); for (Map.Entry<Key<?>, Binding<?>> entry : injector.getBindings().entrySet()) { assertNotNull(expected.remove(entry.getKey().getTypeLiteral().getRawType())); @@ -48,8 +50,7 @@ public class ApplicationEnvironmentModuleTestCase { @Test public void requireThatContainerBuilderCanBeInjected() { - ApplicationLoader loader = new ApplicationLoader(new NonWorkingOsgiFramework(), - Collections.<Module>emptyList()); + ApplicationLoader loader = new ApplicationLoader(new NonWorkingOsgiFramework(), emptyList()); assertNotNull(new ApplicationEnvironmentModule(loader).containerBuilder()); assertNotNull(Guice.createInjector(new ApplicationEnvironmentModule(loader)) .getInstance(ContainerBuilder.class)); diff --git a/jdisc_core/src/test/java/com/yahoo/jdisc/core/OsgiLogHandlerTestCase.java b/jdisc_core/src/test/java/com/yahoo/jdisc/core/OsgiLogHandlerTestCase.java index a5897bea124..7dca8c45d0b 100644 --- a/jdisc_core/src/test/java/com/yahoo/jdisc/core/OsgiLogHandlerTestCase.java +++ b/jdisc_core/src/test/java/com/yahoo/jdisc/core/OsgiLogHandlerTestCase.java @@ -70,6 +70,8 @@ public class OsgiLogHandlerTestCase { } @Test + // TODO: Remove deprecation annotation and replace calls to LogRecord.setMillis() when we no longer have to support Java 8 + @SuppressWarnings("deprecation") public void requireThatJdk14PropertiesAreAvailableThroughServiceReference() { MyLogService logService = new MyLogService(); |