Skip to content

Instantly share code, notes, and snippets.

@cesar1000
Created July 5, 2020 03:19
Show Gist options
  • Save cesar1000/d4d31184add91df64bead71114a04ce6 to your computer and use it in GitHub Desktop.
Save cesar1000/d4d31184add91df64bead71114a04ce6 to your computer and use it in GitHub Desktop.
Indeterministic Kapt stub generation
class BlockUserItemHydrator() : RichFeedbackActionItemHydrator<TwitterUser, RichFeedbackBehaviorBlockUser> {
override fun RichFeedbackBehaviorBlockUser.hydrate(): Pair<RichFeedbackBehaviorBlockUser, TwitterUser?> =
RichFeedbackBehaviorBlockUser.DEFAULT to null
override fun getPrompt(data: TwitterUser): String = "" // implementation removed
@HorizonIcon
override fun getIcon(data: TwitterUser): String? = null // implementation removed
}
interface RichFeedbackActionItemHydrator<Data, RFB : RichFeedbackBehavior> {
fun RFB.hydrate(): Pair<RFB, Data?>
/** This comment is discarded, since the method is overridden. */
fun getPrompt(data: Data): String? = null
/** This comment is picked up only if this interface is in the compilation. */
fun getConfirmation(data: Data): String? = null
@HorizonIcon
fun getIcon(data: Data): String?
fun hydrate(
prompt: FeedbackAction.PromptInfo,
feedback: RFB
): FeedbackAction.PromptInfo? = null // implementation removed
fun hydrate(
action: FeedbackAction,
behavior: RFB
): FeedbackAction? = null // implementation removed
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment