From 80e9ead9e5f831d75e12cee9fed621bd5463b64e Mon Sep 17 00:00:00 2001 From: lingenj Date: Tue, 7 Jan 2025 15:10:24 +0100 Subject: [PATCH] Remove `TimedTodo` to be more like the other java parsers --- .../java/ReloadableJava8Parser.java | 34 +------------------ 1 file changed, 1 insertion(+), 33 deletions(-) diff --git a/rewrite-java-8/src/main/java/org/openrewrite/java/ReloadableJava8Parser.java b/rewrite-java-8/src/main/java/org/openrewrite/java/ReloadableJava8Parser.java index 0a7963b22f2..e97d62a37df 100644 --- a/rewrite-java-8/src/main/java/org/openrewrite/java/ReloadableJava8Parser.java +++ b/rewrite-java-8/src/main/java/org/openrewrite/java/ReloadableJava8Parser.java @@ -23,8 +23,6 @@ import com.sun.tools.javac.util.Context; import com.sun.tools.javac.util.Log; import com.sun.tools.javac.util.Options; -import io.micrometer.core.instrument.Metrics; -import io.micrometer.core.instrument.Timer; import lombok.Getter; import org.jspecify.annotations.Nullable; import org.objectweb.asm.ClassReader; @@ -33,7 +31,6 @@ import org.openrewrite.ExecutionContext; import org.openrewrite.InMemoryExecutionContext; import org.openrewrite.SourceFile; -import org.openrewrite.internal.MetricsHelper; import org.openrewrite.internal.StringUtils; import org.openrewrite.java.internal.JavaTypeCache; import org.openrewrite.java.tree.J; @@ -268,7 +265,7 @@ LinkedHashMap parseInputsToCompilerAst(Iterable if (!annotationProcessors.isEmpty()) { compiler.processAnnotations(jcCompilationUnits, nil()); } - compiler.attribute(new TimedTodo(compiler.todo)); + compiler.attribute(compiler.todo); } catch (Throwable t) { // when symbol entering fails on problems like missing types, attribution can often times proceed // unhindered, but it sometimes cannot (so attribution is always best-effort in the presence of errors) @@ -347,35 +344,6 @@ public void reset(Collection uris) { } } - private static class TimedTodo extends Todo { - private final Todo todo; - private Timer.@Nullable Sample sample; - - private TimedTodo(Todo todo) { - super(new Context()); - this.todo = todo; - } - - @Override - public boolean isEmpty() { - if (sample != null) { - sample.stop(MetricsHelper.successTags( - Timer.builder("rewrite.parse") - .description("The time spent by the JDK in type attributing the source file") - .tag("file.type", "Java") - .tag("step", "(2) Type attribution")) - .register(Metrics.globalRegistry)); - } - return todo.isEmpty(); - } - - @Override - public Env remove() { - this.sample = Timer.start(); - return todo.remove(); - } - } - private static class ByteArrayCapableJavacFileManager extends JavacFileManager { private final List classByteClasspath;