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) {