bumptech / bumptech/glide

Inconsistent Handling of @GlideModule Annotation Between KSP and KAPT

Open
#5,411 2 comments 2 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
35k
Forks
6.2k
Avg merge
1d 11h
Merged PRs (30d)
8

Description

There's a difference in the way KSP handles `@GlideModule` annotation in comparison to KAPT.

* **KSP**: the exact class which is annotated with `@GlideModule` must extend `AppGlideModule` or `LibraryGlideModule`
* **KAPT**: a parent class of the one annotated with `@GlideModule` can extend `AppGlideModule` or `LibraryGlideModule`

**Glide Version**: `4.16.0`

**Issue details / Repro steps / Use case background**:

```kotlin
open class BaseGlideAppModule : AppGlideModule() {

override fun registerComponents(context: Context, glide: Glide, registry: Registry) {
// ... some common behavior (e.g. reused across build variants of an android app)
}
}
```

```kotlin
@GlideModule
class GlideModule : BaseGlideAppModule() {

override fun registerComponents(
context: Context,
glide: Glide,
registry: Registry,
) {
super.registerComponents(context, glide, registry)
// ... registering something
}
}
```
☝️ **this compiles fine when using the compiler with KAPT** (`kapt("com.github.bumptech.glide:compiler:4.16.0")`), **but fails when using KSP** (`ksp("com.github.bumptech.glide:ksp:4.16.0")`) **with** 👇

**Stack trace / LogCat**:
```shell
[ksp] @GlideModule annotated classes must implement AppGlideModule or LibraryGlideModule
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.