drccrd opened a new issue, #6782:
URL: https://github.com/apache/incubator-kie-drools/issues/6782

   **Summary:** A declared `Child extends Parent`, where `Parent` is declared 
in a *different* package, generates a full-argument constructor that omits 
`Parent`'s fields, so `new Child(parentFields…, childFields…)` fails to 
compile. The exec model followed the declared-supertype chain only within the 
current package (or into a Java superclass), not into a declared supertype in 
another package.
   
   **Reproducer:**
   ```drl
   // parent.drl
   package org.test.parentpkg;
   declare Parent
     name : String
     age : int
   end
   
   // child.drl
   package org.test.childpkg;
   import org.test.parentpkg.Parent;
   declare Child extends Parent
     dept : String
   end
   rule Init when then insert( new Child("Mario", 40, "Sales") ); end
   rule Chk  when Child( name == "Mario", age == 40, dept == "Sales" ) then end
   ```
   - **Expected:** both rules fire; `Child` exposes `Child(String name, int 
age, String dept)`.
   - **Actual:** compile error — *constructor `Child(String,int,String)` is 
undefined* (only `Child(String dept)` is generated).
   
   **Root cause:** `DescrTypeDefinition.findInheritedDeclaredFields()` resolved 
inherited fields only from the current package's declared supertype or a Java 
superclass; it never searched other packages' declared types, so a 
cross-package declared supertype's fields were dropped.
   
   **Suggested fix:** follow the declared-supertype chain across all packages 
(base-first), then fall back to a resolvable Java superclass at the end of the 
chain. This needs the build's package descriptors + `PackageRegistryManager` 
passed into `DescrTypeDefinition` so each declaring package's own 
supertypes/imports can be resolved (with its own `TypeResolver`).
   
   Relates to #6779 


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