Skip to content

Remove dead native-image visitor guard from Py.accept - #8419

Merged
jkschneider merged 1 commit into
mainfrom
remove-py-accept-native-image-guard
Aug 7, 2026
Merged

Remove dead native-image visitor guard from Py.accept#8419
jkschneider merged 1 commit into
mainfrom
remove-py-accept-native-image-guard

Conversation

@jkschneider

Copy link
Copy Markdown
Member

Py.accept short-circuits any visitor whose class name starts with io.moderne.serialization. — returning the node unvisited — to avoid runtime visitor adaptation under a GraalVM native image. There is no native-image build anymore, so the guard is dead code.

It is not harmless dead code, though. It silently stops JavaVisitor-based tooling (search recipes, symbol indexing) from traversing a Python LST for those visitors, so they see nothing at all. JS.accept and Cs.accept carry no such guard, which is why the same tooling traverses JavaScript and C# but not Python. The check also hard-codes a downstream package name into the public tree.

This removes the guard so Python adapts to PythonVisitor unconditionally, exactly as JS and C# already do.

Py.accept short-circuited any visitor whose class name started with
io.moderne.serialization., returning the node unvisited to avoid runtime
visitor adaptation under a GraalVM native image. There is no native-image
build anymore, so the guard is dead code — and it silently prevented
JavaVisitor-based tooling (recipes, symbol indexing) from traversing Python
LSTs, unlike JS and C# whose accept methods have no such guard. Remove it so
Python adapts to PythonVisitor unconditionally, matching JS/C#.
@github-project-automation github-project-automation Bot moved this to In Progress in OpenRewrite Aug 7, 2026
@jkschneider
jkschneider merged commit 1711d97 into main Aug 7, 2026
1 check passed
@jkschneider
jkschneider deleted the remove-py-accept-native-image-guard branch August 7, 2026 11:44
@github-project-automation github-project-automation Bot moved this from In Progress to Done in OpenRewrite Aug 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant