Skip to content

expandWildcardImports fails in Java Spring Boot projects #2845

@jellybulb

Description

@jellybulb

Hi, I recently tried applying the expandWildcardImports() feature that was added in a recent Gradle Plugin release to my Java Spring Boot project, and I noticed several issues, so I’d like to report them here.
(If Spring projects are not an intended target for this feature, please let me know!)

It seems that the check runs on any Java file that contains wildcard imports. However, regardless of the imports themselves, the process fails when it cannot resolve:

  • getters(and maybe setters too) automatically generated by annotations such as @Data or @Getter
  • the log generated by @Slf4j

In particular, the issue with getters also causes failures transitively when those getters are called from other classes.

ex 1

@Getter
public abstract class AbstractSample implements Sample {
  int myField;
  ...
  private int sample() {
    return getMyField();
  }
}
(UnsolvedSymbolException) Unsolved symbol : We are unable to find the method declaration corresponding to getMyField()

ex 2

@Slf4j
public abstract class AbstractSample implements Sample {
  ...
  private void sample() {
    log.debug("blabla : {}", blabla);
  }
}
(UnsolvedSymbolException) Unsolved symbol in log.debug("blabla : {}", blabla) : log

Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions