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

Fix identifiable stream #2520

Merged
merged 3 commits into from
Mar 27, 2023
Merged

Fix identifiable stream #2520

merged 3 commits into from
Mar 27, 2023

Conversation

flo-dup
Copy link
Contributor

@flo-dup flo-dup commented Mar 27, 2023

Please check if the PR fulfills these requirements

  • The commit message follows our guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

Does this PR already have an issue describing the problem?
No

What kind of change does this PR introduce?
Bug fix

What is the current behavior?
ClassCastException when network.getIdentifiableStream(IdentifiableType.BATTERY)

flo-dup added 2 commits March 27, 2023 12:32
Signed-off-by: Florian Dupuy <florian.dupuy@rte-france.com>
Signed-off-by: Florian Dupuy <florian.dupuy@rte-france.com>
@@ -1194,38 +1195,38 @@ default Network setMinimumAcceptableValidationLevel(ValidationLevel validationLe
return this;
}

default <I extends Identifiable<I>> Stream<I> getIdentifiableStream(IdentifiableType identifiableType) {
default Stream<Identifiable<?>> getIdentifiableStream(IdentifiableType identifiableType) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't work with previous signature?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it does, but the <I extends Identifiable<I>> is not needed, we only need identifiables when we use it.
Besides before we could write this:

Stream<VoltageLevel> loads = network.getIdentifiableStream(IdentifiableType.LOAD);

So that's another fix in fact

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

73.3% 73.3% Coverage
0.0% 0.0% Duplication

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

73.3% 73.3% Coverage
0.0% 0.0% Duplication

@miovd miovd merged commit 9e4593b into main Mar 27, 2023
@miovd miovd deleted the fix_identifiable_stream branch March 27, 2023 14:25
miovd pushed a commit that referenced this pull request Mar 30, 2023
Signed-off-by: Florian Dupuy <florian.dupuy@rte-france.com
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants