tkobayas commented on code in PR #6225:
URL:
https://github.com/apache/incubator-kie-drools/pull/6225#discussion_r1942510041
##########
drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/lang/ParserHelper.java:
##########
@@ -656,4 +679,123 @@ void setEnd( DescrBuilder< ? , ? > db ) {
public String[] getStatementKeywords() {
return statementKeywords;
}
+
+ public static void logHalfConstraintWarn(String logicalConstraint,
BaseDescr descr) {
+ if (descr instanceof RelationalExprDescr relational) {
+ String halfConstraintStr = logicalConstraint + " " +
relational.getOperator() + " " + relational.getRight().toString();
+ logHalfConstraintWarn("The use of a half constraint '" +
halfConstraintStr + "' is deprecated" +
+ " and will be removed in the future
version (LanguageLevel.DRL10)." +
+ " Please add a left operand.");
+ }
+ }
+
+ public static void logHalfConstraintWarn(String message) {
+ if (logCounterHalfConstraint > 10) {
+ return; // suppress further warnings
+ }
+
+ logCounterHalfConstraint++;
+ LOG.warn(message);
+ if (logCounterHalfConstraint == 10) {
+ LOG.warn("Further warnings about half constraints will be
suppressed.");
+ }
+ }
Review Comment:
The counter usage is repetitive in the log methods. I may be able to
refactor them, but I guess it cannot be improved much. If you want me to
refactor, I can try and share.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]