File no-formatter.patch of Package caffeine
--- caffeine-2.9.3/caffeine/src/javaPoet/java/com/github/benmanes/caffeine/cache/LocalCacheFactoryGenerator.java 2024-11-15 18:24:57.889200870 +0100
+++ caffeine-2.9.3/caffeine/src/javaPoet/java/com/github/benmanes/caffeine/cache/LocalCacheFactoryGenerator.java 2024-11-15 18:26:14.613025566 +0100
@@ -66,8 +66,6 @@
import com.google.common.collect.Sets;
import com.google.common.io.MoreFiles;
import com.google.common.io.Resources;
-import com.google.googlejavaformat.java.Formatter;
-import com.google.googlejavaformat.java.FormatterException;
import com.squareup.javapoet.ClassName;
import com.squareup.javapoet.FieldSpec;
import com.squareup.javapoet.JavaFile;
@@ -113,7 +111,6 @@
generateLocalCaches();
addFactoryMethods();
writeJavaFile();
- reformat();
}
private void addFactoryMethods() {
@@ -147,22 +144,6 @@
}
}
- private void reformat() throws IOException {
- try (Stream<Path> stream = Files.walk(directory)) {
- List<Path> files = stream
- .filter(path -> path.toString().endsWith(".java"))
- .collect(toList());
- Formatter formatter = new Formatter();
- for (Path file : files) {
- String source = MoreFiles.asCharSource(file, UTF_8).read();
- String formatted = formatter.formatSourceAndFixImports(source);
- MoreFiles.asCharSink(file, UTF_8).write(formatted);
- }
- } catch (FormatterException e) {
- throw new RuntimeException(e);
- }
- }
-
private void addConstants() {
List<String> constants = ImmutableList.of("maximum", "windowMaximum", "mainProtectedMaximum",
"weightedSize", "windowWeightedSize", "mainProtectedWeightedSize");
--- caffeine-2.9.3/caffeine/src/javaPoet/java/com/github/benmanes/caffeine/cache/NodeFactoryGenerator.java 2024-11-15 18:24:57.889200870 +0100
+++ caffeine-2.9.3/caffeine/src/javaPoet/java/com/github/benmanes/caffeine/cache/NodeFactoryGenerator.java 2024-11-15 18:25:56.372908753 +0100
@@ -72,8 +72,6 @@
import com.google.common.collect.Sets;
import com.google.common.io.MoreFiles;
import com.google.common.io.Resources;
-import com.google.googlejavaformat.java.Formatter;
-import com.google.googlejavaformat.java.FormatterException;
import com.squareup.javapoet.ClassName;
import com.squareup.javapoet.FieldSpec;
import com.squareup.javapoet.JavaFile;
@@ -130,7 +128,6 @@
generatedNodes();
addNewFactoryMethods();
writeJavaFile();
- reformat();
}
private void writeJavaFile() throws IOException {
@@ -150,22 +147,6 @@
}
}
- private void reformat() throws IOException {
- try (Stream<Path> stream = Files.walk(directory)) {
- List<Path> files = stream
- .filter(path -> path.toString().endsWith(".java"))
- .collect(toList());
- Formatter formatter = new Formatter();
- for (Path file : files) {
- String source = MoreFiles.asCharSource(file, UTF_8).read();
- String formatted = formatter.formatSourceAndFixImports(source);
- MoreFiles.asCharSink(file, UTF_8).write(formatted);
- }
- } catch (FormatterException e) {
- throw new RuntimeException(e);
- }
- }
-
private void addClassJavaDoc() {
nodeFactory.addJavadoc("<em>WARNING: GENERATED CODE</em>\n\n")
.addJavadoc("A factory for cache nodes optimized for a particular configuration.\n")