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

Add support for non-static @Before and @After methods #1100

Closed
asolntsev opened this issue Feb 7, 2017 · 0 comments
Closed

Add support for non-static @Before and @After methods #1100

asolntsev opened this issue Feb 7, 2017 · 0 comments
Assignees
Milestone

Comments

@asolntsev
Copy link
Contributor

Let's say we have controller MyController with @With annotation:

@With(MySecurity.class)
public class MyController extends Controller {
}

public class MySecurity extends Controller {
  @Before
  public void myNonstaticBeforeMethod() {
  }

  @After
  public void myNonstaticAfterMethod() {
  }
}

When trying to execute any action of MyController, Play framework throws an exception:

Oops: IllegalArgumentException
Unexpected error : Unexpected Error, caused by exception IllegalArgumentException: object is not an instance of declaring class

play.exceptions.UnexpectedException: Unexpected Error
	at play.mvc.ActionInvoker.invoke(ActionInvoker.java:208)
	at Invocation.HTTP Request(Play!)
Caused by: java.lang.IllegalArgumentException: object is not an instance of declaring class
	at play.mvc.ActionInvoker.invoke(ActionInvoker.java:482)
	at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:467)
	at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:436)
	at play.mvc.ActionInvoker.handleBefores(ActionInvoker.java:299)
	at play.mvc.ActionInvoker.invoke(ActionInvoker.java:144)
	... 1 more
@asolntsev asolntsev self-assigned this Feb 7, 2017
asolntsev added a commit to codeborne/play that referenced this issue Feb 7, 2017
@xael-fry xael-fry added this to the 1.5.0 milestone Feb 10, 2017
asolntsev added a commit that referenced this issue Feb 10, 2017
Fixes #1100 add support for non-static @before and @after methods …
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants