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

Solve Java warning "Raw use of parameterized class" #7904

Merged
merged 3 commits into from
Feb 26, 2022

Conversation

Stypox
Copy link
Member

@Stypox Stypox commented Feb 19, 2022

What is it?

  • Bugfix (user facing)
  • Feature (user facing)
  • Codebase improvement (dev facing)
  • Meta improvement to the project (dev facing)

Description of the changes in your PR

I made sure there was no raw use of parameterized classes. Raw means without <> when the class requires it.

  • Use <?> for CacheData since the cache map LRU_CACHE can contain items cache data of different types
  • Replace raw use of JsonSink with the actual classes being passed to functions. This may decrease the generality of the functions having such items as parameters, since they would work for any JsonSynk but are actually only called with one type of JsonSink each time. Maybe just using JsonSink<?> is better? (btw, the definition of JsonSink is recursive for some reason...: public interface JsonSink<SELF extends JsonSink<SELF>>)
  • BaseListInfoFragment now has two parameters: the item type to be shown in the list (I extends InfoItem), and the list info type (previously I extends InfoItemsPage without <>, now renamed to L extends InfoItemsPage<I>). This propagated to all subclasses and allowed solving problems in all of them.
  • In AbstractInfoPlayQueue I turned the raw ListInfo in ListInfo<StreamInfoItem> (if you look at the class, it assumes the list info provides stream info items, and strange things were already being done to cast). I also removed an unused <> parameter U (no idea why that existed, its usage only in an unused constructor made no sense), refactored the constructors to deduplicate code for subclasses and refactored a method to use Java streams.
  • In other places, I added the <Type> where it was missing
  • I refactored some lines in BaseListFragment and StreamItemAdapter

APK testing

The APK can be found by going to the "Checks" tab below the title. On the left pane, click on "CI", scroll down to "artifacts" and click "app" to download the zip file which contains the debug APK of this PR.

Due diligence

Also removes unused <> parameter in AbstractInfoPlayQueue and deduplicates constructor code in extending classes
@Stypox Stypox force-pushed the fix-raw-use-of-parameterized-class branch from 7d89043 to 5f1f52b Compare February 19, 2022 16:54
@Stypox Stypox added the codequality Improvements to the codebase to improve the code quality label Feb 19, 2022
@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

0.0% 0.0% Coverage
0.0% 0.0% Duplication

Copy link
Member

@litetex litetex left a comment

Choose a reason for hiding this comment

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

LGTM

@litetex litetex merged commit 5be40f6 into TeamNewPipe:dev Feb 26, 2022
@Stypox Stypox mentioned this pull request Apr 16, 2022
12 tasks
@Stypox Stypox deleted the fix-raw-use-of-parameterized-class branch August 4, 2022 09:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
codequality Improvements to the codebase to improve the code quality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants