diff options
Diffstat (limited to 'src/core/lombok/javac/JavacAST.java')
-rw-r--r-- | src/core/lombok/javac/JavacAST.java | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/core/lombok/javac/JavacAST.java b/src/core/lombok/javac/JavacAST.java index 9e15516e..8197dae6 100644 --- a/src/core/lombok/javac/JavacAST.java +++ b/src/core/lombok/javac/JavacAST.java @@ -34,6 +34,7 @@ import javax.tools.JavaFileObject; import lombok.core.AST; import com.sun.tools.javac.code.Symtab; +import com.sun.tools.javac.code.Source; import com.sun.tools.javac.model.JavacElements; import com.sun.tools.javac.model.JavacTypes; import com.sun.tools.javac.tree.JCTree; @@ -113,6 +114,15 @@ public class JavacAST extends AST<JavacAST, JavacNode, JCTree> { for (JavacNode child : node.down()) child.traverse(visitor); } + @Override public int getSourceVersion() { + try { + String nm = Source.instance(context).name(); + int underscoreIdx = nm.indexOf('_'); + if (underscoreIdx > -1) return Integer.parseInt(nm.substring(underscoreIdx + 1)); + } catch (Exception ignore) {} + return 6; + } + @Override public int getLatestJavaSpecSupported() { return Javac.getJavaCompilerVersion(); } |