diff --git a/brut.apktool/apktool-lib/src/main/java/brut/androlib/mod/SmaliMod.java b/brut.apktool/apktool-lib/src/main/java/brut/androlib/mod/SmaliMod.java index b34c1b81..d951d91e 100644 --- a/brut.apktool/apktool-lib/src/main/java/brut/androlib/mod/SmaliMod.java +++ b/brut.apktool/apktool-lib/src/main/java/brut/androlib/mod/SmaliMod.java @@ -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);