< prev index next >

src/jdk.jcmd/share/classes/sun/tools/jstat/ExpressionResolver.java

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.  Oracle designates this

@@ -71,11 +71,11 @@
             if (m == null) {
                 if (debug) {
                     System.err.println("Warning: Unresolved Symbol: "
                                        + id.getName() + " substituted NaN");
                 }
-                return new Literal(Double.valueOf(Double.NaN));
+                return new Literal(e.isRequired() ? 0.0d : Double.NaN);
             }
             if (m.getVariability() == Variability.CONSTANT) {
                 if (debug) {
                     System.out.println("Converting constant " + id.getName()
                                        + " to literal with value "

@@ -129,11 +129,13 @@
                     System.out.println("Converting expression " + e
                                        + " (left = " + ln.doubleValue() + ")"
                                        + " (right = " + rn.doubleValue() + ")"
                                        + " to literal value " + result);
                 }
-                return new Literal(Double.valueOf(result));
+                var literal = new Literal(result);
+                literal.setRequired(e.isRequired());
+                return literal;
             }
         }
 
         if (l != null && r == null) {
             return l;
< prev index next >