aboutsummaryrefslogtreecommitdiff
path: root/src/utils
diff options
context:
space:
mode:
authorReinier Zwitserloot <reinier@zwitserloot.com>2014-03-04 23:16:49 +0100
committerReinier Zwitserloot <reinier@zwitserloot.com>2014-03-04 23:16:49 +0100
commitf956ba1e337699206052a016da65f4f02ac6825b (patch)
tree53b0c638275ebfa8a3d1133c1d389ef700460572 /src/utils
parente5574133363c8b718329e07a73bf161416485da5 (diff)
parentfbab1ca77cb8306843e26c5bad91186b34563282 (diff)
downloadlombok-f956ba1e337699206052a016da65f4f02ac6825b.tar.gz
lombok-f956ba1e337699206052a016da65f4f02ac6825b.tar.bz2
lombok-f956ba1e337699206052a016da65f4f02ac6825b.zip
[configuration] Merge branch 'master' as we work on configuration.
* Conflict due to adding topic() feature to logger in master, and 'field name' feature in config branch. * master has since updated to shiny new eclipse dep versions and the 'ant eclipseForDebugging' feature, but this branch added deps. Addressed that. * Renamed 'loggerCategory' to 'loggerTopic'. I know, that wasn't exactly right to do in a merge, but, there you have it. * Test infrastructure changed in configuration branch, and tests had been added in master branch. Conflicts: build.xml buildScripts/ivy.xml src/core/lombok/eclipse/handlers/HandleLog.java src/core/lombok/extern/apachecommons/CommonsLog.java src/core/lombok/extern/java/Log.java src/core/lombok/extern/log4j/Log4j.java src/core/lombok/extern/log4j/Log4j2.java src/core/lombok/javac/handlers/HandleLog.java test/transform/resource/after-ecj/ValInTryWithResources.java
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/lombok/javac/Javac.java35
1 files changed, 34 insertions, 1 deletions
diff --git a/src/utils/lombok/javac/Javac.java b/src/utils/lombok/javac/Javac.java
index bdf5e7a0..e207c44a 100644
--- a/src/utils/lombok/javac/Javac.java
+++ b/src/utils/lombok/javac/Javac.java
@@ -177,7 +177,7 @@ public class Javac {
public static final TreeTag CTC_PREINC = treeTag("PREINC");
public static final TreeTag CTC_PREDEC = treeTag("PREDEC");
- private static final Method getExtendsClause, getEndPosition;
+ private static final Method getExtendsClause, getEndPosition, storeEnd;
static {
getExtendsClause = getMethod(JCClassDecl.class, "getExtendsClause", new Class<?>[0]);
@@ -185,10 +185,32 @@ public class Javac {
if (getJavaCompilerVersion() < 8) {
getEndPosition = getMethod(DiagnosticPosition.class, "getEndPosition", java.util.Map.class);
+ storeEnd = getMethod(java.util.Map.class, "put", Object.class, Object.class);
} else {
getEndPosition = getMethod(DiagnosticPosition.class, "getEndPosition", "com.sun.tools.javac.tree.EndPosTable");
+ Method storeEndMethodTemp;
+ Class<?> endPosTable;
+ try {
+ endPosTable = Class.forName("com.sun.tools.javac.tree.EndPosTable");
+ } catch (ClassNotFoundException ex) {
+ throw sneakyThrow(ex);
+ }
+ try {
+ storeEndMethodTemp = endPosTable.getMethod("storeEnd", JCTree.class, int.class);
+ } catch (NoSuchMethodException e) {
+ try {
+ endPosTable = Class.forName("com.sun.tools.javac.parser.JavacParser$AbstractEndPosTable");
+ storeEndMethodTemp = endPosTable.getDeclaredMethod("storeEnd", JCTree.class, int.class);
+ } catch (NoSuchMethodException ex) {
+ throw sneakyThrow(ex);
+ } catch (ClassNotFoundException ex) {
+ throw sneakyThrow(ex);
+ }
+ }
+ storeEnd = storeEndMethodTemp;
}
getEndPosition.setAccessible(true);
+ storeEnd.setAccessible(true);
}
private static Method getMethod(Class<?> clazz, String name, Class<?>... paramTypes) {
@@ -250,6 +272,17 @@ public class Javac {
}
}
+ public static void storeEnd(JCTree tree, int pos, JCCompilationUnit top) {
+ try {
+ Object endPositions = JCCOMPILATIONUNIT_ENDPOSITIONS.get(top);
+ storeEnd.invoke(endPositions, tree, pos);
+ } catch (IllegalAccessException e) {
+ throw sneakyThrow(e);
+ } catch (InvocationTargetException e) {
+ throw sneakyThrow(e.getCause());
+ }
+ }
+
private static final Class<?> JC_VOID_TYPE, JC_NO_TYPE;
static {