gitgabrio commented on code in PR #6267:
URL:
https://github.com/apache/incubator-kie-drools/pull/6267#discussion_r2003332637
##########
kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/compiler/DMNCompilerImpl.java:
##########
@@ -209,60 +210,82 @@ public DMNModel compile(Definitions dmndefs,
Collection<DMNModel> dmnModels, Res
}
DMNModelImpl model = new DMNModelImpl(dmndefs, resource);
model.setRuntimeTypeCheck(((DMNCompilerConfigurationImpl)
dmnCompilerConfig).getOption(RuntimeTypeCheckOption.class).isRuntimeTypeCheck());
+ DMNCompilerContext ctx = configureDMNCompiler(model.getFeelDialect(),
relativeResolver);
+ if (!dmndefs.getImport().isEmpty()) {
+ iterateImports(dmndefs, dmnModels, model, relativeResolver );
+ }
+ processItemDefinitions(ctx, model, dmndefs);
+ processDrgElements(ctx, model, dmndefs);
+ return model;
+ }
+
+ private DMNCompilerContext configureDMNCompiler(FEELDialect feeldialect,
Function<String, Reader> relativeResolver) {
+
DMNCompilerConfigurationImpl cc = (DMNCompilerConfigurationImpl)
dmnCompilerConfig;
List<FEELProfile> helperFEELProfiles = cc.getFeelProfiles();
- DMNFEELHelper feel = new DMNFEELHelper(cc.getRootClassLoader(),
helperFEELProfiles, model.getFeelDialect());
+ DMNFEELHelper feel = new DMNFEELHelper(cc.getRootClassLoader(),
helperFEELProfiles, feeldialect);
DMNCompilerContext ctx = new DMNCompilerContext(feel);
ctx.setRelativeResolver(relativeResolver);
+ return ctx;
+ }
+
+ private void iterateImports(Definitions dmndefs, Collection<DMNModel>
dmnModels, DMNModelImpl model, Function<String, Reader> relativeResolver ) {
Review Comment:
Ok @ChinchuAjith, but it would be better to verify the method in isolation,
and not just from hidden side-effect.
If, for whatever reason, something change in that inner method that breaks
everything else in some strange corner-case, without a specific test we won't
realize immediately: does this make sense ?
--
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]