From 58df281975664b1bb4962594c5126d488e0d9c85 Mon Sep 17 00:00:00 2001 From: Coffeemakr Date: Thu, 30 Nov 2017 11:34:26 +0100 Subject: [PATCH] Make some fields final --- src/main/java/org/schabi/newpipe/extractor/Info.java | 2 +- src/main/java/org/schabi/newpipe/extractor/Subtitles.java | 7 ++++--- .../org/schabi/newpipe/extractor/SuggestionExtractor.java | 2 +- .../schabi/newpipe/extractor/kiosk/KioskExtractor.java | 2 +- .../org/schabi/newpipe/extractor/kiosk/KioskList.java | 8 ++++---- .../org/schabi/newpipe/extractor/search/SearchEngine.java | 2 +- .../soundcloud/SoundcloudChannelInfoItemExtractor.java | 2 +- .../soundcloud/SoundcloudPlaylistInfoItemExtractor.java | 2 +- .../newpipe/extractor/services/youtube/ItagItem.java | 4 ++-- .../services/youtube/YoutubeChannelInfoItemExtractor.java | 2 +- .../youtube/YoutubePlaylistInfoItemExtractor.java | 2 +- .../schabi/newpipe/extractor/stream/SubtitlesFormat.java | 4 ++-- .../org/schabi/newpipe/extractor/stream/VideoStream.java | 4 ++-- 13 files changed, 22 insertions(+), 21 deletions(-) diff --git a/src/main/java/org/schabi/newpipe/extractor/Info.java b/src/main/java/org/schabi/newpipe/extractor/Info.java index c704717e6..9fa8e130e 100644 --- a/src/main/java/org/schabi/newpipe/extractor/Info.java +++ b/src/main/java/org/schabi/newpipe/extractor/Info.java @@ -16,7 +16,7 @@ public abstract class Info implements Serializable { public final String url; public final String name; - public List errors = new ArrayList<>(); + public final List errors = new ArrayList<>(); public void addError(Throwable throwable) { this.errors.add(throwable); diff --git a/src/main/java/org/schabi/newpipe/extractor/Subtitles.java b/src/main/java/org/schabi/newpipe/extractor/Subtitles.java index 0542b385e..9427bf528 100644 --- a/src/main/java/org/schabi/newpipe/extractor/Subtitles.java +++ b/src/main/java/org/schabi/newpipe/extractor/Subtitles.java @@ -3,9 +3,10 @@ package org.schabi.newpipe.extractor; import org.schabi.newpipe.extractor.stream.SubtitlesFormat; public class Subtitles { - private SubtitlesFormat format; - private String languageCode, URL; - private boolean autoGenerated; + private final SubtitlesFormat format; + private final String languageCode; + private final String URL; + private final boolean autoGenerated; public Subtitles(SubtitlesFormat format, String languageCode, String URL, boolean autoGenerated) { this.format = format; diff --git a/src/main/java/org/schabi/newpipe/extractor/SuggestionExtractor.java b/src/main/java/org/schabi/newpipe/extractor/SuggestionExtractor.java index 983adc07e..d7c9cdca7 100644 --- a/src/main/java/org/schabi/newpipe/extractor/SuggestionExtractor.java +++ b/src/main/java/org/schabi/newpipe/extractor/SuggestionExtractor.java @@ -27,7 +27,7 @@ import java.util.List; public abstract class SuggestionExtractor { - private int serviceId; + private final int serviceId; public SuggestionExtractor(int serviceId) { this.serviceId = serviceId; diff --git a/src/main/java/org/schabi/newpipe/extractor/kiosk/KioskExtractor.java b/src/main/java/org/schabi/newpipe/extractor/kiosk/KioskExtractor.java index 5df579e7a..923f5d033 100644 --- a/src/main/java/org/schabi/newpipe/extractor/kiosk/KioskExtractor.java +++ b/src/main/java/org/schabi/newpipe/extractor/kiosk/KioskExtractor.java @@ -30,7 +30,7 @@ import java.io.IOException; public abstract class KioskExtractor extends ListExtractor { private String contentCountry = null; - private String id = null; + private final String id; public KioskExtractor(StreamingService streamingService, String url, diff --git a/src/main/java/org/schabi/newpipe/extractor/kiosk/KioskList.java b/src/main/java/org/schabi/newpipe/extractor/kiosk/KioskList.java index bbaab0092..5256af8e0 100644 --- a/src/main/java/org/schabi/newpipe/extractor/kiosk/KioskList.java +++ b/src/main/java/org/schabi/newpipe/extractor/kiosk/KioskList.java @@ -19,8 +19,8 @@ public class KioskList { throws ExtractionException, IOException; } - private int service_id; - private HashMap kioskList = new HashMap<>(); + private final int service_id; + private final HashMap kioskList = new HashMap<>(); private String defaultKiosk = null; private class KioskEntry { @@ -28,8 +28,8 @@ public class KioskList { extractorFactory = ef; handler = h; } - KioskExtractorFactory extractorFactory; - UrlIdHandler handler; + final KioskExtractorFactory extractorFactory; + final UrlIdHandler handler; } public KioskList(int service_id) { diff --git a/src/main/java/org/schabi/newpipe/extractor/search/SearchEngine.java b/src/main/java/org/schabi/newpipe/extractor/search/SearchEngine.java index b9f9fa393..878888324 100644 --- a/src/main/java/org/schabi/newpipe/extractor/search/SearchEngine.java +++ b/src/main/java/org/schabi/newpipe/extractor/search/SearchEngine.java @@ -35,7 +35,7 @@ public abstract class SearchEngine { } } - private InfoItemSearchCollector collector; + private final InfoItemSearchCollector collector; public SearchEngine(int serviceId) { collector = new InfoItemSearchCollector(serviceId); diff --git a/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudChannelInfoItemExtractor.java b/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudChannelInfoItemExtractor.java index 773e8e405..532c059b8 100644 --- a/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudChannelInfoItemExtractor.java +++ b/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudChannelInfoItemExtractor.java @@ -4,7 +4,7 @@ import com.grack.nanojson.JsonObject; import org.schabi.newpipe.extractor.channel.ChannelInfoItemExtractor; public class SoundcloudChannelInfoItemExtractor implements ChannelInfoItemExtractor { - private JsonObject searchResult; + private final JsonObject searchResult; public SoundcloudChannelInfoItemExtractor(JsonObject searchResult) { this.searchResult = searchResult; diff --git a/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudPlaylistInfoItemExtractor.java b/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudPlaylistInfoItemExtractor.java index 6002f054e..276f2c6a5 100644 --- a/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudPlaylistInfoItemExtractor.java +++ b/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudPlaylistInfoItemExtractor.java @@ -9,7 +9,7 @@ public class SoundcloudPlaylistInfoItemExtractor implements PlaylistInfoItemExtr private static final String AVATAR_URL_KEY = "avatar_url"; private static final String ARTWORK_URL_KEY = "artwork_url"; - private JsonObject searchResult; + private final JsonObject searchResult; public SoundcloudPlaylistInfoItemExtractor(JsonObject searchResult) { this.searchResult = searchResult; diff --git a/src/main/java/org/schabi/newpipe/extractor/services/youtube/ItagItem.java b/src/main/java/org/schabi/newpipe/extractor/services/youtube/ItagItem.java index 9d9663de3..1950c0b5e 100644 --- a/src/main/java/org/schabi/newpipe/extractor/services/youtube/ItagItem.java +++ b/src/main/java/org/schabi/newpipe/extractor/services/youtube/ItagItem.java @@ -146,8 +146,8 @@ public class ItagItem { return mediaFormat; } - public int id; - public ItagType itagType; + public final int id; + public final ItagType itagType; // Audio fields public int avgBitrate = -1; diff --git a/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeChannelInfoItemExtractor.java b/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeChannelInfoItemExtractor.java index d6d5d4620..a04d85622 100644 --- a/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeChannelInfoItemExtractor.java +++ b/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeChannelInfoItemExtractor.java @@ -26,7 +26,7 @@ import org.schabi.newpipe.extractor.utils.Utils; */ public class YoutubeChannelInfoItemExtractor implements ChannelInfoItemExtractor { - private Element el; + private final Element el; public YoutubeChannelInfoItemExtractor(Element el) { this.el = el; diff --git a/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubePlaylistInfoItemExtractor.java b/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubePlaylistInfoItemExtractor.java index 552f58f41..fe6e7768f 100644 --- a/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubePlaylistInfoItemExtractor.java +++ b/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubePlaylistInfoItemExtractor.java @@ -6,7 +6,7 @@ import org.schabi.newpipe.extractor.playlist.PlaylistInfoItemExtractor; import org.schabi.newpipe.extractor.utils.Utils; public class YoutubePlaylistInfoItemExtractor implements PlaylistInfoItemExtractor { - private Element el; + private final Element el; public YoutubePlaylistInfoItemExtractor(Element el) { this.el = el; diff --git a/src/main/java/org/schabi/newpipe/extractor/stream/SubtitlesFormat.java b/src/main/java/org/schabi/newpipe/extractor/stream/SubtitlesFormat.java index a45454800..1509d339d 100644 --- a/src/main/java/org/schabi/newpipe/extractor/stream/SubtitlesFormat.java +++ b/src/main/java/org/schabi/newpipe/extractor/stream/SubtitlesFormat.java @@ -13,8 +13,8 @@ public enum SubtitlesFormat { TRANSCRIPT2 (0x3, "srv2"), TRANSCRIPT3 (0x4, "srv3"); - private int id; - private String extension; + private final int id; + private final String extension; SubtitlesFormat(int id, String extension) { this.id = id; diff --git a/src/main/java/org/schabi/newpipe/extractor/stream/VideoStream.java b/src/main/java/org/schabi/newpipe/extractor/stream/VideoStream.java index 76fa20c1a..1e877bee3 100644 --- a/src/main/java/org/schabi/newpipe/extractor/stream/VideoStream.java +++ b/src/main/java/org/schabi/newpipe/extractor/stream/VideoStream.java @@ -23,8 +23,8 @@ package org.schabi.newpipe.extractor.stream; import org.schabi.newpipe.extractor.MediaFormat; public class VideoStream extends Stream { - public String resolution; - public boolean isVideoOnly; + public final String resolution; + public final boolean isVideoOnly; public VideoStream(String url, MediaFormat format, String resolution) {