Skip to content

Avoid calling parsers when there are no source files#660

Merged
timtebeek merged 1 commit intoopenrewrite:mainfrom
Bananeweizen:avoid_parsing_empty_lists
Nov 22, 2023
Merged

Avoid calling parsers when there are no source files#660
timtebeek merged 1 commit intoopenrewrite:mainfrom
Bananeweizen:avoid_parsing_empty_lists

Conversation

@Bananeweizen
Copy link
Copy Markdown
Contributor

With empty lists of main or test, Java or Kotlin files avoid invoking the parsers completely. That's more performant and avoids any bad side effects during initialization of the parsers.

Fixes #658.

Anything in particular you'd like reviewers to focus on?

You may want to reformat, I used the Eclipse formatter.

Checklist

  • I've added unit tests to cover both positive and negative cases
  • I've added the license header to any new files through ./gradlew licenseFormat
  • I've used the IntelliJ IDEA auto-formatter on affected files

With empty lists of main or test, Java or Kotlin files avoid invoking
the parsers completely. That's more performant and avoids any bad side
effects during initialization of the parsers.

Fixes openrewrite#658.
@timtebeek timtebeek added the bug Something isn't working label Nov 22, 2023
@timtebeek timtebeek merged commit 379c671 into openrewrite:main Nov 22, 2023
@timtebeek
Copy link
Copy Markdown
Member

Thanks a lot! Yes makes sense not to initialize parsers that might go unused.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Kotlin parser failures on project without Kotlin sources

2 participants