diff options
author | Reinier Zwitserloot <reinier@zwitserloot.com> | 2013-05-23 22:58:34 +0200 |
---|---|---|
committer | Reinier Zwitserloot <reinier@zwitserloot.com> | 2013-05-23 22:58:34 +0200 |
commit | 9c1e29842e65bf20895db9e19336b2ca948236ad (patch) | |
tree | 396adccb0d61e049526622956c5ff59b5a32710c /src/core/lombok/eclipse | |
parent | 4152eee126bcb6a0403d3e7a79fe336944031268 (diff) | |
download | lombok-9c1e29842e65bf20895db9e19336b2ca948236ad.tar.gz lombok-9c1e29842e65bf20895db9e19336b2ca948236ad.tar.bz2 lombok-9c1e29842e65bf20895db9e19336b2ca948236ad.zip |
Added methods to obtain JLS support-level version information from AST/LombokNode. Tests updates to honour these with //version X at the top
of any test file (now also in eclipse, which until now always said it was v6)
Diffstat (limited to 'src/core/lombok/eclipse')
-rw-r--r-- | src/core/lombok/eclipse/EclipseAST.java | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/core/lombok/eclipse/EclipseAST.java b/src/core/lombok/eclipse/EclipseAST.java index d1f4ff06..612dcff7 100644 --- a/src/core/lombok/eclipse/EclipseAST.java +++ b/src/core/lombok/eclipse/EclipseAST.java @@ -68,6 +68,20 @@ public class EclipseAST extends AST<EclipseAST, EclipseNode, ASTNode> { return pkg == null ? null : Eclipse.toQualifiedName(pkg.getImportName()); } + @Override public int getSourceVersion() { + long sl = compilationUnitDeclaration.problemReporter.options.sourceLevel; + long cl = compilationUnitDeclaration.problemReporter.options.complianceLevel; + sl >>= 16; + cl >>= 16; + if (sl == 0) sl = cl; + if (cl == 0) cl = sl; + return Math.min((int)(sl - 44), (int)(cl - 44)); + } + + @Override public int getLatestJavaSpecSupported() { + return Eclipse.getEcjCompilerVersion(); + } + /** * Runs through the entire AST, starting at the compilation unit, calling the provided visitor's visit methods * for each node, depth first. |