airbnb / airbnb/DeepLinkDispatch

Custom annotations not working in Kotlin

Open
#202 3 comments 1 reaction 0 assignees View on GitHub
Dominant language
Kotlin
Stars
4.4k
Forks
414
PR merge metrics
No merged PRs in 30d

Description

I'm trying to use custom annotations on top-level methods in Kotlin. Unfortunately, they don't work. No `DeepLinkEntry`s are generated for them. Only if I annotate at least one static method in a Java class too the correct `DeepLinkEntry`s are generated.

My custom annotation looks like this:
```
@DeepLinkSpec(prefix = arrayOf("http://myapp.com", "https://myapp.com", "myapp://"))
annotation class WebAndAppLink(vararg val value: String)
```
and the annotated top-level method looks like this:
```
@WebAndAppLink("/main")
fun main(context: Context): Intent {
return MainActivity.getIntent(context)
}
```

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue with the shown DeepLinkSpec, WebAndAppLink annotation, and Kotlin top-level main method, first checking annotation processing when no Java static method is present. Trace generation of DeepLinkEntry entries and verify that the Kotlin annotation alone produces the expected entries without requiring a Java class.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, kotlin
Domain
mobile, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.