diff options
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/lombok/core/AST.java | 8 | ||||
-rw-r--r-- | src/core/lombok/core/LombokNode.java | 9 | ||||
-rw-r--r-- | src/core/lombok/javac/JavacAST.java | 4 |
3 files changed, 21 insertions, 0 deletions
diff --git a/src/core/lombok/core/AST.java b/src/core/lombok/core/AST.java index 644d9449..a2279efe 100644 --- a/src/core/lombok/core/AST.java +++ b/src/core/lombok/core/AST.java @@ -146,6 +146,14 @@ public abstract class AST<A extends AST<A, L, N>, L extends LombokNode<A, L, N>, return nodeMap.get(node); } + /** + * Returns the latest version of the java language specification supported by the host compiler. + * For example, if compiling with javac v1.7, this returns {@code 7}. + */ + public int getLatestJavaSpecSupported() { + return 6; + } + @SuppressWarnings({"unchecked", "rawtypes"}) L replaceNewWithExistingOld(Map<N, L> oldNodes, L newNode) { L oldNode = oldNodes.get(newNode.get()); diff --git a/src/core/lombok/core/LombokNode.java b/src/core/lombok/core/LombokNode.java index 588adc55..aa161a8d 100644 --- a/src/core/lombok/core/LombokNode.java +++ b/src/core/lombok/core/LombokNode.java @@ -181,6 +181,15 @@ public abstract class LombokNode<A extends AST<A, L, N>, L extends LombokNode<A, } /** + * Convenient shortcut to the owning ast object's getLatestJavaSpecSupported method. + * + * @see AST#getLatestJavaSpecSupported() + */ + public int getLatestJavaSpecSupported() { + return ast.getLatestJavaSpecSupported(); + } + + /** * Convenient shortcut to the owning ast object's top method. * * @see AST#top() diff --git a/src/core/lombok/javac/JavacAST.java b/src/core/lombok/javac/JavacAST.java index 93ea9754..9e15516e 100644 --- a/src/core/lombok/javac/JavacAST.java +++ b/src/core/lombok/javac/JavacAST.java @@ -113,6 +113,10 @@ public class JavacAST extends AST<JavacAST, JavacNode, JCTree> { for (JavacNode child : node.down()) child.traverse(visitor); } + @Override public int getLatestJavaSpecSupported() { + return Javac.getJavaCompilerVersion(); + } + /** @return A Name object generated for the proper name table belonging to this AST. */ public Name toName(String name) { return elements.getName(name); |