{"record":{"id":"fbf5db4c57da450b","repo":"bumptech/glide","slug":"the-method-annotated-with-glideoption-in-the","errorCode":null,"errorMessage":"The {} method annotated with @GlideOption in the {} @GlideExtension is using a legacy format that is no longer supported. Please change your method definition so that your @GlideModule annotated methods return BaseRequestOptions<?> objects instead of null.","messagePattern":"The (.+?) method annotated with @GlideOption in the (.+?) @GlideExtension is using a legacy format that is no longer supported\\. Please change your method definition so that your @GlideModule annotated methods return BaseRequestOptions<\\?> objects instead of null\\.","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"annotation/compiler/src/main/java/com/bumptech/glide/annotation/compiler/RequestOptionsExtensionGenerator.java","lineNumber":61,"sourceCode":"   * Returns a list containing an override {@link MethodSpec} for all {@link GlideOption} annotated\n   * methods in the classes that correspond to the given extension class names.\n   */\n  List<MethodSpec> generateInstanceMethodsForExtensions(Set<String> glideExtensionClassNames) {\n    List<ExecutableElement> requestOptionExtensionMethods =\n        getRequestOptionExtensionMethods(glideExtensionClassNames);\n\n    List<MethodSpec> result = new ArrayList<>(requestOptionExtensionMethods.size());\n    for (ExecutableElement requestOptionsExtensionMethod : requestOptionExtensionMethods) {\n      result.add(generateMethodsForRequestOptionsExtension(requestOptionsExtensionMethod));\n    }\n\n    return result;\n  }\n\n  private MethodSpec generateMethodsForRequestOptionsExtension(ExecutableElement element) {\n    // Assert for legacy versions\n    if (element.getReturnType().getKind() == TypeKind.VOID) {\n      throw new IllegalArgumentException(\n          \"The \"\n              + element.getSimpleName()\n              + \" method annotated with @GlideOption in the \"\n              + element.getEnclosingElement().getSimpleName()\n              + \" @GlideExtension is using a legacy\"\n              + \" format that is no longer supported. Please change your method definition so that\"\n              + \" your @GlideModule annotated methods return BaseRequestOptions<?> objects instead\"\n              + \" of null.\");\n    }\n\n    int overrideType = processorUtil.getOverrideType(element);\n\n    String methodName = element.getSimpleName().toString();\n    MethodSpec.Builder builder =\n        MethodSpec.methodBuilder(methodName)\n            .addModifiers(Modifier.PUBLIC)\n            .addJavadoc(processorUtil.generateSeeMethodJavadoc(element))\n            .varargs(element.isVarArgs())","sourceCodeStart":43,"sourceCodeEnd":79,"githubUrl":"https://github.com/bumptech/glide/blob/eb14a895d8f866e6a08c3e19d50ea3bd2c12c20a/annotation/compiler/src/main/java/com/bumptech/glide/annotation/compiler/RequestOptionsExtensionGenerator.java#L43-L79","documentation":"Thrown when generating code for a method annotated with @GlideOption inside a @GlideExtension whose return type is void. The current Glide API requires @GlideOption methods to return a BaseRequestOptions<?> (typically the modified options object); the older void-returning signature is no longer supported.","triggerScenarios":"generateMethodsForRequestOptionsExtension() inspects element.getReturnType().getKind(); if it is TypeKind.VOID the legacy-format guard fires. This happens for any @GlideOption extension method declared with a void return.","commonSituations":"Porting a project or sample from an old Glide version (<=3.x or early 4.x previews) whose @GlideOption methods returned void; copy-pasting an outdated Glide extension example; following a stale tutorial.","solutions":["Change the @GlideOption method to return BaseRequestOptions<?> (e.g. RequestOptions or GlideOptions).","Return the options object at the end of the method after applying your customization.","Update the method signature so the first parameter is the RequestOptions/BaseRequestOptions instance.","Rebuild; the processor will now generate the static helper."],"exampleFix":"// before\n@GlideOption\n@GlideExtension\nfun cache( options: RequestOptions) {\n  options.diskCacheStrategy(DiskCacheStrategy.ALL)\n}\n\n// after\n@GlideOption\n@GlideExtension\nfun cache(options: RequestOptions): RequestOptions {\n  return options.diskCacheStrategy(DiskCacheStrategy.ALL)\n}","handlingStrategy":"validation","validationCode":"// @GlideOption methods must return BaseRequestOptions<?>, not void.\n@GlideOption\nfun myOption(options: RequestOptions): RequestOptions {\n  return options.diskCacheStrategy(DiskCacheStrategy.AUTOMATIC)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always return the options object from @GlideOption methods.","Keep the first parameter as the RequestOptions/BaseRequestOptions instance.","Update extension code copied from old Glide samples to the modern signature."],"tags":["annotation-processor","compile-time","glideoption","glideextension","migration"],"backgroundTag":null,"analyzedSha":"eb14a895d8f866e6a08c3e19d50ea3bd2c12c20a","analyzedAt":"2026-08-14T01:43:54.821Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}