Skip to content

Conversation

@Goooler
Copy link
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
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
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
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
Contributor Author

Goooler commented Dec 12, 2025

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

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