Avoid VarWithPrimitive crash on implicitly typed primitive lambda parameters - #6171
Draft
mehuljariwala wants to merge 1 commit into
Draft
mehuljariwala wants to merge 1 commit into
mehuljariwala wants to merge 1 commit into
Conversation
Assisted-by: OpenAI Codex
Author
|
Could a maintainer review whether CI run https://github.com/google/error-prone/actions/runs/37122598346 can be approved to run? It is currently awaiting approval and no CI jobs have executed. This PR remains a draft. Full repository validation is still unverified; the isolated checker reproduction in the description is not a substitute for CI. The draft status will remain until the validation and review requirements are satisfied. AI assistance disclosure: this implementation and follow-up are AI-assisted. |
This branch has not been deployed
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.
An implicitly typed primitive lambda parameter can have no type tree on JDK 27.
VarWithPrimitivecurrently passes it toreplaceVariableType, which dereferences that absent tree and crashes the compiler plugin.Skip parameters without a source type tree before considering a replacement. Explicit
vardeclarations retain their existing refactorings. Add anIntConsumerregression covering both bare and parenthesized lambda parameters.Fixes #6165.
Validation and draft status
The repository reactor could not reach tests on the unmodified baseline:
ErrorProneSignatureGenerator.java:31fails compilation with “an enclosing instance that contains Types.SignatureGenerator is required.” This occurred with the configured JDK 25 compiler and in a second explicit JDK 27 executable attempt. I have not modified that unrelated source or weakened repository tests. This PR is a draft until the normal reactor/CI validation is resolved.The attempted repository command was:
mvn -B -ntp -t /tmp/errorprone-toolchains.xml -pl core -am \ -Dtest=VarWithPrimitiveTest -Dsurefire.failIfNoSpecifiedTests=false testTo separate the reported bug from the baseline build failure, a local isolated Maven harness compiled the exact checker and its complete test class from this branch against released
error_prone_coreanderror_prone_test_helpers2.50.0, with JUnit 4.13.2. It used Java 21 source/target, exported javac internals, and no annotation processing for those isolated files. The harness is not a replacement for the repository build and is not included in this scoped source PR.getStartPosition()null dereference.git diff --checkpassed.The isolated harness was run with
mvn -B -ntp teston JDK 27 andmvn -B -ntp clean teston JDK 25. Explicit-var lambda, annotated-var lambda, ordinary local-variable, and multi-parameter cases in the existing class were retained. Full reactor tests and full formatting/CI checks remain unverified.AI assistance: OpenAI Codex assisted with reproduction, implementation, and local checks. No independent human review is claimed. Any required Google CLA acceptance will be completed by the contributor personally.