Skip to content

cleanup: convert anonymous inner classes to lambdas in test files#8178

Merged
akarnokd merged 1 commit into
ReactiveX:4.xfrom
GautamKumarOffical:cleanup/anonymous-classes-tests
Jun 25, 2026
Merged

cleanup: convert anonymous inner classes to lambdas in test files#8178
akarnokd merged 1 commit into
ReactiveX:4.xfrom
GautamKumarOffical:cleanup/anonymous-classes-tests

Conversation

@GautamKumarOffical

Copy link
Copy Markdown
Contributor

Converts anonymous inner classes to lambdas in test files where the anonymous class implements a functional interface (single abstract method) and has no instance fields or self-references.

Changes in 4 files:

  • BlockingObservableNextTest: new Thread() subclass to new Thread(() -> ...)
  • TestSchedulerTest: new Publisher<Object>() to lambda
  • AbstractSchedulerConcurrencyTests: new Publisher<Integer>() to lambda
  • AbstractSchedulerTests: new Publisher<Integer>() to lambda

Inner classes that use this for recursive scheduling or have instance fields are intentionally kept as-is since lambdas cannot replace those.

Ref: #8080

Replace anonymous inner class usages with lambdas where the type
is a functional interface and the anonymous class has no instance
fields or self-references.

Changes:
- BlockingObservableNextTest: Thread subclass to Thread with lambda
- TestSchedulerTest: Publisher anonymous class to lambda
- AbstractSchedulerConcurrencyTests: Publisher anonymous class to lambda
- AbstractSchedulerTests: Publisher anonymous class to lambda
@github-actions

Copy link
Copy Markdown

🐷 TruffleHog + Entropy Beauty Scan

Average entropy of changed code: 4.735 bits/char
Verdict: ⚠️ Consider review — entropy outside sweet spot

Changed files entropy:

src/main/java/io/reactivex/rxjava4/core/Flowable.java: 4.779
src/main/java/io/reactivex/rxjava4/core/Observable.java: 4.757
src/main/java/io/reactivex/rxjava4/core/config/CompletableConcatConfig.java: 4.771
src/main/java/io/reactivex/rxjava4/core/config/CompletableMergeConfig.java: 4.849
src/main/java/io/reactivex/rxjava4/core/config/FlatMapConfig.java: 4.869
src/main/java/io/reactivex/rxjava4/core/config/GenericConfig.java: 4.848
src/main/java/io/reactivex/rxjava4/core/config/MaybeConcatEagerConfig.java: 4.797
src/main/java/io/reactivex/rxjava4/core/config/MaybeMergeConfig.java: 4.876
src/main/java/io/reactivex/rxjava4/core/config/ObservableCombineLatestConfig.java: 4.820
src/main/java/io/reactivex/rxjava4/core/config/ObservableMergeConfig.java: 4.884
src/main/java/io/reactivex/rxjava4/core/config/ParallelSchedulerConfig.java: 4.724
src/main/java/io/reactivex/rxjava4/core/config/SingleConcatConfig.java: 4.773
src/main/java/io/reactivex/rxjava4/core/config/SingleConcatEagerConfig.java: 4.794
src/main/java/io/reactivex/rxjava4/core/config/SingleMergeConfig.java: 4.869
src/main/java/io/reactivex/rxjava4/observers/TestObserver.java: 4.609
src/main/java/io/reactivex/rxjava4/schedulers/Schedulers.java: 4.730
src/main/java/io/reactivex/rxjava4/subscribers/TestSubscriber.java: 4.602
src/test/java/io/reactivex/rxjava4/core/config/ObservableMergeConfigTest.java: 4.986
src/test/java/io/reactivex/rxjava4/internal/operators/observable/ObservableDebounceTest.java: 4.750
src/test/java/io/reactivex/rxjava4/internal/operators/observable/ObservableFlatMapTest.java: 4.594

✅ No secrets or suspicious high-entropy strings found.

Mid-4 beauty heuristic in action — powered by our entropy chats! 😊

@GautamKumarOffical GautamKumarOffical changed the title cleanup-test-lambdas cleanup: convert anonymous inner classes to lambdas in test files Jun 25, 2026
@akarnokd akarnokd merged commit 972ba74 into ReactiveX:4.x Jun 25, 2026
4 checks passed
@codecov

codecov Bot commented Jun 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.32%. Comparing base (f08aa83) to head (0c7f13c).
⚠️ Report is 3 commits behind head on 4.x.

Additional details and impacted files
@@             Coverage Diff              @@
##                4.x    #8178      +/-   ##
============================================
- Coverage     98.33%   98.32%   -0.02%     
+ Complexity     6935     6933       -2     
============================================
  Files           784      784              
  Lines         48995    48995              
  Branches       6596     6596              
============================================
- Hits          48179    48174       -5     
- Misses          624      627       +3     
- Partials        192      194       +2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants