aboutsummaryrefslogtreecommitdiff
path: root/src/core/lombok
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/lombok')
-rw-r--r--src/core/lombok/javac/JavacResolution.java17
-rw-r--r--src/core/lombok/javac/handlers/HandleVal.java6
2 files changed, 10 insertions, 13 deletions
diff --git a/src/core/lombok/javac/JavacResolution.java b/src/core/lombok/javac/JavacResolution.java
index 5631e62c..ec455b18 100644
--- a/src/core/lombok/javac/JavacResolution.java
+++ b/src/core/lombok/javac/JavacResolution.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011-2013 The Project Lombok Authors.
+ * Copyright (C) 2011-2014 The Project Lombok Authors.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -94,17 +94,6 @@ public class JavacResolution {
@Override public void visitClassDef(JCClassDecl tree) {
if (copyAt != null) return;
- // The commented out stuff requires reflection tricks to avoid leaving lint unset which causes NPEs during attrib. So, we use the other one, much less code.
-// env = enter.classEnv((JCClassDecl) tree, env);
-// try {
-// Field f = env.info.getClass().getDeclaredField("lint");
-// f.setAccessible(true);
-// Constructor<?> c = Lint.class.getDeclaredConstructor(Lint.class);
-// c.setAccessible(true);
-// f.set(env.info, c.newInstance(lint));
-// } catch (Exception e) {
-// throw Lombok.sneakyThrow(e);
-// }
env = enter.getClassEnv(tree.sym);
}
@@ -358,4 +347,8 @@ public class JavacResolution {
throw new TypeNotConvertibleException("Nulltype");
}
}
+
+ public static boolean platformHasTargetTyping() {
+ return Javac.getJavaCompilerVersion() >= 8;
+ }
}
diff --git a/src/core/lombok/javac/handlers/HandleVal.java b/src/core/lombok/javac/handlers/HandleVal.java
index eb3a2f46..0230e1b0 100644
--- a/src/core/lombok/javac/handlers/HandleVal.java
+++ b/src/core/lombok/javac/handlers/HandleVal.java
@@ -91,7 +91,11 @@ public class HandleVal extends JavacASTAdapter {
local.mods.annotations = local.mods.annotations == null ? List.of(valAnnotation) : local.mods.annotations.append(valAnnotation);
}
- local.vartype = localNode.getAst().getTreeMaker().Ident(localNode.getAst().toName("___Lombok_VAL_Attrib__"));
+ if (JavacResolution.platformHasTargetTyping()) {
+ local.vartype = localNode.getAst().getTreeMaker().Ident(localNode.getAst().toName("___Lombok_VAL_Attrib__"));
+ } else {
+ local.vartype = JavacResolution.createJavaLangObject(localNode.getAst());
+ }
Type type;
try {