Copilot commented on code in PR #7136:
URL: https://github.com/apache/incubator-kie/pull/7136#discussion_r4130412895


##########
drools-model/drools-model-compiler/src/main/java/org/drools/modelcompiler/consequence/DroolsImpl.java:
##########
@@ -54,9 +54,11 @@ public class DroolsImpl implements Drools, 
org.kie.api.runtime.rule.RuleContext
 
     @Override
     public void insert(Object object) {
-        insert( object, false );
+        TerminalNode terminalNode = 
((InternalMatch)getMatch()).getTerminalNode();
+        
((InternalWorkingMemoryEntryPoint)reteEvaluator.getDefaultEntryPoint()).insert(object,
 false, getRule(), terminalNode);

Review Comment:
   This bypasses the existing virtual delegation through `insert(Object, 
boolean)`. A subclass that overrides that overload previously intercepted 
`insert(Object)` calls, but will no longer do so; deprecating the overload 
should not silently change dispatch behavior. Keep the original delegation 
while the deprecated method remains supported.



##########
drools-kiesession/src/main/java/org/drools/kiesession/consequence/DefaultKnowledgeHelper.java:
##########
@@ -121,9 +121,11 @@ public FactHandle insertAsync( final Object object ) {
     }
 
     public FactHandle insert(final Object object) {
-        return insert( object, false );
+        return ((InternalWorkingMemoryEntryPoint) 
this.reteEvaluator.getDefaultEntryPoint())
+                .insert(object, false, this.internalMatch.getRule(), 
SuperCacheFixer.asTerminalNode(this.internalMatch.getTuple()));

Review Comment:
   This direct entry-point call changes the method's virtual-dispatch behavior. 
Previously, subclasses of this public implementation could override 
`insert(Object, boolean)` and have `insert(Object)` delegate to it; now that 
override is bypassed. Deprecation should preserve existing behavior until 
removal, so retain the original delegation.



##########
drools-core/src/main/java/org/drools/core/WorkingMemoryEntryPoint.java:
##########
@@ -42,15 +42,18 @@ public interface WorkingMemoryEntryPoint extends EntryPoint 
{
      * Insert a fact registering JavaBean <code>PropertyChangeListeners</code>
      * on the Object to automatically trigger <code>update</code> calls
      * if <code>dynamic</code> is <code>true</code>.
-     * 
+     *
      * @param object
      *            The fact object.
      * @param dynamic
      *            true if Drools should add JavaBean
      *            <code>PropertyChangeListeners</code> to the object.
-     * 
+     *
      * @return The new fact-handle associated with the object.
+     * @deprecated Use {@link org.kie.api.runtime.KieSession#insert(Object)} 
and declare the fact type
+     *             with {@code @propertyChangeSupport} instead.

Review Comment:
   The replacement link points to `KieSession.insert`, which always inserts 
into the session's default entry point. This interface also represents named 
entry points, so following that advice can change where the fact is inserted. 
Link to the inherited `EntryPoint.insert(Object)` method instead to preserve 
the receiver's entry point.



-- 
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]

Reply via email to