Skip to content
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

Replace looseSignature with a better and fine grained annotation #8829

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

utzcoz
Copy link
Member

@utzcoz utzcoz commented Feb 14, 2024

If one method of a shadow class uses the Class that brought by newer SDK than user's compileSdk, and it will cause compiling error for user because Robolectri's Shadows loads this shadow class, and trigger this shadow class to load this new Class. In previous experience, we use looseSignatures to mark shadow class and use Object to replace all input parameters of this method to avoid compiling error and ensure ShadowWrangle can find this method. looseSignatures work fine now, but it's coarse-grained. ClassName can be used to mark the input parameter that has new Class type only, and ShadowWrangle will provide type checking for real input parameter to ensure real passed input parameters match to expected class types.

Close #6888.

Moved from #7770 with a correct branch name.

@utzcoz utzcoz changed the title Replace looseSignature with ClassName Replace looseSignature with a better and fine grained annotation Feb 14, 2024
@utzcoz utzcoz marked this pull request as draft February 14, 2024 08:02
@utzcoz utzcoz force-pushed the looseSignature-fine-grained-replacement branch 4 times, most recently from 5b5d7f1 to 14b93cd Compare February 15, 2024 02:53
Signed-off-by: utzcoz <utzcoz@outlook.com>
@utzcoz utzcoz force-pushed the looseSignature-fine-grained-replacement branch from 14b93cd to 03bebfc Compare February 16, 2024 03:21
@utzcoz
Copy link
Member Author

utzcoz commented Feb 16, 2024

@hoisie It's first round prototype now. I make building and all tests passed with current migrations. At least it can work with standard looseSignature methods, including standard class, internal class, collections with generic, array type, return types. I still work #8841 to try to reduce looseSignature usage occasion for one shadow method for different SDKs as they return different types.

Actually, current implementation has other limitations, but I think it can be reviewed and discussed now. I can continue the improvement based on the first round review suggestions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Investigate supporting WithType for single input parameter of shadow method
1 participant