< prev index next >

src/jdk.jshell/share/classes/jdk/jshell/ExpressionToTypeInfo.java

Print this page
@@ -54,10 +54,11 @@
  import com.sun.tools.javac.code.Symbol.TypeSymbol;
  import com.sun.tools.javac.code.Symtab;
  import com.sun.tools.javac.code.Type;
  import com.sun.tools.javac.code.Types;
  import com.sun.tools.javac.tree.JCTree.JCClassDecl;
+ import com.sun.tools.javac.tree.JCTree.JCMethodDecl;
  import com.sun.tools.javac.tree.TreeInfo;
  import com.sun.tools.javac.util.List;
  import com.sun.tools.javac.util.ListBuffer;
  import java.util.function.BinaryOperator;
  import jdk.jshell.ExpressionToTypeInfo.ExpressionInfo.AnonymousDescription;

@@ -426,11 +427,13 @@
                                                                            node);
                          JCClassDecl clazz = (JCClassDecl) node.getClassBody();
                          MethodInvocationTree superCall =
                                  clazz.getMembers()
                                       .stream()
-                                      .map(TreeInfo::firstConstructorCall)
+                                      .filter(JCMethodDecl.class::isInstance)
+                                      .map(JCMethodDecl.class::cast)
+                                      .map(TreeInfo::findConstructorCall)
                                       .findAny()
                                       .get();
                          TreePath superCallPath
                                  = at.trees().
                                          getPath(tp.getCompilationUnit(), superCall.
< prev index next >