-
Notifications
You must be signed in to change notification settings - Fork 269
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
overrides check with a protected java methods throws IllegalStateException #34
Comments
Seems like it has nothing to do w/ Any or equals. e.g. with the following code:
Checking |
some more information. Seems like it is an issue specific to More specifically, if I get a class via So seems like an issue in resolver. |
I tried extending the
If I visit the declaration by directly getting it via:
it prints:
In some ways, getting it via resolver seems to be returning a more complete information (e.g. |
They should always be same implementation, I noticed this issue last week but since the fix was rather small and inside the implementation detail therefore I didn't make it an issue, was planning to address it myself, sorry for the confusion. |
It's true that descriptors contains most detailed information as they are fully resolved, but they are not representing the original code structure, like the implicit OPEN for Java symbols, and hence it will be nice if users won't rely on this buggy behavior of getClassDeclarationByName always returns descriptor based implementation. |
i think both are probably fine from developer's perspective as long as it is consistent. but when they are inconsistent, it will be really hard to workaround as most of the code in the symbol processor does not necessarily know how the KSClassDeclaration was acquired. |
If consistent mean .isOpen() will return always return true for an open class regardless of JavaImpl or DescriptorImpl, they are consistent by our design. We are making modifiers only include explicit modifier just to make sure there is a way to still inspect code. Developers should look at utility functions like isOpen rather than relying on modifiers which can differ by platform. |
I agree with that. |
android/kotlin#51 includes a fix to this reproduce project. |
Modifiers are platform dependent hence we should not access them directly, instead, use helper methods which we can make platform specific once we add support for KSP. see: https://github.com/android/kotlin/issues/48#issuecomment-652126757 Bug: 160323720 Test: existing test suite Change-Id: I79678beff3b3a087bd961db39edaa2fca1fd5ec1
override-bug.zip
See attached sample for repro (simply run its tests)
If I have a java class like this:
And try to check if
test
overridesAny.equals
, it throws IllegalStateException.The text was updated successfully, but these errors were encountered: