Skip to content

Commit

Permalink
Make FrameworkField ctor public. Fixes #1668
Browse files Browse the repository at this point in the history
Prior to this change, custom runners could make `FrameworkMethod`
instances, but not `FrameworkField` instances. This small change
allows for both now, because `FrameworkField`'s constructor has been
promoted to `public` from package-private.
  • Loading branch information
Paul Holser committed Jul 22, 2020
1 parent c53a277 commit 5be301c
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/main/java/org/junit/runners/model/FrameworkField.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,12 @@
public class FrameworkField extends FrameworkMember<FrameworkField> {
private final Field field;

FrameworkField(Field field) {
/**
* Returns a new {@code FrameworkField} for {@code field}.
*
* <p>Access relaxed to {@code public} since version 4.14.
*/
public FrameworkField(Field field) {
if (field == null) {
throw new NullPointerException(
"FrameworkField cannot be created without an underlying field.");
Expand All @@ -26,7 +31,7 @@ public class FrameworkField extends FrameworkMember<FrameworkField> {
// This field could be a public field in a package-scope base class
try {
field.setAccessible(true);
} catch (SecurityException e) {
} catch (SecurityException e) {
// We may get an IllegalAccessException when we try to access the field
}
}
Expand Down

0 comments on commit 5be301c

Please sign in to comment.