From 47b8e91ea6f6a8f0207f19da63a4a844bf276a52 Mon Sep 17 00:00:00 2001 From: Gregory B Date: Tue, 17 Jul 2018 13:56:59 +0200 Subject: [PATCH] fix(tests): issue #1200, added testing compatibility for jdk9+ refactor(tests): issue #1200, adds Controller.test class and unit test for modification on this issue fix(tests): issue #1200, fixes missing imports fix(tests): issue #1200, fixes encapsulation fix(tests): issue #1200 sorted import errors style(tests): issue #1200 beautification --- framework/src/play/mvc/Controller.java | 13 ++++++++++++- framework/test-src/play/mvc/ControllerTest.java | 14 ++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 framework/test-src/play/mvc/ControllerTest.java diff --git a/framework/src/play/mvc/Controller.java b/framework/src/play/mvc/Controller.java index 7112a9d515..b94a8092f0 100644 --- a/framework/src/play/mvc/Controller.java +++ b/framework/src/play/mvc/Controller.java @@ -1234,7 +1234,7 @@ private static void verifyContinuationsEnhancement() { } if (haveSeenFirstApplicationClass) { - if (className.startsWith("sun.") || className.startsWith("play.")) { + if (shouldBeCheckedForEnhancement(className)) { // we're back into the play framework code... return; // done checking } else { @@ -1252,6 +1252,17 @@ private static void verifyContinuationsEnhancement() { } } + + /** + * Checks if the classname is from the jdk, sun or play package and therefore should not be checked for enhancement + * @param String className + * @return boolean + */ + static boolean shouldBeCheckedForEnhancement(String className) + { + return className.startsWith("jdk.") || className.startsWith("sun.") || className.startsWith("play."); + } + protected static void await(Future future, F.Action callback) { Request.current().isNew = false; Request.current().args.put(ActionInvoker.F, future); diff --git a/framework/test-src/play/mvc/ControllerTest.java b/framework/test-src/play/mvc/ControllerTest.java new file mode 100644 index 0000000000..8f1900511b --- /dev/null +++ b/framework/test-src/play/mvc/ControllerTest.java @@ -0,0 +1,14 @@ +package play.mvc; + +import org.junit.Test; +import static org.junit.Assert.*; +import static play.mvc.Controller.shouldBeCheckedForEnhancement; + +public class ControllerTest{ + @Test + public void jdkAndPlayClassesShouldNeverBeenCheckedForEnhancement() { + assertTrue(shouldBeCheckedForEnhancement("sun.blah")); + assertTrue(shouldBeCheckedForEnhancement("play.foo")); + assertFalse(shouldBeCheckedForEnhancement("com.bar")); + } +} \ No newline at end of file