Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Datatable not correct for find spring components? #594

Open
Jenson3210 opened this issue Sep 23, 2024 · 1 comment
Open

Datatable not correct for find spring components? #594

Jenson3210 opened this issue Sep 23, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@Jenson3210
Copy link
Contributor

Jenson3210 commented Sep 23, 2024

Not sure if this is a bug or expected behaviour.

when we run find spring components recipe, we get the results back of all @Bean annotated methods. However, some/all these beans that are marked with @bean are not added to the datatables of the results it seems.
Classes with @Component or extensions are shown correctly it seems.

  1. Using a codebase without classes marked with @Component
  2. Running the recipe org.openrewrite.java.spring.search.FindSpringComponents
  3. See there are results

Screenshot 2024-09-23 at 10 05 08

  1. See details of results
    Screenshot 2024-09-23 at 10 05 25

  2. See that only one of the datables is available (as no bean's through component annotation?)
    Screenshot 2024-09-23 at 10 05 35

  3. The available datatable contains the correct rows
    Screenshot 2024-09-23 at 10 06 39

EXPECTED:
Also the other table should contain the beans identified.

@Jenson3210 Jenson3210 added the bug Something isn't working label Sep 23, 2024
@timtebeek timtebeek moved this to Backlog in OpenRewrite Sep 23, 2024
@Jenson3210
Copy link
Contributor Author

Jenson3210 commented Sep 23, 2024

Here only the addition to one of the 2 datatables is happening: this line

recordDependencies(TypeUtils.asFullyQualified(requireNonNull(m.getReturnTypeExpression()).getType()), m, ctx);

Should be sufficient to add

springComponents.insertRow(ctx, new SpringComponents.Row(getCursor().firstEnclosingOrThrow(SourceFile.class).getSourcePath().toString(), TypeUtils.asFullyQualified(requireNonNull(m.getReturnTypeExpression()).getType())));

We can provide PR once it is indicated that would indeed be "expected"/wanted

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
Status: Backlog
Development

No branches or pull requests

1 participant