lightbend / genjavadoc

A compiler plugin for generating doc’able Java source from Scala source
Other
58 stars 32 forks source link

GH-97 Add basic support for passing annotations to the generated Java stubs #171

Closed ilx closed 5 years ago

ilx commented 5 years ago

Hi, we have a custom javadoc doclet that relies on some annotations to be present in Java files. In order to be able to use Scala for the code that needs to be processed with that doclet I have added very limited support that will pass annotations without any parameters to Java stubs generated by genjavadoc plugin. Can you please take a look and maybe merge it / improve it?

P.S. Are tests up-to-date? I'm not sbt user, so maybe I skipped something important but I could not get test task to pass:

[IJ]sbt:genjavadoc> {file:/Users/ilx/work/xebialabs/xlr-project/genjavadoc/}genjavadoc-plugin/test
[info] Updating genjavadoc-plugin...
[info] Done updating.
[info] Compiling 9 Scala sources to /Users/ilx/work/xebialabs/xlr-project/genjavadoc/plugin/target/scala-2.13.0-RC1/classes ...
[error] /Users/ilx/work/xebialabs/xlr-project/genjavadoc/plugin/src/main/scala/com/typesafe/genjavadoc/Plugin.scala:65:30: not found: type CompilationUnit
[error]     def newTransformer(unit: CompilationUnit) = new GenJavadocTransformer(unit)
[error]                              ^
[error] /Users/ilx/work/xebialabs/xlr-project/genjavadoc/plugin/src/main/scala/com/typesafe/genjavadoc/Plugin.scala:67:68: not found: type Transformer
[error]     class GenJavadocTransformer(val unit: CompilationUnit) extends Transformer with TransformCake {
[error]                                                                    ^
[error] /Users/ilx/work/xebialabs/xlr-project/genjavadoc/plugin/src/main/scala/com/typesafe/genjavadoc/Plugin.scala:67:43: not found: type CompilationUnit
[error]     class GenJavadocTransformer(val unit: CompilationUnit) extends Transformer with TransformCake {
[error]                                           ^
[error] /Users/ilx/work/xebialabs/xlr-project/genjavadoc/plugin/src/main/scala/com/typesafe/genjavadoc/Plugin.scala:65:49: type mismatch;
[error]  found   : com.typesafe.genjavadoc.GenJavadocPlugin.MyComponent.GenJavadocTransformer
[error]  required: com.typesafe.genjavadoc.GenJavadocPlugin.MyComponent.global.Transformer
[error]     def newTransformer(unit: CompilationUnit) = new GenJavadocTransformer(unit)
lightbend-cla-validator commented 5 years ago

Hi @ilx,

Thank you for your contribution! We really value the time you've taken to put this together.

Before we proceed with reviewing this pull request, please sign the Lightbend Contributors License Agreement:

http://www.lightbend.com/contribute/cla

ilx commented 5 years ago

Just to inform you I have signed individual CLA

raboof commented 5 years ago

Hi ilx, thanks for your contribution! The tests should be up-to-date, as they're ran on Travis - I'll have a quick look if I can explain that error.

ilx commented 5 years ago

@raboof tnx for the feedback - I've added an artificial scenario with @SupressWarnings annotation - arguments are ignored.

ilx commented 5 years ago

Hi, can someone take a look?