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

KTypeName.toJTypeName() can lead to infinite recursion #2022

Open
bcorso opened this issue Nov 19, 2024 · 0 comments
Open

KTypeName.toJTypeName() can lead to infinite recursion #2022

bcorso opened this issue Nov 19, 2024 · 0 comments
Labels

Comments

@bcorso
Copy link

bcorso commented Nov 19, 2024

Describe the bug

KTypeVariableName.toJTypeVariableName() (and similarly JTypeVariableName.toKTypeVariableName()) method can cause infinite recursion for type variable names that reference themselves (e.g. Enum<E extends Enum<E>>).

Internally, there are methods to avoid this recursion when creating type variable names, e.g. JTypeVariableName#get() and KTypeVariableName#get(), but the public API doesn't have a way to avoid this recursion.

To Reproduce

  1. Get a KTypeName (or JTypeName) of a type like Enum<E extends Enum<E>>
  2. Call KTypeName.toJTypeName() (or JTypeName.toKTypeName())
  3. Should fail with an infinite recursion

Expected behavior

The call should detect this and avoid the infinite recursion.

Additional context

Unfortunately, given the current API, I'm not sure there's a great way to work around this issue. Any ideas would be helpful.

@bcorso bcorso added the bug label Nov 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant