Kotlin: a memberless stub the Java side makes for a missing kotlin.* type is used by K2 (Function1.invoke unresolved)
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 28/100
Direzione di ricerca
Reproduce with a Java source set that lacks kotlin-stdlib and mentions kotlin.jvm.functions.Function1, plus Kotlin that calls through Function1; the Java side logs ClassSymbolScanner stub creation. Existing kotlin-package tests in maddi-modification-prepwork and maddi-modification-link put the stdlib on both sides and will not catch this. Done is K2 preferring its own library model over a Java-created stub, or the mixed inspector refusing that classpath mismatch.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Corrected 2026-09-28, the same day it was filed. The first version said that any Java mention of Function1 breaks Kotlin calls. It does not. It happens only when the Java source set does not have kotlin-stdlib on its class path. Then the Java front end creates a memberless stub for kotlin.jvm.functions.Function1, and K2 resolves against that stub. With the stdlib jar as a dependency of the Java source set, the same fixture parses cleanly. The original trigger came from a test harness that put the stdlib on K2's path only.
What remains is a robustness issue, not a correctness one on a buildable project: a stub made by one front end is used by the other.
package k
class X { fun apply(f: (String) -> Unit, s: String) { f(s) } }
| Java source beside it, Java source set WITHOUT kotlin-stdlib | Kotlin apply |
|---|---|
class X { } |
{f.invoke(s);} |
class X { void unrelated(kotlin.jvm.functions.Function1<String, String> g) { } } |
k2-unresolved-call:f at 2:55 |
class X { void unrelated(kotlin.jvm.functions.Function0<String> g) { } } |
fine |
The Java side logs WARN ClassSymbolScanner -- Creating stub type for …, and a Java file that calls a stubbed type is dropped (Dropping compilation unit … (unresolved symbol)). Both are visible. What is not visible is that the Kotlin half then silently loses every call through the stubbed type.
When it matters. It matters when a configuration is incomplete, for example a hand-assembled source-set configuration (as coil needs) that forgets the stdlib on the Java side. The failure lands in Kotlin code that is correct, far from the missing class-path entry.
Options. K2 could prefer its own library model over a stub the Java side created (a stub is marked as such), or the mixed inspector could refuse to run when a Java source set lacks the stdlib while a Kotlin source set in the same project has it.
Not pinned by a test: the tiers in maddi-modification-prepwork and maddi-modification-link (package kotlin) put the stdlib on both sides, as a real build does.
- Lingua principale
- Java
- Stelle
- 1
- Fork
- 1
- Merge medio
- 2h 51m
- PR unite (30g)
- 3
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di CodeLaser/maddi
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
-
build/ci good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
-
bug
Difficoltà 3/5 1-2 giorni Idoneità per principianti 45/100
-
bug
Difficoltà 3/5 1-2 giorni Idoneità per principianti 58/100
-
Java printer: drops the qualifier a call needs (explicit type arguments, a method named yield)Apertabug
Difficoltà 3/5 1-2 giorni Idoneità per principianti 65/100
Tutte le issue di CodeLaser/maddi
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
Netcracker/qubership-integration-platform#1046 ·
I maintainer di solito rispondono entro 2 giorni
-
`check_java_version()` fails when Java path contains spaces (Windows / Git Bash, `C:\Program Files`)Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
-
Fix Math.ceilDiv wrong result for exact positive divisionsForse già presa @pamod-madubashana l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
scala-native/scala-native#5094 ·
I maintainer di solito rispondono entro 1 giorno
-
[Bug] AI unread message badge counts a batch of new bubbles as one messageForse già presa Una pull request collegata a questa issue è aperta o già unita. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
apache/rocketmq-dashboard#5784 ·
I maintainer di solito rispondono entro 3 giorni
-
[i18n] 安装实例完成后的成功提示未正确本地化Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
PCL-Community/PCL-CE#3658 ·
I maintainer di solito rispondono entro 1 giorno