-
Notifications
You must be signed in to change notification settings - Fork 32
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
GH-97 Add basic support for passing annotations to the generated Java stubs #171
Conversation
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: |
Just to inform you I have signed individual CLA |
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be good to add a test demonstrating the new feature?
def sig = pattern(s"$ret $name") | ||
case class MethodInfo(access: String, pattern: String => String, ret: String, name: String, comment: Seq[String], d: Option[DefDef] = None) extends Templ { | ||
def sig: String = { | ||
s""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The additional whitespace here makes tests fail
|
||
private object MyComponent extends PluginComponent with Transform { | ||
|
||
import global._ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apparently this imported CompilationUnit
, perhaps best to bring it back?
… line as Java class stubs and write a simple test that demonstrates how to create Java stub with some annotation
@raboof tnx for the feedback - I've added an artificial scenario with |
Hi, can someone take a look? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I missed your update!
A couple of minor comments, but you can address those in a follow-up PR if you want. LGTM!
@@ -103,6 +103,36 @@ GenJavadoc can also be integrated into a Maven build (inspired by [this answer o | |||
</profile> | |||
~~~ | |||
|
|||
You can integrate genjavadoc with gradle build: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great! Could've been a separate PR but 👍 :)
@@ -93,9 +108,27 @@ trait AST { this: TransformCake => | |||
} | |||
} | |||
|
|||
case class MethodInfo(access: String, pattern: String => String, ret: String, name: String, comment: Seq[String]) extends Templ { | |||
def sig = pattern(s"$ret $name") | |||
case class MethodInfo(access: String, pattern: String => String, ret: String, name: String, comment: Seq[String], d: Option[DefDef] = None) extends Templ { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might have been nice to only include the annotations here rather than the full DefDef
?
} else { | ||
annotations | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A bit simpler might be:
.map { a => s"@${a.symbol.fullName('.')}${System.lineSeparator}" }
.mkString
perhaps?
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: