You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@solr.apache.org by "malliaridis (via GitHub)" <gi...@apache.org> on 2025/03/19 17:24:56 UTC

[PR] Replace all with configureEach to solve configuration issues [solr]

malliaridis opened a new pull request, #3276:
URL: https://github.com/apache/solr/pull/3276

   # Description
   
   One of the current build issues we are facing is a NPE when `optimizeTask` is called on an undefined task during project configuration. This and similar issues are caused in various configurations that make use of the `TaskCollection.all` method. 
   
   The actual root cause of these errors seems to be caused by our customization for the javadoc tasks in `render-javadoc.gradle`. I am not sure why this is happening and if similar errors could occur elsewhere.
   
   # Solution
   
   This PR changes the method from `all` to `configureEach` for the problematic locations. They are somewhat equivalent:
   
   _org.gradle.api.DomainObjectCollection<T>.all_
   
   > Executes the given closure against all objects in this collection, and any objects subsequently added to this collection. The object is passed to the closure as the closure delegate. Alternatively, it is also passed as a parameter.
   
    _org.gradle.api.DomainObjectCollection<T>.configureEach_
   
    >Configures each element in this collection using the given action, as each element is required. Actions are run in the order added.
   
   Since the collections are not altered, it should be safe to use `configureEach`.
   
   Additionally, during the development of the [initial PR](https://github.com/apache/solr/pull/2605), `java.lang.Iterable<T>.forEach` was used in two other places, so they are changed to `configureEach` as well.
   
   # Tests
   
   The NPE caused when specifying an alternative JDK via `RUNTIME_JAVA_HOME` should be fixed with this change. To test it, run the current state with the environment variable `RUNTIME_JAVA_HOME` pointing to a different JDK installation. WIthout the change it should fail to build the project when running `gradlew check -x test`.
   
   # Checklist
   
   Please review the following and check all that apply:
   
   - [x] I have reviewed the guidelines for [How to Contribute](https://github.com/apache/solr/blob/main/CONTRIBUTING.md) and my code conforms to the standards described there to the best of my ability.
   - [x] I have created a Jira issue and added the issue ID to my pull request title.
   - [x] I have given Solr maintainers [access](https://help.github.com/en/articles/allowing-changes-to-a-pull-request-branch-created-from-a-fork) to contribute to my PR branch. (optional but recommended, not available for branches on forks living under an organisation)
   - [x] I have developed this patch against the `main` branch.
   - [x] I have run `./gradlew check`.
   - [ ] I have added tests for my changes.
   - [ ] I have added documentation for the [Reference Guide](https://github.com/apache/solr/tree/main/solr/solr-ref-guide)
   


-- 
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: issues-unsubscribe@solr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org


Re: [PR] Replace all with configureEach to solve configuration issues [solr]

Posted by "HoustonPutman (via GitHub)" <gi...@apache.org>.
HoustonPutman merged PR #3276:
URL: https://github.com/apache/solr/pull/3276


-- 
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: issues-unsubscribe@solr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org