< prev index next >
src/jdk.jshell/share/classes/jdk/jshell/JShell.java
Print this page
@@ -344,14 +344,24 @@
* @throws IllegalStateException if this <code>JShell</code> instance is closed.
* @see SourceCodeAnalysis#analyzeCompletion(String)
* @see JShell#onShutdown(java.util.function.Consumer)
*/
public List<SnippetEvent> eval(String input) throws IllegalStateException {
+ SourceCodeAnalysisImpl a = sourceCodeAnalysis;
+ if (a != null) {
+ a.suspendIndexing();
+ }
+ try {
checkIfAlive();
List<SnippetEvent> events = eval.eval(input);
events.forEach(this::notifyKeyStatusEvent);
return Collections.unmodifiableList(events);
+ } finally {
+ if (a != null) {
+ a.resumeIndexing();
+ }
+ }
}
/**
* Remove a declaration from the state.
* @param snippet The snippet to remove
< prev index next >