InferenceResult: fix inaccurate results-map Javadoc - #1979
Merged
Conversation
Both the results field and getResults() claimed "If inference failed, this map will be empty." False for the annoInferenceFailed case: InvocationTypeInference.infer (both the method-invocation and member-reference overloads) always passes the resolved variables to the constructor regardless of annoInferenceFailed, so a qualifier-only failure still carries best-effort, Java-resolved type arguments. The map is only actually empty for the two paths that pass Collections.emptyList() explicitly: inferenceCrashed and inferenceBudgetExceeded (both in DefaultTypeArgumentInference). Verified by reading all five call sites that construct InferenceResult. No behavioral change. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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.
Summary
Both the
resultsfield andgetResults()inInferenceResultclaimed "If inference failed, this map will be empty." That's false for theannoInferenceFailedcase:InvocationTypeInference.infer(both the method-invocation and member-reference overloads) always passes the resolved variables to the constructor regardless ofannoInferenceFailed, so a qualifier-only failure still carries best-effort, Java-resolved type arguments. The map is only actually empty for the two paths that passCollections.emptyList()explicitly:inferenceCrashedandinferenceBudgetExceeded(both inDefaultTypeArgumentInference).Verified by reading all five call sites that construct
InferenceResult. No behavioral change — Javadoc only.Surfaced while analyzing the
type.arguments.not.inferredcluster; full write-up in a follow-up issue.Test plan
./gradlew :framework:compileJava— compiles clean./gradlew :framework:spotlessJavaCheck— passes🤖 Generated with Claude Code