Skip to content

Commit

Permalink
Merge pull request #1245 from SomelifeDev/master
Browse files Browse the repository at this point in the history
fix(tests): issue #1200, added testing compatibility for jdk9+
  • Loading branch information
asolntsev authored Jul 30, 2018
2 parents bdfc7ad + 47b8e91 commit 50b1864
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
13 changes: 12 additions & 1 deletion framework/src/play/mvc/Controller.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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 <T> void await(Future<T> future, F.Action<T> callback) {
Request.current().isNew = false;
Request.current().args.put(ActionInvoker.F, future);
Expand Down
14 changes: 14 additions & 0 deletions framework/test-src/play/mvc/ControllerTest.java
Original file line number Diff line number Diff line change
@@ -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"));
}
}

0 comments on commit 50b1864

Please sign in to comment.