Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Remove crossinline `addInterceptor` and `addNetworkInterceptor` overloads

Open
#9,779 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@Amir-Golmoradi is already working on this.

Since Oct 8, 2026.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
58/100
Issue type
Refactor
Clarity
Clearly specified
Activity status
Active
Tech stack
kotlin

Research direction

Find the builder definitions of addInterceptor and addNetworkInterceptor shown in the issue, then read their call sites and existing tests. Check that removing the overloads leaves Kotlin lambda calls working through the SAM interface and does not introduce Java overload ambiguity; run the relevant tests. Done when both redundant overloads are removed and those usages remain covered.

Written by the indexing model from the issue text.

Description

enhancement

I'm talking about these:

    @JvmName("-addInterceptor") // Prefix with '-' to prevent ambiguous overloads from Java.
    inline fun addInterceptor(crossinline block: (chain: Interceptor.Chain) -> Response) =
      addInterceptor(Interceptor { chain -> block(chain) })

    @JvmName("-addNetworkInterceptor") // Prefix with '-' to prevent ambiguous overloads from Java.
    inline fun addNetworkInterceptor(crossinline block: (chain: Interceptor.Chain) -> Response) =
      addNetworkInterceptor(Interceptor { chain -> block(chain) })

The two APIs are redundant -- Because we can directly pass a SAM lambda in Kotlin. The worse thing is, current Kotlin compiler won't make crossinlined SAM (interface Interceptor) to be invokedynamic, so one new class will be generated when we use this in Kotlin.

They are safe to remove (all Kotlin callsite are complied into addInterceptor(new Interceptor() { ... })

Dominant language
Kotlin
Stars
47.1k
Forks
9.3k
Avg merge
18h 18m
Merged PRs (30d)
15

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from lysine-dev/okhttp

All issues in lysine-dev/okhttp

Similar issues

More Kotlin issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.