From hannes.wallnoefer at oracle.com Mon Oct 21 11:59:10 2019 From: hannes.wallnoefer at oracle.com (=?utf-8?Q?Hannes_Walln=C3=B6fer?=) Date: Mon, 21 Oct 2019 13:59:10 +0200 Subject: RFR: 8232209: Update double-conversion license file to version 3.1.5 Message-ID: <9BC385B7-6CC5-4C9F-9F7D-0CD705DEF17E@oracle.com> Please review this trivial patch to update the version number in the double-conversion license file. JBS: https://bugs.openjdk.java.net/browse/JDK-8232209 Webrev: http://cr.openjdk.java.net/~hannesw/8232209/webrev.00/ Thanks, Hannes From mitrofanov at krista.ru Wed Oct 23 11:45:11 2019 From: mitrofanov at krista.ru (=?UTF-8?B?0JzQuNGC0YDQvtGE0LDQvdC+0LIgINCQ0L3RgtC+0L0gINCh0LXRgNCz0LU=?= =?UTF-8?B?0LXQstC40Yc=?=) Date: Wed, 23 Oct 2019 14:45:11 +0300 Subject: Bug in extractVarNodesFromDeadCode. Variable "x" has already been declared Message-ID: <008401d58997$53f50050$fbdf00f0$@ru> Hi. We have encountered another bug in Nashorn. It can be reproduced by evaluation of this script with "jjs --language=es6": if (true) { throw "test"; } { let x = "1"; } { let x = 2; } It results in compilation error: ECMAScript Exception: SyntaxError: :1:34 Variable "x" has already been declared if (true) { throw "test"; } { let x = "1"; } { let x = 2; } ^ While expected out was to get runtime exception "test". Looks like the problem is in dead code elimination logic of FoldConstants.extractVarNodesFromDeadCode function. And here is the patch to fix it: diff -r 6e287efa5fa3 src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/FoldConstants.java --- a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/FoldConstants.java Wed Oct 23 09:53:07 2019 +0200 +++ b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/FoldConstants.java Wed Oct 23 14:23:48 2019 +0300 @@ -195,7 +195,9 @@ deadCodeRoot.accept(new SimpleNodeVisitor() { @Override public boolean enterVarNode(final VarNode varNode) { - statements.add(varNode.setInit(null)); + if (!varNode.isBlockScoped()) { + statements.add(varNode.setInit(null)); + } return false; } From mitrofanov at krista.ru Mon Oct 28 15:21:10 2019 From: mitrofanov at krista.ru (Anton Mitrofanov) Date: Mon, 28 Oct 2019 18:21:10 +0300 Subject: Bug in extractVarNodesFromDeadCode. Variable "x" has already been declared Message-ID: <006201d58da3$53ee4ed0$fbcaec70$@ru> Hi. We have encountered another bug in Nashorn. It can be reproduced by evaluation of this script with "jjs --language=es6": if (true) { throw "test"; } { let x = "1"; } { let x = 2; } It results in compilation error: ECMAScript Exception: SyntaxError: :1:34 Variable "x" has already been declared if (true) { throw "test"; } { let x = "1"; } { let x = 2; } ^ While expected out was to get runtime exception "test". Looks like the problem is in dead code elimination logic of FoldConstants.extractVarNodesFromDeadCode function. And here is the patch to fix it: diff -r 6e287efa5fa3 src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/FoldConstants.java --- a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/FoldConstants.java Wed Oct 23 09:53:07 2019 +0200 +++ b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/FoldConstants.java Wed Oct 23 14:23:48 2019 +0300 @@ -195,7 +195,9 @@ deadCodeRoot.accept(new SimpleNodeVisitor() { @Override public boolean enterVarNode(final VarNode varNode) { - statements.add(varNode.setInit(null)); + if (!varNode.isBlockScoped()) { + statements.add(varNode.setInit(null)); + } return false; } From james.laskey at oracle.com Mon Oct 28 15:36:35 2019 From: james.laskey at oracle.com (Jim Laskey) Date: Mon, 28 Oct 2019 12:36:35 -0300 Subject: Bug in extractVarNodesFromDeadCode. Variable "x" has already been declared In-Reply-To: <006201d58da3$53ee4ed0$fbcaec70$@ru> References: <006201d58da3$53ee4ed0$fbcaec70$@ru> Message-ID: <3C94F40F-6FAD-4078-89A2-4A1E3439F7BF@oracle.com> You want to take this on? File a bug and put the e-mail (change set) in it, then tell the user Nashorn is deprecated. > On Oct 28, 2019, at 12:21 PM, Anton Mitrofanov wrote: > > Hi. > > We have encountered another bug in Nashorn. It can be reproduced by evaluation of this script with "jjs --language=es6": > > if (true) { throw "test"; } { let x = "1"; } { let x = 2; } > > It results in compilation error: > > ECMAScript Exception: SyntaxError: :1:34 Variable "x" has already been declared if (true) { throw "test"; } { let x = "1"; } { let x = 2; } > ^ > While expected out was to get runtime exception "test". > > Looks like the problem is in dead code elimination logic of FoldConstants.extractVarNodesFromDeadCode function. > > And here is the patch to fix it: > > diff -r 6e287efa5fa3 src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/FoldConstants.java > --- a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/FoldConstants.java Wed Oct 23 09:53:07 2019 +0200 > +++ b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/FoldConstants.java Wed Oct 23 14:23:48 2019 +0300 > @@ -195,7 +195,9 @@ > deadCodeRoot.accept(new SimpleNodeVisitor() { > @Override > public boolean enterVarNode(final VarNode varNode) { > - statements.add(varNode.setInit(null)); > + if (!varNode.isBlockScoped()) { > + statements.add(varNode.setInit(null)); > + } > return false; > } > > From james.laskey at oracle.com Mon Oct 28 15:47:14 2019 From: james.laskey at oracle.com (Jim Laskey) Date: Mon, 28 Oct 2019 12:47:14 -0300 Subject: Bug in extractVarNodesFromDeadCode. Variable "x" has already been declared In-Reply-To: <3C94F40F-6FAD-4078-89A2-4A1E3439F7BF@oracle.com> References: <006201d58da3$53ee4ed0$fbcaec70$@ru> <3C94F40F-6FAD-4078-89A2-4A1E3439F7BF@oracle.com> Message-ID: Obviously, this wasn't intended for the list. To clarify, since Nashorn is being deprecated, we are taking input such as this and recording it as a bug in case someone adopts Nashorn in future. Cheers, -- Jim > On Oct 28, 2019, at 12:36 PM, Jim Laskey wrote: > > You want to take this on? File a bug and put the e-mail (change set) in it, then tell the user Nashorn is deprecated. > >> On Oct 28, 2019, at 12:21 PM, Anton Mitrofanov wrote: >> >> Hi. >> >> We have encountered another bug in Nashorn. It can be reproduced by evaluation of this script with "jjs --language=es6": >> >> if (true) { throw "test"; } { let x = "1"; } { let x = 2; } >> >> It results in compilation error: >> >> ECMAScript Exception: SyntaxError: :1:34 Variable "x" has already been declared if (true) { throw "test"; } { let x = "1"; } { let x = 2; } >> ^ >> While expected out was to get runtime exception "test". >> >> Looks like the problem is in dead code elimination logic of FoldConstants.extractVarNodesFromDeadCode function. >> >> And here is the patch to fix it: >> >> diff -r 6e287efa5fa3 src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/FoldConstants.java >> --- a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/FoldConstants.java Wed Oct 23 09:53:07 2019 +0200 >> +++ b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/FoldConstants.java Wed Oct 23 14:23:48 2019 +0300 >> @@ -195,7 +195,9 @@ >> deadCodeRoot.accept(new SimpleNodeVisitor() { >> @Override >> public boolean enterVarNode(final VarNode varNode) { >> - statements.add(varNode.setInit(null)); >> + if (!varNode.isBlockScoped()) { >> + statements.add(varNode.setInit(null)); >> + } >> return false; >> } >> >> > From hannes.wallnoefer at oracle.com Wed Oct 30 10:31:01 2019 From: hannes.wallnoefer at oracle.com (=?utf-8?Q?Hannes_Walln=C3=B6fer?=) Date: Wed, 30 Oct 2019 11:31:01 +0100 Subject: Bug in extractVarNodesFromDeadCode. Variable "x" has already been declared In-Reply-To: References: <006201d58da3$53ee4ed0$fbcaec70$@ru> <3C94F40F-6FAD-4078-89A2-4A1E3439F7BF@oracle.com> Message-ID: <367840B6-6187-489F-8B4C-838B09CCF12B@oracle.com> Thanks for the report! https://bugs.openjdk.java.net/browse/JDK-8233195 The provided patch looks reasonable so the chances to get this fixed are quite good. Hannes > Am 28.10.2019 um 16:47 schrieb Jim Laskey : > > Obviously, this wasn't intended for the list. To clarify, since Nashorn is being deprecated, we are taking input such as this and recording it as a bug in case someone adopts Nashorn in future. > > Cheers, > > -- Jim > > >> On Oct 28, 2019, at 12:36 PM, Jim Laskey wrote: >> >> You want to take this on? File a bug and put the e-mail (change set) in it, then tell the user Nashorn is deprecated. >> >>> On Oct 28, 2019, at 12:21 PM, Anton Mitrofanov wrote: >>> >>> Hi. >>> >>> We have encountered another bug in Nashorn. It can be reproduced by evaluation of this script with "jjs --language=es6": >>> >>> if (true) { throw "test"; } { let x = "1"; } { let x = 2; } >>> >>> It results in compilation error: >>> >>> ECMAScript Exception: SyntaxError: :1:34 Variable "x" has already been declared if (true) { throw "test"; } { let x = "1"; } { let x = 2; } >>> ^ >>> While expected out was to get runtime exception "test". >>> >>> Looks like the problem is in dead code elimination logic of FoldConstants.extractVarNodesFromDeadCode function. >>> >>> And here is the patch to fix it: >>> >>> diff -r 6e287efa5fa3 src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/FoldConstants.java >>> --- a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/FoldConstants.java Wed Oct 23 09:53:07 2019 +0200 >>> +++ b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/FoldConstants.java Wed Oct 23 14:23:48 2019 +0300 >>> @@ -195,7 +195,9 @@ >>> deadCodeRoot.accept(new SimpleNodeVisitor() { >>> @Override >>> public boolean enterVarNode(final VarNode varNode) { >>> - statements.add(varNode.setInit(null)); >>> + if (!varNode.isBlockScoped()) { >>> + statements.add(varNode.setInit(null)); >>> + } >>> return false; >>> } >>> >>> >> > From xihua.duan at gmail.com Wed Oct 30 07:38:32 2019 From: xihua.duan at gmail.com (tibetty) Date: Wed, 30 Oct 2019 00:38:32 -0700 (MST) Subject: Bug report: can't call static methods on a Java class instance In-Reply-To: <774896D2-A5B3-4D61-A001-9026FACACF12@oracle.com> References: <52556484.4050107@threecrickets.com> <774896D2-A5B3-4D61-A001-9026FACACF12@oracle.com> Message-ID: <1572421112680-0.post@n7.nabble.com> I used your method, but it stills failed calling a static method of a 3rd party class (com.alibaba.fastjson.JSONObject): Nashorn (JS) code: var jso = Java.type('com.alibaba.fastjson.JSONObject').parseObject(json); Error Message: Exception in thread "main" javax.script.ScriptException: TypeError: Java.type("com.alibaba.fastjson.JSONObject").parseObject is not a function in at line number 1 How to overcome this kind of problem? -- Sent from: http://nashorn.36665.n7.nabble.com/ From joaovarandas at inpaas.com Wed Oct 30 12:25:44 2019 From: joaovarandas at inpaas.com (=?UTF-8?Q?Jo=C3=A3o_Paulo_Varandas?=) Date: Wed, 30 Oct 2019 09:25:44 -0300 Subject: Bug report: can't call static methods on a Java class instance In-Reply-To: <1572421112680-0.post@n7.nabble.com> References: <52556484.4050107@threecrickets.com> <774896D2-A5B3-4D61-A001-9026FACACF12@oracle.com> <1572421112680-0.post@n7.nabble.com> Message-ID: Call parseObject directly from the class that contains the static method, not from the extended one. var jso = Java.type('com.alibaba.fastjson.JSON').parseObject(json); https://github.com/alibaba/fastjson/blob/master/src/main/java/com/alibaba/fastjson/JSON.java On Wed, Oct 30, 2019 at 9:22 AM tibetty wrote: > I used your method, but it stills failed calling a static method of a 3rd > party class (com.alibaba.fastjson.JSONObject): > Nashorn (JS) code: > var jso = Java.type('com.alibaba.fastjson.JSONObject').parseObject(json); > > Error Message: > Exception in thread "main" javax.script.ScriptException: TypeError: > Java.type("com.alibaba.fastjson.JSONObject").parseObject is not a function > in at line number 1 > > How to overcome this kind of problem? > > > > > -- > Sent from: http://nashorn.36665.n7.nabble.com/ > -- " This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. If you are not the intended recipient you are notified that disclosing, copying, distributing or taking any action in reliance on the contents of this information is strictly prohibited. " From xihua.duan at gmail.com Wed Oct 30 13:32:33 2019 From: xihua.duan at gmail.com (tibetty) Date: Wed, 30 Oct 2019 21:32:33 +0800 Subject: Bug report: can't call static methods on a Java class instance In-Reply-To: References: <52556484.4050107@threecrickets.com> <774896D2-A5B3-4D61-A001-9026FACACF12@oracle.com> <1572421112680-0.post@n7.nabble.com> Message-ID: It works and many thanks for your timely response, Joao! However, personally I think it's problematic for Nashorn not to support the static method invocation from an extended class. Any design consideration under the hood? On Wed, Oct 30, 2019 at 8:27 PM Jo?o Paulo Varandas wrote: > Call parseObject directly from the class that contains the static method, > not from the extended one. > > var jso = Java.type('com.alibaba.fastjson.JSON').parseObject(json); > > > > https://github.com/alibaba/fastjson/blob/master/src/main/java/com/alibaba/fastjson/JSON.java > > > > > > On Wed, Oct 30, 2019 at 9:22 AM tibetty wrote: > >> I used your method, but it stills failed calling a static method of a 3rd >> party class (com.alibaba.fastjson.JSONObject): >> Nashorn (JS) code: >> var jso = Java.type('com.alibaba.fastjson.JSONObject').parseObject(json); >> >> Error Message: >> Exception in thread "main" javax.script.ScriptException: TypeError: >> Java.type("com.alibaba.fastjson.JSONObject").parseObject is not a function >> in at line number 1 >> >> How to overcome this kind of problem? >> >> >> >> >> -- >> Sent from: http://nashorn.36665.n7.nabble.com/ >> > > " This email and any files transmitted with it are confidential and > intended solely for the use of the individual or entity to whom they are > addressed. If you have received this email in error please notify the > system manager. This message contains confidential information and is > intended only for the individual named. If you are not the named addressee > you should not disseminate, distribute or copy this e-mail. Please notify > the sender immediately by e-mail if you have received this e-mail by > mistake and delete this e-mail from your system. If you are not the > intended recipient you are notified that disclosing, copying, distributing > or taking any action in reliance on the contents of this information is > strictly prohibited. " > From xihua.duan at gmail.com Wed Oct 30 13:40:25 2019 From: xihua.duan at gmail.com (tibetty) Date: Wed, 30 Oct 2019 06:40:25 -0700 (MST) Subject: Bug report: can't call static methods on a Java class instance In-Reply-To: References: <52556484.4050107@threecrickets.com> <774896D2-A5B3-4D61-A001-9026FACACF12@oracle.com> <1572421112680-0.post@n7.nabble.com> Message-ID: <1572442825465-0.post@n7.nabble.com> t works and many thanks for your timely response, Joao! However, personally I think it's problematic for Nashorn not to support the static method invocation from an extended class. Any design consideration under the hood? -- Sent from: http://nashorn.36665.n7.nabble.com/ From mahdiumd at gmail.com Wed Oct 30 13:55:41 2019 From: mahdiumd at gmail.com (Matt Zand) Date: Wed, 30 Oct 2019 09:55:41 -0400 Subject: Bug report: can't call static methods on a Java class instance In-Reply-To: <1572442825465-0.post@n7.nabble.com> References: <52556484.4050107@threecrickets.com> <774896D2-A5B3-4D61-A001-9026FACACF12@oracle.com> <1572421112680-0.post@n7.nabble.com> <1572442825465-0.post@n7.nabble.com> Message-ID: Hey guys, How I can un-subscribe from this mailing list Thx, On Wed, Oct 30, 2019 at 9:33 AM tibetty wrote: > t works and many thanks for your timely response, Joao! However, > personally > I think it's problematic for Nashorn not to support the static method > invocation from an extended class. Any design consideration under the > hood? > > > > -- > Sent from: http://nashorn.36665.n7.nabble.com/ > -- Cheers, Matt Zand Cell: 202-420-9192 Work: 240-200-6131 High School Technology Services DC Web Makers Coding Bootcamps From mahdiumd at gmail.com Wed Oct 30 13:55:57 2019 From: mahdiumd at gmail.com (Matt Zand) Date: Wed, 30 Oct 2019 09:55:57 -0400 Subject: Bug in extractVarNodesFromDeadCode. Variable "x" has already been declared In-Reply-To: <367840B6-6187-489F-8B4C-838B09CCF12B@oracle.com> References: <006201d58da3$53ee4ed0$fbcaec70$@ru> <3C94F40F-6FAD-4078-89A2-4A1E3439F7BF@oracle.com> <367840B6-6187-489F-8B4C-838B09CCF12B@oracle.com> Message-ID: Hey guys, How I can un-subscribe from this mailing list Thx, On Wed, Oct 30, 2019 at 6:33 AM Hannes Walln?fer < hannes.wallnoefer at oracle.com> wrote: > Thanks for the report! > > https://bugs.openjdk.java.net/browse/JDK-8233195 > > The provided patch looks reasonable so the chances to get this fixed are > quite good. > > Hannes > > > > Am 28.10.2019 um 16:47 schrieb Jim Laskey : > > > > Obviously, this wasn't intended for the list. To clarify, since Nashorn > is being deprecated, we are taking input such as this and recording it as a > bug in case someone adopts Nashorn in future. > > > > Cheers, > > > > -- Jim > > > > > >> On Oct 28, 2019, at 12:36 PM, Jim Laskey > wrote: > >> > >> You want to take this on? File a bug and put the e-mail (change set) > in it, then tell the user Nashorn is deprecated. > >> > >>> On Oct 28, 2019, at 12:21 PM, Anton Mitrofanov > wrote: > >>> > >>> Hi. > >>> > >>> We have encountered another bug in Nashorn. It can be reproduced by > evaluation of this script with "jjs --language=es6": > >>> > >>> if (true) { throw "test"; } { let x = "1"; } { let x = 2; } > >>> > >>> It results in compilation error: > >>> > >>> ECMAScript Exception: SyntaxError: :1:34 Variable "x" has > already been declared if (true) { throw "test"; } { let x = "1"; } { let x > = 2; } > >>> ^ > >>> While expected out was to get runtime exception "test". > >>> > >>> Looks like the problem is in dead code elimination logic of > FoldConstants.extractVarNodesFromDeadCode function. > >>> > >>> And here is the patch to fix it: > >>> > >>> diff -r 6e287efa5fa3 > src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/FoldConstants.java > >>> --- > a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/FoldConstants.java > Wed Oct 23 09:53:07 2019 +0200 > >>> +++ > b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/FoldConstants.java > Wed Oct 23 14:23:48 2019 +0300 > >>> @@ -195,7 +195,9 @@ > >>> deadCodeRoot.accept(new SimpleNodeVisitor() { > >>> @Override > >>> public boolean enterVarNode(final VarNode varNode) { > >>> - statements.add(varNode.setInit(null)); > >>> + if (!varNode.isBlockScoped()) { > >>> + statements.add(varNode.setInit(null)); > >>> + } > >>> return false; > >>> } > >>> > >>> > >> > > > > -- Cheers, Matt Zand Cell: 202-420-9192 Work: 240-200-6131 High School Technology Services DC Web Makers Coding Bootcamps