Skip to content

Commit

Permalink
Merge pull request playframework#1255 from xael-fry/1200_compatibilit…
Browse files Browse the repository at this point in the history
…y_jdk9

fix(tests): issue playframework#1200, added testing compatibility for jdk9+
  • Loading branch information
xael-fry authored Aug 23, 2018
2 parents 8622669 + 16684c3 commit 6b62c96
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 6b62c96

Please sign in to comment.