mirror of
https://github.com/revanced/Apktool.git
synced 2024-12-04 18:12:54 +01:00
refactor: prevent casting by setting proper types
This commit is contained in:
parent
943b424172
commit
6427a28beb
@ -17,6 +17,8 @@
|
||||
package brut.androlib.mod;
|
||||
|
||||
import java.io.*;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
import org.antlr.runtime.*;
|
||||
import org.antlr.runtime.tree.CommonTree;
|
||||
import org.antlr.runtime.tree.CommonTreeNodeStream;
|
||||
@ -54,14 +56,14 @@ public class SmaliMod {
|
||||
boolean printTokens) throws IOException, RecognitionException {
|
||||
|
||||
CommonTokenStream tokens;
|
||||
LexerErrorInterface lexer;
|
||||
smaliFlexLexer lexer;
|
||||
|
||||
InputStream is = new FileInputStream(smaliFile);
|
||||
InputStreamReader reader = new InputStreamReader(is, "UTF-8");
|
||||
InputStreamReader reader = new InputStreamReader(is, StandardCharsets.UTF_8);
|
||||
|
||||
lexer = new smaliFlexLexer(reader, apiLevel);
|
||||
((smaliFlexLexer)lexer).setSourceFile(smaliFile);
|
||||
tokens = new CommonTokenStream((TokenSource) lexer);
|
||||
(lexer).setSourceFile(smaliFile);
|
||||
tokens = new CommonTokenStream(lexer);
|
||||
|
||||
if (printTokens) {
|
||||
tokens.getTokens();
|
||||
@ -88,7 +90,7 @@ public class SmaliMod {
|
||||
return false;
|
||||
}
|
||||
|
||||
CommonTree t = (CommonTree) result.getTree();
|
||||
CommonTree t = result.getTree();
|
||||
|
||||
CommonTreeNodeStream treeStream = new CommonTreeNodeStream(t);
|
||||
treeStream.setTokenStream(tokens);
|
||||
|
Loading…
Reference in New Issue
Block a user