[fixes #2049] Delombok now figures out usages of ‘var’ and delomboks them as just ‘var’ instead of their actual type.

This commit is contained in:
Reinier Zwitserloot committed 2019-03-26 01:26:37 +01:00
1 parent 33281d8578
commit 320fbfee4d
5 files changed
+20 -1

No files matched your search

+1
View File
@@ -6,6 +6,7 @@ Lombok Changelog
* FEATURE: When using `@NonNull`, or any other annotation that would result in a null-check, you can configure to generate an assert statement instead. [Issue #2078](https://github.com/rzwitserloot/lombok/issues/2078).
* BUGFIX: var/val on methods that return an intersection type would now work in Eclipse. [Issue #1986](https://github.com/rzwitserloot/lombok/issues/1986)
* BUGFIX: Fix for java6 regression if a field has javadoc. [Issue #2066](https://github.com/rzwitserloot/lombok/issues/2066)
* BUGFIX: Delombok now delomboks java10's own `var` as `var` and not as the actual underlying type. [Issue #2049](https://github.com/rzwitserloot/lombok/issues/2049)
* IMPROBABLE BREAKING CHANGE: For fields and parameters marked non-null, if the method body starts with an assert statement to ensure the value isn't null, no code to throw an exception will be generated.
### v1.18.6 (February 12th, 2019)
@@ -753,6 +753,7 @@ public class Delombok {
Object care = callAttributeMethodOnJavaCompiler(delegate, delegate.todo);
callFlowMethodOnJavaCompiler(delegate, care);
FormatPreferences fps = new FormatPreferences(formatPrefs);
for (JCCompilationUnit unit : roots) {
DelombokResult result = new DelombokResult(catcher.getComments(unit), unit, force || options.isChanged(unit), fps);
@@ -648,7 +648,11 @@ public class PrettyPrinter extends JCTree.Visitor {
*/
try {
innermostArrayBracketsAreVarargs = varargs;
print(tree.vartype);
if (tree.vartype == null || tree.vartype.pos == -1) {
print("var");
} else {
print(tree.vartype);
}
} finally {
innermostArrayBracketsAreVarargs = false;
}
@@ -0,0 +1,6 @@
public class Java11Var {
public void test() {
var b = 10;
int c = 11;
}
}
@@ -0,0 +1,7 @@
//version 11:
public class Java11Var {
public void test() {
var b = 10;
int c = 11;
}
}