Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RequestConverter causing compile error #621

Closed
DatL4g opened this issue Jul 28, 2024 · 1 comment · Fixed by #627
Closed

RequestConverter causing compile error #621

DatL4g opened this issue Jul 28, 2024 · 1 comment · Fixed by #627
Assignees
Labels
bug Something isn't working

Comments

@DatL4g
Copy link
Contributor

DatL4g commented Jul 28, 2024

Ktorfit version

2.0.0

What happened and how can we reproduce this issue?

Adding @RequestType causes compile exception.

Example:

@GET("trending/all/{window}")
suspend fun all(
	@RequestType(String::class) @Path("window") window: Boolean,
	@Query("language") language: String
): HttpResponse
Stacktrace:
[ksp] java.util.NoSuchElementException: List is empty.
	at kotlin.collections.CollectionsKt___CollectionsKt.first(_Collections.kt:221)
	at de.jensklingenberg.ktorfit.reqBuilderExtension.RequestConverterTextKt.addRequestConverterText(RequestConverterText.kt:13)
	at de.jensklingenberg.ktorfit.model.FunctionData.toFunSpec(FunctionData.kt:36)
	at de.jensklingenberg.ktorfit.model.ClassDataKt.getImplClassFileSource(ClassData.kt:116)
	at de.jensklingenberg.ktorfit.generator.ClassGeneratorKt.generateImplClass(ClassGenerator.kt:25)
	at de.jensklingenberg.ktorfit.KtorfitProcessor.process(KtorfitProcessor.kt:40)
	at com.google.devtools.ksp.AbstractKotlinSymbolProcessingExtension$doAnalysis$8$1.invoke(KotlinSymbolProcessingExtension.kt:310)
	at com.google.devtools.ksp.AbstractKotlinSymbolProcessingExtension$doAnalysis$8$1.invoke(KotlinSymbolProcessingExtension.kt:308)
	at com.google.devtools.ksp.AbstractKotlinSymbolProcessingExtension.handleException(KotlinSymbolProcessingExtension.kt:414)
	at com.google.devtools.ksp.AbstractKotlinSymbolProcessingExtension.doAnalysis(KotlinSymbolProcessingExtension.kt:308)
	at org.jetbrains.kotlin.analyzer.common.CommonResolverForModuleFactory$Companion.analyzeFiles(CommonResolverForModuleFactory.kt:204)
	at org.jetbrains.kotlin.analyzer.common.CommonResolverForModuleFactory$Companion.analyzeFiles$default(CommonResolverForModuleFactory.kt:143)
	at org.jetbrains.kotlin.cli.metadata.CommonAnalysisKt.runCommonAnalysisIteration$lambda$1(CommonAnalysis.kt:72)
	at org.jetbrains.kotlin.cli.common.messages.AnalyzerWithCompilerReport.analyzeAndReport(AnalyzerWithCompilerReport.kt:115)
	at org.jetbrains.kotlin.cli.metadata.CommonAnalysisKt.runCommonAnalysisIteration(CommonAnalysis.kt:71)
	at org.jetbrains.kotlin.cli.metadata.CommonAnalysisKt.runCommonAnalysisForSerialization(CommonAnalysis.kt:38)
	at org.jetbrains.kotlin.cli.metadata.K2MetadataKlibSerializer.analyze(K2MetadataKlibSerializer.kt:45)
	at org.jetbrains.kotlin.cli.metadata.K2MetadataKlibSerializer.analyze(K2MetadataKlibSerializer.kt:40)
	at org.jetbrains.kotlin.cli.metadata.AbstractMetadataSerializer.analyzeAndSerialize(AbstractMetadataSerializer.kt:34)
	at org.jetbrains.kotlin.cli.metadata.K2MetadataCompiler.doExecute(K2MetadataCompiler.kt:134)
	at org.jetbrains.kotlin.cli.metadata.K2MetadataCompiler.doExecute(K2MetadataCompiler.kt:48)
	at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:104)
	at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:48)
	at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:101)
	at org.jetbrains.kotlin.daemon.CompileServiceImpl.compile(CompileServiceImpl.kt:1556)
	at jdk.internal.reflect.GeneratedMethodAccessor14.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at java.rmi/sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:360)
	at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:200)
	at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:197)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:712)
	at java.rmi/sun.rmi.transport.Transport.serviceCall(Transport.java:196)
	at java.rmi/sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:587)
	at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:828)
	at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:705)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
	at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:704)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
	at java.base/java.lang.Thread.run(Thread.java:840)

What did you expect to happen?

Well, no compile error and working Converter.Factory integration of requestParameterConverter

Is there anything else we need to know about?

Maybe #511 related but not sure

@DatL4g DatL4g added the bug Something isn't working label Jul 28, 2024
@Foso Foso self-assigned this Aug 8, 2024
@Foso
Copy link
Owner

Foso commented Aug 8, 2024

Hi @DatL4g thank you for your bug report. I found the reason for the bug

