From df875bcdb173d740f6e81e051a357d9a26ba57aa Mon Sep 17 00:00:00 2001 From: Tobias Stamann Date: Thu, 25 Apr 2024 09:39:03 +0200 Subject: [PATCH] [#126]Added AutoCloseable to Writers and Readers --- .../aptk/tools/generators/FileObjectSimpleWriter.java | 2 +- .../toolisticon/aptk/tools/generators/SimpleKotlinWriter.java | 2 +- .../toolisticon/aptk/tools/generators/SimpleResourceReader.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/src/main/java/io/toolisticon/aptk/tools/generators/FileObjectSimpleWriter.java b/tools/src/main/java/io/toolisticon/aptk/tools/generators/FileObjectSimpleWriter.java index c286be68..47212d2e 100644 --- a/tools/src/main/java/io/toolisticon/aptk/tools/generators/FileObjectSimpleWriter.java +++ b/tools/src/main/java/io/toolisticon/aptk/tools/generators/FileObjectSimpleWriter.java @@ -10,7 +10,7 @@ /** * Abstract base class for writers of java code and resources. */ -public class FileObjectSimpleWriter extends SimpleWriter{ +public class FileObjectSimpleWriter extends SimpleWriter implements AutoCloseable{ private final T fileObject; private final Writer foWriter; diff --git a/tools/src/main/java/io/toolisticon/aptk/tools/generators/SimpleKotlinWriter.java b/tools/src/main/java/io/toolisticon/aptk/tools/generators/SimpleKotlinWriter.java index 9379efe4..2785b208 100644 --- a/tools/src/main/java/io/toolisticon/aptk/tools/generators/SimpleKotlinWriter.java +++ b/tools/src/main/java/io/toolisticon/aptk/tools/generators/SimpleKotlinWriter.java @@ -15,7 +15,7 @@ /** * A simple writer for writing kotlin source files. */ -public class SimpleKotlinWriter extends SimpleWriter { +public class SimpleKotlinWriter extends SimpleWriter implements AutoCloseable{ final static String KAPT_KOTLIN_GENERATED = "kapt.kotlin.generated"; private final static Pattern PACKAGE_PATTERN = Pattern.compile("(\\w+?(?:[.]\\w+?)*)[.]\\w*"); diff --git a/tools/src/main/java/io/toolisticon/aptk/tools/generators/SimpleResourceReader.java b/tools/src/main/java/io/toolisticon/aptk/tools/generators/SimpleResourceReader.java index 8379b649..ffdbb793 100644 --- a/tools/src/main/java/io/toolisticon/aptk/tools/generators/SimpleResourceReader.java +++ b/tools/src/main/java/io/toolisticon/aptk/tools/generators/SimpleResourceReader.java @@ -11,7 +11,7 @@ /** * Simple helper class to open and read a resource file. */ -public class SimpleResourceReader { +public class SimpleResourceReader implements AutoCloseable{ private final FileObject fileObject; private final BufferedReader foReader;