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

Handle parent before child initialisation order #850

Merged
merged 6 commits into from
Dec 31, 2020
Merged

Conversation

hcoles
Copy link
Owner

@hcoles hcoles commented Dec 31, 2020

Fixes #770 and #746 based on work by @LaurentTho3

Henry Coles added 5 commits December 30, 2020 12:44
Failing test to describe general issue behind coverage bugs - child
classes are initialized after their parents, so coverage probe is not
initialized when parent refers to child in a static initializer block.
Adds a null check when accessing the probe field, initialising it if
null.

Under most circumstances the probe array will have been assigned in the
static initializer, but in the special case of a child class where the
parent class constructs the child in a static initializer the child
initializer will not have been called.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

NPE in enum constructors if hamcrest on classpath
1 participant