-
-
Notifications
You must be signed in to change notification settings - Fork 543
Remove usage of reflection in timeago-parser module #1288
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
Merged
Merged
Changes from 2 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,2 @@ | ||
| include 'extractor', 'timeago-parser' | ||
| include 'extractor', 'timeago-parser', 'timeago-generator' | ||
| rootProject.name = 'NewPipeExtractor' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| dependencies { | ||
| implementation "com.github.TeamNewPipe:nanojson:$nanojsonVersion" | ||
| implementation "com.google.code.findbugs:jsr305:$jsr305Version" | ||
| implementation project(":timeago-parser") | ||
| } |
2 changes: 2 additions & 0 deletions
2
timeago-parser/raw/java/CheckAll.java → ...java/com/github/TeamNewPipe/CheckAll.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,5 @@ | ||
| package com.github.TeamNewPipe; | ||
|
|
||
| import com.grack.nanojson.JsonObject; | ||
| import com.grack.nanojson.JsonParser; | ||
|
|
||
|
|
||
2 changes: 2 additions & 0 deletions
2
...ago-parser/raw/java/GenerateOverview.java → .../github/TeamNewPipe/GenerateOverview.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
timeago-parser/raw/java/Utils.java → ...in/java/com/github/TeamNewPipe/Utils.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,5 @@ | ||
| package com.github.TeamNewPipe; | ||
|
|
||
| import java.util.*; | ||
|
|
||
| public class Utils { | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,3 @@ | ||
| dependencies { | ||
| implementation "com.github.TeamNewPipe:nanojson:$nanojsonVersion" | ||
| implementation "com.google.code.findbugs:jsr305:$jsr305Version" | ||
| } |
100 changes: 100 additions & 0 deletions
100
timeago-parser/src/main/java/org/schabi/newpipe/extractor/timeago/PatternMap.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,100 @@ | ||
| /**/// DO NOT MODIFY THIS FILE MANUALLY | ||
| /**/// This class was automatically generated by "GeneratePatternClasses.java", | ||
| /**/// modify the "unique_patterns.json" and re-generate instead. | ||
|
|
||
| package org.schabi.newpipe.extractor.timeago; | ||
|
|
||
| import org.schabi.newpipe.extractor.timeago.patterns.*; | ||
| import java.util.HashMap; | ||
| import java.util.Map; | ||
|
|
||
| public class PatternMap { | ||
| private static final Map<String, PatternsHolder> patternMap = new HashMap<>(); | ||
|
|
||
| static { | ||
| patternMap.put("af", af.getInstance()); | ||
| patternMap.put("am", am.getInstance()); | ||
| patternMap.put("ar", ar.getInstance()); | ||
| patternMap.put("az", az.getInstance()); | ||
| patternMap.put("be", be.getInstance()); | ||
| patternMap.put("bg", bg.getInstance()); | ||
| patternMap.put("bn", bn.getInstance()); | ||
| patternMap.put("bs", bs.getInstance()); | ||
| patternMap.put("ca", ca.getInstance()); | ||
| patternMap.put("cs", cs.getInstance()); | ||
| patternMap.put("da", da.getInstance()); | ||
| patternMap.put("de", de.getInstance()); | ||
| patternMap.put("el", el.getInstance()); | ||
| patternMap.put("en", en.getInstance()); | ||
| patternMap.put("en_GB", en_GB.getInstance()); | ||
| patternMap.put("es", es.getInstance()); | ||
| patternMap.put("es_419", es_419.getInstance()); | ||
| patternMap.put("es_US", es_US.getInstance()); | ||
| patternMap.put("et", et.getInstance()); | ||
| patternMap.put("eu", eu.getInstance()); | ||
| patternMap.put("fa", fa.getInstance()); | ||
| patternMap.put("fi", fi.getInstance()); | ||
| patternMap.put("fil", fil.getInstance()); | ||
| patternMap.put("fr", fr.getInstance()); | ||
| patternMap.put("fr_CA", fr_CA.getInstance()); | ||
| patternMap.put("gl", gl.getInstance()); | ||
| patternMap.put("gu", gu.getInstance()); | ||
| patternMap.put("hi", hi.getInstance()); | ||
| patternMap.put("hr", hr.getInstance()); | ||
| patternMap.put("hu", hu.getInstance()); | ||
| patternMap.put("hy", hy.getInstance()); | ||
| patternMap.put("id", id.getInstance()); | ||
| patternMap.put("is", is.getInstance()); | ||
| patternMap.put("it", it.getInstance()); | ||
| patternMap.put("iw", iw.getInstance()); | ||
| patternMap.put("ja", ja.getInstance()); | ||
| patternMap.put("ka", ka.getInstance()); | ||
| patternMap.put("kk", kk.getInstance()); | ||
| patternMap.put("km", km.getInstance()); | ||
| patternMap.put("kn", kn.getInstance()); | ||
| patternMap.put("ko", ko.getInstance()); | ||
| patternMap.put("ky", ky.getInstance()); | ||
| patternMap.put("lo", lo.getInstance()); | ||
| patternMap.put("lt", lt.getInstance()); | ||
| patternMap.put("lv", lv.getInstance()); | ||
| patternMap.put("mk", mk.getInstance()); | ||
| patternMap.put("ml", ml.getInstance()); | ||
| patternMap.put("mn", mn.getInstance()); | ||
| patternMap.put("mr", mr.getInstance()); | ||
| patternMap.put("ms", ms.getInstance()); | ||
| patternMap.put("my", my.getInstance()); | ||
| patternMap.put("ne", ne.getInstance()); | ||
| patternMap.put("nl", nl.getInstance()); | ||
| patternMap.put("no", no.getInstance()); | ||
| patternMap.put("pa", pa.getInstance()); | ||
| patternMap.put("pl", pl.getInstance()); | ||
| patternMap.put("pt", pt.getInstance()); | ||
| patternMap.put("pt_PT", pt_PT.getInstance()); | ||
| patternMap.put("ro", ro.getInstance()); | ||
| patternMap.put("ru", ru.getInstance()); | ||
| patternMap.put("si", si.getInstance()); | ||
| patternMap.put("sk", sk.getInstance()); | ||
| patternMap.put("sl", sl.getInstance()); | ||
| patternMap.put("sq", sq.getInstance()); | ||
| patternMap.put("sr", sr.getInstance()); | ||
| patternMap.put("sr_Latn", sr_Latn.getInstance()); | ||
| patternMap.put("sv", sv.getInstance()); | ||
| patternMap.put("sw", sw.getInstance()); | ||
| patternMap.put("ta", ta.getInstance()); | ||
| patternMap.put("te", te.getInstance()); | ||
| patternMap.put("th", th.getInstance()); | ||
| patternMap.put("tr", tr.getInstance()); | ||
| patternMap.put("uk", uk.getInstance()); | ||
| patternMap.put("ur", ur.getInstance()); | ||
| patternMap.put("uz", uz.getInstance()); | ||
| patternMap.put("vi", vi.getInstance()); | ||
| patternMap.put("zh_CN", zh_CN.getInstance()); | ||
| patternMap.put("zh_HK", zh_HK.getInstance()); | ||
| patternMap.put("zh_TW", zh_TW.getInstance()); | ||
| patternMap.put("zu", zu.getInstance()); | ||
| } | ||
|
|
||
| public static PatternsHolder getPattern(String languageCode) { | ||
|
Stypox marked this conversation as resolved.
Outdated
|
||
| return patternMap.get(languageCode); | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.