{"record":{"id":"e4b87ee8c01efc93","repo":"bumptech/glide","slug":"requestoptionsextensions-must-be-public-including","errorCode":null,"errorMessage":"RequestOptionsExtensions must be public, including: {}","messagePattern":"RequestOptionsExtensions must be public, including: (.+?)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"annotation/compiler/src/main/java/com/bumptech/glide/annotation/compiler/GlideExtensionValidator.java","lineNumber":51,"sourceCode":" * for an Application.\n */\nfinal class GlideExtensionValidator {\n  private final ProcessingEnvironment processingEnvironment;\n  private final ProcessorUtil processorUtil;\n  private final boolean useLegacyTypeComparison;\n\n  GlideExtensionValidator(\n      ProcessingEnvironment processingEnvironment,\n      ProcessorUtil processorUtil,\n      boolean useLegacyTypeComparison) {\n    this.processingEnvironment = processingEnvironment;\n    this.processorUtil = processorUtil;\n    this.useLegacyTypeComparison = useLegacyTypeComparison;\n  }\n\n  void validateExtension(TypeElement typeElement) {\n    if (!typeElement.getModifiers().contains(Modifier.PUBLIC)) {\n      throw new IllegalArgumentException(\n          \"RequestOptionsExtensions must be public, including: \" + getName(typeElement));\n    }\n    for (Element element : typeElement.getEnclosedElements()) {\n      if (element.getKind() == ElementKind.CONSTRUCTOR) {\n        validateExtensionConstructor(element);\n      } else if (element.getKind() == ElementKind.METHOD) {\n        ExecutableElement executableElement = (ExecutableElement) element;\n        if (executableElement.getAnnotation(GlideOption.class) != null) {\n          validateGlideOption(executableElement);\n        } else if (executableElement.getAnnotation(GlideType.class) != null) {\n          validateGlideType(executableElement);\n        }\n      }\n    }\n  }\n\n  private static String getQualifiedMethodName(ExecutableElement executableElement) {\n    return getEnclosingClassName(executableElement) + \"#\" + getName(executableElement);","sourceCodeStart":33,"sourceCodeEnd":69,"githubUrl":"https://github.com/bumptech/glide/blob/eb14a895d8f866e6a08c3e19d50ea3bd2c12c20a/annotation/compiler/src/main/java/com/bumptech/glide/annotation/compiler/GlideExtensionValidator.java#L33-L69","documentation":"A @GlideExtension class must be public because Glide generates code that references its static methods from the produced RequestOptions/RequestManager subclasses. GlideExtensionValidator.validateExtension checks typeElement.getModifiers().contains(Modifier.PUBLIC) first and rejects anything less visible. Non-public, package-private, internal (Kotlin) or nested-non-public classes all fail.","triggerScenarios":"GlideExtensionValidator.validateExtension runs for every class annotated with @GlideExtension; if the modifiers omit PUBLIC it throws. Hit by a Kotlin `internal class`, a package-private Java class, or a non-public nested class carrying @GlideExtension.","commonSituations":"Kotlin extension written as `class` or `internal class` instead of `class` with `public`; refactoring that dropped the `public` modifier; placing the @GlideExtension on a private nested utility class.","solutions":["Make the @GlideExtension class `public` (Java: `public class`; Kotlin: top-level `class` — Kotlin classes are public by default, so remove any `private`/`internal`).","If the class is nested, ensure both the outer and inner class are public, or move it to a top-level class.","Recompile to confirm validateExtension passes (the validator runs before any method-level checks)."],"exampleFix":"// before\n@GlideExtension\ninternal class MyGlideExtension { ... }   // Kotlin\n\n// after\n@GlideExtension\nclass MyGlideExtension { ... }","handlingStrategy":"validation","validationCode":"@Test void glideExtensionIsPublic() {\n  int mods = MyGlideExtension.class.getModifiers();\n  assertTrue(\"@GlideExtension class must be public\", java.lang.reflect.Modifier.isPublic(mods));\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Make @GlideExtension classes top-level and public (Kotlin classes are public by default).","Avoid `internal`/`private` on Kotlin extension classes.","Add a reflection-based test asserting the visibility of every @GlideExtension class."],"tags":["glide","annotation-processing","glideextension","visibility"],"backgroundTag":null,"analyzedSha":"eb14a895d8f866e6a08c3e19d50ea3bd2c12c20a","analyzedAt":"2026-08-14T01:43:54.821Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}