diff -r 2c3901225ff2 -r d071bcc8d32e langtools/src/jdk.jshell/share/classes/jdk/jshell/SourceCodeAnalysisImpl.java --- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/SourceCodeAnalysisImpl.java Wed Sep 07 12:15:22 2016 -0700 +++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/SourceCodeAnalysisImpl.java Thu Sep 08 15:48:28 2016 +0200 @@ -838,8 +838,31 @@ } private Stream localElements(Scope scope) { - @SuppressWarnings("unchecked") - Stream elements = Util.stream((Iterable)scope.getLocalElements()); + //workaround for: JDK-8024687 + Iterable elementsIt = () -> new Iterator() { + Iterator it = scope.getLocalElements().iterator(); + @Override + public boolean hasNext() { + while (true) { + try { + return it.hasNext(); + } catch (CompletionFailure cf) { + //ignore... + } + } + } + @Override + public Element next() { + while (true) { + try { + return it.next(); + } catch (CompletionFailure cf) { + //ignore... + } + } + } + }; + Stream elements = Util.stream(elementsIt); if (scope.getEnclosingScope() != null && scope.getEnclosingClass() != scope.getEnclosingScope().getEnclosingClass()) {