diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/core/lombok/javac/JavacAST.java | 9 | ||||
-rw-r--r-- | src/eclipseAgent/lombok/eclipse/agent/PatchExtensionMethod.java | 17 |
2 files changed, 17 insertions, 9 deletions
diff --git a/src/core/lombok/javac/JavacAST.java b/src/core/lombok/javac/JavacAST.java index b3e8930e..f58de60f 100644 --- a/src/core/lombok/javac/JavacAST.java +++ b/src/core/lombok/javac/JavacAST.java @@ -174,7 +174,14 @@ public class JavacAST extends AST<JavacAST, JavacNode, JCTree> { if (sbtMappedVirtualFileRootsField == null) return null; String encodedPath = (String) sbtMappedVirtualFilePathField.get(mappedVirtualFile); - if (!encodedPath.startsWith("${")) return null; + if (!encodedPath.startsWith("${")) { + File maybeAbsoluteFile = new File(encodedPath); + if (maybeAbsoluteFile.exists()) { + return maybeAbsoluteFile.toURI(); + } else { + return null; + } + } int idx = encodedPath.indexOf('}'); if (idx == -1) return null; String base = encodedPath.substring(2, idx); diff --git a/src/eclipseAgent/lombok/eclipse/agent/PatchExtensionMethod.java b/src/eclipseAgent/lombok/eclipse/agent/PatchExtensionMethod.java index c916ca26..5f229955 100644 --- a/src/eclipseAgent/lombok/eclipse/agent/PatchExtensionMethod.java +++ b/src/eclipseAgent/lombok/eclipse/agent/PatchExtensionMethod.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012-2014 The Project Lombok Authors. + * Copyright (C) 2012-2020 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 @@ -58,7 +58,6 @@ import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration; import org.eclipse.jdt.internal.compiler.lookup.Binding; import org.eclipse.jdt.internal.compiler.lookup.BlockScope; import org.eclipse.jdt.internal.compiler.lookup.MethodBinding; -import org.eclipse.jdt.internal.compiler.lookup.ParameterizedTypeBinding; import org.eclipse.jdt.internal.compiler.lookup.ProblemMethodBinding; import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding; import org.eclipse.jdt.internal.compiler.lookup.Scope; @@ -304,12 +303,13 @@ public class PatchExtensionMethod { argumentTypes.add(argumentType); } - // Copy generic information. This one covers a few simple cases, more complex cases are still broken - int typeVariables = extensionMethod.typeVariables.length; - if (typeVariables > 0 && methodCall.receiver.resolvedType instanceof ParameterizedTypeBinding) { - ParameterizedTypeBinding parameterizedTypeBinding = (ParameterizedTypeBinding) methodCall.receiver.resolvedType; - if (parameterizedTypeBinding.arguments != null && parameterizedTypeBinding.arguments.length == typeVariables) { - methodCall.genericTypeArguments = parameterizedTypeBinding.arguments; + if (methodCall.receiver instanceof MessageSend) { + if (Reflection.inferenceContexts != null) { + try { + Permit.set(Reflection.inferenceContexts, methodCall.receiver, null); + } catch (IllegalAccessException ignore) { + // ignore + } } } @@ -402,6 +402,7 @@ public class PatchExtensionMethod { private static final class Reflection { public static final Field argumentTypes = Permit.permissiveGetField(MessageSend.class, "argumentTypes"); public static final Field argumentsHaveErrors = Permit.permissiveGetField(MessageSend.class, "argumentsHaveErrors"); + public static final Field inferenceContexts = Permit.permissiveGetField(MessageSend.class, "inferenceContexts"); private static final Class<?> functionalExpression; private static final Constructor<?> polyTypeBindingConstructor; |