Repository navigation
Remove javapoet dependency #3555
Description
Is your feature request related to a problem? Please describe.
Javapoet has not been updated since 2024. At my work, this has made it be deemed an end of life package and thus not approved for use. This blocks our use of the java-operator-sdk library.
Describe the solution you'd like
Remove java poet as a dependency, it's barely used in this codebase (only in io.javaoperatorsdk.operator.config.runtime.ControllerConfigurationAnnotationProcessor) and can be quite trivially swapped out for methods from the standard library.
Describe alternatives you've considered
Sadly none
Additional context
My understanding is that javapoet was used back in 2020 for version 4 of the fabric8 client, but since upgrading to version 5 of fabric8 it's basically not needed anymore.
This is the necessary diff to the main source code
--- a/operator-framework/src/main/java/io/javaoperatorsdk/operator/config/runtime/ControllerConfigurationAnnotationProcessor.java
+++ b/operator-framework/src/main/java/io/javaoperatorsdk/operator/config/runtime/ControllerConfigurationAnnotationProcessor.java
@@ -34,8 +34,6 @@ import org.slf4j.LoggerFactory;
import io.fabric8.kubernetes.client.CustomResource;
import io.javaoperatorsdk.operator.api.reconciler.Reconciler;
-import com.squareup.javapoet.TypeName;
-
import static io.javaoperatorsdk.operator.config.runtime.RuntimeControllerMetadata.RECONCILERS_RESOURCE_PATH;
@SupportedAnnotationTypes("io.javaoperatorsdk.operator.api.reconciler.ControllerConfiguration")
@@ -103,9 +101,12 @@ public class ControllerConfigurationAnnotationProcessor extends AbstractProcesso
+ "': ignoring!");
return;
}
- final TypeName customResourceType = TypeName.get(resourceType);
+ // the resolved resource type is always a declared type, so its element is a TypeElement
+ final var customResourceType =
+ (TypeElement) processingEnv.getTypeUtils().asElement(resourceType);
controllersResourceWriter.add(
- controllerClassSymbol.getQualifiedName().toString(), customResourceType.toString());
+ controllerClassSymbol.getQualifiedName().toString(),
+ customResourceType.getQualifiedName().toString());
Activity
csviri commentedon Aug 11, 2026
Hi @fs-alecbg , thx for reporting this, do you plan to create a PR for it?
fs-alecbg commentedon Aug 11, 2026
I'd really love to, but the process at my work for doing so is a bit of a pain. I actually have the fix locally with some extra tests, but I need to get permission and it's a process.
csviri commentedon Aug 11, 2026
oki, np, will try to take a look asap.
csviri commentedon Aug 11, 2026
@fs-alecbg if you have the bandwidth pls take a look on the PR
fs-alecbg commentedon Aug 11, 2026
just had a look and approved. Thanks for being so quick with the fix @csviri!