0 Replies Latest reply on Sep 7, 2009 5:56 PM by thomas.diesler

    RequirementDependencyItems can only resolve againt INSTALLED

    thomas.diesler

      https://jira.jboss.org/jira/browse/JBCL-113

      The RequirementDependencyItem is constructed like this

       /**
       * Create a new RequirementDependencyItem.
       *
       * @param module the module
       * @param requirement the requirement
       * @param state when the dependency is required and the state of the required dependency
       * @throws IllegalArgumentException for a null parameter
       */
       public RequirementDependencyItem(Module module, Requirement requirement, ControllerState state)
       {
       this(module, requirement, state, ControllerState.INSTALLED);
       }
      


      Despite the javadoc


      param state when the dependency is required and the state of the required dependency


      The ctor hard codes the state of the required dependency to INSTALLED.

      If this correct, the javadoc should change accordingly.

      The code that works for OSGi would be

      this(module, requirement, state, state);
      


      Because this has been rolled back I now use the new explicit ctor from Module when the RequirementDependencyItem is constructed.

       protected void createDependencies()
       {
       ControllerState classLoaderState = getClassLoaderState();
      
       List<Requirement> requirements = getRequirements();
       if (requirements != null)
       {
       requirementDependencies = new ArrayList<RequirementDependencyItem>();
       for (Requirement requirement : requirements)
       {
       // [JBCL-113] RequirementDependencyItems can only resolve againt INSTALLED contexts
       RequirementDependencyItem item = new RequirementDependencyItem(this, requirement, classLoaderState, classLoaderState);
       addIDependOn(item);
       requirementDependencies.add(item);
       }
       }
       }