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

Generate default constructor with JavaDoc for Xdoclint #50

Merged
merged 6 commits into from
Dec 17, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,16 @@ public void visitIdent(JCTree.JCIdent ident) {

out.write("\n");
out.write("/**\n * OpenRewrite `" + templateName.getValue() + "` template created for `" + templateFqn.split("_")[0] + "`.\n */\n");
timtebeek marked this conversation as resolved.
Show resolved Hide resolved
out.write("public class " + templateFqn.substring(templateFqn.lastIndexOf('.') + 1) + " {\n");
out.write(" /**\n * @return `JavaTemplate` to match or replace.\n */\n");
String templateClassName = templateFqn.substring(templateFqn.lastIndexOf('.') + 1);
out.write("public class " + templateClassName + " {\n");
out.write(" /**\n");
out.write(" * Instantiates a new {@link " + templateClassName + "} instance.\n");
out.write(" * @return the new instance\n");
out.write(" */\n");
out.write(" public " + templateClassName + "() {}\n\n");
out.write(" /**\n");
out.write(" * @return `JavaTemplate` to match or replace.\n");
out.write(" */\n");
out.write(" public static JavaTemplate.Builder getTemplate() {\n");
out.write(" return JavaTemplate\n");
out.write(" .builder(\"" + templateSource + "\")");
Expand Down
12 changes: 12 additions & 0 deletions src/test/resources/template/ParameterReuseRecipe$1_before.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,19 @@
package foo;
import org.openrewrite.java.*;

/**
* OpenRewrite `before` template created for `foo.ParameterReuseRecipe$1`.
timtebeek marked this conversation as resolved.
Show resolved Hide resolved
*/
public class ParameterReuseRecipe$1_before {
/**
* Instantiates a new {@link ParameterReuseRecipe$1_before} instance.
timtebeek marked this conversation as resolved.
Show resolved Hide resolved
* @return the new instance
timtebeek marked this conversation as resolved.
Show resolved Hide resolved
*/
timtebeek marked this conversation as resolved.
Show resolved Hide resolved
public ParameterReuseRecipe$1_before() {}

/**
* @return `JavaTemplate` to match or replace.
timtebeek marked this conversation as resolved.
Show resolved Hide resolved
*/
public static JavaTemplate.Builder getTemplate() {
return JavaTemplate
.builder("#{s:any(java.lang.String)}.equals(#{s})");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,19 @@
package foo;
import org.openrewrite.java.*;

/**
* OpenRewrite `after` template created for `foo.ShouldAddClasspathRecipes$FullyQualifiedRecipe$1`.
*/
public class ShouldAddClasspathRecipes$FullyQualifiedRecipe$1_after {
/**
* Instantiates a new {@link ShouldAddClasspathRecipes$FullyQualifiedRecipe$1_after} instance.
* @return the new instance
*/
public ShouldAddClasspathRecipes$FullyQualifiedRecipe$1_after() {}

/**
* @return `JavaTemplate` to match or replace.
*/
public static JavaTemplate.Builder getTemplate() {
return JavaTemplate
.builder("org.slf4j.LoggerFactory.getLogger(#{message:any(java.lang.String)})")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,19 @@
package foo;
import org.openrewrite.java.*;

/**
* OpenRewrite `before` template created for `foo.ShouldAddClasspathRecipes$FullyQualifiedRecipe$1`.
*/
public class ShouldAddClasspathRecipes$FullyQualifiedRecipe$1_before {
/**
* Instantiates a new {@link ShouldAddClasspathRecipes$FullyQualifiedRecipe$1_before} instance.
* @return the new instance
*/
public ShouldAddClasspathRecipes$FullyQualifiedRecipe$1_before() {}

/**
* @return `JavaTemplate` to match or replace.
*/
public static JavaTemplate.Builder getTemplate() {
return JavaTemplate
.builder("System.out.println(#{message:any(java.lang.String)})");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,19 @@
package foo;
import org.openrewrite.java.*;

/**
* OpenRewrite `after` template created for `foo.ShouldAddClasspathRecipes$PrimitiveRecipe$1`.
*/
public class ShouldAddClasspathRecipes$PrimitiveRecipe$1_after {
/**
* Instantiates a new {@link ShouldAddClasspathRecipes$PrimitiveRecipe$1_after} instance.
* @return the new instance
*/
public ShouldAddClasspathRecipes$PrimitiveRecipe$1_after() {}

/**
* @return `JavaTemplate` to match or replace.
*/
public static JavaTemplate.Builder getTemplate() {
return JavaTemplate
.builder("System.out.print(#{i:any(int)})");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,19 @@
package foo;
import org.openrewrite.java.*;

/**
* OpenRewrite `before` template created for `foo.ShouldAddClasspathRecipes$PrimitiveRecipe$1`.
*/
public class ShouldAddClasspathRecipes$PrimitiveRecipe$1_before {
/**
* Instantiates a new {@link ShouldAddClasspathRecipes$PrimitiveRecipe$1_before} instance.
* @return the new instance
*/
public ShouldAddClasspathRecipes$PrimitiveRecipe$1_before() {}

/**
* @return `JavaTemplate` to match or replace.
*/
public static JavaTemplate.Builder getTemplate() {
return JavaTemplate
.builder("System.out.println(#{i:any(int)})");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,19 @@
package foo;
import org.openrewrite.java.*;

/**
* OpenRewrite `after` template created for `foo.ShouldAddClasspathRecipes$UnqualifiedRecipe$1`.
*/
public class ShouldAddClasspathRecipes$UnqualifiedRecipe$1_after {
/**
* Instantiates a new {@link ShouldAddClasspathRecipes$UnqualifiedRecipe$1_after} instance.
* @return the new instance
*/
public ShouldAddClasspathRecipes$UnqualifiedRecipe$1_after() {}

/**
* @return `JavaTemplate` to match or replace.
*/
public static JavaTemplate.Builder getTemplate() {
return JavaTemplate
.builder("org.slf4j.LoggerFactory.getLogger(#{message:any(java.lang.String)})")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,19 @@
package foo;
import org.openrewrite.java.*;

/**
* OpenRewrite `before` template created for `foo.ShouldAddClasspathRecipes$UnqualifiedRecipe$1`.
*/
public class ShouldAddClasspathRecipes$UnqualifiedRecipe$1_before {
/**
* Instantiates a new {@link ShouldAddClasspathRecipes$UnqualifiedRecipe$1_before} instance.
* @return the new instance
*/
public ShouldAddClasspathRecipes$UnqualifiedRecipe$1_before() {}

/**
* @return `JavaTemplate` to match or replace.
*/
public static JavaTemplate.Builder getTemplate() {
return JavaTemplate
.builder("System.out.println(#{message:any(java.lang.String)})");
Expand Down