From 5be301c6e7f5d2305f078da7a5e2272050733981 Mon Sep 17 00:00:00 2001 From: Paul Holser Date: Mon, 20 Jul 2020 09:45:28 -0500 Subject: [PATCH] Make FrameworkField ctor public. Fixes #1668 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. --- .../java/org/junit/runners/model/FrameworkField.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/junit/runners/model/FrameworkField.java b/src/main/java/org/junit/runners/model/FrameworkField.java index e99d05b46312..007fa3530d62 100644 --- a/src/main/java/org/junit/runners/model/FrameworkField.java +++ b/src/main/java/org/junit/runners/model/FrameworkField.java @@ -15,7 +15,12 @@ public class FrameworkField extends FrameworkMember { private final Field field; - FrameworkField(Field field) { + /** + * Returns a new {@code FrameworkField} for {@code field}. + * + *

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."); @@ -26,7 +31,7 @@ public class FrameworkField extends FrameworkMember { // 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 } }