@Foso Foso linked a pull request Aug 8, 2024 that will close this issue
1 task
@Foso Foso closed this as completed in #627 Aug 8, 2024
github-actions bot pushed a commit to abendt/arrow-ktor that referenced this issue Aug 26, 2024
Bumps [de.jensklingenberg.ktorfit](https://github.com/Foso/Ktorfit) from
2.0.0 to 2.0.1.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/Foso/Ktorfit/releases">de.jensklingenberg.ktorfit's
releases</a>.</em></p>
<blockquote>
<h1>2.0.1 - 2024-08-08</h1>
<p>Fixed</p>
<pre><code>[#594](Foso/Ktorfit#594) Endpoint
with types from other module
[#591](Foso/Ktorfit#591) Ktorfit plugin
doesn't include correct generate source if build directory changes
[#591](Foso/Ktorfit#591)
[#621](Foso/Ktorfit#621) RequestConverter
causing compile error
Build with Ktor 2.3.12
</code></pre>
<h2>New Contributors</h2>
<ul>
<li><a href="https://github.com/bidrohi"><code>@​bidrohi</code></a> made
their first contribution in <a
href="https://github.com/Foso/Ktorfit/pull/592">Foso/Ktorfit#592</a></li>
<li><a href="https://github.com/Goooler"><code>@​Goooler</code></a> made
their first contribution in <a
href="https://github.com/Foso/Ktorfit/pull/612">Foso/Ktorfit#612</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/Foso/Ktorfit/compare/2.0.0...2.0.1">https://github.com/Foso/Ktorfit/compare/2.0.0...2.0.1</a></p>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/Foso/Ktorfit/blob/master/docs/CHANGELOG.md">de.jensklingenberg.ktorfit's
changelog</a>.</em></p>
<blockquote>
<h1><a href="">2.0.1</a></h1>
<h1>compiler-plugin:2.0.1-2.0.10 - 2024-08-10</h1>
<ul>
<li>Kotlin 2.0.10</li>
</ul>
<h1>2.0.1 - 2024-08-08</h1>
<h3>Fixed</h3>
<ul>
<li><a
href="https://github.com/Foso/Ktorfit/issues/594">#594</a>
Endpoint with types from other module</li>
<li><a
href="https://github.com/Foso/Ktorfit/issues/591">#591</a>
Ktorfit plugin doesn't include correct generate source if build
directory changes <a
href="https://github.com/Foso/Ktorfit/issues/591">#591</a></li>
<li><a
href="https://github.com/Foso/Ktorfit/issues/621">#621</a>
RequestConverter causing compile error</li>
<li>Build with Ktor 2.3.12</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/Foso/Ktorfit/commit/7a7d7dca8459dd2fbd110c4eb79a878c3ed8bffa"><code>7a7d7dc</code></a>
Release 2.0.1 (<a
href="https://github.com/Foso/Ktorfit/issues/628">#628</a>)</li>
<li><a
href="https://github.com/Foso/Ktorfit/commit/19fc43f9debd37823f704d92882b0330c9ce2e5f"><code>19fc43f</code></a>
Fix compile issue with RequestType and multiple parameters (<a
href="https://github.com/Foso/Ktorfit/issues/627">#627</a>)</li>
<li><a
href="https://github.com/Foso/Ktorfit/commit/b5117cde5505bcac23657e2a759126d9af18ffff"><code>b5117cd</code></a>
Set dynamic lib name</li>
<li><a
href="https://github.com/Foso/Ktorfit/commit/84591bdb5214397f1f18ef9a509636aa14523680"><code>84591bd</code></a>
Update to Ktor 2.3.12 (<a
href="https://github.com/Foso/Ktorfit/issues/625">#625</a>)</li>
<li><a
href="https://github.com/Foso/Ktorfit/commit/0b407d0951a24c4283d40f723092108b72b14542"><code>0b407d0</code></a>
Update to KSP 1.0.24 (<a
href="https://github.com/Foso/Ktorfit/issues/624">#624</a>)</li>
<li><a
href="https://github.com/Foso/Ktorfit/commit/9aec19e95fded65a53cdd38d65fb498dc5fd2a81"><code>9aec19e</code></a>
Merge remote-tracking branch 'origin/master'</li>
<li><a
href="https://github.com/Foso/Ktorfit/commit/e25c9a8a60dd60cbf8dfa3211e14c63325a34230"><code>e25c9a8</code></a>
Update changelog</li>
<li><a
href="https://github.com/Foso/Ktorfit/commit/16fa387157c48cd23214e6bf6b5a3b1b79c7faeb"><code>16fa387</code></a>
build(deps): bump gradle/actions from 3 to 4 (<a
href="https://github.com/Foso/Ktorfit/issues/623">#623</a>)</li>
<li><a
href="https://github.com/Foso/Ktorfit/commit/03bec9a510c58f37b8aaa2c3d9eff14e22daa7e2"><code>03bec9a</code></a>
Polish badges (<a
href="https://github.com/Foso/Ktorfit/issues/612">#612</a>)</li>
<li><a
href="https://github.com/Foso/Ktorfit/commit/8457b0660ef473b09ba5ce7864df97565196e358"><code>8457b06</code></a>
Add OptIn annotation</li>
<li>Additional commits viewable in <a
href="https://github.com/Foso/Ktorfit/compare/2.0.0...2.0.1">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=de.jensklingenberg.ktorfit&package-manager=gradle&previous-version=2.0.0&new-version=2.0.1)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants