Skip to content

Attribute types on untyped field accesses - #1268

Merged
timtebeek merged 1 commit into
mainfrom
fix/untyped-field-access
Nov 18, 2026
Merged

timtebeek merged 1 commit into
mainfrom
fix/untyped-field-access

Conversation

@timtebeek

Copy link
Copy Markdown
Member

Prepares for openrewrite/rewrite#10034, which makes the test harness type check flag J.FieldAccess nodes without a type.

  • ExplicitThis now types the Outer.this field access it creates (it passed null).
  • UseLambdaForFunctionalInterfaceTest: the inputs returned this.n from an anonymous class that has no field n, which does not compile. They use this.hashCode() instead, which keeps the "references this" intent.
  • FindNewExceptionWithoutCauseTest: the input references classes that are deliberately not on the classpath, so it also sets identifiers(false).

Verified against a build of that PR: ExplicitThisTest, UseLambdaForFunctionalInterfaceTest and FindNewExceptionWithoutCauseTest all pass. The only remaining failures in those classes are the JS/Python tests that cannot install the package for a local snapshot version, which are unrelated.

ExplicitThis built the qualified `Outer.this` field access without a type, and
three tests used inputs that do not compile or reference unresolved types. This
prepares for openrewrite/rewrite#10034, which flags untyped field accesses in the
test type check.
@github-project-automation github-project-automation Bot moved this to In Progress in OpenRewrite Nov 18, 2026
@timtebeek
timtebeek merged commit d46eff5 into main Nov 18, 2026
1 check passed
@timtebeek
timtebeek deleted the fix/untyped-field-access branch November 18, 2026 13:50
@github-project-automation github-project-automation Bot moved this from In Progress to Done in OpenRewrite Nov 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

1 participant