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

Initialize play static field early #1064

Closed
asolntsev opened this issue Dec 26, 2016 · 1 comment
Closed

Initialize play static field early #1064

asolntsev opened this issue Dec 26, 2016 · 1 comment
Assignees
Milestone

Comments

@asolntsev
Copy link
Contributor

asolntsev commented Dec 26, 2016

... to avoid NullPointerExceptions and make writing plain unit-tests easier.

Problem description:

  • Play has lot of public static field - first of all, Play.configuration
  • Many classes do use these public static fields
  • When writing unit-test or main method, developers always need to write null checks and boilerplate code for Play initialization, e.g.:
    if (Play.configuration == null) Play.coniguration = new Properties();

We want to improve it.
Let's initialize early as many Play fields as possible.

@asolntsev asolntsev self-assigned this Dec 26, 2016
asolntsev pushed a commit to codeborne/play that referenced this issue Dec 26, 2016
…ier to write pure unit tests:

* Play.configuration
* Play.id
* Play.javaPath
* Play.applicationPath
* Play.mode
* Play.templatesPath
* Play.modulesRoutes
* Messages.defaults
xael-fry added a commit that referenced this issue Dec 27, 2016
#1064 add default value for static fields to make it easier to write …
xael-fry added a commit to xael-fry/play that referenced this issue Dec 27, 2016
@xael-fry xael-fry added this to the 1.4.4 milestone Dec 27, 2016
xael-fry added a commit that referenced this issue Dec 27, 2016
…Exception

[#1064] fix(messages): add some test on parameters to avoid NullpointerException
@xael-fry
Copy link
Member

@asolntsev .
Thanks, merged and pushed in 1.4.x

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