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

PermissionOverwrite vs ExtendedPermissionOverwrite Discrepancy #1009

Closed
Laarryy opened this issue Sep 26, 2021 · 2 comments · Fixed by Discord4J/discord-json#128
Closed

PermissionOverwrite vs ExtendedPermissionOverwrite Discrepancy #1009

Laarryy opened this issue Sep 26, 2021 · 2 comments · Fixed by Discord4J/discord-json#128
Labels
area/core Related to core module: events, entities, clients, specs bug A general bug help wanted Contributors welcome!
Milestone

Comments

@Laarryy
Copy link

Laarryy commented Sep 26, 2021

To Reproduce:

textChannel#getPermissionOverwrites returns a Set<ExtendedPermissionOverwrite>, while textChannel#addAllPermissionOverwrites requires a Set<PermissionOverwrite>. This means that there is no straightforward way to get the list of permission overwrites for a channel, add n overwrites to it, and then send them off to discord.

Expected Behavior:

After discussion with Panso, the method should potentially relax the type parameter there to allow List<? extends PermissionOverwrite> instead of strictly PermissionOverwrite.

Actual Behavior:

Method permits only PermissionOverwrite and not ExtendedPermissionOverwrite as is provided elsewhere.

Version:

3.2.0-RC3

Other:

@darichey darichey added area/core Related to core module: events, entities, clients, specs bug A general bug good first issue Good for newcomers help wanted Contributors welcome! labels Sep 26, 2021
@darichey darichey added this to the 3.2.x Backlog milestone Sep 26, 2021
@darichey
Copy link
Member

As explained in the issue, I think this is really as simple as

- Possible<List<PermissionOverwrite>> permissionOverwrites();
+ Possible<List<? extends PermissionOverwrite>> permissionOverwrites();

in all of the XChannelEditGenerator. We should still be able to read at least PermissionOverwrite from the list.

@NovaFox161 NovaFox161 mentioned this issue Sep 27, 2021
8 tasks
@skykatik
Copy link
Contributor

skykatik commented Oct 6, 2021

It's not as simple as it seems, Immutables can't handle List<? extends PermissionOverwrite> and throws exception with message "Wildcard as array element is not allowed: ? extends discord4j.core.object.PermissionOverwrite"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/core Related to core module: events, entities, clients, specs bug A general bug help wanted Contributors welcome!
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants