langtools/src/jdk.jshell/share/classes/jdk/jshell/Eval.java
changeset 38908 f0c186d76c8a
parent 38535 4a25025e0b0d
child 39370 437ba9bd2582
equal deleted inserted replaced
38840:7693aa00e131 38908:f0c186d76c8a
   438         Unit c = new Unit(state, si, null, generatedDiagnostics);
   438         Unit c = new Unit(state, si, null, generatedDiagnostics);
   439         Set<Unit> ins = new LinkedHashSet<>();
   439         Set<Unit> ins = new LinkedHashSet<>();
   440         ins.add(c);
   440         ins.add(c);
   441         Set<Unit> outs = compileAndLoad(ins);
   441         Set<Unit> outs = compileAndLoad(ins);
   442 
   442 
   443         if (!si.status().isDefined
   443         if (!si.status().isDefined()
   444                 && si.diagnostics().isEmpty()
   444                 && si.diagnostics().isEmpty()
   445                 && si.unresolved().isEmpty()) {
   445                 && si.unresolved().isEmpty()) {
   446             // did not succeed, but no record of it, extract from others
   446             // did not succeed, but no record of it, extract from others
   447             si.setDiagnostics(outs.stream()
   447             si.setDiagnostics(outs.stream()
   448                     .flatMap(u -> u.snippet().diagnostics().stream())
   448                     .flatMap(u -> u.snippet().diagnostics().stream())
   450         }
   450         }
   451 
   451 
   452         // If appropriate, execute the snippet
   452         // If appropriate, execute the snippet
   453         String value = null;
   453         String value = null;
   454         JShellException exception = null;
   454         JShellException exception = null;
   455         if (si.status().isDefined) {
   455         if (si.status().isDefined()) {
   456             if (si.isExecutable()) {
   456             if (si.isExecutable()) {
   457                 try {
   457                 try {
   458                 value = state.executionControl().invoke(si.classFullName(), DOIT_METHOD_NAME);
   458                 value = state.executionControl().invoke(si.classFullName(), DOIT_METHOD_NAME);
   459                     value = si.subKind().hasValue()
   459                     value = si.subKind().hasValue()
   460                             ? expunge(value)
   460                             ? expunge(value)