Hello,

I pushed a first PR for circular dependencies https://github.com/apache/ofbiz-framework/pull/837 .

It's not very usefull at this stage and I can't continue since I need help on how to solve circular dependencies around Util* classes.

My next step is to move org.apache.ofbiz.base.util.Debug class into base/util.

Logging is essential to all components (and IMO should be it's own module perhaps) so it should be in a lower level component.

If I do Refactor/ Move class from Intellij I get first issue with two lines:

Properties properties = UtilProperties.createProperties("debug.properties");

and

if (UtilValidate.isNotEmpty(module)) {


Debug brings in a LOT of dependencies via org.apache.ofbiz.base.util.UtilValidate and org.apache.ofbiz.base.util.UtilProperties.

IMO Debug should not depend on higher up API's / classes.
But it does end up depending on Entity, Delegateor, etc via UtilProperties and UtilValidate which do import these clasesses.

How should I break this chain?

I fixed these issues in my previous PR by splitting the functionality into 2 classes. A base class in base/util project and a "Runtime" class under framework/base that uses the high level API's like Entity, that in turn will import Debug.

The "Runtime" classes contain methods that are Moved via refactoring - so no business logic change.

Note that this particular issue is found throughout the codebase.
If we solve it now, we can probably apply a similar solution to most if not all cases.


https://github.com/ieugen/ofbiz-framework/blob/OFBIZ-3500-split-crypt-datafile/base/util/src/main/java/org/apache/ofbiz/base/util/UtilValidate.java

and

https://github.com/ieugen/ofbiz-framework/blob/OFBIZ-3500-split-crypt-datafile/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilValidateRuntime.java

https://github.com/ieugen/ofbiz-framework/blob/OFBIZ-3500-split-crypt-datafile/base/util/src/main/java/org/apache/ofbiz/base/util/UtilProperties.java

and

https://github.com/ieugen/ofbiz-framework/blob/OFBIZ-3500-split-crypt-datafile/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilPropertiesRuntime.java

And some others:

https://github.com/ieugen/ofbiz-framework/blob/OFBIZ-3500-split-crypt-datafile/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilMiscRuntime.java

https://github.com/ieugen/ofbiz-framework/blob/OFBIZ-3500-split-crypt-datafile/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilDateTimeRuntime.java


--
Eugen Stan

Reply via email to