Skip to content

Conversation

Laurens-W
Copy link
Contributor

What's changed?

Allow parser to parse compact source files

What's your motivation?

Java 25 coming out next week

Any additional context

https://openjdk.org/jeps/512

Checklist

  • I've added unit tests to cover both positive and negative cases
  • I've read and applied the recipe conventions and best practices
  • I've used the IntelliJ IDEA auto-formatter on affected files

github-actions[bot]

This comment was marked as off-topic.

github-actions[bot]

This comment was marked as off-topic.

@timtebeek timtebeek mentioned this pull request Sep 8, 2025
4 tasks
github-actions[bot]

This comment was marked as off-topic.

github-actions[bot]

This comment was marked as off-topic.

github-actions[bot]

This comment was marked as resolved.

@Laurens-W Laurens-W marked this pull request as ready for review September 9, 2025 14:05
Comment on lines +26 to +27
public class CompactSourceFile implements Marker {
UUID id;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Had a brief look at Kotlin (perhaps you did as well); for context there we seem to use an OmitBraces marker:

boolean omitBraces = block.getMarkers().findFirst(OmitBraces.class).isPresent();
if (!omitBraces) {
p.append("{");
}

I wonder if it makes sense to copy that marker here and deprecate the old one, as opposed to using CompactSourceFile in both printing the compilation unit as well as printing the class declaration.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that makes a whole lot of sense, in retrospect I knew this existed but hadn't considered using this concept separately from the CompactSourceFile marker. I applied this to the PR instead of overloading the visitBlock in the Java printer!

…itors to consider both java and kotlin version of `OmitBraces`
@Laurens-W Laurens-W requested a review from sambsnyd October 20, 2025 12:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

3 participants