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

bug: imports added to generated sources are never used #2485

Closed
pvojtechovsky opened this issue Sep 20, 2018 · 1 comment
Closed

bug: imports added to generated sources are never used #2485

pvojtechovsky opened this issue Sep 20, 2018 · 1 comment
Labels

Comments

@pvojtechovsky
Copy link
Collaborator

Test case:

  • The Spoon pattern is based on java source which imports template class like e.g. com.somepackage.Request
  • The Spoon pattern replaces this template class by another class, so the com.somepackage.Request isn't used in generated code.

bug: printed sources contains import of com.somepackage.Request if any javadoc contains substring "Request".
I my case the javadoc was, which caused that is: Generated by com.somepackage_generator.templates.soap.RequestBuilderTemplate#serviceWrapper(RequestBuilderTemplate.java:25)

The problem is in /spoon-core/src/main/java/spoon/reflect/visitor/ImportScannerImpl.java method visitCtJavaDoc
in code
javadoc.contains(ctImport.getReference().getSimpleName())

Spoon should understand javadoc better before it marks import as used.

@monperrus monperrus changed the title Unused imports added to generated sources bug: imports added to generated sources are never used Sep 20, 2018
@monperrus
Copy link
Collaborator

closed per #2486

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants