-
Notifications
You must be signed in to change notification settings - Fork 291
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
KSP resolves classes that are not available to the app #198
Comments
There is an existing bug in KSP where it returns classes that are not available to the application, causing room to find j9 generated class even when it doesn't exist. This CL disables the generated annotation support in KSP for now until the issue is resolved. google/ksp#198 Bug: 160322705 Test: disabled the related test Change-Id: I4bf8f47f124a2288adb0b99e80648a4f5a9a533a
FWIW auto-common changed from trying to tell whether |
interesting, i think we might be using the old version (i checked the impl while copying it). Also, |
i found a workaround by calling setupCompilerArgs on the compile kotlin task in the KspTask. Kapt uses something similar: but it is using the contributor. I've not debugged what is in it. Specifically, if it adds sources etc, that might be a problem. Otherwise, seems like a safe solution? |
Fixed in #270. Solution is what Yigit mentioned in the above. |
* Removed workarounds in KspTypeElement about detecting constructors since KSP now has an API to get check if a function is a constructor * Removed the workaround for google/ksp#175 which seems to be working now. Instead, now we revert some override calls if its jvm signatures won't match. * Updated ksp integration test (room kotlin test app) to use the new kspAndroidTest conffiguration. * Removed the workaround for google/ksp#173 * Re-enabled @generated annotation for KSP: google/ksp#198 * Removed the log for https://github.com/android/kotlin/issues/133 We'll still use custom logic because calling KSP will invoke the descriptor APIs and current implementation is working fine. * Fallback location test now also checks the KSP constructor case google/ksp#273 Bug: 160322705 Test: existing tests Change-Id: I1aef81b0c7475a86d40d38456e765a469ca79de6
Seems like something is wrong with how classpaths are set for android apps (couldn't repro w/ jvm sample but that might be my mistake).
See the attached project where I have an android module and a ksp processor module.
The KSP processor checks for the availability of the
javax.annotation.processing.Generated
class and adds that annotation if available.Unfortunately, KSP does return that class even though it is not available to the app, causing compilation failure.
Make sure to compile the attached project with a JDK where that class is available. (I'm using J11). I'm guessing it is why the class shows up.
I tried adding the following line to the app module but didn't help:
ksp-android-classpath-bug.zip
The text was updated successfully, but these errors were encountered: