aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/changelog.markdown2
-rw-r--r--src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java4
-rw-r--r--src/eclipseAgent/lombok/eclipse/agent/PatchVal.java6
-rw-r--r--test/transform/resource/after-delombok/ValLambda.java4
-rw-r--r--test/transform/resource/before/ValLambda.java5
5 files changed, 6 insertions, 15 deletions
diff --git a/doc/changelog.markdown b/doc/changelog.markdown
index e0e3d49a..1d927e62 100644
--- a/doc/changelog.markdown
+++ b/doc/changelog.markdown
@@ -2,7 +2,7 @@ Lombok Changelog
----------------
### v1.18.9 "Edgy Guinea Pig"
-* Nothing yet.
+* ENHANCEMENT: `val` is now capable of decoding the type of convoluted expressions (particularly if the right hand side involves lambdas and conditional (ternary) expressions). [Pull Request #2109](https://github.com/rzwitserloot/lombok/pull/2109) with thanks to Alexander Bulgakov.
### v1.18.8 (May 7th, 2019)
* FEATURE: You can now configure `@FieldNameConstants` to `CONSTANT_CASE` the generated constants, using a `lombok.config` option. See the [FieldNameConstants documentation](https://projectlombok.org/features/experimental/FieldNameConstants). [Issue #2092](https://github.com/rzwitserloot/lombok/issues/2092).
diff --git a/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java b/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java
index 257f5cec..463990d1 100644
--- a/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java
+++ b/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java
@@ -845,7 +845,6 @@ public class EclipseHandlerUtil {
}
public static TypeReference makeType(TypeBinding binding, ASTNode pos, boolean allowCompound) {
-
if (binding.getClass() == EclipseReflectiveMembers.INTERSECTION_BINDING) {
Object[] arr = (Object[]) EclipseReflectiveMembers.reflect(EclipseReflectiveMembers.INTERSECTION_BINDING_TYPES, binding);
binding = (TypeBinding) arr[0];
@@ -966,7 +965,8 @@ public class EclipseHandlerUtil {
// Finally, add however many nullTypeArgument[] arrays as that are missing, inverse the list, toArray it, and use that as PTR's typeArgument argument.
List<TypeReference[]> params = new ArrayList<TypeReference[]>();
- /* Calculate generics */ if(!(binding instanceof RawTypeBinding)) {
+ /* Calculate generics */
+ if (!(binding instanceof RawTypeBinding)) {
TypeBinding b = binding;
while (true) {
boolean isFinalStop = b.isLocalType() || !b.isMemberType() || b.enclosingType() == null;
diff --git a/src/eclipseAgent/lombok/eclipse/agent/PatchVal.java b/src/eclipseAgent/lombok/eclipse/agent/PatchVal.java
index 832a25e3..c0c2cea6 100644
--- a/src/eclipseAgent/lombok/eclipse/agent/PatchVal.java
+++ b/src/eclipseAgent/lombok/eclipse/agent/PatchVal.java
@@ -1,16 +1,16 @@
/*
* Copyright (C) 2010-2019 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
diff --git a/test/transform/resource/after-delombok/ValLambda.java b/test/transform/resource/after-delombok/ValLambda.java
index b993028e..00ff27ad 100644
--- a/test/transform/resource/after-delombok/ValLambda.java
+++ b/test/transform/resource/after-delombok/ValLambda.java
@@ -18,8 +18,4 @@ class ValLambda {
java.util.function.Function foo3 = (System.currentTimeMillis() < 0) ? (java.util.function.Function) r -> "" : r -> System.currentTimeMillis();
final java.util.function.Function<java.lang.String, java.lang.String> foo4 = (System.currentTimeMillis() < 0) ? (java.util.function.Function<String, String>) r -> "" : r -> String.valueOf(System.currentTimeMillis());
}
-// public void castLubLambda() {
-// Runnable foo = (Runnable) ((System.currentTimeMillis() > 0) ? () -> {} : System.out::println);
-// lombok.val foo = (Runnable) ((System.currentTimeMillis() > 0) ? () -> {} : System.out::println);
-// }
} \ No newline at end of file
diff --git a/test/transform/resource/before/ValLambda.java b/test/transform/resource/before/ValLambda.java
index 5d40f220..35f83c3c 100644
--- a/test/transform/resource/before/ValLambda.java
+++ b/test/transform/resource/before/ValLambda.java
@@ -16,9 +16,4 @@ class ValLambda {
java.util.function.Function foo3 = (System.currentTimeMillis() < 0) ? (java.util.function.Function) r -> "" : r -> System.currentTimeMillis();
lombok.val foo4 = (System.currentTimeMillis() < 0) ? (java.util.function.Function<String, String>) r -> "" : r -> String.valueOf(System.currentTimeMillis());
}
-
-// public void castLubLambda() {
-// Runnable foo = (Runnable) ((System.currentTimeMillis() > 0) ? () -> {} : System.out::println);
-// lombok.val foo = (Runnable) ((System.currentTimeMillis() > 0) ? () -> {} : System.out::println);
-// }
}