Breaking change - renaming old mutable setXX methods by bbakerman · Pull Request #191 · graphql-java/java-dataloader

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Chaining is good however even with this change you can still write

DataLoaderOptions options = DataLoaderOptions.newOptions()
                .withMaxBatchSize(5);
        
        options.withBatchingEnabled(false);

Which is breaking

I feel like instead if you remove newOptions() and swap to static the IDE will hint the bad pattern of static methods on the instance, no longer recommend chaining on the concrete instance and hint people towards chaining only on the builder

Screenshot 2025-05-01 at 9 39 25 AM IDE hinting to not use the static methods on the instance which would break the behavior Screenshot 2025-05-01 at 9 48 11 AM

IDE not suggesting chaining of the static methods

Screenshot 2025-05-01 at 9 51 52 AM

(It will allow you to explicitly type it out but won't suggest it and will warn if you do) This code is technically valid but i feel like we want to push people to the Builder since it exists now

Screenshot 2025-05-01 at 9 41 49 AM

Push people towards proper builder pattern