kinow commented on code in PR #543:
URL: https://github.com/apache/opennlp/pull/543#discussion_r1272222441
##########
opennlp-tools/src/main/java/opennlp/tools/ml/model/Event.java:
##########
@@ -52,6 +52,23 @@ public Event(String outcome, String[] context, float[]
values) {
this.values = values;
}
+ /**
+ * Instantiates an {@link Event}.
+ *
+ * @param outcome The outcome to use. Must not be {@code null}.
+ * @param context The {@link CharSequence array} of context elements. Must
not be {@code null}.
+ * @param values The {@code float} array to use.
+ */
+ public Event(String outcome, CharSequence[] context, float[] values) {
+ this.outcome = Objects.requireNonNull(outcome, "outcome must not be null");
+ final String[] ctx = new String[context.length];
Review Comment:
Should we validate with `requireNonNull` here too? I think that gives a user
friendly message pointing that outcome must not be null, but here it will just
raise the NPE? (I think)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]