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

GHTeamBuilder#parentTeamId should accept a long #850

Closed
MarcosCela opened this issue Jun 17, 2020 · 1 comment · Fixed by #851
Closed

GHTeamBuilder#parentTeamId should accept a long #850

MarcosCela opened this issue Jun 17, 2020 · 1 comment · Fixed by #851

Comments

@MarcosCela
Copy link

Describe the bug

The identifier for a GHTeam returns a long, while the team builder accepts an int. This causes
a compile error if not handled.

To Reproduce

I detected this issue because while provisioning teams using the following snippet:

public void example(GHTeam parentTeam){
organization.createTeam(teamName)
                .privacy(Privacy.CLOSED)
                .parentTeamId(parentTeam.getId())  <-- Problematic!
                .description(description)
                .create();
}

The following compile error is raised:

java: incompatible types: possible lossy conversion from long to int

This is due to a recent change: fdcf74e where GHTeam
extends GHObject, which causes an inheritance of the GHObject#getId() that is returning a long,
instead of the previous version of GHTeam#getId() that was returning an int.

Expected behavior

We should be able to "chain" the creation of a team with a direct call without the need for type conversion.

Additional context
I think that this should be as easy as GHTeamBuilder accepting a long instead of an int:

- public GHTeamBuilder parentTeamId(int parentTeamId);
+ public GHTeamBuilder parentTeamId(long parentTeamId);
@bitwiseman
Copy link
Member

Thanks for catching this and the PR.

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

Successfully merging a pull request may close this issue.

2 participants