Skip to content

Module code isn't constructing in topologically sorted order? #146

@mikehearn

Description

@mikehearn

I upgraded to 6.10 but hit a weird bug, where the generated module code isn't constructing objects in the right order. It tries to build an object before its dependency, which then yields:

java.lang.IllegalStateException: Injecting null for hydraulic.parts.tasks.jvm.DetectJDK name:!detectJDK when creating class hydraulic.parts.tasks.jvm.DownloadLinkerJDKTask - potential beans to inject: []. Check for missing module? [ missing beanScopeBuilder.withModules() ]. If it is expected to be externally provided, missing beanScopeBuilder.withBean() ?

And indeed, if we look at the module code, we can see:

  public void build(Builder builder) {
    // register external dependencies
    builder.withBean(Machine.class, machine);
    this.builder = builder;
    // create beans in order based on constructor dependencies
    // i.e. "provides" followed by "dependsOn"
    build_jvm_DownloadLinkerJDKTask();
    build_jvm_LinkDistributionJVMTask();
    build_jvm_RepackJarsTask();
    build_jvm_LinkDevJDKTask();
    build_jvm_FetchJDKInputsTask();
    build_mac_GenerateAppleICNSTask();
    build_mac_SparkleRepositoryTask();
    build_mac_ZipUnnotarizedTask();
    build_mac_NotarizeTask();
    build_mac_ZipNotarizedTask();
    build_mac_BundleMacJVMAppTask();
    build_mac_FetchSparkleInputsTask();
    build_tasks_JSONTask();
    build_linux_AptRepositoryTask();
    build_linux_BuildLinuxJVMAppTask();
    build_linux_CreateDebianPackageTask();
    build_tasks_FetchBaseInputsTask();
    build_tasks_PackageForMachine();
    build_jvm_DetectJDK();
  }

so DetectJDK is built last, even though it's needed first. I'm not totally sure how to make a smaller repro case for this because I'm not sure what causes it, but this module depends on another module.

In this code, DetectJDK depends on FetchJDKInputsTask, which in turn depends on three externally provided dependencies, but they're provided by the scope this scope depends on. So maybe there's a sorting problem when scopes depend on each other?

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions