-
Bug
-
Resolution: Fixed
-
P3
-
8u60, 9
-
b84
-
x86
-
windows_8
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8142293 | emb-9 | Attila Szegedi | P3 | Resolved | Fixed | team |
JDK-8141003 | 8u91 | Attila Szegedi | P3 | Resolved | Fixed | b01 |
JDK-8137238 | 8u72 | Attila Szegedi | P3 | Resolved | Fixed | b01 |
JDK-8147372 | emb-8u91 | Attila Szegedi | P3 | Resolved | Fixed | b01 |
FULL PRODUCT VERSION :
java version "1.8.0_60"
Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
Java HotSpot(TM) Client VM (build 25.60-b23, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 6.3.9600]
A DESCRIPTION OF THE PROBLEM :
There is a bug while executing the following javascript program with Nashorn via command line:
jjs.exe program.js
Probably the dead code elimination corrupts the global scope, hence the Nashorn's predefined "print" function is undefined during runtime.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Save the following javascript program to file (program.js) and run it by CLI:
jjs.exe program.js
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
the expected output would be (as it does in other javascript engines):
string
string
ACTUAL -
the actual output is:
string
run.js:7 TypeError: Cannot call undefined
ERROR MESSAGES/STACK TRACES THAT OCCUR :
run.js:7 TypeError: Cannot call undefined
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
var x = "string";
print(x);
(function () {
(function () {
// print is undefined!
print(x);
})();
if (false) {
(function () {
var x;
})();
}
})();
---------- END SOURCE ----------
java version "1.8.0_60"
Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
Java HotSpot(TM) Client VM (build 25.60-b23, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 6.3.9600]
A DESCRIPTION OF THE PROBLEM :
There is a bug while executing the following javascript program with Nashorn via command line:
jjs.exe program.js
Probably the dead code elimination corrupts the global scope, hence the Nashorn's predefined "print" function is undefined during runtime.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Save the following javascript program to file (program.js) and run it by CLI:
jjs.exe program.js
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
the expected output would be (as it does in other javascript engines):
string
string
ACTUAL -
the actual output is:
string
run.js:7 TypeError: Cannot call undefined
ERROR MESSAGES/STACK TRACES THAT OCCUR :
run.js:7 TypeError: Cannot call undefined
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
var x = "string";
print(x);
(function () {
(function () {
// print is undefined!
print(x);
})();
if (false) {
(function () {
var x;
})();
}
})();
---------- END SOURCE ----------
- backported by
-
JDK-8137238 var statement in if(false) block incorrectly evacuated into enclosing function
- Resolved
-
JDK-8141003 var statement in if(false) block incorrectly evacuated into enclosing function
- Resolved
-
JDK-8142293 var statement in if(false) block incorrectly evacuated into enclosing function
- Resolved
-
JDK-8147372 var statement in if(false) block incorrectly evacuated into enclosing function
- Resolved