Skip to content

Remove javapoet dependency #3555

Closed

Description

@fs-alecbg

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

  1. csviri commented on Aug 11, 2026

    @csviri
    Collaborator

    Hi @fs-alecbg , thx for reporting this, do you plan to create a PR for it?

  2. fs-alecbg commented on Aug 11, 2026

    @fs-alecbg
    Author

    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.

  3. csviri commented on Aug 11, 2026

    @csviri
    Collaborator

    oki, np, will try to take a look asap.

  4. linked a pull request that will close this issuechore: remove the JavaPoet dependency #3556on Aug 11, 2026
  5. csviri commented on Aug 11, 2026

    @csviri
    Collaborator

    @fs-alecbg if you have the bandwidth pls take a look on the PR

  6. fs-alecbg commented on Aug 11, 2026

    @fs-alecbg
    Author

    just had a look and approved. Thanks for being so quick with the fix @csviri!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions