From jan.lahoda at oracle.com Thu May 4 13:44:44 2017 From: jan.lahoda at oracle.com (Jan Lahoda) Date: Thu, 4 May 2017 15:44:44 +0200 Subject: RFR: JDK-8179531: JShell: fails to provide bytecode for dynamically created lambdas Message-ID: <590B304C.8040800@oracle.com> Hi, This makes ClassLoader.getResource(s) return the actual bytecode that is being run. Bug: https://bugs.openjdk.java.net/browse/JDK-8179531 Webrev: http://cr.openjdk.java.net/~jlahoda/8179531/webrev.00/ Thanks, Jan From paul.sandoz at oracle.com Thu May 4 17:32:48 2017 From: paul.sandoz at oracle.com (Paul Sandoz) Date: Thu, 4 May 2017 10:32:48 -0700 Subject: RFR: JDK-8179531: JShell: fails to provide bytecode for dynamically created lambdas In-Reply-To: <590B304C.8040800@oracle.com> References: <590B304C.8040800@oracle.com> Message-ID: <2259DA6F-7F4E-4537-9872-FABA66346940@oracle.com> > On 4 May 2017, at 06:44, Jan Lahoda wrote: > > Hi, > > This makes ClassLoader.getResource(s) return the actual bytecode that is being run. > > Bug: > https://bugs.openjdk.java.net/browse/JDK-8179531 > > Webrev: > http://cr.openjdk.java.net/~jlahoda/8179531/webrev.00/ > Looks good. Minor comments. DefaultLoaderDelegate ? 68 private final Map classFiles = new TreeMap<>(); HashMap? 187 } catch (MalformedURLException ex) { 188 } Rather than swallowing the exception you might wanna throw an InternalError. I don?t think there are any valid resource names that used in a raw manner would result in the creation of a malformed URL, but just in case? I am a little paranoid about this, so would create a URI instance from the component parts, and then pass the result of toString to the URL constructor, thereby ensuring correct escaping of the resource name as the URL path. Up to you. GetResourceTest ? 118 Thread.sleep(1000); //ensure time change: The test might intermittently fail. Recommend you wrap in try/catch (InterruptedException e ) {} 136 public void checkFieldAccess() throws InterruptedException { 152 public void checkGetResources() throws InterruptedException { I don?t see how those methods throw InterruptedException. Paul. From jan.lahoda at oracle.com Thu May 4 21:07:32 2017 From: jan.lahoda at oracle.com (Jan Lahoda) Date: Thu, 4 May 2017 23:07:32 +0200 Subject: RFR: JDK-8179531: JShell: fails to provide bytecode for dynamically created lambdas In-Reply-To: <2259DA6F-7F4E-4537-9872-FABA66346940@oracle.com> References: <590B304C.8040800@oracle.com> <2259DA6F-7F4E-4537-9872-FABA66346940@oracle.com> Message-ID: <590B9814.1030802@oracle.com> Thanks for the comments. An updated webrev: http://cr.openjdk.java.net/~jlahoda/8179531/webrev.01/ On 4.5.2017 19:32, Paul Sandoz wrote: > >> On 4 May 2017, at 06:44, Jan Lahoda wrote: >> >> Hi, >> >> This makes ClassLoader.getResource(s) return the actual bytecode that is being run. >> >> Bug: >> https://bugs.openjdk.java.net/browse/JDK-8179531 >> >> Webrev: >> http://cr.openjdk.java.net/~jlahoda/8179531/webrev.00/ >> > > Looks good. Minor comments. > > > DefaultLoaderDelegate > ? > > 68 private final Map classFiles = new TreeMap<>(); > > HashMap? Sorry, done. > > > 187 } catch (MalformedURLException ex) { > 188 } > > > Rather than swallowing the exception you might wanna throw an InternalError. I don?t think there are any valid resource names that used in a raw manner would result in the creation of a malformed URL, but just in case? I am a little paranoid about this, so would create a URI instance from the component parts, and then pass the result of toString to the URL constructor, thereby ensuring correct escaping of the resource name as the URL path. Up to you. Done. > > > GetResourceTest > ? > > 118 Thread.sleep(1000); //ensure time change: > > The test might intermittently fail. Recommend you wrap in try/catch (InterruptedException e ) {} Done. (Will wait for a second even in case of the exception, to prevent following failure.) > > > 136 public void checkFieldAccess() throws InterruptedException { > > 152 public void checkGetResources() throws InterruptedException { > > I don?t see how those methods throw InterruptedException. Done. Jan > > Paul. > From paul.sandoz at oracle.com Thu May 4 21:24:15 2017 From: paul.sandoz at oracle.com (Paul Sandoz) Date: Thu, 4 May 2017 14:24:15 -0700 Subject: RFR: JDK-8179531: JShell: fails to provide bytecode for dynamically created lambdas In-Reply-To: <590B9814.1030802@oracle.com> References: <590B304C.8040800@oracle.com> <2259DA6F-7F4E-4537-9872-FABA66346940@oracle.com> <590B9814.1030802@oracle.com> Message-ID: <726037F1-2DE4-4233-B4AE-58D88CF2034F@oracle.com> > On 4 May 2017, at 14:07, Jan Lahoda wrote: > > Thanks for the comments. An updated webrev: > http://cr.openjdk.java.net/~jlahoda/8179531/webrev.01/ > +1 > On 4.5.2017 19:32, Paul Sandoz wrote: >> >> GetResourceTest >> ? >> >> 118 Thread.sleep(1000); //ensure time change: >> >> The test might intermittently fail. Recommend you wrap in try/catch (InterruptedException e ) {} > > Done. (Will wait for a second even in case of the exception, to prevent following failure.) > For future reference i believe you can do this: CompletableFuture.runAsync(() -> {}, CompletableFuture.delayedExecutor(1, TimeUnit.SECONDS)).join(); Paul. From robert.field at oracle.com Fri May 5 02:24:48 2017 From: robert.field at oracle.com (Robert Field) Date: Thu, 04 May 2017 19:24:48 -0700 Subject: RFR: JDK-8179531: JShell: fails to provide bytecode for dynamically created lambdas In-Reply-To: <590B9814.1030802@oracle.com> References: <590B304C.8040800@oracle.com> <2259DA6F-7F4E-4537-9872-FABA66346940@oracle.com> <590B9814.1030802@oracle.com> Message-ID: <590BE270.2090607@oracle.com> One concern, in DefaultLoaderDelegate.RemoteClassLoader.findResources, if it is possible for the result found by doFindResource to equal one of those returned super.findResources then there would be a duplicate in the Enumeration. Otherwise, looks good. Robert On 05/04/17 14:07, Jan Lahoda wrote: > Thanks for the comments. An updated webrev: > http://cr.openjdk.java.net/~jlahoda/8179531/webrev.01/ > > On 4.5.2017 19:32, Paul Sandoz wrote: >> >>> On 4 May 2017, at 06:44, Jan Lahoda wrote: >>> >>> Hi, >>> >>> This makes ClassLoader.getResource(s) return the actual bytecode >>> that is being run. >>> >>> Bug: >>> https://bugs.openjdk.java.net/browse/JDK-8179531 >>> >>> Webrev: >>> http://cr.openjdk.java.net/~jlahoda/8179531/webrev.00/ >>> >> >> Looks good. Minor comments. >> >> >> DefaultLoaderDelegate >> ? >> >> 68 private final Map classFiles = new >> TreeMap<>(); >> >> HashMap? > > Sorry, done. > >> >> >> 187 } catch (MalformedURLException ex) { >> 188 } >> >> >> Rather than swallowing the exception you might wanna throw an >> InternalError. I don?t think there are any valid resource names that >> used in a raw manner would result in the creation of a malformed URL, >> but just in case? I am a little paranoid about this, so would create >> a URI instance from the component parts, and then pass the result of >> toString to the URL constructor, thereby ensuring correct escaping of >> the resource name as the URL path. Up to you. > > Done. > >> >> >> GetResourceTest >> ? >> >> 118 Thread.sleep(1000); //ensure time change: >> >> The test might intermittently fail. Recommend you wrap in try/catch >> (InterruptedException e ) {} > > Done. (Will wait for a second even in case of the exception, to > prevent following failure.) > >> >> >> 136 public void checkFieldAccess() throws InterruptedException { >> >> 152 public void checkGetResources() throws InterruptedException { >> >> I don?t see how those methods throw InterruptedException. > > Done. > > Jan > >> >> Paul. >> From jan.lahoda at oracle.com Fri May 5 14:01:27 2017 From: jan.lahoda at oracle.com (Jan Lahoda) Date: Fri, 5 May 2017 16:01:27 +0200 Subject: RFR: JDK-8179531: JShell: fails to provide bytecode for dynamically created lambdas In-Reply-To: <590BE270.2090607@oracle.com> References: <590B304C.8040800@oracle.com> <2259DA6F-7F4E-4537-9872-FABA66346940@oracle.com> <590B9814.1030802@oracle.com> <590BE270.2090607@oracle.com> Message-ID: <590C85B7.7050901@oracle.com> On 5.5.2017 04:24, Robert Field wrote: > One concern, in DefaultLoaderDelegate.RemoteClassLoader.findResources, > if it is possible for the result found by doFindResource to equal one of > those returned super.findResources then there would be a duplicate in > the Enumeration. I don't think super.findResources can return the resource we are returning from doFindResource. Thanks, Jan > > Otherwise, looks good. > > Robert > > On 05/04/17 14:07, Jan Lahoda wrote: >> Thanks for the comments. An updated webrev: >> http://cr.openjdk.java.net/~jlahoda/8179531/webrev.01/ >> >> On 4.5.2017 19:32, Paul Sandoz wrote: >>> >>>> On 4 May 2017, at 06:44, Jan Lahoda wrote: >>>> >>>> Hi, >>>> >>>> This makes ClassLoader.getResource(s) return the actual bytecode >>>> that is being run. >>>> >>>> Bug: >>>> https://bugs.openjdk.java.net/browse/JDK-8179531 >>>> >>>> Webrev: >>>> http://cr.openjdk.java.net/~jlahoda/8179531/webrev.00/ >>>> >>> >>> Looks good. Minor comments. >>> >>> >>> DefaultLoaderDelegate >>> ? >>> >>> 68 private final Map classFiles = new >>> TreeMap<>(); >>> >>> HashMap? >> >> Sorry, done. >> >>> >>> >>> 187 } catch (MalformedURLException ex) { >>> 188 } >>> >>> >>> Rather than swallowing the exception you might wanna throw an >>> InternalError. I don?t think there are any valid resource names that >>> used in a raw manner would result in the creation of a malformed URL, >>> but just in case? I am a little paranoid about this, so would create >>> a URI instance from the component parts, and then pass the result of >>> toString to the URL constructor, thereby ensuring correct escaping of >>> the resource name as the URL path. Up to you. >> >> Done. >> >>> >>> >>> GetResourceTest >>> ? >>> >>> 118 Thread.sleep(1000); //ensure time change: >>> >>> The test might intermittently fail. Recommend you wrap in try/catch >>> (InterruptedException e ) {} >> >> Done. (Will wait for a second even in case of the exception, to >> prevent following failure.) >> >>> >>> >>> 136 public void checkFieldAccess() throws InterruptedException { >>> >>> 152 public void checkGetResources() throws InterruptedException { >>> >>> I don?t see how those methods throw InterruptedException. >> >> Done. >> >> Jan >> >>> >>> Paul. >>> > From robert.field at oracle.com Fri May 5 15:27:04 2017 From: robert.field at oracle.com (Robert Field) Date: Fri, 05 May 2017 08:27:04 -0700 Subject: RFR: JDK-8179531: JShell: fails to provide bytecode for dynamically created lambdas In-Reply-To: <590C85B7.7050901@oracle.com> References: <590B304C.8040800@oracle.com> <2259DA6F-7F4E-4537-9872-FABA66346940@oracle.com> <590B9814.1030802@oracle.com> <590BE270.2090607@oracle.com> <590C85B7.7050901@oracle.com> Message-ID: <15bd938b540.2784.4011f3a8741ca2aabce58b8b81f42d24@oracle.com> Ok On May 5, 2017 7:01:32 AM Jan Lahoda wrote: > On 5.5.2017 04:24, Robert Field wrote: >> One concern, in DefaultLoaderDelegate.RemoteClassLoader.findResources, >> if it is possible for the result found by doFindResource to equal one of >> those returned super.findResources then there would be a duplicate in >> the Enumeration. > > I don't think super.findResources can return the resource we are > returning from doFindResource. > > Thanks, > Jan > >> >> Otherwise, looks good. >> >> Robert >> >> On 05/04/17 14:07, Jan Lahoda wrote: >>> Thanks for the comments. An updated webrev: >>> http://cr.openjdk.java.net/~jlahoda/8179531/webrev.01/ >>> >>> On 4.5.2017 19:32, Paul Sandoz wrote: >>>> >>>>> On 4 May 2017, at 06:44, Jan Lahoda wrote: >>>>> >>>>> Hi, >>>>> >>>>> This makes ClassLoader.getResource(s) return the actual bytecode >>>>> that is being run. >>>>> >>>>> Bug: >>>>> https://bugs.openjdk.java.net/browse/JDK-8179531 >>>>> >>>>> Webrev: >>>>> http://cr.openjdk.java.net/~jlahoda/8179531/webrev.00/ >>>>> >>>> >>>> Looks good. Minor comments. >>>> >>>> >>>> DefaultLoaderDelegate >>>> ? >>>> >>>> 68 private final Map classFiles = new >>>> TreeMap<>(); >>>> >>>> HashMap? >>> >>> Sorry, done. >>> >>>> >>>> >>>> 187 } catch (MalformedURLException ex) { >>>> 188 } >>>> >>>> >>>> Rather than swallowing the exception you might wanna throw an >>>> InternalError. I don?t think there are any valid resource names that >>>> used in a raw manner would result in the creation of a malformed URL, >>>> but just in case? I am a little paranoid about this, so would create >>>> a URI instance from the component parts, and then pass the result of >>>> toString to the URL constructor, thereby ensuring correct escaping of >>>> the resource name as the URL path. Up to you. >>> >>> Done. >>> >>>> >>>> >>>> GetResourceTest >>>> ? >>>> >>>> 118 Thread.sleep(1000); //ensure time change: >>>> >>>> The test might intermittently fail. Recommend you wrap in try/catch >>>> (InterruptedException e ) {} >>> >>> Done. (Will wait for a second even in case of the exception, to >>> prevent following failure.) >>> >>>> >>>> >>>> 136 public void checkFieldAccess() throws InterruptedException { >>>> >>>> 152 public void checkGetResources() throws InterruptedException { >>>> >>>> I don?t see how those methods throw InterruptedException. >>> >>> Done. >>> >>> Jan >>> >>>> >>>> Paul. >>>> >> From robert.field at oracle.com Wed May 17 07:45:44 2017 From: robert.field at oracle.com (Robert Field) Date: Wed, 17 May 2017 00:45:44 -0700 Subject: RFR 8167554: jshell tool: re-execute a range and/or sequence of snippets Message-ID: <591BFFA8.6090507@oracle.com> Please review (for JDK 10) -- Bug: https://bugs.openjdk.java.net/browse/JDK-8167554 Webrev: http://cr.openjdk.java.net/~rfield/8167554v0.webrev/ Thanks, Robert From robert.field at oracle.com Thu May 18 03:08:04 2017 From: robert.field at oracle.com (Robert Field) Date: Wed, 17 May 2017 20:08:04 -0700 Subject: RFR 8167554: jshell tool: re-execute a range and/or sequence of snippets In-Reply-To: <591BFFA8.6090507@oracle.com> References: <591BFFA8.6090507@oracle.com> Message-ID: <591D1014.3030705@oracle.com> This is an update that also adds (consistent) range support to command arguments and extends uniform processing to more commands. Please review (for JDK 10) -- Bugs: jshell tool: re-execute a range and/or sequence of snippets https://bugs.openjdk.java.net/browse/JDK-8167554 jshell tool: support id ranges in all commands with id arguments https://bugs.openjdk.java.net/browse/JDK-8180508 Webrev: http://cr.openjdk.java.net/~rfield/8167554v1.webrev/ Thanks, Robert From jan.lahoda at oracle.com Thu May 18 17:52:54 2017 From: jan.lahoda at oracle.com (Jan Lahoda) Date: Thu, 18 May 2017 19:52:54 +0200 Subject: RFR 8167554: jshell tool: re-execute a range and/or sequence of snippets In-Reply-To: <591D1014.3030705@oracle.com> References: <591BFFA8.6090507@oracle.com> <591D1014.3030705@oracle.com> Message-ID: <591DDF76.5050108@oracle.com> Seems OK. Jan On 18.5.2017 05:08, Robert Field wrote: > This is an update that also adds (consistent) range support to command > arguments and extends uniform processing to more commands. > > Please review (for JDK 10) -- > > Bugs: > > jshell tool: re-execute a range and/or sequence of snippets > https://bugs.openjdk.java.net/browse/JDK-8167554 > > jshell tool: support id ranges in all commands with id arguments > https://bugs.openjdk.java.net/browse/JDK-8180508 > > Webrev: > > http://cr.openjdk.java.net/~rfield/8167554v1.webrev/ > > Thanks, > Robert From robert.field at oracle.com Tue May 30 22:53:26 2017 From: robert.field at oracle.com (Robert Field) Date: Tue, 30 May 2017 12:53:26 -1000 Subject: RFR 8180306 et. al.: jshell tool /help fixes Message-ID: <5AE3A57B-CE78-4585-8A2C-F89D8BF5875A@oracle.com> Please review ? Bugs: 8180306: jshell tool: /help -- confusing identifier in feedback mode examples https://bugs.openjdk.java.net/browse/JDK-8180306 8179048: jshell tool: /help -- references to "/reset or /reload" should add /env https://bugs.openjdk.java.net/browse/JDK-8179048 8179046: jshell tool: /help /edit is missing -all and -start https://bugs.openjdk.java.net/browse/JDK-8179046 Diff: diff -r 0a6e4f88a9b7 src/jdk.jshell/share/classes/jdk/internal/jshell/tool/resources/l10n.properties --- a/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/resources/l10n.properties Fri May 26 01:00:44 2017 +0000 +++ b/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/resources/l10n.properties Tue May 30 12:44:44 2017 -1000 @@ -249,6 +249,11 @@ Edit the snippets with the specified snippet ids\n\n\ /edit -\n\t\ Edit the snippets within the range of snippet ids\n\n\ +/edit -start\n\t\ + Edit the automatically evaluated start-up snippets. Any changes are in this\n\t\ + session, and do not affect the start-up setting\n\n\ +/edit -all\n\t\ + Edit all snippets including failed, overwritten, dropped, and start-up\n\n\ /edit\n\t\ Edit the currently active snippets of code that you typed or read with /open @@ -393,7 +398,7 @@ recent.\n\n\ /reload -restore\n\t\ Reset and replay the valid history between the previous and most\n\t\ - recent time that jshell was entered, or a /reset, or /reload\n\t\ + recent time that jshell was entered, or a /reset, /reload, or /env\n\t\ command was executed. This can thus be used to restore a previous\n\t\ jshell tool session.\n\n\ /reload [-restore] -quiet\n\t\ @@ -695,18 +700,18 @@ error1 -- one error\n\t\ error2 -- two or more errors\n\n\ Examples:\n\t\ -/set format myformat action 'Created' added-primary\n\t\ -/set format myformat action 'Update replaced' replaced-update\n\t\ -/set format myformat display '{pre}{action} class {name}{post}' class-ok\n\t\ -/set format myformat display '{pre}{action} variable {name}, reset to null{post}' replaced-vardecl,varinit-ok-update\n\n\ +/set format mymode action 'Created' added-primary\n\t\ +/set format mymode action 'Update replaced' replaced-update\n\t\ +/set format mymode display '{pre}{action} class {name}{post}' class-ok\n\t\ +/set format mymode display '{pre}{action} variable {name}, reset to null{post}' replaced-vardecl,varinit-ok-update\n\n\ Note that subsequent selectors for a field may overwrite some or all of previous used selectors -- last one wins\n\ \n\ The form without shows the current format settings.\n\ When the is specified only the format settings for that mode are shown.\n\ When both the and are specified only the format settings for that\n\ mode and field are shown. Example:\n\t\ -/set format myformat\n\ -shows the format settings for the mode myformat\n +/set format mymode\n\ +shows the format settings for the mode mymode\n help.set.truncation = \ Set the max length of a displayed value:\n\ @@ -745,8 +750,8 @@ The form without shows the truncation settings.\n\ When the is specified only the truncation settings for that mode are shown.\n\ Example:\n\t\ -/set truncation myformat\n\ -shows the truncation settings for the mode myformat\n +/set truncation mymode\n\ +shows the truncation settings for the mode mymode\n help.set.feedback = \ Set the feedback mode describing displayed feedback for entered snippets and commands:\n\ @@ -818,9 +823,9 @@ Note: the settings for the mode include the settings for prompt, format, and\n\ truncation.\n\ Example:\n\t\ -/set mode myformat\n\ +/set mode mymode\n\ \n\ -shows the mode, prompt, format, and truncation settings for the mode myformat +shows the mode, prompt, format, and truncation settings for the mode mymode help.set.prompt = \ Set the prompts. Both the normal prompt and the continuation-prompt must be set:\n\ @@ -840,8 +845,8 @@ The form without shows the currently set prompts.\n\ When the is specified only the prompts for that mode are shown.\n\ Example:\n\t\ -/set prompt myformat\n\ -shows the prompts set for the mode myformat\n +/set prompt mymode\n\ +shows the prompts set for the mode mymode\n help.set.editor =\ Specify the command to launch for the /edit command:\n\