diff --git a/org.sf.feeling.decompiler/src/org/sf/feeling/decompiler/util/ASTParserUtil.java b/org.sf.feeling.decompiler/src/org/sf/feeling/decompiler/util/ASTParserUtil.java index 73693516..c8d1fe94 100644 --- a/org.sf.feeling.decompiler/src/org/sf/feeling/decompiler/util/ASTParserUtil.java +++ b/org.sf.feeling.decompiler/src/org/sf/feeling/decompiler/util/ASTParserUtil.java @@ -2,6 +2,7 @@ import java.util.Map; +import org.eclipse.jdt.core.dom.AST; import org.eclipse.jdt.core.dom.ASTParser; import org.eclipse.jdt.core.dom.CompilationUnit; import org.eclipse.jdt.internal.compiler.impl.CompilerOptions; @@ -12,7 +13,7 @@ private ASTParserUtil() { } public static CompilationUnit parse(String sourceCode) { - ASTParser parser = ASTParser.newParser(DecompilerOutputUtil.getMaxJSLLevel()); + ASTParser parser = ASTParser.newParser(AST.getJLSLatest()); CompilerOptions option = new CompilerOptions(); Map options = option.getMap(); options.put(CompilerOptions.OPTION_Compliance, DecompilerOutputUtil.getMaxDecompileLevel()); // $NON-NLS-1$ diff --git a/org.sf.feeling.decompiler/src/org/sf/feeling/decompiler/util/DecompilerOutputUtil.java b/org.sf.feeling.decompiler/src/org/sf/feeling/decompiler/util/DecompilerOutputUtil.java index 9237aeee..39a58f1b 100644 --- a/org.sf.feeling.decompiler/src/org/sf/feeling/decompiler/util/DecompilerOutputUtil.java +++ b/org.sf.feeling.decompiler/src/org/sf/feeling/decompiler/util/DecompilerOutputUtil.java @@ -16,7 +16,6 @@ import java.util.regex.Pattern; import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jdt.core.dom.AST; import org.eclipse.jdt.core.dom.ASTNode; import org.eclipse.jdt.core.dom.AbstractTypeDeclaration; import org.eclipse.jdt.core.dom.CompilationUnit; @@ -778,27 +777,4 @@ public static String getMaxDecompileLevel() { level = "1.8"; //$NON-NLS-1$ return level; } - - private static int jslLevel = -1; - - public static int getMaxJSLLevel() { - if (jslLevel == -1) { - if (ReflectionUtils.getDeclaredField(AST.class, "JLS8") != null) //$NON-NLS-1$ - { - jslLevel = (Integer) ReflectionUtils.getFieldValue(AST.class, "JLS8"); //$NON-NLS-1$ - } else if (ReflectionUtils.getDeclaredField(AST.class, "JLS4") != null) //$NON-NLS-1$ - { - jslLevel = (Integer) ReflectionUtils.getFieldValue(AST.class, "JLS4"); //$NON-NLS-1$ - } else if (ReflectionUtils.getDeclaredField(AST.class, "JLS3") != null) //$NON-NLS-1$ - { - jslLevel = (Integer) ReflectionUtils.getFieldValue(AST.class, "JLS3"); //$NON-NLS-1$ - } else if (ReflectionUtils.getDeclaredField(AST.class, "JLS2") != null) //$NON-NLS-1$ - { - jslLevel = (Integer) ReflectionUtils.getFieldValue(AST.class, "JLS2"); //$NON-NLS-1$ - } else { - jslLevel = 3; - } - } - return jslLevel; - } }