Skip to content

Support QUERY method#4595

Open
Goooler wants to merge 5 commits intosquare:trunkfrom
Goooler:query-method
Open

Support QUERY method#4595
Goooler wants to merge 5 commits intosquare:trunkfrom
Goooler:query-method

Conversation

@Goooler
Copy link
Copy Markdown
Contributor

@Goooler Goooler commented Dec 11, 2025

We can't name it to QUERY due to the case-insensitive file systems on MacOS and Windows. Should we rename the annotation to SEARCH or something else?


  • CHANGELOG.md's "Unreleased" section has been updated, if applicable.

We can't name it to `QUERY` due to the case-insensitive file systems on MacOS and Window. Should we rename the annotation to `SEARCH` or something else?
@JakeWharton
Copy link
Copy Markdown
Collaborator

You can write it in Kotlin where the file name doesn't need to match the class name. The case collision isn't a problem for people consuming the jar.

@Goooler
Copy link
Copy Markdown
Contributor Author

Goooler commented Dec 11, 2025

I tried, grouped @Query and @QUERY in the same kt file like:

@MustBeDocumented
@Target(
  AnnotationTarget.FUNCTION,
  AnnotationTarget.PROPERTY_GETTER,
  AnnotationTarget.PROPERTY_SETTER,
)
@Retention(AnnotationRetention.RUNTIME)
annotation class QUERY(
  val value: String = ""
)

@MustBeDocumented
@Target(AnnotationTarget.VALUE_PARAMETER)
@Retention(AnnotationRetention.RUNTIME)
annotation class Query(
  val value: String,
  val encoded: Boolean = false,
)

and ran gw assemble:

/Users/goooler/IdeaProjects/retrofit/retrofit/src/main/java/retrofit2/Converter.java:33: error: cannot find symbol
import retrofit2.http.Query;
                     ^
  symbol:   class Query
  location: package retrofit2.http

@Goooler
Copy link
Copy Markdown
Contributor Author

Goooler commented Dec 11, 2025

We can't leave the single QUERY in the QUERY_METHOD.kt, as the generated QUERY.class still conflicts with Query.class. May need to add a new uber jar configuration to fix the classes bundling.

@Goooler
Copy link
Copy Markdown
Contributor Author

Goooler commented Dec 12, 2025

I added a new source set and moved the QUERY.java into it to avoid the conflict.

@JakeWharton JakeWharton enabled auto-merge (squash) February 12, 2026 03:56
@JakeWharton
Copy link
Copy Markdown
Collaborator

Ugh gotta do something for RoboVM

@Goooler
Copy link
Copy Markdown
Contributor Author

Goooler commented Feb 13, 2026

I took a look at the RoboVM Gradle plugin and it doesn't seem to offer an easy way to support case-insensitive features.

@JakeWharton
Copy link
Copy Markdown
Collaborator

I'm just deleting it. It's time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants