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

Redundant visibility modifier added on interfaces #1880

Closed
j-roskopf opened this issue Apr 12, 2024 · 3 comments
Closed

Redundant visibility modifier added on interfaces #1880

j-roskopf opened this issue Apr 12, 2024 · 3 comments

Comments

@j-roskopf
Copy link

j-roskopf commented Apr 12, 2024

Describe the bug

When generating an interface, redundant public modifier is added to nested types. I see in the documentation, that compatibility with explicit API mode is desired, but this modifier is not required for explicit API mode compatibility.

To Reproduce

TypeSpec.interfaceBuilder("PageAction")
  .addModifiers(KModifier.INTERNAL)
  .addType(TypeSpec.objectBuilder("Run").build())
  .build()

Results in:

internal interface PageAction {
  public object Run
}

But public visibility modifier is redundant.

Expected behavior
I'd expect the public visibility modifier to not be added.

Screenshot 2024-04-12 at 7 26 27 AM

@j-roskopf j-roskopf added the bug label Apr 12, 2024
@JakeWharton
Copy link
Collaborator

This has nothing to do with sealed, but is instead a property of interface whose members and nested types are always public.

@JakeWharton JakeWharton changed the title Redundant visibility modifier added on Sealed types Redundant visibility modifier added on interfaces Apr 12, 2024
@j-roskopf
Copy link
Author

That makes sense! The original info was more limiting than it needed to be. It extends beyond interfaces though to classes etc though, no?

internal class Class {
  private val _flow: MutableStateFlow<String> =
    MutableStateFlow("")

  public val flow: StateFlow<String>
    get() = _flow.asStateFlow()
}

Where flow is unnecessarily public. Just want to try and understand the full scope, seems like a fun first issue to try and tackle

@JakeWharton
Copy link
Collaborator

Ah, indeed. This is once again #1301 then!

@JakeWharton JakeWharton closed this as not planned Won't fix, can't repro, duplicate, stale Apr 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants