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

Print this page

        

@@ -29,10 +29,11 @@
 import static jdk.jshell.Util.*;
 import java.util.Locale;
 import javax.tools.Diagnostic;
 import javax.tools.JavaFileObject;
 import jdk.jshell.MemoryFileManager.SourceMemoryJavaFileObject;
+import static jdk.internal.jshell.debug.InternalDebugControl.DBG_GEN;
 
 /**
  *
  * @author Robert Field
  */

@@ -181,10 +182,26 @@
             }
             return null;
         }
 
         @Override
+        boolean isResolutionError() {
+            if (!super.isResolutionError()) {
+                return false;
+            }
+            for (String line : diag.getMessage(PARSED_LOCALE).split("\\r?\\n")) {
+                if (line.trim().startsWith("location:")) {
+                    if (!line.contains(REPL_CLASS_PREFIX)) {
+                        // Resolution error must occur within a REPL class or it is not resolvable
+                        return false;
+                    }
+                }
+            }
+            return true;
+        }
+
+        @Override
         public String toString() {
             return "WrappedDiagnostic(" + getMessage(null) + ":" + getPosition() + ")";
         }
     }
 }