ballerina-lang icon indicating copy to clipboard operation
ballerina-lang copied to clipboard

[Refactoring] Replace `collect(Collectors.toList())` with `toList()`

Open f-schnabel opened this issue 1 year ago • 1 comments

Purpose

This is a continuation of PR #42894. Somehow I missed a lot of places where collect(Collectors.toList()) is still used. I also had to fix some typing issues since the resulting types of the Lists are not 100% the same:

  • collect(Collectors.toList()) can return List<? super T>
  • toList() returns List<T>

Which means collect(Collectors.toList()) can convert from List<String> to List<Object> but toList() can't. I fixed the type signatures so they respect the more explicit type.

Check List

  • [x] Read the Contributing Guide
  • [ ] Updated Change Log
  • [ ] Checked Tooling Support (#<Issue Number>)
  • [ ] Added necessary tests
    • [ ] Unit Tests
    • [ ] Spec Conformance Tests
    • [ ] Integration Tests
    • [ ] Ballerina By Example Tests
  • [ ] Increased Test Coverage
  • [ ] Added necessary documentation
    • [ ] API documentation
    • [ ] Module documentation in Module.md files
    • [ ] Ballerina By Examples

f-schnabel avatar Jun 11 '24 20:06 f-schnabel

Codecov Report

Attention: Patch coverage is 83.22981% with 54 lines in your changes missing coverage. Please review.

Project coverage is 77.50%. Comparing base (0477a4a) to head (02c4210). Report is 95 commits behind head on master.

Files with missing lines Patch % Lines
...main/java/io/ballerina/projects/ModuleContext.java 0.00% 10 Missing :warning:
...a/io/ballerina/cli/launcher/util/BalToolsUtil.java 0.00% 2 Missing :warning:
...ternal/repositories/AbstractPackageRepository.java 33.33% 1 Missing and 1 partial :warning:
...completion/context/AsyncSendActionNodeContext.java 0.00% 2 Missing :warning:
...bugadapter/completion/util/QNameReferenceUtil.java 0.00% 2 Missing :warning:
...ebugadapter/jdi/ThreadGroupReferenceProxyImpl.java 0.00% 2 Missing :warning:
...a/semver/checker/comparator/ServiceComparator.java 50.00% 2 Missing :warning:
...allerina/toml/syntax/tree/AbstractNodeFactory.java 33.33% 2 Missing :warning:
.../java/io/ballerina/shell/utils/ModuleImporter.java 0.00% 1 Missing :warning:
...rc/main/java/io/ballerina/cli/cmd/CommandUtil.java 50.00% 1 Missing :warning:
... and 28 more
Additional details and impacted files
@@             Coverage Diff              @@
##             master   #42904      +/-   ##
============================================
- Coverage     77.50%   77.50%   -0.01%     
+ Complexity    58581    58577       -4     
============================================
  Files          3438     3438              
  Lines        219214   219196      -18     
  Branches      28919    28909      -10     
============================================
- Hits         169910   169887      -23     
- Misses        39890    39896       +6     
+ Partials       9414     9413       -1     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Jun 27 '24 14:06 codecov[bot]

I don't understand why the pipeline fails. Could someone please restart it to see if the test was flaky?

f-schnabel avatar Jul 19 '24 10:07 f-schnabel

This PR has been open for more than 15 days with no activity. This will be closed in 3 days unless the stale label is removed or commented.

github-actions[bot] avatar Aug 18 '24 19:08 github-actions[bot]

This PR has been open for more than 15 days with no activity. This will be closed in 3 days unless the stale label is removed or commented.

github-actions[bot] avatar Sep 06 '24 19:09 github-actions[bot]

@Shadow-Devil Some stdlib levels seem to be failing. Shall we retrigger and check?

Dilhasha avatar Sep 12 '24 05:09 Dilhasha

@Dilhasha it would be great if you could retrigger the failing pipelines. Thank you!

f-schnabel avatar Sep 12 '24 11:09 f-schnabel

I'm really confused why the test org.ballerinalang.langserver.diagnostics.CyclicDependenciesTest is failing:

org.mockito.exceptions.verification.WantedButNotInvoked: 	
Wanted but not invoked:	
extendedLanguageClient.showMessage(<any>);	
-> at org.ballerinalang.langserver.diagnostics.CyclicDependenciesTest.testCyclicDependenciesOnOpen(CyclicDependenciesTest.java:69)	
Actually, there were zero interactions with this mock.

Maybe someone could help debug this, since I don't know how to resolve this. Otherwise I will debug it in some weeks since I don't have time at the moment.

f-schnabel avatar Sep 13 '24 16:09 f-schnabel