Skip to content

Commit

Permalink
Remove warnings about unused imports from TemplateProcessor
Browse files Browse the repository at this point in the history
  • Loading branch information
timtebeek committed Nov 23, 2024
1 parent 4ea0ede commit dc10492
Show file tree
Hide file tree
Showing 17 changed files with 24 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,10 @@ public void visitApply(JCTree.JCMethodInvocation tree) {
out.write("package " + pkg.fullname + ";\n");
out.write("\n");
}
out.write("import org.openrewrite.java.*;\n");
if (templateCode.contains("JavaParser")) {
out.write("import org.openrewrite.java.JavaParser;\n");
}
out.write("import org.openrewrite.java.JavaTemplate;\n");

out.write("\n");
out.write("/**\n * OpenRewrite `" + templateName.getValue() + "` template created for {@code " + templateFqn.split("_")[0] + "}.\n */\n");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/
package template;

import org.openrewrite.java.*;
import org.openrewrite.java.JavaTemplate;

@SuppressWarnings("all")
public class AnonymousClass$1_newInstance {
Expand Down
2 changes: 1 addition & 1 deletion src/test/resources/template/Generics$1_after.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/
package template;

import org.openrewrite.java.*;
import org.openrewrite.java.JavaTemplate;

/**
* OpenRewrite `after` template created for {@code template.Generics$1}.
Expand Down
2 changes: 1 addition & 1 deletion src/test/resources/template/Generics$1_before.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/
package template;

import org.openrewrite.java.*;
import org.openrewrite.java.JavaTemplate;

/**
* OpenRewrite `before` template created for {@code template.Generics$1}.
Expand Down
3 changes: 2 additions & 1 deletion src/test/resources/template/LoggerRecipe$1_info.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
* limitations under the License.
*/
package template;
import org.openrewrite.java.*;
import org.openrewrite.java.JavaParser;
import org.openrewrite.java.JavaTemplate;

@SuppressWarnings("all")
public class LoggerRecipe$1_info {
Expand Down
3 changes: 2 additions & 1 deletion src/test/resources/template/LoggerRecipe$1_logger.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
* limitations under the License.
*/
package template;
import org.openrewrite.java.*;
import org.openrewrite.java.JavaParser;
import org.openrewrite.java.JavaTemplate;

@SuppressWarnings("all")
public class LoggerRecipe$1_logger {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/
package foo;
import org.openrewrite.java.*;
import org.openrewrite.java.JavaTemplate;

@SuppressWarnings("all")
public class ParameterReuseRecipe$1_before {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/
package foo;
import org.openrewrite.java.*;
import org.openrewrite.java.JavaTemplate;

@SuppressWarnings("all")
public class ShouldAddClasspathRecipes$FullyQualifiedFieldRecipe$1_after {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/
package foo;
import org.openrewrite.java.*;
import org.openrewrite.java.JavaTemplate;

@SuppressWarnings("all")
public class ShouldAddClasspathRecipes$FullyQualifiedFieldRecipe$1_before {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
* limitations under the License.
*/
package foo;
import org.openrewrite.java.*;
import org.openrewrite.java.JavaParser;
import org.openrewrite.java.JavaTemplate;

@SuppressWarnings("all")
public class ShouldAddClasspathRecipes$FullyQualifiedRecipe$1_after {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/
package foo;
import org.openrewrite.java.*;
import org.openrewrite.java.JavaTemplate;

@SuppressWarnings("all")
public class ShouldAddClasspathRecipes$FullyQualifiedRecipe$1_before {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/
package foo;
import org.openrewrite.java.*;
import org.openrewrite.java.JavaTemplate;

@SuppressWarnings("all")
public class ShouldAddClasspathRecipes$PrimitiveRecipe$1_after {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/
package foo;
import org.openrewrite.java.*;
import org.openrewrite.java.JavaTemplate;

@SuppressWarnings("all")
public class ShouldAddClasspathRecipes$PrimitiveRecipe$1_before {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
* limitations under the License.
*/
package foo;
import org.openrewrite.java.*;
import org.openrewrite.java.JavaParser;
import org.openrewrite.java.JavaTemplate;

@SuppressWarnings("all")
public class ShouldAddClasspathRecipes$UnqualifiedRecipe$1_after {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/
package foo;
import org.openrewrite.java.*;
import org.openrewrite.java.JavaTemplate;

@SuppressWarnings("all")
public class ShouldAddClasspathRecipes$UnqualifiedRecipe$1_before {
Expand Down
2 changes: 1 addition & 1 deletion src/test/resources/template/ThrowNewRecipe$1_template.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/
package template;
import org.openrewrite.java.*;
import org.openrewrite.java.JavaTemplate;

@SuppressWarnings("all")
public class ThrowNewRecipe$1_template {
Expand Down
2 changes: 1 addition & 1 deletion src/test/resources/template/UnnamedPackage$1_message.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import org.openrewrite.java.*;
import org.openrewrite.java.JavaTemplate;

/**
* OpenRewrite `message` template created for {@code UnnamedPackage$1}.
Expand Down

0 comments on commit dc10492

Please sign in to comment.