diff options
author | Reinier Zwitserloot <r.zwitserloot@projectlombok.org> | 2019-05-21 23:22:18 +0200 |
---|---|---|
committer | Reinier Zwitserloot <r.zwitserloot@projectlombok.org> | 2019-05-21 23:22:18 +0200 |
commit | 8f69331ce8d120c3a0c8440c805aab0b5e458e6d (patch) | |
tree | bf59e20b05c4dda5c6539efac50ccbecf4c1be61 /src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java | |
parent | 56aabf5465918bd167c67fe46d56e72968c5cea3 (diff) | |
parent | 2704f073aad6deb362707e0311b6275cde7c5e1a (diff) | |
download | lombok-8f69331ce8d120c3a0c8440c805aab0b5e458e6d.tar.gz lombok-8f69331ce8d120c3a0c8440c805aab0b5e458e6d.tar.bz2 lombok-8f69331ce8d120c3a0c8440c805aab0b5e458e6d.zip |
Merge branch 'bulgakovalexander-feature/typeInferenceImprovements'
Diffstat (limited to 'src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java')
-rw-r--r-- | src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java b/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java index c8e7b60a..463990d1 100644 --- a/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java +++ b/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java @@ -114,6 +114,7 @@ import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; import org.eclipse.jdt.internal.compiler.lookup.Binding; import org.eclipse.jdt.internal.compiler.lookup.CaptureBinding; import org.eclipse.jdt.internal.compiler.lookup.ParameterizedTypeBinding; +import org.eclipse.jdt.internal.compiler.lookup.RawTypeBinding; import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding; import org.eclipse.jdt.internal.compiler.lookup.TypeBinding; import org.eclipse.jdt.internal.compiler.lookup.TypeConstants; @@ -844,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]; @@ -933,7 +933,12 @@ public class EclipseHandlerUtil { WildcardBinding wildcard = (WildcardBinding) binding; if (wildcard.boundKind == Wildcard.EXTENDS) { if (!allowCompound) { - return makeType(wildcard.bound, pos, false); + TypeBinding bound = wildcard.bound; + boolean isObject = bound.id == TypeIds.T_JavaLangObject; + TypeBinding[] otherBounds = wildcard.otherBounds; + if (isObject && otherBounds != null && otherBounds.length > 0) { + return makeType(otherBounds[0], pos, false); + } else return makeType(bound, pos, false); } else { Wildcard out = new Wildcard(Wildcard.EXTENDS); setGeneratedBy(out, pos); @@ -960,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 */ { + /* Calculate generics */ + if (!(binding instanceof RawTypeBinding)) { TypeBinding b = binding; while (true) { boolean isFinalStop = b.isLocalType() || !b.isMemberType() || b.enclosingType() == null; |