From 220cac1b599a0d806110c6d6585117d99effff14 Mon Sep 17 00:00:00 2001 From: David Thompson Date: Thu, 4 Jul 2024 09:11:56 -0400 Subject: [PATCH] Fix regression caused by #558 Both the "create new method" and the "add cast to method invocation" cases should work now. Signed-off-by: David Thompson --- .../src/org/eclipse/jdt/core/dom/JavacBindingResolver.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/org.eclipse.jdt.core.javac/src/org/eclipse/jdt/core/dom/JavacBindingResolver.java b/org.eclipse.jdt.core.javac/src/org/eclipse/jdt/core/dom/JavacBindingResolver.java index b59711497b3..c7c44bbf2b8 100644 --- a/org.eclipse.jdt.core.javac/src/org/eclipse/jdt/core/dom/JavacBindingResolver.java +++ b/org.eclipse.jdt.core.javac/src/org/eclipse/jdt/core/dom/JavacBindingResolver.java @@ -671,7 +671,10 @@ public ITypeBinding resolveExpressionType(Expression expr) { } var jcTree = this.converter.domToJavac.get(expr); if (jcTree instanceof JCMethodInvocation javacMethodInvocation) { - return this.bindings.getTypeBinding(javacMethodInvocation.meth.type.asMethodType().getReturnType()); + if (javacMethodInvocation.meth.type instanceof MethodType methodType) { + return this.bindings.getTypeBinding(methodType.getReturnType()); + } + jcTree = javacMethodInvocation.meth; } if (jcTree instanceof JCFieldAccess jcFieldAccess) { if (jcFieldAccess.type instanceof PackageType) {