Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(tests): issue #1200, added testing compatibility for jdk9+ #1245

Merged
merged 1 commit into from
Jul 30, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Collaborator

@tazmaniax tazmaniax Jul 31, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for being late to the party but this comment feels counter intuitive. It states that if the class name package is jdk, sun or play then it should NOT be checked for enhancement. As the method returns true if any of those packages match then shouldn't the method be shouldNotBeCheckedForEnhancement() ? Or am I having a brain fart here :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, good point. I already fixed it in master branch.

* @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"));
}
}