Conversation
The circular Q-class detector was pre-filtering entities by createDefaultVariable() before walking the graph. Because neighbors are resolved through that same map, dropping a node also removed its edges — so a cycle passing through a createDefaultVariable=false entity was silently missed, even though the remaining entities still emit static default instances and can deadlock at class initialization. Walk the full context.entityTypes so every edge is traversed, and filter the emitted cycles instead: report one only when at least two of its nodes have createDefaultVariable() == true. Two rather than one because a single static instance re-enters on the same thread, and JVM class initialization is re-entrant. Also pins the -Aquerydsl.createDefaultVariable=false suggestion string via hadWarningContaining, so the flag name added in OpenFeign#1905 is covered. Follow-up to OpenFeign#1905 (see approval comment). Closes OpenFeign#1949.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Background
Follow-up to @velo's review on #1905.
Closes #1949.
AbstractQuerydslProcessor.detectCircularQClassReferencespreviously filteredcontext.entityTypesbycreateDefaultVariable()before passing the map toQClassCycleDetector.Because the detector resolves neighbors through that map, removing an entity also removes the reference paths through it. However,
createDefaultVariablecontrols static default instance generation; it does not remove constructor references to other Q-classes.As a result, a cycle passing through a
createDefaultVariable=falseentity could go undetected even when the remaining static default instances could cause a class initialization deadlock.Changes
context.entityTypesmap without filtering out intermediate entities.List<List<EntityType>>fromQClassCycleDetector.detectso the processor can check each entity's configuration after detection.createDefaultVariable() == true..distinct()to avoid counting the repeated endpoint twice.The two-entity threshold follows the reasoning in the #1905 review: with only one static default instance, the circular initialization re-entry occurs on the same thread, which JVM class initialization permits.
Tests
QClassCycleDetectorTestto the new return type while preserving existing graph assertions.@Config(createDefaultVariable = false).-Aquerydsl.createDefaultVariable=false.