jooby-apt: invalid generated Kotlin code in certain edge cases
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Anfängerfreundlichkeit
- 55/100
- Issue-Typ
- Bug
- Klarheit
- Klar beschrieben
- Aktivitätsstatus
- Aktiv
- Bereich
- build-system, tooling
Rechercherichtung
Everything lives in the jooby-apt module, which renders handler signatures as source text. Start by reproducing with the snippet given, then grep the module for the places that map Java types to Kotlin names (the byte[] output) and that emit Reified.set(...)/primitive class lookups for parameterized types, and for the code that writes the package line. Done means the three generated-code defects disappear and existing jooby-apt tests still pass.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
jooby-apt seems to generate uncompilable Kotlin code in some edge cases.
Source code:
import io.jooby.annotation.GET
import io.jooby.annotation.Path
@Path("test")
class Test {
@GET fun test(payload: Set<Int>): ByteArray = byteArrayOf()
}
Generated code:
package
@io.jooby.annotation.Generated(Test::class)
open class Test_ : io.jooby.Extension {
// Omitted for brevity
fun test(ctx: io.jooby.Context): byte[] {
val c = this.factory.apply(ctx)
return c.test(ctx.body(io.jooby.Reified.set<Int>(Integer::class.java).getType()))
}
}
Gradle configuration for good measure:
implementation("io.jooby:jooby:4.6.0")
implementation("io.jooby:jooby-kotlin:4.6.0")
kapt("io.jooby:jooby-apt:4.6.0")
Couple of issues:
ByteArrayis converted tobyte[], which is not a valid Kotlin syntaxSet<Int>is converted toReified.set<Int>(Integer::class.java), which fails at runtime withIllegalArgumentException: Not a primitive type: int. I believe the correct form should beReified.set<Int>(Int::class.javaObjectType)- Dangling
packagestatement (not a big issue since package-less classes are rare, but I thought I'd report it anyway)
- Vorherrschende Sprache
- Java
- Sterne
- 1.8k
- Forks
- 205
- Ø Merge
- 1 T. 3 Std.
- Gemergte PRs (30 T.)
- 15
Entwicklungsumgebung
- Enthält ein Dockerfile oder eine Docker-Compose-Datei
- Keine Pull-Request-Vorlage
- Kein Beitragsleitfaden
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus jooby-project/jooby
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 77/100
jooby-project/jooby#4047 ·
Maintainer antworten meist innerhalb von 1 Tag
-
jooby-opentelemetry not compatible with slf4j-jdk14Evtl. vergeben @froque hat das vor 8 Tagen übernommen. Offenbug opentelemetry
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 53/100
jooby-project/jooby#4042 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 25/100
jooby-project/jooby#4021 · 5 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 38/100
jooby-project/jooby#3766 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Add Jooby CLI to SDKMANOffen
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 25/100
jooby-project/jooby#3521 · 2 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in jooby-project/jooby
Ähnliche Issues
-
needs discussion
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
openfga/openfga.dev#1436 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 2 Tagen
-
Bug feat:Syntax
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 80/100
ignatov/intellij-erlang#1342 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 66/100
commons-app/apps-android-commons#7379 · 3 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag
-
Flaky EnrollmentCoordinatorTest.theNewSettingsShouldNotInheritTheFormerOnesBackoff on WindowsEvtl. vergeben @NassimBtk hat das heute übernommen. Offenbug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
MetricsHub/metricshub-community#1636 ·
Maintainer antworten meist innerhalb von 1 Tag
-
[Bug] no hint/error message for max picture sizeEvtl. vergeben @flahamue hat das heute übernommen. OffenType: Bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
it-at-m/raumreservierung#439 ·
Maintainer antworten meist innerhalb von 1 Tag