From huizhe.wang at oracle.com Wed Apr 1 01:16:48 2015 From: huizhe.wang at oracle.com (huizhe wang) Date: Tue, 31 Mar 2015 18:16:48 -0700 Subject: RFR: 8076290: JCK test api/xsl/conf/string/string17 starts failing after JDK-8074297 In-Reply-To: <551AA152.6080602@oracle.com> References: <551AA152.6080602@oracle.com> Message-ID: <551B4700.7070305@oracle.com> Hi Aleksej, The patch looks good. It's good that you identified the issue so quickly. The definition of the XPath's substring function is indeed different. When the beginIndex is out of bound (0 in this case since it treats the position of the first character as 1), instead of getting an IOBE as String would with negative index, it actually uses it to calculate the length of the substring. Best, Joe On 3/31/2015 6:29 AM, Aleksej Efimov wrote: > Hi, > > Please review a fix for JCK test failure [2] that was caused by > slightly incorrect fix for JDK-8074297 [3]. > The problem is that the length of required string is incorrectly > calculated when the start index is less or equal than zero: The pushed > fix for JDK-8074297 assumes that length are specified from the first > string character, but it should be counted from the specified start > index - two added test cases for substring test illustrates it - one > for string with supplementary characters, another one without. > All JCK xml related tests passes (including the failed one). > Tests set: api/xsl api/javax_xml api/org_xml xml_schema api/xinclude. > Test results: passed: 35,342 > > Thank you, > Aleksej > > [1] Webrev: http://cr.openjdk.java.net/~aefimov/8076290/00/ > [2] JBS: https://bugs.openjdk.java.net/browse/JDK-8076290 > [3] JDK-8074297: https://bugs.openjdk.java.net/browse/JDK-8074297 From john.r.rose at oracle.com Wed Apr 1 02:54:32 2015 From: john.r.rose at oracle.com (John Rose) Date: Tue, 31 Mar 2015 19:54:32 -0700 Subject: RFR: 8071571: Move substring of same string to slow path In-Reply-To: References: <55156FB3.1080006@oracle.com> <55157487.10108@oracle.com> <5515B58B.5070205@oracle.com> <5515C23D.3050906@oracle.com> <5515D0F4.7040103@oracle.com> <5515D250.10302@Oracle.com> Message-ID: <1EFCE1B1-F9D2-442E-A68D-44CEE0EB8C56@oracle.com> On Mar 27, 2015, at 3:01 PM, Martin Buchholz wrote: > > final Type foo = this.foo; There are IMO a few places where local finals pay for themselves, even after Java 8. One is Martin's idiom. The key thing to observe is that 'foo' is a read-only snapshot or view of 'this.foo'. If we were after conciseness (only) we could delete the whole line, but the line as a whole has a clear purpose. Another reasonable use of local finals is when writing SSA-style code. A blank final enforces SSA, and makes it clearer what's going on. If I'm writing a large, complex loop and I want to make it clear that something is loop-invariant, I sometimes use a final. But in cases like that it's better to factor the loop body into a separate method, if that is possible. Another place I like finals is where I am capturing values which are constants, sampled from a variable (e.g., "cursor++"). In that case, the different declaration makes clear the distinction between a snapshot and a varying cursor. This is of course a matter of taste. In all these cases the benefits are only present when the affected variable has a large or complex live range. So the best use cases are always going to give the onlooker a sense of unease. In simple use cases, "final" is just noise, but in complex ones it can help solidify the reader's understanding. ? John From huizhe.wang at oracle.com Wed Apr 1 05:14:01 2015 From: huizhe.wang at oracle.com (huizhe wang) Date: Tue, 31 Mar 2015 22:14:01 -0700 Subject: Review request for JDK-8051559: JAXP function dom tests conversion In-Reply-To: References: <035701d066e0$93124560$b936d020$@oracle.com> <019b01d06b8a$da0abca0$8e2035e0$@oracle.com> <0E4D09A9-8046-42AC-98B8-D2433A8D38FF@oracle.com> Message-ID: <551B7E99.9050406@oracle.com> Hi Frank, I did see the request, just didn't have time to look at it. I again agree with Lance, that these tests were written over 10 years ago, it would be valuable to write down whatever understanding you gained while converting the tests, same as the Astro application/test, the goal of each test and how it works would all be helpful. Basically, it would be nice to add some comment on @Test. I tried the tests. They worked fine with my current build (with some changes). Thanks, Joe On 3/31/2015 7:10 AM, Lance Andersen wrote: > Hi Frank > On Mar 31, 2015, at 7:24 AM, Lance @ Oracle > wrote: > >> Hi frank >> >> Can you forward the other review request as I think I thought they >> were the same and deleted it > > Ignore this comment, the subjects were too similar but this is what > needed reviewed. >> >> I will look at this again today > > The tests overall look fine. > > I still have the same comment WRT providing a simple comment > describing each test. The key point to remember is we want to make it > easier for someone to look at the test, understand what you are > trying to validate, and understand the coverage of the tests. This > will help future maintainers of the code. Comments are just as > important in test code as it is in implementation IMHO. > > Best > Lance >> >> Best >> Lance >> >> >> Lance >> Andersen| Principal Member of Technical Staff | +1.781.442.2037 >> >> Oracle Java Engineering >> 1 Network Drive >> Burlington, MA 01803 >> Lance.Andersen at oracle.com >> Sent from my iPad >> >> On Mar 31, 2015, at 4:15 AM, Frank Yuan > > wrote: >> >>> Hi Joe >>> >>> >>> >>> Do you have any comment for dom suite co-location? >>> >>> >>> >>> Best Regards >>> >>> Frank >>> >>> >>> >>> From: Frank Yuan [mailto:frank.yuan at oracle.com] >>> Sent: Wednesday, March 25, 2015 5:46 PM >>> To: 'huizhe wang'; 'Core-Libs-Dev' >>> Cc: 'jibing chen'; 'Gustavo Galimberti'; sandeep.konchady at oracle.com >>> ; >>> 'Alexandre (Shura) Iline' >>> Subject: RE: Review request for JDK-8051559: JAXP function dom tests >>> conversion >>> >>> >>> >>> Hi, Joe and All >>> >>> >>> >>> We are working on moving internal jaxp functional tests to open jdk >>> repo. >>> >>> This is the dom suite. Would you please review these test? Any >>> comment will >>> be appreciated. >>> >>> >>> >>> bug: https://bugs.openjdk.java.net/browse/JDK-8051559 >>> >>> webrev: http://cr.openjdk.java.net/~fyuan/8051559/webrev.00/ >>> >>> >>> >>> >>> Thanks, >>> >>> >>> >>> Frank >>> > > > > Lance > Andersen| Principal Member of Technical Staff | +1.781.442.2037 > Oracle Java Engineering > 1 Network Drive > Burlington, MA 01803 > Lance.Andersen at oracle.com > > > From thomas.stuefe at gmail.com Wed Apr 1 09:52:30 2015 From: thomas.stuefe at gmail.com (=?UTF-8?Q?Thomas_St=C3=BCfe?=) Date: Wed, 1 Apr 2015 11:52:30 +0200 Subject: RFR(xxs): 8074547: libjli, get_cpuid() implementation missing for MacOs, breaks libjli.so build in slowdebug In-Reply-To: References: Message-ID: Added core-libs-dev. Sorry for the crosspost. On Wed, Apr 1, 2015 at 10:35 AM, Thomas St?fe wrote: > Hi, > > please review this tiny change. It fixes a build error on MacOS when > building jdk without optimization. > > bug: https://bugs.openjdk.java.net/browse/JDK-8074547 > webrev: > http://cr.openjdk.java.net/~stuefe/webrevs/8074547/webrev.00/webrev/ > > Thank you! > > ..Thomas Stuefe > > From snazy at snazy.de Wed Apr 1 11:21:58 2015 From: snazy at snazy.de (Robert Stupp) Date: Wed, 1 Apr 2015 13:21:58 +0200 Subject: Copying in Java_java_net_SocketOutputStream_socketWrite0 Message-ID: <14A1A5CF-AAA2-4335-ADF3-E919CD60B67E@snazy.de> Hi, jdk/src/solaris/native/java/net/SocketOutputStream.c always copy data from the given byte[] to a temporary stack/heap buffer. Wouldn?t it be sufficient to just use a pointer into the byte[] and directly call NET_Send with that pointer? ? Robert Stupp @snazy From snazy at snazy.de Wed Apr 1 11:24:09 2015 From: snazy at snazy.de (Robert Stupp) Date: Wed, 1 Apr 2015 13:24:09 +0200 Subject: Copying in Java_java_net_SocketOutputStream_socketWrite0 In-Reply-To: <14A1A5CF-AAA2-4335-ADF3-E919CD60B67E@snazy.de> References: <14A1A5CF-AAA2-4335-ADF3-E919CD60B67E@snazy.de> Message-ID: Is it because of pausing GC otherwise? > Am 01.04.2015 um 13:21 schrieb Robert Stupp : > > Hi, > > jdk/src/solaris/native/java/net/SocketOutputStream.c always copy data from the given byte[] to a temporary stack/heap buffer. > Wouldn?t it be sufficient to just use a pointer into the byte[] and directly call NET_Send with that pointer? > > ? > Robert Stupp > @snazy > ? Robert Stupp @snazy From lance.andersen at oracle.com Wed Apr 1 11:46:22 2015 From: lance.andersen at oracle.com (Lance Andersen) Date: Wed, 1 Apr 2015 07:46:22 -0400 Subject: Review request for JDK-8051560: JAXP function astro tests conversion In-Reply-To: <032f01d06c69$25acec80$7106c580$@oracle.com> References: <033901d066de$f371f8d0$da55ea70$@oracle.com> <5514ABEB.9060501@oracle.com> <017b01d06872$72959330$57c0b990$@oracle.com> <551A02FB.5070805@oracle.com> <00ff01d06b60$bd5d86c0$38189440$@oracle.com> <032f01d06c69$25acec80$7106c580$@oracle.com> Message-ID: <09BC620C-C1C1-489C-9866-58E506CF8E7E@oracle.com> Hi Frank, On Apr 1, 2015, at 6:46 AM, Frank Yuan wrote: > Hi Lance > > Thank you for your comments! > > I have already added/updated the comments as your suggestion. I see them in the webrev below but were not in webrev.01 which is what I looked at yesterday > For USER_DIR, I am not sure if I understood your question, USER_DIR is a public member in JAXPTestUtilities, it's shared by all jaxp functional co-location tests, and assigned with System.getProperty("user.dir"), jtreg affords this property, but may be different dir under different mode. sorry if this was not clear. jtreg has a concept of a working directory, which I believe jtreg sets user.dir to. Because of that, there really is not a reason to have to specify user.dir again in your tests. jtreg makes sure that the working directory gets cleaned up after a test run Best Lance > > The new webrev is at: http://cr.openjdk.java.net/~fyuan/8051560/webrev.02/ > > Best Regards > Frank > > From: Lance Andersen [mailto:lance.andersen at oracle.com] > Sent: Tuesday, March 31, 2015 9:45 PM > To: Frank Yuan > Cc: 'huizhe wang'; 'Core-Libs-Dev'; 'Gustavo Galimberti' > Subject: Re: Review request for JDK-8051560: JAXP function astro tests conversion > > Hi Frank, > > Overall, its OK. > > A couple of suggestions but they should not prevent you from pushing your changes: > > I still think you should consider adding a basic comment to tests which are missing one such as in DocumentLSTest.java & NamespaceContextTest.java. > > In AstroTest.java, you probably do not need the USER.DIR field as jtreg and just reference the file/directory. > > Best > Lance > On Mar 30, 2015, at 11:14 PM, Frank Yuan wrote: > > > Hi Joe > > I am glad to explain your questions! > > For test number, the original AstroApp has 10 test, XPath API, SAX 2.0.1, Schema Validation, Namespace, DocumentLS and Astro Test mode 1~5, one test method is reported as one test case, so there are 39. Current astro test suite has 6 tests, besides the first 5, AstroTest includes mode1 ~5. So they are same in deed. There are totally 371 test, 365 are already in repo, the 6 are astro. And 70 of them are functional test, because functional and unit test use separate TEST.properties files, you see the functional number at last, the unit number is scrolled up on the screen. > > For test report, current process means original query, one original test mode connects one factories permutation. I also noticed it's not easy to identify the test mode/factories permutation, so I added "System.out.println(fFactClass.getName() +" : " + isFactClass.getName());" after I sent last webrev to you, you can check it now still at http://cr.openjdk.java.net/~fyuan/8051560/webrev.01/ > > I am not sure which is other insight you mentioned, would you like to explain more? > > Best Regareds > Frank > > From: huizhe wang [mailto:huizhe.wang at oracle.com] > Sent: Tuesday, March 31, 2015 10:14 AM > To: Frank Yuan > Cc: 'Lance Andersen'; 'Core-Libs-Dev'; 'Gustavo Galimberti' > Subject: Re: Review request for JDK-8051560: JAXP function astro tests conversion > > Hi Frank, > > Looks good. > > Since you've gone through the original test/the astro application, and refactored it into a TestNG test, you probably have other insight too. If so, it would be nice to add them as well. > > In terms of report, yes, I can see the output files displayed along with process id. Thanks for doing that. Not as good as the old test report, which lists test mode/query ids with status, but acceptable since it prints out the process and query ids that helps identifying the exact test. > > I have always wondered, but thought not so important, that in its current (TestNG) form, the test report will show test cases (thus fewer tests than the original test suite). For example, the AstroApp reports 10 tests and 39 test cases, while the new 5. Console display is quite different from the html report as well. For example, on the console, the test results are: passed: 70, but the html report shows 371 tests passed. What are your thoughts on this? > > Thanks, > Joe > > On 3/27/2015 2:43 AM, Frank Yuan wrote: > Hi Joe and Lance > > Thank you very much for your review! It's very good comment! > > According to your comments, I made the following changes: > 1. Rename the output file name to be easier understanding. > 2. Print the output file name to be easier debugging. > 3. Add comment for AstroProcessor class > 4. Add comment in AstroTest to describe the test, some are from astro application design document. > > Besides these new adding comments, there are many comments in astro classes(in libs/test/astro), which are from the original source files. And the current tests prints information to the standard out, which is redirected to .jtr file by jtreg, so there is not any other trace file now. USER_DIR is the scratch dir in deed, it is property user.dir in jtreg. The new webrev is at http://cr.openjdk.java.net/~fyuan/8051560/webrev.01/ > > Btw, I also sent out review request for JDK-8051559: JAXP function dom tests minutes later than this review request, I am afraid you may miss it, reminder here:) > > Best Regards > Frank > > From: huizhe wang [mailto:huizhe.wang at oracle.com] > Sent: Friday, March 27, 2015 9:02 AM > To: Lance Andersen > Cc: Frank Yuan; 'Core-Libs-Dev'; 'Gustavo Galimberti' > Subject: Re: Review request for JDK-8051560: JAXP function astro tests conversion > > I second Lance. The Main of the original astro had Javadocs and developer comments. Probably more important is that you've completely changed the main classes (TestDriver and Main), which looks good, however, the original classes contained a lot of information on what each test does and how it works that seem to have all been lost. > > The suite's README and build.xml may also contain information that is worth keeping. Some of them may be no longer valid, in which case, it may be helpful to describe the change. For example, the log files described in README were useful for debugging. It would be good to explain where to find the debug info in your new design. > > While scanning the test, I see that you are creating temporary output files under USER_DIR. Is that intended? JAXP processors do not necessarily open them with the DELETE_ON_CLOSE option. I thought in previous tests, you were creating them in the scratch directory. > > Thanks, > Joe > > On 3/26/2015 12:08 PM, Lance Andersen wrote: > Hi Frank, > > Overall these look fine. I would suggest adding a simple comment to describe the tests that do not have one to give a basic intent of the test to make it easier for someone to understand if they are new. > > Best > Lance > On Mar 25, 2015, at 5:34 AM, Frank Yuan wrote: > > > > > Hi, Joe and All > > > > We are working on moving internal jaxp functional tests to open jdk repo. > > This is the astro suite. Would you please review these test? Any comment > will be appreciated. > > > > bug: https://bugs.openjdk.java.net/browse/JDK-8051560 > > webrev: http://cr.openjdk.java.net/~fyuan/8051560/webrev.00/ > > > > AstroTest is the primary test in this suite, it transforms an xml file(which > includes astro data) with several xsl files, sets different filtering > condition by these xsl files and different filtering range, finally compares > the result with golden files. > > And there are 5 permutations of InputSourceFactory and FilterFactory(I uses > template method pattern for the variant FilterFactoryImpls), each > permutation will be applied to above transforming processes. > > > > Thanks, > > > > Frank > > > > > Lance Andersen| Principal Member of Technical Staff | +1.781.442.2037 > Oracle Java Engineering > 1 Network Drive > Burlington, MA 01803 > Lance.Andersen at oracle.com > > > > > > > > > > > Lance Andersen| Principal Member of Technical Staff | +1.781.442.2037 > Oracle Java Engineering > 1 Network Drive > Burlington, MA 01803 > Lance.Andersen at oracle.com > > > Lance Andersen| Principal Member of Technical Staff | +1.781.442.2037 Oracle Java Engineering 1 Network Drive Burlington, MA 01803 Lance.Andersen at oracle.com From Alan.Bateman at oracle.com Wed Apr 1 11:48:46 2015 From: Alan.Bateman at oracle.com (Alan Bateman) Date: Wed, 01 Apr 2015 12:48:46 +0100 Subject: Copying in Java_java_net_SocketOutputStream_socketWrite0 In-Reply-To: References: <14A1A5CF-AAA2-4335-ADF3-E919CD60B67E@snazy.de> Message-ID: <551BDB1E.8040305@oracle.com> On 01/04/2015 12:24, Robert Stupp wrote: > Is it because of pausing GC otherwise? > Yes, GC and also that a Socket write is a potentially blocking operation. Some VMs do have a way of pinning objects in the heap (beyond JNI critical sections) but it is not assumed here. If you do socket I/O with direct buffers then it doesn't need a temporary area of memory for the I/O. -Alan. From snazy at snazy.de Wed Apr 1 12:37:18 2015 From: snazy at snazy.de (Robert Stupp) Date: Wed, 1 Apr 2015 14:37:18 +0200 Subject: Copying in Java_java_net_SocketOutputStream_socketWrite0 In-Reply-To: <551BDB1E.8040305@oracle.com> References: <14A1A5CF-AAA2-4335-ADF3-E919CD60B67E@snazy.de> <551BDB1E.8040305@oracle.com> Message-ID: <64C615CD-ADB3-44AC-A6C9-73D211D6DD38@snazy.de> > Am 01.04.2015 um 13:48 schrieb Alan Bateman : > > On 01/04/2015 12:24, Robert Stupp wrote: >> Is it because of pausing GC otherwise? >> > Yes, GC and also that a Socket write is a potentially blocking operation. Some VMs do have a way of pinning objects in the heap (beyond JNI critical sections) but it is not assumed here. Just want to understand ?the magic? here (sure, NIO is the way to go)? Where?s the ?trick? to avoid GC pauses for socketWrite0 and similar methods? Is it something hard coded like ?if JNI method is from jdk source tree?? AFAIK there?s always a safe point w/ JNI calls. socketWrite0 is simply declared as ?JNIEXPORT void JNICALL Java_java_net_SocketOutputStream_socketWrite0? and I could not find anything in the source tree declaring ?socketWrite0? or ?SocketOutputStream? to be special (in jdk8u tree). ? Robert Stupp @snazy From Alan.Bateman at oracle.com Wed Apr 1 13:26:12 2015 From: Alan.Bateman at oracle.com (Alan Bateman) Date: Wed, 01 Apr 2015 14:26:12 +0100 Subject: Copying in Java_java_net_SocketOutputStream_socketWrite0 In-Reply-To: <64C615CD-ADB3-44AC-A6C9-73D211D6DD38@snazy.de> References: <14A1A5CF-AAA2-4335-ADF3-E919CD60B67E@snazy.de> <551BDB1E.8040305@oracle.com> <64C615CD-ADB3-44AC-A6C9-73D211D6DD38@snazy.de> Message-ID: <551BF1F4.2030709@oracle.com> On 01/04/2015 13:37, Robert Stupp wrote: > : > > Just want to understand ?the magic? here (sure, NIO is the way to go)? > > Where?s the ?trick? to avoid GC pauses for socketWrite0 and similar > methods? > Is it something hard coded like ?if JNI method is from jdk source tree?? > > AFAIK there?s always a safe point w/ JNI calls. socketWrite0 is simply > declared as ?JNIEXPORT void JNICALL > Java_java_net_SocketOutputStream_socketWrite0? and I could not find > anything in the source tree declaring ?socketWrite0? or > ?SocketOutputStream? to be special (in jdk8u tree). There isn't anything special here. In HotSpot then threads in JNI methods are considered to be a safepoint and so continue to execute even if the VM is brought to a safepoint, say for a stop-the-world GC. If the thread attempts to call back into VM or return from the native method then it will block until the safepoint completes. So nothing special for socketWrite0. -Alan. From kumar.x.srinivasan at oracle.com Wed Apr 1 13:31:29 2015 From: kumar.x.srinivasan at oracle.com (Kumar Srinivasan) Date: Wed, 01 Apr 2015 06:31:29 -0700 Subject: RFR(xxs): 8074547: libjli, get_cpuid() implementation missing for MacOs, breaks libjli.so build in slowdebug In-Reply-To: References: Message-ID: <551BF331.2000403@oracle.com> Hello Thomas, [removed jdk9-dev] My take is that, there is a makefile oversight lurking somewhere wrt. macosx, and is likely to be fixed by fix for 8074840, the review discussion is here: http://mail.openjdk.java.net/pipermail/core-libs-dev/2015-March/032614.html So for now lets put this particular issue in a holding pattern. Thanks Kumar > Added core-libs-dev. Sorry for the crosspost. > > On Wed, Apr 1, 2015 at 10:35 AM, Thomas St?fe > wrote: > >> Hi, >> >> please review this tiny change. It fixes a build error on MacOS when >> building jdk without optimization. >> >> bug: https://bugs.openjdk.java.net/browse/JDK-8074547 >> webrev: >> http://cr.openjdk.java.net/~stuefe/webrevs/8074547/webrev.00/webrev/ >> >> Thank you! >> >> ..Thomas Stuefe >> >> From thomas.stuefe at gmail.com Wed Apr 1 13:56:22 2015 From: thomas.stuefe at gmail.com (=?UTF-8?Q?Thomas_St=C3=BCfe?=) Date: Wed, 1 Apr 2015 15:56:22 +0200 Subject: RFR(xxs): 8074547: libjli, get_cpuid() implementation missing for MacOs, breaks libjli.so build in slowdebug In-Reply-To: <551BF331.2000403@oracle.com> References: <551BF331.2000403@oracle.com> Message-ID: Hi Kumar, ok, I'll wait. I see that Mikael did empty out ergo_i586.c for MacOsX completely, which seems ok to me. It would be nice to solve this soon as this is a constant error source for our MacOS slowdebug builds. Kind Regards, Thomas On Wed, Apr 1, 2015 at 3:31 PM, Kumar Srinivasan < kumar.x.srinivasan at oracle.com> wrote: > Hello Thomas, > > [removed jdk9-dev] > > My take is that, there is a makefile oversight lurking somewhere wrt. > macosx, and > is likely to be fixed by fix for 8074840, the review discussion is here: > http://mail.openjdk.java.net/pipermail/core-libs-dev/2015- > March/032614.html > > So for now lets put this particular issue in a holding pattern. > > Thanks > > Kumar > > > > Added core-libs-dev. Sorry for the crosspost. >> >> On Wed, Apr 1, 2015 at 10:35 AM, Thomas St?fe >> wrote: >> >> Hi, >>> >>> please review this tiny change. It fixes a build error on MacOS when >>> building jdk without optimization. >>> >>> bug: https://bugs.openjdk.java.net/browse/JDK-8074547 >>> webrev: >>> http://cr.openjdk.java.net/~stuefe/webrevs/8074547/webrev.00/webrev/ >>> >>> Thank you! >>> >>> ..Thomas Stuefe >>> >>> >>> > From pbenedict at apache.org Wed Apr 1 15:47:46 2015 From: pbenedict at apache.org (Paul Benedict) Date: Wed, 1 Apr 2015 10:47:46 -0500 Subject: Javadoc new tags not yet documented Message-ID: The JDK 8 documentation did not include any documentation on the new tags (e.g., @apiNote, @implSpec and @implNote). It's neither here [1] nor there [2], but they should be. Can anyone look into this for 9 (or even fix 8)? The absence of documentation is probably why they haven't seen widespread adoption yet. [1] http://docs.oracle.com/javase/8/docs/technotes/guides/javadoc/whatsnew-8.html [2] http://docs.oracle.com/javase/8/docs/technotes/tools/windows/javadoc.html Cheers, Paul From Alan.Bateman at oracle.com Wed Apr 1 15:59:05 2015 From: Alan.Bateman at oracle.com (Alan Bateman) Date: Wed, 01 Apr 2015 16:59:05 +0100 Subject: Javadoc new tags not yet documented In-Reply-To: References: Message-ID: <551C15C9.8040808@oracle.com> On 01/04/2015 16:47, Paul Benedict wrote: > The JDK 8 documentation did not include any documentation on the new tags > (e.g., @apiNote, @implSpec and @implNote). It's neither here [1] nor there > [2], but they should be. > > Can anyone look into this for 9 (or even fix 8)? The absence of > documentation is probably why they haven't seen widespread adoption yet. > There is an informational JEP prepared for this, see: http://openjdk.java.net/jeps/8068562 -Alan. From mikael.vidstedt at oracle.com Wed Apr 1 17:22:44 2015 From: mikael.vidstedt at oracle.com (Mikael Vidstedt) Date: Wed, 01 Apr 2015 10:22:44 -0700 Subject: [9] RFR 8074840: Resolve disabled warnings for libjli and libjli_static In-Reply-To: <5518CBFB.4020706@oracle.com> References: <550C60CC.1080208@oracle.com> <5518CBFB.4020706@oracle.com> Message-ID: <551C2964.90506@oracle.com> New webrev available here: http://cr.openjdk.java.net/~mikael/webrevs/8074840/webrev.02/webrev/ Changes include: * Excluded ergo_i586.c in the makefile on macosx instead of using ifdef-style exclusion * Updated to fix a newly introduced (currently silenced) warning in parse_manifest.c:readAt(), introduced by the change [1] for JDK-8073158 [2] The change to have readAt take an unsigned int is not exactly pretty, so I'm again taking suggestions on alternative solutions. The underlying reason for making that change is again because read on Windows uses an unsigned int for count instead of the more common size_t. I played around with several different ways of working around this (I even introduced a JLI_Read at some point) but after chatting with mr. Holmes I decided to cut back on the changes and instead just change the prototype of readAt to also take an unsigned int in the spirit of "common denominator". All the current uses of readAt() can AFAICT tolerate this, and if they don't the problem is already there on windows. Happy to hear your thoughts though. Also, some comments below. On 2015-03-29 21:07, David Holmes wrote: > Hi Mikael, > > On 21/03/2015 4:02 AM, Mikael Vidstedt wrote: >> >> Please review the following change which fixes a number of native >> compilation warnings in files related to libjli. >> >> Bug: https://bugs.openjdk.java.net/browse/JDK-8074840 >> Webrev: >> http://cr.openjdk.java.net/~mikael/webrevs/8074840/webrev.01/webrev/ > > Mostly looks okay, but I find some of these odd. For example: > > src/java.base/share/native/libjli/java.c > > if (threadStackSize < STACK_SIZE_MINIMUM) > > becomes: > > if (threadStackSize < (jlong)STACK_SIZE_MINIMUM) { > > but integer promotion would make that cast implicitly. And why should > the comparison cause a warning when the subsequent assignment does > not? What was the actual warning and on what compiler? Real warning - gcc on linux among others: jdk/src/java.base/share/native/libjli/java.c:792:33: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] if (threadStackSize < STACK_SIZE_MINIMUM) { ^ As you can see the warning is generated because of the unsigned vs signed-ness in combination with a compare; the assignment does not generate a corresponding warning. The unsigned type comes from the fact that STACK_SIZE_MINIMUM which is based on the KB macro which in turn is an unsigned long (UL) constant. One alternative would of course be to cast the (macro) definition of STACK_SIZE_MINIMUM instead, or not use KB to start with, but I'm not sure that's any better than having the cast here. I really don't have a strong opinion though. > > --- > > I second Kumar's query about the ergo_i586.c changes. Seems to me that > if this is causing a problem on non Solaris/Linux then the problem is > in the makefile (jdk/lib/CoreLibraries.gmk) because this file should > be being excluded on platforms it is not used. Indeed - fixed! > > --- > > src/java.base/windows/native/libjli/cmdtoargs.c > > Surely charLength should be a ptrdiff_t ? Well aren't we picky? Fixed :) > > --- > > src/java.base/windows/native/libjli/java_md.c > > Aside: I find it quite bizarre that the vsnprintf family of methods > take a size_t as the count but return an int, when on success it has > to return the number of characters written! Fully agree. Maybe _today_ is a good day to change the return type of all printf functions? ;) Cheers, Mikael [1] http://hg.openjdk.java.net/jdk9/dev/jdk/rev/cb94a46ab47b [2] https://bugs.openjdk.java.net/browse/JDK-8073158 > > --- > > Thanks, > David > > >> I built the code across all the OracleJDK platforms and there were no >> warnings on any of the platforms (in the files related to this change). >> I'm taking suggestions on specific tests to run. >> >> Some specifics: >> >> Unfortunately there is no intrinsic for cpuid in Solaris Studio, so I >> had to keep the inline asm code and the corresponding flag to disable >> the related warning (E_ASM_DISABLES_OPTIMIZATION). The alternative would >> be to move it out into a dedicated assembly file, but that seems like >> more trouble than it's worth given that the warning is harmless. >> >> I'm not entirely happy with the unsigned cast in parse_manifest.c:196, >> but unfortunately the windows prototype for read() takes an unsigned as >> its last argument, where All(tm) other platforms take a size_t. In this >> specific case 'len' will never be be more than END_MAXLEN = 0xFFFF + >> ENDHDR = 0xFFFF + 22 = 0x10015, meaning it will comfortably fit in an >> unsigned on the platforms we support. But if somebody has suggestions >> I'm all ears, doing the #ifdef dance is of course also an option. >> >> Note that the warnings were temporarily disabled as part of JDK-8074096 >> [1] until such time they could be fixed the proper way. Also note that >> this change supersedes the earlier change [2] Dmitry had out for review. >> The bug [3] corresponding to that webrev will be closed as a duplicate >> of this bug (JDK-8074839). >> >> Cheers, >> Mikael >> >> [1] https://bugs.openjdk.java.net/browse/JDK-8074096 >> [2] http://cr.openjdk.java.net/~dsamersoff/JDK-8073175/webrev.01/ >> [3] https://bugs.openjdk.java.net/browse/JDK-8073175 >> From kasperni at gmail.com Wed Apr 1 17:34:47 2015 From: kasperni at gmail.com (Kasper Nielsen) Date: Wed, 1 Apr 2015 19:34:47 +0200 Subject: JEP 110 HTTP 2 client API In-Reply-To: <551ACBFA.7040304@oracle.com> References: <551ACBFA.7040304@oracle.com> Message-ID: Looks really clean and simple. Some minor issues. 1) Would it possible to add a connect timeout parameter. builder.setConnectTimeout(long timeout, TimeUnit unit) For some reason it was left out of the javax.websocket API. And working around it is a serious PITA. 2) Rename Websocket to WebsocketClient to avoid people thinking you can use it server side? 3) How is the threading done for something like asynchronous connect? 4) I find the use of byte[] vs ByteBuffer a bit inconsistent. For example, HttpResponseBodyProcessor uses ByteBuffer while WebSocketMessage uses byte[] - Kasper On Tue, Mar 31, 2015 at 6:31 PM, Michael McMahon < michael.x.mcmahon at oracle.com> wrote: > Hi, > > [this has already been posted to net-dev] > > JEP 110 HTTP 2 client > > in JDK 9, is defining and implementing a new API for HTTP which also > supports > the new HTTP version 2 that has recently been working its way through the > IETF. > The work also includes support for websockets (RFC 6455). > > In fact, the majority of the API is agnostic about the HTTP protocol > version, with only minor > configuration settings, and support for multiple responses (Http server > push) having any direct impact. > > The HTTP API is defined around three main types (HttpClient, which is the > central > point for configuration of SSL, executor service cookie management etc), > HttpRequest > and HttpResponse (which should be self explanatory). > > Requests are sent/received either synchronously (blocking) or in a > non-blocking (asynchronous) > mode using java.util.future.CompletableFuture. > > The API docs can be seen at the link below: > > http://cr.openjdk.java.net/~michaelm/httpclient/01/ > > All new classes and interfaces belong to the java.net package. > > A prototype implementation of this API supporting HTTP/1.1, is available > in the JDK 9 sandbox forest in JEP-110-branch. > > Comments welcome! > > Thanks, > Michael. > From peter.levart at gmail.com Wed Apr 1 18:54:26 2015 From: peter.levart at gmail.com (Peter Levart) Date: Wed, 01 Apr 2015 20:54:26 +0200 Subject: RFR: 8061950: Class.getMethods() exhibits quadratic time complexity In-Reply-To: References: <900D2AE3-B3A6-4B1B-B25A-C564B10334AA@oracle.com> <54492255.3040108@gmail.com> <544D58D4.7020909@gmail.com> <544D7B74.5060607@gmail.com> <5450CEE9.7060707@gmail.com> <545120D2.5010301@gmail.com> <54526D10.5060101@gmail.com> <54551D2F.407@gmail.com> <545A572D.3050608@gmail.com> <547B90A0.1080508@gmail.com> <547CE713.2020905@gmail.com> <5517E5B5.5000308@gmail.com> Message-ID: <551C3EE2.8030408@gmail.com> On 03/31/2015 03:35 AM, Martin Buchholz wrote: > Thanks, Peter. > > I've started making my way through these changes. > It's too bad there's so much complexity here, but I can't come up with > a simpler solution either. > So we will probably submit something based on your latest webrev. > I've collected minor changes into an mq patch to be applied on top of > yours. > > http://cr.openjdk.java.net/~martin/Class.getMethods > > > - need @library > - it's => its > - remove end tags > - Remove => Removes > > Should we switch to using testng? I think yes. Hi Martin, For start I incorporated your javadoc changes. Here's new webrev containing them: http://cr.openjdk.java.net/~plevart/jdk9-dev/Class.getMethods/webrev.09/ I noticed the bug I have discovered a couple of months ago when preparing this patch, has recently received priority P2: https://bugs.openjdk.java.net/browse/JDK-8062389 I think I know how to fix that on top of this patch. But perhaps this should be performed afterwards as a separate change. Currently this patch retains the status-quo. Regards, Peter > > More review later. > > > On Sun, Mar 29, 2015 at 4:44 AM, Peter Levart > wrote: > > Hi, > > I'd like to resurrect a patch I did a couple of months ago. Here's > a rebased webrev (no changes from webrev.07): > > http://cr.openjdk.java.net/~plevart/jdk9-dev/Class.getMethods/webrev.08/ > > > > Regards, Peter > > > > On 03/23/2015 11:42 PM, Martin Buchholz wrote: >> So Peter, ... time to rebase one of your getMethods patches? >> >> On Mon, Dec 1, 2014 at 2:09 PM, Peter Levart >> > wrote: >> >> >> On 12/01/2014 09:09 PM, Martin Buchholz wrote: >>> Looking at Peter's work here is still on my long TODO list, but I was >>> hoping first to get in my concurrency correctness fixes for core >>> reflection, which conflicts slightly... >> >> No problem. I can rebase the patch after your fixes are in. >> >> Regards, Peter >> >> >>> On Sun, Nov 30, 2014 at 1:48 PM, Peter Levart wrote: >>>> Hi Joel, >>>> >>>> I managed to find some time to create some tests for this patch: >>>> >>>> http://cr.openjdk.java.net/~plevart/jdk9-dev/Class.getMethods/webrev.07/ >>>> >>>> Both MethodTable and HashArray unit tests are provided. I had to create a >>>> special TestProxy to access package-private classes from the tests. >>>> >>>> There are no changes to j.l.Class or j.l.r.Method from webrev.06 (I just >>>> re-based them to current tip). >>>> >>>> I also included the patch to StarInheritance test that I forgot to include >>>> in webrev.06. >>>> >>>> Comments inline... >>>> >>>> On 11/13/2014 10:39 AM, Joel Borggr?n-Franck wrote: >>>>> Hi Peter, >>>>> >>>>> As always, thanks for taking a look at this, >>>>> >>>>> This is quite big so in order to make this more approachable perhaps you >>>>> can split the patch up into a series? If you start with creating the >>>>> MethodTable interface, adding tests for how the interface should behave and >>>>> refactored the current MethodArray into implementing that interface while >>>>> also changing the lookup logic that would be easier to review. >>>> Well, there's not much to refactor in MethodArray when implementing >>>> MethodTable. They are two entirely different APIs with entirely different >>>> implementations. >>>> >>>>> Then you could add different implementations of MethodTable (with >>>>> additional unit tests) as follow up patches. >>>> You can view the MethodTable.SimpleArrayImpl as the basic implementation of >>>> the MethodTable API and a replacement for MethodArray. >>>> MethodTable.HashArrayImpl is the alternative implementation for bigger >>>> sizes. The same unit tests are executed against both implementations. >>>> >>>>> I am a bit concerned about the size and scope of the implementations. In >>>>> general I would prefer if you targeted these to the precise need of core >>>>> reflection today. If you want to expand these to general purpose data >>>>> structures (even internal ones) I think that is a larger effort. >>>> I stripped HashArray and only left those methods that are needed to >>>> implement MethodTable API and execute the tests. >>>> >>>>> In general I think the changes to Class are sound, but there is a slight >>>>> change in the default method pruning. The call to removeLessSpecifics was >>>>> deliberately placed at the end, so that all default methods would be present >>>>> (the algorithm is sensitive to the order of pair vise comparisons). Since we >>>>> add methods in a deterministic order, I think consolidate() as you go should >>>>> result in the same set of methods, but I haven?t 100% convinced myself of >>>>> this just yet. >>>> I think it results in the same methods. I haven't yet found an example where >>>> it would result in different set of methods. All JDK classes return same >>>> methods with current implementation as with patched one. >>>> >>>>> Have you double checked that all methods returning root Method/Ctors are >>>>> private? >>>> I checked all usages of private methods that I have changed and are now >>>> returning root objects and made sure those are copied before being exposed >>>> to the outside or being modified. >>>> >>>> Regards, Peter >>>> >>>> >>>>> On 5 nov 2014, at 17:58, Peter Levart wrote: >>>>> >>>>>> Here's new webrev: >>>>>> >>>>>> http://cr.openjdk.java.net/~plevart/jdk9-dev/Class.getMethods/webrev.06/ >>>>>> >>>>>> >>>>>> The optimizations made from webrev.05 are: >>>>>> >>>>>> - getMethod() skips construction of MethodTable if there are no >>>>>> (super)interfaces. >>>>>> - getMethods() returns just declared public methods if there are no >>>>>> superclass and no (super)interfaces. >>>>>> - comparing method parameter types is optimized by adding two methods to >>>>>> Method/LangReflectAccess/ReflectionFactory. >>>>>> >>>>>> New MethodTable implementation based on a linear-probe hash table is a >>>>>> space/garbage improvement. I took IdentityHashMap, removed unneeded stuff >>>>>> and modified it's API. The result is a HashArray. It's API is similar in >>>>>> function and form to java.util.Map, but doesn't use separate keys and >>>>>> values. An element of HashArray is a key and a value at the same time. >>>>>> Elements are always non-null, so the method return values are unambiguous. >>>>>> As HashArray is a linear-probe hash table and there are no Map.Entry objects >>>>>> involved, the underlying data structure is very simple and memory efficient. >>>>>> It is just a sparse array of elements with length that is always a power of >>>>>> two and larger than 3 * size / 2. It also features overriddable element >>>>>> equals/hashCode methods. I made it a separate generic class because I think >>>>>> it can find it's usage elsewhere (for example as a cannonicalizing cache). >>>>>> >>>>>> Since HashArray based MethodTable is more space-efficient I moved the >>>>>> line between simple array based and HashArray based MethodTable down to 20 >>>>>> elements to minimize the worst-case scenario effect. Calling getMethods() on >>>>>> all rt.jar classes now constructs about 3/4 simple array based and 1/4 >>>>>> HashArray based MethodTables. >>>>>> >>>>> HashArray.java: >>>>> >>>>> I was hoping for a decent set of unit tests for the new HashArray data >>>>> structure. I think it is reasonable to test the corner cases/non-trivial >>>>> areas of the table (closeDeletion(), rezise() etc). Perhaps also run these >>>>> over the simple implementation. Also, please document thread safety (there >>>>> is none IFAICT it should just be noted). >>>>> >>>>> Instead of using inheritance to change the behavior of equals() and hash() >>>>> you could give it two lambdas at table creation time, a ToIntFunction for >>>>> hash() and a BiPredicate for equals(). Might not give you the >>>>> performance we need though. >>>>> >>>>> Note that the file doesn?t actually compile in jdk9/dev, you have two >>>>> unchecked casts and we build with -Werror. >>>>> >>>>> MethodTable.java >>>>> >>>>> HashMapImpl is missing serialVersionUID, but it looks like this class >>>>> won?t be needed at all. >>>>> >>>>> >>>>>> Here's also Martin's ManyMethodsBenchmark: >>>>>> >>>>>> Original: >>>>>> >>>>>> Base class load time: 129.95 ms >>>>>> getDeclaredMethods: 65521 methods, 36.58 ms total time, 0.0006 ms per >>>>>> method >>>>>> getMethods : 65530 methods, 47.43 ms total time, 0.0007 ms per >>>>>> method >>>>>> Derived class load time: 32216.09 ms >>>>>> getDeclaredMethods: 65521 methods, 35.05 ms total time, 0.0005 ms per >>>>>> method >>>>>> getMethods : 65530 methods, 8068.66 ms total time, 0.1231 ms per >>>>>> method >>>>>> >>>>>> >>>>>> Patched (using HashArray based MethodTable): >>>>>> >>>>>> Base class load time: 126.00 ms >>>>>> getDeclaredMethods: 65521 methods, 36.83 ms total time, 0.0006 ms per >>>>>> method >>>>>> getMethods : 65530 methods, 45.08 ms total time, 0.0007 ms per >>>>>> method >>>>>> Derived class load time: 31865.27 ms >>>>>> getDeclaredMethods: 65521 methods, 35.01 ms total time, 0.0005 ms per >>>>>> method >>>>>> getMethods : 65530 methods, 78.05 ms total time, 0.0012 ms per >>>>>> method >>>>>> >>>>>> >>>>>> All 86 jtreg test in java.lang/Class/ and java/lang/reflect/ still pass. >>>>>> >>>>> I have seen discussion about allocation, should we measure and compare? >>>>> You can probably use the Hotspot impl of ThreadMXBean to get the allocation >>>>> in the tread. >>>>> >>>>> Also, it might be time to fix the boolean parameters: >>>>> >>>>> 2741 Method[] declaredMethods = privateGetDeclaredMethods(true); >>>>> 2742 Class superclass = getSuperclass(); >>>>> 2743 Class[] interfaces = getInterfaces(false); >>>>> >>>>> Perhaps just add boolean constants somewhere so that it is easier to >>>>> decode. >>>>> >>>>> 2741 Method[] declaredMethods = >>>>> privateGetDeclaredMethods(PUBLIC_METHOD_ONLY); >>>>> 2742 Class superclass = getSuperclass(); >>>>> 2743 Class[] interfaces = getInterfaces(NO_COPY_RESULT); >>>>> >>>>> or so. >>>>> >>>>> HashArray.java: >>>>> >>>>> 155 if (lookupObj == null) throw new NullPointerException(); >>>>> >>>>> use Objects.requreNonNull() ? >>>>> >>>>> cheers >>>>> /Joel >>>>> >> >> > > From nadeesh.tv at oracle.com Wed Apr 1 19:50:44 2015 From: nadeesh.tv at oracle.com (nadeesh tv) Date: Thu, 02 Apr 2015 01:20:44 +0530 Subject: Code review request for JDK-8076441: Remove dead code in java.time.chrono.Chronology.isLeapYear Message-ID: <551C4C14.30505@oracle.com> Hi all, Please review this minor change which remove a dead code in isLeapYear(long prolepticYear) method of java/time/chrono/HijrahChronology.java. Bug: https://bugs.openjdk.java.net/browse/JDK-8076441 Webrev: http://cr.openjdk.java.net/~rriggs/hadeesh-tv-8076441/ -- Thanks and Regards, Nadeesh TV From vladimir.x.ivanov at oracle.com Wed Apr 1 20:56:50 2015 From: vladimir.x.ivanov at oracle.com (Vladimir Ivanov) Date: Wed, 01 Apr 2015 23:56:50 +0300 Subject: [9] RFR (M): 8057967: CallSite dependency tracking scales devastatingly poorly Message-ID: <551C5B92.8060500@oracle.com> http://cr.openjdk.java.net/~vlivanov/8057967/webrev.00/hotspot/ http://cr.openjdk.java.net/~vlivanov/8057967/webrev.00/jdk/ https://bugs.openjdk.java.net/browse/JDK-8057967 HotSpot JITs inline very aggressively through CallSites. The optimistically treat CallSite target as constant, but record a nmethod dependency to invalidate the compiled code once CallSite target changes. Right now, such dependencies have call site class as a context. This context is too coarse and it leads to context pollution: if some CallSite target changes, VM needs to enumerate all nmethods which depends on call sites of such type. As performance analysis in the bug report shows, it can sum to significant amount of work. While working on the fix, I investigated 3 approaches: (1) unique context per call site (2) use CallSite target class (3) use a class the CallSite instance is linked to Considering call sites are ubiquitous (e.g. 10,000s on some octane benchmarks), loading a dedicated class for every call site is an overkill (even VM anonymous). CallSite target class (MethodHandle.form->LambdaForm.vmentry->MemberName.clazz->Class) is also not satisfactory, since it is a compiled LambdaForm VM anonymous class, which is heavily shared. It gets context pollution down, but still the overhead is quite high. So, I decided to focus on (3) and ended up with a mixture of (2) & (3). Comparing to other options, the complications of (3) are: - CallSite can stay unlinked (e.g. CallSite.dynamicInvoker()), so there should be some default context VM can use - CallSite instances can be shared and it shouldn't keep the context class from unloading; It motivated a scheme where CallSite context is initialized lazily and can change during lifetime. When CallSite is linked with an indy instruction, it's context is initialized. Usually, JIT sees CallSite instances with initialized context (since it reaches them through indy), but if it's not the case and there's no context yet, JIT sets it to "default context", which means "use target call site". I introduced CallSite$DependencyContext, which represents a nmethod dependency context and points (indirectly) to a Class used as a context. Context class is referenced through a phantom reference (sun.misc.Cleaner to simplify cleanup). Though it's impossible to extract referent using Reference.get(), VM can access it directly by reading corresponding field. Unlike other types of references, phantom references aren't cleared automatically. It allows VM to access context class until cleanup is performed. And cleanup resets the context to NULL, in addition to invalidating all relevant dependencies. There are 3 context states a CallSite instance can be in: (1) NULL: no depedencies (2) DependencyContext.DEFAULT_CONTEXT: dependencies are stored in call site target class (3) DependencyContext for some class: dependencies are stored on the class DependencyContext instance points to Every CallSite starts w/o a context (1) and then lazily gets one ((2) or (3) depending on the situation). State transitions: (1->3): When a CallSite w/o a context (1) is linked with some indy call site, it's owner is recorded as a context (3). (1->2): When JIT needs to record a dependency on a target of a CallSite w/o a context(1), it sets the context to DEFAULT_CONTEXT and uses target class to store the dependency. (3->1): When context class becomes unreachable, a cleanup hook invalidates all dependencies on that CallSite and resets the context to NULL (1). Only (3->1) requires dependency invalidation, because there are no depedencies in (1) and (2->1) isn't performed. (1->3) is done in Java code (CallSite.initContext) and (1->2) is performed in VM (ciCallSite::get_context()). The updates are performed by CAS, so there's no need in additional synchronization. Other operations on VM side are volatile (to play well with Java code) and performed with Compile_lock held (to avoid races between VM operations). Some statistics: Box2D, latest jdk9-dev - CallSite instances: ~22000 - invalidated nmethods due to CallSite target changes: ~60 - checked call_site_target_value dependencies: - before the fix: ~1,600,000 - after the fix: ~600 Testing: - dedicated test which excercises different state transitions - jdk/java/lang/invoke, hotspot/test/compiler/jsr292, nashorn Thanks! Best regards, Vladimir Ivanov From kumar.x.srinivasan at oracle.com Wed Apr 1 21:53:51 2015 From: kumar.x.srinivasan at oracle.com (Kumar Srinivasan) Date: Wed, 01 Apr 2015 14:53:51 -0700 Subject: [9] RFR 8074840: Resolve disabled warnings for libjli and libjli_static In-Reply-To: <551C2964.90506@oracle.com> References: <550C60CC.1080208@oracle.com> <5518CBFB.4020706@oracle.com> <551C2964.90506@oracle.com> Message-ID: <551C68EF.7060504@oracle.com> CoreLibraries.gmk: glad you caught the ergo_i586.c. That should also address: JDK-8074547 Looks good and Thanks! Kumar On 4/1/2015 10:22 AM, Mikael Vidstedt wrote: > > New webrev available here: > > http://cr.openjdk.java.net/~mikael/webrevs/8074840/webrev.02/webrev/ > > Changes include: > > * Excluded ergo_i586.c in the makefile on macosx instead of using > ifdef-style exclusion > * Updated to fix a newly introduced (currently silenced) warning in > parse_manifest.c:readAt(), introduced by the change [1] for > JDK-8073158 [2] > > The change to have readAt take an unsigned int is not exactly pretty, > so I'm again taking suggestions on alternative solutions. The > underlying reason for making that change is again because read on > Windows uses an unsigned int for count instead of the more common > size_t. I played around with several different ways of working around > this (I even introduced a JLI_Read at some point) but after chatting > with mr. Holmes I decided to cut back on the changes and instead just > change the prototype of readAt to also take an unsigned int in the > spirit of "common denominator". All the current uses of readAt() can > AFAICT tolerate this, and if they don't the problem is already there > on windows. Happy to hear your thoughts though. > > Also, some comments below. > > On 2015-03-29 21:07, David Holmes wrote: >> Hi Mikael, >> >> On 21/03/2015 4:02 AM, Mikael Vidstedt wrote: >>> >>> Please review the following change which fixes a number of native >>> compilation warnings in files related to libjli. >>> >>> Bug: https://bugs.openjdk.java.net/browse/JDK-8074840 >>> Webrev: >>> http://cr.openjdk.java.net/~mikael/webrevs/8074840/webrev.01/webrev/ >> >> Mostly looks okay, but I find some of these odd. For example: >> >> src/java.base/share/native/libjli/java.c >> >> if (threadStackSize < STACK_SIZE_MINIMUM) >> >> becomes: >> >> if (threadStackSize < (jlong)STACK_SIZE_MINIMUM) { >> >> but integer promotion would make that cast implicitly. And why should >> the comparison cause a warning when the subsequent assignment does >> not? What was the actual warning and on what compiler? > > Real warning - gcc on linux among others: > > jdk/src/java.base/share/native/libjli/java.c:792:33: warning: > comparison between signed and unsigned integer expressions > [-Wsign-compare] > if (threadStackSize < STACK_SIZE_MINIMUM) { > ^ > > As you can see the warning is generated because of the unsigned vs > signed-ness in combination with a compare; the assignment does not > generate a corresponding warning. The unsigned type comes from the > fact that STACK_SIZE_MINIMUM which is based on the KB macro which in > turn is an unsigned long (UL) constant. One alternative would of > course be to cast the (macro) definition of STACK_SIZE_MINIMUM > instead, or not use KB to start with, but I'm not sure that's any > better than having the cast here. I really don't have a strong opinion > though. > >> >> --- >> >> I second Kumar's query about the ergo_i586.c changes. Seems to me >> that if this is causing a problem on non Solaris/Linux then the >> problem is in the makefile (jdk/lib/CoreLibraries.gmk) because this >> file should be being excluded on platforms it is not used. > > Indeed - fixed! > >> >> --- >> >> src/java.base/windows/native/libjli/cmdtoargs.c >> >> Surely charLength should be a ptrdiff_t ? > > Well aren't we picky? Fixed :) > >> >> --- >> >> src/java.base/windows/native/libjli/java_md.c >> >> Aside: I find it quite bizarre that the vsnprintf family of methods >> take a size_t as the count but return an int, when on success it has >> to return the number of characters written! > > Fully agree. Maybe _today_ is a good day to change the return type of > all printf functions? ;) > > Cheers, > Mikael > > [1] http://hg.openjdk.java.net/jdk9/dev/jdk/rev/cb94a46ab47b > [2] https://bugs.openjdk.java.net/browse/JDK-8073158 > > >> >> --- >> >> Thanks, >> David >> >> >>> I built the code across all the OracleJDK platforms and there were no >>> warnings on any of the platforms (in the files related to this change). >>> I'm taking suggestions on specific tests to run. >>> >>> Some specifics: >>> >>> Unfortunately there is no intrinsic for cpuid in Solaris Studio, so I >>> had to keep the inline asm code and the corresponding flag to disable >>> the related warning (E_ASM_DISABLES_OPTIMIZATION). The alternative >>> would >>> be to move it out into a dedicated assembly file, but that seems like >>> more trouble than it's worth given that the warning is harmless. >>> >>> I'm not entirely happy with the unsigned cast in parse_manifest.c:196, >>> but unfortunately the windows prototype for read() takes an unsigned as >>> its last argument, where All(tm) other platforms take a size_t. In this >>> specific case 'len' will never be be more than END_MAXLEN = 0xFFFF + >>> ENDHDR = 0xFFFF + 22 = 0x10015, meaning it will comfortably fit in an >>> unsigned on the platforms we support. But if somebody has suggestions >>> I'm all ears, doing the #ifdef dance is of course also an option. >>> >>> Note that the warnings were temporarily disabled as part of JDK-8074096 >>> [1] until such time they could be fixed the proper way. Also note that >>> this change supersedes the earlier change [2] Dmitry had out for >>> review. >>> The bug [3] corresponding to that webrev will be closed as a duplicate >>> of this bug (JDK-8074839). >>> >>> Cheers, >>> Mikael >>> >>> [1] https://bugs.openjdk.java.net/browse/JDK-8074096 >>> [2] http://cr.openjdk.java.net/~dsamersoff/JDK-8073175/webrev.01/ >>> [3] https://bugs.openjdk.java.net/browse/JDK-8073175 >>> > > > From david.holmes at oracle.com Wed Apr 1 23:17:47 2015 From: david.holmes at oracle.com (David Holmes) Date: Thu, 02 Apr 2015 09:17:47 +1000 Subject: [9] RFR 8074840: Resolve disabled warnings for libjli and libjli_static In-Reply-To: <551C2964.90506@oracle.com> References: <550C60CC.1080208@oracle.com> <5518CBFB.4020706@oracle.com> <551C2964.90506@oracle.com> Message-ID: <551C7C9B.8070302@oracle.com> On 2/04/2015 3:22 AM, Mikael Vidstedt wrote: > > New webrev available here: > > http://cr.openjdk.java.net/~mikael/webrevs/8074840/webrev.02/webrev/ > > Changes include: > > * Excluded ergo_i586.c in the makefile on macosx instead of using > ifdef-style exclusion Good. > * Updated to fix a newly introduced (currently silenced) warning in > parse_manifest.c:readAt(), introduced by the change [1] for JDK-8073158 [2] > > The change to have readAt take an unsigned int is not exactly pretty, so > I'm again taking suggestions on alternative solutions. The underlying > reason for making that change is again because read on Windows uses an > unsigned int for count instead of the more common size_t. I played > around with several different ways of working around this (I even > introduced a JLI_Read at some point) but after chatting with mr. Holmes > I decided to cut back on the changes and instead just change the > prototype of readAt to also take an unsigned int in the spirit of > "common denominator". All the current uses of readAt() can AFAICT > tolerate this, and if they don't the problem is already there on > windows. Happy to hear your thoughts though. I think what you have is the simplest correct fix. There is still size confusion in parse_manifest with the jlong use of len/flen. It would probably be clearer to make len uint as it is constrained to a small value due to END_MAXLEN and ENDRD, but that would likely introduce more casts. Maybe a comment (or assert?) that len always fits in uint? Otherwise all good. > > Also, some comments below. I missed the fact that KB introduces unsignedness (is that a word? ;-) ) Thanks, David > On 2015-03-29 21:07, David Holmes wrote: >> Hi Mikael, >> >> On 21/03/2015 4:02 AM, Mikael Vidstedt wrote: >>> >>> Please review the following change which fixes a number of native >>> compilation warnings in files related to libjli. >>> >>> Bug: https://bugs.openjdk.java.net/browse/JDK-8074840 >>> Webrev: >>> http://cr.openjdk.java.net/~mikael/webrevs/8074840/webrev.01/webrev/ >> >> Mostly looks okay, but I find some of these odd. For example: >> >> src/java.base/share/native/libjli/java.c >> >> if (threadStackSize < STACK_SIZE_MINIMUM) >> >> becomes: >> >> if (threadStackSize < (jlong)STACK_SIZE_MINIMUM) { >> >> but integer promotion would make that cast implicitly. And why should >> the comparison cause a warning when the subsequent assignment does >> not? What was the actual warning and on what compiler? > > Real warning - gcc on linux among others: > > jdk/src/java.base/share/native/libjli/java.c:792:33: warning: comparison > between signed and unsigned integer expressions [-Wsign-compare] > if (threadStackSize < STACK_SIZE_MINIMUM) { > ^ > > As you can see the warning is generated because of the unsigned vs > signed-ness in combination with a compare; the assignment does not > generate a corresponding warning. The unsigned type comes from the fact > that STACK_SIZE_MINIMUM which is based on the KB macro which in turn is > an unsigned long (UL) constant. One alternative would of course be to > cast the (macro) definition of STACK_SIZE_MINIMUM instead, or not use KB > to start with, but I'm not sure that's any better than having the cast > here. I really don't have a strong opinion though. > >> >> --- >> >> I second Kumar's query about the ergo_i586.c changes. Seems to me that >> if this is causing a problem on non Solaris/Linux then the problem is >> in the makefile (jdk/lib/CoreLibraries.gmk) because this file should >> be being excluded on platforms it is not used. > > Indeed - fixed! > >> >> --- >> >> src/java.base/windows/native/libjli/cmdtoargs.c >> >> Surely charLength should be a ptrdiff_t ? > > Well aren't we picky? Fixed :) > >> >> --- >> >> src/java.base/windows/native/libjli/java_md.c >> >> Aside: I find it quite bizarre that the vsnprintf family of methods >> take a size_t as the count but return an int, when on success it has >> to return the number of characters written! > > Fully agree. Maybe _today_ is a good day to change the return type of > all printf functions? ;) > > Cheers, > Mikael > > [1] http://hg.openjdk.java.net/jdk9/dev/jdk/rev/cb94a46ab47b > [2] https://bugs.openjdk.java.net/browse/JDK-8073158 > > >> >> --- >> >> Thanks, >> David >> >> >>> I built the code across all the OracleJDK platforms and there were no >>> warnings on any of the platforms (in the files related to this change). >>> I'm taking suggestions on specific tests to run. >>> >>> Some specifics: >>> >>> Unfortunately there is no intrinsic for cpuid in Solaris Studio, so I >>> had to keep the inline asm code and the corresponding flag to disable >>> the related warning (E_ASM_DISABLES_OPTIMIZATION). The alternative would >>> be to move it out into a dedicated assembly file, but that seems like >>> more trouble than it's worth given that the warning is harmless. >>> >>> I'm not entirely happy with the unsigned cast in parse_manifest.c:196, >>> but unfortunately the windows prototype for read() takes an unsigned as >>> its last argument, where All(tm) other platforms take a size_t. In this >>> specific case 'len' will never be be more than END_MAXLEN = 0xFFFF + >>> ENDHDR = 0xFFFF + 22 = 0x10015, meaning it will comfortably fit in an >>> unsigned on the platforms we support. But if somebody has suggestions >>> I'm all ears, doing the #ifdef dance is of course also an option. >>> >>> Note that the warnings were temporarily disabled as part of JDK-8074096 >>> [1] until such time they could be fixed the proper way. Also note that >>> this change supersedes the earlier change [2] Dmitry had out for review. >>> The bug [3] corresponding to that webrev will be closed as a duplicate >>> of this bug (JDK-8074839). >>> >>> Cheers, >>> Mikael >>> >>> [1] https://bugs.openjdk.java.net/browse/JDK-8074096 >>> [2] http://cr.openjdk.java.net/~dsamersoff/JDK-8073175/webrev.01/ >>> [3] https://bugs.openjdk.java.net/browse/JDK-8073175 >>> > > > From john.r.rose at oracle.com Thu Apr 2 02:27:00 2015 From: john.r.rose at oracle.com (John Rose) Date: Wed, 1 Apr 2015 19:27:00 -0700 Subject: [9] RFR (M): 8057967: CallSite dependency tracking scales devastatingly poorly In-Reply-To: <551C5B92.8060500@oracle.com> References: <551C5B92.8060500@oracle.com> Message-ID: On Apr 1, 2015, at 1:56 PM, Vladimir Ivanov wrote: > > http://cr.openjdk.java.net/~vlivanov/8057967/webrev.00/hotspot/ > http://cr.openjdk.java.net/~vlivanov/8057967/webrev.00/jdk/ > https://bugs.openjdk.java.net/browse/JDK-8057967 Impressive work. Question: How common is state 2 (context-free CS) compared to state 3 (indy-bound CS)? And is state 2 well tested by Box2D? I recommend putting CONTEXT_OFFSET into CallSite, not the nested class. For one thing, your getDeclaredField call will fail (I think) with a security manager installed. You can load it up where TARGET_OFFSET is initialized. I haven't looked at the JVM changes yet, and I don't understand the cleaner, yet. Can a call site target class change as a result of LF recompiling or customization? If so, won't that cause a risk of dropped dependencies? ? John From peter.levart at gmail.com Thu Apr 2 08:02:17 2015 From: peter.levart at gmail.com (Peter Levart) Date: Thu, 02 Apr 2015 10:02:17 +0200 Subject: [9] RFR (M): 8057967: CallSite dependency tracking scales devastatingly poorly In-Reply-To: <551C5B92.8060500@oracle.com> References: <551C5B92.8060500@oracle.com> Message-ID: <551CF789.9080607@gmail.com> Hi Vladimir, Would it be possible for CallSite.context to hold the Cleaner instance itself (without indirection through DependencyContext)? DEFAULT_CONTEXT would then be a Cleaner instance that references some "default" Class object (for example DefaultContext.class that serves no other purpose). Regards, Peter On 04/01/2015 10:56 PM, Vladimir Ivanov wrote: > http://cr.openjdk.java.net/~vlivanov/8057967/webrev.00/hotspot/ > http://cr.openjdk.java.net/~vlivanov/8057967/webrev.00/jdk/ > https://bugs.openjdk.java.net/browse/JDK-8057967 > > HotSpot JITs inline very aggressively through CallSites. The > optimistically treat CallSite target as constant, but record a nmethod > dependency to invalidate the compiled code once CallSite target changes. > > Right now, such dependencies have call site class as a context. This > context is too coarse and it leads to context pollution: if some > CallSite target changes, VM needs to enumerate all nmethods which > depends on call sites of such type. > > As performance analysis in the bug report shows, it can sum to > significant amount of work. > > While working on the fix, I investigated 3 approaches: > (1) unique context per call site > (2) use CallSite target class > (3) use a class the CallSite instance is linked to > > Considering call sites are ubiquitous (e.g. 10,000s on some octane > benchmarks), loading a dedicated class for every call site is an > overkill (even VM anonymous). > > CallSite target class > (MethodHandle.form->LambdaForm.vmentry->MemberName.clazz->Class) is > also not satisfactory, since it is a compiled LambdaForm VM anonymous > class, which is heavily shared. It gets context pollution down, but > still the overhead is quite high. > > So, I decided to focus on (3) and ended up with a mixture of (2) & (3). > > Comparing to other options, the complications of (3) are: > - CallSite can stay unlinked (e.g. CallSite.dynamicInvoker()), so > there should be some default context VM can use > > - CallSite instances can be shared and it shouldn't keep the context > class from unloading; > > It motivated a scheme where CallSite context is initialized lazily and > can change during lifetime. When CallSite is linked with an indy > instruction, it's context is initialized. Usually, JIT sees CallSite > instances with initialized context (since it reaches them through > indy), but if it's not the case and there's no context yet, JIT sets > it to "default context", which means "use target call site". > > I introduced CallSite$DependencyContext, which represents a nmethod > dependency context and points (indirectly) to a Class used as a > context. > > Context class is referenced through a phantom reference > (sun.misc.Cleaner to simplify cleanup). Though it's impossible to > extract referent using Reference.get(), VM can access it directly by > reading corresponding field. Unlike other types of references, phantom > references aren't cleared automatically. It allows VM to access > context class until cleanup is performed. And cleanup resets the > context to NULL, in addition to invalidating all relevant dependencies. > > There are 3 context states a CallSite instance can be in: > (1) NULL: no depedencies > (2) DependencyContext.DEFAULT_CONTEXT: dependencies are stored in > call site target class > (3) DependencyContext for some class: dependencies are stored on the > class DependencyContext instance points to > > Every CallSite starts w/o a context (1) and then lazily gets one ((2) > or (3) depending on the situation). > > State transitions: > (1->3): When a CallSite w/o a context (1) is linked with some indy > call site, it's owner is recorded as a context (3). > > (1->2): When JIT needs to record a dependency on a target of a > CallSite w/o a context(1), it sets the context to DEFAULT_CONTEXT and > uses target class to store the dependency. > > (3->1): When context class becomes unreachable, a cleanup hook > invalidates all dependencies on that CallSite and resets the context > to NULL (1). > > Only (3->1) requires dependency invalidation, because there are no > depedencies in (1) and (2->1) isn't performed. > > (1->3) is done in Java code (CallSite.initContext) and (1->2) is > performed in VM (ciCallSite::get_context()). The updates are performed > by CAS, so there's no need in additional synchronization. Other > operations on VM side are volatile (to play well with Java code) and > performed with Compile_lock held (to avoid races between VM operations). > > Some statistics: > Box2D, latest jdk9-dev > - CallSite instances: ~22000 > > - invalidated nmethods due to CallSite target changes: ~60 > > - checked call_site_target_value dependencies: > - before the fix: ~1,600,000 > - after the fix: ~600 > > Testing: > - dedicated test which excercises different state transitions > - jdk/java/lang/invoke, hotspot/test/compiler/jsr292, nashorn > > Thanks! > > Best regards, > Vladimir Ivanov From ivan.gerasimov at oracle.com Thu Apr 2 14:24:41 2015 From: ivan.gerasimov at oracle.com (Ivan Gerasimov) Date: Thu, 02 Apr 2015 17:24:41 +0300 Subject: Code review request for JDK-8076441: Remove dead code in java.time.chrono.Chronology.isLeapYear In-Reply-To: <551C4C14.30505@oracle.com> References: <551C4C14.30505@oracle.com> Message-ID: <551D5129.2010705@oracle.com> Looks good. Can we also fix a typo in the doc with this change? 662 * Return the maximum supported Hijrah ear. s/ear/year/ :) Sincerely yours, Ivan On 01.04.2015 22:50, nadeesh tv wrote: > Hi all, > > Please review this minor change which remove a dead code in > isLeapYear(long prolepticYear) method of > java/time/chrono/HijrahChronology.java. > > Bug: https://bugs.openjdk.java.net/browse/JDK-8076441 > Webrev: http://cr.openjdk.java.net/~rriggs/hadeesh-tv-8076441/ > From Roger.Riggs at Oracle.com Thu Apr 2 14:31:48 2015 From: Roger.Riggs at Oracle.com (Roger Riggs) Date: Thu, 02 Apr 2015 10:31:48 -0400 Subject: Code review request for JDK-8076441: Remove dead code in java.time.chrono.Chronology.isLeapYear In-Reply-To: <551D5129.2010705@oracle.com> References: <551C4C14.30505@oracle.com> <551D5129.2010705@oracle.com> Message-ID: <551D52D4.7020506@Oracle.com> Hi, Sure, I'll sponsor this for Hadeesh and fix the typo at the same time. Thanks, Roger On 4/2/2015 10:24 AM, Ivan Gerasimov wrote: > Looks good. > > Can we also fix a typo in the doc with this change? > > 662 * Return the maximum supported Hijrah ear. > > > s/ear/year/ :) > > Sincerely yours, > Ivan > > On 01.04.2015 22:50, nadeesh tv wrote: >> Hi all, >> >> Please review this minor change which remove a dead code in >> isLeapYear(long prolepticYear) method of >> java/time/chrono/HijrahChronology.java. >> >> Bug: https://bugs.openjdk.java.net/browse/JDK-8076441 >> Webrev: http://cr.openjdk.java.net/~rriggs/hadeesh-tv-8076441/ >> > From aleksey.shipilev at oracle.com Thu Apr 2 16:10:53 2015 From: aleksey.shipilev at oracle.com (Aleksey Shipilev) Date: Thu, 02 Apr 2015 19:10:53 +0300 Subject: [9] RFR (M): 8057967: CallSite dependency tracking scales devastatingly poorly In-Reply-To: <551C5B92.8060500@oracle.com> References: <551C5B92.8060500@oracle.com> Message-ID: <551D6A0D.8090500@oracle.com> On 04/01/2015 11:56 PM, Vladimir Ivanov wrote: > http://cr.openjdk.java.net/~vlivanov/8057967/webrev.00/hotspot/ > http://cr.openjdk.java.net/~vlivanov/8057967/webrev.00/jdk/ > https://bugs.openjdk.java.net/browse/JDK-8057967 Glad to see this finally addressed, thanks! I did not look through the code changes, but ran Octane on my configuration. As expected, Typescript had improved substantially. Other benchmarks are not affected much. This in line with the performance analysis done for the original bug report. Baseline: Benchmark Mode Cnt Score Error Units Box2D.test ss 20 4454.677 ? 345.807 ms/op CodeLoad.test ss 20 4784.299 ? 370.658 ms/op Crypto.test ss 20 878.395 ? 87.918 ms/op DeltaBlue.test ss 20 502.182 ? 52.362 ms/op EarleyBoyer.test ss 20 2250.508 ? 273.924 ms/op Gbemu.test ss 20 5893.102 ? 656.036 ms/op Mandreel.test ss 20 9323.484 ? 825.801 ms/op NavierStokes.test ss 20 657.608 ? 41.212 ms/op PdfJS.test ss 20 3829.534 ? 353.702 ms/op Raytrace.test ss 20 1202.826 ? 166.795 ms/op Regexp.test ss 20 156.782 ? 20.992 ms/op Richards.test ss 20 324.256 ? 35.874 ms/op Splay.test ss 20 179.660 ? 34.120 ms/op Typescript.test ss 20 40.537 ? 2.457 s/op Patched: Benchmark Mode Cnt Score Error Units Box2D.test ss 20 4306.198 ? 376.030 ms/op CodeLoad.test ss 20 4881.635 ? 395.585 ms/op Crypto.test ss 20 823.551 ? 106.679 ms/op DeltaBlue.test ss 20 490.557 ? 41.705 ms/op EarleyBoyer.test ss 20 2299.763 ? 270.961 ms/op Gbemu.test ss 20 5612.868 ? 414.052 ms/op Mandreel.test ss 20 8616.735 ? 825.813 ms/op NavierStokes.test ss 20 640.722 ? 28.035 ms/op PdfJS.test ss 20 4139.396 ? 373.580 ms/op Raytrace.test ss 20 1227.632 ? 151.088 ms/op Regexp.test ss 20 169.246 ? 34.055 ms/op Richards.test ss 20 331.824 ? 32.706 ms/op Splay.test ss 20 168.479 ? 23.512 ms/op Typescript.test ss 20 31.181 ? 1.790 s/op The offending profile branch (Universe::flush_dependents_on) is also gone, which explains the performance improvement. Thanks, -Aleksey. From vladimir.x.ivanov at oracle.com Thu Apr 2 16:17:25 2015 From: vladimir.x.ivanov at oracle.com (Vladimir Ivanov) Date: Thu, 02 Apr 2015 19:17:25 +0300 Subject: [9] RFR (M): 8057967: CallSite dependency tracking scales devastatingly poorly In-Reply-To: References: <551C5B92.8060500@oracle.com> Message-ID: <551D6B95.5030109@oracle.com> John, Peter, Thanks a lot for the feedback! Updated webrev: http://cr.openjdk.java.net/~vlivanov/8057967/webrev.01/hotspot/ http://cr.openjdk.java.net/~vlivanov/8057967/webrev.01/jdk/ > Question: How common is state 2 (context-free CS) compared to state 3 (indy-bound CS)? It's quite rare (<2%). For Box2D the stats are: total # of call sites instantiated: 22000 (1): ~1800 (stay uninitialized) (2): ~19900 (3): ~300 > And is state 2 well tested by Box2D? No, it's not. But: (1) I wrote a focused test on different context state transitions (see test/compiler/jsr292/CallSiteDepContextTest.java); and (2) artificially stressed the logic by eagerly initializing the context to DEFAULT_CONTEXT. I had (2)->(3) transition (DEF_CTX => bound Class context) at some point, but decided to get rid of it. IMO the price of recompilation (recorded dependencies should be invalidated during context migration) is too much for reduced number of dependencies enumerated. > I recommend putting CONTEXT_OFFSET into CallSite, not the nested class. > For one thing, your getDeclaredField call will fail (I think) with a security manager installed. > You can load it up where TARGET_OFFSET is initialized. Since I removed DependencyContext, I moved CONTEXT_OFFSET to CallSite. BTW why do you think security manager was the problem? (1) Class.getDeclaredField() is caller-sensitive; and (2) DependencyContext was eagerly initialized with CallSite (see UNSAFE.ensureClassInitialized() in original version). > > I haven't looked at the JVM changes yet, and I don't understand the cleaner, yet. > Can a call site target class change as a result of LF recompiling or customization? > If so, won't that cause a risk of dropped dependencies? Good point! It's definitely a problem I haven't envisioned. Ok, I completely removed call site target class logic and use DefaultContext class instead. On 4/2/15 11:02 AM, Peter Levart wrote:> Hi Vladimir, > > Would it be possible for CallSite.context to hold the Cleaner instance > itself (without indirection through DependencyContext)? > > DEFAULT_CONTEXT would then be a Cleaner instance that references some > "default" Class object (for example DefaultContext.class that serves no > other purpose). Good idea! I eliminated the indirection as you suggest. Best regards, Vladimir Ivanov From vladimir.x.ivanov at oracle.com Thu Apr 2 16:26:20 2015 From: vladimir.x.ivanov at oracle.com (Vladimir Ivanov) Date: Thu, 02 Apr 2015 19:26:20 +0300 Subject: [9] RFR (M): 8057967: CallSite dependency tracking scales devastatingly poorly In-Reply-To: <551D6A0D.8090500@oracle.com> References: <551C5B92.8060500@oracle.com> <551D6A0D.8090500@oracle.com> Message-ID: <551D6DAC.8030607@oracle.com> Aleksey, thanks a lot for the performance evaluation of the fix! Best regards, Vladimir Ivanov On 4/2/15 7:10 PM, Aleksey Shipilev wrote: > On 04/01/2015 11:56 PM, Vladimir Ivanov wrote: >> http://cr.openjdk.java.net/~vlivanov/8057967/webrev.00/hotspot/ >> http://cr.openjdk.java.net/~vlivanov/8057967/webrev.00/jdk/ >> https://bugs.openjdk.java.net/browse/JDK-8057967 > > Glad to see this finally addressed, thanks! > > I did not look through the code changes, but ran Octane on my > configuration. As expected, Typescript had improved substantially. Other > benchmarks are not affected much. This in line with the performance > analysis done for the original bug report. > > Baseline: > > Benchmark Mode Cnt Score Error Units > Box2D.test ss 20 4454.677 ? 345.807 ms/op > CodeLoad.test ss 20 4784.299 ? 370.658 ms/op > Crypto.test ss 20 878.395 ? 87.918 ms/op > DeltaBlue.test ss 20 502.182 ? 52.362 ms/op > EarleyBoyer.test ss 20 2250.508 ? 273.924 ms/op > Gbemu.test ss 20 5893.102 ? 656.036 ms/op > Mandreel.test ss 20 9323.484 ? 825.801 ms/op > NavierStokes.test ss 20 657.608 ? 41.212 ms/op > PdfJS.test ss 20 3829.534 ? 353.702 ms/op > Raytrace.test ss 20 1202.826 ? 166.795 ms/op > Regexp.test ss 20 156.782 ? 20.992 ms/op > Richards.test ss 20 324.256 ? 35.874 ms/op > Splay.test ss 20 179.660 ? 34.120 ms/op > Typescript.test ss 20 40.537 ? 2.457 s/op > > Patched: > > Benchmark Mode Cnt Score Error Units > Box2D.test ss 20 4306.198 ? 376.030 ms/op > CodeLoad.test ss 20 4881.635 ? 395.585 ms/op > Crypto.test ss 20 823.551 ? 106.679 ms/op > DeltaBlue.test ss 20 490.557 ? 41.705 ms/op > EarleyBoyer.test ss 20 2299.763 ? 270.961 ms/op > Gbemu.test ss 20 5612.868 ? 414.052 ms/op > Mandreel.test ss 20 8616.735 ? 825.813 ms/op > NavierStokes.test ss 20 640.722 ? 28.035 ms/op > PdfJS.test ss 20 4139.396 ? 373.580 ms/op > Raytrace.test ss 20 1227.632 ? 151.088 ms/op > Regexp.test ss 20 169.246 ? 34.055 ms/op > Richards.test ss 20 331.824 ? 32.706 ms/op > Splay.test ss 20 168.479 ? 23.512 ms/op > Typescript.test ss 20 31.181 ? 1.790 s/op > > The offending profile branch (Universe::flush_dependents_on) is also > gone, which explains the performance improvement. > > Thanks, > -Aleksey. > From Sergey.Bylokhov at oracle.com Thu Apr 2 16:28:56 2015 From: Sergey.Bylokhov at oracle.com (Sergey Bylokhov) Date: Thu, 02 Apr 2015 19:28:56 +0300 Subject: jsr 305 In-Reply-To: <53F3BA16.1080902@oracle.com> References: <4E77F6E3.7040300@oracle.com> <4E78E2D0.4050303@oracle.com> <53F39466.5040304@oracle.com> <53F3BA16.1080902@oracle.com> Message-ID: <551D6E48.20000@oracle.com> Hi, Joe. It is interesting does anybody plan something related? I still think that using something similar to [1] will greatly improve of jdk development. [1] http://types.cs.washington.edu/checker-framework 20.08.14 0:56, Joe Darcy wrote: > Sergey, > > JSR 305 is officially marked "dormant" in the JCP: > > https://www.jcp.org/en/jsr/detail?id=305 > > At this point, the addition of annotations in that vein should > probably occur under the banner of a different effort. > > Cheers, > > -Joe > > On 08/19/2014 11:16 AM, Sergey Bylokhov wrote: >> Hi, Joe. >> There are no news about this jsr in jdk9? I guess it will be useful >> in jdk development also. >> >> On 20.09.2011 23:00, Joe Darcy wrote: >>> Hello. >>> >>> First, a procedural point, the party responsible for making progress on >>> a JSR is the spec lead, which in the case of JSR 305 is Bill Pugh. >>> >>> When I last spoke to Bill about 18 months ago, he said he felt the >>> annotations needed more use on real-world code before they could be >>> fully standardized. I assume that the JSR has remained in that state >>> since then. >>> >>> JSR 308 is primarily about allowing annotations in more locations in a >>> source file and *not* about defining more annotations. >>> >>> -Joe >>> >>> Ben Evans wrote: >>>> Hi Sergey, >>>> >>>> I am not an expert in what happened to JSR 305, but from a quick look >>>> at it, it seems to have a big overlap with JSR 308 (Type Annotations), >>>> which is still an active JSR. >>>> >>>> So you may want to approach the Spec Lead / EG for JSR 308 and see >>>> what their current status is - the last I heard they were interested >>>> in trying to make the cut for JDK 8. >>>> >>>> Does anyone have more information? >>>> >>>> Thanks, >>>> >>>> Ben >>>> >>>> On Tue, Sep 20, 2011 at 3:13 AM, Sergey Bylokhov >>>> wrote: >>>>> Hello, all. >>>>> >>>>> Does anybody know what happens with jsr305? >>>>> http://jcp.org/en/jsr/detail?id=305 >>>>> >>>>> Probably it is replaced by another jsr? Can it be integrated as >>>>> part of >>>>> coin project? >>>>> >>>>> >>>>> Thanks. >>>>> >>>>> -- >>>>> Best regards, Sergey. >>>>> >>>>> >>>>> >>> >>> >> >> > -- Best regards, Sergey. From john.r.rose at oracle.com Thu Apr 2 20:21:03 2015 From: john.r.rose at oracle.com (John Rose) Date: Thu, 2 Apr 2015 13:21:03 -0700 Subject: [9] RFR (M): 8057967: CallSite dependency tracking scales devastatingly poorly In-Reply-To: <551D6B95.5030109@oracle.com> References: <551C5B92.8060500@oracle.com> <551D6B95.5030109@oracle.com> Message-ID: <606B777D-C99C-4F28-9E0B-A0A032659B71@oracle.com> On Apr 2, 2015, at 9:17 AM, Vladimir Ivanov wrote: > >> >> I recommend putting CONTEXT_OFFSET into CallSite, not the nested class. >> For one thing, your getDeclaredField call will fail (I think) with a security manager installed. >> You can load it up where TARGET_OFFSET is initialized. > Since I removed DependencyContext, I moved CONTEXT_OFFSET to CallSite. > > BTW why do you think security manager was the problem? (1) Class.getDeclaredField() is caller-sensitive; and (2) DependencyContext was eagerly initialized with CallSite (see UNSAFE.ensureClassInitialized() in original version). CallSite$DependencyContext and CallSite are distinct classes. At the JVM level they cannot access each others' private members. So if DependencyContext wants to reflect a private field from CallSite, there will be extra security checks. These sometimes fail, as in: https://bugs.openjdk.java.net/browse/JDK-7050328 ? John From mikael.vidstedt at oracle.com Thu Apr 2 20:37:23 2015 From: mikael.vidstedt at oracle.com (Mikael Vidstedt) Date: Thu, 02 Apr 2015 13:37:23 -0700 Subject: [9] RFR 8074840: Resolve disabled warnings for libjli and libjli_static In-Reply-To: <551C7C9B.8070302@oracle.com> References: <550C60CC.1080208@oracle.com> <5518CBFB.4020706@oracle.com> <551C2964.90506@oracle.com> <551C7C9B.8070302@oracle.com> Message-ID: <551DA883.7070400@oracle.com> David/Kumar - thanks a lot for the reviews! I added a comment for the unsigned cast and pushed to jdk9/dev. Cheers, Mikael On 2015-04-01 16:17, David Holmes wrote: > On 2/04/2015 3:22 AM, Mikael Vidstedt wrote: >> >> New webrev available here: >> >> http://cr.openjdk.java.net/~mikael/webrevs/8074840/webrev.02/webrev/ >> >> Changes include: >> >> * Excluded ergo_i586.c in the makefile on macosx instead of using >> ifdef-style exclusion > > Good. > >> * Updated to fix a newly introduced (currently silenced) warning in >> parse_manifest.c:readAt(), introduced by the change [1] for >> JDK-8073158 [2] >> >> The change to have readAt take an unsigned int is not exactly pretty, so >> I'm again taking suggestions on alternative solutions. The underlying >> reason for making that change is again because read on Windows uses an >> unsigned int for count instead of the more common size_t. I played >> around with several different ways of working around this (I even >> introduced a JLI_Read at some point) but after chatting with mr. Holmes >> I decided to cut back on the changes and instead just change the >> prototype of readAt to also take an unsigned int in the spirit of >> "common denominator". All the current uses of readAt() can AFAICT >> tolerate this, and if they don't the problem is already there on >> windows. Happy to hear your thoughts though. > > I think what you have is the simplest correct fix. There is still size > confusion in parse_manifest with the jlong use of len/flen. It would > probably be clearer to make len uint as it is constrained to a small > value due to END_MAXLEN and ENDRD, but that would likely introduce > more casts. Maybe a comment (or assert?) that len always fits in uint? > > Otherwise all good. > >> >> Also, some comments below. > > I missed the fact that KB introduces unsignedness (is that a word? ;-) ) > > Thanks, > David > >> On 2015-03-29 21:07, David Holmes wrote: >>> Hi Mikael, >>> >>> On 21/03/2015 4:02 AM, Mikael Vidstedt wrote: >>>> >>>> Please review the following change which fixes a number of native >>>> compilation warnings in files related to libjli. >>>> >>>> Bug: https://bugs.openjdk.java.net/browse/JDK-8074840 >>>> Webrev: >>>> http://cr.openjdk.java.net/~mikael/webrevs/8074840/webrev.01/webrev/ >>> >>> Mostly looks okay, but I find some of these odd. For example: >>> >>> src/java.base/share/native/libjli/java.c >>> >>> if (threadStackSize < STACK_SIZE_MINIMUM) >>> >>> becomes: >>> >>> if (threadStackSize < (jlong)STACK_SIZE_MINIMUM) { >>> >>> but integer promotion would make that cast implicitly. And why should >>> the comparison cause a warning when the subsequent assignment does >>> not? What was the actual warning and on what compiler? >> >> Real warning - gcc on linux among others: >> >> jdk/src/java.base/share/native/libjli/java.c:792:33: warning: comparison >> between signed and unsigned integer expressions [-Wsign-compare] >> if (threadStackSize < STACK_SIZE_MINIMUM) { >> ^ >> >> As you can see the warning is generated because of the unsigned vs >> signed-ness in combination with a compare; the assignment does not >> generate a corresponding warning. The unsigned type comes from the fact >> that STACK_SIZE_MINIMUM which is based on the KB macro which in turn is >> an unsigned long (UL) constant. One alternative would of course be to >> cast the (macro) definition of STACK_SIZE_MINIMUM instead, or not use KB >> to start with, but I'm not sure that's any better than having the cast >> here. I really don't have a strong opinion though. >> >>> >>> --- >>> >>> I second Kumar's query about the ergo_i586.c changes. Seems to me that >>> if this is causing a problem on non Solaris/Linux then the problem is >>> in the makefile (jdk/lib/CoreLibraries.gmk) because this file should >>> be being excluded on platforms it is not used. >> >> Indeed - fixed! >> >>> >>> --- >>> >>> src/java.base/windows/native/libjli/cmdtoargs.c >>> >>> Surely charLength should be a ptrdiff_t ? >> >> Well aren't we picky? Fixed :) >> >>> >>> --- >>> >>> src/java.base/windows/native/libjli/java_md.c >>> >>> Aside: I find it quite bizarre that the vsnprintf family of methods >>> take a size_t as the count but return an int, when on success it has >>> to return the number of characters written! >> >> Fully agree. Maybe _today_ is a good day to change the return type of >> all printf functions? ;) >> >> Cheers, >> Mikael >> >> [1] http://hg.openjdk.java.net/jdk9/dev/jdk/rev/cb94a46ab47b >> [2] https://bugs.openjdk.java.net/browse/JDK-8073158 >> >> >>> >>> --- >>> >>> Thanks, >>> David >>> >>> >>>> I built the code across all the OracleJDK platforms and there were no >>>> warnings on any of the platforms (in the files related to this >>>> change). >>>> I'm taking suggestions on specific tests to run. >>>> >>>> Some specifics: >>>> >>>> Unfortunately there is no intrinsic for cpuid in Solaris Studio, so I >>>> had to keep the inline asm code and the corresponding flag to disable >>>> the related warning (E_ASM_DISABLES_OPTIMIZATION). The alternative >>>> would >>>> be to move it out into a dedicated assembly file, but that seems like >>>> more trouble than it's worth given that the warning is harmless. >>>> >>>> I'm not entirely happy with the unsigned cast in parse_manifest.c:196, >>>> but unfortunately the windows prototype for read() takes an >>>> unsigned as >>>> its last argument, where All(tm) other platforms take a size_t. In >>>> this >>>> specific case 'len' will never be be more than END_MAXLEN = 0xFFFF + >>>> ENDHDR = 0xFFFF + 22 = 0x10015, meaning it will comfortably fit in an >>>> unsigned on the platforms we support. But if somebody has suggestions >>>> I'm all ears, doing the #ifdef dance is of course also an option. >>>> >>>> Note that the warnings were temporarily disabled as part of >>>> JDK-8074096 >>>> [1] until such time they could be fixed the proper way. Also note that >>>> this change supersedes the earlier change [2] Dmitry had out for >>>> review. >>>> The bug [3] corresponding to that webrev will be closed as a duplicate >>>> of this bug (JDK-8074839). >>>> >>>> Cheers, >>>> Mikael >>>> >>>> [1] https://bugs.openjdk.java.net/browse/JDK-8074096 >>>> [2] http://cr.openjdk.java.net/~dsamersoff/JDK-8073175/webrev.01/ >>>> [3] https://bugs.openjdk.java.net/browse/JDK-8073175 >>>> >> >> >> From vladimir.x.ivanov at oracle.com Thu Apr 2 22:08:10 2015 From: vladimir.x.ivanov at oracle.com (Vladimir Ivanov) Date: Fri, 03 Apr 2015 01:08:10 +0300 Subject: [9] RFR (M): 8057967: CallSite dependency tracking scales devastatingly poorly In-Reply-To: <606B777D-C99C-4F28-9E0B-A0A032659B71@oracle.com> References: <551C5B92.8060500@oracle.com> <551D6B95.5030109@oracle.com> <606B777D-C99C-4F28-9E0B-A0A032659B71@oracle.com> Message-ID: <551DBDCA.4020100@oracle.com> John, Thanks for the clarification! >> BTW why do you think security manager was the problem? (1) >> Class.getDeclaredField() is caller-sensitive; and (2) >> DependencyContext was eagerly initialized with CallSite (see >> UNSAFE.ensureClassInitialized() in original version). > > CallSite$DependencyContext and CallSite are distinct classes. > At the JVM level they cannot access each others' private members. > So if DependencyContext wants to reflect a private field from CallSite, > there will be extra security checks. These sometimes fail, as in: Member access permission check isn't performed if caller and member owner class are loaded by the same class loader (which is the case with CallSite$DependencyContext and CallSite classes). jdk/src/java.base/share/classes/java/lang/Class.java: @CallerSensitive public Field getDeclaredField(String name) throws NoSuchFieldException, SecurityException { checkMemberAccess(Member.DECLARED, Reflection.getCallerClass(), true); ... private void checkMemberAccess(int which, Class caller, boolean checkProxyInterfaces) { final SecurityManager s = System.getSecurityManager(); if (s != null) { final ClassLoader ccl = ClassLoader.getClassLoader(caller); final ClassLoader cl = getClassLoader0(); if (which != Member.PUBLIC) { if (ccl != cl) { s.checkPermission(SecurityConstants.CHECK_MEMBER_ACCESS_PERMISSION); } Best regards, Vladimir Ivanov From john.r.rose at oracle.com Thu Apr 2 22:57:41 2015 From: john.r.rose at oracle.com (John Rose) Date: Thu, 2 Apr 2015 15:57:41 -0700 Subject: [9] RFR (M): 8057967: CallSite dependency tracking scales devastatingly poorly In-Reply-To: <551DBDCA.4020100@oracle.com> References: <551C5B92.8060500@oracle.com> <551D6B95.5030109@oracle.com> <606B777D-C99C-4F28-9E0B-A0A032659B71@oracle.com> <551DBDCA.4020100@oracle.com> Message-ID: <27F0D8DE-FF78-4B41-B5DF-2C985705CC96@oracle.com> On Apr 2, 2015, at 3:08 PM, Vladimir Ivanov wrote: > > Member access permission check isn't performed if caller and member owner class are loaded by the same class loader (which is the case with CallSite$DependencyContext and CallSite classes). Heh! And I thought I had compiled the reflection logic to gray matter. ? John From jonathan.gibbons at oracle.com Thu Apr 2 23:52:04 2015 From: jonathan.gibbons at oracle.com (Jonathan Gibbons) Date: Thu, 02 Apr 2015 16:52:04 -0700 Subject: RFR: JDK-8076583: move jdk.Exported from langtools to jdk Message-ID: <551DD624.4060701@oracle.com> Sorry for the relatively wide distribution. JDK-8076583 is a conceptually simple cleanup, to move the source file for the jdk.Exported class from the langtools repo (where it is a singleton outlier) to the jdk repo (alongside most of the rest of the classes in the jdk package hierarchy). The class was originally placed in the langtools repo for bootstrapping reasons that no longer apply. As a result of moving the source file, references to java.base in a number of places in the langtools repo can be cleaned up. @Build folk: There is a trivial change to a makefile in the langtools repo. @Core-libs folk: The source file gets moved into the jdk/ repo. @Compiler-dev folk: We can remove references to the java.base folder from the private Ant build, and from IDE support files. JBS: https://bugs.openjdk.java.net/browse/JDK-8076583 Webrev: http://cr.openjdk.java.net/~jjg/8076583/webrev.00/ -- Jon From joe.darcy at oracle.com Fri Apr 3 01:27:58 2015 From: joe.darcy at oracle.com (Joseph D. Darcy) Date: Thu, 02 Apr 2015 18:27:58 -0700 Subject: RFR: JDK-8076583: move jdk.Exported from langtools to jdk In-Reply-To: <551DD624.4060701@oracle.com> References: <551DD624.4060701@oracle.com> Message-ID: <551DEC9E.3050906@oracle.com> Jon, The actual file move looks fine to me. Thanks, -Joe On 4/2/2015 4:52 PM, Jonathan Gibbons wrote: > Sorry for the relatively wide distribution. > > JDK-8076583 is a conceptually simple cleanup, to move the source file > for the jdk.Exported class from the langtools repo (where it is a > singleton outlier) to the jdk repo (alongside most of the rest of the > classes in the jdk package hierarchy). The class was originally placed > in the langtools repo for bootstrapping reasons that no longer apply. > > As a result of moving the source file, references to java.base in a > number of places in the langtools repo can be cleaned up. > > @Build folk: > There is a trivial change to a makefile in the langtools repo. > > @Core-libs folk: > The source file gets moved into the jdk/ repo. > > @Compiler-dev folk: > We can remove references to the java.base folder from the private Ant > build, and from IDE support files. > > JBS: https://bugs.openjdk.java.net/browse/JDK-8076583 > Webrev: http://cr.openjdk.java.net/~jjg/8076583/webrev.00/ > > -- Jon From huizhe.wang at oracle.com Fri Apr 3 02:02:27 2015 From: huizhe.wang at oracle.com (huizhe wang) Date: Thu, 02 Apr 2015 19:02:27 -0700 Subject: Review request for JDK-8051559: JAXP function dom tests conversion In-Reply-To: <034b01d06c6b$451b6c70$cf524550$@oracle.com> References: <035701d066e0$93124560$b936d020$@oracle.com> <019b01d06b8a$da0abca0$8e2035e0$@oracle.com> <0E4D09A9-8046-42AC-98B8-D2433A8D38FF@oracle.com> <551B7E99.9050406@oracle.com> <034b01d06c6b$451b6c70$cf524550$@oracle.com> Message-ID: <551DF4B3.6020508@oracle.com> DocumentTest->testCreateElementNeg, the conversion seems to be incorrect. The original test, as the Javadoc stated, "This checks for the constuctor of DOMException ". The new test however, only verifies that an Exception is thrown. Comments for tests such as testCreateAttributeNSNeg can be more descriptive, for example, "Test for createAttributeNS method: verifies that DOMException is thrown if reserved prefixes are used with an arbitrary namespace name." The original tests that made up DocumentTypeTest had comments that you may want to copy over or rewrite as you did other tests. The comment for EntityChildTest can be "Test DOM Parser: parsing an xml file that contains external entities." NodeListTest: @summary Verifies a bug found in jaxp1.0.1 and 1.1FCS. After going out of bound, the last element of a NodeList returns null. The bug has been fixed in jaxp 1.1.1 build. Thanks, Joe On 4/1/2015 4:01 AM, Frank Yuan wrote: > > Hi Joe and Lance > > Many thanks for your review and comments! > > I have added the comments to the tests as your suggestions except some > test method is very simple, the method name/code can present all > information, e.g. method testHasFeature in DomImplementationTest.java. > Please check my update in > http://cr.openjdk.java.net/~fyuan/8051559/webrev.01/ > > > As well, I understand your suggestion about the code comment, I will > think about how to add the comment on the viewpoint of the other code > reader in my future work, thank you! > > Best Regards > > Frank > > *From:*huizhe wang [mailto:huizhe.wang at oracle.com] > *Sent:* Wednesday, April 01, 2015 1:14 PM > *To:* Lance Andersen > *Cc:* Frank Yuan; Core-Libs-Dev; Gustavo Galimberti > *Subject:* Re: Review request for JDK-8051559: JAXP function dom tests > conversion > > Hi Frank, > > I did see the request, just didn't have time to look at it. > > I again agree with Lance, that these tests were written over 10 years > ago, it would be valuable to write down whatever understanding you > gained while converting the tests, same as the Astro application/test, > the goal of each test and how it works would all be helpful. > Basically, it would be nice to add some comment on @Test. > > I tried the tests. They worked fine with my current build (with some > changes). > > Thanks, > Joe > > On 3/31/2015 7:10 AM, Lance Andersen wrote: > > Hi Frank > > On Mar 31, 2015, at 7:24 AM, Lance @ Oracle > > wrote: > > > > Hi frank > > Can you forward the other review request as I think I thought > they were the same and deleted it > > Ignore this comment, the subjects were too similar but this is > what needed reviewed. > > I will look at this again today > > The tests overall look fine. > > I still have the same comment WRT providing a simple comment > describing each test. The key point to remember is we want to > make it easier for someone to look at the test, understand what > you are trying to validate, and understand the coverage of the > tests. This will help future maintainers of the code. Comments > are just as important in test code as it is in implementation IMHO. > > Best > > Lance > > Best > > Lance > > > Lance > Andersen| Principal Member of Technical Staff | > +1.781.442.2037 > Oracle Java Engineering > 1 Network Drive > Burlington, MA 01803 > Lance.Andersen at oracle.com > > Sent from my iPad > > > On Mar 31, 2015, at 4:15 AM, Frank Yuan > wrote: > > Hi Joe > > > > Do you have any comment for dom suite co-location? > > > > Best Regards > > Frank > > > > From: Frank Yuan [mailto:frank.yuan at oracle.com] > Sent: Wednesday, March 25, 2015 5:46 PM > To: 'huizhe wang'; 'Core-Libs-Dev' > Cc: 'jibing chen'; 'Gustavo Galimberti'; > sandeep.konchady at oracle.com > ; > 'Alexandre (Shura) Iline' > Subject: RE: Review request for JDK-8051559: JAXP function > dom tests > conversion > > > > Hi, Joe and All > > > > We are working on moving internal jaxp functional tests to > open jdk repo. > > This is the dom suite. Would you please review these test? > Any comment will > be appreciated. > > > > bug: https://bugs.openjdk.java.net/browse/JDK-8051559 > > webrev: > http://cr.openjdk.java.net/~fyuan/8051559/webrev.00/ > > > > > Thanks, > > > > Frank > > > > > Lance > Andersen| Principal Member of Technical Staff | +1.781.442.2037 > Oracle Java Engineering > 1 Network Drive > Burlington, MA 01803 > Lance.Andersen at oracle.com > > > From huizhe.wang at oracle.com Fri Apr 3 04:16:22 2015 From: huizhe.wang at oracle.com (huizhe wang) Date: Thu, 02 Apr 2015 21:16:22 -0700 Subject: Review request for JDK-8051559: JAXP function dom tests conversion In-Reply-To: <00c001d06dbe$97323c10$c596b430$@oracle.com> References: <035701d066e0$93124560$b936d020$@oracle.com> <019b01d06b8a$da0abca0$8e2035e0$@oracle.com> <0E4D09A9-8046-42AC-98B8-D2433A8D38FF@oracle.com> <551B7E99.9050406@oracle.com> <034b01d06c6b$451b6c70$cf524550$@oracle.com> <551DF4B3.6020508@oracle.com> <00c001d06dbe$97323c10$c596b430$@oracle.com> Message-ID: <551E1416.4000208@oracle.com> Hi Frank, Looks good. With regard to a test being too simple or straightforward, it can be subjective. I mean, what are easy to the author/you may not for others who don't have the knowledge on the particular subject matter. So it's always good to leave comments when you are there. It's also helpful for the author/you to remember what's done and why should you revisit them. Cheers, Joe On 4/2/2015 8:30 PM, Frank Yuan wrote: > > Hi Joe > > Thank you for your comments, I have updated at > http://cr.openjdk.java.net/~fyuan/8051559/webrev.02/ > > > Please also check my comments in line below > > Best Regards > > Frank > > *From:*huizhe wang [mailto:huizhe.wang at oracle.com] > *Sent:* Friday, April 03, 2015 10:02 AM > *To:* Frank Yuan > *Cc:* 'Lance Andersen'; 'Core-Libs-Dev'; 'Gustavo Galimberti' > *Subject:* Re: Review request for JDK-8051559: JAXP function dom tests > conversion > > DocumentTest->testCreateElementNeg, the conversion seems to be > incorrect. The original test, as the Javadoc stated, "This checks for > the constuctor of DOMException ". The new test however, only verifies > that an Exception is thrown. > > //I moved a part of original DomExcpTestas testCreateElementNeg into > DocumentTest, and write some code for DOMException, but as you known, > class DOMException is so simple, JCK test has covered what I/original > DomExcpTest test, Shura suggested me to remove this test from ours, > then I did as his comment. > > > > Comments for tests such as testCreateAttributeNSNeg can be more > descriptive, for example, "Test for createAttributeNS method: verifies > that DOMException is thrown if reserved prefixes are used with an > arbitrary namespace name." > > //Modified the comments to be more descriptive as your example on the > similar cases. > > > > The original tests that made up DocumentTypeTest had comments that you > may want to copy over or rewrite as you did other tests. > > //Because I thought this test is so straightforward, I didn't add > comment for it. However, I added comments as your suggestion. > > > > The comment for EntityChildTest can be "Test DOM Parser: parsing an > xml file that contains external entities." > > //changed the comment > > > > NodeListTest: @summary Verifies a bug found in jaxp1.0.1 and 1.1FCS. > After going out of bound, the last element of a NodeList returns null. > The bug has been fixed in jaxp 1.1.1 build. > > //changed the comment > > > > Thanks, > Joe > > On 4/1/2015 4:01 AM, Frank Yuan wrote: > > Hi Joe and Lance > > Many thanks for your review and comments! > > I have added the comments to the tests as your suggestions except > some test method is very simple, the method name/code can present > all information, e.g. method testHasFeature in > DomImplementationTest.java. Please check my update in > http://cr.openjdk.java.net/~fyuan/8051559/webrev.01/ > > > As well, I understand your suggestion about the code comment, I > will think about how to add the comment on the viewpoint of the > other code reader in my future work, thank you! > > Best Regards > > Frank > > *From:*huizhe wang [mailto:huizhe.wang at oracle.com] > *Sent:* Wednesday, April 01, 2015 1:14 PM > *To:* Lance Andersen > *Cc:* Frank Yuan; Core-Libs-Dev; Gustavo Galimberti > *Subject:* Re: Review request for JDK-8051559: JAXP function dom > tests conversion > > Hi Frank, > > I did see the request, just didn't have time to look at it. > > I again agree with Lance, that these tests were written over 10 > years ago, it would be valuable to write down whatever > understanding you gained while converting the tests, same as the > Astro application/test, the goal of each test and how it works > would all be helpful. Basically, it would be nice to add some > comment on @Test. > > I tried the tests. They worked fine with my current build (with > some changes). > > Thanks, > Joe > > On 3/31/2015 7:10 AM, Lance Andersen wrote: > > Hi Frank > > On Mar 31, 2015, at 7:24 AM, Lance @ Oracle > > > wrote: > > > > > Hi frank > > Can you forward the other review request as I think I > thought they were the same and deleted it > > Ignore this comment, the subjects were too similar but this is > what needed reviewed. > > > I will look at this again today > > The tests overall look fine. > > I still have the same comment WRT providing a simple comment > describing each test. The key point to remember is we want to > make it easier for someone to look at the test, understand > what you are trying to validate, and understand the coverage > of the tests. This will help future maintainers of the code. > Comments are just as important in test code as it is in > implementation IMHO. > > Best > > Lance > > > Best > > Lance > > > Lance > Andersen| Principal Member of Technical Staff | > +1.781.442.2037 > Oracle Java Engineering > 1 Network Drive > Burlington, MA 01803 > Lance.Andersen at oracle.com > > Sent from my iPad > > > On Mar 31, 2015, at 4:15 AM, Frank Yuan > > wrote: > > Hi Joe > > > > Do you have any comment for dom suite co-location? > > > > Best Regards > > Frank > > > > From: Frank Yuan [mailto:frank.yuan at oracle.com] > Sent: Wednesday, March 25, 2015 5:46 PM > To: 'huizhe wang'; 'Core-Libs-Dev' > Cc: 'jibing chen'; 'Gustavo Galimberti'; > sandeep.konchady at oracle.com > ; > 'Alexandre (Shura) Iline' > Subject: RE: Review request for JDK-8051559: JAXP > function dom tests > conversion > > > > Hi, Joe and All > > > > We are working on moving internal jaxp functional > tests to open jdk repo. > > This is the dom suite. Would you please review these > test? Any comment will > be appreciated. > > > > bug: https://bugs.openjdk.java.net/browse/JDK-8051559 > > webrev: > http://cr.openjdk.java.net/~fyuan/8051559/webrev.00/ > > > > > Thanks, > > > > Frank > > > > > Lance > Andersen| Principal Member of Technical Staff | +1.781.442.2037 > Oracle Java Engineering > 1 Network Drive > Burlington, MA 01803 > Lance.Andersen at oracle.com > > > > From Alan.Bateman at oracle.com Fri Apr 3 06:47:34 2015 From: Alan.Bateman at oracle.com (Alan Bateman) Date: Fri, 03 Apr 2015 07:47:34 +0100 Subject: RFR: JDK-8076583: move jdk.Exported from langtools to jdk In-Reply-To: <551DD624.4060701@oracle.com> References: <551DD624.4060701@oracle.com> Message-ID: <551E3786.9090005@oracle.com> On 03/04/2015 00:52, Jonathan Gibbons wrote: > Sorry for the relatively wide distribution. > > JDK-8076583 is a conceptually simple cleanup, to move the source file > for the jdk.Exported class from the langtools repo (where it is a > singleton outlier) to the jdk repo (alongside most of the rest of the > classes in the jdk package hierarchy). The class was originally placed > in the langtools repo for bootstrapping reasons that no longer apply. > > As a result of moving the source file, references to java.base in a > number of places in the langtools repo can be cleaned up. > > @Build folk: > There is a trivial change to a makefile in the langtools repo. > > @Core-libs folk: > The source file gets moved into the jdk/ repo. The move looks okay although the new home might be temporary given the design principles in JEP 200 (meaning java.base should not export the jdk API package). -Alan From robbiexgibson at yahoo.com Fri Apr 3 09:33:12 2015 From: robbiexgibson at yahoo.com (Robert Gibson) Date: Fri, 3 Apr 2015 09:33:12 +0000 (UTC) Subject: JDK-8060068/JDK-8067904 DriverManager clean-up introduces bootstrap problem that breaks production drivers Message-ID: <601807605.4331549.1428053592161.JavaMail.yahoo@mail.yahoo.com> Hi there, We are doing some early testing with JDK 9 and have discovered that the changes made to java.sql.DriverManager back in November/December have introduced an incompatibility with our JDBC driver (that we have used unchanged since Java 6) when it is pre-loaded with Class.forName (as recommended by Tomcat and specified as being harmless in the JavaDoc). We filed a bug report but it got an incident ID JI-9019539 and then disappeared into a black hole. In the hope of the problem getting a bit more attention I attach a reproducible test case that is representative of the commercially-available JDBC driver that we use (hint: the name rhymes with MyFace and it's used in a lot of banks). I guess the problem is that the driver is calling DriverManager.getDrivers() as part of its registration process, which is now causing the stack overflow given at the end of this mail, after the code. If you compile the attached files into test.jar and run java -cp test.jar JDBCTest n java -cp test.jar JDBCTest y then the test should print Trying to connect to jdbc:mydriver OK in both cases (as it does with Java 8). When running with Java 9, the second command prints Trying to connect to jdbc:mydriver FAIL No suitable driver found for jdbc:mydriver Hope this is helpful. Regards, Robert JDBCTest.java import java.io.*; import java.sql.*; import java.util.*; public class JDBCTest { public static void main(String... argv) throws Exception { if (argv.length > 1) DriverManager.setLogWriter(new PrintWriter(System.out)); String[] urls = new String[] {"jdbc:mydriver"}; if (argv.length > 0 && argv[0].equals("y")) { loadClass("MyDriver"); } for (String url : urls) { System.out.println("Trying to connect to " + url); try { Connection c = DriverManager.getConnection (url); if (c == null) System.out.println("FAIL"); else System.out.println("OK"); }catch(SQLException e) { System.out.println("FAIL"); System.out.println(e.getMessage()); } } } public static void loadClass(String classname) { try { Class.forName(classname); } catch(ClassNotFoundException e) { System.out.println("Class not found: " + classname); } } } MyDriver.java import java.sql.*; import java.util.Enumeration; import java.util.Properties; import java.util.logging.Logger; public class MyDriver implements java.sql.Driver { static { new MyDriver(); } public MyDriver() { this.registerWithDriverManager(); } public final Connection connect(String url, Properties props) throws SQLException { return acceptsURL(url) ? new MyConnection() : null; } public boolean acceptsURL(String url) throws SQLException { return url.startsWith("jdbc:mydriver"); } public DriverPropertyInfo[] getPropertyInfo(String var1, Properties props) throws SQLException { return null; } public int getMajorVersion() { return 0; } public int getMinorVersion() { return 1; } public boolean jdbcCompliant() { return false; } public Logger getParentLogger() throws SQLFeatureNotSupportedException { throw new SQLFeatureNotSupportedException("No logging for you"); } protected void registerWithDriverManager() { try { synchronized(DriverManager.class) { DriverManager.registerDriver(this); Enumeration e = DriverManager.getDrivers(); while(e.hasMoreElements()) { Driver d = (Driver)e.nextElement(); if(d instanceof MyDriver && d != this) { DriverManager.deregisterDriver(d); } } } } catch (SQLException ex) { } } } MyConnection.java import java.sql.*; import java.util.Map; import java.util.Properties; import java.util.concurrent.Executor; public class MyConnection implements Connection { @Override public Statement createStatement() throws SQLException { return null; } @Override public PreparedStatement prepareStatement(String sql) throws SQLException { return null; } @Override public CallableStatement prepareCall(String sql) throws SQLException { return null; } @Override public String nativeSQL(String sql) throws SQLException { return null; } @Override public void setAutoCommit(boolean autoCommit) throws SQLException { } @Override public boolean getAutoCommit() throws SQLException { return false; } @Override public void commit() throws SQLException { } @Override public void rollback() throws SQLException { } @Override public void close() throws SQLException { } @Override public boolean isClosed() throws SQLException { return false; } @Override public DatabaseMetaData getMetaData() throws SQLException { return null; } @Override public void setReadOnly(boolean readOnly) throws SQLException { } @Override public boolean isReadOnly() throws SQLException { return false; } @Override public void setCatalog(String catalog) throws SQLException { } @Override public String getCatalog() throws SQLException { return null; } @Override public void setTransactionIsolation(int level) throws SQLException { } @Override public int getTransactionIsolation() throws SQLException { return 0; } @Override public SQLWarning getWarnings() throws SQLException { return null; } @Override public void clearWarnings() throws SQLException { } @Override public Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException { return null; } @Override public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLException { return null; } @Override public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException { return null; } @Override public Map> getTypeMap() throws SQLException { return null; } @Override public void setTypeMap(Map> map) throws SQLException { } @Override public void setHoldability(int holdability) throws SQLException { } @Override public int getHoldability() throws SQLException { return 0; } @Override public Savepoint setSavepoint() throws SQLException { return null; } @Override public Savepoint setSavepoint(String name) throws SQLException { return null; } @Override public void rollback(Savepoint savepoint) throws SQLException { } @Override public void releaseSavepoint(Savepoint savepoint) throws SQLException { } @Override public Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException { return null; } @Override public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException { return null; } @Override public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException { return null; } @Override public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) throws SQLException { return null; } @Override public PreparedStatement prepareStatement(String sql, int[] columnIndexes) throws SQLException { return null; } @Override public PreparedStatement prepareStatement(String sql, String[] columnNames) throws SQLException { return null; } @Override public Clob createClob() throws SQLException { return null; } @Override public Blob createBlob() throws SQLException { return null; } @Override public NClob createNClob() throws SQLException { return null; } @Override public SQLXML createSQLXML() throws SQLException { return null; } @Override public boolean isValid(int timeout) throws SQLException { return false; } @Override public void setClientInfo(String name, String value) throws SQLClientInfoException { } @Override public void setClientInfo(Properties properties) throws SQLClientInfoException { } @Override public String getClientInfo(String name) throws SQLException { return null; } @Override public Properties getClientInfo() throws SQLException { return null; } @Override public Array createArrayOf(String typeName, Object[] elements) throws SQLException { return null; } @Override public Struct createStruct(String typeName, Object[] attributes) throws SQLException { return null; } @Override public void setSchema(String schema) throws SQLException { } @Override public String getSchema() throws SQLException { return null; } @Override public void abort(Executor executor) throws SQLException { } @Override public void setNetworkTimeout(Executor executor, int milliseconds) throws SQLException { } @Override public int getNetworkTimeout() throws SQLException { return 0; } @Override public T unwrap(Class iface) throws SQLException { return null; } @Override public boolean isWrapperFor(Class iface) throws SQLException { return false; } } Stack overflow (recursive call to new MyDriver()) [1] MyDriver.registerWithDriverManager (MyDriver.java:47) [2] MyDriver. (MyDriver.java:12) [3] sun.reflect.NativeConstructorAccessorImpl.newInstance0 (native method) [4] sun.reflect.NativeConstructorAccessorImpl.newInstance (NativeConstructorAccessorImpl.java:62) [5] sun.reflect.DelegatingConstructorAccessorImpl.newInstance (DelegatingConstructorAccessorImpl.java:45) [6] java.lang.reflect.Constructor.newInstance (Constructor.java:425) [7] java.lang.Class.newInstance (Class.java:464) [8] java.util.ServiceLoader$LazyIterator.nextService (ServiceLoader.java:378) [9] java.util.ServiceLoader$LazyIterator.next (ServiceLoader.java:402) [10] java.util.ServiceLoader$1.next (ServiceLoader.java:478) [11] java.sql.DriverManager$2.run (DriverManager.java:614) [12] java.sql.DriverManager$2.run (DriverManager.java:594) [13] java.security.AccessController.doPrivileged (native method) [14] java.sql.DriverManager.ensureDriversInitialized (DriverManager.java:594) [15] java.sql.DriverManager.getDrivers (DriverManager.java:437) [16] MyDriver.registerWithDriverManager (MyDriver.java:47) [17] MyDriver. (MyDriver.java:12) [18] MyDriver. (MyDriver.java:8) [19] java.lang.Class.forName0 (native method) [20] java.lang.Class.forName (Class.java:286) [21] JDBCTest.loadClass (JDBCTest.java:28) [22] JDBCTest.main (JDBCTest.java:12) From chris.hegarty at oracle.com Fri Apr 3 09:57:07 2015 From: chris.hegarty at oracle.com (Chris Hegarty) Date: Fri, 3 Apr 2015 10:57:07 +0100 Subject: 8076442: Cannot fully read BitSet.stream() if bit Integer.MAX_VALUE is set Message-ID: <3FB8B370-68C6-414D-B157-99999DC2549C@oracle.com> This is a request for review for a small change to address 8076442 [1]. Seems to be a day one bug in the internal BitSetIterator, for a boundary condition when the Integer.MAX_VALUE bit is set. The change to the iterator, and test, is in line with the advise in BitSet.nextSetBit(int) ( break/terminate processing after reaching an index of Integer.MAX_VALUE ). http://cr.openjdk.java.net/~chegar/8076442/webrev/ -Chris. [1] https://bugs.openjdk.java.net/browse/JDK-8076442 From Alan.Bateman at oracle.com Fri Apr 3 11:04:05 2015 From: Alan.Bateman at oracle.com (Alan Bateman) Date: Fri, 03 Apr 2015 12:04:05 +0100 Subject: JDK-8060068/JDK-8067904 DriverManager clean-up introduces bootstrap problem that breaks production drivers In-Reply-To: <601807605.4331549.1428053592161.JavaMail.yahoo@mail.yahoo.com> References: <601807605.4331549.1428053592161.JavaMail.yahoo@mail.yahoo.com> Message-ID: <551E73A5.70704@oracle.com> On 03/04/2015 10:33, Robert Gibson wrote: > Hi there, > > We are doing some early testing with JDK 9 and have discovered that the changes made to java.sql.DriverManager back in November/December have introduced an incompatibility with our JDBC driver (that we have used unchanged since Java 6) when it is pre-loaded with Class.forName (as recommended by Tomcat and specified as being harmless in the JavaDoc). We filed a bug report but it got an incident ID JI-9019539 and then disappeared into a black hole. > There does appear to be an issue with those changes. I've located the incident and moved it to the JDK project as JDK-8076639 [1]. -Alan [1] https://bugs.openjdk.java.net/browse/JDK-8076639 From Alan.Bateman at oracle.com Fri Apr 3 11:28:01 2015 From: Alan.Bateman at oracle.com (Alan Bateman) Date: Fri, 03 Apr 2015 12:28:01 +0100 Subject: 8076442: Cannot fully read BitSet.stream() if bit Integer.MAX_VALUE is set In-Reply-To: <3FB8B370-68C6-414D-B157-99999DC2549C@oracle.com> References: <3FB8B370-68C6-414D-B157-99999DC2549C@oracle.com> Message-ID: <551E7941.2090708@oracle.com> On 03/04/2015 10:57, Chris Hegarty wrote: > This is a request for review for a small change to address 8076442 [1]. > > Seems to be a day one bug in the internal BitSetIterator, for a boundary condition when the Integer.MAX_VALUE bit is set. The change to the iterator, and test, is in line with the advise in BitSet.nextSetBit(int) ( break/terminate processing after reaching an index of Integer.MAX_VALUE ). > > http://cr.openjdk.java.net/~chegar/8076442/webrev/ > This looks okay to me, easily to over look this case. -Alan. From robbiexgibson at yahoo.com Fri Apr 3 12:07:42 2015 From: robbiexgibson at yahoo.com (Robert Gibson) Date: Fri, 3 Apr 2015 12:07:42 +0000 (UTC) Subject: JDK-8060068/JDK-8067904 DriverManager clean-up introduces bootstrap problem that breaks production drivers In-Reply-To: <551E73A5.70704@oracle.com> References: <551E73A5.70704@oracle.com> Message-ID: <564412785.4394192.1428062862423.JavaMail.yahoo@mail.yahoo.com> Thanks Alan,Note that the repro given in my mail is a bit simpler than the current defect description, especially if you don't have access to the "MyFace"?JDBC driver.Regards,Robert On Friday, 3 April 2015, 13:04, Alan Bateman wrote: On 03/04/2015 10:33, Robert Gibson wrote: > Hi there, > > We are doing some early testing with JDK 9 and have discovered that the changes made to java.sql.DriverManager back in November/December have introduced an incompatibility with our JDBC driver (that we have used unchanged since Java 6) when it is pre-loaded with Class.forName (as recommended by Tomcat and specified as being harmless in the JavaDoc). We filed a bug report but it got an incident ID JI-9019539 and then disappeared into a black hole. > There does appear to be an issue with those changes. I've located the incident and moved it to the JDK project as JDK-8076639 [1]. -Alan [1] https://bugs.openjdk.java.net/browse/JDK-8076639 From pavel.rappo at oracle.com Fri Apr 3 13:20:12 2015 From: pavel.rappo at oracle.com (Pavel Rappo) Date: Fri, 3 Apr 2015 14:20:12 +0100 Subject: JEP 110 HTTP 2 client API In-Reply-To: References: <551ACBFA.7040304@oracle.com> Message-ID: Hi Kasper, I assume your questions are all about WebSocket part, right? If so, then > 1) > Would it possible to add a connect timeout parameter. > builder.setConnectTimeout(long timeout, TimeUnit unit) > > For some reason it was left out of the javax.websocket API. And working > around it is a serious PITA. What's the purpose of this timeout? Could you please explain it a bit more? > 2) > Rename Websocket to WebsocketClient to avoid people thinking you can use it > server side? Makes sense. I would also change following methods' names: java.net.WebSocket#create(java.net.URI) java.net.WebSocket#create(java.net.HttpClient, java.net.URI) as they create a _builder_, not a WebSocket, which a bit misleading in my opinion. > 3) > How is the threading done for something like asynchronous connect? Let's wait for Michael to reply. But I suppose it'll be a non-blocking selector-based nio thing running by worker threads from java.net.HttpClient#executorService (I might be mistaken) > 4) > I find the use of byte[] vs ByteBuffer a bit inconsistent. > For example, HttpResponseBodyProcessor uses ByteBuffer while > WebSocketMessage uses byte[] I believe this is done solely for simplicity. HttpClient is a more "general purpose" kind of thing. -Pavel From chris.hegarty at oracle.com Fri Apr 3 14:28:48 2015 From: chris.hegarty at oracle.com (Chris Hegarty) Date: Fri, 3 Apr 2015 15:28:48 +0100 Subject: JEP 110 HTTP 2 client API In-Reply-To: References: <551ACBFA.7040304@oracle.com> Message-ID: <188B16D8-29FC-4BF4-944F-0F076AA01C3C@oracle.com> On 3 Apr 2015, at 14:20, Pavel Rappo wrote: > Hi Kasper, > > I assume your questions are all about WebSocket part, right? If so, then > >> 1) >> Would it possible to add a connect timeout parameter. >> builder.setConnectTimeout(long timeout, TimeUnit unit) >> >> For some reason it was left out of the javax.websocket API. And working >> around it is a serious PITA. > > What's the purpose of this timeout? Could you please explain it a bit more? As with any API that deals with underlying socket connect, read, write, there should be some configurable way to set a time for the reply, or availability of system resources. -Chris. From mandy.chung at oracle.com Fri Apr 3 14:47:49 2015 From: mandy.chung at oracle.com (Mandy Chung) Date: Fri, 03 Apr 2015 07:47:49 -0700 Subject: RFR: JDK-8076583: move jdk.Exported from langtools to jdk In-Reply-To: <551DD624.4060701@oracle.com> References: <551DD624.4060701@oracle.com> Message-ID: <551EA815.4010408@oracle.com> On 4/2/2015 4:52 PM, Jonathan Gibbons wrote: > Sorry for the relatively wide distribution. > > JDK-8076583 is a conceptually simple cleanup, to move the source file > for the jdk.Exported class from the langtools repo (where it is a > singleton outlier) to the jdk repo (alongside most of the rest of the > classes in the jdk package hierarchy). The class was originally placed > in the langtools repo for bootstrapping reasons that no longer apply. > > As a result of moving the source file, references to java.base in a > number of places in the langtools repo can be cleaned up. > > @Build folk: > There is a trivial change to a makefile in the langtools repo. > > @Core-libs folk: > The source file gets moved into the jdk/ repo. > > @Compiler-dev folk: > We can remove references to the java.base folder from the private Ant > build, and from IDE support files. > > JBS: https://bugs.openjdk.java.net/browse/JDK-8076583 > Webrev: http://cr.openjdk.java.net/~jjg/8076583/webrev.00/ Moving jdk.Exported to jdk repo is fine. Mandy From chris.hegarty at oracle.com Fri Apr 3 15:03:05 2015 From: chris.hegarty at oracle.com (Chris Hegarty) Date: Fri, 3 Apr 2015 16:03:05 +0100 Subject: RFR [9] 8071474: Better failure atomicity for default read object In-Reply-To: References: <550B3F21.6020206@oracle.com> <550C2979.9090407@gmail.com> Message-ID: <0DF0A6D7-2CC8-4A45-9B65-63C5BFD5F848@oracle.com> Peter, Some more thought is needed in that area of the field setter API. If there are no strong objections, then I?d like to proceed with this version of better failure atomicity, and follow up as needed. -Chris. On 20 Mar 2015, at 16:30, Chris Hegarty wrote: > Hi Peter, > > On 20 Mar 2015, at 14:06, Peter Levart wrote: > >> On 03/19/2015 10:26 PM, Chris Hegarty wrote: >>> The current implementation of defaultReadObject sets non-primitive field values one at a time, without first checking that all their types are assignable. If, for example, the assignment of the last non-primitive value fails, a CCE is thrown, and the previously set fields remain set. The setting of field values, including primitives, can be deferred until after they have been "validated", at a minimum that the non-primitive types are assignable. This is achievable per Class in the hierarchy up until the first user visible affect, i.e. a readObject(NoData) method. Either all fields will be set, or contain their default values. >>> >>> http://cr.openjdk.java.net/~chegar/8071474/webrev.00/webrev/ >>> >>> I think there are further improvements that can be made in this area, but I would like to move things forward incrementally. >>> >>> -Chris. >> >> Hi Chris, >> >> I'd just ask you a few questions to confirm my understanding of the code: >> >> In ObjectInputStream: >> >> 1886 // Best effort Failure Atomicity; Each element in 'slotFieldValues' >> 1887 // contains the stream field values for the same element in 'slots', >> 1888 // up to the first slot with a readObject(NoData) method ( a user >> 1889 // visible effect ). >> 1890 int index = 1; >> 1891 for (; index < slots.length; index++) { >> 1892 ObjectStreamClass slotDesc = slots[index].desc; >> 1893 if (slotDesc.hasReadObjectMethod() >> 1894 || slotDesc.hasReadObjectNoDataMethod()) { >> 1895 break; >> 1896 } >> 1897 } >> 1898 // Store, and defer setting, values for index slots, ignore if just one. >> 1899 StreamFieldValues[] slotFieldValues = null; >> 1900 if (index > 1 && obj != null) >> 1901 slotFieldValues = new StreamFieldValues[index]; >> >> >> ...you scan slots starting from 1 and up. Is this because slots[0] is an uninteresting slot that belongs to j.l.Object class? > > No. I should have explained. > > From ObjectStreamClass.getClassDataLayout: > * Returns array of ClassDataSlot instances representing the data layout > * (including superclass data) for serialized objects described by this > * class descriptor. ClassDataSlots are ordered by inheritance with those > * containing "higher" superclasses appearing first. The final > * ClassDataSlot contains a reference to this descriptor. > > ? so slots contains entries for only Serializable types in the hierarchy, and from superclass down. > > The first entry can be skipped as its stream field values will always be read, checked, and then set, regardless of anything else in the hierarchy ( as you can see I split defaultReadFields so that is now only reads stream field vales, and they can then be ?checked?, and set separately). It only becomes ?interesting" when there are more than one level of Serializable type in the hierarchy. > >> In this loop, you scan slots from 0 and up. Is this to catch corrupted streams that contain data for Object slot? >> >> 1971 /** Sets slot field values in the given obj. */ >> 1972 private void setSlotFieldValues(Object obj, >> 1973 ObjectStreamClass.ClassDataSlot[] slots, >> 1974 StreamFieldValues[] slotFieldValues) { >> 1975 int length = slotFieldValues.length; >> 1976 for (int i = 0; i < length; i++) { >> 1977 if (slotFieldValues[i] != null) >> 1978 defaultSetFieldValues(obj, slots[i].desc, slotFieldValues[i]); >> 1979 } >> 1980 } > > All slots can contain field values, so they will need to be set. Note to self: I need to verify that this is ok when a slot has no data ( let me check ). > >> I agree that this is an incremental improvement. You buffer values read from stream, check their types and delay setting them in particular class slots for classes not declaring readObject[NoData] methods (or a span of slots in hierarchy ranging from Object to one before the class that declares readObject[NoData] method) which guarantees either success or atomic failure. > > Right. Almost everything can be delayed until the first observable effect, i.e. a readObject[NoData]. Fields from non-Serializable types in the hierarchy will remain set, as per the default no-args constructor. > >> But have you considered a strategy that we discussed before where you would allow gradual building of state in object being deserialized and in case this fails anywhere (even in class slots declaring readObject[NoData] method), you roll-back the state (setting fields to default values) in all class slots from the one throwing an exception down to the 1st non-Serializable superclass (or Object). This would cover failure atomicity for the whole object, not just the slots not declaring readObject[NoData] methods. The premise is that deserialization starts with an uninitialized object (just class slots from 1st non-Serializable superclass down to Object are initialized by default accessible constructor). So rolling back the object to this state can be achieved by setting all instance fields of Serializable class slots to default values. A package-private FieldSetterContext.FieldsMap could be reused for this purpose (by adding a resetAllFields(Object obj) method). The FieldsMap instance is obtainable from ObjectStreamClass.getFieldAccessMap() which caches it (although internal, these type and method need renaming). > > I agree with this. I think it could be built on top of this work. In many cases the reset/rollback can be completely avoided, but in the case where a readObject throws an Exception then the rollback could be triggered. It will really come down to code complexity whether this proposal adds value, when the rollback/reset is implemented. > >> If you think this is a promising alternative to your failure atomicity proposal, I volunteer to add resetAllFields() method. I understand that this can only be added as part or on the top of FieldSetter API proposal. > > I certainly think it is worth exploring, and I will help with that myself. We can explore this in the sandbox ( where the FieldSetter API exists ), maybe a branch off serial-exp-branch ? > > I would like to move the FieldSetter API forward separate to this effort. I will send mail on that later today to see if we can finalize/agree final API wording. > > -Chris. > >> Regards, Peter >> > From aleksej.efimov at oracle.com Fri Apr 3 15:20:58 2015 From: aleksej.efimov at oracle.com (Aleksej Efimov) Date: Fri, 03 Apr 2015 18:20:58 +0300 Subject: RFR: 8076549: Update JAX-WS RI integration to latest version (2.2.11-b150402.1412) Message-ID: <551EAFDA.3020809@oracle.com> Hello, Can I have a review for a JDK9 bulk update of JAX-B/WS from upstream projects. Webrev: http://cr.openjdk.java.net/~aefimov/8076549/9/00/ More details in issue description: https://bugs.openjdk.java.net/browse/JDK-8076549 Thank you, Aleksej From jan.lahoda at oracle.com Fri Apr 3 17:34:17 2015 From: jan.lahoda at oracle.com (Jan Lahoda) Date: Fri, 03 Apr 2015 19:34:17 +0200 Subject: RFR: JDK-8076583: move jdk.Exported from langtools to jdk In-Reply-To: <551DD624.4060701@oracle.com> References: <551DD624.4060701@oracle.com> Message-ID: <551ECF19.70305@oracle.com> On 3.4.2015 01:52, Jonathan Gibbons wrote: > Sorry for the relatively wide distribution. > > JDK-8076583 is a conceptually simple cleanup, to move the source file > for the jdk.Exported class from the langtools repo (where it is a > singleton outlier) to the jdk repo (alongside most of the rest of the > classes in the jdk package hierarchy). The class was originally placed > in the langtools repo for bootstrapping reasons that no longer apply. > > As a result of moving the source file, references to java.base in a > number of places in the langtools repo can be cleaned up. > > @Build folk: > There is a trivial change to a makefile in the langtools repo. > > @Core-libs folk: > The source file gets moved into the jdk/ repo. > > @Compiler-dev folk: > We can remove references to the java.base folder from the private Ant > build, and from IDE support files. These changes seem fine to me. I am not that big expert on the IntelliJ support, though. Jan > > JBS: https://bugs.openjdk.java.net/browse/JDK-8076583 > Webrev: http://cr.openjdk.java.net/~jjg/8076583/webrev.00/ > > -- Jon From peter.levart at gmail.com Fri Apr 3 20:02:25 2015 From: peter.levart at gmail.com (Peter Levart) Date: Fri, 03 Apr 2015 22:02:25 +0200 Subject: RFR [9] 8071474: Better failure atomicity for default read object In-Reply-To: <0DF0A6D7-2CC8-4A45-9B65-63C5BFD5F848@oracle.com> References: <550B3F21.6020206@oracle.com> <550C2979.9090407@gmail.com> <0DF0A6D7-2CC8-4A45-9B65-63C5BFD5F848@oracle.com> Message-ID: <551EF1D1.6000502@gmail.com> On 04/03/2015 05:03 PM, Chris Hegarty wrote: > Peter, > > Some more thought is needed in that area of the field setter API. If there are no strong objections, then I?d like to proceed with this version of better failure atomicity, and follow up as needed. > > -Chris. I agree. We can revisit this later if needed. Regards, Peter > On 20 Mar 2015, at 16:30, Chris Hegarty wrote: > >> Hi Peter, >> >> On 20 Mar 2015, at 14:06, Peter Levart wrote: >> >>> On 03/19/2015 10:26 PM, Chris Hegarty wrote: >>>> The current implementation of defaultReadObject sets non-primitive field values one at a time, without first checking that all their types are assignable. If, for example, the assignment of the last non-primitive value fails, a CCE is thrown, and the previously set fields remain set. The setting of field values, including primitives, can be deferred until after they have been "validated", at a minimum that the non-primitive types are assignable. This is achievable per Class in the hierarchy up until the first user visible affect, i.e. a readObject(NoData) method. Either all fields will be set, or contain their default values. >>>> >>>> http://cr.openjdk.java.net/~chegar/8071474/webrev.00/webrev/ >>>> >>>> I think there are further improvements that can be made in this area, but I would like to move things forward incrementally. >>>> >>>> -Chris. >>> Hi Chris, >>> >>> I'd just ask you a few questions to confirm my understanding of the code: >>> >>> In ObjectInputStream: >>> >>> 1886 // Best effort Failure Atomicity; Each element in 'slotFieldValues' >>> 1887 // contains the stream field values for the same element in 'slots', >>> 1888 // up to the first slot with a readObject(NoData) method ( a user >>> 1889 // visible effect ). >>> 1890 int index = 1; >>> 1891 for (; index < slots.length; index++) { >>> 1892 ObjectStreamClass slotDesc = slots[index].desc; >>> 1893 if (slotDesc.hasReadObjectMethod() >>> 1894 || slotDesc.hasReadObjectNoDataMethod()) { >>> 1895 break; >>> 1896 } >>> 1897 } >>> 1898 // Store, and defer setting, values for index slots, ignore if just one. >>> 1899 StreamFieldValues[] slotFieldValues = null; >>> 1900 if (index > 1 && obj != null) >>> 1901 slotFieldValues = new StreamFieldValues[index]; >>> >>> >>> ...you scan slots starting from 1 and up. Is this because slots[0] is an uninteresting slot that belongs to j.l.Object class? >> No. I should have explained. >> >> From ObjectStreamClass.getClassDataLayout: >> * Returns array of ClassDataSlot instances representing the data layout >> * (including superclass data) for serialized objects described by this >> * class descriptor. ClassDataSlots are ordered by inheritance with those >> * containing "higher" superclasses appearing first. The final >> * ClassDataSlot contains a reference to this descriptor. >> >> ? so slots contains entries for only Serializable types in the hierarchy, and from superclass down. >> >> The first entry can be skipped as its stream field values will always be read, checked, and then set, regardless of anything else in the hierarchy ( as you can see I split defaultReadFields so that is now only reads stream field vales, and they can then be ?checked?, and set separately). It only becomes ?interesting" when there are more than one level of Serializable type in the hierarchy. >> >>> In this loop, you scan slots from 0 and up. Is this to catch corrupted streams that contain data for Object slot? >>> >>> 1971 /** Sets slot field values in the given obj. */ >>> 1972 private void setSlotFieldValues(Object obj, >>> 1973 ObjectStreamClass.ClassDataSlot[] slots, >>> 1974 StreamFieldValues[] slotFieldValues) { >>> 1975 int length = slotFieldValues.length; >>> 1976 for (int i = 0; i < length; i++) { >>> 1977 if (slotFieldValues[i] != null) >>> 1978 defaultSetFieldValues(obj, slots[i].desc, slotFieldValues[i]); >>> 1979 } >>> 1980 } >> All slots can contain field values, so they will need to be set. Note to self: I need to verify that this is ok when a slot has no data ( let me check ). >> >>> I agree that this is an incremental improvement. You buffer values read from stream, check their types and delay setting them in particular class slots for classes not declaring readObject[NoData] methods (or a span of slots in hierarchy ranging from Object to one before the class that declares readObject[NoData] method) which guarantees either success or atomic failure. >> Right. Almost everything can be delayed until the first observable effect, i.e. a readObject[NoData]. Fields from non-Serializable types in the hierarchy will remain set, as per the default no-args constructor. >> >>> But have you considered a strategy that we discussed before where you would allow gradual building of state in object being deserialized and in case this fails anywhere (even in class slots declaring readObject[NoData] method), you roll-back the state (setting fields to default values) in all class slots from the one throwing an exception down to the 1st non-Serializable superclass (or Object). This would cover failure atomicity for the whole object, not just the slots not declaring readObject[NoData] methods. The premise is that deserialization starts with an uninitialized object (just class slots from 1st non-Serializable superclass down to Object are initialized by default accessible constructor). So rolling back the object to this state can be achieved by setting all instance fields of Serializable class slots to default values. A package-private FieldSetterContext.FieldsMap could be reused for this purpose (by adding a resetAllFields(Object obj) method). The FieldsMap instance is obtainable from ObjectStreamClass.getFieldAccessMap() which caches it (although internal, these type and method need renaming). >> I agree with this. I think it could be built on top of this work. In many cases the reset/rollback can be completely avoided, but in the case where a readObject throws an Exception then the rollback could be triggered. It will really come down to code complexity whether this proposal adds value, when the rollback/reset is implemented. >> >>> If you think this is a promising alternative to your failure atomicity proposal, I volunteer to add resetAllFields() method. I understand that this can only be added as part or on the top of FieldSetter API proposal. >> I certainly think it is worth exploring, and I will help with that myself. We can explore this in the sandbox ( where the FieldSetter API exists ), maybe a branch off serial-exp-branch ? >> >> I would like to move the FieldSetter API forward separate to this effort. I will send mail on that later today to see if we can finalize/agree final API wording. >> >> -Chris. >> >>> Regards, Peter >>> From tim.bell at oracle.com Fri Apr 3 20:14:43 2015 From: tim.bell at oracle.com (Tim Bell) Date: Fri, 03 Apr 2015 13:14:43 -0700 Subject: RFR: JDK-8076583: move jdk.Exported from langtools to jdk In-Reply-To: <551DD624.4060701@oracle.com> References: <551DD624.4060701@oracle.com> Message-ID: <551EF4B3.6080904@oracle.com> > @Build folk: > There is a trivial change to a makefile in the langtools repo. Looks good to me. Tim On 04/02/15 16:52, Jonathan Gibbons wrote: > Sorry for the relatively wide distribution. > > JDK-8076583 is a conceptually simple cleanup, to move the source file > for the jdk.Exported class from the langtools repo (where it is a > singleton outlier) to the jdk repo (alongside most of the rest of the > classes in the jdk package hierarchy). The class was originally placed > in the langtools repo for bootstrapping reasons that no longer apply. > > As a result of moving the source file, references to java.base in a > number of places in the langtools repo can be cleaned up. > > @Build folk: > There is a trivial change to a makefile in the langtools repo. > > @Core-libs folk: > The source file gets moved into the jdk/ repo. > > @Compiler-dev folk: > We can remove references to the java.base folder from the private Ant > build, and from IDE support files. > > JBS: https://bugs.openjdk.java.net/browse/JDK-8076583 > Webrev: http://cr.openjdk.java.net/~jjg/8076583/webrev.00/ > > -- Jon From huizhe.wang at oracle.com Fri Apr 3 21:41:51 2015 From: huizhe.wang at oracle.com (huizhe wang) Date: Fri, 03 Apr 2015 14:41:51 -0700 Subject: Review request for JDK-8051559: JAXP function dom tests conversion In-Reply-To: <00ea01d06dcc$ad683cb0$0838b610$@oracle.com> References: <035701d066e0$93124560$b936d020$@oracle.com> <019b01d06b8a$da0abca0$8e2035e0$@oracle.com> <0E4D09A9-8046-42AC-98B8-D2433A8D38FF@oracle.com> <551B7E99.9050406@oracle.com> <034b01d06c6b$451b6c70$cf524550$@oracle.com> <551DF4B3.6020508@oracle.com> <00c001d06dbe$97323c10$c596b430$@oracle.com> <551E1416.4000208@oracle.com> <00ea01d06dcc$ad683cb0$0838b610$@oracle.com> Message-ID: <551F091F.5000203@oracle.com> On 4/2/2015 10:11 PM, Frank Yuan wrote: > > Yes, understand, thank you very much! I will follow this rule you > talked in future! > > Well, since current code is ok for you, would you like to be my > sponsor to push the code? > Will do once Lance finishes the review. Best, Joe > Best Regards > > Frank > > *From:*huizhe wang [mailto:huizhe.wang at oracle.com] > *Sent:* Friday, April 03, 2015 12:16 PM > *To:* Frank Yuan > *Cc:* 'Lance Andersen'; 'Core-Libs-Dev'; 'Gustavo Galimberti' > *Subject:* Re: Review request for JDK-8051559: JAXP function dom tests > conversion > > Hi Frank, > > Looks good. With regard to a test being too simple or > straightforward, it can be subjective. I mean, what are easy to the > author/you may not for others who don't have the knowledge on the > particular subject matter. So it's always good to leave comments when > you are there. It's also helpful for the author/you to remember what's > done and why should you revisit them. > > Cheers, > Joe > > On 4/2/2015 8:30 PM, Frank Yuan wrote: > > Hi Joe > > Thank you for your comments, I have updated at > http://cr.openjdk.java.net/~fyuan/8051559/webrev.02/ > > > Please also check my comments in line below > > Best Regards > > Frank > > *From:*huizhe wang [mailto:huizhe.wang at oracle.com] > *Sent:* Friday, April 03, 2015 10:02 AM > *To:* Frank Yuan > *Cc:* 'Lance Andersen'; 'Core-Libs-Dev'; 'Gustavo Galimberti' > *Subject:* Re: Review request for JDK-8051559: JAXP function dom > tests conversion > > DocumentTest->testCreateElementNeg, the conversion seems to be > incorrect. The original test, as the Javadoc stated, "This checks > for the constuctor of DOMException ". The new test however, only > verifies that an Exception is thrown. > > //I moved a part of original DomExcpTestas testCreateElementNeg > into DocumentTest, and write some code for DOMException, but as > you known, class DOMException is so simple, JCK test has covered > what I/original DomExcpTest test, Shura suggested me to remove > this test from ours, then I did as his comment. > > > > Comments for tests such as testCreateAttributeNSNeg can be more > descriptive, for example, "Test for createAttributeNS method: > verifies that DOMException is thrown if reserved prefixes are used > with an arbitrary namespace name." > > //Modified the comments to be more descriptive as your example on > the similar cases. > > > > The original tests that made up DocumentTypeTest had comments that > you may want to copy over or rewrite as you did other tests. > > //Because I thought this test is so straightforward, I didn't add > comment for it. However, I added comments as your suggestion. > > > > The comment for EntityChildTest can be "Test DOM Parser: parsing > an xml file that contains external entities." > > //changed the comment > > > > NodeListTest: @summary Verifies a bug found in jaxp1.0.1 and > 1.1FCS. After going out of bound, the last element of a NodeList > returns null. The bug has been fixed in jaxp 1.1.1 build. > > //changed the comment > > > > Thanks, > Joe > > On 4/1/2015 4:01 AM, Frank Yuan wrote: > > Hi Joe and Lance > > Many thanks for your review and comments! > > I have added the comments to the tests as your suggestions > except some test method is very simple, the method name/code > can present all information, e.g. method testHasFeature in > DomImplementationTest.java. Please check my update in > http://cr.openjdk.java.net/~fyuan/8051559/webrev.01/ > > > As well, I understand your suggestion about the code comment, > I will think about how to add the comment on the viewpoint of > the other code reader in my future work, thank you! > > Best Regards > > Frank > > *From:*huizhe wang [mailto:huizhe.wang at oracle.com] > *Sent:* Wednesday, April 01, 2015 1:14 PM > *To:* Lance Andersen > *Cc:* Frank Yuan; Core-Libs-Dev; Gustavo Galimberti > *Subject:* Re: Review request for JDK-8051559: JAXP function > dom tests conversion > > Hi Frank, > > I did see the request, just didn't have time to look at it. > > I again agree with Lance, that these tests were written over > 10 years ago, it would be valuable to write down whatever > understanding you gained while converting the tests, same as > the Astro application/test, the goal of each test and how it > works would all be helpful. Basically, it would be nice to add > some comment on @Test. > > I tried the tests. They worked fine with my current build > (with some changes). > > Thanks, > Joe > > On 3/31/2015 7:10 AM, Lance Andersen wrote: > > Hi Frank > > On Mar 31, 2015, at 7:24 AM, Lance @ Oracle > > wrote: > > > > > > Hi frank > > Can you forward the other review request as I think I > thought they were the same and deleted it > > Ignore this comment, the subjects were too similar but > this is what needed reviewed. > > > > I will look at this again today > > The tests overall look fine. > > I still have the same comment WRT providing a simple > comment describing each test. The key point to remember > is we want to make it easier for someone to look at the > test, understand what you are trying to validate, and > understand the coverage of the tests. This will help > future maintainers of the code. Comments are just as > important in test code as it is in implementation IMHO. > > Best > > Lance > > > > Best > > Lance > > > Lance > Andersen| Principal Member of Technical Staff | > +1.781.442.2037 > Oracle Java Engineering > 1 Network Drive > Burlington, MA 01803 > Lance.Andersen at oracle.com > > > Sent from my iPad > > > On Mar 31, 2015, at 4:15 AM, Frank Yuan > > > wrote: > > Hi Joe > > > > Do you have any comment for dom suite co-location? > > > > Best Regards > > Frank > > > > From: Frank Yuan [mailto:frank.yuan at oracle.com] > Sent: Wednesday, March 25, 2015 5:46 PM > To: 'huizhe wang'; 'Core-Libs-Dev' > Cc: 'jibing chen'; 'Gustavo Galimberti'; > sandeep.konchady at oracle.com > ; > 'Alexandre (Shura) Iline' > Subject: RE: Review request for JDK-8051559: JAXP > function dom tests > conversion > > > > Hi, Joe and All > > > > We are working on moving internal jaxp functional > tests to open jdk repo. > > This is the dom suite. Would you please review > these test? Any comment will > be appreciated. > > > > bug: https://bugs.openjdk.java.net/browse/JDK-8051559 > > webrev: > http://cr.openjdk.java.net/~fyuan/8051559/webrev.00/ > > > > > Thanks, > > > > Frank > > > > > Lance > Andersen| Principal Member of Technical Staff | > +1.781.442.2037 > Oracle Java Engineering > 1 Network Drive > Burlington, MA 01803 > Lance.Andersen at oracle.com > > > > > From henry.jen at oracle.com Fri Apr 3 22:01:33 2015 From: henry.jen at oracle.com (Henry Jen) Date: Fri, 03 Apr 2015 15:01:33 -0700 Subject: 8076442: Cannot fully read BitSet.stream() if bit Integer.MAX_VALUE is set In-Reply-To: <3FB8B370-68C6-414D-B157-99999DC2549C@oracle.com> References: <3FB8B370-68C6-414D-B157-99999DC2549C@oracle.com> Message-ID: <551F0DBD.8050200@oracle.com> Looks fine to me, thanks for taking care of it. Cheers, Henry On 04/03/2015 02:57 AM, Chris Hegarty wrote: > This is a request for review for a small change to address 8076442 [1]. > > Seems to be a day one bug in the internal BitSetIterator, for a boundary condition when the Integer.MAX_VALUE bit is set. The change to the iterator, and test, is in line with the advise in BitSet.nextSetBit(int) ( break/terminate processing after reaching an index of Integer.MAX_VALUE ). > > http://cr.openjdk.java.net/~chegar/8076442/webrev/ > > -Chris. > > [1] https://bugs.openjdk.java.net/browse/JDK-8076442 > From xueming.shen at oracle.com Fri Apr 3 22:24:15 2015 From: xueming.shen at oracle.com (Xueming Shen) Date: Fri, 03 Apr 2015 15:24:15 -0700 Subject: RFR JDK-8076641: getNextEntry throws ArrayIndexOutOfBoundsException when unzipping file Message-ID: <551F130F.5010009@oracle.com> Hi, Please help review the changeset for issue: https://bugs.openjdk.java.net/browse/JDK-8076641 webrev: http://cr.openjdk.java.net/~sherman/8076641/webrev/ It appears there is zip tool over there that purposely doesn't generate the complete NTFS timestamp in loc table (while it does generate the correct one in cen header), probably to save some bytes. The proposed change here is to simply ignore those "data blocks" during extra data parsing, if no enough valid data embedded. Thanks, Sherman From lance.andersen at oracle.com Sat Apr 4 01:49:04 2015 From: lance.andersen at oracle.com (Lance Andersen) Date: Fri, 3 Apr 2015 21:49:04 -0400 Subject: Review request for JDK-8051559: JAXP function dom tests conversion In-Reply-To: <551F091F.5000203@oracle.com> References: <035701d066e0$93124560$b936d020$@oracle.com> <019b01d06b8a$da0abca0$8e2035e0$@oracle.com> <0E4D09A9-8046-42AC-98B8-D2433A8D38FF@oracle.com> <551B7E99.9050406@oracle.com> <034b01d06c6b$451b6c70$cf524550$@oracle.com> <551DF4B3.6020508@oracle.com> <00c001d06dbe$97323c10$c596b430$@oracle.com> <551E1416.4000208@oracle.com> <00ea01d06dcc$ad683cb0$0838b610$@oracle.com> <551F091F.5000203@oracle.com> Message-ID: <2D5CA571-34D8-4820-9F1D-D7DBB63EC0A6@oracle.com> On Apr 3, 2015, at 5:41 PM, huizhe wang wrote: > > On 4/2/2015 10:11 PM, Frank Yuan wrote: >> Yes, understand, thank you very much! I will follow this rule you talked in future! >> >> Well, since current code is ok for you, would you like to be my sponsor to push the code? > > Will do once Lance finishes the review. I may not get to this until Monday given it is Easter Weekend (and Joe I will get to your other review as well). Just ran out of cycles today Best Lance > > Best, > Joe > >> >> Best Regards >> Frank >> >> From: huizhe wang [mailto:huizhe.wang at oracle.com] >> Sent: Friday, April 03, 2015 12:16 PM >> To: Frank Yuan >> Cc: 'Lance Andersen'; 'Core-Libs-Dev'; 'Gustavo Galimberti' >> Subject: Re: Review request for JDK-8051559: JAXP function dom tests conversion >> >> Hi Frank, >> >> Looks good. With regard to a test being too simple or straightforward, it can be subjective. I mean, what are easy to the author/you may not for others who don't have the knowledge on the particular subject matter. So it's always good to leave comments when you are there. It's also helpful for the author/you to remember what's done and why should you revisit them. >> >> Cheers, >> Joe >> >> On 4/2/2015 8:30 PM, Frank Yuan wrote: >> Hi Joe >> >> Thank you for your comments, I have updated at http://cr.openjdk.java.net/~fyuan/8051559/webrev.02/ >> Please also check my comments in line below >> >> Best Regards >> Frank >> >> From: huizhe wang [mailto:huizhe.wang at oracle.com] >> Sent: Friday, April 03, 2015 10:02 AM >> To: Frank Yuan >> Cc: 'Lance Andersen'; 'Core-Libs-Dev'; 'Gustavo Galimberti' >> Subject: Re: Review request for JDK-8051559: JAXP function dom tests conversion >> >> DocumentTest->testCreateElementNeg, the conversion seems to be incorrect. The original test, as the Javadoc stated, "This checks for the constuctor of DOMException ". The new test however, only verifies that an Exception is thrown. >> >> //I moved a part of original DomExcpTest as testCreateElementNeg into DocumentTest, and write some code for DOMException, but as you known, class DOMException is so simple, JCK test has covered what I/original DomExcpTest test, Shura suggested me to remove this test from ours, then I did as his comment. >> >> >> >> Comments for tests such as testCreateAttributeNSNeg can be more descriptive, for example, "Test for createAttributeNS method: verifies that DOMException is thrown if reserved prefixes are used with an arbitrary namespace name." >> >> //Modified the comments to be more descriptive as your example on the similar cases. >> >> >> >> The original tests that made up DocumentTypeTest had comments that you may want to copy over or rewrite as you did other tests. >> >> //Because I thought this test is so straightforward, I didn't add comment for it. However, I added comments as your suggestion. >> >> >> >> The comment for EntityChildTest can be "Test DOM Parser: parsing an xml file that contains external entities." >> >> //changed the comment >> >> >> >> NodeListTest: @summary Verifies a bug found in jaxp1.0.1 and 1.1FCS. After going out of bound, the last element of a NodeList returns null. The bug has been fixed in jaxp 1.1.1 build. >> >> //changed the comment >> >> >> >> Thanks, >> Joe >> >> On 4/1/2015 4:01 AM, Frank Yuan wrote: >> Hi Joe and Lance >> >> Many thanks for your review and comments! >> >> I have added the comments to the tests as your suggestions except some test method is very simple, the method name/code can present all information, e.g. method testHasFeature in DomImplementationTest.java. Please check my update in http://cr.openjdk.java.net/~fyuan/8051559/webrev.01/ >> >> As well, I understand your suggestion about the code comment, I will think about how to add the comment on the viewpoint of the other code reader in my future work, thank you! >> >> Best Regards >> Frank >> >> From: huizhe wang [mailto:huizhe.wang at oracle.com] >> Sent: Wednesday, April 01, 2015 1:14 PM >> To: Lance Andersen >> Cc: Frank Yuan; Core-Libs-Dev; Gustavo Galimberti >> Subject: Re: Review request for JDK-8051559: JAXP function dom tests conversion >> >> Hi Frank, >> >> I did see the request, just didn't have time to look at it. >> >> I again agree with Lance, that these tests were written over 10 years ago, it would be valuable to write down whatever understanding you gained while converting the tests, same as the Astro application/test, the goal of each test and how it works would all be helpful. Basically, it would be nice to add some comment on @Test. >> >> I tried the tests. They worked fine with my current build (with some changes). >> >> Thanks, >> Joe >> >> On 3/31/2015 7:10 AM, Lance Andersen wrote: >> Hi Frank >> On Mar 31, 2015, at 7:24 AM, Lance @ Oracle wrote: >> >> >> >> >> Hi frank >> >> Can you forward the other review request as I think I thought they were the same and deleted it >> >> Ignore this comment, the subjects were too similar but this is what needed reviewed. >> >> >> >> >> I will look at this again today >> >> The tests overall look fine. >> >> I still have the same comment WRT providing a simple comment describing each test. The key point to remember is we want to make it easier for someone to look at the test, understand what you are trying to validate, and understand the coverage of the tests. This will help future maintainers of the code. Comments are just as important in test code as it is in implementation IMHO. >> >> Best >> Lance >> >> >> >> >> Best >> Lance >> >> >> Lance Andersen| Principal Member of Technical Staff | +1.781.442.2037 >> Oracle Java Engineering >> 1 Network Drive >> Burlington, MA 01803 >> Lance.Andersen at oracle.com >> Sent from my iPad >> >> On Mar 31, 2015, at 4:15 AM, Frank Yuan wrote: >> >> Hi Joe >> >> >> >> Do you have any comment for dom suite co-location? >> >> >> >> Best Regards >> >> Frank >> >> >> >> From: Frank Yuan [mailto:frank.yuan at oracle.com] >> Sent: Wednesday, March 25, 2015 5:46 PM >> To: 'huizhe wang'; 'Core-Libs-Dev' >> Cc: 'jibing chen'; 'Gustavo Galimberti'; sandeep.konchady at oracle.com; >> 'Alexandre (Shura) Iline' >> Subject: RE: Review request for JDK-8051559: JAXP function dom tests >> conversion >> >> >> >> Hi, Joe and All >> >> >> >> We are working on moving internal jaxp functional tests to open jdk repo. >> >> This is the dom suite. Would you please review these test? Any comment will >> be appreciated. >> >> >> >> bug: https://bugs.openjdk.java.net/browse/JDK-8051559 >> >> webrev: http://cr.openjdk.java.net/~fyuan/8051559/webrev.00/ >> >> >> >> Thanks, >> >> >> >> Frank >> >> >> >> >> Lance Andersen| Principal Member of Technical Staff | +1.781.442.2037 >> Oracle Java Engineering >> 1 Network Drive >> Burlington, MA 01803 >> Lance.Andersen at oracle.com >> >> >> >> >> >> >> >> >> > Lance Andersen| Principal Member of Technical Staff | +1.781.442.2037 Oracle Java Engineering 1 Network Drive Burlington, MA 01803 Lance.Andersen at oracle.com From Alan.Bateman at oracle.com Sat Apr 4 07:48:41 2015 From: Alan.Bateman at oracle.com (Alan Bateman) Date: Sat, 04 Apr 2015 08:48:41 +0100 Subject: RFR JDK-8076641: getNextEntry throws ArrayIndexOutOfBoundsException when unzipping file In-Reply-To: <551F130F.5010009@oracle.com> References: <551F130F.5010009@oracle.com> Message-ID: <551F9759.9080306@oracle.com> On 03/04/2015 23:24, Xueming Shen wrote: > Hi, > > Please help review the changeset for > > issue: https://bugs.openjdk.java.net/browse/JDK-8076641 > webrev: http://cr.openjdk.java.net/~sherman/8076641/webrev/ > > It appears there is zip tool over there that purposely doesn't > generate the complete > NTFS timestamp in loc table (while it does generate the correct one in > cen header), > probably to save some bytes. > > The proposed change here is to simply ignore those "data blocks" > during extra data > parsing, if no enough valid data embedded. This looks okay to me although it does seems a bit odd to have an NTFS extra field here without the attributes that are defined for this tag. I don't see it it in the bug to know which zip tool this is. -Alan From Alan.Bateman at oracle.com Sat Apr 4 19:53:46 2015 From: Alan.Bateman at oracle.com (Alan Bateman) Date: Sat, 04 Apr 2015 20:53:46 +0100 Subject: [9] RFR of 8075156: (prefs) remove() should disallow the use of the null control character '\u0000' as key In-Reply-To: <6AECFBD9-492F-4EA4-B126-478F1B19D5AE@oracle.com> References: <6AECFBD9-492F-4EA4-B126-478F1B19D5AE@oracle.com> Message-ID: <5520414A.4000804@oracle.com> On 24/03/2015 19:20, Brian Burkhalter wrote: > Please review at your convenience. > > Issue: https://bugs.openjdk.java.net/browse/JDK-8075156 > Patch: http://cr.openjdk.java.net/~bpb/8075156/webrev.00/ > > This is a sequel to the resolved issue https://bugs.openjdk.java.net/browse/JDK-8068373, (prefs) FileSystemPreferences writes \0 to XML storage, causing loss of all preferences, wherein the code point U+0000, the null control character, was made illegal to use as a key in the generic Unix file system-based Preferences. > > The issue at hand extends disallowing U+0000 as a key in the put() method on Mac OS X and Windows, and also disallows this use to the remove() methods on these platforms and in the generic Unix file system-based Preferences. > > Use of U+0000 in the corresponding get() method has not been disallowed as this method returns a default value. If it would be preferable that the behavior of get() with respect to the key U+0000 were the same as for put() and remove() then this patch may be updated to that effect. > Minimally then the putXXX methods should make it clear that they throw IAE for this case. This would be a javadoc only change because the implementation does this as a consequence of the original patch. In the original discussion then it was just a question as to whether get/getXXX and remove should be consistent. If the get and remove methods will always behave as if the key doesn't exist (and return the default value in the case of get) then it shouldn't require a javadoc change. However I suspect it will require an implementation change as there may be non-XML backing stores might that allow \0 in the key (hence get and remove should actually do something). -Alan. From lance.andersen at oracle.com Mon Apr 6 15:25:55 2015 From: lance.andersen at oracle.com (Lance Andersen) Date: Mon, 6 Apr 2015 11:25:55 -0400 Subject: Review request for JDK-8051559: JAXP function dom tests conversion In-Reply-To: <551F091F.5000203@oracle.com> References: <035701d066e0$93124560$b936d020$@oracle.com> <019b01d06b8a$da0abca0$8e2035e0$@oracle.com> <0E4D09A9-8046-42AC-98B8-D2433A8D38FF@oracle.com> <551B7E99.9050406@oracle.com> <034b01d06c6b$451b6c70$cf524550$@oracle.com> <551DF4B3.6020508@oracle.com> <00c001d06dbe$97323c10$c596b430$@oracle.com> <551E1416.4000208@oracle.com> <00ea01d06dcc$ad683cb0$0838b610$@oracle.com> <551F091F.5000203@oracle.com> Message-ID: <8BE37648-33A3-492E-88CB-DB60A2210EFC@oracle.com> Hi Frank On Apr 3, 2015, at 5:41 PM, huizhe wang wrote: > > On 4/2/2015 10:11 PM, Frank Yuan wrote: >> Yes, understand, thank you very much! I will follow this rule you talked in future! >> >> Well, since current code is ok for you, would you like to be my sponsor to push the code? > > Will do once Lance finishes the review. As I mentioned earlier, I do not have an issue with you pushing your tests but looking at the webrev.02 a couple of minor points of feedback which you can choose to ignore. There are a few tests in AbstractCharacterDataTest.java, AttrTest.java, DocumentTest.java, DocumentTypeTest.java, DomImplementationTest.java, NotationTest.java that could use a comment still Same comment as previously about the use of user.dir in NodeTest.java, really not necessary but no harm Again, feel free to ignore Best Lance > > Best, > Joe > >> >> Best Regards >> Frank >> >> From: huizhe wang [mailto:huizhe.wang at oracle.com] >> Sent: Friday, April 03, 2015 12:16 PM >> To: Frank Yuan >> Cc: 'Lance Andersen'; 'Core-Libs-Dev'; 'Gustavo Galimberti' >> Subject: Re: Review request for JDK-8051559: JAXP function dom tests conversion >> >> Hi Frank, >> >> Looks good. With regard to a test being too simple or straightforward, it can be subjective. I mean, what are easy to the author/you may not for others who don't have the knowledge on the particular subject matter. So it's always good to leave comments when you are there. It's also helpful for the author/you to remember what's done and why should you revisit them. >> >> Cheers, >> Joe >> >> On 4/2/2015 8:30 PM, Frank Yuan wrote: >> Hi Joe >> >> Thank you for your comments, I have updated at http://cr.openjdk.java.net/~fyuan/8051559/webrev.02/ >> Please also check my comments in line below >> >> Best Regards >> Frank >> >> From: huizhe wang [mailto:huizhe.wang at oracle.com] >> Sent: Friday, April 03, 2015 10:02 AM >> To: Frank Yuan >> Cc: 'Lance Andersen'; 'Core-Libs-Dev'; 'Gustavo Galimberti' >> Subject: Re: Review request for JDK-8051559: JAXP function dom tests conversion >> >> DocumentTest->testCreateElementNeg, the conversion seems to be incorrect. The original test, as the Javadoc stated, "This checks for the constuctor of DOMException ". The new test however, only verifies that an Exception is thrown. >> >> //I moved a part of original DomExcpTest as testCreateElementNeg into DocumentTest, and write some code for DOMException, but as you known, class DOMException is so simple, JCK test has covered what I/original DomExcpTest test, Shura suggested me to remove this test from ours, then I did as his comment. >> >> >> >> Comments for tests such as testCreateAttributeNSNeg can be more descriptive, for example, "Test for createAttributeNS method: verifies that DOMException is thrown if reserved prefixes are used with an arbitrary namespace name." >> >> //Modified the comments to be more descriptive as your example on the similar cases. >> >> >> >> The original tests that made up DocumentTypeTest had comments that you may want to copy over or rewrite as you did other tests. >> >> //Because I thought this test is so straightforward, I didn't add comment for it. However, I added comments as your suggestion. >> >> >> >> The comment for EntityChildTest can be "Test DOM Parser: parsing an xml file that contains external entities." >> >> //changed the comment >> >> >> >> NodeListTest: @summary Verifies a bug found in jaxp1.0.1 and 1.1FCS. After going out of bound, the last element of a NodeList returns null. The bug has been fixed in jaxp 1.1.1 build. >> >> //changed the comment >> >> >> >> Thanks, >> Joe >> >> On 4/1/2015 4:01 AM, Frank Yuan wrote: >> Hi Joe and Lance >> >> Many thanks for your review and comments! >> >> I have added the comments to the tests as your suggestions except some test method is very simple, the method name/code can present all information, e.g. method testHasFeature in DomImplementationTest.java. Please check my update in http://cr.openjdk.java.net/~fyuan/8051559/webrev.01/ >> >> As well, I understand your suggestion about the code comment, I will think about how to add the comment on the viewpoint of the other code reader in my future work, thank you! >> >> Best Regards >> Frank >> >> From: huizhe wang [mailto:huizhe.wang at oracle.com] >> Sent: Wednesday, April 01, 2015 1:14 PM >> To: Lance Andersen >> Cc: Frank Yuan; Core-Libs-Dev; Gustavo Galimberti >> Subject: Re: Review request for JDK-8051559: JAXP function dom tests conversion >> >> Hi Frank, >> >> I did see the request, just didn't have time to look at it. >> >> I again agree with Lance, that these tests were written over 10 years ago, it would be valuable to write down whatever understanding you gained while converting the tests, same as the Astro application/test, the goal of each test and how it works would all be helpful. Basically, it would be nice to add some comment on @Test. >> >> I tried the tests. They worked fine with my current build (with some changes). >> >> Thanks, >> Joe >> >> On 3/31/2015 7:10 AM, Lance Andersen wrote: >> Hi Frank >> On Mar 31, 2015, at 7:24 AM, Lance @ Oracle wrote: >> >> >> >> >> Hi frank >> >> Can you forward the other review request as I think I thought they were the same and deleted it >> >> Ignore this comment, the subjects were too similar but this is what needed reviewed. >> >> >> >> >> I will look at this again today >> >> The tests overall look fine. >> >> I still have the same comment WRT providing a simple comment describing each test. The key point to remember is we want to make it easier for someone to look at the test, understand what you are trying to validate, and understand the coverage of the tests. This will help future maintainers of the code. Comments are just as important in test code as it is in implementation IMHO. >> >> Best >> Lance >> >> >> >> >> Best >> Lance >> >> >> Lance Andersen| Principal Member of Technical Staff | +1.781.442.2037 >> Oracle Java Engineering >> 1 Network Drive >> Burlington, MA 01803 >> Lance.Andersen at oracle.com >> Sent from my iPad >> >> On Mar 31, 2015, at 4:15 AM, Frank Yuan wrote: >> >> Hi Joe >> >> >> >> Do you have any comment for dom suite co-location? >> >> >> >> Best Regards >> >> Frank >> >> >> >> From: Frank Yuan [mailto:frank.yuan at oracle.com] >> Sent: Wednesday, March 25, 2015 5:46 PM >> To: 'huizhe wang'; 'Core-Libs-Dev' >> Cc: 'jibing chen'; 'Gustavo Galimberti'; sandeep.konchady at oracle.com; >> 'Alexandre (Shura) Iline' >> Subject: RE: Review request for JDK-8051559: JAXP function dom tests >> conversion >> >> >> >> Hi, Joe and All >> >> >> >> We are working on moving internal jaxp functional tests to open jdk repo. >> >> This is the dom suite. Would you please review these test? Any comment will >> be appreciated. >> >> >> >> bug: https://bugs.openjdk.java.net/browse/JDK-8051559 >> >> webrev: http://cr.openjdk.java.net/~fyuan/8051559/webrev.00/ >> >> >> >> Thanks, >> >> >> >> Frank >> >> >> >> >> Lance Andersen| Principal Member of Technical Staff | +1.781.442.2037 >> Oracle Java Engineering >> 1 Network Drive >> Burlington, MA 01803 >> Lance.Andersen at oracle.com >> >> >> >> >> >> >> >> >> > Lance Andersen| Principal Member of Technical Staff | +1.781.442.2037 Oracle Java Engineering 1 Network Drive Burlington, MA 01803 Lance.Andersen at oracle.com From michael.haupt at oracle.com Tue Apr 7 10:23:06 2015 From: michael.haupt at oracle.com (Michael Haupt) Date: Tue, 7 Apr 2015 12:23:06 +0200 Subject: RFR (XS): 8033465: JSR292: InvokerBytecodeGenerator: convert a check for REF_invokeVirtual on an interface into an assert Message-ID: <5A0CCEA0-180A-46A1-A101-B85654553FB3@oracle.com> Dear all, please review and sponsor this change. Bug: https://bugs.openjdk.java.net/browse/JDK-8033465 Change: http://cr.openjdk.java.net/~mhaupt/8033465/webrev.00/ Thanks, Michael -- Dr. Michael Haupt | Principal Member of Technical Staff Phone: +49 331 200 7277 | Fax: +49 331 200 7561 Oracle Java Platform Group | HotSpot Compiler Team Oracle Deutschland B.V. & Co. KG, Schiffbauergasse 14 | 14467 Potsdam, Germany Oracle is committed to developing practices and products that help protect the environment From vladimir.x.ivanov at oracle.com Tue Apr 7 12:17:31 2015 From: vladimir.x.ivanov at oracle.com (Vladimir Ivanov) Date: Tue, 07 Apr 2015 15:17:31 +0300 Subject: RFR (XS): 8033465: JSR292: InvokerBytecodeGenerator: convert a check for REF_invokeVirtual on an interface into an assert In-Reply-To: <5A0CCEA0-180A-46A1-A101-B85654553FB3@oracle.com> References: <5A0CCEA0-180A-46A1-A101-B85654553FB3@oracle.com> Message-ID: <5523CADB.5020404@oracle.com> Looks good. I'll push it for you. Best regards, Vladimir Ivanov On 4/7/15 1:23 PM, Michael Haupt wrote: > Dear all, > > please review and sponsor this change. > > Bug: https://bugs.openjdk.java.net/browse/JDK-8033465 > Change: http://cr.openjdk.java.net/~mhaupt/8033465/webrev.00/ > > Thanks, > > Michael > From michael.haupt at oracle.com Tue Apr 7 12:20:15 2015 From: michael.haupt at oracle.com (Michael Haupt) Date: Tue, 7 Apr 2015 14:20:15 +0200 Subject: RFR (XS): 8033465: JSR292: InvokerBytecodeGenerator: convert a check for REF_invokeVirtual on an interface into an assert In-Reply-To: <5523CADB.5020404@oracle.com> References: <5A0CCEA0-180A-46A1-A101-B85654553FB3@oracle.com> <5523CADB.5020404@oracle.com> Message-ID: <20572953-4070-4B24-B9B8-DBFF38B9B0E7@oracle.com> ... thank you very much, Vladimir! Best, Michael > Am 07.04.2015 um 14:17 schrieb Vladimir Ivanov : > > Looks good. > > I'll push it for you. > > Best regards, > Vladimir Ivanov > > On 4/7/15 1:23 PM, Michael Haupt wrote: >> Dear all, >> >> please review and sponsor this change. >> >> Bug: https://bugs.openjdk.java.net/browse/JDK-8033465 >> Change: http://cr.openjdk.java.net/~mhaupt/8033465/webrev.00/ >> >> Thanks, >> >> Michael >> -- Dr. Michael Haupt | Principal Member of Technical Staff Phone: +49 331 200 7277 | Fax: +49 331 200 7561 Oracle Java Platform Group | HotSpot Compiler Team Oracle Deutschland B.V. & Co. KG, Schiffbauergasse 14 | 14467 Potsdam, Germany Oracle is committed to developing practices and products that help protect the environment From alexander.v.stepanov at oracle.com Tue Apr 7 14:40:34 2015 From: alexander.v.stepanov at oracle.com (alexander stepanov) Date: Tue, 07 Apr 2015 17:40:34 +0300 Subject: Review Request for 8039440: Tidy warnings cleanup for org/omg Message-ID: <5523EC62.4070907@oracle.com> Hello, I'm not if the mail list is correct, but could anyone please review the following fix? http://cr.openjdk.java.net/~avstepan/8039440/webrev.01/ Bug: https://bugs.openjdk.java.net/browse/JDK-8039440 Just an HTML markup fix for CORBA. Thanks, Alexander From yuri.nesterenko at oracle.com Tue Apr 7 14:45:54 2015 From: yuri.nesterenko at oracle.com (Yuri Nesterenko) Date: Tue, 07 Apr 2015 17:45:54 +0300 Subject: Review Request for 8039440: Tidy warnings cleanup for org/omg In-Reply-To: <5523EC62.4070907@oracle.com> References: <5523EC62.4070907@oracle.com> Message-ID: <5523EDA2.90301@oracle.com> I'm not sure either but the fix looks OK to me. -yan On 04/07/2015 05:40 PM, alexander stepanov wrote: > Hello, > > I'm not if the mail list is correct, but could anyone please review the > following fix? > http://cr.openjdk.java.net/~avstepan/8039440/webrev.01/ > > Bug: https://bugs.openjdk.java.net/browse/JDK-8039440 > > Just an HTML markup fix for CORBA. > > Thanks, > Alexander > From alexander.v.stepanov at oracle.com Tue Apr 7 14:47:20 2015 From: alexander.v.stepanov at oracle.com (alexander stepanov) Date: Tue, 07 Apr 2015 17:47:20 +0300 Subject: Review Request for 8039440: Tidy warnings cleanup for org/omg In-Reply-To: <5523EDA2.90301@oracle.com> References: <5523EC62.4070907@oracle.com> <5523EDA2.90301@oracle.com> Message-ID: <5523EDF8.8060300@oracle.com> Thanks! On 07.04.2015 17:45, Yuri Nesterenko wrote: > I'm not sure either but the fix looks OK to me. > > -yan > > On 04/07/2015 05:40 PM, alexander stepanov wrote: >> Hello, >> >> I'm not if the mail list is correct, but could anyone please review the >> following fix? >> http://cr.openjdk.java.net/~avstepan/8039440/webrev.01/ >> >> Bug: https://bugs.openjdk.java.net/browse/JDK-8039440 >> >> Just an HTML markup fix for CORBA. >> >> Thanks, >> Alexander >> > From Roger.Riggs at Oracle.com Tue Apr 7 14:53:32 2015 From: Roger.Riggs at Oracle.com (Roger Riggs) Date: Tue, 07 Apr 2015 10:53:32 -0400 Subject: Review Request for 8039440: Tidy warnings cleanup for org/omg In-Reply-To: <5523EDF8.8060300@oracle.com> References: <5523EC62.4070907@oracle.com> <5523EDA2.90301@oracle.com> <5523EDF8.8060300@oracle.com> Message-ID: <5523EF6C.4060106@Oracle.com> Hi, I'll send some comments in a bit, there are a few things to fix. Roger On 4/7/2015 10:47 AM, alexander stepanov wrote: > Thanks! > > On 07.04.2015 17:45, Yuri Nesterenko wrote: >> I'm not sure either but the fix looks OK to me. >> >> -yan >> >> On 04/07/2015 05:40 PM, alexander stepanov wrote: >>> Hello, >>> >>> I'm not if the mail list is correct, but could anyone please review the >>> following fix? >>> http://cr.openjdk.java.net/~avstepan/8039440/webrev.01/ >>> >>> Bug: https://bugs.openjdk.java.net/browse/JDK-8039440 >>> >>> Just an HTML markup fix for CORBA. >>> >>> Thanks, >>> Alexander >>> >> > From Roger.Riggs at Oracle.com Tue Apr 7 15:20:14 2015 From: Roger.Riggs at Oracle.com (Roger Riggs) Date: Tue, 07 Apr 2015 11:20:14 -0400 Subject: Review Request for 8039440: Tidy warnings cleanup for org/omg In-Reply-To: <5523EC62.4070907@oracle.com> References: <5523EC62.4070907@oracle.com> Message-ID: <5523F5AE.2040707@Oracle.com> Hi, Just a few minor comments; no need for another webrev (on my account). The preferred form for code markup is {@code } instead of ... and ... but that may beyond the scope of the current issue. - Lowercase markup

is preferred over uppercase

but per file conventions should be consistent. +++ new/src/java.corba/share/classes/org/omg/CORBA/portable/package.html 2015-04-07 16:41:12.299150361 +0400 -

  • Delegate +
  • <*code*>Delegate (RR) Why is this list element in code, the others are not. +++ new/src/java.corba/share/classes/org/omg/CORBA/ShortHolder.java 2015-04-07 16:41:09.883150470 +0400 @@ -32,7 +32,7 @@ /** * The Holder for Short. For more information on * Holder files, see - * "Generated Files: Holder Files".

    .*

    * (RR)

    should be on a new line; before the paragraph it separates +++ new/src/java.corba/share/classes/org/omg/CORBA/TypeCode.java 2015-04-07 16:41:10.567150439 +0400 @@ -164,9 +164,9 @@ * * Java IDL extends the CORBA specification to allow all operations permitted * on a struct TypeCode to be permitted - * on an exception TypeCode as well.

    - * + * on an exception TypeCode as well. */ + public abstract class TypeCode implements IDLEntity { (RR) There should not be blank line between comment and class definition. Thanks, Roger On 4/7/2015 10:40 AM, alexander stepanov wrote: > Hello, > > I'm not if the mail list is correct, but could anyone please review > the following fix? > http://cr.openjdk.java.net/~avstepan/8039440/webrev.01/ > > Bug: https://bugs.openjdk.java.net/browse/JDK-8039440 > > Just an HTML markup fix for CORBA. > > Thanks, > Alexander > From alexander.v.stepanov at oracle.com Tue Apr 7 17:00:45 2015 From: alexander.v.stepanov at oracle.com (alexander stepanov) Date: Tue, 07 Apr 2015 20:00:45 +0300 Subject: Review Request for 8039440: Tidy warnings cleanup for org/omg In-Reply-To: <5523F5AE.2040707@Oracle.com> References: <5523EC62.4070907@oracle.com> <5523F5AE.2040707@Oracle.com> Message-ID: <55240D3D.8020402@oracle.com> Hello Roger, Thank you for the notes, fixed: http://cr.openjdk.java.net/~avstepan/8039440/webrev.01/src/java.corba/share/classes/org/omg/CORBA/portable/package.html.udiff.html http://cr.openjdk.java.net/~avstepan/8039440/webrev.01/src/java.corba/share/classes/org/omg/CORBA/ShortHolder.java.udiff.html http://cr.openjdk.java.net/~avstepan/8039440/webrev.01/src/java.corba/share/classes/org/omg/CORBA/TypeCode.java.udiff.html Regards, Alexander On 07.04.2015 18:20, Roger Riggs wrote: > Hi, > > Just a few minor comments; no need for another webrev (on my account). > > The preferred form for code markup is {@code } instead of ... > > and ... but that may beyond the scope of the current issue. > > - Lowercase markup

    is preferred over uppercase

    but per file > conventions should be consistent. > > +++ > new/src/java.corba/share/classes/org/omg/CORBA/portable/package.html > 2015-04-07 16:41:12.299150361 +0400 > > -

  • Delegate > +
  • <*code*>Delegate > > (RR) Why is this list element in code, the others are not. > > +++ new/src/java.corba/share/classes/org/omg/CORBA/ShortHolder.java > 2015-04-07 16:41:09.883150470 +0400 > @@ -32,7 +32,7 @@ > /** > * The Holder for Short. For more information on > * Holder files, see > - * "Generated Files: Holder Files".

    + * "Generated Files: Holder Files".*

    * > > (RR)

    should be on a new line; before the paragraph it separates > > +++ new/src/java.corba/share/classes/org/omg/CORBA/TypeCode.java > 2015-04-07 16:41:10.567150439 +0400 > > @@ -164,9 +164,9 @@ > * > * Java IDL extends the CORBA specification to allow all operations > permitted > * on a struct TypeCode to be permitted > - * on an exception TypeCode as well.

    > - * > + * on an exception TypeCode as well. > */ > + > public abstract class TypeCode implements IDLEntity { > > (RR) There should not be blank line between comment and class definition. > > > Thanks, Roger > > > On 4/7/2015 10:40 AM, alexander stepanov wrote: >> Hello, >> >> I'm not if the mail list is correct, but could anyone please review >> the following fix? >> http://cr.openjdk.java.net/~avstepan/8039440/webrev.01/ >> >> Bug: https://bugs.openjdk.java.net/browse/JDK-8039440 >> >> Just an HTML markup fix for CORBA. >> >> Thanks, >> Alexander >> > From lance.andersen at oracle.com Tue Apr 7 17:48:26 2015 From: lance.andersen at oracle.com (Lance Andersen) Date: Tue, 7 Apr 2015 13:48:26 -0400 Subject: Review Request for 8039440: Tidy warnings cleanup for org/omg In-Reply-To: <55240D3D.8020402@oracle.com> References: <5523EC62.4070907@oracle.com> <5523F5AE.2040707@Oracle.com> <55240D3D.8020402@oracle.com> Message-ID: Hi Alexander, InTypeCode.java you might want to use {@code} vs so that you do not have to use > < Otherwise it is OK Best Lance On Apr 7, 2015, at 1:00 PM, alexander stepanov wrote: > Hello Roger, > > Thank you for the notes, fixed: > http://cr.openjdk.java.net/~avstepan/8039440/webrev.01/src/java.corba/share/classes/org/omg/CORBA/portable/package.html.udiff.html > http://cr.openjdk.java.net/~avstepan/8039440/webrev.01/src/java.corba/share/classes/org/omg/CORBA/ShortHolder.java.udiff.html > http://cr.openjdk.java.net/~avstepan/8039440/webrev.01/src/java.corba/share/classes/org/omg/CORBA/TypeCode.java.udiff.html > > Regards, > Alexander > > On 07.04.2015 18:20, Roger Riggs wrote: >> Hi, >> >> Just a few minor comments; no need for another webrev (on my account). >> >> The preferred form for code markup is {@code } instead of ... >> and ... but that may beyond the scope of the current issue. >> >> - Lowercase markup

    is preferred over uppercase

    but per file conventions should be consistent. >> >> +++ new/src/java.corba/share/classes/org/omg/CORBA/portable/package.html 2015-04-07 16:41:12.299150361 +0400 >> >> -

  • Delegate >> +
  • <*code*>Delegate >> >> (RR) Why is this list element in code, the others are not. >> >> +++ new/src/java.corba/share/classes/org/omg/CORBA/ShortHolder.java 2015-04-07 16:41:09.883150470 +0400 >> @@ -32,7 +32,7 @@ >> /** >> * The Holder for Short. For more information on >> * Holder files, see >> - * "Generated Files: Holder Files".

    > + * "Generated Files: Holder Files".*

    * >> >> (RR)

    should be on a new line; before the paragraph it separates >> >> +++ new/src/java.corba/share/classes/org/omg/CORBA/TypeCode.java 2015-04-07 16:41:10.567150439 +0400 >> >> @@ -164,9 +164,9 @@ >> * >> * Java IDL extends the CORBA specification to allow all operations permitted >> * on a struct TypeCode to be permitted >> - * on an exception TypeCode as well.

    >> - * >> + * on an exception TypeCode as well. >> */ >> + >> public abstract class TypeCode implements IDLEntity { >> >> (RR) There should not be blank line between comment and class definition. >> >> >> Thanks, Roger >> >> >> On 4/7/2015 10:40 AM, alexander stepanov wrote: >>> Hello, >>> >>> I'm not if the mail list is correct, but could anyone please review the following fix? >>> http://cr.openjdk.java.net/~avstepan/8039440/webrev.01/ >>> >>> Bug: https://bugs.openjdk.java.net/browse/JDK-8039440 >>> >>> Just an HTML markup fix for CORBA. >>> >>> Thanks, >>> Alexander >>> >> > Lance Andersen| Principal Member of Technical Staff | +1.781.442.2037 Oracle Java Engineering 1 Network Drive Burlington, MA 01803 Lance.Andersen at oracle.com From michael.haupt at oracle.com Tue Apr 7 19:11:30 2015 From: michael.haupt at oracle.com (Michael Haupt) Date: Tue, 7 Apr 2015 21:11:30 +0200 Subject: RFR (S): 8076461: JSR292: remove unused native and constants Message-ID: <4EB3C4DA-C382-4795-A676-6147E863DFF1@oracle.com> Dear all, please review and sponsor this change. Cross-posted to hs-comp and core-lib as this is at the JVM/libraries boundary. This is a straightforward refactoring change that removes many constants and unused API from MHNatives, and places some constants used only in MemberName in that class. RFE: https://bugs.openjdk.java.net/browse/JDK-8076461 Changes: http://cr.openjdk.java.net/~mhaupt/8076461/webrev.00/ Tested with JPRT, HotSpot testset. Thanks, Michael -- Dr. Michael Haupt | Principal Member of Technical Staff Phone: +49 331 200 7277 | Fax: +49 331 200 7561 Oracle Java Platform Group | HotSpot Compiler Team Oracle Deutschland B.V. & Co. KG, Schiffbauergasse 14 | 14467 Potsdam, Germany Oracle is committed to developing practices and products that help protect the environment From michael.haupt at oracle.com Tue Apr 7 20:10:53 2015 From: michael.haupt at oracle.com (Michael Haupt) Date: Tue, 7 Apr 2015 22:10:53 +0200 Subject: RFR (S): 8076461: JSR292: remove unused native and constants In-Reply-To: <4EB3C4DA-C382-4795-A676-6147E863DFF1@oracle.com> References: <4EB3C4DA-C382-4795-A676-6147E863DFF1@oracle.com> Message-ID: <8D74B563-185A-40E8-AEA2-A6688E819377@oracle.com> Hello, in case anyone was wondering about the empty changeset in the webrev: that's fixed now. Thanks to Vladimir I. for pointing out the glitch in my webrev creation approach. :-) Best, Michael > Am 07.04.2015 um 21:11 schrieb Michael Haupt : > > Dear all, > > please review and sponsor this change. Cross-posted to hs-comp and core-lib as this is at the JVM/libraries boundary. This is a straightforward refactoring change that removes many constants and unused API from MHNatives, and places some constants used only in MemberName in that class. > > RFE: https://bugs.openjdk.java.net/browse/JDK-8076461 > Changes: http://cr.openjdk.java.net/~mhaupt/8076461/webrev.00/ > > Tested with JPRT, HotSpot testset. > > Thanks, > > Michael -- Dr. Michael Haupt | Principal Member of Technical Staff Phone: +49 331 200 7277 | Fax: +49 331 200 7561 Oracle Java Platform Group | HotSpot Compiler Team Oracle Deutschland B.V. & Co. KG, Schiffbauergasse 14 | 14467 Potsdam, Germany Oracle is committed to developing practices and products that help protect the environment From lowasser at google.com Tue Apr 7 21:10:52 2015 From: lowasser at google.com (Louis Wasserman) Date: Tue, 07 Apr 2015 21:10:52 +0000 Subject: String concatenation tweaks In-Reply-To: <55244704.8080709@gmail.com> References: <5500E84F.3080800@oracle.com> <55022114.8040904@oracle.com> <55034189.4000900@oracle.com> <55244704.8080709@gmail.com> Message-ID: Could that actually be provided immutability-safely? I suppose an append-only, fixed-length builder would be potentially safe. Part of the trickiness there is with primitive parameters, where presizing and doing the actual append both require calculating the size of the primitive when converted to a string. The current approach just uses an upper bound for the primitive type as a whole, which is fine and allocates a small constant excess in most cases, but I'm not sure how we could avoid duplicating that computation in a public API. On Tue, Apr 7, 2015 at 2:07 PM Peter Levart wrote: > Hi Louis, > > This is nice. Amd could be even nicer. In case the estimated initial > StringBuilder capacity is exactly the final String length, then > constructing the String could skip the char[] copying step as the > StringBuilder instance does not escape. But in order to be safe, this would > have to be a special kind of StringBuilder. Like the following: > > > http://cr.openjdk.java.net/~plevart/misc/ThreadLocalStringBuilder/webrev.01/ > > Such class would be useful for direct API use too. > > > Regards, Peter > > > On 03/13/2015 10:40 PM, Louis Wasserman wrote: > > Got it. I think the only cases we have to worry about, then, are buffer > size overflows resulting in NegativeArraySizeException, or possibly an > explicitly thrown OutOfMemoryError (which is StringBuilder's response when > the buffer size tries to exceed Integer.MAX_VALUE). I think we might > conceivably deal with this by rewriting the bytecode to -- I think we can > improve on this with jump hackery to avoid repetition, but essentially -- > > int length = 3; // sum of the constant strings; we can check that this > won't overflow at compile time but I think it couldn't no matter what > because of method length constraints > String mStr = m().toString(); > length += mStr.length(); > if (length < 0) { > throw new OutOfMemoryError(); > } > String nStr = n().toString(); > length += nStr.length(); > if (length < 0) { > throw new OutOfMemoryError(); > } > > This continues to expand the bytecode, but probably manageably -- we > don't actually need a local for length; if (int < 0) is easy in bytecode, > and we can have only one OOME site that all the ifs jump to? > > On Fri, Mar 13, 2015 at 12:59 PM Alex Buckley > wrote: > >> I do recognize that the proposed implementation doesn't reorder the >> evaluation of subexpressions. >> >> When discussing the proposed implementation of '+' -- whose key element >> is calling append(String) with a pre-computed value -- I was careful to >> set aside asynchronous OOMEs, but I see that even synchronous OOMEs are >> sidetracking us. My concern is not heap pressure; my concern is >> arbitrary unchecked exceptions arising from the (int) and >> append(String) calls. >> >> For sake of argument, I'll simplify "unchecked exceptions" to just >> RuntimeExceptions, not Errors. If you can guarantee that no >> RuntimeExceptions are thrown synchronously during the execution of those >> method bodies on the JVM, then '+' cannot fail and the timing of >> subexpression evaluation is unobservable (ordering is still observable, >> as required). I think this guarantee is just a matter of reviewing the >> method bodies. >> >> Alex >> >> On 3/12/2015 6:01 PM, Louis Wasserman wrote: >> > I confess I'm not sure how that "quality" goal would be achievable in >> > bytecode without deliberately allocating arrays we then discard. >> > >> > For what it's worth, delaying or avoiding OOMEs seems a desirable goal >> > in general, and up to a constant multiplicative factor, this >> > implementation seems to allocate the same amount in the same order. >> > That is, we're still computing m().toString() before n().toString(), and >> > up to a constant multiplicative factor, m().toString() allocates the >> > same number of bytes as the StringBuilder the status quo generates. So >> > if m() does something like allocate a char[Integer.MAX_VALUE], we still >> > OOM at the appropriate time. >> > >> > Other notes: this implementation would tend to decrease maximum >> > allocation, so it'd reduce OOMEs. Also, since the StringBuilder will >> > never need further expansion and we're only using the String and >> > primitive overloads of append, the only way for append to OOME would be >> > in append(float) and append(double), which allocate a FloatingDecimal >> > (which may, in turn, allocate a new thread-local char[26] if one isn't >> > already there). >> > >> > On Thu, Mar 12, 2015 at 4:28 PM Alex Buckley > > > wrote: >> > >> > More abstract presentation. Given the expression: >> > >> > "foo" + m() + n() >> > >> > you must not evaluate n() if evaluation of "foo" + m() completes >> > abruptly. The proposed implementation evaluates n() regardless. >> > >> > All is not lost. In the proposed implementation, the abrupt >> completion >> > of "foo" + m() could occur because an append call fails or (thanks >> to >> > Jon for pointing this out) the StringBuilder ctor fails. The >> > quality-of-implementation issue is thus: if the proposed >> implementation >> > is of sufficiently high quality to guarantee that the ctor and the >> first >> > append both succeed, then the evaluation of "foo" + m() will always >> > complete normally, and it would be an unobservable (thus acceptable) >> > implementation detail to evaluate n() early. >> > >> > Alex >> > >> > On 3/11/2015 10:26 PM, Jeremy Manson wrote: >> > > Isn't Louis's proposed behavior equivalent to saying "the >> rightmost >> > > concatenation threw an OOME" instead of "some concatenation in >> the >> > > middle threw an OOME"? >> > > >> > > It's true that the intermediate String concatenations haven't >> > occurred >> > > at that point, but in the JDK's current implementation, that's >> true, >> > > too: the concatenations that have occurred at that point are >> > > StringBuilder ones, not String ones. If any of the append >> operations >> > > throws an OOME, no Strings have been created at all, either in >> > Louis's >> > > implementation or in the JDK's. >> > > >> > > Ultimately, isn't this a quality of implementation issue? And >> if so, >> > > isn't it a quality of implementation issue that doesn't provide >> any >> > > additional quality? I can't imagine code whose semantics relies >> on >> > > this, and if they do, they are relying on something >> > > implementation-dependent. >> > > >> > > Jeremy >> > > >> > > On Wed, Mar 11, 2015 at 6:13 PM, Alex Buckley >> > >> > > > > >> wrote: >> > > >> > > On 3/11/2015 2:01 PM, Louis Wasserman wrote: >> > > >> > > So for example, "foo" + myInt + myString + "bar" + myObj >> > would be >> > > compiled to the equivalent of >> > > >> > > int myIntTmp = myInt; >> > > String myStringTmp = String.valueOf(myString); // defend >> > against >> > > null >> > > String myObjTmp = >> > String.valueOf(String.valueOf(____myObj)); // defend >> > > against evil toString implementations returning null >> > > >> > > return new StringBuilder( >> > > 17 // length of "foo" (3) + max length of myInt >> (11) + >> > > length of >> > > "bar" (3) >> > > + myStringTmp.length() >> > > + myObjTmp.length()) >> > > .append("foo") >> > > .append(myIntTmp) >> > > .append(myStringTmp) >> > > .append("bar") >> > > .append(myObjTmp) >> > > .toString(); >> > > >> > > As far as language constraints go, the JLS is (apparently >> > > deliberately) >> > > vague about how string concatenation is implemented. "An >> > > implementation >> > > may choose to perform conversion and concatenation in one >> > step >> > > to avoid >> > > creating and then discarding an intermediate String >> > object. To >> > > increase >> > > the performance of repeated string concatenation, a Java >> > > compiler may >> > > use the StringBuffer class or a similar technique to >> > reduce the >> > > number >> > > of intermediate String objects that are created by >> > evaluation of an >> > > expression." We see no reason this approach would not >> > qualify as a >> > > "similar technique." >> > > >> > > >> > > The really key property of the string concatenation operator >> is >> > > left-associativity. Later subexpressions must not be >> > evaluated until >> > > earlier subexpressions have been successfully evaluated AND >> > > concatenated. Consider this expression: >> > > >> > > "foo" + m() + n() >> > > >> > > which JLS8 15.8 specifies to mean: >> > > >> > > ("foo" + m()) + n() >> > > >> > > We know from JLS8 15.6 that if m() throws, then foo+m() >> > throws, and >> > > n() will never be evaluated. >> > > >> > > Happily, your translation doesn't appear to catch and swallow >> > > exceptions when eagerly evaluating each subexpression in >> > turn, so I >> > > believe you won't evaluate n() if m() already threw. >> > > >> > > Unhappily, a call to append(..) can in general fail with >> > > OutOfMemoryError. (I'm not talking about asynchronous >> > exceptions in >> > > general, but rather the sense that append(..) manipulates the >> > heap >> > > so an OOME is at least plausible.) In the OpenJDK >> > implementation, if >> > > blah.append(m()) fails with OOME, then n() hasn't been >> > evaluated yet >> > > -- that's "real" left-associativity. In the proposed >> > implementation, >> > > it's possible that more memory is available when evaluating >> > m() and >> > > n() upfront than at the time of an append call, so n() is >> > evaluated >> > > even if append(<>) fails -- that's not >> > > left-associative. >> > > >> > > Perhaps you can set my mind at ease that append(..) can't >> > fail with >> > > OOME? >> > > >> > > Alex >> > > >> > > >> > >> > > From peter.levart at gmail.com Tue Apr 7 21:07:16 2015 From: peter.levart at gmail.com (Peter Levart) Date: Tue, 07 Apr 2015 23:07:16 +0200 Subject: String concatenation tweaks In-Reply-To: References: <5500E84F.3080800@oracle.com> <55022114.8040904@oracle.com> <55034189.4000900@oracle.com> Message-ID: <55244704.8080709@gmail.com> Hi Louis, This is nice. Amd could be even nicer. In case the estimated initial StringBuilder capacity is exactly the final String length, then constructing the String could skip the char[] copying step as the StringBuilder instance does not escape. But in order to be safe, this would have to be a special kind of StringBuilder. Like the following: http://cr.openjdk.java.net/~plevart/misc/ThreadLocalStringBuilder/webrev.01/ Such class would be useful for direct API use too. Regards, Peter On 03/13/2015 10:40 PM, Louis Wasserman wrote: > Got it. I think the only cases we have to worry about, then, are > buffer size overflows resulting in NegativeArraySizeException, or > possibly an explicitly thrown OutOfMemoryError (which is > StringBuilder's response when the buffer size tries to exceed > Integer.MAX_VALUE). I think we might conceivably deal with this by > rewriting the bytecode to -- I think we can improve on this with jump > hackery to avoid repetition, but essentially -- > > int length = 3; // sum of the constant strings; we can check that this > won't overflow at compile time but I think it couldn't no matter what > because of method length constraints > String mStr = m().toString(); > length += mStr.length(); > if (length < 0) { > throw new OutOfMemoryError(); > } > String nStr = n().toString(); > length += nStr.length(); > if (length < 0) { > throw new OutOfMemoryError(); > } > > This continues to expand the bytecode, but probably manageably -- we > don't actually need a local for length; if (int < 0) is easy in > bytecode, and we can have only one OOME site that all the ifs jump to? > > On Fri, Mar 13, 2015 at 12:59 PM Alex Buckley > wrote: > > I do recognize that the proposed implementation doesn't reorder the > evaluation of subexpressions. > > When discussing the proposed implementation of '+' -- whose key > element > is calling append(String) with a pre-computed value -- I was > careful to > set aside asynchronous OOMEs, but I see that even synchronous > OOMEs are > sidetracking us. My concern is not heap pressure; my concern is > arbitrary unchecked exceptions arising from the (int) and > append(String) calls. > > For sake of argument, I'll simplify "unchecked exceptions" to just > RuntimeExceptions, not Errors. If you can guarantee that no > RuntimeExceptions are thrown synchronously during the execution of > those > method bodies on the JVM, then '+' cannot fail and the timing of > subexpression evaluation is unobservable (ordering is still > observable, > as required). I think this guarantee is just a matter of reviewing the > method bodies. > > Alex > > On 3/12/2015 6:01 PM, Louis Wasserman wrote: > > I confess I'm not sure how that "quality" goal would be > achievable in > > bytecode without deliberately allocating arrays we then discard. > > > > For what it's worth, delaying or avoiding OOMEs seems a > desirable goal > > in general, and up to a constant multiplicative factor, this > > implementation seems to allocate the same amount in the same order. > > That is, we're still computing m().toString() before > n().toString(), and > > up to a constant multiplicative factor, m().toString() allocates the > > same number of bytes as the StringBuilder the status quo > generates. So > > if m() does something like allocate a char[Integer.MAX_VALUE], > we still > > OOM at the appropriate time. > > > > Other notes: this implementation would tend to decrease maximum > > allocation, so it'd reduce OOMEs. Also, since the StringBuilder > will > > never need further expansion and we're only using the String and > > primitive overloads of append, the only way for append to OOME > would be > > in append(float) and append(double), which allocate a > FloatingDecimal > > (which may, in turn, allocate a new thread-local char[26] if one > isn't > > already there). > > > > On Thu, Mar 12, 2015 at 4:28 PM Alex Buckley > > > >> wrote: > > > > More abstract presentation. Given the expression: > > > > "foo" + m() + n() > > > > you must not evaluate n() if evaluation of "foo" + m() completes > > abruptly. The proposed implementation evaluates n() regardless. > > > > All is not lost. In the proposed implementation, the abrupt > completion > > of "foo" + m() could occur because an append call fails or > (thanks to > > Jon for pointing this out) the StringBuilder ctor fails. The > > quality-of-implementation issue is thus: if the proposed > implementation > > is of sufficiently high quality to guarantee that the ctor > and the first > > append both succeed, then the evaluation of "foo" + m() will > always > > complete normally, and it would be an unobservable (thus > acceptable) > > implementation detail to evaluate n() early. > > > > Alex > > > > On 3/11/2015 10:26 PM, Jeremy Manson wrote: > > > Isn't Louis's proposed behavior equivalent to saying "the > rightmost > > > concatenation threw an OOME" instead of "some > concatenation in the > > > middle threw an OOME"? > > > > > > It's true that the intermediate String concatenations haven't > > occurred > > > at that point, but in the JDK's current implementation, > that's true, > > > too: the concatenations that have occurred at that point are > > > StringBuilder ones, not String ones. If any of the > append operations > > > throws an OOME, no Strings have been created at all, > either in > > Louis's > > > implementation or in the JDK's. > > > > > > Ultimately, isn't this a quality of implementation > issue? And if so, > > > isn't it a quality of implementation issue that doesn't > provide any > > > additional quality? I can't imagine code whose semantics > relies on > > > this, and if they do, they are relying on something > > > implementation-dependent. > > > > > > Jeremy > > > > > > On Wed, Mar 11, 2015 at 6:13 PM, Alex Buckley > > > > > > > __com > > >>> wrote: > > > > > > On 3/11/2015 2:01 PM, Louis Wasserman wrote: > > > > > > So for example, "foo" + myInt + myString + "bar" > + myObj > > would be > > > compiled to the equivalent of > > > > > > int myIntTmp = myInt; > > > String myStringTmp = String.valueOf(myString); // > defend > > against > > > null > > > String myObjTmp = > > String.valueOf(String.valueOf(____myObj)); // defend > > > against evil toString implementations returning null > > > > > > return new StringBuilder( > > > 17 // length of "foo" (3) + max length of > myInt (11) + > > > length of > > > "bar" (3) > > > + myStringTmp.length() > > > + myObjTmp.length()) > > > .append("foo") > > > .append(myIntTmp) > > > .append(myStringTmp) > > > .append("bar") > > > .append(myObjTmp) > > > .toString(); > > > > > > As far as language constraints go, the JLS is > (apparently > > > deliberately) > > > vague about how string concatenation is > implemented. "An > > > implementation > > > may choose to perform conversion and > concatenation in one > > step > > > to avoid > > > creating and then discarding an intermediate String > > object. To > > > increase > > > the performance of repeated string concatenation, > a Java > > > compiler may > > > use the StringBuffer class or a similar technique to > > reduce the > > > number > > > of intermediate String objects that are created by > > evaluation of an > > > expression." We see no reason this approach > would not > > qualify as a > > > "similar technique." > > > > > > > > > The really key property of the string concatenation > operator is > > > left-associativity. Later subexpressions must not be > > evaluated until > > > earlier subexpressions have been successfully > evaluated AND > > > concatenated. Consider this expression: > > > > > > "foo" + m() + n() > > > > > > which JLS8 15.8 specifies to mean: > > > > > > ("foo" + m()) + n() > > > > > > We know from JLS8 15.6 that if m() throws, then foo+m() > > throws, and > > > n() will never be evaluated. > > > > > > Happily, your translation doesn't appear to catch and > swallow > > > exceptions when eagerly evaluating each subexpression in > > turn, so I > > > believe you won't evaluate n() if m() already threw. > > > > > > Unhappily, a call to append(..) can in general fail with > > > OutOfMemoryError. (I'm not talking about asynchronous > > exceptions in > > > general, but rather the sense that append(..) > manipulates the > > heap > > > so an OOME is at least plausible.) In the OpenJDK > > implementation, if > > > blah.append(m()) fails with OOME, then n() hasn't been > > evaluated yet > > > -- that's "real" left-associativity. In the proposed > > implementation, > > > it's possible that more memory is available when > evaluating > > m() and > > > n() upfront than at the time of an append call, so n() is > > evaluated > > > even if append(<>) fails -- that's not > > > left-associative. > > > > > > Perhaps you can set my mind at ease that append(..) can't > > fail with > > > OOME? > > > > > > Alex > > > > > > > > > From peter.levart at gmail.com Tue Apr 7 21:37:02 2015 From: peter.levart at gmail.com (Peter Levart) Date: Tue, 07 Apr 2015 23:37:02 +0200 Subject: String concatenation tweaks In-Reply-To: References: <5500E84F.3080800@oracle.com> <55022114.8040904@oracle.com> <55034189.4000900@oracle.com> <55244704.8080709@gmail.com> Message-ID: <55244DFE.2050200@gmail.com> On 04/07/2015 11:10 PM, Louis Wasserman wrote: > Could that actually be provided immutability-safely? I suppose an > append-only, fixed-length builder would be potentially safe. I think the presented implementation *is* thread and immutability safe. It only allows mutations from the constructing thread and disables them as soon as toString() is called. > > Part of the trickiness there is with primitive parameters, where > presizing and doing the actual append both require calculating the > size of the primitive when converted to a string. The current > approach just uses an upper bound for the primitive type as a whole, > which is fine and allocates a small constant excess in most cases, but > I'm not sure how we could avoid duplicating that computation in a > public API. I've been thinking of static methods parallel to: String.valueOf(int) - String.lengthOf(int) String.valueOf(long) - String.lengthOf(long) ... ... The integral variants could be quick to compute (the implementations are already there - they are just not public), the floating point maybe not so. But the floating point conversion is already taking much more overhead and estimating an upper bound would be fine in case floating point is involved. If one wants to optimize the case of very long concatenation of exactly sized Strings, integrals and other Objects with just one or few floating point values, then he can always do it explicitly: "....long string...." + String.valueOf(Math.PI); Regards, Peter > > On Tue, Apr 7, 2015 at 2:07 PM Peter Levart > wrote: > > Hi Louis, > > This is nice. Amd could be even nicer. In case the estimated > initial StringBuilder capacity is exactly the final String length, > then constructing the String could skip the char[] copying step as > the StringBuilder instance does not escape. But in order to be > safe, this would have to be a special kind of StringBuilder. Like > the following: > > http://cr.openjdk.java.net/~plevart/misc/ThreadLocalStringBuilder/webrev.01/ > > > Such class would be useful for direct API use too. > > > Regards, Peter > > > On 03/13/2015 10:40 PM, Louis Wasserman wrote: >> Got it. I think the only cases we have to worry about, then, are >> buffer size overflows resulting in NegativeArraySizeException, or >> possibly an explicitly thrown OutOfMemoryError (which is >> StringBuilder's response when the buffer size tries to exceed >> Integer.MAX_VALUE). I think we might conceivably deal with this >> by rewriting the bytecode to -- I think we can improve on this >> with jump hackery to avoid repetition, but essentially -- >> >> int length = 3; // sum of the constant strings; we can check that >> this won't overflow at compile time but I think it couldn't no >> matter what because of method length constraints >> String mStr = m().toString(); >> length += mStr.length(); >> if (length < 0) { >> throw new OutOfMemoryError(); >> } >> String nStr = n().toString(); >> length += nStr.length(); >> if (length < 0) { >> throw new OutOfMemoryError(); >> } >> >> This continues to expand the bytecode, but probably manageably -- >> we don't actually need a local for length; if (int < 0) is easy >> in bytecode, and we can have only one OOME site that all the ifs >> jump to? >> >> On Fri, Mar 13, 2015 at 12:59 PM Alex Buckley >> > wrote: >> >> I do recognize that the proposed implementation doesn't >> reorder the >> evaluation of subexpressions. >> >> When discussing the proposed implementation of '+' -- whose >> key element >> is calling append(String) with a pre-computed value -- I was >> careful to >> set aside asynchronous OOMEs, but I see that even synchronous >> OOMEs are >> sidetracking us. My concern is not heap pressure; my concern is >> arbitrary unchecked exceptions arising from the (int) and >> append(String) calls. >> >> For sake of argument, I'll simplify "unchecked exceptions" to >> just >> RuntimeExceptions, not Errors. If you can guarantee that no >> RuntimeExceptions are thrown synchronously during the >> execution of those >> method bodies on the JVM, then '+' cannot fail and the timing of >> subexpression evaluation is unobservable (ordering is still >> observable, >> as required). I think this guarantee is just a matter of >> reviewing the >> method bodies. >> >> Alex >> >> On 3/12/2015 6:01 PM, Louis Wasserman wrote: >> > I confess I'm not sure how that "quality" goal would be >> achievable in >> > bytecode without deliberately allocating arrays we then >> discard. >> > >> > For what it's worth, delaying or avoiding OOMEs seems a >> desirable goal >> > in general, and up to a constant multiplicative factor, this >> > implementation seems to allocate the same amount in the >> same order. >> > That is, we're still computing m().toString() before >> n().toString(), and >> > up to a constant multiplicative factor, m().toString() >> allocates the >> > same number of bytes as the StringBuilder the status quo >> generates. So >> > if m() does something like allocate a >> char[Integer.MAX_VALUE], we still >> > OOM at the appropriate time. >> > >> > Other notes: this implementation would tend to decrease maximum >> > allocation, so it'd reduce OOMEs. Also, since the >> StringBuilder will >> > never need further expansion and we're only using the >> String and >> > primitive overloads of append, the only way for append to >> OOME would be >> > in append(float) and append(double), which allocate a >> FloatingDecimal >> > (which may, in turn, allocate a new thread-local char[26] >> if one isn't >> > already there). >> > >> > On Thu, Mar 12, 2015 at 4:28 PM Alex Buckley >> >> > > >> wrote: >> > >> > More abstract presentation. Given the expression: >> > >> > "foo" + m() + n() >> > >> > you must not evaluate n() if evaluation of "foo" + m() >> completes >> > abruptly. The proposed implementation evaluates n() >> regardless. >> > >> > All is not lost. In the proposed implementation, the >> abrupt completion >> > of "foo" + m() could occur because an append call fails >> or (thanks to >> > Jon for pointing this out) the StringBuilder ctor >> fails. The >> > quality-of-implementation issue is thus: if the >> proposed implementation >> > is of sufficiently high quality to guarantee that the >> ctor and the first >> > append both succeed, then the evaluation of "foo" + m() >> will always >> > complete normally, and it would be an unobservable >> (thus acceptable) >> > implementation detail to evaluate n() early. >> > >> > Alex >> > >> > On 3/11/2015 10:26 PM, Jeremy Manson wrote: >> > > Isn't Louis's proposed behavior equivalent to saying >> "the rightmost >> > > concatenation threw an OOME" instead of "some >> concatenation in the >> > > middle threw an OOME"? >> > > >> > > It's true that the intermediate String >> concatenations haven't >> > occurred >> > > at that point, but in the JDK's current >> implementation, that's true, >> > > too: the concatenations that have occurred at that >> point are >> > > StringBuilder ones, not String ones. If any of the >> append operations >> > > throws an OOME, no Strings have been created at all, >> either in >> > Louis's >> > > implementation or in the JDK's. >> > > >> > > Ultimately, isn't this a quality of implementation >> issue? And if so, >> > > isn't it a quality of implementation issue that >> doesn't provide any >> > > additional quality? I can't imagine code whose >> semantics relies on >> > > this, and if they do, they are relying on something >> > > implementation-dependent. >> > > >> > > Jeremy >> > > >> > > On Wed, Mar 11, 2015 at 6:13 PM, Alex Buckley >> > > >> > >> > > > __com >> > > >>> wrote: >> > > >> > > On 3/11/2015 2:01 PM, Louis Wasserman wrote: >> > > >> > > So for example, "foo" + myInt + myString + >> "bar" + myObj >> > would be >> > > compiled to the equivalent of >> > > >> > > int myIntTmp = myInt; >> > > String myStringTmp = >> String.valueOf(myString); // defend >> > against >> > > null >> > > String myObjTmp = >> > String.valueOf(String.valueOf(____myObj)); // defend >> > > against evil toString implementations >> returning null >> > > >> > > return new StringBuilder( >> > > 17 // length of "foo" (3) + max >> length of myInt (11) + >> > > length of >> > > "bar" (3) >> > > + myStringTmp.length() >> > > + myObjTmp.length()) >> > > .append("foo") >> > > .append(myIntTmp) >> > > .append(myStringTmp) >> > > .append("bar") >> > > .append(myObjTmp) >> > > .toString(); >> > > >> > > As far as language constraints go, the JLS >> is (apparently >> > > deliberately) >> > > vague about how string concatenation is >> implemented. "An >> > > implementation >> > > may choose to perform conversion and >> concatenation in one >> > step >> > > to avoid >> > > creating and then discarding an intermediate >> String >> > object. To >> > > increase >> > > the performance of repeated string >> concatenation, a Java >> > > compiler may >> > > use the StringBuffer class or a similar >> technique to >> > reduce the >> > > number >> > > of intermediate String objects that are >> created by >> > evaluation of an >> > > expression." We see no reason this approach >> would not >> > qualify as a >> > > "similar technique." >> > > >> > > >> > > The really key property of the string >> concatenation operator is >> > > left-associativity. Later subexpressions must not be >> > evaluated until >> > > earlier subexpressions have been successfully >> evaluated AND >> > > concatenated. Consider this expression: >> > > >> > > "foo" + m() + n() >> > > >> > > which JLS8 15.8 specifies to mean: >> > > >> > > ("foo" + m()) + n() >> > > >> > > We know from JLS8 15.6 that if m() throws, then >> foo+m() >> > throws, and >> > > n() will never be evaluated. >> > > >> > > Happily, your translation doesn't appear to >> catch and swallow >> > > exceptions when eagerly evaluating each >> subexpression in >> > turn, so I >> > > believe you won't evaluate n() if m() already threw. >> > > >> > > Unhappily, a call to append(..) can in general >> fail with >> > > OutOfMemoryError. (I'm not talking about >> asynchronous >> > exceptions in >> > > general, but rather the sense that append(..) >> manipulates the >> > heap >> > > so an OOME is at least plausible.) In the OpenJDK >> > implementation, if >> > > blah.append(m()) fails with OOME, then n() >> hasn't been >> > evaluated yet >> > > -- that's "real" left-associativity. In the proposed >> > implementation, >> > > it's possible that more memory is available when >> evaluating >> > m() and >> > > n() upfront than at the time of an append call, >> so n() is >> > evaluated >> > > even if append(<>) fails -- >> that's not >> > > left-associative. >> > > >> > > Perhaps you can set my mind at ease that >> append(..) can't >> > fail with >> > > OOME? >> > > >> > > Alex >> > > >> > > >> > >> > From lowasser at google.com Tue Apr 7 21:42:02 2015 From: lowasser at google.com (Louis Wasserman) Date: Tue, 07 Apr 2015 21:42:02 +0000 Subject: String concatenation tweaks In-Reply-To: <55244DFE.2050200@gmail.com> References: <5500E84F.3080800@oracle.com> <55022114.8040904@oracle.com> <55034189.4000900@oracle.com> <55244704.8080709@gmail.com> <55244DFE.2050200@gmail.com> Message-ID: In some ways it might be more sensible to provide those as optimized logarithms rather than making them part of String? The current private stringSize implementation is calibrated for short inputs, though, as opposed to a fast general logarithm -- compare Guava's IntMath.log10(int, RoundingMode) at http://docs.guava-libraries.googlecode.com/git-history/release/javadoc/com/google/common/math/IntMath.html#log10(int, java.math.RoundingMode) ). In any event, the vanilla StringBuilder proposal above represents a respectable win. If a FixedStringBuilder type or something that avoided the copy entirely were under consideration, I'd very much like to be involved in the API design, but I'd tend to prefer moving this change forward first as an incremental improvement? On Tue, Apr 7, 2015 at 2:37 PM Peter Levart wrote: > > > On 04/07/2015 11:10 PM, Louis Wasserman wrote: > > Could that actually be provided immutability-safely? I suppose an > append-only, fixed-length builder would be potentially safe. > > > I think the presented implementation *is* thread and immutability safe. It > only allows mutations from the constructing thread and disables them as > soon as toString() is called. > > > > Part of the trickiness there is with primitive parameters, where presizing > and doing the actual append both require calculating the size of the > primitive when converted to a string. The current approach just uses an > upper bound for the primitive type as a whole, which is fine and allocates > a small constant excess in most cases, but I'm not sure how we could avoid > duplicating that computation in a public API. > > > I've been thinking of static methods parallel to: > > String.valueOf(int) - String.lengthOf(int) > String.valueOf(long) - String.lengthOf(long) > ... > ... > > > The integral variants could be quick to compute (the implementations are > already there - they are just not public), the floating point maybe not so. > But the floating point conversion is already taking much more overhead and > estimating an upper bound would be fine in case floating point is involved. > If one wants to optimize the case of very long concatenation of exactly > sized Strings, integrals and other Objects with just one or few floating > point values, then he can always do it explicitly: > > "....long string...." + String.valueOf(Math.PI); > > Regards, Peter > > > > > On Tue, Apr 7, 2015 at 2:07 PM Peter Levart > wrote: > >> Hi Louis, >> >> This is nice. Amd could be even nicer. In case the estimated initial >> StringBuilder capacity is exactly the final String length, then >> constructing the String could skip the char[] copying step as the >> StringBuilder instance does not escape. But in order to be safe, this would >> have to be a special kind of StringBuilder. Like the following: >> >> >> http://cr.openjdk.java.net/~plevart/misc/ThreadLocalStringBuilder/webrev.01/ >> >> Such class would be useful for direct API use too. >> >> >> Regards, Peter >> >> >> On 03/13/2015 10:40 PM, Louis Wasserman wrote: >> >> Got it. I think the only cases we have to worry about, then, are buffer >> size overflows resulting in NegativeArraySizeException, or possibly an >> explicitly thrown OutOfMemoryError (which is StringBuilder's response when >> the buffer size tries to exceed Integer.MAX_VALUE). I think we might >> conceivably deal with this by rewriting the bytecode to -- I think we can >> improve on this with jump hackery to avoid repetition, but essentially -- >> >> int length = 3; // sum of the constant strings; we can check that this >> won't overflow at compile time but I think it couldn't no matter what >> because of method length constraints >> String mStr = m().toString(); >> length += mStr.length(); >> if (length < 0) { >> throw new OutOfMemoryError(); >> } >> String nStr = n().toString(); >> length += nStr.length(); >> if (length < 0) { >> throw new OutOfMemoryError(); >> } >> >> This continues to expand the bytecode, but probably manageably -- we >> don't actually need a local for length; if (int < 0) is easy in bytecode, >> and we can have only one OOME site that all the ifs jump to? >> >> On Fri, Mar 13, 2015 at 12:59 PM Alex Buckley >> wrote: >> >>> I do recognize that the proposed implementation doesn't reorder the >>> evaluation of subexpressions. >>> >>> When discussing the proposed implementation of '+' -- whose key element >>> is calling append(String) with a pre-computed value -- I was careful to >>> set aside asynchronous OOMEs, but I see that even synchronous OOMEs are >>> sidetracking us. My concern is not heap pressure; my concern is >>> arbitrary unchecked exceptions arising from the (int) and >>> append(String) calls. >>> >>> For sake of argument, I'll simplify "unchecked exceptions" to just >>> RuntimeExceptions, not Errors. If you can guarantee that no >>> RuntimeExceptions are thrown synchronously during the execution of those >>> method bodies on the JVM, then '+' cannot fail and the timing of >>> subexpression evaluation is unobservable (ordering is still observable, >>> as required). I think this guarantee is just a matter of reviewing the >>> method bodies. >>> >>> Alex >>> >>> On 3/12/2015 6:01 PM, Louis Wasserman wrote: >>> > I confess I'm not sure how that "quality" goal would be achievable in >>> > bytecode without deliberately allocating arrays we then discard. >>> > >>> > For what it's worth, delaying or avoiding OOMEs seems a desirable goal >>> > in general, and up to a constant multiplicative factor, this >>> > implementation seems to allocate the same amount in the same order. >>> > That is, we're still computing m().toString() before n().toString(), >>> and >>> > up to a constant multiplicative factor, m().toString() allocates the >>> > same number of bytes as the StringBuilder the status quo generates. So >>> > if m() does something like allocate a char[Integer.MAX_VALUE], we still >>> > OOM at the appropriate time. >>> > >>> > Other notes: this implementation would tend to decrease maximum >>> > allocation, so it'd reduce OOMEs. Also, since the StringBuilder will >>> > never need further expansion and we're only using the String and >>> > primitive overloads of append, the only way for append to OOME would be >>> > in append(float) and append(double), which allocate a FloatingDecimal >>> > (which may, in turn, allocate a new thread-local char[26] if one isn't >>> > already there). >>> > >>> > On Thu, Mar 12, 2015 at 4:28 PM Alex Buckley >> > > wrote: >>> > >>> > More abstract presentation. Given the expression: >>> > >>> > "foo" + m() + n() >>> > >>> > you must not evaluate n() if evaluation of "foo" + m() completes >>> > abruptly. The proposed implementation evaluates n() regardless. >>> > >>> > All is not lost. In the proposed implementation, the abrupt >>> completion >>> > of "foo" + m() could occur because an append call fails or (thanks >>> to >>> > Jon for pointing this out) the StringBuilder ctor fails. The >>> > quality-of-implementation issue is thus: if the proposed >>> implementation >>> > is of sufficiently high quality to guarantee that the ctor and the >>> first >>> > append both succeed, then the evaluation of "foo" + m() will always >>> > complete normally, and it would be an unobservable (thus >>> acceptable) >>> > implementation detail to evaluate n() early. >>> > >>> > Alex >>> > >>> > On 3/11/2015 10:26 PM, Jeremy Manson wrote: >>> > > Isn't Louis's proposed behavior equivalent to saying "the >>> rightmost >>> > > concatenation threw an OOME" instead of "some concatenation in >>> the >>> > > middle threw an OOME"? >>> > > >>> > > It's true that the intermediate String concatenations haven't >>> > occurred >>> > > at that point, but in the JDK's current implementation, that's >>> true, >>> > > too: the concatenations that have occurred at that point are >>> > > StringBuilder ones, not String ones. If any of the append >>> operations >>> > > throws an OOME, no Strings have been created at all, either in >>> > Louis's >>> > > implementation or in the JDK's. >>> > > >>> > > Ultimately, isn't this a quality of implementation issue? And >>> if so, >>> > > isn't it a quality of implementation issue that doesn't provide >>> any >>> > > additional quality? I can't imagine code whose semantics >>> relies on >>> > > this, and if they do, they are relying on something >>> > > implementation-dependent. >>> > > >>> > > Jeremy >>> > > >>> > > On Wed, Mar 11, 2015 at 6:13 PM, Alex Buckley >>> > >>> > > >> > >> wrote: >>> > > >>> > > On 3/11/2015 2:01 PM, Louis Wasserman wrote: >>> > > >>> > > So for example, "foo" + myInt + myString + "bar" + myObj >>> > would be >>> > > compiled to the equivalent of >>> > > >>> > > int myIntTmp = myInt; >>> > > String myStringTmp = String.valueOf(myString); // defend >>> > against >>> > > null >>> > > String myObjTmp = >>> > String.valueOf(String.valueOf(____myObj)); // defend >>> > > against evil toString implementations returning null >>> > > >>> > > return new StringBuilder( >>> > > 17 // length of "foo" (3) + max length of myInt >>> (11) + >>> > > length of >>> > > "bar" (3) >>> > > + myStringTmp.length() >>> > > + myObjTmp.length()) >>> > > .append("foo") >>> > > .append(myIntTmp) >>> > > .append(myStringTmp) >>> > > .append("bar") >>> > > .append(myObjTmp) >>> > > .toString(); >>> > > >>> > > As far as language constraints go, the JLS is >>> (apparently >>> > > deliberately) >>> > > vague about how string concatenation is implemented. >>> "An >>> > > implementation >>> > > may choose to perform conversion and concatenation in >>> one >>> > step >>> > > to avoid >>> > > creating and then discarding an intermediate String >>> > object. To >>> > > increase >>> > > the performance of repeated string concatenation, a Java >>> > > compiler may >>> > > use the StringBuffer class or a similar technique to >>> > reduce the >>> > > number >>> > > of intermediate String objects that are created by >>> > evaluation of an >>> > > expression." We see no reason this approach would not >>> > qualify as a >>> > > "similar technique." >>> > > >>> > > >>> > > The really key property of the string concatenation >>> operator is >>> > > left-associativity. Later subexpressions must not be >>> > evaluated until >>> > > earlier subexpressions have been successfully evaluated AND >>> > > concatenated. Consider this expression: >>> > > >>> > > "foo" + m() + n() >>> > > >>> > > which JLS8 15.8 specifies to mean: >>> > > >>> > > ("foo" + m()) + n() >>> > > >>> > > We know from JLS8 15.6 that if m() throws, then foo+m() >>> > throws, and >>> > > n() will never be evaluated. >>> > > >>> > > Happily, your translation doesn't appear to catch and >>> swallow >>> > > exceptions when eagerly evaluating each subexpression in >>> > turn, so I >>> > > believe you won't evaluate n() if m() already threw. >>> > > >>> > > Unhappily, a call to append(..) can in general fail with >>> > > OutOfMemoryError. (I'm not talking about asynchronous >>> > exceptions in >>> > > general, but rather the sense that append(..) manipulates >>> the >>> > heap >>> > > so an OOME is at least plausible.) In the OpenJDK >>> > implementation, if >>> > > blah.append(m()) fails with OOME, then n() hasn't been >>> > evaluated yet >>> > > -- that's "real" left-associativity. In the proposed >>> > implementation, >>> > > it's possible that more memory is available when evaluating >>> > m() and >>> > > n() upfront than at the time of an append call, so n() is >>> > evaluated >>> > > even if append(<>) fails -- that's not >>> > > left-associative. >>> > > >>> > > Perhaps you can set my mind at ease that append(..) can't >>> > fail with >>> > > OOME? >>> > > >>> > > Alex >>> > > >>> > > >>> > >>> >> >> > From john.r.rose at oracle.com Tue Apr 7 21:49:59 2015 From: john.r.rose at oracle.com (John Rose) Date: Tue, 7 Apr 2015 14:49:59 -0700 Subject: RFR (S): 8076461: JSR292: remove unused native and constants In-Reply-To: <4EB3C4DA-C382-4795-A676-6147E863DFF1@oracle.com> References: <4EB3C4DA-C382-4795-A676-6147E863DFF1@oracle.com> Message-ID: On Apr 7, 2015, at 12:11 PM, Michael Haupt wrote: > > Dear all, > > please review and sponsor this change. Cross-posted to hs-comp and core-lib as this is at the JVM/libraries boundary. This is a straightforward refactoring change that removes many constants and unused API from MHNatives, and places some constants used only in MemberName in that class. The class MethodHandleNatives.Constants exists to enumerate and cross-check any constants which the JVM and JDK code need to agree about. Removing a constant from MethodHandleNatives.Constants (moving to MemberName) may cause failures when MHN.verifyConstants is run (via "java -esa" on a debug build of Java). If there are no failures, I wonder what would happen if the JVM and JDK got out of sync. in their notion of the value of a constant like MN_CALLER_SENSITIVE. It's important that some part of our release testing detect if MN_CALLER_SENSITIVE (etc.) gets out of sync. If there is some reason why this testing is no longer needed, I'd like to see the whole Constants class go away, since that's all it's really good for. But I don't see that reason yet, and moving the constants somewhere either will cause a test failure, or *should* cause a test failure. I'm happy to see the "GC" guys go away. They were artifacts of a quickly moving 292 implementation that spanned two repositories with unsynchronized change streams. ? John > > RFE: https://bugs.openjdk.java.net/browse/JDK-8076461 > Changes: http://cr.openjdk.java.net/~mhaupt/8076461/webrev.00/ > > Tested with JPRT, HotSpot testset. > > Thanks, > > Michael > > -- > > > Dr. Michael Haupt | Principal Member of Technical Staff > Phone: +49 331 200 7277 | Fax: +49 331 200 7561 > Oracle Java Platform Group | HotSpot Compiler Team > Oracle Deutschland B.V. & Co. KG, Schiffbauergasse 14 | 14467 Potsdam, Germany > Oracle is committed to developing practices and products that help protect the environment > From erik.joelsson at oracle.com Wed Apr 8 08:32:24 2015 From: erik.joelsson at oracle.com (Erik Joelsson) Date: Wed, 08 Apr 2015 10:32:24 +0200 Subject: native2ascii be removed from JDK? In-Reply-To: <5519C1FC.6010303@oracle.com> References: <5519C1FC.6010303@oracle.com> Message-ID: <5524E798.1080301@oracle.com> Note that the JDK build itself uses native2ascii for the man pages. I have no idea why or if this is actually necessary. Here is the code: define install-ja-manpage $(MKDIR) -p $(@D) $(CAT) $< \ | $(NATIVE2ASCII) -encoding eucJP \ | $(SED) 's/@@VERSION@@/$(THIS_JDK_VERSION)/g' \ | $(NATIVE2ASCII) -reverse -encoding $1 \ > $@ endef /Erik On 2015-03-30 23:37, Mandy Chung wrote: > There are several existing ways to do native to ascii conversion. For > example, IDEs like NetBeans and IntelliJ support the transparent > native-to-ascii conversion. There is also maven native 2 ascii plugin. > > JEP 226 proposes to support UTF Properties file that will address the > original motivation of creating the native2ascii tool. > > While native2ascii used to be a convenient tool for some developers to > use, it may be time to remove it in JDK 9 and developers can use IDEs > and Maven plugin and other build tools. > > Any thought? > > Mandy From alexander.v.stepanov at oracle.com Wed Apr 8 10:14:12 2015 From: alexander.v.stepanov at oracle.com (alexander stepanov) Date: Wed, 08 Apr 2015 13:14:12 +0300 Subject: Review Request for 8039440: Tidy warnings cleanup for org/omg In-Reply-To: References: <5523EC62.4070907@oracle.com> <5523F5AE.2040707@Oracle.com> <55240D3D.8020402@oracle.com> Message-ID: <5524FF74.6040708@oracle.com> Thanks! On 07.04.2015 20:48, Lance Andersen wrote: > Hi Alexander, > > InTypeCode.java you might want to use {@code} vs so that you do > not have to use > < > > Otherwise it is OK > > Best > Lance > On Apr 7, 2015, at 1:00 PM, alexander stepanov > > wrote: > >> Hello Roger, >> >> Thank you for the notes, fixed: >> http://cr.openjdk.java.net/~avstepan/8039440/webrev.01/src/java.corba/share/classes/org/omg/CORBA/portable/package.html.udiff.html >> >> http://cr.openjdk.java.net/~avstepan/8039440/webrev.01/src/java.corba/share/classes/org/omg/CORBA/ShortHolder.java.udiff.html >> http://cr.openjdk.java.net/~avstepan/8039440/webrev.01/src/java.corba/share/classes/org/omg/CORBA/TypeCode.java.udiff.html >> >> Regards, >> Alexander >> >> On 07.04.2015 18:20, Roger Riggs wrote: >>> Hi, >>> >>> Just a few minor comments; no need for another webrev (on my account). >>> >>> The preferred form for code markup is {@code } instead of ... >>> >>> and ... but that may beyond the scope of the current issue. >>> >>> - Lowercase markup

    is preferred over uppercase

    but per file >>> conventions should be consistent. >>> >>> +++ >>> new/src/java.corba/share/classes/org/omg/CORBA/portable/package.html >>> 2015-04-07 16:41:12.299150361 +0400 >>> >>> -

  • Delegate >>> +
  • <*code*>Delegate >>> >>> (RR) Why is this list element in code, the others are not. >>> >>> +++ new/src/java.corba/share/classes/org/omg/CORBA/ShortHolder.java >>> 2015-04-07 16:41:09.883150470 +0400 >>> @@ -32,7 +32,7 @@ >>> /** >>> * The Holder for Short. For more information on >>> * Holder files, see >>> - * "Generated Files: Holder Files".

    >> + * "Generated Files: Holder Files".*

    * >>> >>> (RR)

    should be on a new line; before the paragraph it separates >>> >>> +++ new/src/java.corba/share/classes/org/omg/CORBA/TypeCode.java >>> 2015-04-07 16:41:10.567150439 +0400 >>> >>> @@ -164,9 +164,9 @@ >>> * >>> * Java IDL extends the CORBA specification to allow all operations >>> permitted >>> * on a struct TypeCode to be permitted >>> - * on an exception TypeCode as well.

    >>> - * >>> + * on an exception TypeCode as well. >>> */ >>> + >>> public abstract class TypeCode implements IDLEntity { >>> >>> (RR) There should not be blank line between comment and class >>> definition. >>> >>> >>> Thanks, Roger >>> >>> >>> On 4/7/2015 10:40 AM, alexander stepanov wrote: >>>> Hello, >>>> >>>> I'm not if the mail list is correct, but could anyone please review >>>> the following fix? >>>> http://cr.openjdk.java.net/~avstepan/8039440/webrev.01/ >>>> >>>> Bug: https://bugs.openjdk.java.net/browse/JDK-8039440 >>>> >>>> Just an HTML markup fix for CORBA. >>>> >>>> Thanks, >>>> Alexander >>>> >>> >> > > > > Lance > Andersen| Principal Member of Technical Staff | +1.781.442.2037 > Oracle Java Engineering > 1 Network Drive > Burlington, MA 01803 > Lance.Andersen at oracle.com > > > From alexander.v.stepanov at oracle.com Wed Apr 8 10:27:52 2015 From: alexander.v.stepanov at oracle.com (alexander stepanov) Date: Wed, 08 Apr 2015 13:27:52 +0300 Subject: Review Request for 8039440: Tidy warnings cleanup for org/omg In-Reply-To: <55241041.60005@Oracle.com> References: <5523EC62.4070907@oracle.com> <5523F5AE.2040707@Oracle.com> <55240D3D.8020402@oracle.com> <55241041.60005@Oracle.com> Message-ID: <552502A8.20101@oracle.com> Thanks! On 07.04.2015 20:13, Roger Riggs wrote: > Thanks, looks fine. > > Roger > > > On 4/7/2015 1:00 PM, alexander stepanov wrote: >> Hello Roger, >> >> Thank you for the notes, fixed: >> http://cr.openjdk.java.net/~avstepan/8039440/webrev.01/src/java.corba/share/classes/org/omg/CORBA/portable/package.html.udiff.html >> >> http://cr.openjdk.java.net/~avstepan/8039440/webrev.01/src/java.corba/share/classes/org/omg/CORBA/ShortHolder.java.udiff.html >> >> http://cr.openjdk.java.net/~avstepan/8039440/webrev.01/src/java.corba/share/classes/org/omg/CORBA/TypeCode.java.udiff.html >> >> >> Regards, >> Alexander >> >> On 07.04.2015 18:20, Roger Riggs wrote: >>> Hi, >>> >>> Just a few minor comments; no need for another webrev (on my account). >>> >>> The preferred form for code markup is {@code } instead of ... >>> >>> and ... but that may beyond the scope of the current issue. >>> >>> - Lowercase markup

    is preferred over uppercase

    but per file >>> conventions should be consistent. >>> >>> +++ >>> new/src/java.corba/share/classes/org/omg/CORBA/portable/package.html >>> 2015-04-07 16:41:12.299150361 +0400 >>> >>> -

  • Delegate >>> +
  • <*code*>Delegate >>> >>> (RR) Why is this list element in code, the others are not. >>> >>> +++ new/src/java.corba/share/classes/org/omg/CORBA/ShortHolder.java >>> 2015-04-07 16:41:09.883150470 +0400 >>> @@ -32,7 +32,7 @@ >>> /** >>> * The Holder for Short. For more information on >>> * Holder files, see >>> - * "Generated Files: Holder Files".

    >> + * "Generated Files: Holder Files".*

    * >>> >>> (RR)

    should be on a new line; before the paragraph it separates >>> >>> +++ new/src/java.corba/share/classes/org/omg/CORBA/TypeCode.java >>> 2015-04-07 16:41:10.567150439 +0400 >>> >>> @@ -164,9 +164,9 @@ >>> * >>> * Java IDL extends the CORBA specification to allow all operations >>> permitted >>> * on a struct TypeCode to be permitted >>> - * on an exception TypeCode as well.

    >>> - * >>> + * on an exception TypeCode as well. >>> */ >>> + >>> public abstract class TypeCode implements IDLEntity { >>> >>> (RR) There should not be blank line between comment and class >>> definition. >>> >>> >>> Thanks, Roger >>> >>> >>> On 4/7/2015 10:40 AM, alexander stepanov wrote: >>>> Hello, >>>> >>>> I'm not if the mail list is correct, but could anyone please review >>>> the following fix? >>>> http://cr.openjdk.java.net/~avstepan/8039440/webrev.01/ >>>> >>>> Bug: https://bugs.openjdk.java.net/browse/JDK-8039440 >>>> >>>> Just an HTML markup fix for CORBA. >>>> >>>> Thanks, >>>> Alexander >>>> >>> >> > From vladimir.x.ivanov at oracle.com Wed Apr 8 13:06:41 2015 From: vladimir.x.ivanov at oracle.com (Vladimir Ivanov) Date: Wed, 08 Apr 2015 16:06:41 +0300 Subject: [9] RFR (M): 8057967: CallSite dependency tracking scales devastatingly poorly In-Reply-To: <551C5B92.8060500@oracle.com> References: <551C5B92.8060500@oracle.com> Message-ID: <552527E1.5060102@oracle.com> Any volunteers to review VM part? Latest webrev: http://cr.openjdk.java.net/~vlivanov/8057967/webrev.01/hotspot/ http://cr.openjdk.java.net/~vlivanov/8057967/webrev.01/jdk/ Best regards, Vladimir Ivanov On 4/1/15 11:56 PM, Vladimir Ivanov wrote: > http://cr.openjdk.java.net/~vlivanov/8057967/webrev.00/hotspot/ > http://cr.openjdk.java.net/~vlivanov/8057967/webrev.00/jdk/ > https://bugs.openjdk.java.net/browse/JDK-8057967 > > HotSpot JITs inline very aggressively through CallSites. The > optimistically treat CallSite target as constant, but record a nmethod > dependency to invalidate the compiled code once CallSite target changes. > > Right now, such dependencies have call site class as a context. This > context is too coarse and it leads to context pollution: if some > CallSite target changes, VM needs to enumerate all nmethods which > depends on call sites of such type. > > As performance analysis in the bug report shows, it can sum to > significant amount of work. > > While working on the fix, I investigated 3 approaches: > (1) unique context per call site > (2) use CallSite target class > (3) use a class the CallSite instance is linked to > > Considering call sites are ubiquitous (e.g. 10,000s on some octane > benchmarks), loading a dedicated class for every call site is an > overkill (even VM anonymous). > > CallSite target class > (MethodHandle.form->LambdaForm.vmentry->MemberName.clazz->Class) is > also not satisfactory, since it is a compiled LambdaForm VM anonymous > class, which is heavily shared. It gets context pollution down, but > still the overhead is quite high. > > So, I decided to focus on (3) and ended up with a mixture of (2) & (3). > > Comparing to other options, the complications of (3) are: > - CallSite can stay unlinked (e.g. CallSite.dynamicInvoker()), so > there should be some default context VM can use > > - CallSite instances can be shared and it shouldn't keep the context > class from unloading; > > It motivated a scheme where CallSite context is initialized lazily and > can change during lifetime. When CallSite is linked with an indy > instruction, it's context is initialized. Usually, JIT sees CallSite > instances with initialized context (since it reaches them through indy), > but if it's not the case and there's no context yet, JIT sets it to > "default context", which means "use target call site". > > I introduced CallSite$DependencyContext, which represents a nmethod > dependency context and points (indirectly) to a Class used as a context. > > Context class is referenced through a phantom reference > (sun.misc.Cleaner to simplify cleanup). Though it's impossible to > extract referent using Reference.get(), VM can access it directly by > reading corresponding field. Unlike other types of references, phantom > references aren't cleared automatically. It allows VM to access context > class until cleanup is performed. And cleanup resets the context to > NULL, in addition to invalidating all relevant dependencies. > > There are 3 context states a CallSite instance can be in: > (1) NULL: no depedencies > (2) DependencyContext.DEFAULT_CONTEXT: dependencies are stored in > call site target class > (3) DependencyContext for some class: dependencies are stored on the > class DependencyContext instance points to > > Every CallSite starts w/o a context (1) and then lazily gets one ((2) or > (3) depending on the situation). > > State transitions: > (1->3): When a CallSite w/o a context (1) is linked with some indy > call site, it's owner is recorded as a context (3). > > (1->2): When JIT needs to record a dependency on a target of a > CallSite w/o a context(1), it sets the context to DEFAULT_CONTEXT and > uses target class to store the dependency. > > (3->1): When context class becomes unreachable, a cleanup hook > invalidates all dependencies on that CallSite and resets the context to > NULL (1). > > Only (3->1) requires dependency invalidation, because there are no > depedencies in (1) and (2->1) isn't performed. > > (1->3) is done in Java code (CallSite.initContext) and (1->2) is > performed in VM (ciCallSite::get_context()). The updates are performed > by CAS, so there's no need in additional synchronization. Other > operations on VM side are volatile (to play well with Java code) and > performed with Compile_lock held (to avoid races between VM operations). > > Some statistics: > Box2D, latest jdk9-dev > - CallSite instances: ~22000 > > - invalidated nmethods due to CallSite target changes: ~60 > > - checked call_site_target_value dependencies: > - before the fix: ~1,600,000 > - after the fix: ~600 > > Testing: > - dedicated test which excercises different state transitions > - jdk/java/lang/invoke, hotspot/test/compiler/jsr292, nashorn > > Thanks! > > Best regards, > Vladimir Ivanov From Sergey.Bylokhov at oracle.com Wed Apr 8 13:29:41 2015 From: Sergey.Bylokhov at oracle.com (Sergey Bylokhov) Date: Wed, 08 Apr 2015 16:29:41 +0300 Subject: [9] Review Request: 8076264 [macosx] Launching app on MacOSX requires enclosing class Message-ID: <55252D45.4050109@oracle.com> Hello. Please review the fix for jdk 9. After the fix we clear all errors caused by getCanonicalName() on the mainclass and leave JAVA_MAIN_CLASS_ empty. This empty case will be handled in the NSApplicationAWT.m. Plus small cleanup suggested in the bug report(jstring->jclass). Bug: https://bugs.openjdk.java.net/browse/JDK-8076264 Webrev can be found at: http://cr.openjdk.java.net/~serb/8076264/webrev.01 -- Best regards, Sergey. From vladimir.x.ivanov at oracle.com Wed Apr 8 15:41:15 2015 From: vladimir.x.ivanov at oracle.com (Vladimir Ivanov) Date: Wed, 08 Apr 2015 18:41:15 +0300 Subject: [9] RFR (S): Class.getSimpleName() should work for non-JLS compliant class names Message-ID: <55254C1B.2040603@oracle.com> http://cr.openjdk.java.net/~vlivanov/8057919/webrev.00/jdk http://cr.openjdk.java.net/~vlivanov/8057919/webrev.00/hotspot https://bugs.openjdk.java.net/browse/JDK-8057919 The logic to compute simple name (Class.getSimpleName()) for inner/nested/local classes is tightly coupled with Java naming scheme and sometimes fails for classes generated from non-Java code. Instead of parsing class name and try to extract simple name based on JLS rules, the fix I propose is to use InnerClasses attribute from the class file. Simple name is already recorded there. JVMS-4.7.6: The InnerClasses Attribute "inner_name_index: If C is anonymous (JLS ?15.9.5), the value of the inner_name_index item must be zero. Otherwise, the value of the inner_name_index item must be a valid index into the constant_pool table, and the entry at that index must be a CONSTANT_Utf8_info structure (?4.4.7) that represents the original simple name of C, as given in the source code from which this class file was compiled." Since I consider backporting the fix into 8u60, I'd like to hear opinions about backward compatibility of such change. As an alternative solution, I can restore original logic and consult InnerClasses attribute when class name parsing logic fails. Testing: regression test, jck-runtime/java_lang, jdk/test/java/lang/ Thanks! Best regards, Vladimir Ivanov From mandy.chung at oracle.com Wed Apr 8 18:37:50 2015 From: mandy.chung at oracle.com (Mandy Chung) Date: Wed, 08 Apr 2015 11:37:50 -0700 Subject: RFR: 8076090: jimage extract + recreate broken again In-Reply-To: <1C17B0E1-ED6E-461E-9EAA-554C5CBE5AD1@oracle.com> References: <1C17B0E1-ED6E-461E-9EAA-554C5CBE5AD1@oracle.com> Message-ID: <5525757E.9000501@oracle.com> Forwarding to core-libs-dev for review (bcc jdk9-dev) On 4/8/2015 11:02 AM, Jim Laskey (Oracle) wrote: > The fix addresses problem with the jimage tool rebuilding meta data on windows systems (\ in path.) Including new test to verify that jimage tool does successfully extract and recreate. > > JBS: https://bugs.openjdk.java.net/browse/JDK-8076090 > Webrev: http://cr.openjdk.java.net/~jlaskey/8076090/webrev/index.html Looks fine to me. The test will need to check if $JAVA_HOME is an exploded image ($JAVA_HOME/lib/modules not exists); if so, it should simply exit. Otherwise the test will fail. Nit: line 24 is not unused. FYI. jdk/test/lib/testlibrary/jdk/testlibrary/ProcessTools.java could be used. Mandy From aleksej.efimov at oracle.com Wed Apr 8 20:57:19 2015 From: aleksej.efimov at oracle.com (Aleksej Efimov) Date: Wed, 08 Apr 2015 23:57:19 +0300 Subject: RFR: 8076549: Update JAX-WS RI integration to latest version (2.2.11-b150402.1412) In-Reply-To: <551EAFDA.3020809@oracle.com> References: <551EAFDA.3020809@oracle.com> Message-ID: <5525962F.9060906@oracle.com> Hi, Can I kindly ask for a review of this JAX-WS update? With Best Regards, Aleksej On 04/03/2015 06:20 PM, Aleksej Efimov wrote: > Hello, > > Can I have a review for a JDK9 bulk update of JAX-B/WS from upstream > projects. > Webrev: http://cr.openjdk.java.net/~aefimov/8076549/9/00/ > More details in issue description: > https://bugs.openjdk.java.net/browse/JDK-8076549 > > Thank you, > Aleksej From david.holmes at oracle.com Thu Apr 9 02:52:15 2015 From: david.holmes at oracle.com (David Holmes) Date: Thu, 09 Apr 2015 12:52:15 +1000 Subject: [9] RFR (S): Class.getSimpleName() should work for non-JLS compliant class names In-Reply-To: <55254C1B.2040603@oracle.com> References: <55254C1B.2040603@oracle.com> Message-ID: <5525E95F.7080306@oracle.com> Hi Vladimir, On 9/04/2015 1:41 AM, Vladimir Ivanov wrote: > http://cr.openjdk.java.net/~vlivanov/8057919/webrev.00/jdk > http://cr.openjdk.java.net/~vlivanov/8057919/webrev.00/hotspot > https://bugs.openjdk.java.net/browse/JDK-8057919 > > The logic to compute simple name (Class.getSimpleName()) for > inner/nested/local classes is tightly coupled with Java naming scheme > and sometimes fails for classes generated from non-Java code. Meta-question: if this is non-Java code then what does/should "simpleName" even mean? "Returns the simple name of the underlying class as given in the source code." If there is no (java) source code does this have any meaning? Should it return "" ? > Instead of parsing class name and try to extract simple name based on > JLS rules, the fix I propose is to use InnerClasses attribute from the > class file. Simple name is already recorded there. > > JVMS-4.7.6: The InnerClasses Attribute > "inner_name_index: If C is anonymous (JLS ?15.9.5), the value of the > inner_name_index item must be zero. Otherwise, the value of the > inner_name_index item must be a valid index into the constant_pool > table, and the entry at that index must be a CONSTANT_Utf8_info > structure (?4.4.7) that represents the original simple name of C, as > given in the source code from which this class file was compiled." > > Since I consider backporting the fix into 8u60, I'd like to hear > opinions about backward compatibility of such change. > > As an alternative solution, I can restore original logic and consult > InnerClasses attribute when class name parsing logic fails. I think I'd prefer to see the VM call only used as a fallback if the regular parsing fails. That would prevent any compatibility issues for the 8u backport (ignoring tests that deliberately generate invalidly named classes). Thanks, David > Testing: regression test, jck-runtime/java_lang, jdk/test/java/lang/ > > Thanks! > > Best regards, > Vladimir Ivanov From forax at univ-mlv.fr Thu Apr 9 06:10:57 2015 From: forax at univ-mlv.fr (=?ISO-8859-1?Q?R=E9mi_Forax?=) Date: Thu, 09 Apr 2015 06:10:57 +0000 Subject: [9] RFR (S): Class.getSimpleName() should work for non-JLS compliant class names In-Reply-To: <5525E95F.7080306@oracle.com> References: <55254C1B.2040603@oracle.com> <5525E95F.7080306@oracle.com> Message-ID: <3AD9FDA1-CB4E-4F08-BC42-F1B311AA8D3A@univ-mlv.fr> Hi David, The problem is that j.l.i.MethodType.toString uses getSimpleName and j.l i.WrongMethodTypeException uses MethodType.toString. So if getSimpleName returns a blank string, you destroy the debuggability of any invokedynamic/methodhandle calls. regards, R?mi Le 9 avril 2015 04:52:15 CEST, David Holmes a ?crit : >Hi Vladimir, > >On 9/04/2015 1:41 AM, Vladimir Ivanov wrote: >> http://cr.openjdk.java.net/~vlivanov/8057919/webrev.00/jdk >> http://cr.openjdk.java.net/~vlivanov/8057919/webrev.00/hotspot >> https://bugs.openjdk.java.net/browse/JDK-8057919 >> >> The logic to compute simple name (Class.getSimpleName()) for >> inner/nested/local classes is tightly coupled with Java naming scheme >> and sometimes fails for classes generated from non-Java code. > >Meta-question: if this is non-Java code then what does/should >"simpleName" even mean? "Returns the simple name of the underlying >class >as given in the source code." If there is no (java) source code does >this have any meaning? Should it return "" ? > >> Instead of parsing class name and try to extract simple name based on >> JLS rules, the fix I propose is to use InnerClasses attribute from >the >> class file. Simple name is already recorded there. > > >> JVMS-4.7.6: The InnerClasses Attribute >> "inner_name_index: If C is anonymous (JLS ?15.9.5), the value of the >> inner_name_index item must be zero. Otherwise, the value of the >> inner_name_index item must be a valid index into the constant_pool >> table, and the entry at that index must be a CONSTANT_Utf8_info >> structure (?4.4.7) that represents the original simple name of C, as >> given in the source code from which this class file was compiled." >> >> Since I consider backporting the fix into 8u60, I'd like to hear >> opinions about backward compatibility of such change. >> >> As an alternative solution, I can restore original logic and consult >> InnerClasses attribute when class name parsing logic fails. > >I think I'd prefer to see the VM call only used as a fallback if the >regular parsing fails. That would prevent any compatibility issues for >the 8u backport (ignoring tests that deliberately generate invalidly >named classes). > >Thanks, >David > >> Testing: regression test, jck-runtime/java_lang, jdk/test/java/lang/ >> >> Thanks! >> >> Best regards, >> Vladimir Ivanov From david.holmes at oracle.com Thu Apr 9 06:27:33 2015 From: david.holmes at oracle.com (David Holmes) Date: Thu, 09 Apr 2015 16:27:33 +1000 Subject: [9] RFR (S): Class.getSimpleName() should work for non-JLS compliant class names In-Reply-To: <3AD9FDA1-CB4E-4F08-BC42-F1B311AA8D3A@univ-mlv.fr> References: <55254C1B.2040603@oracle.com> <5525E95F.7080306@oracle.com> <3AD9FDA1-CB4E-4F08-BC42-F1B311AA8D3A@univ-mlv.fr> Message-ID: <55261BD5.9070208@oracle.com> Hi Remi, On 9/04/2015 4:10 PM, R?mi Forax wrote: > Hi David, > The problem is that j.l.i.MethodType.toString uses getSimpleName and j.l > i.WrongMethodTypeException uses MethodType.toString. > > So if getSimpleName returns a blank string, you destroy the debuggability of any invokedynamic/methodhandle calls. Okay, so an alternative there is for MethodType.toString to not use getSimpleName :) More seriously perhaps things like getSimpleName need to be re-specified to account for classes coming from other than Java source code? Even the INNERCLASSES_Attribute associates the name with Java source code: "original simple name of C, as given in the source code from which this class file was compiled". And what is a "simple name"? It should be the most basic name given to a class without any prefix that indicates an enclosing type or containing package - but if non-Java-language-names are allowed how can you recognize such a prefix? Cheers, David > regards, > R?mi > > Le 9 avril 2015 04:52:15 CEST, David Holmes a ?crit : >> Hi Vladimir, >> >> On 9/04/2015 1:41 AM, Vladimir Ivanov wrote: >>> http://cr.openjdk.java.net/~vlivanov/8057919/webrev.00/jdk >>> http://cr.openjdk.java.net/~vlivanov/8057919/webrev.00/hotspot >>> https://bugs.openjdk.java.net/browse/JDK-8057919 >>> >>> The logic to compute simple name (Class.getSimpleName()) for >>> inner/nested/local classes is tightly coupled with Java naming scheme >>> and sometimes fails for classes generated from non-Java code. >> >> Meta-question: if this is non-Java code then what does/should >> "simpleName" even mean? "Returns the simple name of the underlying >> class >> as given in the source code." If there is no (java) source code does >> this have any meaning? Should it return "" ? >> >>> Instead of parsing class name and try to extract simple name based on >>> JLS rules, the fix I propose is to use InnerClasses attribute from >> the >>> class file. Simple name is already recorded there. >>> >>> JVMS-4.7.6: The InnerClasses Attribute >>> "inner_name_index: If C is anonymous (JLS ?15.9.5), the value of the >>> inner_name_index item must be zero. Otherwise, the value of the >>> inner_name_index item must be a valid index into the constant_pool >>> table, and the entry at that index must be a CONSTANT_Utf8_info >>> structure (?4.4.7) that represents the original simple name of C, as >>> given in the source code from which this class file was compiled." >>> >>> Since I consider backporting the fix into 8u60, I'd like to hear >>> opinions about backward compatibility of such change. >>> >>> As an alternative solution, I can restore original logic and consult >>> InnerClasses attribute when class name parsing logic fails. >> >> I think I'd prefer to see the VM call only used as a fallback if the >> regular parsing fails. That would prevent any compatibility issues for >> the 8u backport (ignoring tests that deliberately generate invalidly >> named classes). >> >> Thanks, >> David >> >>> Testing: regression test, jck-runtime/java_lang, jdk/test/java/lang/ >>> >>> Thanks! >>> >>> Best regards, >>> Vladimir Ivanov > From john.r.rose at oracle.com Thu Apr 9 06:33:41 2015 From: john.r.rose at oracle.com (John Rose) Date: Wed, 8 Apr 2015 23:33:41 -0700 Subject: [9] RFR (S): Class.getSimpleName() should work for non-JLS compliant class names In-Reply-To: <5525E95F.7080306@oracle.com> References: <55254C1B.2040603@oracle.com> <5525E95F.7080306@oracle.com> Message-ID: <238882B4-E15A-494E-A88C-F9D6A145E2CD@oracle.com> On Apr 8, 2015, at 7:52 PM, David Holmes wrote: > > Meta-question: if this is non-Java code then what does/should "simpleName" even mean? "Returns the simple name of the underlying class as given in the source code." If there is no (java) source code does this have any meaning? Should it return "" ? Non-Java languages can use the JVM's features, including the InnerClasses attribute. The simple name of a class has a natural (JVM-level) definition in terms of the contents of the class's InnerClasses attribute. Parsing the name string was always a buggy stopgap. It doesn't fully make sense for either Java or non-Java programs. ? John From robbiexgibson at yahoo.com Thu Apr 9 07:47:54 2015 From: robbiexgibson at yahoo.com (Robert Gibson) Date: Thu, 9 Apr 2015 07:47:54 +0000 (UTC) Subject: JDK-8060068/JDK-8067904 DriverManager clean-up introduces bootstrap problem that breaks production drivers In-Reply-To: <564412785.4394192.1428062862423.JavaMail.yahoo@mail.yahoo.com> References: <551E73A5.70704@oracle.com> <564412785.4394192.1428062862423.JavaMail.yahoo@mail.yahoo.com> Message-ID: <139269075.2548907.1428565674707.JavaMail.yahoo@mail.yahoo.com> Hi again, I just realised that I missed an important bit from the test case in my earlier mail. The jar file used for the test needs to contain, in addition to the class files, a text file called META-INF/services/java.sql.Driver containing the text MyDriver since it is the interaction between the driver being loaded manually and through the Service Provider mechanism which causes the dysfunction. Regards, Robert On Friday, 3 April 2015, 14:07, Robert Gibson wrote: Thanks Alan, Note that the repro given in my mail is a bit simpler than the current defect description, especially if you don't have access to the "MyFace" JDBC driver. Regards, Robert On Friday, 3 April 2015, 13:04, Alan Bateman wrote: On 03/04/2015 10:33, Robert Gibson wrote: > Hi there, > > We are doing some early testing with JDK 9 and have discovered that the changes made to java.sql.DriverManager back in November/December have introduced an incompatibility with our JDBC driver (that we have used unchanged since Java 6) when it is pre-loaded with Class.forName (as recommended by Tomcat and specified as being harmless in the JavaDoc). We filed a bug report but it got an incident ID JI-9019539 and then disappeared into a black hole. > There does appear to be an issue with those changes. I've located the incident and moved it to the JDK project as JDK-8076639 [1]. -Alan [1] https://bugs.openjdk.java.net/browse/JDK-8076639 From sean.coffey at oracle.com Thu Apr 9 13:42:45 2015 From: sean.coffey at oracle.com (=?UTF-8?B?U2XDoW4gQ29mZmV5?=) Date: Thu, 09 Apr 2015 14:42:45 +0100 Subject: RFR (XXS) : 8050123: Incorrect property name documented in CORBA InputStream API Message-ID: <552681D5.9020605@oracle.com> https://bugs.openjdk.java.net/browse/JDK-8050123 diff --git a/src/java.corba/share/classes/org/omg/CORBA_2_3/portable/InputStream.java b/src/java.corba/share/classes/org/omg/CORBA_2_3/portable/InputStream.java --- a/src/java.corba/share/classes/org/omg/CORBA_2_3/portable/InputStream.java +++ b/src/java.corba/share/classes/org/omg/CORBA_2_3/portable/InputStream.java @@ -77,7 +77,7 @@ * * throw SecurityException if SecurityManager is installed and * enableSubclassImplementation SerializablePermission - * is not granted or jdk.corba.allowOutputStreamSubclass system + * is not granted or jdk.corba.allowInputStreamSubclass system * property is either not set or is set to 'false' */ public InputStream() { -- Regards, Sean. From vladimir.x.ivanov at oracle.com Thu Apr 9 14:17:27 2015 From: vladimir.x.ivanov at oracle.com (Vladimir Ivanov) Date: Thu, 09 Apr 2015 17:17:27 +0300 Subject: [9] RFR (S): Class.getSimpleName() should work for non-JLS compliant class names In-Reply-To: <3AD9FDA1-CB4E-4F08-BC42-F1B311AA8D3A@univ-mlv.fr> References: <55254C1B.2040603@oracle.com> <5525E95F.7080306@oracle.com> <3AD9FDA1-CB4E-4F08-BC42-F1B311AA8D3A@univ-mlv.fr> Message-ID: <552689F7.7030605@oracle.com> On 4/9/15 9:10 AM, R?mi Forax wrote: > Hi David, > The problem is that j.l.i.MethodType.toString uses getSimpleName and j.l > i.WrongMethodTypeException uses MethodType.toString. > > So if getSimpleName returns a blank string, you destroy the debuggability of any invokedynamic/methodhandle calls. Debuggability is a different story. MethodType.toString() can produce ambiguous description, since it doesn't print all the details about the structure. Right now, if a MethodType refers to a problematic class, MethodType.toString() throws an InternalError("Malformed class name"). Best regards, Vladimir Ivanov > > regards, > R?mi > > Le 9 avril 2015 04:52:15 CEST, David Holmes a ?crit : >> Hi Vladimir, >> >> On 9/04/2015 1:41 AM, Vladimir Ivanov wrote: >>> http://cr.openjdk.java.net/~vlivanov/8057919/webrev.00/jdk >>> http://cr.openjdk.java.net/~vlivanov/8057919/webrev.00/hotspot >>> https://bugs.openjdk.java.net/browse/JDK-8057919 >>> >>> The logic to compute simple name (Class.getSimpleName()) for >>> inner/nested/local classes is tightly coupled with Java naming scheme >>> and sometimes fails for classes generated from non-Java code. >> >> Meta-question: if this is non-Java code then what does/should >> "simpleName" even mean? "Returns the simple name of the underlying >> class >> as given in the source code." If there is no (java) source code does >> this have any meaning? Should it return "" ? >> >>> Instead of parsing class name and try to extract simple name based on >>> JLS rules, the fix I propose is to use InnerClasses attribute from >> the >>> class file. Simple name is already recorded there. >>> >>> JVMS-4.7.6: The InnerClasses Attribute >>> "inner_name_index: If C is anonymous (JLS ?15.9.5), the value of the >>> inner_name_index item must be zero. Otherwise, the value of the >>> inner_name_index item must be a valid index into the constant_pool >>> table, and the entry at that index must be a CONSTANT_Utf8_info >>> structure (?4.4.7) that represents the original simple name of C, as >>> given in the source code from which this class file was compiled." >>> >>> Since I consider backporting the fix into 8u60, I'd like to hear >>> opinions about backward compatibility of such change. >>> >>> As an alternative solution, I can restore original logic and consult >>> InnerClasses attribute when class name parsing logic fails. >> >> I think I'd prefer to see the VM call only used as a fallback if the >> regular parsing fails. That would prevent any compatibility issues for >> the 8u backport (ignoring tests that deliberately generate invalidly >> named classes). >> >> Thanks, >> David >> >>> Testing: regression test, jck-runtime/java_lang, jdk/test/java/lang/ >>> >>> Thanks! >>> >>> Best regards, >>> Vladimir Ivanov > From vladimir.x.ivanov at oracle.com Thu Apr 9 14:51:06 2015 From: vladimir.x.ivanov at oracle.com (Vladimir Ivanov) Date: Thu, 09 Apr 2015 17:51:06 +0300 Subject: [9] RFR (S): Class.getSimpleName() should work for non-JLS compliant class names In-Reply-To: <5525E95F.7080306@oracle.com> References: <55254C1B.2040603@oracle.com> <5525E95F.7080306@oracle.com> Message-ID: <552691DA.7000604@oracle.com> David, thanks for the feedback! Updated webrev: http://cr.openjdk.java.net/~vlivanov/8057919/webrev.01/jdk http://cr.openjdk.java.net/~vlivanov/8057919/webrev.01/hotspot I restored original logic and call into VM only if it fails. >> The logic to compute simple name (Class.getSimpleName()) for >> inner/nested/local classes is tightly coupled with Java naming scheme >> and sometimes fails for classes generated from non-Java code. > > Meta-question: if this is non-Java code then what does/should > "simpleName" even mean? "Returns the simple name of the underlying class > as given in the source code." If there is no (java) source code does > this have any meaning? Should it return "" ? My reading of the JVMS is that InnerClasses attribute can be freely used by non-Java compilers to store simple names for classes they generate. The current wording for inner_name_index doesn't mention Java language. Best regards, Vladimir Ivanov >> Instead of parsing class name and try to extract simple name based on >> JLS rules, the fix I propose is to use InnerClasses attribute from the >> class file. Simple name is already recorded there. > > >> JVMS-4.7.6: The InnerClasses Attribute >> "inner_name_index: If C is anonymous (JLS ?15.9.5), the value of the >> inner_name_index item must be zero. Otherwise, the value of the >> inner_name_index item must be a valid index into the constant_pool >> table, and the entry at that index must be a CONSTANT_Utf8_info >> structure (?4.4.7) that represents the original simple name of C, as >> given in the source code from which this class file was compiled." >> >> Since I consider backporting the fix into 8u60, I'd like to hear >> opinions about backward compatibility of such change. >> >> As an alternative solution, I can restore original logic and consult >> InnerClasses attribute when class name parsing logic fails. > > I think I'd prefer to see the VM call only used as a fallback if the > regular parsing fails. That would prevent any compatibility issues for > the 8u backport (ignoring tests that deliberately generate invalidly > named classes). > > Thanks, > David > >> Testing: regression test, jck-runtime/java_lang, jdk/test/java/lang/ >> >> Thanks! >> >> Best regards, >> Vladimir Ivanov From james.laskey at oracle.com Thu Apr 9 14:59:05 2015 From: james.laskey at oracle.com (Jim Laskey (Oracle)) Date: Thu, 9 Apr 2015 11:59:05 -0300 Subject: RFR: 8076090: jimage extract + recreate broken again In-Reply-To: <5525757E.9000501@oracle.com> References: <1C17B0E1-ED6E-461E-9EAA-554C5CBE5AD1@oracle.com> <5525757E.9000501@oracle.com> Message-ID: Thanks Mandy. Changed the main to ; public static void main(String[] args) { final String JAVA_HOME = System.getProperty("java.home"); Path jimagePath = Paths.get(JAVA_HOME, "bin", "jimage"); Path bootimagePath = Paths.get(JAVA_HOME, "lib", "modules", "bootmodules.jimage"); if (Files.exists(jimagePath) && Files.exists(bootimagePath)) { String jimage = jimagePath.toAbsolutePath().toString(); String bootimage = bootimagePath.toAbsolutePath().toString(); String extractDir = Paths.get(".", "extract").toAbsolutePath().toString(); String recreateImage = Paths.get(".", "recreate.jimage").toAbsolutePath().toString(); exec(new String[] {jimage, "extract", "--dir", extractDir, bootimage}); exec(new String[] {jimage, "recreate", "--dir", extractDir, recreateImage}); System.err.println("Test successful"); } else { System.err.println("Test skipped, no module image"); } } Running jprt - okay to push after that? Cheers, -- Jim > On Apr 8, 2015, at 3:37 PM, Mandy Chung wrote: > > Forwarding to core-libs-dev for review (bcc jdk9-dev) > > On 4/8/2015 11:02 AM, Jim Laskey (Oracle) wrote: >> The fix addresses problem with the jimage tool rebuilding meta data on windows systems (\ in path.) Including new test to verify that jimage tool does successfully extract and recreate. >> >> JBS: https://bugs.openjdk.java.net/browse/JDK-8076090 >> Webrev: http://cr.openjdk.java.net/~jlaskey/8076090/webrev/index.html > > Looks fine to me. > > The test will need to check if $JAVA_HOME is an exploded image ($JAVA_HOME/lib/modules not exists); if so, it should simply exit. Otherwise the test will fail. Nit: line 24 is not unused. > > FYI. jdk/test/lib/testlibrary/jdk/testlibrary/ProcessTools.java could be used. > > Mandy From lance.andersen at oracle.com Thu Apr 9 15:26:32 2015 From: lance.andersen at oracle.com (Lance @ Oracle) Date: Thu, 9 Apr 2015 11:26:32 -0400 Subject: RFR (XXS) : 8050123: Incorrect property name documented in CORBA InputStream API In-Reply-To: <552681D5.9020605@oracle.com> References: <552681D5.9020605@oracle.com> Message-ID: <8A0EFF08-05A1-4B79-86F4-A28F95686D68@oracle.com> +1 Lance Andersen| Principal Member of Technical Staff | +1.781.442.2037 Oracle Java Engineering 1 Network Drive Burlington, MA 01803 Lance.Andersen at oracle.com Sent from my iPad > On Apr 9, 2015, at 9:42 AM, Se?n Coffey wrote: > > https://bugs.openjdk.java.net/browse/JDK-8050123 > > diff --git a/src/java.corba/share/classes/org/omg/CORBA_2_3/portable/InputStream.java b/src/java.corba/share/classes/org/omg/CORBA_2_3/portable/InputStream.java > --- a/src/java.corba/share/classes/org/omg/CORBA_2_3/portable/InputStream.java > +++ b/src/java.corba/share/classes/org/omg/CORBA_2_3/portable/InputStream.java > @@ -77,7 +77,7 @@ > * > * throw SecurityException if SecurityManager is installed and > * enableSubclassImplementation SerializablePermission > - * is not granted or jdk.corba.allowOutputStreamSubclass system > + * is not granted or jdk.corba.allowInputStreamSubclass system > * property is either not set or is set to 'false' > */ > public InputStream() { > > -- > Regards, > Sean. > From mandy.chung at oracle.com Thu Apr 9 15:57:56 2015 From: mandy.chung at oracle.com (Mandy Chung) Date: Thu, 09 Apr 2015 08:57:56 -0700 Subject: RFR: 8076090: jimage extract + recreate broken again In-Reply-To: References: <1C17B0E1-ED6E-461E-9EAA-554C5CBE5AD1@oracle.com> <5525757E.9000501@oracle.com> Message-ID: <5526A184.80400@oracle.com> On 4/9/15 7:59 AM, Jim Laskey (Oracle) wrote: > Thanks Mandy. Changed the main to ; > > public static void main(String[] args) { > final String JAVA_HOME = System.getProperty("java.home"); > Path jimagePath = Paths.get(JAVA_HOME, "bin", "jimage"); > Path bootimagePath = Paths.get(JAVA_HOME, "lib", "modules", "bootmodules.jimage"); > > if (Files.exists(jimagePath) && Files.exists(bootimagePath)) { > String jimage = jimagePath.toAbsolutePath().toString(); > String bootimage = bootimagePath.toAbsolutePath().toString(); > String extractDir = Paths.get(".", "extract").toAbsolutePath().toString(); > String recreateImage = Paths.get(".", "recreate.jimage").toAbsolutePath().toString(); > > exec(new String[] {jimage, "extract", "--dir", extractDir, bootimage}); > exec(new String[] {jimage, "recreate", "--dir", extractDir, recreateImage}); > > System.err.println("Test successful"); > } else { > System.err.println("Test skipped, no module image"); > } > } > > Running jprt - okay to push after that? > Looks good and yes okay to push after jprt job succeeds. Nit: System.err -> System.out as it's not an error. Mandy From vladimir.x.ivanov at oracle.com Thu Apr 9 18:44:22 2015 From: vladimir.x.ivanov at oracle.com (Vladimir Ivanov) Date: Thu, 09 Apr 2015 21:44:22 +0300 Subject: [9] RFR (XXS): 8077054: DMH LFs should be customizeable Message-ID: <5526C886.1090606@oracle.com> http://cr.openjdk.java.net/~vlivanov/8077054/webrev.00/ https://bugs.openjdk.java.net/browse/JDK-8077054 It's a followup fix for JDK-8069591 [1]. As Charlie observed, it's important to customize DirectMethodHandles as well. Otherwise, additional frame for DMH LambdaForm is created and it causes observable peak performance regression in some situations (e.g. JRuby9K). Testing: manual (microbenchmark, compilation log inspection). Thanks! Best regards, Vladimir Ivanov [1] https://bugs.openjdk.java.net/browse/JDK-8069591 "Customize LambdaForms which are invoked using MH.invoke/invokeExact" From john.r.rose at oracle.com Thu Apr 9 18:50:52 2015 From: john.r.rose at oracle.com (John Rose) Date: Thu, 9 Apr 2015 11:50:52 -0700 Subject: [9] RFR (XXS): 8077054: DMH LFs should be customizeable In-Reply-To: <5526C886.1090606@oracle.com> References: <5526C886.1090606@oracle.com> Message-ID: Looks good. Would you please also check the number of distinct LFs compiled when running standard benchmarks? (With and without the change.) The number should go up, but only slightly. Thanks! ? John On Apr 9, 2015, at 11:44 AM, Vladimir Ivanov wrote: > > http://cr.openjdk.java.net/~vlivanov/8077054/webrev.00/ > https://bugs.openjdk.java.net/browse/JDK-8077054 > > It's a followup fix for JDK-8069591 [1]. > > As Charlie observed, it's important to customize DirectMethodHandles as well. Otherwise, additional frame for DMH LambdaForm is created and it causes observable peak performance regression in some situations (e.g. JRuby9K). > > Testing: manual (microbenchmark, compilation log inspection). > > Thanks! > > Best regards, > Vladimir Ivanov > > [1] https://bugs.openjdk.java.net/browse/JDK-8069591 > "Customize LambdaForms which are invoked using > MH.invoke/invokeExact" > _______________________________________________ > mlvm-dev mailing list > mlvm-dev at openjdk.java.net > http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev From Roger.Riggs at Oracle.com Thu Apr 9 20:00:10 2015 From: Roger.Riggs at Oracle.com (Roger Riggs) Date: Thu, 09 Apr 2015 16:00:10 -0400 Subject: RFR 9: 8077350 Process API Updates Implementation Review Message-ID: <5526DA4A.6030808@Oracle.com> Please review the API and implementation of the Process API Updates described inJEP 102 . Please review and comment by April 23rd. The recommendation to make ProcessHandle an interface is included allowing the new functions to be extended by Process subclasses. The implementation covers all functions on Unix, Windows, Solaris, and Mac OS X. The API doc: http://cr.openjdk.java.net/~rriggs/ph-apidraft/ The webrev: http://cr.openjdk.java.net/~rriggs/webrev-ph Issue: JDK-8077350 Process API Updates Implementation The code is in the jdk9 sandbox on branch JDK-8046092-branch. Please review and comment, Roger From Sergey.Bylokhov at oracle.com Thu Apr 9 22:06:37 2015 From: Sergey.Bylokhov at oracle.com (Sergey Bylokhov) Date: Fri, 10 Apr 2015 01:06:37 +0300 Subject: [9] Review Request: 8076264 [macosx] Launching app on MacOSX requires enclosing class In-Reply-To: <55252D45.4050109@oracle.com> References: <55252D45.4050109@oracle.com> Message-ID: <5526F7ED.2080403@oracle.com> Hello, Can somebody from the core team take a look? Thanks. On 08.04.15 16:29, Sergey Bylokhov wrote: > Hello. > Please review the fix for jdk 9. > After the fix we clear all errors caused by getCanonicalName() on the > mainclass and leave JAVA_MAIN_CLASS_ empty. This empty case will be > handled in the NSApplicationAWT.m. > Plus small cleanup suggested in the bug report(jstring->jclass). > > Bug: https://bugs.openjdk.java.net/browse/JDK-8076264 > Webrev can be found at: > http://cr.openjdk.java.net/~serb/8076264/webrev.01 > -- Best regards, Sergey. From pbenedict at apache.org Thu Apr 9 22:19:08 2015 From: pbenedict at apache.org (Paul Benedict) Date: Thu, 9 Apr 2015 17:19:08 -0500 Subject: RFR 9: 8077350 Process API Updates Implementation Review In-Reply-To: <5526DA4A.6030808@Oracle.com> References: <5526DA4A.6030808@Oracle.com> Message-ID: My only comment is the method summary sentences of Process sometime refer to itself as "process" and other times "subprocess". I'm guessing they both refer to the same so perhaps the language shouldn't equivocate. Cheers, Paul On Thu, Apr 9, 2015 at 3:00 PM, Roger Riggs wrote: > Please review the API and implementation of the Process API Updates > described inJEP 102 . > Please review and comment by April 23rd. > > The recommendation to make ProcessHandle an interface is included > allowing the new functions to be extended by Process subclasses. > The implementation covers all functions on Unix, Windows, Solaris, and Mac > OS X. > > The API doc: http://cr.openjdk.java.net/~rriggs/ph-apidraft/ > > The webrev: http://cr.openjdk.java.net/~rriggs/webrev-ph > > Issue: JDK-8077350 > Process API Updates Implementation > > The code is in the jdk9 sandbox on branch JDK-8046092-branch. > > Please review and comment, Roger > From david.holmes at oracle.com Thu Apr 9 23:16:50 2015 From: david.holmes at oracle.com (David Holmes) Date: Fri, 10 Apr 2015 09:16:50 +1000 Subject: [9] RFR (S): Class.getSimpleName() should work for non-JLS compliant class names In-Reply-To: <552691DA.7000604@oracle.com> References: <55254C1B.2040603@oracle.com> <5525E95F.7080306@oracle.com> <552691DA.7000604@oracle.com> Message-ID: <55270862.9020704@oracle.com> Hi Vladimir, On 10/04/2015 12:51 AM, Vladimir Ivanov wrote: > David, thanks for the feedback! > > Updated webrev: > http://cr.openjdk.java.net/~vlivanov/8057919/webrev.01/jdk > http://cr.openjdk.java.net/~vlivanov/8057919/webrev.01/hotspot > > I restored original logic and call into VM only if it fails. This change seems fine to me, but I think John may prefer to see getSimpleName implemented such that it always returns the name from the innerclass attribute. (Though perhaps with caching if performance is a concern?) >>> The logic to compute simple name (Class.getSimpleName()) for >>> inner/nested/local classes is tightly coupled with Java naming scheme >>> and sometimes fails for classes generated from non-Java code. >> >> Meta-question: if this is non-Java code then what does/should >> "simpleName" even mean? "Returns the simple name of the underlying class >> as given in the source code." If there is no (java) source code does >> this have any meaning? Should it return "" ? > My reading of the JVMS is that InnerClasses attribute can be freely used > by non-Java compilers to store simple names for classes they generate. > The current wording for inner_name_index doesn't mention Java language. True, but it does refer to source code: "represents the original simple name of C, as given in the source code from which this class file was compiled. " which seems misplaced as we're discussing classes for which there is no source code as such. Anyway it just flags to me that perhaps these Class methods need to be generalized a bit given the support for non-Java languages on the JVM. But that's for core-libs folk to decide. Thanks, David > Best regards, > Vladimir Ivanov > >>> Instead of parsing class name and try to extract simple name based on >>> JLS rules, the fix I propose is to use InnerClasses attribute from the >>> class file. Simple name is already recorded there. >> > >>> JVMS-4.7.6: The InnerClasses Attribute >>> "inner_name_index: If C is anonymous (JLS ?15.9.5), the value of the >>> inner_name_index item must be zero. Otherwise, the value of the >>> inner_name_index item must be a valid index into the constant_pool >>> table, and the entry at that index must be a CONSTANT_Utf8_info >>> structure (?4.4.7) that represents the original simple name of C, as >>> given in the source code from which this class file was compiled." >>> >>> Since I consider backporting the fix into 8u60, I'd like to hear >>> opinions about backward compatibility of such change. >>> >>> As an alternative solution, I can restore original logic and consult >>> InnerClasses attribute when class name parsing logic fails. >> >> I think I'd prefer to see the VM call only used as a fallback if the >> regular parsing fails. That would prevent any compatibility issues for >> the 8u backport (ignoring tests that deliberately generate invalidly >> named classes). >> >> Thanks, >> David >> >>> Testing: regression test, jck-runtime/java_lang, jdk/test/java/lang/ >>> >>> Thanks! >>> >>> Best regards, >>> Vladimir Ivanov From kumar.x.srinivasan at oracle.com Fri Apr 10 01:39:08 2015 From: kumar.x.srinivasan at oracle.com (Kumar Srinivasan) Date: Thu, 09 Apr 2015 18:39:08 -0700 Subject: [9] Review Request: 8076264 [macosx] Launching app on MacOSX requires enclosing class In-Reply-To: <5526F7ED.2080403@oracle.com> References: <55252D45.4050109@oracle.com> <5526F7ED.2080403@oracle.com> Message-ID: <552729BC.7080205@oracle.com> Hi Sergey, src/java.base/macosx/native/libjli/java_md_macosx.c we need a comment here explaining why the Exception is cleared, basically what you have explained below. test/tools/launcher/MainClassWithoutEnclosingClass.java :) the test seems to be more complicated than the source changes, the launcher tests have had their own test framework TestHelper, to keep these tests consistent, I have enclosed a simpler test implementation, I have not tested this on MacOSX as I don't have one, however I have tested on Windows, I trust you will verify the test, with JPRT on all platforms. Many thanks for looking into this!. Kumar -----------------------------------------------------------CUT------------------------------------------------------------ /* * Copyright (c) 2015, 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. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /** * @test * @bug 8076264 * @summary Launching app shouldn't require enclosing class for the main class. * @compile TestMainWithoutEnclosing.java * @run main TestMainWithoutEnclosing */ import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.List; public class TestMainWithoutEnclosing extends TestHelper { static final String EnclosingName = "Enclosing"; static void createJarFile(File testJar) throws IOException { List scratch = new ArrayList<>(); scratch.add("public class Enclosing {"); scratch.add(" public static final class Main {"); scratch.add(" public static void main(String... args) {"); scratch.add(" System.out.println(\"Hello World\");"); scratch.add(" }"); scratch.add(" }"); scratch.add("}"); File enclosingFile = new File(EnclosingName + ".java"); createFile(enclosingFile, scratch); compile(enclosingFile.getName()); // avoid side effects remove the Enclosing class getClassFile(enclosingFile).delete(); createJar("cvfe", testJar.getName(), EnclosingName + "$Main", EnclosingName + "$Main" + ".class"); // remove extraneous files in the current directory new File(EnclosingName + "$Main" + ".class").delete(); } public static void main(String... args) throws IOException { File testJarFile = new File("test.jar"); createJarFile(testJarFile); TestResult tr = doExec(javaCmd, "-jar", testJarFile.getName()); if (!tr.isOK()) { System.out.println(tr); throw new RuntimeException("test returned non-positive value"); } if (!tr.contains("Hello World")) { System.out.println(tr); throw new RuntimeException("expected output not found"); } } } -----------------------------------------------------------CUT------------------------------------------------------------ On 4/9/2015 3:06 PM, Sergey Bylokhov wrote: > Hello, > Can somebody from the core team take a look? > Thanks. > On 08.04.15 16:29, Sergey Bylokhov wrote: >> Hello. >> Please review the fix for jdk 9. >> After the fix we clear all errors caused by getCanonicalName() on the >> mainclass and leave JAVA_MAIN_CLASS_ empty. This empty case will be >> handled in the NSApplicationAWT.m. >> Plus small cleanup suggested in the bug report(jstring->jclass). >> >> Bug: https://bugs.openjdk.java.net/browse/JDK-8076264 >> Webrev can be found at: >> http://cr.openjdk.java.net/~serb/8076264/webrev.01 >> > > From huizhe.wang at oracle.com Fri Apr 10 06:50:14 2015 From: huizhe.wang at oracle.com (huizhe wang) Date: Thu, 09 Apr 2015 23:50:14 -0700 Subject: RFR: 8076549: Update JAX-WS RI integration to latest version (2.2.11-b150402.1412) In-Reply-To: <5525962F.9060906@oracle.com> References: <551EAFDA.3020809@oracle.com> <5525962F.9060906@oracle.com> Message-ID: <552772A6.8050109@oracle.com> Hi Aleksej, I assume the JAX-WS/JAXB standalone releases are well tested for this integration, esp. the service finder code. I see a great number of "<>" to "<>" changes that was suggested by Alan in the last integration. Besides that, you may consider removing

    , using {@literal @} to replace @, and the diamond operator in new expression in MIMEMessage. Also, new StringBuilder().append("META-INF/services/").append(jaxbContextFQCN).toString() isn't any better than "META-INF/services/"+jaxbContextFQCN since they'll be compiled into the same. None of the above should prevent you from pushing your changes. Cheers, Joe On 4/8/2015 1:57 PM, Aleksej Efimov wrote: > Hi, > Can I kindly ask for a review of this JAX-WS update? > > With Best Regards, > Aleksej > > On 04/03/2015 06:20 PM, Aleksej Efimov wrote: >> Hello, >> >> Can I have a review for a JDK9 bulk update of JAX-B/WS from upstream >> projects. >> Webrev: http://cr.openjdk.java.net/~aefimov/8076549/9/00/ >> More details in issue description: >> https://bugs.openjdk.java.net/browse/JDK-8076549 >> >> Thank you, >> Aleksej > From Alan.Bateman at oracle.com Fri Apr 10 06:52:18 2015 From: Alan.Bateman at oracle.com (Alan Bateman) Date: Fri, 10 Apr 2015 07:52:18 +0100 Subject: RFR: 8076090: jimage extract + recreate broken again In-Reply-To: References: <1C17B0E1-ED6E-461E-9EAA-554C5CBE5AD1@oracle.com> <5525757E.9000501@oracle.com> Message-ID: <55277322.5040408@oracle.com> On 09/04/2015 15:59, Jim Laskey (Oracle) wrote: > : > > Running jprt - okay to push after that? > The change to recreate look okay although there is a mix of old/new I/O in this method that could be cleaned up a bit. For the test then have you considered using the test library infrastructure to launch the tool? -Alan From Alan.Bateman at oracle.com Fri Apr 10 07:03:06 2015 From: Alan.Bateman at oracle.com (Alan Bateman) Date: Fri, 10 Apr 2015 08:03:06 +0100 Subject: RFR (XXS) : 8050123: Incorrect property name documented in CORBA InputStream API In-Reply-To: <552681D5.9020605@oracle.com> References: <552681D5.9020605@oracle.com> Message-ID: <552775AA.1080202@oracle.com> On 09/04/2015 14:42, Se?n Coffey wrote: > https://bugs.openjdk.java.net/browse/JDK-8050123 > > diff --git > a/src/java.corba/share/classes/org/omg/CORBA_2_3/portable/InputStream.java > b/src/java.corba/share/classes/org/omg/CORBA_2_3/portable/InputStream.java > > --- > a/src/java.corba/share/classes/org/omg/CORBA_2_3/portable/InputStream.java > +++ > b/src/java.corba/share/classes/org/omg/CORBA_2_3/portable/InputStream.java > @@ -77,7 +77,7 @@ > * > * throw SecurityException if SecurityManager is installed and > * enableSubclassImplementation SerializablePermission > - * is not granted or jdk.corba.allowOutputStreamSubclass system > + * is not granted or jdk.corba.allowInputStreamSubclass system > * property is either not set or is set to 'false' > */ > public InputStream() { > This is JDK-specific and so shouldn't be in the constructor specification. Can it be moved to an @implNote? -Alan. From james.laskey at oracle.com Fri Apr 10 09:04:43 2015 From: james.laskey at oracle.com (James Laskey) Date: Fri, 10 Apr 2015 06:04:43 -0300 Subject: RFR: 8076090: jimage extract + recreate broken again In-Reply-To: <55277322.5040408@oracle.com> References: <1C17B0E1-ED6E-461E-9EAA-554C5CBE5AD1@oracle.com> <5525757E.9000501@oracle.com> <55277322.5040408@oracle.com> Message-ID: Sent from my iPhone > On Apr 10, 2015, at 3:52 AM, Alan Bateman wrote: > >> On 09/04/2015 15:59, Jim Laskey (Oracle) wrote: >> : >> >> Running jprt - okay to push after that? > The change to recreate look okay although there is a mix of old/new I/O in this method that could be cleaned up a bit. Noted. > > For the test then have you considered using the test library infrastructure to launch the tool? > > -Alan Unless I missed something the infra is fairly minimal. From Alan.Bateman at oracle.com Fri Apr 10 09:08:38 2015 From: Alan.Bateman at oracle.com (Alan Bateman) Date: Fri, 10 Apr 2015 10:08:38 +0100 Subject: RFR: 8076090: jimage extract + recreate broken again In-Reply-To: References: <1C17B0E1-ED6E-461E-9EAA-554C5CBE5AD1@oracle.com> <5525757E.9000501@oracle.com> <55277322.5040408@oracle.com> Message-ID: <55279316.4020806@oracle.com> On 10/04/2015 10:04, James Laskey wrote: > : > Unless I missed something the infra is fairly minimal. In general we've had a lot of reliability issues with multi-VM tests so the trend in the recent time has been to use the test infrastructure where possible. It looks straight-forward to convert this new test to use it. -Alan From aleksej.efimov at oracle.com Fri Apr 10 10:09:09 2015 From: aleksej.efimov at oracle.com (Aleksej Efimov) Date: Fri, 10 Apr 2015 13:09:09 +0300 Subject: RFR: 8076549: Update JAX-WS RI integration to latest version (2.2.11-b150402.1412) In-Reply-To: <552772A6.8050109@oracle.com> References: <551EAFDA.3020809@oracle.com> <5525962F.9060906@oracle.com> <552772A6.8050109@oracle.com> Message-ID: <5527A145.2050902@oracle.com> Hi Joe, Yes, the extensive testing took place before syncing the standalone implementation to JDK: JCK, sets of jaxws/b unit tests, JPRT testing. Thank you for your comments and suggestions - we'll try to address them and integrate during the next integration. About diamond operator in MIMEMessage - not sure that we can put it there - AFAIK the standalone JAXWS/B still supports JDK6 and we can't use "diamonds" there. With Best Regards, Aleksej On 04/10/2015 09:50 AM, huizhe wang wrote: > Hi Aleksej, > > I assume the JAX-WS/JAXB standalone releases are well tested for this > integration, esp. the service finder code. > > I see a great number of "<>" to "<>" changes that was suggested > by Alan in the last integration. Besides that, you may consider > removing

    , using {@literal @} to replace @, and the diamond > operator in new expression in MIMEMessage. Also, new > StringBuilder().append("META-INF/services/").append(jaxbContextFQCN).toString() > isn't any better than "META-INF/services/"+jaxbContextFQCN since > they'll be compiled into the same. > > None of the above should prevent you from pushing your changes. > > Cheers, > Joe > > On 4/8/2015 1:57 PM, Aleksej Efimov wrote: >> Hi, >> Can I kindly ask for a review of this JAX-WS update? >> >> With Best Regards, >> Aleksej >> >> On 04/03/2015 06:20 PM, Aleksej Efimov wrote: >>> Hello, >>> >>> Can I have a review for a JDK9 bulk update of JAX-B/WS from upstream >>> projects. >>> Webrev: >>> More details in issue description: >>> https://bugs.openjdk.java.net/browse/JDK-8076549 >>> >>> Thank you, >>> Aleksej >> > From kasperni at gmail.com Fri Apr 10 11:32:05 2015 From: kasperni at gmail.com (Kasper Nielsen) Date: Fri, 10 Apr 2015 13:32:05 +0200 Subject: JEP 110 HTTP 2 client API In-Reply-To: References: <551ACBFA.7040304@oracle.com> Message-ID: On Fri, Apr 3, 2015 at 3:20 PM, Pavel Rappo wrote: > Hi Kasper, > > I assume your questions are all about WebSocket part, right? If so, then > > > 1) > > Would it possible to add a connect timeout parameter. > > builder.setConnectTimeout(long timeout, TimeUnit unit) > > > > For some reason it was left out of the javax.websocket API. And working > > around it is a serious PITA. > > What's the purpose of this timeout? Could you please explain it a bit more? > > It is pretty normal to not want to block indefinitely on I/O methods. For example, in java.net.Socket you have both connect(SocketAddress endpoint) connect(SocketAddress endpoint, int timeout) the way I work around it in the javax.websocket api. Is spawning a thread that can interrupt the blocking thread after XX seconds. But that is pretty annoying. > > 4) > > I find the use of byte[] vs ByteBuffer a bit inconsistent. > > For example, HttpResponseBodyProcessor uses ByteBuffer while > > WebSocketMessage uses byte[] > > I believe this is done solely for simplicity. HttpClient is a more "general > purpose" kind of thing. I'm not sure I understand what you mean here. ByteBuffer is for general purpose things. While byte[] is for special things? I would say it was the other way around. From michael.x.mcmahon at oracle.com Fri Apr 10 12:01:07 2015 From: michael.x.mcmahon at oracle.com (Michael McMahon) Date: Fri, 10 Apr 2015 13:01:07 +0100 Subject: JEP 110 HTTP 2 client API In-Reply-To: References: <551ACBFA.7040304@oracle.com> Message-ID: <5527BB83.10408@oracle.com> On 10/04/15 12:32, Kasper Nielsen wrote: > > Sorry, I've been away and am catching up on email > On Fri, Apr 3, 2015 at 3:20 PM, Pavel Rappo > wrote: > > Hi Kasper, > > I assume your questions are all about WebSocket part, right? If > so, then > > > 1) > > Would it possible to add a connect timeout parameter. > > builder.setConnectTimeout(long timeout, TimeUnit unit) > > > > For some reason it was left out of the javax.websocket API. And > working > > around it is a serious PITA. > > What's the purpose of this timeout? Could you please explain it a > bit more? > > It is pretty normal to not want to block indefinitely on I/O methods. > For example, in java.net.Socket you have both > connect(SocketAddress endpoint) > connect(SocketAddress endpoint, int timeout) > > the way I work around it in the javax.websocket api. Is spawning a > thread that can interrupt the blocking thread after XX seconds. > But that is pretty annoying. > You can use the connectAsync() method which returns a CompletableFuture and then do a timed get() on that object. That's the nice thing about CompletableFuture in that these concerns are just delegated to that class rather than being replicated in each non-blocking API > > 4) > > I find the use of byte[] vs ByteBuffer a bit inconsistent. > > For example, HttpResponseBodyProcessor uses ByteBuffer while > > WebSocketMessage uses byte[] > > I believe this is done solely for simplicity. HttpClient is a more > "general > purpose" kind of thing. > > I'm not sure I understand what you mean here. ByteBuffer is for > general purpose things. > While byte[] is for special things? I would say it was the other way > around. Our view is that ByteBuffer is a complicated class (relatively speaking) and even in the general HttpClient API, most developers won't use it. Only someone who wants to implement a specific response processor would need to use it. So, I think programmers will in both cases use familiar types like String or byte[] or application specific classes in the Http client api. Michael From martinrb at google.com Fri Apr 10 12:28:50 2015 From: martinrb at google.com (Martin Buchholz) Date: Fri, 10 Apr 2015 05:28:50 -0700 Subject: [9] Review Request: 8076264 [macosx] Launching app on MacOSX requires enclosing class In-Reply-To: <55252D45.4050109@oracle.com> References: <55252D45.4050109@oracle.com> Message-ID: OKish, but musings follow: I was a little disappointed that Class.getCanonicalName and Class.getSimpleName want to examine/load the enclosing class (if any). You would think that the class file for a static nested class would contain enough information to answer those queries ("just turn the $ into a dot!"). But we're probably not going to fix Class... As a result of Class' behavior, we are closer to the position that the test jar file I created where the enclosing class was missing was "malformed". Yeah, I'll avoid doing that in future. My biggest gripe about the Mac behavior was that java startup was doing AWT-specific initialization even though there is no AWT code here. Figure out how to move this code into the AWT module somehow? Isn't this sort of thing one of the goals of jigsaw? But looking at SetMainClassForAWT I see that this is hard to change. It's a mess. Why does AWT, SWT and JavaFX want to get the name of the main class, but ... only on Mac?! 969 * WARNING: This environment variable is an implementation detail and 970 * isn't meant for use outside of the core platform. The mechanism for 971 * passing this information from Java launcher to other modules may 972 * change drastically between update release, and it may even be 973 * removed or replaced with another mechanism. 974 * 975 * NOTE: It is used by SWT, and JavaFX. On Wed, Apr 8, 2015 at 6:29 AM, Sergey Bylokhov wrote: > Hello. > Please review the fix for jdk 9. > After the fix we clear all errors caused by getCanonicalName() on the > mainclass and leave JAVA_MAIN_CLASS_ empty. This empty case will be handled > in the NSApplicationAWT.m. > Plus small cleanup suggested in the bug report(jstring->jclass). > > Bug: https://bugs.openjdk.java.net/browse/JDK-8076264 > Webrev can be found at: http://cr.openjdk.java.net/~serb/8076264/webrev.01 > > -- > Best regards, Sergey. > > From david.holmes at oracle.com Fri Apr 10 12:52:39 2015 From: david.holmes at oracle.com (David Holmes) Date: Fri, 10 Apr 2015 22:52:39 +1000 Subject: [9] Review Request: 8076264 [macosx] Launching app on MacOSX requires enclosing class In-Reply-To: References: <55252D45.4050109@oracle.com> Message-ID: <5527C797.1050306@oracle.com> Martin, On 10/04/2015 10:28 PM, Martin Buchholz wrote: > OKish, but musings follow: > > I was a little disappointed that Class.getCanonicalName and > Class.getSimpleName want to examine/load the enclosing class (if any). You > would think that the class file for a static nested class would contain > enough information to answer those queries ("just turn the $ into a > dot!"). But we're probably not going to fix Class... As a result of > Class' behavior, we are closer to the position that the test jar file I > created where the enclosing class was missing was "malformed". Yeah, I'll > avoid doing that in future. See 8057919. There is currently a RFR on core-libs-dev and hotspot-dev to fix getSimpleName for non-Java-langauge compliant naming schemes. David ----- > My biggest gripe about the Mac behavior was that java startup was doing > AWT-specific initialization even though there is no AWT code here. Figure > out how to move this code into the AWT module somehow? Isn't this sort of > thing one of the goals of jigsaw? > > But looking at SetMainClassForAWT I see that this is hard to change. It's > a mess. Why does AWT, SWT and JavaFX want to get the name of the main > class, but ... only on Mac?! > > 969 * WARNING: This environment variable is an implementation detail and > 970 * isn't meant for use outside of the core platform. The mechanism for > 971 * passing this information from Java launcher to other modules may > 972 * change drastically between update release, and it may even be > 973 * removed or replaced with another mechanism. > 974 * > 975 * NOTE: It is used by SWT, and JavaFX. > > > > On Wed, Apr 8, 2015 at 6:29 AM, Sergey Bylokhov > wrote: > >> Hello. >> Please review the fix for jdk 9. >> After the fix we clear all errors caused by getCanonicalName() on the >> mainclass and leave JAVA_MAIN_CLASS_ empty. This empty case will be handled >> in the NSApplicationAWT.m. >> Plus small cleanup suggested in the bug report(jstring->jclass). >> >> Bug: https://bugs.openjdk.java.net/browse/JDK-8076264 >> Webrev can be found at: http://cr.openjdk.java.net/~serb/8076264/webrev.01 >> >> -- >> Best regards, Sergey. >> >> From Sergey.Bylokhov at oracle.com Fri Apr 10 13:47:53 2015 From: Sergey.Bylokhov at oracle.com (Sergey Bylokhov) Date: Fri, 10 Apr 2015 16:47:53 +0300 Subject: [9] Review Request: 8076264 [macosx] Launching app on MacOSX requires enclosing class In-Reply-To: References: <55252D45.4050109@oracle.com> Message-ID: <5527D489.2070301@oracle.com> On 10.04.15 15:28, Martin Buchholz wrote: > > My biggest gripe about the Mac behavior was that java startup was > doing AWT-specific initialization even though there is no AWT code > here. Figure out how to move this code into the AWT module somehow? > Isn't this sort of thing one of the goals of jigsaw? > > But looking at SetMainClassForAWT I see that this is hard to change. > It's a mess. Why does AWT, SWT and JavaFX want to get the name of the > main class, but ... only on Mac?! It is used to initialize the name of the application during start of UI library. Since there is no public way to take the mainclass from the launcher(see [1] and [2]) we need to pass this value ourself. I suppose such functionality is missing(or not implemented) on other platforms. [1] https://bugs.openjdk.java.net/browse/JDK-4827318 [2] http://stackoverflow.com/questions/939932/how-to-determine-main-class-at-runtime-in-threaded-java-application > > 969 * WARNING: This environment variable is an implementation detail and > 970 * isn't meant for use outside of the core platform. The mechanism for > 971 * passing this information from Java launcher to other modules may > 972 * change drastically between update release, and it may even be > 973 * removed or replaced with another mechanism. > 974 * > 975 * NOTE: It is used by SWT, and JavaFX. > > > On Wed, Apr 8, 2015 at 6:29 AM, Sergey Bylokhov > > wrote: > > Hello. > Please review the fix for jdk 9. > After the fix we clear all errors caused by getCanonicalName() on > the mainclass and leave JAVA_MAIN_CLASS_ empty. This empty case > will be handled in the NSApplicationAWT.m. > Plus small cleanup suggested in the bug report(jstring->jclass). > > Bug: https://bugs.openjdk.java.net/browse/JDK-8076264 > Webrev can be found at: > http://cr.openjdk.java.net/~serb/8076264/webrev.01 > > > -- > Best regards, Sergey. > > -- Best regards, Sergey. From kumar.x.srinivasan at oracle.com Fri Apr 10 15:02:59 2015 From: kumar.x.srinivasan at oracle.com (Kumar Srinivasan) Date: Fri, 10 Apr 2015 08:02:59 -0700 Subject: [9] Review Request: 8076264 [macosx] Launching app on MacOSX requires enclosing class In-Reply-To: <5527D489.2070301@oracle.com> References: <55252D45.4050109@oracle.com> <5527D489.2070301@oracle.com> Message-ID: <5527E623.2070308@oracle.com> and it looks like sun.java.command is no longer exported to Java. /* * inject the -Dsun.java.command pseudo property into the args structure * this pseudo property is used in the HotSpot VM to expose the * Java class name and arguments to the main method to the VM. The * HotSpot VM uses this pseudo property to store the Java class name * (or jar file name) and the arguments to the class's main method * to the instrumentation memory region. The sun.java.command pseudo * property is not exported by HotSpot to the Java layer. */ I guess you could get it from the intrumentation or serviceability layer, that may likely be an additional overhead. Kumar On 4/10/2015 6:47 AM, Sergey Bylokhov wrote: > On 10.04.15 15:28, Martin Buchholz wrote: >> >> My biggest gripe about the Mac behavior was that java startup was >> doing AWT-specific initialization even though there is no AWT code >> here. Figure out how to move this code into the AWT module somehow? >> Isn't this sort of thing one of the goals of jigsaw? >> >> But looking at SetMainClassForAWT I see that this is hard to change. >> It's a mess. Why does AWT, SWT and JavaFX want to get the name of >> the main class, but ... only on Mac?! > It is used to initialize the name of the application during start of > UI library. Since there is no public way to take the mainclass from > the launcher(see [1] and [2]) we need to pass this value ourself. I > suppose such functionality is missing(or not implemented) on other > platforms. > > [1] https://bugs.openjdk.java.net/browse/JDK-4827318 > [2] > http://stackoverflow.com/questions/939932/how-to-determine-main-class-at-runtime-in-threaded-java-application >> >> 969 * WARNING: This environment variable is an implementation >> detail and >> 970 * isn't meant for use outside of the core platform. The >> mechanism for >> 971 * passing this information from Java launcher to other >> modules may >> 972 * change drastically between update release, and it may >> even be >> 973 * removed or replaced with another mechanism. >> 974 * >> 975 * NOTE: It is used by SWT, and JavaFX. >> >> >> On Wed, Apr 8, 2015 at 6:29 AM, Sergey Bylokhov >> > wrote: >> >> Hello. >> Please review the fix for jdk 9. >> After the fix we clear all errors caused by getCanonicalName() on >> the mainclass and leave JAVA_MAIN_CLASS_ empty. This empty case >> will be handled in the NSApplicationAWT.m. >> Plus small cleanup suggested in the bug report(jstring->jclass). >> >> Bug: https://bugs.openjdk.java.net/browse/JDK-8076264 >> Webrev can be found at: >> http://cr.openjdk.java.net/~serb/8076264/webrev.01 >> >> >> -- Best regards, Sergey. >> >> > > From vladimir.x.ivanov at oracle.com Fri Apr 10 15:06:37 2015 From: vladimir.x.ivanov at oracle.com (Vladimir Ivanov) Date: Fri, 10 Apr 2015 18:06:37 +0300 Subject: [9] RFR (XXS): 8077054: DMH LFs should be customizeable In-Reply-To: References: <5526C886.1090606@oracle.com> Message-ID: <5527E6FD.7010801@oracle.com> Thanks for review, John! Yes, it increases the number of customized LFs, but not significantly. Octane/Nashorn (before/after): Box2D: 90 / 127 CodeLoad.testClosure: 40 / 44 CodeLoad.testJQuery: 93 / 102 Crypto: 12 / 23 DeltaBlue: 5 / 17 EarleyBoyer: 36 / 43 Gameboy: 365 / 438 Mandreel: 54 / 58 NavierStokes: 5 / 10 PdfJS: 614 / 664 Raytrace: 32 / 39 Regexp: 16 / 22 Richards: 5 / 15 Splay: 5 / 9 Best regards, Vladimir Ivanov On 4/9/15 9:50 PM, John Rose wrote: > Looks good. Would you please also check the number of distinct LFs compiled when running standard benchmarks? (With and without the change.) The number should go up, but only slightly. > > Thanks! > ? John > > On Apr 9, 2015, at 11:44 AM, Vladimir Ivanov wrote: >> >> http://cr.openjdk.java.net/~vlivanov/8077054/webrev.00/ >> https://bugs.openjdk.java.net/browse/JDK-8077054 >> >> It's a followup fix for JDK-8069591 [1]. >> >> As Charlie observed, it's important to customize DirectMethodHandles as well. Otherwise, additional frame for DMH LambdaForm is created and it causes observable peak performance regression in some situations (e.g. JRuby9K). >> >> Testing: manual (microbenchmark, compilation log inspection). >> >> Thanks! >> >> Best regards, >> Vladimir Ivanov >> >> [1] https://bugs.openjdk.java.net/browse/JDK-8069591 >> "Customize LambdaForms which are invoked using >> MH.invoke/invokeExact" >> _______________________________________________ >> mlvm-dev mailing list >> mlvm-dev at openjdk.java.net >> http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev > > _______________________________________________ > mlvm-dev mailing list > mlvm-dev at openjdk.java.net > http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev > From Roger.Riggs at Oracle.com Fri Apr 10 15:26:11 2015 From: Roger.Riggs at Oracle.com (Roger Riggs) Date: Fri, 10 Apr 2015 11:26:11 -0400 Subject: RFR 9: 8077350 Process API Updates Implementation Review In-Reply-To: References: <5526DA4A.6030808@Oracle.com> Message-ID: <5527EB93.10108@Oracle.com> Hi Paul, That's a good point, the subprocess terminology is in the prior descriptions so wasn't included in the scope of the updates. But in my reading, replacing subprocess by process would not change the semantics or understanding since the spawned process is always the direct object. Perhaps worth an editorial update as a separate issue. Thanks, Roger On 4/9/2015 6:19 PM, Paul Benedict wrote: > My only comment is the method summary sentences of Process sometime > refer to itself as "process" and other times "subprocess". I'm > guessing they both refer to the same so perhaps the language shouldn't > equivocate. > > > Cheers, > Paul > > On Thu, Apr 9, 2015 at 3:00 PM, Roger Riggs > wrote: > > Please review the API and implementation of the Process API Updates > described inJEP 102 > . Please review > and comment by April 23rd. > > The recommendation to make ProcessHandle an interface is included > allowing the new functions to be extended by Process subclasses. > The implementation covers all functions on Unix, Windows, Solaris, > and Mac OS X. > > The API doc: http://cr.openjdk.java.net/~rriggs/ph-apidraft/ > > > The webrev: http://cr.openjdk.java.net/~rriggs/webrev-ph > > > Issue: JDK-8077350 > Process API > Updates Implementation > > The code is in the jdk9 sandbox on branch JDK-8046092-branch. > > Please review and comment, Roger > > From alexander.v.stepanov at oracle.com Fri Apr 10 15:50:10 2015 From: alexander.v.stepanov at oracle.com (alexander stepanov) Date: Fri, 10 Apr 2015 18:50:10 +0300 Subject: RFR [9] 8077332: tidy warnings from javax/xml Message-ID: <5527F132.80408@oracle.com> Hello, Could you please review the following fix http://cr.openjdk.java.net/~avstepan/8077332/ for https://bugs.openjdk.java.net/browse/JDK-8077332 Some HTML cleanup for docs. Thanks, Alexander From Alan.Bateman at oracle.com Fri Apr 10 16:01:25 2015 From: Alan.Bateman at oracle.com (Alan Bateman) Date: Fri, 10 Apr 2015 17:01:25 +0100 Subject: RFR [9] 8077332: tidy warnings from javax/xml In-Reply-To: <5527F132.80408@oracle.com> References: <5527F132.80408@oracle.com> Message-ID: <5527F3D5.7070309@oracle.com> On 10/04/2015 16:50, alexander stepanov wrote: > Hello, > > Could you please review the following fix > http://cr.openjdk.java.net/~avstepan/8077332/ > > for > https://bugs.openjdk.java.net/browse/JDK-8077332 > > Some HTML cleanup for docs. cc'ing security-dev as that is where the XML-DSIG code is maintained. I've also cc'ed Miroslav Kos as I think you'll need to work with him to get the JAX-WS and JAXB updated in the upstream repos. This is mostly just about ensuring that the changes in the jaxws repo don't get overridden at the next JAX-WS sync up. -Alan From martinrb at google.com Fri Apr 10 16:20:56 2015 From: martinrb at google.com (Martin Buchholz) Date: Fri, 10 Apr 2015 09:20:56 -0700 Subject: [9] Review Request: 8076264 [macosx] Launching app on MacOSX requires enclosing class In-Reply-To: <5527E623.2070308@oracle.com> References: <55252D45.4050109@oracle.com> <5527D489.2070301@oracle.com> <5527E623.2070308@oracle.com> Message-ID: I don't get it. Either providing this information (what "java program" is running - main class and/or command line) is generally useful or it is not. There's nothing macosx-specific about it. Either provide a clean blessed api (i.e. not an environment variable) and have AWT etc use it on every platform or do not provide it at all. Hmmm... come to think of it, "jps" gives a list of java processes and tries to identify them using their main class, so there's cross-platform precedent. So please just figure out how to stop setting this environment variable at all. On Fri, Apr 10, 2015 at 8:02 AM, Kumar Srinivasan < kumar.x.srinivasan at oracle.com> wrote: > and it looks like sun.java.command is no longer exported to Java. > > /* > * inject the -Dsun.java.command pseudo property into the args structure > * this pseudo property is used in the HotSpot VM to expose the > * Java class name and arguments to the main method to the VM. The > * HotSpot VM uses this pseudo property to store the Java class name > * (or jar file name) and the arguments to the class's main method > * to the instrumentation memory region. The sun.java.command pseudo > * property is not exported by HotSpot to the Java layer. > */ > > I guess you could get it from the intrumentation or serviceability > layer, that may likely be an additional overhead. > > Kumar > > On 4/10/2015 6:47 AM, Sergey Bylokhov wrote: > >> On 10.04.15 15:28, Martin Buchholz wrote: >> >>> >>> My biggest gripe about the Mac behavior was that java startup was doing >>> AWT-specific initialization even though there is no AWT code here. Figure >>> out how to move this code into the AWT module somehow? Isn't this sort of >>> thing one of the goals of jigsaw? >>> >>> But looking at SetMainClassForAWT I see that this is hard to change. >>> It's a mess. Why does AWT, SWT and JavaFX want to get the name of the main >>> class, but ... only on Mac?! >>> >> It is used to initialize the name of the application during start of UI >> library. Since there is no public way to take the mainclass from the >> launcher(see [1] and [2]) we need to pass this value ourself. I suppose >> such functionality is missing(or not implemented) on other platforms. >> >> [1] https://bugs.openjdk.java.net/browse/JDK-4827318 >> [2] http://stackoverflow.com/questions/939932/how-to- >> determine-main-class-at-runtime-in-threaded-java-application >> >>> >>> 969 * WARNING: This environment variable is an implementation >>> detail and >>> 970 * isn't meant for use outside of the core platform. The >>> mechanism for >>> 971 * passing this information from Java launcher to other >>> modules may >>> 972 * change drastically between update release, and it may even >>> be >>> 973 * removed or replaced with another mechanism. >>> 974 * >>> 975 * NOTE: It is used by SWT, and JavaFX. >>> >>> >>> On Wed, Apr 8, 2015 at 6:29 AM, Sergey Bylokhov < >>> Sergey.Bylokhov at oracle.com > wrote: >>> >>> Hello. >>> Please review the fix for jdk 9. >>> After the fix we clear all errors caused by getCanonicalName() on >>> the mainclass and leave JAVA_MAIN_CLASS_ empty. This empty case >>> will be handled in the NSApplicationAWT.m. >>> Plus small cleanup suggested in the bug report(jstring->jclass). >>> >>> Bug: https://bugs.openjdk.java.net/browse/JDK-8076264 >>> Webrev can be found at: >>> http://cr.openjdk.java.net/~serb/8076264/webrev.01 >>> >>> >>> -- Best regards, Sergey. >>> >>> >>> >> >> > From Sergey.Bylokhov at oracle.com Fri Apr 10 16:36:48 2015 From: Sergey.Bylokhov at oracle.com (Sergey Bylokhov) Date: Fri, 10 Apr 2015 19:36:48 +0300 Subject: [9] Review Request: 8076264 [macosx] Launching app on MacOSX requires enclosing class In-Reply-To: References: <55252D45.4050109@oracle.com> <5527D489.2070301@oracle.com> <5527E623.2070308@oracle.com> Message-ID: <5527FC20.50607@oracle.com> On 10.04.15 19:20, Martin Buchholz wrote: > I don't get it. Either providing this information (what "java > program" is running - main class and/or command line) is generally > useful or it is not. There's nothing macosx-specific about it. > Either provide a clean blessed api (i.e. not an environment variable) > and have AWT etc use it on every platform or do not provide it at all. API for what? This is internal implementation of argument passing from launcher to some known UI library, inside one particular jdk implementation. It would be good if some public api will be added for this(as requested in [1]) in jdk9, but it is not required for this functionality. > Hmmm... come to think of it, "jps" gives a list of java processes and > tries to identify them using their main class, so there's > cross-platform precedent. > > So please just figure out how to stop setting this environment > variable at all. > > On Fri, Apr 10, 2015 at 8:02 AM, Kumar Srinivasan > > > wrote: > > and it looks like sun.java.command is no longer exported to Java. > > /* > * inject the -Dsun.java.command pseudo property into the args > structure > * this pseudo property is used in the HotSpot VM to expose the > * Java class name and arguments to the main method to the VM. The > * HotSpot VM uses this pseudo property to store the Java class name > * (or jar file name) and the arguments to the class's main method > * to the instrumentation memory region. The sun.java.command pseudo > * property is not exported by HotSpot to the Java layer. > */ > > I guess you could get it from the intrumentation or serviceability > layer, that may likely be an additional overhead. > > Kumar > > On 4/10/2015 6:47 AM, Sergey Bylokhov wrote: > > On 10.04.15 15:28, Martin Buchholz wrote: > > > My biggest gripe about the Mac behavior was that java > startup was doing AWT-specific initialization even though > there is no AWT code here. Figure out how to move this > code into the AWT module somehow? Isn't this sort of > thing one of the goals of jigsaw? > > But looking at SetMainClassForAWT I see that this is hard > to change. It's a mess. Why does AWT, SWT and JavaFX > want to get the name of the main class, but ... only on Mac?! > > It is used to initialize the name of the application during > start of UI library. Since there is no public way to take the > mainclass from the launcher(see [1] and [2]) we need to pass > this value ourself. I suppose such functionality is missing(or > not implemented) on other platforms. > > [1] https://bugs.openjdk.java.net/browse/JDK-4827318 > [2] > http://stackoverflow.com/questions/939932/how-to-determine-main-class-at-runtime-in-threaded-java-application > > > 969 * WARNING: This environment variable is an > implementation detail and > 970 * isn't meant for use outside of the core > platform. The mechanism for > 971 * passing this information from Java launcher > to other modules may > 972 * change drastically between update release, > and it may even be > 973 * removed or replaced with another mechanism. > 974 * > 975 * NOTE: It is used by SWT, and JavaFX. > > > On Wed, Apr 8, 2015 at 6:29 AM, Sergey Bylokhov > > >> wrote: > > Hello. > Please review the fix for jdk 9. > After the fix we clear all errors caused by > getCanonicalName() on > the mainclass and leave JAVA_MAIN_CLASS_ empty. This > empty case > will be handled in the NSApplicationAWT.m. > Plus small cleanup suggested in the bug > report(jstring->jclass). > > Bug: https://bugs.openjdk.java.net/browse/JDK-8076264 > Webrev can be found at: > http://cr.openjdk.java.net/~serb/8076264/webrev.01 > > > > -- Best regards, Sergey. > > > > > > -- Best regards, Sergey. From sean.mullan at oracle.com Fri Apr 10 17:07:47 2015 From: sean.mullan at oracle.com (Sean Mullan) Date: Fri, 10 Apr 2015 13:07:47 -0400 Subject: RFR [9] 8077332: tidy warnings from javax/xml In-Reply-To: <5527F3D5.7070309@oracle.com> References: <5527F132.80408@oracle.com> <5527F3D5.7070309@oracle.com> Message-ID: <55280363.1070101@oracle.com> On 04/10/2015 12:01 PM, Alan Bateman wrote: > On 10/04/2015 16:50, alexander stepanov wrote: >> Hello, >> >> Could you please review the following fix >> http://cr.openjdk.java.net/~avstepan/8077332/ >> >> for >> https://bugs.openjdk.java.net/browse/JDK-8077332 >> >> Some HTML cleanup for docs. > cc'ing security-dev as that is where the XML-DSIG code is maintained. The DSig changes look fine. --Sean From martinrb at google.com Fri Apr 10 17:08:11 2015 From: martinrb at google.com (Martin Buchholz) Date: Fri, 10 Apr 2015 10:08:11 -0700 Subject: [9] Review Request: 8076264 [macosx] Launching app on MacOSX requires enclosing class In-Reply-To: <5527FC20.50607@oracle.com> References: <55252D45.4050109@oracle.com> <5527D489.2070301@oracle.com> <5527E623.2070308@oracle.com> <5527FC20.50607@oracle.com> Message-ID: On Fri, Apr 10, 2015 at 9:36 AM, Sergey Bylokhov wrote: > On 10.04.15 19:20, Martin Buchholz wrote: > > I don't get it. Either providing this information (what "java program" > is running - main class and/or command line) is generally useful or it is > not. There's nothing macosx-specific about it. Either provide a clean > blessed api (i.e. not an environment variable) and have AWT etc use it on > every platform or do not provide it at all. > > API for what? This is internal implementation of argument passing from > launcher to some known UI library, inside one particular jdk > implementation. It would be good if some public api will be added for > this(as requested in [1]) in jdk9, but it is not required for this > functionality. > I think we're actually mostly in agreement. I don't object to your point fix going in, but I hope that higher level improvements, probably including removing the JAVA_MAIN_CLASS* environment variable, will be made elsewhere. From duncan.macgregor at ge.com Thu Apr 9 09:46:21 2015 From: duncan.macgregor at ge.com (MacGregor, Duncan (GE Energy Management)) Date: Thu, 9 Apr 2015 09:46:21 +0000 Subject: [9] RFR (M): 8057967: CallSite dependency tracking scales devastatingly poorly In-Reply-To: <551D6DAC.8030607@oracle.com> References: <551C5B92.8060500@oracle.com> <551D6A0D.8090500@oracle.com> <551D6DAC.8030607@oracle.com> Message-ID: Now I?m back from my Easter break I?ve run done some testing with our code. Hs-comp is looking good in general, and this code does appear to give a nice little extra boost. My results are showing a difference at peak performance, which I found slightly surprising so I?ll need to take a look at just how often targets are being reset and for what reasons. Anyway, in general I?m getting about 10% better performance with hs-comp than 8u40, and that?s in code which spends a substantial amount of its time down in some C libraries. Keep up the good work Vladimir! Duncan. On 02/04/2015 17:26, "Vladimir Ivanov" wrote: >Aleksey, thanks a lot for the performance evaluation of the fix! > >Best regards, >Vladimir Ivanov > >On 4/2/15 7:10 PM, Aleksey Shipilev wrote: >> On 04/01/2015 11:56 PM, Vladimir Ivanov wrote: >>> http://cr.openjdk.java.net/~vlivanov/8057967/webrev.00/hotspot/ >>> http://cr.openjdk.java.net/~vlivanov/8057967/webrev.00/jdk/ >>> https://bugs.openjdk.java.net/browse/JDK-8057967 >> >> Glad to see this finally addressed, thanks! >> >> I did not look through the code changes, but ran Octane on my >> configuration. As expected, Typescript had improved substantially. Other >> benchmarks are not affected much. This in line with the performance >> analysis done for the original bug report. >> >> Baseline: >> >> Benchmark Mode Cnt Score Error Units >> Box2D.test ss 20 4454.677 ? 345.807 ms/op >> CodeLoad.test ss 20 4784.299 ? 370.658 ms/op >> Crypto.test ss 20 878.395 ? 87.918 ms/op >> DeltaBlue.test ss 20 502.182 ? 52.362 ms/op >> EarleyBoyer.test ss 20 2250.508 ? 273.924 ms/op >> Gbemu.test ss 20 5893.102 ? 656.036 ms/op >> Mandreel.test ss 20 9323.484 ? 825.801 ms/op >> NavierStokes.test ss 20 657.608 ? 41.212 ms/op >> PdfJS.test ss 20 3829.534 ? 353.702 ms/op >> Raytrace.test ss 20 1202.826 ? 166.795 ms/op >> Regexp.test ss 20 156.782 ? 20.992 ms/op >> Richards.test ss 20 324.256 ? 35.874 ms/op >> Splay.test ss 20 179.660 ? 34.120 ms/op >> Typescript.test ss 20 40.537 ? 2.457 s/op >> >> Patched: >> >> Benchmark Mode Cnt Score Error Units >> Box2D.test ss 20 4306.198 ? 376.030 ms/op >> CodeLoad.test ss 20 4881.635 ? 395.585 ms/op >> Crypto.test ss 20 823.551 ? 106.679 ms/op >> DeltaBlue.test ss 20 490.557 ? 41.705 ms/op >> EarleyBoyer.test ss 20 2299.763 ? 270.961 ms/op >> Gbemu.test ss 20 5612.868 ? 414.052 ms/op >> Mandreel.test ss 20 8616.735 ? 825.813 ms/op >> NavierStokes.test ss 20 640.722 ? 28.035 ms/op >> PdfJS.test ss 20 4139.396 ? 373.580 ms/op >> Raytrace.test ss 20 1227.632 ? 151.088 ms/op >> Regexp.test ss 20 169.246 ? 34.055 ms/op >> Richards.test ss 20 331.824 ? 32.706 ms/op >> Splay.test ss 20 168.479 ? 23.512 ms/op >> Typescript.test ss 20 31.181 ? 1.790 s/op >> >> The offending profile branch (Universe::flush_dependents_on) is also >> gone, which explains the performance improvement. >> >> Thanks, >> -Aleksey. >> >_______________________________________________ >mlvm-dev mailing list >mlvm-dev at openjdk.java.net >http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev From kumar.x.srinivasan at oracle.com Fri Apr 10 17:33:26 2015 From: kumar.x.srinivasan at oracle.com (Kumar Srinivasan) Date: Fri, 10 Apr 2015 10:33:26 -0700 Subject: [9] Review Request: 8076264 [macosx] Launching app on MacOSX requires enclosing class In-Reply-To: References: <55252D45.4050109@oracle.com> <5527D489.2070301@oracle.com> <5527E623.2070308@oracle.com> Message-ID: <55280966.8020203@oracle.com> > I don't get it. Either providing this information (what "java > program" is running - main class and/or command line) is generally > useful or it is not. There's nothing macosx-specific about it. > Either provide a clean blessed api (i.e. not an environment variable) > and have Are you equating environment variable to system property ? Kumar > AWT etc use it on every platform or do not provide it at all. Hmmm... > come to think of it, "jps" gives a list of java processes and tries to > identify them using their main class, so there's cross-platform precedent. > > So please just figure out how to stop setting this environment > variable at all. > > On Fri, Apr 10, 2015 at 8:02 AM, Kumar Srinivasan > > > wrote: > > and it looks like sun.java.command is no longer exported to Java. > > /* > * inject the -Dsun.java.command pseudo property into the args > structure > * this pseudo property is used in the HotSpot VM to expose the > * Java class name and arguments to the main method to the VM. The > * HotSpot VM uses this pseudo property to store the Java class name > * (or jar file name) and the arguments to the class's main method > * to the instrumentation memory region. The sun.java.command pseudo > * property is not exported by HotSpot to the Java layer. > */ > > I guess you could get it from the intrumentation or serviceability > layer, that may likely be an additional overhead. > > Kumar > > On 4/10/2015 6:47 AM, Sergey Bylokhov wrote: > > On 10.04.15 15:28, Martin Buchholz wrote: > > > My biggest gripe about the Mac behavior was that java > startup was doing AWT-specific initialization even though > there is no AWT code here. Figure out how to move this > code into the AWT module somehow? Isn't this sort of > thing one of the goals of jigsaw? > > But looking at SetMainClassForAWT I see that this is hard > to change. It's a mess. Why does AWT, SWT and JavaFX > want to get the name of the main class, but ... only on Mac?! > > It is used to initialize the name of the application during > start of UI library. Since there is no public way to take the > mainclass from the launcher(see [1] and [2]) we need to pass > this value ourself. I suppose such functionality is missing(or > not implemented) on other platforms. > > [1] https://bugs.openjdk.java.net/browse/JDK-4827318 > [2] > http://stackoverflow.com/questions/939932/how-to-determine-main-class-at-runtime-in-threaded-java-application > > > 969 * WARNING: This environment variable is an > implementation detail and > 970 * isn't meant for use outside of the core > platform. The mechanism for > 971 * passing this information from Java launcher > to other modules may > 972 * change drastically between update release, > and it may even be > 973 * removed or replaced with another mechanism. > 974 * > 975 * NOTE: It is used by SWT, and JavaFX. > > > On Wed, Apr 8, 2015 at 6:29 AM, Sergey Bylokhov > > >> wrote: > > Hello. > Please review the fix for jdk 9. > After the fix we clear all errors caused by > getCanonicalName() on > the mainclass and leave JAVA_MAIN_CLASS_ empty. This > empty case > will be handled in the NSApplicationAWT.m. > Plus small cleanup suggested in the bug > report(jstring->jclass). > > Bug: https://bugs.openjdk.java.net/browse/JDK-8076264 > Webrev can be found at: > http://cr.openjdk.java.net/~serb/8076264/webrev.01 > > > > -- Best regards, Sergey. > > > > > > From huizhe.wang at oracle.com Fri Apr 10 18:27:00 2015 From: huizhe.wang at oracle.com (huizhe wang) Date: Fri, 10 Apr 2015 11:27:00 -0700 Subject: RFR [9] 8077332: tidy warnings from javax/xml In-Reply-To: <5527F132.80408@oracle.com> References: <5527F132.80408@oracle.com> Message-ID: <552815F4.4050005@oracle.com> Hi Alexander, First of all, there's no code change in this webrev, the copyright year should not be changed. I see that in some cases, you removed "

    ", in a lot more cases though, you didn't, for example, - * Return day in month or {@link DatatypeConstants#FIELD_UNDEFINED}.

    + * Return day in month or {@link DatatypeConstants#FIELD_UNDEFINED}. * *

    Value constraints for this value are summarized in * day field of date/time field mapping table.

    I suggest you do a global substitution for each of the classes. As Roger suggested in the previous view, {@code } is preferable to ... . This can be a couple of global substitutions as well (s//{@code /g and s/<\/code>/}/g), An example is the following change: +++ new/src/java.xml/share/classes/javax/xml/datatype/DatatypeFactory.java 2015-04-10 19:59:29.427759390 +0400 @@ -787,7 +786,7 @@ * * * - * (ZONE_OFFSET + DST_OFFSET) / (60*1000)
    + * (ZONE_OFFSET + DST_OFFSET) / (60*1000)
    Note also at line 35, the "s" was outside of markup: * Factory that creates new javax.xml.datatype Objects that map XML to/from Java Objects. +++ new/src/java.xml/share/classes/javax/xml/datatype/Duration.java 2015-04-10 19:59:29.807759373 +0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. *(JW) Copyright year shall not be changed.* * - *

    The first five fields have non-negative (>=0) integers or null + *

    The first five fields have non-negative (≥0) integers or null *(JW) Use {@literal }**instead.* @@ -57,7 +57,7 @@ *

  • A<B (A is shorter than B) *
  • A>B (A is longer than B) *
  • A==B (A and B are of the same duration) - *
  • A<>B (Comparison between A and B is indeterminate) + *
  • A<>B (Comparison between A and B is indeterminate) *(JW) Use @literal instead.* There are a lot more "<>" being changed to "<>", please use @literal or @code. @code is preferable if the content is presented in the code font. *

    For example, "P1D" (one day) > "PT12H" (12 hours) and *^ this one was missed by the way.* - * "P2Y" (two years) > "P23M" (23 months).

    + * "P2Y" (two years) > "P23M" (23 months).

    +++ new/src/java.xml/share/classes/javax/xml/stream/XMLStreamReader.java 2015-04-10 19:59:32.027759273 +0400 @@ -542,7 +543,7 @@ * If the number of characters actually copied is less than the "length", then there is no more text. * Otherwise, subsequent calls need to be made until all text has been retrieved. For example: * - * + * * int length = 1024; * char[] myBuffer = new char[ length ]; * @@ -550,7 +551,7 @@ * { * int nCopied = stream.getTextCharacters( sourceStart, myBuffer, 0, length ); * - * if (nCopied < length) + * if (nCopied < length) * break; * } * (JW) after substituting with {@code ...}, no need to change < to < Please also add
     to the code snippet.
    
    -     * 

    Normally, result tree serialization escapes & and < (and + *

    Normally, result tree serialization escapes & and < (and *(JW) use @literal for "&" as well.* - *

    Use a DOM node to create a new output target with the specified System ID.

    + *

    Use a DOM node to create a new output target with the specified System ID.

    *(JW) again, replace and remove all "

    "* Thanks, Joe On 4/10/2015 8:50 AM, alexander stepanov wrote: > Hello, > > Could you please review the following fix > http://cr.openjdk.java.net/~avstepan/8077332/ > > for > https://bugs.openjdk.java.net/browse/JDK-8077332 > > Some HTML cleanup for docs. > > Thanks, > Alexander > From martinrb at google.com Fri Apr 10 18:57:34 2015 From: martinrb at google.com (Martin Buchholz) Date: Fri, 10 Apr 2015 11:57:34 -0700 Subject: [9] Review Request: 8076264 [macosx] Launching app on MacOSX requires enclosing class In-Reply-To: <55280966.8020203@oracle.com> References: <55252D45.4050109@oracle.com> <5527D489.2070301@oracle.com> <5527E623.2070308@oracle.com> <55280966.8020203@oracle.com> Message-ID: On Fri, Apr 10, 2015 at 10:33 AM, Kumar Srinivasan < kumar.x.srinivasan at oracle.com> wrote: > > I don't get it. Either providing this information (what "java program" > is running - main class and/or command line) is generally useful or it is > not. There's nothing macosx-specific about it. Either provide a clean > blessed api (i.e. not an environment variable) and have > > > Are you equating environment variable to system property ? > The environment variable is particularly bad because it is just a private communication mechanism, but one that is even visible to subprocesses. A proper documented supported public cross-platform API would be fine, and that would include a system property. I now see my jdk9 has a system property sun.java.command= Why can't AWT use that? (We could improve it by making it "official", i.e. move it to the java.* namespace.) From kumar.x.srinivasan at oracle.com Fri Apr 10 19:08:30 2015 From: kumar.x.srinivasan at oracle.com (Kumar Srinivasan) Date: Fri, 10 Apr 2015 12:08:30 -0700 Subject: [9] Review Request: 8076264 [macosx] Launching app on MacOSX requires enclosing class In-Reply-To: References: <55252D45.4050109@oracle.com> <5527D489.2070301@oracle.com> <5527E623.2070308@oracle.com> <55280966.8020203@oracle.com> Message-ID: <55281FAE.3040404@oracle.com> On 4/10/2015 11:57 AM, Martin Buchholz wrote: > > > On Fri, Apr 10, 2015 at 10:33 AM, Kumar Srinivasan > > > wrote: > >> I don't get it. Either providing this information (what "java >> program" is running - main class and/or command line) is >> generally useful or it is not. There's nothing macosx-specific >> about it. Either provide a clean blessed api (i.e. not an >> environment variable) and have > > Are you equating environment variable to system property ? > > > The environment variable is particularly bad because it is just a > private communication mechanism, but one that is even visible to > subprocesses. A proper documented supported public cross-platform API > would be fine, and that would include a system property. > > I now see my jdk9 has a system property > > sun.java.command= > > Why can't AWT use that? It relates to the comment I have below, look at: http://hg.openjdk.java.net/jdk9/dev/jdk/file/84c5527f742b/src/java.base/share/native/libjli/java.c#l1412 Kumar > > (We could improve it by making it "official", i.e. move it to the > java.* namespace.) From john.r.rose at oracle.com Fri Apr 10 19:15:01 2015 From: john.r.rose at oracle.com (John Rose) Date: Fri, 10 Apr 2015 12:15:01 -0700 Subject: [9] RFR (S): Class.getSimpleName() should work for non-JLS compliant class names In-Reply-To: <55270862.9020704@oracle.com> References: <55254C1B.2040603@oracle.com> <5525E95F.7080306@oracle.com> <552691DA.7000604@oracle.com> <55270862.9020704@oracle.com> Message-ID: <38AF71DB-944B-42B8-A955-C5173881BE63@oracle.com> On Apr 9, 2015, at 4:16 PM, David Holmes wrote: > > Hi Vladimir, > > On 10/04/2015 12:51 AM, Vladimir Ivanov wrote: >> David, thanks for the feedback! >> >> Updated webrev: >> http://cr.openjdk.java.net/~vlivanov/8057919/webrev.01/jdk >> http://cr.openjdk.java.net/~vlivanov/8057919/webrev.01/hotspot >> >> I restored original logic and call into VM only if it fails. > > This change seems fine to me, but I think John may prefer to see getSimpleName implemented such that it always returns the name from the innerclass attribute. (Though perhaps with caching if performance is a concern?) Yes, I do prefer the new logic instead of a combination of old and new. Two concerns: Somebody somewhere might be relying on a bug in the old logic and be frustrated by seeing that bug fixed. This is a fine line to walk, but in this case I think the behavior change (if any) will show up in places where we already have outages. Perhaps someone is post-processing the result of getSimpleName to correct it. If so they may no longer need to do that. Second, the new logic may itself have issues. A typical problem with the InnerClasses attribute is it is broken or stripped, or a related nestmate is missing. (See parallel thread in core-libs-dev on 8076264.) But the proposed change takes effect after a call to Class.getEnclosingClass, which uses InstanceKlass::compute_enclosing_class_impl and accesses the same InnerClasses record. This leads me to a comment: The common code (two uses of InnerClassesIterator with klass_name_at_matches) should be factored out. The factored subroutine should search out the self-record in the InnerClasses attribute. The logic is tricky enough that I'm uncomfortable with it being duplicated. Key issue: We don't want to load any classes doing this lookup. (For bonus points, factor the third use in that file, the one that looks not for self but for children-of-self. Add a boolean flag that varies the test.) Bottom line: The new logic should replace the old. > >>>> The logic to compute simple name (Class.getSimpleName()) for >>>> inner/nested/local classes is tightly coupled with Java naming scheme >>>> and sometimes fails for classes generated from non-Java code. >>> >>> Meta-question: if this is non-Java code then what does/should >>> "simpleName" even mean? "Returns the simple name of the underlying class >>> as given in the source code." If there is no (java) source code does >>> this have any meaning? Should it return "" ? >> My reading of the JVMS is that InnerClasses attribute can be freely used >> by non-Java compilers to store simple names for classes they generate. >> The current wording for inner_name_index doesn't mention Java language. > > True, but it does refer to source code: "represents the original simple name of C, as given in the source code from which this class file was compiled. " which seems misplaced as we're discussing classes for which there is no source code as such. It could be non-Java source code. In any case, the indicated component of the "binary name" of the class is well-defined, whether or not it occurs in source code. Note also that classes might be generated by ASM (no source code per se) but we still have a reasonable expectation of reflecting on them, even though reflection is (mostly) defined in terms of source code constructs. > Anyway it just flags to me that perhaps these Class methods need to be generalized a bit given the support for non-Java languages on the JVM. But that's for core-libs folk to decide. Yes, I think that's the issue. The multi-language folks (like me) would be disappointed to hear that we decided that non-Java languages don't have any needs here; they do. Thanks, ? John > Thanks, > David > >> Best regards, >> Vladimir Ivanov >> >>>> Instead of parsing class name and try to extract simple name based on >>>> JLS rules, the fix I propose is to use InnerClasses attribute from the >>>> class file. Simple name is already recorded there. >>> > >>>> JVMS-4.7.6: The InnerClasses Attribute >>>> "inner_name_index: If C is anonymous (JLS ?15.9.5), the value of the >>>> inner_name_index item must be zero. Otherwise, the value of the >>>> inner_name_index item must be a valid index into the constant_pool >>>> table, and the entry at that index must be a CONSTANT_Utf8_info >>>> structure (?4.4.7) that represents the original simple name of C, as >>>> given in the source code from which this class file was compiled." >>>> >>>> Since I consider backporting the fix into 8u60, I'd like to hear >>>> opinions about backward compatibility of such change. >>>> >>>> As an alternative solution, I can restore original logic and consult >>>> InnerClasses attribute when class name parsing logic fails. >>> >>> I think I'd prefer to see the VM call only used as a fallback if the >>> regular parsing fails. That would prevent any compatibility issues for >>> the 8u backport (ignoring tests that deliberately generate invalidly >>> named classes). >>> >>> Thanks, >>> David >>> >>>> Testing: regression test, jck-runtime/java_lang, jdk/test/java/lang/ >>>> >>>> Thanks! >>>> >>>> Best regards, >>>> Vladimir Ivanov From martinrb at google.com Fri Apr 10 19:47:47 2015 From: martinrb at google.com (Martin Buchholz) Date: Fri, 10 Apr 2015 12:47:47 -0700 Subject: [9] Review Request: 8076264 [macosx] Launching app on MacOSX requires enclosing class In-Reply-To: <55281FAE.3040404@oracle.com> References: <55252D45.4050109@oracle.com> <5527D489.2070301@oracle.com> <5527E623.2070308@oracle.com> <55280966.8020203@oracle.com> <55281FAE.3040404@oracle.com> Message-ID: On Fri, Apr 10, 2015 at 12:08 PM, Kumar Srinivasan < kumar.x.srinivasan at oracle.com> wrote: > > On 4/10/2015 11:57 AM, Martin Buchholz wrote: > > > > On Fri, Apr 10, 2015 at 10:33 AM, Kumar Srinivasan < > kumar.x.srinivasan at oracle.com> wrote: >> >> I don't get it. Either providing this information (what "java >> program" is running - main class and/or command line) is generally useful >> or it is not. There's nothing macosx-specific about it. Either provide a >> clean blessed api (i.e. not an environment variable) and have >> >> >> Are you equating environment variable to system property ? >> > > The environment variable is particularly bad because it is just a > private communication mechanism, but one that is even visible to > subprocesses. A proper documented supported public cross-platform API > would be fine, and that would include a system property. > > I now see my jdk9 has a system property > > sun.java.command= > > Why can't AWT use that? > > > It relates to the comment I have below, look at: > > http://hg.openjdk.java.net/jdk9/dev/jdk/file/84c5527f742b/src/java.base/share/native/libjli/java.c#l1412 > I'm confused. Comments in java.c suggest that sun.java.command is not exposed to java land, but my test program clearly tells me it's there! (with jdk9-b57) From brian.burkhalter at oracle.com Fri Apr 10 22:26:31 2015 From: brian.burkhalter at oracle.com (Brian Burkhalter) Date: Fri, 10 Apr 2015 15:26:31 -0700 Subject: [9] RFR of 8075156: (prefs) remove() should disallow the use of the null control character '\u0000' as key In-Reply-To: <5520414A.4000804@oracle.com> References: <6AECFBD9-492F-4EA4-B126-478F1B19D5AE@oracle.com> <5520414A.4000804@oracle.com> Message-ID: <21B0A029-9D57-445F-BE5F-5C0D03D7581D@oracle.com> On Apr 4, 2015, at 12:53 PM, Alan Bateman wrote: > On 24/03/2015 19:20, Brian Burkhalter wrote: >> Please review at your convenience. >> >> Issue: https://bugs.openjdk.java.net/browse/JDK-8075156 >> Patch: http://cr.openjdk.java.net/~bpb/8075156/webrev.00/ >> >> This is a sequel to the resolved issue https://bugs.openjdk.java.net/browse/JDK-8068373, (prefs) FileSystemPreferences writes \0 to XML storage, causing loss of all preferences, wherein the code point U+0000, the null control character, was made illegal to use as a key in the generic Unix file system-based Preferences. >> >> The issue at hand extends disallowing U+0000 as a key in the put() method on Mac OS X and Windows, and also disallows this use to the remove() methods on these platforms and in the generic Unix file system-based Preferences. >> >> Use of U+0000 in the corresponding get() method has not been disallowed as this method returns a default value. If it would be preferable that the behavior of get() with respect to the key U+0000 were the same as for put() and remove() then this patch may be updated to that effect. >> > Minimally then the putXXX methods should make it clear that they throw IAE for this case. This would be a javadoc only change because the implementation does this as a consequence of the original patch. Agreed. Actually I am not completely satisfied with the fix for https://bugs.openjdk.java.net/browse/JDK-8068373 so I went back over all the discussions and notes on the various ways to fix the problem trying to rethink whether there might be a better solution. The problem is not really with the Preferences APIs per se, but rather with the ability of the XML-based backing store to handle all characters which might be present in a String, in this particular case \u0000, but there are other possible problematic characters as well. Ideally, the fix would be to modify the XML backing store to handle all possible characters. This does not however appear to be possible without introducing an incompatibility when the XML backing store is shared between the set of newer versions of Java which would support storing all characters and the older versions which do not. There are ways to minimize the incompatibility but not apparently eliminate it and the additional complexity might not merit the effort. In the RFC thread on 8068373, it was concluded that it would be better simply to disallow \u0000 for XML-backed Preferences. This change however introduced an incompatibility with non-XML backing stores which might or might not be able to handle \u0000. So to address this incompatibility (and to address the companion get/remove methods) the present RFR was introduced. The present change has the potential however to break Preferences implementations which have a backing store for which \u0000 *is* legal. Note also that all Preferences implementations should be able to handle all Strings if there is no interaction with the backing store, even in the case of the XML backing store. Without a round trip via the XML backing store no error would be encountered. This suggests an alternative fix of allowing the illegal character to be used ?live? but disallowed from being written to a backing store which cannot handle it. I raise these alternatives here because if any were preferable, then there is no point in going further in the current direction as one changeset reversion would already be needed. > In the original discussion then it was just a question as to whether get/getXXX and remove should be consistent. If the get and remove methods will always behave as if the key doesn't exist (and return the default value in the case of get) then it shouldn't require a javadoc change. In the case of get(), for implementations based on AbstractPreferences, any exception thrown by getSpi() will in any case be caught and the default value returned. For remove() there might after all be no point in checking the key if the key is disallowed from being stored in the first place, so the method call would be a no-op and neither an implementation nor a javadoc change would be needed. > However I suspect it will require an implementation change as there may be non-XML backing stores might that allow \0 in the key (hence get and remove should actually do something). As noted above, it might not be correct to extend the checked-in fix for 8068373 to the non-XML backing store cases as is being proposed in this RFR and likewise not to modify remove() symmetrically. Rethinking this entire topic l am now inclined to suggest retracting the prior fix of 8068373 and instead take one of the following approaches: 1. Modify the XML backing store to be able to handle at least \0 if not other characters problematic for XML. As noted above this might be complicated and introduce inter-version incompatibilities. 2. Allow \0 to be in Strings at the API level but do not write these entries to an XML backing store. This would allow in-session use of unsupported characters but these would magically disappear thereafter which could cause confusion. 3. Change the put() specification to allow throwing an IAE if the backing store cannot handle the supplied Strings. This however runs somewhat counter to the Preferences class-level specification that "The user of this class needn't be concerned with details of the backing store.? On reexamining things I also noticed this paragraph in the AbstractPreferences class-level specification: "The remaining SPI methods putSpi(String,String), removeSpi(String) and childSpi(String) have more complicated exception behavior. They are not specified to throw BackingStoreException, as they can generally obey their contracts even if the backing store is unavailable. This is true because they return no information and their effects are not required to become permanent until a subsequent call to Preferences.flush() or Preferences.sync(). Generally speaking, these SPI methods should not throw exceptions. In some implementations, there may be circumstances under which these calls cannot even enqueue the requested operation for later processing. Even under these circumstances it is generally better to simply ignore the invocation and return, rather than throwing an exception. Under these circumstances, however, all subsequent invocations of flush() and sync should return false, as returning true would imply that all previous operations had successfully been made permanent." This suggests that solution #2 above might be the appropriate fix instead of that of 8068373 plus the patch in the current RFR. There are errors in the above specification paragraph however which should also be fixed, viz., flush{Spi}() and sync{Spi}() are void, not boolean-returning methods. Thanks, Brian From martinrb at google.com Sat Apr 11 05:37:40 2015 From: martinrb at google.com (Martin Buchholz) Date: Fri, 10 Apr 2015 22:37:40 -0700 Subject: RFR 9: 8077350 Process API Updates Implementation Review In-Reply-To: <5526DA4A.6030808@Oracle.com> References: <5526DA4A.6030808@Oracle.com> Message-ID: Thanks for the huge effort. I did a superficial review and it seems pretty good. Of course, changing the Process good is high risk and some things will probably need fixup later. On Unix, you seem to be identifying ProcessHandles by their pid. What are you going to do about the problem of misidentifying Unix processes whose pid got recycled? If you spin up a thread to call waitpid as soon as you create the ProcessHandle, the window is very short (and OSes avoid recycling pids immediately) so that's pretty safe, but it wastes a thread for each ProcessHandle! I don't have a good answer. Maybe record the start time of the process, where available? + } else if (siginfo.si_code == CLD_KILLED || siginfo.si_code == CLD_DUMPED) { Using siginfo probably won't work under load because multiple signals arriving at the same time are coalesced into one, at least on Linux. Unix signals are sadly totally broken. -- It seems you don't support sending arbitary signals, which is a little sad. On Thu, Apr 9, 2015 at 1:00 PM, Roger Riggs wrote: > Please review the API and implementation of the Process API Updates > described inJEP 102 . > Please review and comment by April 23rd. > > The recommendation to make ProcessHandle an interface is included > allowing the new functions to be extended by Process subclasses. > The implementation covers all functions on Unix, Windows, Solaris, and Mac > OS X. > > The API doc: http://cr.openjdk.java.net/~rriggs/ph-apidraft/ > > The webrev: http://cr.openjdk.java.net/~rriggs/webrev-ph > > Issue: JDK-8077350 > Process API Updates Implementation > > The code is in the jdk9 sandbox on branch JDK-8046092-branch. > > Please review and comment, Roger > From martinrb at google.com Sat Apr 11 05:50:53 2015 From: martinrb at google.com (Martin Buchholz) Date: Fri, 10 Apr 2015 22:50:53 -0700 Subject: RFR 9: 8077350 Process API Updates Implementation Review In-Reply-To: References: <5526DA4A.6030808@Oracle.com> Message-ID: On Fri, Apr 10, 2015 at 10:37 PM, Martin Buchholz wrote: > > + } else if (siginfo.si_code == CLD_KILLED || siginfo.si_code == CLD_DUMPED) { > > Using siginfo probably won't work under load because multiple signals > arriving at the same time are coalesced into one, at least on Linux. > Unix signals are sadly totally broken. > Of course I was wrong - I should have looked more closely at the code - you're not using signals, despite the use of siginfo! --- Can you explain why you chose to use waitid instead of waitpid? From anthony.vanelverdinghe at gmail.com Sat Apr 11 09:00:14 2015 From: anthony.vanelverdinghe at gmail.com (Anthony Vanelverdinghe) Date: Sat, 11 Apr 2015 11:00:14 +0200 Subject: RFR 9: 8077350 Process API Updates Implementation Review In-Reply-To: <5526DA4A.6030808@Oracle.com> References: <5526DA4A.6030808@Oracle.com> Message-ID: <5528E29E.1070503@gmail.com> Hi Roger In my opinion, the method "supportsDestroyForcibly" is unintuitive, for the following 2 reasons: - it's named "supportsXxx", where Xxx is the name of a method in the same class. So as a user of this API, I would intuitively assume that "supportsDestroyForcibly" is related to "destroyForcibly", and means whether or not "destroyForcibly" actually forcibly terminates the process. - "supports" has a positive connotation. However, if "supportsDestroyForcibly" returns true, this means that the implementation of "destroy" is forcible. And "destroyForcibly" either invokes "destroy" (default implementation) or is overridden with a compliant implementation. So in other words: if "supportsDestroyForcibly" returns true, it's impossible to allow the process to shut down cleanly. This, in my opinion, is a bad thing, so the method indicating this behavior should not start with "supports". Therefore I would like to propose to replace "supportsDestroyForcibly" with "supportsDestroy", which returns the negation of what's currently returned by "supportsDestroyForcibly". Another question I have is: what happens if "destroy" or "destroyForcibly" are called on processes other than the current process & its children, i.e. a process that is in "allProcesses" but isn't "current" & isn't in "allChildren" (e.g. the parent process of the current process)? Kind regards, Anthony On 9/04/2015 22:00, Roger Riggs wrote: > Please review the API and implementation of the Process API Updates > described inJEP 102 > . Please review and > comment by April 23rd. > > The recommendation to make ProcessHandle an interface is included > allowing the new functions to be extended by Process subclasses. > The implementation covers all functions on Unix, Windows, Solaris, and > Mac OS X. > > The API doc: http://cr.openjdk.java.net/~rriggs/ph-apidraft/ > > The webrev: http://cr.openjdk.java.net/~rriggs/webrev-ph > > Issue: JDK-8077350 > Process API Updates Implementation > > The code is in the jdk9 sandbox on branch JDK-8046092-branch. > > Please review and comment, Roger > > From thomas.stuefe at gmail.com Sat Apr 11 12:31:36 2015 From: thomas.stuefe at gmail.com (=?UTF-8?Q?Thomas_St=C3=BCfe?=) Date: Sat, 11 Apr 2015 14:31:36 +0200 Subject: RFR 9: 8077350 Process API Updates Implementation Review In-Reply-To: <5526DA4A.6030808@Oracle.com> References: <5526DA4A.6030808@Oracle.com> Message-ID: Hi Roger, I have a question about getChildren() and getAllChildren(). I assume the point of those functions is to implement point 4 of JEP 102 ("The ability to deal with process trees, in particular some means to destroy a process tree."), by returning a collection of PIDs which are the children of the process and then killing them? However, I am not sure that this can be implemented in a safe way, at least on UNIX, because - as Martin already pointed out - of PID recycling. I do not see how you can prevent allChildren() from returning PIDs which may be already reaped and recyled when you use them later. How do you prevent that? Note even if your coding is bulletproof, that allChildren() will also return PIDs of sub processes which are completely unrelated to you and Process.java - they could have been forked by some third party native code which just happens to run in parallel in the same process. There, you have no control about when it gets reaped. It might already have been reaped by the time allChildren() returns, and now the same PID got recycled as another, unrelated process. If I am right, it would not be sufficient to state "There is no guarantee that a process is alive." - it may be alive but by now be a different process altogether. This makes "allChildren()" useless for many cases, because the returned information may already be obsolete the moment the function returns. Of course I may something missing here? But if I got all that right and the sole purpose of allChildren() is to be able to kill them (or otherwise signal them), why not use process groups? Process groups would be the traditional way on POSIX platforms to handle process trees, and they are also available on Windows in the form of Job Objects. Using process groups to signal sub process trees would be safe, would not rely on PID identity, and would be more efficient. Also way less coding. Also, it would be an old, established pattern - process groups have been around for a long time. Also, using process groups it is possible to break away from a group, so a program below you which wants to run as a demon can do so by removing itself from the process group and thus escaping your kill. On Windows we have Job objects, and I think there are enough similarities to POSIX process groups to abstract them into something platform independent. The only problem I think is that the API would have somehow to be changed. Either by directly reflecting the use of process groups, or at least by removing allChildren() and replacing it with something like "killAllChildren()" or "signalAllChildren()". Kind Regards, Thomas On Thu, Apr 9, 2015 at 10:00 PM, Roger Riggs wrote: > Please review the API and implementation of the Process API Updates > described inJEP 102 . > Please review and comment by April 23rd. > > The recommendation to make ProcessHandle an interface is included > allowing the new functions to be extended by Process subclasses. > The implementation covers all functions on Unix, Windows, Solaris, and Mac > OS X. > > The API doc: http://cr.openjdk.java.net/~rriggs/ph-apidraft/ > > The webrev: http://cr.openjdk.java.net/~rriggs/webrev-ph > > Issue: JDK-8077350 > Process API Updates Implementation > > The code is in the jdk9 sandbox on branch JDK-8046092-branch. > > Please review and comment, Roger > On Thu, Apr 9, 2015 at 10:00 PM, Roger Riggs wrote: > Please review the API and implementation of the Process API Updates > described inJEP 102 . > Please review and comment by April 23rd. > > The recommendation to make ProcessHandle an interface is included > allowing the new functions to be extended by Process subclasses. > The implementation covers all functions on Unix, Windows, Solaris, and Mac > OS X. > > The API doc: http://cr.openjdk.java.net/~rriggs/ph-apidraft/ > > The webrev: http://cr.openjdk.java.net/~rriggs/webrev-ph > > Issue: JDK-8077350 > Process API Updates Implementation > > The code is in the jdk9 sandbox on branch JDK-8046092-branch. > > Please review and comment, Roger > From thomas.stuefe at gmail.com Sat Apr 11 12:44:30 2015 From: thomas.stuefe at gmail.com (=?UTF-8?Q?Thomas_St=C3=BCfe?=) Date: Sat, 11 Apr 2015 14:44:30 +0200 Subject: RFR 9: 8077350 Process API Updates Implementation Review In-Reply-To: References: <5526DA4A.6030808@Oracle.com> Message-ID: p.s. Note that using allChildren() to kill process trees has a second problem, even without PID recycling: the PID list it returns may not be complete once you come around to use it. Imagine a process tree with some runaway process forking below you constantly. You want to kill the complete process tree, and do this fast. Iterating over /proc to collect PIDs, returning this list to java to then start processing it may be way to slow for this case. You'd end up with a lot of zombies. Again, process groups were made for problems like this. On Sat, Apr 11, 2015 at 2:31 PM, Thomas St?fe wrote: > Hi Roger, > > I have a question about getChildren() and getAllChildren(). > > I assume the point of those functions is to implement point 4 of JEP 102 > ("The ability to deal with process trees, in particular some means to > destroy a process tree."), by returning a collection of PIDs which are the > children of the process and then killing them? > > However, I am not sure that this can be implemented in a safe way, at > least on UNIX, because - as Martin already pointed out - of PID recycling. > I do not see how you can prevent allChildren() from returning PIDs which > may be already reaped and recyled when you use them later. How do you > prevent that? > > Note even if your coding is bulletproof, that allChildren() will also > return PIDs of sub processes which are completely unrelated to you and > Process.java - they could have been forked by some third party native code > which just happens to run in parallel in the same process. There, you have > no control about when it gets reaped. It might already have been reaped by > the time allChildren() returns, and now the same PID got recycled as > another, unrelated process. > > If I am right, it would not be sufficient to state "There is no guarantee > that a process is alive." - it may be alive but by now be a different > process altogether. This makes "allChildren()" useless for many cases, > because the returned information may already be obsolete the moment the > function returns. > > Of course I may something missing here? > > But if I got all that right and the sole purpose of allChildren() is to be > able to kill them (or otherwise signal them), why not use process groups? > Process groups would be the traditional way on POSIX platforms to handle > process trees, and they are also available on Windows in the form of Job > Objects. > > Using process groups to signal sub process trees would be safe, would not > rely on PID identity, and would be more efficient. Also way less coding. > Also, it would be an old, established pattern - process groups have been > around for a long time. Also, using process groups it is possible to break > away from a group, so a program below you which wants to run as a demon can > do so by removing itself from the process group and thus escaping your kill. > > On Windows we have Job objects, and I think there are enough similarities > to POSIX process groups to abstract them into something platform > independent. > > The only problem I think is that the API would have somehow to be changed. > Either by directly reflecting the use of process groups, or at least by > removing allChildren() and replacing it with something like > "killAllChildren()" or "signalAllChildren()". > > Kind Regards, Thomas > > > > > > > > > > > > On Thu, Apr 9, 2015 at 10:00 PM, Roger Riggs > wrote: > >> Please review the API and implementation of the Process API Updates >> described inJEP 102 . >> Please review and comment by April 23rd. >> >> The recommendation to make ProcessHandle an interface is included >> allowing the new functions to be extended by Process subclasses. >> The implementation covers all functions on Unix, Windows, Solaris, and >> Mac OS X. >> >> The API doc: http://cr.openjdk.java.net/~rriggs/ph-apidraft/ >> >> The webrev: http://cr.openjdk.java.net/~rriggs/webrev-ph >> >> Issue: JDK-8077350 >> Process API Updates Implementation >> >> The code is in the jdk9 sandbox on branch JDK-8046092-branch. >> >> Please review and comment, Roger >> > > > On Thu, Apr 9, 2015 at 10:00 PM, Roger Riggs > wrote: > >> Please review the API and implementation of the Process API Updates >> described inJEP 102 . >> Please review and comment by April 23rd. >> >> The recommendation to make ProcessHandle an interface is included >> allowing the new functions to be extended by Process subclasses. >> The implementation covers all functions on Unix, Windows, Solaris, and >> Mac OS X. >> >> The API doc: http://cr.openjdk.java.net/~rriggs/ph-apidraft/ >> >> The webrev: http://cr.openjdk.java.net/~rriggs/webrev-ph >> >> Issue: JDK-8077350 >> Process API Updates Implementation >> >> The code is in the jdk9 sandbox on branch JDK-8046092-branch. >> >> Please review and comment, Roger >> > > From Roger.Riggs at Oracle.com Sat Apr 11 18:13:30 2015 From: Roger.Riggs at Oracle.com (Roger Riggs) Date: Sat, 11 Apr 2015 14:13:30 -0400 Subject: RFR 9: 8077350 Process API Updates Implementation Review In-Reply-To: References: <5526DA4A.6030808@Oracle.com> Message-ID: <5529644A.8020405@Oracle.com> Hi Martin, Thanks for the review. On 4/11/2015 1:37 AM, Martin Buchholz wrote: > Thanks for the huge effort. I did a superficial review and it seems > pretty good. Of course, changing the Process good is high risk and > some things will probably need fixup later. > > On Unix, you seem to be identifying ProcessHandles by their pid. What > are you going to do about the problem of misidentifying Unix processes > whose pid got recycled? If you spin up a thread to call waitpid as > soon as you create the ProcessHandle, the window is very short (and > OSes avoid recycling pids immediately) so that's pretty safe, but it > wastes a thread for each ProcessHandle! I don't have a good answer. > Maybe record the start time of the process, where available? Getting the basic API and implementation in has taken too long, so I'm looking to get it general agreement and pushed and then I'd be happy to go back and include the start time in ProcessHandle. In the case of children() which already has to read /proc/pid/stat for the parent, the start time is inexpensively available also. The spec for equals(), and compareTo is straightforward without the start time. With the start time, either starttime has be exposed in the API/spec or be left 'implementation' dependent which is a poor spec. Only in the case of allProcesses() would the overhead increase significantly, it currently does not need to open /proc/pid for every process. > > + } else if (siginfo.si_code == CLD_KILLED || siginfo.si_code == CLD_DUMPED) { > Using siginfo probably won't work under load because multiple signals > arriving at the same time are coalesced into one, at least on Linux. > Unix signals are sadly totally broken. Siginfo is only used with waitid as an output argument For the case of reaping the status, it uses waitpid (as Process did before), that seemed the least risky. For the case of waiting for a process without reaping, that option is only available using waitid. I tried using waitid for both cases but on Mac, waitid didn't seem to be working correctly in all cases. > > -- > > It seems you don't support sending arbitary signals, which is a little > sad. I had not investigated any potential negative and unknowable effects of being able to send arbitrary signals. The implementation is easy to generalize, though it does not map to Windows well/at all. Would you propose it as an 'int' argument with no limitation? or what limits? I think it would be an additional method, the current destory/destroyForcibly. Thanks, Roger > > > On Thu, Apr 9, 2015 at 1:00 PM, Roger Riggs > wrote: > > Please review the API and implementation of the Process API Updates > described inJEP 102 > . Please review > and comment by April 23rd. > > The recommendation to make ProcessHandle an interface is included > allowing the new functions to be extended by Process subclasses. > The implementation covers all functions on Unix, Windows, Solaris, > and Mac OS X. > > The API doc: http://cr.openjdk.java.net/~rriggs/ph-apidraft/ > > > The webrev: http://cr.openjdk.java.net/~rriggs/webrev-ph > > > Issue: JDK-8077350 > Process API > Updates Implementation > > The code is in the jdk9 sandbox on branch JDK-8046092-branch. > > Please review and comment, Roger > > From Roger.Riggs at Oracle.com Sat Apr 11 18:35:15 2015 From: Roger.Riggs at Oracle.com (Roger Riggs) Date: Sat, 11 Apr 2015 14:35:15 -0400 Subject: RFR 9: 8077350 Process API Updates Implementation Review In-Reply-To: <5528E29E.1070503@gmail.com> References: <5526DA4A.6030808@Oracle.com> <5528E29E.1070503@gmail.com> Message-ID: <55296963.2090602@Oracle.com> Hi Anthony, Thanks for the review and comments. On 4/11/2015 5:00 AM, Anthony Vanelverdinghe wrote: > Hi Roger > > In my opinion, the method "supportsDestroyForcibly" is unintuitive, > for the following 2 reasons: > > - it's named "supportsXxx", where Xxx is the name of a method in the > same class. So as a user of this API, I would intuitively assume that > "supportsDestroyForcibly" is related to "destroyForcibly", and means > whether or not "destroyForcibly" actually forcibly terminates the > process. > > - "supports" has a positive connotation. However, if > "supportsDestroyForcibly" returns true, this means that the > implementation of "destroy" is forcible. And "destroyForcibly" either > invokes "destroy" (default implementation) or is overridden with a > compliant implementation. So in other words: if > "supportsDestroyForcibly" returns true, it's impossible to allow the > process to shut down cleanly. This, in my opinion, is a bad thing, so > the method indicating this behavior should not start with "supports". The naming of the method has been problematic; as is the ambiguous semantics of Process.destroy which are historical. > > Therefore I would like to propose to replace "supportsDestroyForcibly" > with "supportsDestroy", which returns the negation of what's currently > returned by "supportsDestroyForcibly". I'm not sure this is clearer. Both destroy() and destroyForcibly() always support the destruction of the process and without reading more closely, supportDestroy() would always be true. Perhaps supportNormalTermination() would reflect the more general understanding of the behavior and the spec could provide the details in relation to the destroy method. > > Another question I have is: what happens if "destroy" or > "destroyForcibly" are called on processes other than the current > process & its children, i.e. a process that is in "allProcesses" but > isn't "current" & isn't in "allChildren" (e.g. the parent process of > the current process)? The current spec does not guarantee that the process will be destroyed; processes can protect themselves against the signals (SIGTERM or SIGKILL) just as it does not make any assertion about the timing of the process state change. The behavior is to attempt to kill the process but it may not work for a variety of reasons, not all of which can be detected or reported to the caller. For ProcessHandle.destroy, if the OS does not allow the signal delivered, the destory/destroyForcibly method could return a boolean. Alternatively, Martin's request to throw arbitrary signals would be a new method with more os specific behavior and exceptions. The decoupling of ProcessHandle and Process opens the possibility to have different semantics than for Process.destroy/destroyForcibly. Roger > > Kind regards, > Anthony > > > On 9/04/2015 22:00, Roger Riggs wrote: >> Please review the API and implementation of the Process API Updates >> described inJEP 102 >> . Please review and >> comment by April 23rd. >> >> The recommendation to make ProcessHandle an interface is included >> allowing the new functions to be extended by Process subclasses. >> The implementation covers all functions on Unix, Windows, Solaris, >> and Mac OS X. >> >> The API doc: http://cr.openjdk.java.net/~rriggs/ph-apidraft/ >> >> The webrev: http://cr.openjdk.java.net/~rriggs/webrev-ph >> >> Issue: JDK-8077350 >> Process API Updates Implementation >> >> The code is in the jdk9 sandbox on branch JDK-8046092-branch. >> >> Please review and comment, Roger >> >> > From Roger.Riggs at Oracle.com Sat Apr 11 18:55:21 2015 From: Roger.Riggs at Oracle.com (Roger Riggs) Date: Sat, 11 Apr 2015 14:55:21 -0400 Subject: RFR 9: 8077350 Process API Updates Implementation Review In-Reply-To: References: <5526DA4A.6030808@Oracle.com> Message-ID: <55296E19.3040204@Oracle.com> Hi Thomas, Thanks for the comments. On 4/11/2015 8:31 AM, Thomas St?fe wrote: > Hi Roger, > > I have a question about getChildren() and getAllChildren(). > > I assume the point of those functions is to implement point 4 of JEP > 102 ("The ability to deal with process trees, in particular some means > to destroy a process tree."), by returning a collection of PIDs which > are the children of the process and then killing them? Earlier versions included a killProcess tree method but it was recommended to leave the exact algorithm to kill processes to the caller. > > However, I am not sure that this can be implemented in a safe way, at > least on UNIX, because - as Martin already pointed out - of PID > recycling. I do not see how you can prevent allChildren() from > returning PIDs which may be already reaped and recyled when you use > them later. How do you prevent that? Unless there is an extended time between getting the children and destroying them the pids will still be valid. The technique of caching the start time can prevent that case; though it has AFAIK not been a problem. > > Note even if your coding is bulletproof, that allChildren() will also > return PIDs of sub processes which are completely unrelated to you and > Process.java - they could have been forked by some third party native > code which just happens to run in parallel in the same process. There, > you have no control about when it gets reaped. It might already have > been reaped by the time allChildren() returns, and now the same PID > got recycled as another, unrelated process. Of course, the best case is for an application to spawn and manage its own processes and handle there proper termination. The use cases for children/allChildren are focused on supervisory/executive functions that monitor a running system and can cleanup even in the case of unexpected failures. All management of processes is subject to OS limitations, if the PID were from a completely different process tree, the ordinary destroy/info functions would not be available unless the process was running as a privileged os user (same as any other native application). > > If I am right, it would not be sufficient to state "There is no > guarantee that a process is alive." - it may be alive but by now be a > different process altogether. This makes "allChildren()" useless for > many cases, because the returned information may already be obsolete > the moment the function returns. The caching of startTime can remove the ambiguity. > > Of course I may something missing here? > > But if I got all that right and the sole purpose of allChildren() is > to be able to kill them (or otherwise signal them), why not use > process groups? Process groups would be the traditional way on POSIX > platforms to handle process trees, and they are also available on > Windows in the form of Job Objects. > > Using process groups to signal sub process trees would be safe, would > not rely on PID identity, and would be more efficient. Also way less > coding. Also, it would be an old, established pattern - process groups > have been around for a long time. Also, using process groups it is > possible to break away from a group, so a program below you which > wants to run as a demon can do so by removing itself from the process > group and thus escaping your kill. > > On Windows we have Job objects, and I think there are enough > similarities to POSIX process groups to abstract them into something > platform independent. Earlier discussions of process termination and exit value reaping considered using process groups but it became evident that the Java runtime needed to be very careful to not interfere with processes that might be spawned and controlled by native libraries and that process groups would only increase complexity and the interactions. > > The only problem I think is that the API would have somehow to be > changed. Either by directly reflecting the use of process groups, or > at least by removing allChildren() and replacing it with something > like "killAllChildren()" or "signalAllChildren()". Thanks, Roger > > Kind Regards, Thomas > > > > > > > > > > > > On Thu, Apr 9, 2015 at 10:00 PM, Roger Riggs > wrote: > > Please review the API and implementation of the Process API Updates > described inJEP 102 > . Please review > and comment by April 23rd. > > The recommendation to make ProcessHandle an interface is included > allowing the new functions to be extended by Process subclasses. > The implementation covers all functions on Unix, Windows, Solaris, > and Mac OS X. > > The API doc: http://cr.openjdk.java.net/~rriggs/ph-apidraft/ > > > The webrev: http://cr.openjdk.java.net/~rriggs/webrev-ph > > > Issue: JDK-8077350 > Process API > Updates Implementation > > The code is in the jdk9 sandbox on branch JDK-8046092-branch. > > Please review and comment, Roger > > > > On Thu, Apr 9, 2015 at 10:00 PM, Roger Riggs > wrote: > > Please review the API and implementation of the Process API Updates > described inJEP 102 > . Please review > and comment by April 23rd. > > The recommendation to make ProcessHandle an interface is included > allowing the new functions to be extended by Process subclasses. > The implementation covers all functions on Unix, Windows, Solaris, > and Mac OS X. > > The API doc: http://cr.openjdk.java.net/~rriggs/ph-apidraft/ > > > The webrev: http://cr.openjdk.java.net/~rriggs/webrev-ph > > > Issue: JDK-8077350 > Process API > Updates Implementation > > The code is in the jdk9 sandbox on branch JDK-8046092-branch. > > Please review and comment, Roger > > From anthony.vanelverdinghe at gmail.com Sat Apr 11 19:24:21 2015 From: anthony.vanelverdinghe at gmail.com (Anthony Vanelverdinghe) Date: Sat, 11 Apr 2015 21:24:21 +0200 Subject: RFR 9: 8077350 Process API Updates Implementation Review In-Reply-To: <55296963.2090602@Oracle.com> References: <5526DA4A.6030808@Oracle.com> <5528E29E.1070503@gmail.com> <55296963.2090602@Oracle.com> Message-ID: <552974E5.50202@gmail.com> Thanks for your clarifications Roger. I'm very much in favor of your suggestion for naming the method "supportsNormalTermination". Kind regards, Anthony On 11/04/2015 20:35, Roger Riggs wrote: > Hi Anthony, > > Thanks for the review and comments. > > On 4/11/2015 5:00 AM, Anthony Vanelverdinghe wrote: >> Hi Roger >> >> In my opinion, the method "supportsDestroyForcibly" is unintuitive, >> for the following 2 reasons: >> >> - it's named "supportsXxx", where Xxx is the name of a method in the >> same class. So as a user of this API, I would intuitively assume that >> "supportsDestroyForcibly" is related to "destroyForcibly", and means >> whether or not "destroyForcibly" actually forcibly terminates the >> process. >> >> - "supports" has a positive connotation. However, if >> "supportsDestroyForcibly" returns true, this means that the >> implementation of "destroy" is forcible. And "destroyForcibly" either >> invokes "destroy" (default implementation) or is overridden with a >> compliant implementation. So in other words: if >> "supportsDestroyForcibly" returns true, it's impossible to allow the >> process to shut down cleanly. This, in my opinion, is a bad thing, so >> the method indicating this behavior should not start with "supports". > The naming of the method has been problematic; as is the ambiguous > semantics of Process.destroy > which are historical. >> >> Therefore I would like to propose to replace >> "supportsDestroyForcibly" with "supportsDestroy", which returns the >> negation of what's currently returned by "supportsDestroyForcibly". > I'm not sure this is clearer. Both destroy() and destroyForcibly() > always support the destruction > of the process and without reading more closely, supportDestroy() > would always be true. > > Perhaps supportNormalTermination() would reflect the more general > understanding of the behavior > and the spec could provide the details in relation to the destroy method. > >> >> Another question I have is: what happens if "destroy" or >> "destroyForcibly" are called on processes other than the current >> process & its children, i.e. a process that is in "allProcesses" but >> isn't "current" & isn't in "allChildren" (e.g. the parent process of >> the current process)? > The current spec does not guarantee that the process will be destroyed; > processes can protect themselves against the signals (SIGTERM or SIGKILL) > just as it does not make any assertion about the timing of the process > state change. > > The behavior is to attempt to kill the process but it may not work for > a variety of > reasons, not all of which can be detected or reported to the caller. > For ProcessHandle.destroy, if the OS does not allow the signal delivered, > the destory/destroyForcibly method could return a boolean. > Alternatively, Martin's request to throw arbitrary signals would be a > new method > with more os specific behavior and exceptions. > > The decoupling of ProcessHandle and Process opens the possibility > to have different semantics than for Process.destroy/destroyForcibly. > > Roger >> >> Kind regards, >> Anthony >> >> >> On 9/04/2015 22:00, Roger Riggs wrote: >>> Please review the API and implementation of the Process API Updates >>> described inJEP 102 >>> . Please review >>> and comment by April 23rd. >>> >>> The recommendation to make ProcessHandle an interface is included >>> allowing the new functions to be extended by Process subclasses. >>> The implementation covers all functions on Unix, Windows, Solaris, >>> and Mac OS X. >>> >>> The API doc: http://cr.openjdk.java.net/~rriggs/ph-apidraft/ >>> >>> The webrev: http://cr.openjdk.java.net/~rriggs/webrev-ph >>> >>> Issue: JDK-8077350 >>> Process API >>> Updates Implementation >>> >>> The code is in the jdk9 sandbox on branch JDK-8046092-branch. >>> >>> Please review and comment, Roger >>> >>> >> > > > From alexander.v.stepanov at oracle.com Mon Apr 13 10:40:18 2015 From: alexander.v.stepanov at oracle.com (alexander stepanov) Date: Mon, 13 Apr 2015 13:40:18 +0300 Subject: RFR [9] 8077332: tidy warnings from javax/xml In-Reply-To: <5527F3D5.7070309@oracle.com> References: <5527F132.80408@oracle.com> <5527F3D5.7070309@oracle.com> Message-ID: <552B9D12.6090508@oracle.com> Hello Alan, Thank you. Regards, Alexander On 10.04.2015 19:01, Alan Bateman wrote: > On 10/04/2015 16:50, alexander stepanov wrote: >> Hello, >> >> Could you please review the following fix >> http://cr.openjdk.java.net/~avstepan/8077332/ >> >> for >> https://bugs.openjdk.java.net/browse/JDK-8077332 >> >> Some HTML cleanup for docs. > cc'ing security-dev as that is where the XML-DSIG code is maintained. > > I've also cc'ed Miroslav Kos as I think you'll need to work with him > to get the JAX-WS and JAXB updated in the upstream repos. This is > mostly just about ensuring that the changes in the jaxws repo don't > get overridden at the next JAX-WS sync up. > > -Alan From alexander.v.stepanov at oracle.com Mon Apr 13 10:44:58 2015 From: alexander.v.stepanov at oracle.com (alexander stepanov) Date: Mon, 13 Apr 2015 13:44:58 +0300 Subject: RFR [9] 8077332: tidy warnings from javax/xml In-Reply-To: <55280363.1070101@oracle.com> References: <5527F132.80408@oracle.com> <5527F3D5.7070309@oracle.com> <55280363.1070101@oracle.com> Message-ID: <552B9E2A.6010100@oracle.com> Thanks! On 10.04.2015 20:07, Sean Mullan wrote: > On 04/10/2015 12:01 PM, Alan Bateman wrote: >> On 10/04/2015 16:50, alexander stepanov wrote: >>> Hello, >>> >>> Could you please review the following fix >>> http://cr.openjdk.java.net/~avstepan/8077332/ >>> >>> for >>> https://bugs.openjdk.java.net/browse/JDK-8077332 >>> >>> Some HTML cleanup for docs. >> cc'ing security-dev as that is where the XML-DSIG code is maintained. > > The DSig changes look fine. > > --Sean From otaviojava at java.net Mon Apr 13 10:52:07 2015 From: otaviojava at java.net (=?UTF-8?Q?Ot=C3=A1vio_Gon=C3=A7alves_de_Santana?=) Date: Mon, 13 Apr 2015 07:52:07 -0300 Subject: RFR: 8076549: Update JAX-WS RI integration to latest version (2.2.11-b150402.1412) In-Reply-To: <5527A145.2050902@oracle.com> References: <551EAFDA.3020809@oracle.com> <5525962F.9060906@oracle.com> <552772A6.8050109@oracle.com> <5527A145.2050902@oracle.com> Message-ID: One Question: Look to these classes: MIMEPart MIMEMessage why do not implement AutoClosable instead Closable? Other suggestions: On class MIMEMessage, you can use diamond resource. private final List partsList = new ArrayList<>(); private final Map partsMap = new HashMap<>(); on ContextFinder class try(final InputStream resourceStream = (classLoader == null) ? ClassLoader.getSystemResourceAsStream(resource) : classLoader.getResourceAsStream(resource)) { }catch (IOException e) { throw new JAXBException(e); } on ServiceLoaderUtil class: static String propertyFileLookup(final String configFullPath, final String factoryId) throws IOException { Path path = Paths.get(configFullPath); if (Files.exists(path)) { Properties props = new Properties(); try(InputStream stream = Files.newInputStream(path)) { props.load(stream); return props.getProperty(factoryId); } } return null; } On Fri, Apr 10, 2015 at 7:09 AM, Aleksej Efimov wrote: > Hi Joe, > > Yes, the extensive testing took place before syncing the standalone > implementation to JDK: JCK, sets of jaxws/b unit tests, JPRT testing. > > Thank you for your comments and suggestions - we'll try to address them > and integrate during the next integration. About diamond operator in > MIMEMessage - not sure that we can put it there - AFAIK the standalone > JAXWS/B still supports JDK6 and we can't use "diamonds" there. > > With Best Regards, > Aleksej > > On 04/10/2015 09:50 AM, huizhe wang wrote: > >> Hi Aleksej, >> >> I assume the JAX-WS/JAXB standalone releases are well tested for this >> integration, esp. the service finder code. >> >> I see a great number of "<>" to "<>" changes that was suggested by >> Alan in the last integration. Besides that, you may consider removing

    , >> using {@literal @} to replace @, and the diamond operator in new >> expression in MIMEMessage. Also, new StringBuilder().append("META- >> INF/services/").append(jaxbContextFQCN).toString() isn't any better than >> "META-INF/services/"+jaxbContextFQCN since they'll be compiled into the >> same. >> >> None of the above should prevent you from pushing your changes. >> >> Cheers, >> Joe >> >> On 4/8/2015 1:57 PM, Aleksej Efimov wrote: >> >>> Hi, >>> Can I kindly ask for a review of this JAX-WS update? >>> >>> With Best Regards, >>> Aleksej >>> >>> On 04/03/2015 06:20 PM, Aleksej Efimov wrote: >>> >>>> Hello, >>>> >>>> Can I have a review for a JDK9 bulk update of JAX-B/WS from upstream >>>> projects. >>>> Webrev: >>>> More details in issue description: https://bugs.openjdk.java.net/ >>>> browse/JDK-8076549 >>>> >>>> Thank you, >>>> Aleksej >>>> >>> >>> >> > -- Ot?vio Gon?alves de Santana blog: http://otaviosantana.blogspot.com.br/ twitter: http://twitter.com/otaviojava site: *http://about.me/otaviojava * From alexander.v.stepanov at oracle.com Mon Apr 13 11:22:37 2015 From: alexander.v.stepanov at oracle.com (alexander stepanov) Date: Mon, 13 Apr 2015 14:22:37 +0300 Subject: RFR [9] 8077332: tidy warnings from javax/xml In-Reply-To: <552815F4.4050005@oracle.com> References: <5527F132.80408@oracle.com> <552815F4.4050005@oracle.com> Message-ID: <552BA6FD.5000706@oracle.com> Hello Joe, Thank you for the notes; > Copyright year shall not be changed. That seems to be a bit controversial point; sometimes (while cleaning docs) I was asked to do that, other times - not to do that. Our internal policy seemingly assigns to change the 2nd date every time the sources were touched (but that may be a question of ambiguous interpretation). But of course I can easily revert these changes if you're totally sure it should be done. Regards, Alexander. On 10.04.2015 21:27, huizhe wang wrote: > Hi Alexander, > > First of all, there's no code change in this webrev, the copyright > year should not be changed. > > I see that in some cases, you removed "

    ", in a lot more cases > though, you didn't, for example, > - * Return day in month or {@link DatatypeConstants#FIELD_UNDEFINED}.

    > + * Return day in month or {@link DatatypeConstants#FIELD_UNDEFINED}. > * > *

    Value constraints for this value are summarized in > * day field of date/time field mapping table.

    > > I suggest you do a global substitution for each of the classes. > > As Roger suggested in the previous view, {@code } is preferable to > ... . This can be a couple of global substitutions as > well (s//{@code /g and s/<\/code>/}/g), An example is the > following change: > +++ new/src/java.xml/share/classes/javax/xml/datatype/DatatypeFactory.java 2015-04-10 19:59:29.427759390 +0400 > > @@ -787,7 +786,7 @@ > * > * > * > - * (ZONE_OFFSET + DST_OFFSET) / (60*1000)
    > + * (ZONE_OFFSET + DST_OFFSET) / (60*1000)
    > > Note also at line 35, the "s" was outside of markup: > * Factory that creates new javax.xml.datatype Objects that map XML to/from Java Objects. > > +++ new/src/java.xml/share/classes/javax/xml/datatype/Duration.java 2015-04-10 19:59:29.807759373 +0400 > @@ -1,5 +1,5 @@ > /* > - * Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved. > + * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. > > *(JW) Copyright year shall not be changed.* > > * > - *

    The first five fields have non-negative (>=0) integers or null > + *

    The first five fields have non-negative (≥0) integers or null > > *(JW) Use {@literal }**instead.* > > @@ -57,7 +57,7 @@ > *

  • A<B (A is shorter than B) > *
  • A>B (A is longer than B) > *
  • A==B (A and B are of the same duration) > - *
  • A<>B (Comparison between A and B is indeterminate) > + *
  • A<>B (Comparison between A and B is indeterminate) > > *(JW) Use @literal instead.* > > There are a lot more "<>" being changed to "<>", please use > @literal or @code. @code is preferable if the content is presented in > the code font. > > *

    For example, "P1D" (one day) > "PT12H" (12 hours) and > > *^ this one was missed by the way.* > > - * "P2Y" (two years) > "P23M" (23 months).

    > + * "P2Y" (two years) > "P23M" (23 months).

    > > +++ new/src/java.xml/share/classes/javax/xml/stream/XMLStreamReader.java 2015-04-10 19:59:32.027759273 +0400 > > @@ -542,7 +543,7 @@ > * If the number of characters actually copied is less than the "length", then there is no more text. > * Otherwise, subsequent calls need to be made until all text has been retrieved. For example: > * > - * > + * > * int length = 1024; > * char[] myBuffer = new char[ length ]; > * > @@ -550,7 +551,7 @@ > * { > * int nCopied = stream.getTextCharacters( sourceStart, myBuffer, 0, length ); > * > - * if (nCopied < length) > + * if (nCopied < length) > * break; > * } > * > (JW) after substituting with {@code ...}, no need to > change < to < > Please also add
     to the code snippet.
    >
    > -     * 

    Normally, result tree serialization escapes & and < (and > + *

    Normally, result tree serialization escapes & and < (and > > *(JW) use @literal for "&" as well.* > > - *

    Use a DOM node to create a new output target with the specified System ID.

    > + *

    Use a DOM node to create a new output target with the specified System ID.

    > > *(JW) again, replace and remove all "

    "* > > > Thanks, > Joe > > > On 4/10/2015 8:50 AM, alexander stepanov wrote: >> Hello, >> >> Could you please review the following fix >> http://cr.openjdk.java.net/~avstepan/8077332/ >> >> for >> https://bugs.openjdk.java.net/browse/JDK-8077332 >> >> Some HTML cleanup for docs. >> >> Thanks, >> Alexander >> > From michael.haupt at oracle.com Mon Apr 13 11:40:08 2015 From: michael.haupt at oracle.com (Michael Haupt) Date: Mon, 13 Apr 2015 13:40:08 +0200 Subject: RFR (S): 8076461: JSR292: remove unused native and constants In-Reply-To: References: <4EB3C4DA-C382-4795-A676-6147E863DFF1@oracle.com> Message-ID: <3083F107-6D99-4C4F-948C-9326C0E843CE@oracle.com> Hi John, thank you very much for your review; keeping the Constants class around for VM/JDK constant value agreement certainly makes sense. I have undone most of the removal work and verified in a slowdebug build that MHN.verifyConstants() works. I've also added a comment on the Constants class to clarify its role a bit. Local tests and JPRT are still happy with this. Updated webrev: http://cr.openjdk.java.net/~mhaupt/8076461/webrev.01/ Best, Michael > Am 07.04.2015 um 23:49 schrieb John Rose : > > On Apr 7, 2015, at 12:11 PM, Michael Haupt wrote: >> >> Dear all, >> >> please review and sponsor this change. Cross-posted to hs-comp and core-lib as this is at the JVM/libraries boundary. This is a straightforward refactoring change that removes many constants and unused API from MHNatives, and places some constants used only in MemberName in that class. > > The class MethodHandleNatives.Constants exists to enumerate and cross-check any constants which the JVM and JDK code need to agree about. Removing a constant from MethodHandleNatives.Constants (moving to MemberName) may cause failures when MHN.verifyConstants is run (via "java -esa" on a debug build of Java). If there are no failures, I wonder what would happen if the JVM and JDK got out of sync. in their notion of the value of a constant like MN_CALLER_SENSITIVE. It's important that some part of our release testing detect if MN_CALLER_SENSITIVE (etc.) gets out of sync. > > If there is some reason why this testing is no longer needed, I'd like to see the whole Constants class go away, since that's all it's really good for. But I don't see that reason yet, and moving the constants somewhere either will cause a test failure, or *should* cause a test failure. > > I'm happy to see the "GC" guys go away. They were artifacts of a quickly moving 292 implementation that spanned two repositories with unsynchronized change streams. > > ? John > >> >> RFE: https://bugs.openjdk.java.net/browse/JDK-8076461 >> Changes: http://cr.openjdk.java.net/~mhaupt/8076461/webrev.00/ >> >> Tested with JPRT, HotSpot testset. >> >> Thanks, >> >> Michael -- Dr. Michael Haupt | Principal Member of Technical Staff Phone: +49 331 200 7277 | Fax: +49 331 200 7561 Oracle Java Platform Group | HotSpot Compiler Team Oracle Deutschland B.V. & Co. KG, Schiffbauergasse 14 | 14467 Potsdam, Germany Oracle is committed to developing practices and products that help protect the environment From Alan.Bateman at oracle.com Mon Apr 13 11:42:50 2015 From: Alan.Bateman at oracle.com (Alan Bateman) Date: Mon, 13 Apr 2015 12:42:50 +0100 Subject: RFR [9] 8077332: tidy warnings from javax/xml In-Reply-To: <552BA6FD.5000706@oracle.com> References: <5527F132.80408@oracle.com> <552815F4.4050005@oracle.com> <552BA6FD.5000706@oracle.com> Message-ID: <552BABBA.6050903@oracle.com> On 13/04/2015 12:22, alexander stepanov wrote: > Hello Joe, > > Thank you for the notes; > > > Copyright year shall not be changed. > > That seems to be a bit controversial point; sometimes (while cleaning > docs) I was asked to do that, other times - not to do that. Our > internal policy seemingly assigns to change the 2nd date every time > the sources were touched (but that may be a question of ambiguous > interpretation). > > But of course I can easily revert these changes if you're totally sure > it should be done. > This has always been confusing. Some areas insist on updating the copyright dates, others don't. AFAIK, it has always been optional. I think the original assumption was that the update_copyright_year script (in the top-level repo) be run periodically to do bulk updates. Unfortunately that script doesn't seem to be run very often now and this strengthens the case to update the dates on a continuous basis. I have not come across the argument that html tidy tasks that don't change the javadoc should not update the copyright date. The general topic probably should move to jdk9-dev and get this decided once and documented in the developer guide. -Alan From aleksej.efimov at oracle.com Mon Apr 13 13:08:22 2015 From: aleksej.efimov at oracle.com (Aleksej Efimov) Date: Mon, 13 Apr 2015 16:08:22 +0300 Subject: RFR: 8076549: Update JAX-WS RI integration to latest version (2.2.11-b150402.1412) In-Reply-To: References: <551EAFDA.3020809@oracle.com> <5525962F.9060906@oracle.com> <552772A6.8050109@oracle.com> <5527A145.2050902@oracle.com> Message-ID: <552BBFC6.3010501@oracle.com> Hi Ot?vio, Thank you for your remarks. Answers are in-lined below. In general - standalone JAXWS/B still compatible with JDK6. Thank you, Aleksej On 04/13/2015 01:52 PM, Ot?vio Gon?alves de Santana wrote: > > > One Question: > > Look to these classes: > MIMEPart > MIMEMessage > > why do not implement AutoClosable instead Closable? The standalone JAXWS/B still supports the JDK6 and because of that we can't use AutoClosable (since 1.7). > > Other suggestions: > > > On class MIMEMessage, you can use diamond resource. > > private final List partsList = new ArrayList<>(); > private final Map partsMap = new HashMap<>(); Same as previous - no diamonds in JDK6. > > > on ContextFinder class > > try(final InputStream resourceStream = > > (classLoader == null) ? > > ClassLoader.getSystemResourceAsStream(resource) : > > classLoader.getResourceAsStream(resource)) { > > }catch (IOException e) { > > throw new JAXBException(e); > > } > > Same as previous - no try-with-resources in JDK6 > > on ServiceLoaderUtil class: > > > static String propertyFileLookup(final String configFullPath, final > String factoryId) throws IOException { > > Path path = Paths.get(configFullPath); > > if (Files.exists(path)) { > > Properties props = new Properties(); > > try(InputStream stream = Files.newInputStream(path)) { > > props.load(stream); > > return props.getProperty(factoryId); > > } > > } > > returnnull; > > } > no try-with-resources in JDK6 > > > > > On Fri, Apr 10, 2015 at 7:09 AM, Aleksej Efimov > > wrote: > > Hi Joe, > > Yes, the extensive testing took place before syncing the > standalone implementation to JDK: JCK, sets of jaxws/b unit tests, > JPRT testing. > > Thank you for your comments and suggestions - we'll try to address > them and integrate during the next integration. About diamond > operator in MIMEMessage - not sure that we can put it there - > AFAIK the standalone JAXWS/B still supports JDK6 and we can't use > "diamonds" there. > > With Best Regards, > Aleksej > > On 04/10/2015 09:50 AM, huizhe wang wrote: > > Hi Aleksej, > > I assume the JAX-WS/JAXB standalone releases are well tested > for this integration, esp. the service finder code. > > I see a great number of "<>" to "<>" changes that was > suggested by Alan in the last integration. Besides that, you > may consider removing

    , using {@literal @} to replace > @, and the diamond operator in new expression in > MIMEMessage. Also, new > StringBuilder().append("META-INF/services/").append(jaxbContextFQCN).toString() > isn't any better than "META-INF/services/"+jaxbContextFQCN > since they'll be compiled into the same. > > None of the above should prevent you from pushing your changes. > > Cheers, > Joe > > On 4/8/2015 1:57 PM, Aleksej Efimov wrote: > > Hi, > Can I kindly ask for a review of this JAX-WS update? > > With Best Regards, > Aleksej > > On 04/03/2015 06:20 PM, Aleksej Efimov wrote: > > Hello, > > Can I have a review for a JDK9 bulk update of JAX-B/WS > from upstream projects. > Webrev: > More details in issue description: > https://bugs.openjdk.java.net/browse/JDK-8076549 > > Thank you, > Aleksej > > > > > > > > -- > > > Ot?vio Gon?alves de Santana > blog: http://otaviosantana.blogspot.com.br/ > twitter: http://twitter.com/otaviojava > site: _http://about.me/otaviojava_ > From Alan.Bateman at oracle.com Mon Apr 13 13:16:36 2015 From: Alan.Bateman at oracle.com (Alan Bateman) Date: Mon, 13 Apr 2015 14:16:36 +0100 Subject: RFR: 8076549: Update JAX-WS RI integration to latest version (2.2.11-b150402.1412) In-Reply-To: <552BBFC6.3010501@oracle.com> References: <551EAFDA.3020809@oracle.com> <5525962F.9060906@oracle.com> <552772A6.8050109@oracle.com> <5527A145.2050902@oracle.com> <552BBFC6.3010501@oracle.com> Message-ID: <552BC1B4.5030201@oracle.com> On 13/04/2015 14:08, Aleksej Efimov wrote: > Hi Ot?vio, > > Thank you for your remarks. Answers are in-lined below. In general - > standalone JAXWS/B still compatible with JDK6. > Can you double check this that this policy is continuing for JDK 9? That is, the upstream projects want to compile for 6, 7, 8 and 9. Once the module system goes into JDK 9 then I've no doubt that it need to make use of new APIs to work with modules. -Alan From sean.coffey at oracle.com Mon Apr 13 15:23:07 2015 From: sean.coffey at oracle.com (=?UTF-8?B?U2XDoW4gQ29mZmV5?=) Date: Mon, 13 Apr 2015 16:23:07 +0100 Subject: RFR (XXS) : 8050123: Incorrect property name documented in CORBA InputStream API In-Reply-To: <552775AA.1080202@oracle.com> References: <552681D5.9020605@oracle.com> <552775AA.1080202@oracle.com> Message-ID: <552BDF5B.9020202@oracle.com> JDK-8077395 tracking this request now. Thanks for logging bug Alan. Regards, Sean. On 10/04/15 08:03, Alan Bateman wrote: >> > This is JDK-specific and so shouldn't be in the constructor > specification. Can it be moved to an @implNote? From ivan.gerasimov at oracle.com Mon Apr 13 16:29:09 2015 From: ivan.gerasimov at oracle.com (Ivan Gerasimov) Date: Mon, 13 Apr 2015 19:29:09 +0300 Subject: RFR: 8077622: Add sources from jdk/src/jdk.deploy.osx/macosx/classes/ to unshuffle script Message-ID: <552BEED5.1080005@oracle.com> Hi! Preparing a backport to 8, I found that some files aren't properly mapped from 9 to 8. The following simple patch fixes the issue: --- a/common/bin/unshuffle_list.txt +++ b/common/bin/unshuffle_list.txt @@ -1294,6 +1294,9 @@ jdk/src/jdk.crypto.pkcs11/windows/native/libj2pkcs11/p11_md.c : jdk/src/windows/native/sun/security/pkcs11/wrapper/p11_md.c jdk/src/jdk.crypto.pkcs11/windows/native/libj2pkcs11/p11_md.h : jdk/src/windows/native/sun/security/pkcs11/wrapper/p11_md.h jdk/src/jdk.deploy.osx/macosx/classes/com/apple/concurrent/package.html : jdk/src/macosx/classes/com/apple/concurrent/package.html +jdk/src/jdk.deploy.osx/macosx/classes/apple/applescript : jdk/src/macosx/classes/apple/applescript +jdk/src/jdk.deploy.osx/macosx/classes/apple/security : jdk/src/macosx/classes/apple/security +jdk/src/jdk.deploy.osx/macosx/classes/com/apple/concurrent : jdk/src/macosx/classes/com/apple/concurrent jdk/src/jdk.deploy.osx/macosx/native/libapplescriptengine : jdk/src/macosx/native/apple/applescript jdk/src/jdk.deploy.osx/macosx/native/libosx/CFileManager.m : jdk/src/macosx/native/com/apple/eio/CFileManager.m jdk/src/jdk.deploy.osx/macosx/native/libosx/Dispatch.m : jdk/src/macosx/native/com/apple/concurrent/Dispatch.m Sincerely yours, Ivan From vladimir.x.ivanov at oracle.com Mon Apr 13 17:39:44 2015 From: vladimir.x.ivanov at oracle.com (Vladimir Ivanov) Date: Mon, 13 Apr 2015 20:39:44 +0300 Subject: [9] RFR (S): Class.getSimpleName() should work for non-JLS compliant class names In-Reply-To: <38AF71DB-944B-42B8-A955-C5173881BE63@oracle.com> References: <55254C1B.2040603@oracle.com> <5525E95F.7080306@oracle.com> <552691DA.7000604@oracle.com> <55270862.9020704@oracle.com> <38AF71DB-944B-42B8-A955-C5173881BE63@oracle.com> Message-ID: <552BFF60.40803@oracle.com> John, David, thanks for the feedback! What do you think about the following version: http://cr.openjdk.java.net/~vlivanov/8057919/webrev.02/jdk http://cr.openjdk.java.net/~vlivanov/8057919/webrev.02/hotspot Best regards, Vladimir Ivanov On 4/10/15 10:15 PM, John Rose wrote: > On Apr 9, 2015, at 4:16 PM, David Holmes > wrote: >> >> Hi Vladimir, >> >> On 10/04/2015 12:51 AM, Vladimir Ivanov wrote: >>> David, thanks for the feedback! >>> >>> Updated webrev: >>> http://cr.openjdk.java.net/~vlivanov/8057919/webrev.01/jdk >>> http://cr.openjdk.java.net/~vlivanov/8057919/webrev.01/hotspot >>> >>> I restored original logic and call into VM only if it fails. >> >> This change seems fine to me, but I think John may prefer to see >> getSimpleName implemented such that it always returns the name from >> the innerclass attribute. (Though perhaps with caching if performance >> is a concern?) > > Yes, I do prefer the new logic instead of a combination of old and new. > > Two concerns: Somebody somewhere might be relying on a bug in the old > logic and be frustrated by seeing that bug fixed. This is a fine line > to walk, but in this case I think the behavior change (if any) will show > up in places where we already have outages. Perhaps someone is > post-processing the result of getSimpleName to correct it. If so they > may no longer need to do that. > > Second, the new logic may itself have issues. A typical problem with > the InnerClasses attribute is it is broken or stripped, or a related > nestmate is missing. (See parallel thread in core-libs-dev on 8076264.) > But the proposed change takes effect after a call to > Class.getEnclosingClass, which uses > InstanceKlass::compute_enclosing_class_impl and accesses the same > InnerClasses record. > > This leads me to a comment: The common code (two uses > of InnerClassesIterator with klass_name_at_matches) should be factored > out. The factored subroutine should search out the self-record in the > InnerClasses attribute. The logic is tricky enough that I'm > uncomfortable with it being duplicated. Key issue: We don't want to > load any classes doing this lookup. > > (For bonus points, factor the third use in that file, the one that looks > not for self but for children-of-self. Add a boolean flag that varies > the test.) > > Bottom line: The new logic should replace the old. >> >>>>> The logic to compute simple name (Class.getSimpleName()) for >>>>> inner/nested/local classes is tightly coupled with Java naming scheme >>>>> and sometimes fails for classes generated from non-Java code. >>>> >>>> Meta-question: if this is non-Java code then what does/should >>>> "simpleName" even mean? "Returns the simple name of the underlying class >>>> as given in the source code." If there is no (java) source code does >>>> this have any meaning? Should it return "" ? >>> My reading of the JVMS is that InnerClasses attribute can be freely used >>> by non-Java compilers to store simple names for classes they generate. >>> The current wording for inner_name_index doesn't mention Java language. >> >> True, but it does refer to source code: "represents the original >> simple name of C, as given in the source code from which this class >> file was compiled. " which seems misplaced as we're discussing classes >> for which there is no source code as such. > > It could be non-Java source code. In any case, the indicated component > of the "binary name" of the class is well-defined, whether or not it > occurs in source code. Note also that classes might be generated by ASM > (no source code per se) but we still have a reasonable expectation of > reflecting on them, even though reflection is (mostly) defined in terms > of source code constructs. > >> Anyway it just flags to me that perhaps these Class methods need to be >> generalized a bit given the support for non-Java languages on the JVM. >> But that's for core-libs folk to decide. > > Yes, I think that's the issue. The multi-language folks (like me) would > be disappointed to hear that we decided that non-Java languages don't > have any needs here; they do. > > Thanks, > ? John > >> Thanks, >> David >> >>> Best regards, >>> Vladimir Ivanov >>> >>>>> Instead of parsing class name and try to extract simple name based on >>>>> JLS rules, the fix I propose is to use InnerClasses attribute from the >>>>> class file. Simple name is already recorded there. >>>> > >>>>> JVMS-4.7.6: The InnerClasses Attribute >>>>> "inner_name_index: If C is anonymous (JLS ?15.9.5), the value of the >>>>> inner_name_index item must be zero. Otherwise, the value of the >>>>> inner_name_index item must be a valid index into the constant_pool >>>>> table, and the entry at that index must be a CONSTANT_Utf8_info >>>>> structure (?4.4.7) that represents the original simple name of C, as >>>>> given in the source code from which this class file was compiled." >>>>> >>>>> Since I consider backporting the fix into 8u60, I'd like to hear >>>>> opinions about backward compatibility of such change. >>>>> >>>>> As an alternative solution, I can restore original logic and consult >>>>> InnerClasses attribute when class name parsing logic fails. >>>> >>>> I think I'd prefer to see the VM call only used as a fallback if the >>>> regular parsing fails. That would prevent any compatibility issues for >>>> the 8u backport (ignoring tests that deliberately generate invalidly >>>> named classes). >>>> >>>> Thanks, >>>> David >>>> >>>>> Testing: regression test, jck-runtime/java_lang, jdk/test/java/lang/ >>>>> >>>>> Thanks! >>>>> >>>>> Best regards, >>>>> Vladimir Ivanov > From chris.hegarty at oracle.com Mon Apr 13 17:52:31 2015 From: chris.hegarty at oracle.com (Chris Hegarty) Date: Mon, 13 Apr 2015 18:52:31 +0100 Subject: RFR: 8077622: Add sources from jdk/src/jdk.deploy.osx/macosx/classes/ to unshuffle script In-Reply-To: <552BEED5.1080005@oracle.com> References: <552BEED5.1080005@oracle.com> Message-ID: <41094C65-90DD-4D47-B539-0353D4BD4ED7@oracle.com> On 13 Apr 2015, at 17:29, Ivan Gerasimov wrote: > Hi! > > Preparing a backport to 8, I found that some files aren't properly mapped from 9 to 8. Thank you for updating this list. The change looks good to me. -Chris. > The following simple patch fixes the issue: > > --- a/common/bin/unshuffle_list.txt > +++ b/common/bin/unshuffle_list.txt > @@ -1294,6 +1294,9 @@ > jdk/src/jdk.crypto.pkcs11/windows/native/libj2pkcs11/p11_md.c : jdk/src/windows/native/sun/security/pkcs11/wrapper/p11_md.c > jdk/src/jdk.crypto.pkcs11/windows/native/libj2pkcs11/p11_md.h : jdk/src/windows/native/sun/security/pkcs11/wrapper/p11_md.h > jdk/src/jdk.deploy.osx/macosx/classes/com/apple/concurrent/package.html : jdk/src/macosx/classes/com/apple/concurrent/package.html > +jdk/src/jdk.deploy.osx/macosx/classes/apple/applescript : jdk/src/macosx/classes/apple/applescript > +jdk/src/jdk.deploy.osx/macosx/classes/apple/security : jdk/src/macosx/classes/apple/security > +jdk/src/jdk.deploy.osx/macosx/classes/com/apple/concurrent : jdk/src/macosx/classes/com/apple/concurrent > jdk/src/jdk.deploy.osx/macosx/native/libapplescriptengine : jdk/src/macosx/native/apple/applescript > jdk/src/jdk.deploy.osx/macosx/native/libosx/CFileManager.m : jdk/src/macosx/native/com/apple/eio/CFileManager.m > jdk/src/jdk.deploy.osx/macosx/native/libosx/Dispatch.m : jdk/src/macosx/native/com/apple/concurrent/Dispatch.m > > > Sincerely yours, > Ivan From huizhe.wang at oracle.com Mon Apr 13 18:19:46 2015 From: huizhe.wang at oracle.com (huizhe wang) Date: Mon, 13 Apr 2015 11:19:46 -0700 Subject: RFR [9] 8077332: tidy warnings from javax/xml In-Reply-To: <552BABBA.6050903@oracle.com> References: <5527F132.80408@oracle.com> <552815F4.4050005@oracle.com> <552BA6FD.5000706@oracle.com> <552BABBA.6050903@oracle.com> Message-ID: <552C08C2.4030503@oracle.com> On 4/13/2015 4:42 AM, Alan Bateman wrote: > On 13/04/2015 12:22, alexander stepanov wrote: >> Hello Joe, >> >> Thank you for the notes; >> >> > Copyright year shall not be changed. >> >> That seems to be a bit controversial point; sometimes (while cleaning >> docs) I was asked to do that, other times - not to do that. Our >> internal policy seemingly assigns to change the 2nd date every time >> the sources were touched (but that may be a question of ambiguous >> interpretation). >> >> But of course I can easily revert these changes if you're totally >> sure it should be done. >> > This has always been confusing. Some areas insist on updating the > copyright dates, others don't. AFAIK, it has always been optional. I > think the original assumption was that the update_copyright_year > script (in the top-level repo) be run periodically to do bulk updates. > Unfortunately that script doesn't seem to be run very often now and > this strengthens the case to update the dates on a continuous basis. I > have not come across the argument that html tidy tasks that don't > change the javadoc should not update the copyright date. The general > topic probably should move to jdk9-dev and get this decided once and > documented in the developer guide. I think the key question to ask is: is this the code I can claim Copyright with? To me, format, code style, html tags and other minor changes, these are not code changes one can claim copyright with. The date of a Copyright establishes how far back the claim is made. In case where the work is substantially revised, a new Copyright claim is established, which is what the 2nd year is about. In this case, esp. for the JAXP API (e.g. javax.xml.datatype), I'd like to see the years maintained because those are the years the API was designed and modified. The "tidy warnings" change did not change the API. -Joe > > -Alan From john.r.rose at oracle.com Mon Apr 13 19:12:06 2015 From: john.r.rose at oracle.com (John Rose) Date: Mon, 13 Apr 2015 12:12:06 -0700 Subject: [9] RFR (S): Class.getSimpleName() should work for non-JLS compliant class names In-Reply-To: <552BFF60.40803@oracle.com> References: <55254C1B.2040603@oracle.com> <5525E95F.7080306@oracle.com> <552691DA.7000604@oracle.com> <55270862.9020704@oracle.com> <38AF71DB-944B-42B8-A955-C5173881BE63@oracle.com> <552BFF60.40803@oracle.com> Message-ID: <2888111C-0A1B-4C27-81D4-2E377AE9E63E@oracle.com> It's good. Nice cleanup. ? John On Apr 13, 2015, at 10:39 AM, Vladimir Ivanov wrote: > > John, David, thanks for the feedback! > > What do you think about the following version: > http://cr.openjdk.java.net/~vlivanov/8057919/webrev.02/jdk > http://cr.openjdk.java.net/~vlivanov/8057919/webrev.02/hotspot > > Best regards, > Vladimir Ivanov From martinrb at google.com Mon Apr 13 19:34:40 2015 From: martinrb at google.com (Martin Buchholz) Date: Mon, 13 Apr 2015 12:34:40 -0700 Subject: RFR 9: 8077350 Process API Updates Implementation Review In-Reply-To: <5529644A.8020405@Oracle.com> References: <5526DA4A.6030808@Oracle.com> <5529644A.8020405@Oracle.com> Message-ID: On Sat, Apr 11, 2015 at 11:13 AM, Roger Riggs wrote: > Hi Martin, > > Thanks for the review. > > On 4/11/2015 1:37 AM, Martin Buchholz wrote: > > Thanks for the huge effort. I did a superficial review and it seems > pretty good. Of course, changing the Process good is high risk and some > things will probably need fixup later. > > On Unix, you seem to be identifying ProcessHandles by their pid. What > are you going to do about the problem of misidentifying Unix processes > whose pid got recycled? If you spin up a thread to call waitpid as soon as > you create the ProcessHandle, the window is very short (and OSes avoid > recycling pids immediately) so that's pretty safe, but it wastes a thread > for each ProcessHandle! I don't have a good answer. Maybe record the > start time of the process, where available? > > Getting the basic API and implementation in has taken too long, so I'm > looking to get it general agreement > and pushed and then I'd be happy to go back and include the start time in > ProcessHandle. > In the case of children() which already has to read /proc/pid/stat for the > parent, > the start time is inexpensively available also. The spec for equals(), > and compareTo is straightforward > without the start time. With the start time, either starttime has be > exposed in the API/spec or > be left 'implementation' dependent which is a poor spec. > Only in the case of allProcesses() would the overhead increase > significantly, it currently > does not need to open /proc/pid for every process. > We have ancient "recycle pid" bugs and unavoidable races (kill(2) is fundamentally racy). // There is a risk that pid will be recycled, causing us to // kill the wrong process! So we only terminate processes // that appear to still be running. Even with this check, // there is an unavoidable race condition here, but the window // is very small, and OSes try hard to not recycle pids too // soon, so this is quite safe. but in practice, we can assume that there will be a significant time gap between reuses of the same pid, and so a check-then-act race will not result in bad behavior, but you can't allow arbitrary time to elapse and assume you're still dealing with the same process. > Siginfo is only used with waitid as an output argument > > Yes, my mistake. > > It seems you don't support sending arbitary signals, which is a little sad. > > I had not investigated any potential negative and unknowable effects of > being able to send arbitrary signals. > The implementation is easy to generalize, though it does not map to > Windows well/at all. > Would you propose it as an 'int' argument with no limitation? or what > limits? > I think it would be an additional method, the current > destory/destroyForcibly. > > The portable nature of Java has always hindered progress in functionality in this area. I haven't investigated in detail, but perl/emacs/python/tcl-expect manage to achieve cross-platform functionality, perhaps by degraded functionality on windows. I very much do __not__ expect it to happen, but my wish would be to be able to reimplement emacs in 100% java, including all the subprocess and pseudo-terminal support required for: http://www.gnu.org/software/emacs/manual/html_node/elisp/Processes.html From john.r.rose at oracle.com Mon Apr 13 19:38:55 2015 From: john.r.rose at oracle.com (John Rose) Date: Mon, 13 Apr 2015 12:38:55 -0700 Subject: RFR (S): 8076461: JSR292: remove unused native and constants In-Reply-To: <3083F107-6D99-4C4F-948C-9326C0E843CE@oracle.com> References: <4EB3C4DA-C382-4795-A676-6147E863DFF1@oracle.com> <3083F107-6D99-4C4F-948C-9326C0E843CE@oracle.com> Message-ID: <0C16CFAC-EFD5-41E8-840E-3421FA96F3E8@oracle.com> That's much better; thanks. Glad to hear the verifyC's still works. The MN_* constants are a private interface between C++ and Java code. Those are the most important to verify. You can get rid of these lines; we don't look at vtable indexes any more: // The JVM uses values of -2 and above for vtable indexes. // Field values are simple positive offsets. // Ref: src/share/vm/oops/methodOop.hpp // This value is negative enough to avoid such numbers, // but not too negative. The other constants are publicly defined in various standards docs (except T_ILLEGAL). I don't think these constants are used any more, except the MN_* and REF_* ones. (The REF_* ones are in the JVM standard, so are in some sense pre-verified.) I suggest also removing the ACC_*, T_*, and CONSTANT_* names, if you can. We probably stopped using any of those when we started using ASM. Thanks! ? John On Apr 13, 2015, at 4:40 AM, Michael Haupt wrote: > > Hi John, > > thank you very much for your review; keeping the Constants class around for VM/JDK constant value agreement certainly makes sense. I have undone most of the removal work and verified in a slowdebug build that MHN.verifyConstants() works. I've also added a comment on the Constants class to clarify its role a bit. Local tests and JPRT are still happy with this. > > Updated webrev: http://cr.openjdk.java.net/~mhaupt/8076461/webrev.01/ > > Best, > > Michael > >> Am 07.04.2015 um 23:49 schrieb John Rose : >> >> On Apr 7, 2015, at 12:11 PM, Michael Haupt wrote: >>> >>> Dear all, >>> >>> please review and sponsor this change. Cross-posted to hs-comp and core-lib as this is at the JVM/libraries boundary. This is a straightforward refactoring change that removes many constants and unused API from MHNatives, and places some constants used only in MemberName in that class. >> >> The class MethodHandleNatives.Constants exists to enumerate and cross-check any constants which the JVM and JDK code need to agree about. Removing a constant from MethodHandleNatives.Constants (moving to MemberName) may cause failures when MHN.verifyConstants is run (via "java -esa" on a debug build of Java). If there are no failures, I wonder what would happen if the JVM and JDK got out of sync. in their notion of the value of a constant like MN_CALLER_SENSITIVE. It's important that some part of our release testing detect if MN_CALLER_SENSITIVE (etc.) gets out of sync. >> >> If there is some reason why this testing is no longer needed, I'd like to see the whole Constants class go away, since that's all it's really good for. But I don't see that reason yet, and moving the constants somewhere either will cause a test failure, or *should* cause a test failure. >> >> I'm happy to see the "GC" guys go away. They were artifacts of a quickly moving 292 implementation that spanned two repositories with unsynchronized change streams. >> >> ? John >> >>> >>> RFE: https://bugs.openjdk.java.net/browse/JDK-8076461 >>> Changes: http://cr.openjdk.java.net/~mhaupt/8076461/webrev.00/ >>> >>> Tested with JPRT, HotSpot testset. >>> >>> Thanks, >>> >>> Michael > > > -- > > > Dr. Michael Haupt | Principal Member of Technical Staff > Phone: +49 331 200 7277 | Fax: +49 331 200 7561 > Oracle Java Platform Group | HotSpot Compiler Team > Oracle Deutschland B.V. & Co. KG, Schiffbauergasse 14 | 14467 Potsdam, Germany > Oracle is committed to developing practices and products that help protect the environment > From brent.christian at oracle.com Mon Apr 13 22:49:28 2015 From: brent.christian at oracle.com (Brent Christian) Date: Mon, 13 Apr 2015 15:49:28 -0700 Subject: RFR 9: 8048264 : StringBuffer's codePoint methods throw unspecified IndexOutOfBoundsException Message-ID: <552C47F8.2050303@oracle.com> Hello, Please review this small javadoc change. It was discovered that some codePoint-related methods in StringBuffer are missing documentation for throwing IndexOutOfBoundsException. The methods are: codePointAt(int) codePointBefore(int) codePointCount(int,int) offsetByCodePoints(int,int) The StringBuilder JavaDoc does have @throws tags for those methods. Bug: https://bugs.openjdk.java.net/browse/JDK-8048264 Webrev+specdiff: http://cr.openjdk.java.net/~bchristi/8048264/webrev.0/ Thanks, -Brent From lance.andersen at oracle.com Mon Apr 13 22:53:32 2015 From: lance.andersen at oracle.com (Lance @ Oracle) Date: Mon, 13 Apr 2015 18:53:32 -0400 Subject: RFR 9: 8048264 : StringBuffer's codePoint methods throw unspecified IndexOutOfBoundsException In-Reply-To: <552C47F8.2050303@oracle.com> References: <552C47F8.2050303@oracle.com> Message-ID: Hi Brent, This looks fine You might need to fast track a CCC request even though this is minor Best Lance Lance Andersen| Principal Member of Technical Staff | +1.781.442.2037 Oracle Java Engineering 1 Network Drive Burlington, MA 01803 Lance.Andersen at oracle.com Sent from my iPad > On Apr 13, 2015, at 6:49 PM, Brent Christian wrote: > > Hello, > > Please review this small javadoc change. > > It was discovered that some codePoint-related methods in StringBuffer are missing documentation for throwing IndexOutOfBoundsException. The methods are: > > codePointAt(int) > codePointBefore(int) > codePointCount(int,int) > offsetByCodePoints(int,int) > > The StringBuilder JavaDoc does have @throws tags for those methods. > > Bug: > https://bugs.openjdk.java.net/browse/JDK-8048264 > Webrev+specdiff: > http://cr.openjdk.java.net/~bchristi/8048264/webrev.0/ > > Thanks, > -Brent From brent.christian at oracle.com Mon Apr 13 22:55:30 2015 From: brent.christian at oracle.com (Brent Christian) Date: Mon, 13 Apr 2015 15:55:30 -0700 Subject: RFR 9: 8048264 : StringBuffer's codePoint methods throw unspecified IndexOutOfBoundsException In-Reply-To: References: <552C47F8.2050303@oracle.com> Message-ID: <552C4962.8020704@oracle.com> Thanks, Lance. My next stop is the CCC. :) -Brent On 4/13/15 3:53 PM, Lance @ Oracle wrote: > Hi Brent, > > This looks fine > > You might need to fast track a CCC request even though this is minor > > Best > Lance > > > Lance Andersen| > Principal Member of Technical Staff | +1.781.442.2037 > Oracle Java Engineering > 1 Network Drive > Burlington, MA 01803 > Lance.Andersen at oracle.com > Sent from my iPad > > On Apr 13, 2015, at 6:49 PM, Brent Christian > wrote: > >> Hello, >> >> Please review this small javadoc change. >> >> It was discovered that some codePoint-related methods in StringBuffer >> are missing documentation for throwing IndexOutOfBoundsException. The >> methods are: >> >> codePointAt(int) >> codePointBefore(int) >> codePointCount(int,int) >> offsetByCodePoints(int,int) >> >> The StringBuilder JavaDoc does have @throws tags for those methods. >> >> Bug: >> https://bugs.openjdk.java.net/browse/JDK-8048264 >> Webrev+specdiff: >> http://cr.openjdk.java.net/~bchristi/8048264/webrev.0/ >> >> Thanks, >> -Brent From lance.andersen at oracle.com Mon Apr 13 23:13:27 2015 From: lance.andersen at oracle.com (Lance @ Oracle) Date: Mon, 13 Apr 2015 19:13:27 -0400 Subject: RFR 9: 8048264 : StringBuffer's codePoint methods throw unspecified IndexOutOfBoundsException In-Reply-To: <552C4962.8020704@oracle.com> References: <552C47F8.2050303@oracle.com> <552C4962.8020704@oracle.com> Message-ID: Let me know and I will add myself as a reviewer Best Lance Lance Andersen| Principal Member of Technical Staff | +1.781.442.2037 Oracle Java Engineering 1 Network Drive Burlington, MA 01803 Lance.Andersen at oracle.com Sent from my iPad > On Apr 13, 2015, at 6:55 PM, Brent Christian wrote: > > Thanks, Lance. My next stop is the CCC. :) > > -Brent > >> On 4/13/15 3:53 PM, Lance @ Oracle wrote: >> Hi Brent, >> >> This looks fine >> >> You might need to fast track a CCC request even though this is minor >> >> Best >> Lance >> >> >> Lance Andersen| >> Principal Member of Technical Staff | +1.781.442.2037 >> Oracle Java Engineering >> 1 Network Drive >> Burlington, MA 01803 >> Lance.Andersen at oracle.com >> Sent from my iPad >> >> On Apr 13, 2015, at 6:49 PM, Brent Christian > > wrote: >> >>> Hello, >>> >>> Please review this small javadoc change. >>> >>> It was discovered that some codePoint-related methods in StringBuffer >>> are missing documentation for throwing IndexOutOfBoundsException. The >>> methods are: >>> >>> codePointAt(int) >>> codePointBefore(int) >>> codePointCount(int,int) >>> offsetByCodePoints(int,int) >>> >>> The StringBuilder JavaDoc does have @throws tags for those methods. >>> >>> Bug: >>> https://bugs.openjdk.java.net/browse/JDK-8048264 >>> Webrev+specdiff: >>> http://cr.openjdk.java.net/~bchristi/8048264/webrev.0/ >>> >>> Thanks, >>> -Brent From david.holmes at oracle.com Tue Apr 14 00:47:03 2015 From: david.holmes at oracle.com (David Holmes) Date: Tue, 14 Apr 2015 10:47:03 +1000 Subject: [9] RFR (S): Class.getSimpleName() should work for non-JLS compliant class names In-Reply-To: <552BFF60.40803@oracle.com> References: <55254C1B.2040603@oracle.com> <5525E95F.7080306@oracle.com> <552691DA.7000604@oracle.com> <55270862.9020704@oracle.com> <38AF71DB-944B-42B8-A955-C5173881BE63@oracle.com> <552BFF60.40803@oracle.com> Message-ID: <552C6387.20908@oracle.com> On 14/04/2015 3:39 AM, Vladimir Ivanov wrote: > John, David, thanks for the feedback! > > What do you think about the following version: > http://cr.openjdk.java.net/~vlivanov/8057919/webrev.02/jdk > http://cr.openjdk.java.net/~vlivanov/8057919/webrev.02/hotspot Looks good - thanks. David > Best regards, > Vladimir Ivanov > > On 4/10/15 10:15 PM, John Rose wrote: >> On Apr 9, 2015, at 4:16 PM, David Holmes > > wrote: >>> >>> Hi Vladimir, >>> >>> On 10/04/2015 12:51 AM, Vladimir Ivanov wrote: >>>> David, thanks for the feedback! >>>> >>>> Updated webrev: >>>> http://cr.openjdk.java.net/~vlivanov/8057919/webrev.01/jdk >>>> http://cr.openjdk.java.net/~vlivanov/8057919/webrev.01/hotspot >>>> >>>> I restored original logic and call into VM only if it fails. >>> >>> This change seems fine to me, but I think John may prefer to see >>> getSimpleName implemented such that it always returns the name from >>> the innerclass attribute. (Though perhaps with caching if performance >>> is a concern?) >> >> Yes, I do prefer the new logic instead of a combination of old and new. >> >> Two concerns: Somebody somewhere might be relying on a bug in the old >> logic and be frustrated by seeing that bug fixed. This is a fine line >> to walk, but in this case I think the behavior change (if any) will show >> up in places where we already have outages. Perhaps someone is >> post-processing the result of getSimpleName to correct it. If so they >> may no longer need to do that. >> >> Second, the new logic may itself have issues. A typical problem with >> the InnerClasses attribute is it is broken or stripped, or a related >> nestmate is missing. (See parallel thread in core-libs-dev on 8076264.) >> But the proposed change takes effect after a call to >> Class.getEnclosingClass, which uses >> InstanceKlass::compute_enclosing_class_impl and accesses the same >> InnerClasses record. >> >> This leads me to a comment: The common code (two uses >> of InnerClassesIterator with klass_name_at_matches) should be factored >> out. The factored subroutine should search out the self-record in the >> InnerClasses attribute. The logic is tricky enough that I'm >> uncomfortable with it being duplicated. Key issue: We don't want to >> load any classes doing this lookup. >> >> (For bonus points, factor the third use in that file, the one that looks >> not for self but for children-of-self. Add a boolean flag that varies >> the test.) >> >> Bottom line: The new logic should replace the old. >>> >>>>>> The logic to compute simple name (Class.getSimpleName()) for >>>>>> inner/nested/local classes is tightly coupled with Java naming scheme >>>>>> and sometimes fails for classes generated from non-Java code. >>>>> >>>>> Meta-question: if this is non-Java code then what does/should >>>>> "simpleName" even mean? "Returns the simple name of the underlying >>>>> class >>>>> as given in the source code." If there is no (java) source code does >>>>> this have any meaning? Should it return "" ? >>>> My reading of the JVMS is that InnerClasses attribute can be freely >>>> used >>>> by non-Java compilers to store simple names for classes they generate. >>>> The current wording for inner_name_index doesn't mention Java language. >>> >>> True, but it does refer to source code: "represents the original >>> simple name of C, as given in the source code from which this class >>> file was compiled. " which seems misplaced as we're discussing classes >>> for which there is no source code as such. >> >> It could be non-Java source code. In any case, the indicated component >> of the "binary name" of the class is well-defined, whether or not it >> occurs in source code. Note also that classes might be generated by ASM >> (no source code per se) but we still have a reasonable expectation of >> reflecting on them, even though reflection is (mostly) defined in terms >> of source code constructs. >> >>> Anyway it just flags to me that perhaps these Class methods need to be >>> generalized a bit given the support for non-Java languages on the JVM. >>> But that's for core-libs folk to decide. >> >> Yes, I think that's the issue. The multi-language folks (like me) would >> be disappointed to hear that we decided that non-Java languages don't >> have any needs here; they do. >> >> Thanks, >> ? John >> >>> Thanks, >>> David >>> >>>> Best regards, >>>> Vladimir Ivanov >>>> >>>>>> Instead of parsing class name and try to extract simple name based on >>>>>> JLS rules, the fix I propose is to use InnerClasses attribute from >>>>>> the >>>>>> class file. Simple name is already recorded there. >>>>> > >>>>>> JVMS-4.7.6: The InnerClasses Attribute >>>>>> "inner_name_index: If C is anonymous (JLS ?15.9.5), the value of the >>>>>> inner_name_index item must be zero. Otherwise, the value of the >>>>>> inner_name_index item must be a valid index into the constant_pool >>>>>> table, and the entry at that index must be a CONSTANT_Utf8_info >>>>>> structure (?4.4.7) that represents the original simple name of C, as >>>>>> given in the source code from which this class file was compiled." >>>>>> >>>>>> Since I consider backporting the fix into 8u60, I'd like to hear >>>>>> opinions about backward compatibility of such change. >>>>>> >>>>>> As an alternative solution, I can restore original logic and consult >>>>>> InnerClasses attribute when class name parsing logic fails. >>>>> >>>>> I think I'd prefer to see the VM call only used as a fallback if the >>>>> regular parsing fails. That would prevent any compatibility issues for >>>>> the 8u backport (ignoring tests that deliberately generate invalidly >>>>> named classes). >>>>> >>>>> Thanks, >>>>> David >>>>> >>>>>> Testing: regression test, jck-runtime/java_lang, jdk/test/java/lang/ >>>>>> >>>>>> Thanks! >>>>>> >>>>>> Best regards, >>>>>> Vladimir Ivanov >> From david.holmes at oracle.com Tue Apr 14 00:55:55 2015 From: david.holmes at oracle.com (David Holmes) Date: Tue, 14 Apr 2015 10:55:55 +1000 Subject: RFR 9: 8048264 : StringBuffer's codePoint methods throw unspecified IndexOutOfBoundsException In-Reply-To: <552C47F8.2050303@oracle.com> References: <552C47F8.2050303@oracle.com> Message-ID: <552C659B.7020807@oracle.com> On 14/04/2015 8:49 AM, Brent Christian wrote: > Hello, > > Please review this small javadoc change. > > It was discovered that some codePoint-related methods in StringBuffer > are missing documentation for throwing IndexOutOfBoundsException. The > methods are: > > codePointAt(int) > codePointBefore(int) > codePointCount(int,int) > offsetByCodePoints(int,int) > > The StringBuilder JavaDoc does have @throws tags for those methods. Not that you need another review but Reviewed :) I really just wanted to add that I'm surprised that after all this time of having to deal with the complexity of javadoc inheritance rules, that we don't have anything to assist with detecting these omissions, as it is so easy to forget to redeclare unchecked exceptions. :( David > Bug: > https://bugs.openjdk.java.net/browse/JDK-8048264 > Webrev+specdiff: > http://cr.openjdk.java.net/~bchristi/8048264/webrev.0/ > > Thanks, > -Brent From Alan.Bateman at oracle.com Tue Apr 14 07:10:45 2015 From: Alan.Bateman at oracle.com (Alan Bateman) Date: Tue, 14 Apr 2015 08:10:45 +0100 Subject: RFR 9: 8048264 : StringBuffer's codePoint methods throw unspecified IndexOutOfBoundsException In-Reply-To: <552C47F8.2050303@oracle.com> References: <552C47F8.2050303@oracle.com> Message-ID: <552CBD75.3050209@oracle.com> On 13/04/2015 23:49, Brent Christian wrote: > Hello, > > Please review this small javadoc change. > > It was discovered that some codePoint-related methods in StringBuffer > are missing documentation for throwing IndexOutOfBoundsException. The > methods are: > > codePointAt(int) > codePointBefore(int) > codePointCount(int,int) > offsetByCodePoints(int,int) > > The StringBuilder JavaDoc does have @throws tags for those methods. This looks okay. Do you have cycles to check if there are any more of these? It seems that every few years we find more cases where we have missed the inheritDoc. -Alan From vladimir.x.ivanov at oracle.com Tue Apr 14 10:59:53 2015 From: vladimir.x.ivanov at oracle.com (Vladimir Ivanov) Date: Tue, 14 Apr 2015 13:59:53 +0300 Subject: [9] RFR (S): Class.getSimpleName() should work for non-JLS compliant class names In-Reply-To: <552C6387.20908@oracle.com> References: <55254C1B.2040603@oracle.com> <5525E95F.7080306@oracle.com> <552691DA.7000604@oracle.com> <55270862.9020704@oracle.com> <38AF71DB-944B-42B8-A955-C5173881BE63@oracle.com> <552BFF60.40803@oracle.com> <552C6387.20908@oracle.com> Message-ID: <552CF329.2070000@oracle.com> David, John, thanks for review! Best regards, Vladimir Ivanov On 4/14/15 3:47 AM, David Holmes wrote: > On 14/04/2015 3:39 AM, Vladimir Ivanov wrote: >> John, David, thanks for the feedback! >> >> What do you think about the following version: >> http://cr.openjdk.java.net/~vlivanov/8057919/webrev.02/jdk >> http://cr.openjdk.java.net/~vlivanov/8057919/webrev.02/hotspot > > Looks good - thanks. > > David > >> Best regards, >> Vladimir Ivanov >> >> On 4/10/15 10:15 PM, John Rose wrote: >>> On Apr 9, 2015, at 4:16 PM, David Holmes >> > wrote: >>>> >>>> Hi Vladimir, >>>> >>>> On 10/04/2015 12:51 AM, Vladimir Ivanov wrote: >>>>> David, thanks for the feedback! >>>>> >>>>> Updated webrev: >>>>> http://cr.openjdk.java.net/~vlivanov/8057919/webrev.01/jdk >>>>> http://cr.openjdk.java.net/~vlivanov/8057919/webrev.01/hotspot >>>>> >>>>> I restored original logic and call into VM only if it fails. >>>> >>>> This change seems fine to me, but I think John may prefer to see >>>> getSimpleName implemented such that it always returns the name from >>>> the innerclass attribute. (Though perhaps with caching if performance >>>> is a concern?) >>> >>> Yes, I do prefer the new logic instead of a combination of old and new. >>> >>> Two concerns: Somebody somewhere might be relying on a bug in the old >>> logic and be frustrated by seeing that bug fixed. This is a fine line >>> to walk, but in this case I think the behavior change (if any) will show >>> up in places where we already have outages. Perhaps someone is >>> post-processing the result of getSimpleName to correct it. If so they >>> may no longer need to do that. >>> >>> Second, the new logic may itself have issues. A typical problem with >>> the InnerClasses attribute is it is broken or stripped, or a related >>> nestmate is missing. (See parallel thread in core-libs-dev on 8076264.) >>> But the proposed change takes effect after a call to >>> Class.getEnclosingClass, which uses >>> InstanceKlass::compute_enclosing_class_impl and accesses the same >>> InnerClasses record. >>> >>> This leads me to a comment: The common code (two uses >>> of InnerClassesIterator with klass_name_at_matches) should be factored >>> out. The factored subroutine should search out the self-record in the >>> InnerClasses attribute. The logic is tricky enough that I'm >>> uncomfortable with it being duplicated. Key issue: We don't want to >>> load any classes doing this lookup. >>> >>> (For bonus points, factor the third use in that file, the one that looks >>> not for self but for children-of-self. Add a boolean flag that varies >>> the test.) >>> >>> Bottom line: The new logic should replace the old. >>>> >>>>>>> The logic to compute simple name (Class.getSimpleName()) for >>>>>>> inner/nested/local classes is tightly coupled with Java naming >>>>>>> scheme >>>>>>> and sometimes fails for classes generated from non-Java code. >>>>>> >>>>>> Meta-question: if this is non-Java code then what does/should >>>>>> "simpleName" even mean? "Returns the simple name of the underlying >>>>>> class >>>>>> as given in the source code." If there is no (java) source code does >>>>>> this have any meaning? Should it return "" ? >>>>> My reading of the JVMS is that InnerClasses attribute can be freely >>>>> used >>>>> by non-Java compilers to store simple names for classes they generate. >>>>> The current wording for inner_name_index doesn't mention Java >>>>> language. >>>> >>>> True, but it does refer to source code: "represents the original >>>> simple name of C, as given in the source code from which this class >>>> file was compiled. " which seems misplaced as we're discussing classes >>>> for which there is no source code as such. >>> >>> It could be non-Java source code. In any case, the indicated component >>> of the "binary name" of the class is well-defined, whether or not it >>> occurs in source code. Note also that classes might be generated by ASM >>> (no source code per se) but we still have a reasonable expectation of >>> reflecting on them, even though reflection is (mostly) defined in terms >>> of source code constructs. >>> >>>> Anyway it just flags to me that perhaps these Class methods need to be >>>> generalized a bit given the support for non-Java languages on the JVM. >>>> But that's for core-libs folk to decide. >>> >>> Yes, I think that's the issue. The multi-language folks (like me) would >>> be disappointed to hear that we decided that non-Java languages don't >>> have any needs here; they do. >>> >>> Thanks, >>> ? John >>> >>>> Thanks, >>>> David >>>> >>>>> Best regards, >>>>> Vladimir Ivanov >>>>> >>>>>>> Instead of parsing class name and try to extract simple name >>>>>>> based on >>>>>>> JLS rules, the fix I propose is to use InnerClasses attribute from >>>>>>> the >>>>>>> class file. Simple name is already recorded there. >>>>>> > >>>>>>> JVMS-4.7.6: The InnerClasses Attribute >>>>>>> "inner_name_index: If C is anonymous (JLS ?15.9.5), the value of the >>>>>>> inner_name_index item must be zero. Otherwise, the value of the >>>>>>> inner_name_index item must be a valid index into the constant_pool >>>>>>> table, and the entry at that index must be a CONSTANT_Utf8_info >>>>>>> structure (?4.4.7) that represents the original simple name of C, as >>>>>>> given in the source code from which this class file was compiled." >>>>>>> >>>>>>> Since I consider backporting the fix into 8u60, I'd like to hear >>>>>>> opinions about backward compatibility of such change. >>>>>>> >>>>>>> As an alternative solution, I can restore original logic and consult >>>>>>> InnerClasses attribute when class name parsing logic fails. >>>>>> >>>>>> I think I'd prefer to see the VM call only used as a fallback if the >>>>>> regular parsing fails. That would prevent any compatibility issues >>>>>> for >>>>>> the 8u backport (ignoring tests that deliberately generate invalidly >>>>>> named classes). >>>>>> >>>>>> Thanks, >>>>>> David >>>>>> >>>>>>> Testing: regression test, jck-runtime/java_lang, jdk/test/java/lang/ >>>>>>> >>>>>>> Thanks! >>>>>>> >>>>>>> Best regards, >>>>>>> Vladimir Ivanov >>> From michael.haupt at oracle.com Tue Apr 14 11:33:42 2015 From: michael.haupt at oracle.com (Michael Haupt) Date: Tue, 14 Apr 2015 13:33:42 +0200 Subject: RFR (S): 8076461: JSR292: remove unused native and constants In-Reply-To: <0C16CFAC-EFD5-41E8-840E-3421FA96F3E8@oracle.com> References: <4EB3C4DA-C382-4795-A676-6147E863DFF1@oracle.com> <3083F107-6D99-4C4F-948C-9326C0E843CE@oracle.com> <0C16CFAC-EFD5-41E8-840E-3421FA96F3E8@oracle.com> Message-ID: <46742670-8A71-4026-8ED5-25BE82DD2698@oracle.com> Hi John, thanks again; I've applied your suggestions, re-tested as before and uploaded the revision to http://cr.openjdk.java.net/~mhaupt/8076461/webrev.02/. Best, Michael > Am 13.04.2015 um 21:38 schrieb John Rose : > > That's much better; thanks. Glad to hear the verifyC's still works. > > The MN_* constants are a private interface between C++ and Java code. Those are the most important to verify. > > You can get rid of these lines; we don't look at vtable indexes any more: > // The JVM uses values of -2 and above for vtable indexes. > // Field values are simple positive offsets. > // Ref: src/share/vm/oops/methodOop.hpp > // This value is negative enough to avoid such numbers, > // but not too negative. > > The other constants are publicly defined in various standards docs (except T_ILLEGAL). > > I don't think these constants are used any more, except the MN_* and REF_* ones. (The REF_* ones are in the JVM standard, so are in some sense pre-verified.) > > I suggest also removing the ACC_*, T_*, and CONSTANT_* names, if you can. We probably stopped using any of those when we started using ASM. > > Thanks! > > ? John > > On Apr 13, 2015, at 4:40 AM, Michael Haupt wrote: >> >> Hi John, >> >> thank you very much for your review; keeping the Constants class around for VM/JDK constant value agreement certainly makes sense. I have undone most of the removal work and verified in a slowdebug build that MHN.verifyConstants() works. I've also added a comment on the Constants class to clarify its role a bit. Local tests and JPRT are still happy with this. >> >> Updated webrev: http://cr.openjdk.java.net/~mhaupt/8076461/webrev.01/ >> >> Best, >> >> Michael >> >>> Am 07.04.2015 um 23:49 schrieb John Rose : >>> >>> On Apr 7, 2015, at 12:11 PM, Michael Haupt wrote: >>>> >>>> Dear all, >>>> >>>> please review and sponsor this change. Cross-posted to hs-comp and core-lib as this is at the JVM/libraries boundary. This is a straightforward refactoring change that removes many constants and unused API from MHNatives, and places some constants used only in MemberName in that class. >>> >>> The class MethodHandleNatives.Constants exists to enumerate and cross-check any constants which the JVM and JDK code need to agree about. Removing a constant from MethodHandleNatives.Constants (moving to MemberName) may cause failures when MHN.verifyConstants is run (via "java -esa" on a debug build of Java). If there are no failures, I wonder what would happen if the JVM and JDK got out of sync. in their notion of the value of a constant like MN_CALLER_SENSITIVE. It's important that some part of our release testing detect if MN_CALLER_SENSITIVE (etc.) gets out of sync. >>> >>> If there is some reason why this testing is no longer needed, I'd like to see the whole Constants class go away, since that's all it's really good for. But I don't see that reason yet, and moving the constants somewhere either will cause a test failure, or *should* cause a test failure. >>> >>> I'm happy to see the "GC" guys go away. They were artifacts of a quickly moving 292 implementation that spanned two repositories with unsynchronized change streams. >>> >>> ? John >>> >>>> >>>> RFE: https://bugs.openjdk.java.net/browse/JDK-8076461 >>>> Changes: http://cr.openjdk.java.net/~mhaupt/8076461/webrev.00/ >>>> >>>> Tested with JPRT, HotSpot testset. >>>> >>>> Thanks, >>>> >>>> Michael -- Dr. Michael Haupt | Principal Member of Technical Staff Phone: +49 331 200 7277 | Fax: +49 331 200 7561 Oracle Java Platform Group | HotSpot Compiler Team Oracle Deutschland B.V. & Co. KG, Schiffbauergasse 14 | 14467 Potsdam, Germany Oracle is committed to developing practices and products that help protect the environment From vladimir.x.ivanov at oracle.com Tue Apr 14 11:47:51 2015 From: vladimir.x.ivanov at oracle.com (Vladimir Ivanov) Date: Tue, 14 Apr 2015 14:47:51 +0300 Subject: RFR (S): 8076461: JSR292: remove unused native and constants In-Reply-To: <46742670-8A71-4026-8ED5-25BE82DD2698@oracle.com> References: <4EB3C4DA-C382-4795-A676-6147E863DFF1@oracle.com> <3083F107-6D99-4C4F-948C-9326C0E843CE@oracle.com> <0C16CFAC-EFD5-41E8-840E-3421FA96F3E8@oracle.com> <46742670-8A71-4026-8ED5-25BE82DD2698@oracle.com> Message-ID: <552CFE67.1070208@oracle.com> Looks good. I'll push it for you. Best regards, Vladimir Ivanov On 4/14/15 2:33 PM, Michael Haupt wrote: > Hi John, > > thanks again; I've applied your suggestions, re-tested as before and uploaded the revision to http://cr.openjdk.java.net/~mhaupt/8076461/webrev.02/. > > Best, > > Michael > >> Am 13.04.2015 um 21:38 schrieb John Rose : >> >> That's much better; thanks. Glad to hear the verifyC's still works. >> >> The MN_* constants are a private interface between C++ and Java code. Those are the most important to verify. >> >> You can get rid of these lines; we don't look at vtable indexes any more: >> // The JVM uses values of -2 and above for vtable indexes. >> // Field values are simple positive offsets. >> // Ref: src/share/vm/oops/methodOop.hpp >> // This value is negative enough to avoid such numbers, >> // but not too negative. >> >> The other constants are publicly defined in various standards docs (except T_ILLEGAL). >> >> I don't think these constants are used any more, except the MN_* and REF_* ones. (The REF_* ones are in the JVM standard, so are in some sense pre-verified.) >> >> I suggest also removing the ACC_*, T_*, and CONSTANT_* names, if you can. We probably stopped using any of those when we started using ASM. >> >> Thanks! >> >> ? John >> >> On Apr 13, 2015, at 4:40 AM, Michael Haupt wrote: >>> >>> Hi John, >>> >>> thank you very much for your review; keeping the Constants class around for VM/JDK constant value agreement certainly makes sense. I have undone most of the removal work and verified in a slowdebug build that MHN.verifyConstants() works. I've also added a comment on the Constants class to clarify its role a bit. Local tests and JPRT are still happy with this. >>> >>> Updated webrev: http://cr.openjdk.java.net/~mhaupt/8076461/webrev.01/ >>> >>> Best, >>> >>> Michael >>> >>>> Am 07.04.2015 um 23:49 schrieb John Rose : >>>> >>>> On Apr 7, 2015, at 12:11 PM, Michael Haupt wrote: >>>>> >>>>> Dear all, >>>>> >>>>> please review and sponsor this change. Cross-posted to hs-comp and core-lib as this is at the JVM/libraries boundary. This is a straightforward refactoring change that removes many constants and unused API from MHNatives, and places some constants used only in MemberName in that class. >>>> >>>> The class MethodHandleNatives.Constants exists to enumerate and cross-check any constants which the JVM and JDK code need to agree about. Removing a constant from MethodHandleNatives.Constants (moving to MemberName) may cause failures when MHN.verifyConstants is run (via "java -esa" on a debug build of Java). If there are no failures, I wonder what would happen if the JVM and JDK got out of sync. in their notion of the value of a constant like MN_CALLER_SENSITIVE. It's important that some part of our release testing detect if MN_CALLER_SENSITIVE (etc.) gets out of sync. >>>> >>>> If there is some reason why this testing is no longer needed, I'd like to see the whole Constants class go away, since that's all it's really good for. But I don't see that reason yet, and moving the constants somewhere either will cause a test failure, or *should* cause a test failure. >>>> >>>> I'm happy to see the "GC" guys go away. They were artifacts of a quickly moving 292 implementation that spanned two repositories with unsynchronized change streams. >>>> >>>> ? John >>>> >>>>> >>>>> RFE: https://bugs.openjdk.java.net/browse/JDK-8076461 >>>>> Changes: http://cr.openjdk.java.net/~mhaupt/8076461/webrev.00/ >>>>> >>>>> Tested with JPRT, HotSpot testset. >>>>> >>>>> Thanks, >>>>> >>>>> Michael > > From michael.haupt at oracle.com Tue Apr 14 11:53:57 2015 From: michael.haupt at oracle.com (Michael Haupt) Date: Tue, 14 Apr 2015 13:53:57 +0200 Subject: RFR (S): 8076461: JSR292: remove unused native and constants In-Reply-To: <552CFE67.1070208@oracle.com> References: <4EB3C4DA-C382-4795-A676-6147E863DFF1@oracle.com> <3083F107-6D99-4C4F-948C-9326C0E843CE@oracle.com> <0C16CFAC-EFD5-41E8-840E-3421FA96F3E8@oracle.com> <46742670-8A71-4026-8ED5-25BE82DD2698@oracle.com> <552CFE67.1070208@oracle.com> Message-ID: <5F0E415F-6453-48E8-923F-25B835EDC08E@oracle.com> ... thank you, Vladimir! Best, Michael > Am 14.04.2015 um 13:47 schrieb Vladimir Ivanov : > > Looks good. > > I'll push it for you. > > Best regards, > Vladimir Ivanov -- Dr. Michael Haupt | Principal Member of Technical Staff Phone: +49 331 200 7277 | Fax: +49 331 200 7561 Oracle Java Platform Group | HotSpot Compiler Team Oracle Deutschland B.V. & Co. KG, Schiffbauergasse 14 | 14467 Potsdam, Germany Oracle is committed to developing practices and products that help protect the environment From pavel.rappo at oracle.com Tue Apr 14 11:57:02 2015 From: pavel.rappo at oracle.com (Pavel Rappo) Date: Tue, 14 Apr 2015 12:57:02 +0100 Subject: Contracts, subtyping, JDK-8029804 Message-ID: <00AA4A51-1622-4FAA-B446-7F9FB8D189DE@oracle.com> Hi, I've been looking into an old doc issue [1] on incompleteness in description of handling incorrect arguments in BufferedWriter.write(String, int, int). In a nutshell it's concerned that given the following facts: 1. Writer.write(String str, int off, int len) promises to throw IndexOutOfBoundsException if (off < 0) or (len < 0) or (off+len < 0) or (off+len > str.length()) 2. class BufferedWriter extends Writer 3. BufferedWriter.write(String s, int off, int len) states [2] that in contrast to its parent it won't do anything if (len < 0) behaviour of BufferedWriter.write(String s, int off, int len) is unspecified for other cases mentioned in its parent. I thought it's very natural to think that you don't need to copy-paste contracts into children unless they break it or you want to elaborate some details. Basically because of subtype relationship, general principles of OOP and Liskov Substitution Principle. i.e. in this case a line in BufferedWriter.write's javadoc * @exception IndexOutOfBoundsException {@inheritDoc} is implied. Unfortunately, BufferedWriter.write disobeys [3] the remainder of the contract of its parent. So we either have to make additional notes in the javadoc like with `len < 0` case or go and fix the bug instead. I wonder if it makes sense to fix those bugs altogether and remove the initial `len < 0` exceptional behavior. I fully understand that it formally breaks backwards compatibility because of the cases where such calls were lurking in code and ran unnoticed. But [2] shows that it wasn't done for some specific use case but rather was a mistake. Thus I don't think it would be a big stretch to assume that this thing affects no real world applications. Otherwise people would have noticed that something is not being written at all. P.S. I'm very interested in an outcome of this case mainly because I've noticed some more similar things in java.io package (e.g. [4]). Thanks. ------------------------------------------------------------------------------- [1] https://bugs.openjdk.java.net/browse/JDK-8029804 [2] https://bugs.openjdk.java.net/browse/JDK-4156573 [3] To be honest, it silently disobeys parent's guarantees, thus some bizarre things are possible: bw.write("abc", 1, Integer.MAX_VALUE); // ok bw.write("abc", -1, -1); // ok bw.write("abc", -1, 1); // undeclared StringIndexOutOfBoundsException [4] https://bugs.openjdk.java.net/browse/JDK-8067801 From Roger.Riggs at Oracle.com Tue Apr 14 15:00:57 2015 From: Roger.Riggs at Oracle.com (Roger Riggs) Date: Tue, 14 Apr 2015 11:00:57 -0400 Subject: [9] RFR of 8075156: (prefs) remove() should disallow the use of the null control character '\u0000' as key In-Reply-To: <21B0A029-9D57-445F-BE5F-5C0D03D7581D@oracle.com> References: <6AECFBD9-492F-4EA4-B126-478F1B19D5AE@oracle.com> <5520414A.4000804@oracle.com> <21B0A029-9D57-445F-BE5F-5C0D03D7581D@oracle.com> Message-ID: <552D2BA9.2050306@Oracle.com> Hi Brian, Thanks for digging deeper and the recap. I don't see any cases in which it is necessary or valuable to allow \0 in Strings (key or value). The original bug report did not indicate whether it was discovered as a testing exercise or when diagnosing a bug in an application. The compatibility risk is unknown at the moment since no cases have been noted that require \0 in strings. Long term the code will be easier to maintain if it is less complex and has fewer variables that are platform or format specific and developer errors are detected as soon as possible. Of the possible remedies below, #2 seems the most practical. But it will further hide the problem from developers since calling flush and sync is never required for correct operation: ///"explicit //flush//invocation is //not//required upon termination to ensure that pending updates are made persistent"/ Flush and sync would be the only opportunity to throw an exception and explain the cause. It will be harder to track down since the true cause will be far removed from the time/location of the exception. In the absence of advice to continue to support \0in Preference strings on Windows or Mac I'd continue with the recent direction to make \0 in key and value strings throw IAE. Roger On 4/10/2015 6:26 PM, Brian Burkhalter wrote: > On Apr 4, 2015, at 12:53 PM, Alan Bateman wrote: > >> On 24/03/2015 19:20, Brian Burkhalter wrote: >>> Please review at your convenience. >>> >>> Issue: https://bugs.openjdk.java.net/browse/JDK-8075156 >>> Patch: http://cr.openjdk.java.net/~bpb/8075156/webrev.00/ >>> >>> This is a sequel to the resolved issue https://bugs.openjdk.java.net/browse/JDK-8068373, (prefs) FileSystemPreferences writes \0 to XML storage, causing loss of all preferences, wherein the code point U+0000, the null control character, was made illegal to use as a key in the generic Unix file system-based Preferences. >>> >>> The issue at hand extends disallowing U+0000 as a key in the put() method on Mac OS X and Windows, and also disallows this use to the remove() methods on these platforms and in the generic Unix file system-based Preferences. >>> >>> Use of U+0000 in the corresponding get() method has not been disallowed as this method returns a default value. If it would be preferable that the behavior of get() with respect to the key U+0000 were the same as for put() and remove() then this patch may be updated to that effect. >>> >> Minimally then the putXXX methods should make it clear that they throw IAE for this case. This would be a javadoc only change because the implementation does this as a consequence of the original patch. > Agreed. > > Actually I am not completely satisfied with the fix for https://bugs.openjdk.java.net/browse/JDK-8068373 so I went back over all the discussions and notes on the various ways to fix the problem trying to rethink whether there might be a better solution. The problem is not really with the Preferences APIs per se, but rather with the ability of the XML-based backing store to handle all characters which might be present in a String, in this particular case \u0000, but there are other possible problematic characters as well. > > Ideally, the fix would be to modify the XML backing store to handle all possible characters. This does not however appear to be possible without introducing an incompatibility when the XML backing store is shared between the set of newer versions of Java which would support storing all characters and the older versions which do not. There are ways to minimize the incompatibility but not apparently eliminate it and the additional complexity might not merit the effort. > > In the RFC thread on 8068373, it was concluded that it would be better simply to disallow \u0000 for XML-backed Preferences. This change however introduced an incompatibility with non-XML backing stores which might or might not be able to handle \u0000. So to address this incompatibility (and to address the companion get/remove methods) the present RFR was introduced. The present change has the potential however to break Preferences implementations which have a backing store for which \u0000 *is* legal. > > Note also that all Preferences implementations should be able to handle all Strings if there is no interaction with the backing store, even in the case of the XML backing store. Without a round trip via the XML backing store no error would be encountered. This suggests an alternative fix of allowing the illegal character to be used ?live? but disallowed from being written to a backing store which cannot handle it. > > I raise these alternatives here because if any were preferable, then there is no point in going further in the current direction as one changeset reversion would already be needed. > >> In the original discussion then it was just a question as to whether get/getXXX and remove should be consistent. If the get and remove methods will always behave as if the key doesn't exist (and return the default value in the case of get) then it shouldn't require a javadoc change. > In the case of get(), for implementations based on AbstractPreferences, any exception thrown by getSpi() will in any case be caught and the default value returned. > > For remove() there might after all be no point in checking the key if the key is disallowed from being stored in the first place, so the method call would be a no-op and neither an implementation nor a javadoc change would be needed. > >> However I suspect it will require an implementation change as there may be non-XML backing stores might that allow \0 in the key (hence get and remove should actually do something). > As noted above, it might not be correct to extend the checked-in fix for 8068373 to the non-XML backing store cases as is being proposed in this RFR and likewise not to modify remove() symmetrically. > > Rethinking this entire topic l am now inclined to suggest retracting the prior fix of 8068373 and instead take one of the following approaches: > > 1. Modify the XML backing store to be able to handle at least \0 if not other characters problematic for XML. As noted above this might be complicated and introduce inter-version incompatibilities. > > 2. Allow \0 to be in Strings at the API level but do not write these entries to an XML backing store. This would allow in-session use of unsupported characters but these would magically disappear thereafter which could cause confusion. > > 3. Change the put() specification to allow throwing an IAE if the backing store cannot handle the supplied Strings. This however runs somewhat counter to the Preferences class-level specification that "The user of this class needn't be concerned with details of the backing store.? > > On reexamining things I also noticed this paragraph in the AbstractPreferences class-level specification: > > "The remaining SPI methods putSpi(String,String), removeSpi(String) and childSpi(String) have more complicated exception behavior. They are not specified to throw BackingStoreException, as they can generally obey their contracts even if the backing store is unavailable. This is true because they return no information and their effects are not required to become permanent until a subsequent call to Preferences.flush() or Preferences.sync(). Generally speaking, these SPI methods should not throw exceptions. In some implementations, there may be circumstances under which these calls cannot even enqueue the requested operation for later processing. Even under these circumstances it is generally better to simply ignore the invocation and return, rather than throwing an exception. Under these circumstances, however, all subsequent invocations of flush() and sync should return false, as returning true would imply that all previous operations had successfully been made permanent." > > This suggests that solution #2 above might be the appropriate fix instead of that of 8068373 plus the patch in the current RFR. There are errors in the above specification paragraph however which should also be fixed, viz., flush{Spi}() and sync{Spi}() are void, not boolean-returning methods. > > Thanks, > > Brian From brian.burkhalter at oracle.com Tue Apr 14 15:37:56 2015 From: brian.burkhalter at oracle.com (Brian Burkhalter) Date: Tue, 14 Apr 2015 08:37:56 -0700 Subject: [9] RFR of 8075156: (prefs) remove() should disallow the use of the null control character '\u0000' as key In-Reply-To: <552D2BA9.2050306@Oracle.com> References: <6AECFBD9-492F-4EA4-B126-478F1B19D5AE@oracle.com> <5520414A.4000804@oracle.com> <21B0A029-9D57-445F-BE5F-5C0D03D7581D@oracle.com> <552D2BA9.2050306@Oracle.com> Message-ID: Hi Roger, Thanks for taking the time to review this recap. Your suggestion to forge ahead with the approach already taken seems to be reasonable. I concur that a fail-fast approach of throwing an IAE as soon as the bad character is encountered if preferable to waiting for some inscrutable subsequent exception in flush() or sync(). So barring objections to the contrary from some other quarter, I will clean up the current patch and also address the errors in the class level javadoc that I pointed out in AbstractPreferences. Thanks, Brian On Apr 14, 2015, at 8:00 AM, Roger Riggs wrote: > Thanks for digging deeper and the recap. > > I don't see any cases in which it is necessary or valuable to allow > \0 in Strings (key or value). The original bug report did not indicate whether > it was discovered as a testing exercise or when diagnosing a bug in an application. > The compatibility risk is unknown at the moment since no cases have been > noted that require \0 in strings. > > Long term the code will be easier to maintain if it is less complex and has fewer > variables that are platform or format specific and developer errors are detected > as soon as possible. > > Of the possible remedies below, #2 seems the most practical. But it will further > hide the problem from developers since calling flush and sync is never required > for correct operation: > ///"explicit //flush//invocation is //not//required upon termination to ensure that pending updates are made persistent"/ > Flush and sync would be the only opportunity to throw an exception and explain the cause. > It will be harder to track down since the true cause will be far removed from > the time/location of the exception. > > In the absence of advice to continue to support \0in Preference strings on Windows > or Mac I'd continue with the recent direction to make \0 in key and value strings throw IAE. From peter.levart at gmail.com Tue Apr 14 15:47:53 2015 From: peter.levart at gmail.com (Peter Levart) Date: Tue, 14 Apr 2015 17:47:53 +0200 Subject: RFR 9: 8077350 Process API Updates Implementation Review In-Reply-To: <5526DA4A.6030808@Oracle.com> References: <5526DA4A.6030808@Oracle.com> Message-ID: <552D36A9.5090006@gmail.com> On 04/09/2015 10:00 PM, Roger Riggs wrote: > Please review the API and implementation of the Process API Updates > described inJEP 102 > . Please review and > comment by April 23rd. > > The recommendation to make ProcessHandle an interface is included > allowing the new functions to be extended by Process subclasses. > The implementation covers all functions on Unix, Windows, Solaris, and > Mac OS X. > > The API doc: http://cr.openjdk.java.net/~rriggs/ph-apidraft/ > > The webrev: http://cr.openjdk.java.net/~rriggs/webrev-ph > > Issue: JDK-8077350 > Process API Updates Implementation > > The code is in the jdk9 sandbox on branch JDK-8046092-branch. > > Please review and comment, Roger Hi Roger, I have a few comments... ProcessHandle JNI interface is same for all platforms and it is reused in UNIX ProcessImpl for destroying and waiting. Is there some particular reason why it is not reused in Windows ProcessImpl too? The Windows impl still uses it's own native methods for destroying and waiting, but they take "process handles" instead of PIDs. Are handles less susceptible to recycling? I am confused by the method name "supportsDestroyForcibly" too. The following would be more intuitive in my opinion: - destroyIsForcible() - isDestroyForcible() The @implNote for Process.onExit() says: 366 * @implNote 367 * The default implementation of this method employs a thread to 368 * {@link #waitFor() wait} for process exit, 369 * which may consume a lot of memory for thread stacks if a 370 * large number of processes are waited for concurrently. That's true for the default implementation in Process but not true for internal OpenJDK ProcessImpl(s). Should the note say so explicitly so that users won't be afraid of using this method with internal implementations? 371 *

    372 * External implementations are advised to override this method and provide 373 * more efficient implementation. For example, to delegate to the underlying 374 * process, it can simply do the following: 375 *

    {@code
      376      *    public CompletableFuture onExit() {
      377      *       return delegate.onExit();
      378      *    }
      379      * }
    380 * ...which in case of implementation of the delegate is used. ...this example is not correct as it exposes the "delegate" Process instance. It should be something like: public CompletableFuture onExit() { return delegate.onExit().thenApply(p -> this); } Otherwise it's nice how this turned out. Unrelated to your implementation, I have been thinking of another small Process API update. Some people find it odd how redirected in/out/err streams are exposed: http://blog.headius.com/2013/06/the-pain-of-broken-subprocess.html They basically don't like: - that exposed Input/Output streams are buffered - that underlying streams are File(Input/Output)Streams which, although the backing OS implementation are not files but pipes, don't expose selectable channels so that non-blocking event-based IO could be performed on them. - that exposed IO streams are automatically "managed" in UNIX variants of ProcessImpl which needs subtle "hacks" to do it in a perceptively transparent way (delayed close, draining input on exit and making it available after the underlying handle is already closed, ...) So I've been playing with the idea of exposing the "real" pipe channels in last couple of days. Here's the prototype I came up with: http://cr.openjdk.java.net/~plevart/jdk9-sandbox/JDK-8046092-branch/Process.PipeChannel/webrev.01/ This adds new Redirect type to the API and 3 new methods to Process that return Pipe channels when this new Redirect type is used. It's interesting that no native code changes were necessary. The behavior of pipes on Windows is a little different (perhaps because the Pipe NIO API uses sockets under the hood on Windows - why is that? Windows does have a pipe equivalent). What bothers me is that file handles opened on files (when redirecting to/from File) can be closed as soon as the subprocess is started and the subprocess is still able to read/write from the files (like with UNIX). It's not the same with pipe (i.e. socket) handles on Windows. They must be closed only after subprocess exits. If this subtle difference between file handles and socket handles on Windows could be dealt with (perhaps some options exist that affect subprocess spawning), then the extra waiting thread would not be needed on Windows. So what do you thik of this API update? Regards, Peter From Sergey.Bylokhov at oracle.com Tue Apr 14 16:02:41 2015 From: Sergey.Bylokhov at oracle.com (Sergey Bylokhov) Date: Tue, 14 Apr 2015 19:02:41 +0300 Subject: [9] Review Request: 8076264 [macosx] Launching app on MacOSX requires enclosing class In-Reply-To: <552729BC.7080205@oracle.com> References: <55252D45.4050109@oracle.com> <5526F7ED.2080403@oracle.com> <552729BC.7080205@oracle.com> Message-ID: <552D3A21.3050803@oracle.com> Hi, Kumar. Thanks for your suggestions. Then new version of the fix: http://cr.openjdk.java.net/~serb/8076264/webrev.02 On 10.04.15 4:39, Kumar Srinivasan wrote: > src/java.base/macosx/native/libjli/java_md_macosx.c > we need a comment here explaining why the Exception is cleared, > basically what > you have explained below. > > test/tools/launcher/MainClassWithoutEnclosingClass.java > :) the test seems to be more complicated than the source changes, > the launcher tests have had their own test framework TestHelper, to > keep these tests consistent, I have enclosed a simpler test > implementation, > I have not tested this on MacOSX as I don't have one, however I have > tested > on Windows, I trust you will verify the test, with JPRT on all > platforms. > > Many thanks for looking into this!. > Kumar > -----------------------------------------------------------CUT------------------------------------------------------------ > > /* > * Copyright (c) 2015, 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. > * > * This code is distributed in the hope that it will be useful, but > WITHOUT > * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or > * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License > * version 2 for more details (a copy is included in the LICENSE file > that > * accompanied this code). > * > * You should have received a copy of the GNU General Public License > version > * 2 along with this work; if not, write to the Free Software Foundation, > * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. > * > * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 > USA > * or visit www.oracle.com if you need additional information or have any > * questions. > */ > > /** > * @test > * @bug 8076264 > * @summary Launching app shouldn't require enclosing class for the > main class. > * @compile TestMainWithoutEnclosing.java > * @run main TestMainWithoutEnclosing > */ > > import java.io.File; > import java.io.IOException; > import java.util.ArrayList; > import java.util.List; > > public class TestMainWithoutEnclosing extends TestHelper { > > static final String EnclosingName = "Enclosing"; > > static void createJarFile(File testJar) throws IOException { > List scratch = new ArrayList<>(); > scratch.add("public class Enclosing {"); > scratch.add(" public static final class Main {"); > scratch.add(" public static void main(String... args) {"); > scratch.add(" System.out.println(\"Hello World\");"); > scratch.add(" }"); > scratch.add(" }"); > scratch.add("}"); > File enclosingFile = new File(EnclosingName + ".java"); > createFile(enclosingFile, scratch); > compile(enclosingFile.getName()); > // avoid side effects remove the Enclosing class > getClassFile(enclosingFile).delete(); > createJar("cvfe", testJar.getName(), EnclosingName + "$Main", > EnclosingName + "$Main" + ".class"); > // remove extraneous files in the current directory > new File(EnclosingName + "$Main" + ".class").delete(); > } > > public static void main(String... args) throws IOException { > File testJarFile = new File("test.jar"); > createJarFile(testJarFile); > TestResult tr = doExec(javaCmd, "-jar", testJarFile.getName()); > if (!tr.isOK()) { > System.out.println(tr); > throw new RuntimeException("test returned non-positive > value"); > } > if (!tr.contains("Hello World")) { > System.out.println(tr); > throw new RuntimeException("expected output not found"); > } > } > } > -----------------------------------------------------------CUT------------------------------------------------------------ > > On 4/9/2015 3:06 PM, Sergey Bylokhov wrote: >> Hello, >> Can somebody from the core team take a look? >> Thanks. >> On 08.04.15 16:29, Sergey Bylokhov wrote: >>> Hello. >>> Please review the fix for jdk 9. >>> After the fix we clear all errors caused by getCanonicalName() on >>> the mainclass and leave JAVA_MAIN_CLASS_ empty. This empty case will >>> be handled in the NSApplicationAWT.m. >>> Plus small cleanup suggested in the bug report(jstring->jclass). >>> >>> Bug: https://bugs.openjdk.java.net/browse/JDK-8076264 >>> Webrev can be found at: >>> http://cr.openjdk.java.net/~serb/8076264/webrev.01 >>> >> >> > -- Best regards, Sergey. From joel.franck at oracle.com Tue Apr 14 16:40:56 2015 From: joel.franck at oracle.com (=?windows-1252?Q?Joel_Borggr=E9n-Franck?=) Date: Tue, 14 Apr 2015 18:40:56 +0200 Subject: RFR 8073056: Repeating annotations throws java.security.AccessControlException with a SecurityManager In-Reply-To: <0107D848-B42D-4E50-B782-FB314313BB4E@oracle.com> References: <9D775E0E-16CA-43C9-AC30-A691AE7CCC0F@oracle.com> <54EE4A87.8050807@oracle.com> <19E11AB6-1504-4278-8256-154A61D7CBD9@oracle.com> <54EF4B2C.3000002@oracle.com> <54EF8FC0.9060501@gmail.com> <54EF91A8.4050303@gmail.com> <915E482B-4BE9-4BB1-AF9B-712C5FF12A3F@oracle.com> <54F041C2.7040701@gmail.com> <0107D848-B42D-4E50-B782-FB314313BB4E@oracle.com> Message-ID: <4608AAB8-5BB7-466A-9625-B00B06D1529A@oracle.com> Mandy, Paul, what do you think? cheers /Joel > On 28 Mar 2015, at 11:24, Joel Borggr?n-Franck wrote: > > Hi, > >> On 27 Feb 2015, at 11:06, Peter Levart wrote: >> On 02/27/2015 10:27 AM, Joel Borggr?n-Franck wrote: >>>> On 26 feb 2015, at 22:35, Peter Levart >>>> wrote: >>>> On 02/26/2015 10:27 PM, Peter Levart wrote: >>>> >>>>> The m.setAccessible(true) for the methods is needed to access methods of non-public annotations, right? This call could be moved to AnnotationType constructor as there it will be performed only once per Method object. >>>>> >>>> ...which will have the added benefit in that it will guarantee that only one MethodAccessor object per Method will ever be constructed instead of two? >>>> >>>> >>> I don?t see this. setAccessible sets override in AccessibleObject, I don?t see a new MethodAccessor being generated here. >> >> My fault! I was mistakenly thinking of Field objects in the context of setAccessible(boolean). If you use a Field object in two modes it will create and retain two different FieldAccessors (because they are different implementations in case field is final). >> >>> But I agree with you, and setting it as accessible in the AnnotationType constructor should arguably be more secure since then we know it isn?t shared since we just got our copy fresh from getDeclaredMethods(). >> >> That's a good point from maintainability perspective, yes, if someone some time decides to "optimize" the AnnotationType. I think it would be nice if AnnotationType documents that members() method returns Method objects that are pre-conditioned with setAccessible(true) and that users should not change this flag. >> > > I don?t want to do this in AnnotationType without a bigger overhaul that may be slightly incompatible and therefor should be 9 only. I do want to backport this fix to 8 however, so here is an alternative solution that should be safe and correct at the cost of extra allocation in the path for custom implementations of annotations (that should be rare). > > New webrev: > > http://cr.openjdk.java.net/~jfranck/8073056/webrev.02/ > > cheers > /Joel From kumar.x.srinivasan at oracle.com Tue Apr 14 17:05:16 2015 From: kumar.x.srinivasan at oracle.com (Kumar Srinivasan) Date: Tue, 14 Apr 2015 10:05:16 -0700 Subject: [9] Review Request: 8076264 [macosx] Launching app on MacOSX requires enclosing class In-Reply-To: <552D3A21.3050803@oracle.com> References: <55252D45.4050109@oracle.com> <5526F7ED.2080403@oracle.com> <552729BC.7080205@oracle.com> <552D3A21.3050803@oracle.com> Message-ID: <552D48CC.50807@oracle.com> Hi Sergey, looks good to me. Thanks Kumar On 4/14/2015 9:02 AM, Sergey Bylokhov wrote: > Hi, Kumar. > Thanks for your suggestions. Then new version of the fix: > http://cr.openjdk.java.net/~serb/8076264/webrev.02 > > On 10.04.15 4:39, Kumar Srinivasan wrote: >> src/java.base/macosx/native/libjli/java_md_macosx.c >> we need a comment here explaining why the Exception is cleared, >> basically what >> you have explained below. >> >> test/tools/launcher/MainClassWithoutEnclosingClass.java >> :) the test seems to be more complicated than the source changes, >> the launcher tests have had their own test framework TestHelper, to >> keep these tests consistent, I have enclosed a simpler test >> implementation, >> I have not tested this on MacOSX as I don't have one, however I have >> tested >> on Windows, I trust you will verify the test, with JPRT on all >> platforms. >> >> Many thanks for looking into this!. >> Kumar >> -----------------------------------------------------------CUT------------------------------------------------------------ >> >> /* >> * Copyright (c) 2015, 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. >> * >> * This code is distributed in the hope that it will be useful, but >> WITHOUT >> * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or >> * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License >> * version 2 for more details (a copy is included in the LICENSE file >> that >> * accompanied this code). >> * >> * You should have received a copy of the GNU General Public License >> version >> * 2 along with this work; if not, write to the Free Software >> Foundation, >> * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. >> * >> * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA >> 94065 USA >> * or visit www.oracle.com if you need additional information or have >> any >> * questions. >> */ >> >> /** >> * @test >> * @bug 8076264 >> * @summary Launching app shouldn't require enclosing class for the >> main class. >> * @compile TestMainWithoutEnclosing.java >> * @run main TestMainWithoutEnclosing >> */ >> >> import java.io.File; >> import java.io.IOException; >> import java.util.ArrayList; >> import java.util.List; >> >> public class TestMainWithoutEnclosing extends TestHelper { >> >> static final String EnclosingName = "Enclosing"; >> >> static void createJarFile(File testJar) throws IOException { >> List scratch = new ArrayList<>(); >> scratch.add("public class Enclosing {"); >> scratch.add(" public static final class Main {"); >> scratch.add(" public static void main(String... args) >> {"); >> scratch.add(" System.out.println(\"Hello World\");"); >> scratch.add(" }"); >> scratch.add(" }"); >> scratch.add("}"); >> File enclosingFile = new File(EnclosingName + ".java"); >> createFile(enclosingFile, scratch); >> compile(enclosingFile.getName()); >> // avoid side effects remove the Enclosing class >> getClassFile(enclosingFile).delete(); >> createJar("cvfe", testJar.getName(), EnclosingName + "$Main", >> EnclosingName + "$Main" + ".class"); >> // remove extraneous files in the current directory >> new File(EnclosingName + "$Main" + ".class").delete(); >> } >> >> public static void main(String... args) throws IOException { >> File testJarFile = new File("test.jar"); >> createJarFile(testJarFile); >> TestResult tr = doExec(javaCmd, "-jar", testJarFile.getName()); >> if (!tr.isOK()) { >> System.out.println(tr); >> throw new RuntimeException("test returned non-positive >> value"); >> } >> if (!tr.contains("Hello World")) { >> System.out.println(tr); >> throw new RuntimeException("expected output not found"); >> } >> } >> } >> -----------------------------------------------------------CUT------------------------------------------------------------ >> >> On 4/9/2015 3:06 PM, Sergey Bylokhov wrote: >>> Hello, >>> Can somebody from the core team take a look? >>> Thanks. >>> On 08.04.15 16:29, Sergey Bylokhov wrote: >>>> Hello. >>>> Please review the fix for jdk 9. >>>> After the fix we clear all errors caused by getCanonicalName() on >>>> the mainclass and leave JAVA_MAIN_CLASS_ empty. This empty case >>>> will be handled in the NSApplicationAWT.m. >>>> Plus small cleanup suggested in the bug report(jstring->jclass). >>>> >>>> Bug: https://bugs.openjdk.java.net/browse/JDK-8076264 >>>> Webrev can be found at: >>>> http://cr.openjdk.java.net/~serb/8076264/webrev.01 >>>> >>> >>> >> > > From Alan.Bateman at oracle.com Tue Apr 14 19:30:40 2015 From: Alan.Bateman at oracle.com (Alan Bateman) Date: Tue, 14 Apr 2015 20:30:40 +0100 Subject: RFR 9: 8077350 Process API Updates Implementation Review In-Reply-To: <552D36A9.5090006@gmail.com> References: <5526DA4A.6030808@Oracle.com> <552D36A9.5090006@gmail.com> Message-ID: <552D6AE0.7050506@oracle.com> On 14/04/2015 16:47, Peter Levart wrote: > > The behavior of pipes on Windows is a little different (perhaps > because the Pipe NIO API uses sockets under the hood on Windows - why > is that? Windows does have a pipe equivalent). Multiplexing is a bit limited on Windows, I don't think you can select on both sockets and pipe handlers in the one select. It should be rare to need to do this of course. So it should be possible to have the Windows Selector partition the selectable channels so that they are multiplexed via different threads when it arises. -Alan From lance.andersen at oracle.com Tue Apr 14 21:12:26 2015 From: lance.andersen at oracle.com (Lance Andersen) Date: Tue, 14 Apr 2015 17:12:26 -0400 Subject: JDK-8060068/JDK-8067904 DriverManager clean-up introduces bootstrap problem that breaks production drivers In-Reply-To: <601807605.4331549.1428053592161.JavaMail.yahoo@mail.yahoo.com> References: <601807605.4331549.1428053592161.JavaMail.yahoo@mail.yahoo.com> Message-ID: <2EF3878E-B7DF-4D80-B4E4-FBD68A558E74@oracle.com> Hi Robert, I had a chance to look at the code you provided and part of the problem is that MyDriver is not adhering to the JDBC specification as the call to registerDriver *must* be in the static block of the java.sql.Driver implementation and *not* in the constructor. The registerWithDriverManager() logic and the fact the call to this method is in the constructor is the primary culprit. I will probably put back the static block at least in the short term but please work with the vendor to address their issue Best, Lance On Apr 3, 2015, at 5:33 AM, Robert Gibson wrote: > Hi there, > > We are doing some early testing with JDK 9 and have discovered that the changes made to java.sql.DriverManager back in November/December have introduced an incompatibility with our JDBC driver (that we have used unchanged since Java 6) when it is pre-loaded with Class.forName (as recommended by Tomcat and specified as being harmless in the JavaDoc). We filed a bug report but it got an incident ID JI-9019539 and then disappeared into a black hole. > > In the hope of the problem getting a bit more attention I attach a reproducible test case that is representative of the commercially-available JDBC driver that we use (hint: the name rhymes with MyFace and it's used in a lot of banks). I guess the problem is that the driver is calling DriverManager.getDrivers() as part of its registration process, which is now causing the stack overflow given at the end of this mail, after the code. > > If you compile the attached files into test.jar and run > java -cp test.jar JDBCTest n > java -cp test.jar JDBCTest y > then the test should print > Trying to connect to jdbc:mydriver > OK > in both cases (as it does with Java 8). > When running with Java 9, the second command prints > Trying to connect to jdbc:mydriver > FAIL > No suitable driver found for jdbc:mydriver > > Hope this is helpful. > Regards, > Robert > > JDBCTest.java > > import java.io.*; > import java.sql.*; > import java.util.*; > > public class JDBCTest > { > public static void main(String... argv) throws Exception > { > if (argv.length > 1) DriverManager.setLogWriter(new PrintWriter(System.out)); > String[] urls = new String[] {"jdbc:mydriver"}; > if (argv.length > 0 && argv[0].equals("y")) { > loadClass("MyDriver"); > } > for (String url : urls) { > System.out.println("Trying to connect to " + url); > try { > Connection c = DriverManager.getConnection (url); > if (c == null) System.out.println("FAIL"); > else System.out.println("OK"); > }catch(SQLException e) { > System.out.println("FAIL"); > System.out.println(e.getMessage()); > } > } > } > > public static void loadClass(String classname) { > try { Class.forName(classname); } catch(ClassNotFoundException e) { System.out.println("Class not found: " + classname); } > } > } > > MyDriver.java > > import java.sql.*; > import java.util.Enumeration; > import java.util.Properties; > import java.util.logging.Logger; > > public class MyDriver implements java.sql.Driver { > static { > new MyDriver(); > } > public MyDriver() { > this.registerWithDriverManager(); > } > public final Connection connect(String url, Properties props) throws SQLException { > return acceptsURL(url) ? new MyConnection() : null; > } > public boolean acceptsURL(String url) throws SQLException { > return url.startsWith("jdbc:mydriver"); > } > public DriverPropertyInfo[] getPropertyInfo(String var1, Properties props) throws SQLException { > return null; > } > public int getMajorVersion() { > return 0; > } > public int getMinorVersion() { > return 1; > } > public boolean jdbcCompliant() { > return false; > } > public Logger getParentLogger() throws SQLFeatureNotSupportedException { > throw new SQLFeatureNotSupportedException("No logging for you"); > } > protected void registerWithDriverManager() { > try { > synchronized(DriverManager.class) { > DriverManager.registerDriver(this); > Enumeration e = DriverManager.getDrivers(); > while(e.hasMoreElements()) { > Driver d = (Driver)e.nextElement(); > if(d instanceof MyDriver && d != this) { > DriverManager.deregisterDriver(d); > } > } > } > } catch (SQLException ex) { > } > } > } > > MyConnection.java > > import java.sql.*; > import java.util.Map; > import java.util.Properties; > import java.util.concurrent.Executor; > > public class MyConnection implements Connection { > @Override > public Statement createStatement() throws SQLException { > return null; > } > @Override > public PreparedStatement prepareStatement(String sql) throws SQLException { > return null; > } > @Override > public CallableStatement prepareCall(String sql) throws SQLException { > return null; > } > @Override > public String nativeSQL(String sql) throws SQLException { > return null; > } > @Override > public void setAutoCommit(boolean autoCommit) throws SQLException { > } > @Override > public boolean getAutoCommit() throws SQLException { > return false; > } > @Override > public void commit() throws SQLException { > } > @Override > public void rollback() throws SQLException { > } > @Override > public void close() throws SQLException { > } > @Override > public boolean isClosed() throws SQLException { > return false; > } > @Override > public DatabaseMetaData getMetaData() throws SQLException { > return null; > } > @Override > public void setReadOnly(boolean readOnly) throws SQLException { > } > @Override > public boolean isReadOnly() throws SQLException { > return false; > } > @Override > public void setCatalog(String catalog) throws SQLException { > } > @Override > public String getCatalog() throws SQLException { > return null; > } > @Override > public void setTransactionIsolation(int level) throws SQLException { > } > @Override > public int getTransactionIsolation() throws SQLException { > return 0; > } > @Override > public SQLWarning getWarnings() throws SQLException { > return null; > } > @Override > public void clearWarnings() throws SQLException { > } > @Override > public Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException { > return null; > } > @Override > public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLException { > return null; > } > @Override > public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException { > return null; > } > @Override > public Map> getTypeMap() throws SQLException { > return null; > } > @Override > public void setTypeMap(Map> map) throws SQLException { > } > @Override > public void setHoldability(int holdability) throws SQLException { > } > @Override > public int getHoldability() throws SQLException { > return 0; > } > @Override > public Savepoint setSavepoint() throws SQLException { > return null; > } > @Override > public Savepoint setSavepoint(String name) throws SQLException { > return null; > } > @Override > public void rollback(Savepoint savepoint) throws SQLException { > } > @Override > public void releaseSavepoint(Savepoint savepoint) throws SQLException { > } > @Override > public Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException { > return null; > } > @Override > public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException { > return null; > } > @Override > public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException { > return null; > } > @Override > public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) throws SQLException { > return null; > } > @Override > public PreparedStatement prepareStatement(String sql, int[] columnIndexes) throws SQLException { > return null; > } > @Override > public PreparedStatement prepareStatement(String sql, String[] columnNames) throws SQLException { > return null; > } > @Override > public Clob createClob() throws SQLException { > return null; > } > @Override > public Blob createBlob() throws SQLException { > return null; > } > @Override > public NClob createNClob() throws SQLException { > return null; > } > @Override > public SQLXML createSQLXML() throws SQLException { > return null; > } > @Override > public boolean isValid(int timeout) throws SQLException { > return false; > } > @Override > public void setClientInfo(String name, String value) throws SQLClientInfoException { > } > @Override > public void setClientInfo(Properties properties) throws SQLClientInfoException { > } > @Override > public String getClientInfo(String name) throws SQLException { > return null; > } > @Override > public Properties getClientInfo() throws SQLException { > return null; > } > @Override > public Array createArrayOf(String typeName, Object[] elements) throws SQLException { > return null; > } > @Override > public Struct createStruct(String typeName, Object[] attributes) throws SQLException { > return null; > } > @Override > public void setSchema(String schema) throws SQLException { > } > @Override > public String getSchema() throws SQLException { > return null; > } > @Override > public void abort(Executor executor) throws SQLException { > } > @Override > public void setNetworkTimeout(Executor executor, int milliseconds) throws SQLException { > } > @Override > public int getNetworkTimeout() throws SQLException { > return 0; > } > @Override > public T unwrap(Class iface) throws SQLException { > return null; > } > @Override > public boolean isWrapperFor(Class iface) throws SQLException { > return false; > } > } > > Stack overflow (recursive call to new MyDriver()) > > [1] MyDriver.registerWithDriverManager (MyDriver.java:47) > [2] MyDriver. (MyDriver.java:12) > [3] sun.reflect.NativeConstructorAccessorImpl.newInstance0 (native method) > [4] sun.reflect.NativeConstructorAccessorImpl.newInstance (NativeConstructorAccessorImpl.java:62) > [5] sun.reflect.DelegatingConstructorAccessorImpl.newInstance (DelegatingConstructorAccessorImpl.java:45) > [6] java.lang.reflect.Constructor.newInstance (Constructor.java:425) > [7] java.lang.Class.newInstance (Class.java:464) > [8] java.util.ServiceLoader$LazyIterator.nextService (ServiceLoader.java:378) > [9] java.util.ServiceLoader$LazyIterator.next (ServiceLoader.java:402) > [10] java.util.ServiceLoader$1.next (ServiceLoader.java:478) > [11] java.sql.DriverManager$2.run (DriverManager.java:614) > [12] java.sql.DriverManager$2.run (DriverManager.java:594) > [13] java.security.AccessController.doPrivileged (native method) > [14] java.sql.DriverManager.ensureDriversInitialized (DriverManager.java:594) > [15] java.sql.DriverManager.getDrivers (DriverManager.java:437) > [16] MyDriver.registerWithDriverManager (MyDriver.java:47) > [17] MyDriver. (MyDriver.java:12) > [18] MyDriver. (MyDriver.java:8) > [19] java.lang.Class.forName0 (native method) > [20] java.lang.Class.forName (Class.java:286) > [21] JDBCTest.loadClass (JDBCTest.java:28) > [22] JDBCTest.main (JDBCTest.java:12) Lance Andersen| Principal Member of Technical Staff | +1.781.442.2037 Oracle Java Engineering 1 Network Drive Burlington, MA 01803 Lance.Andersen at oracle.com From Roger.Riggs at Oracle.com Tue Apr 14 21:33:46 2015 From: Roger.Riggs at Oracle.com (Roger Riggs) Date: Tue, 14 Apr 2015 17:33:46 -0400 Subject: RFR 9: 8077350 Process API Updates Implementation Review In-Reply-To: <552D36A9.5090006@gmail.com> References: <5526DA4A.6030808@Oracle.com> <552D36A9.5090006@gmail.com> Message-ID: <552D87BA.9030201@Oracle.com> Hi Peter, Thanks for the review. On 4/14/2015 11:47 AM, Peter Levart wrote: > > On 04/09/2015 10:00 PM, Roger Riggs wrote: >> Please review the API and implementation of the Process API Updates >> described inJEP 102 >> . Please review and >> comment by April 23rd. >> >> The recommendation to make ProcessHandle an interface is included >> allowing the new functions to be extended by Process subclasses. >> The implementation covers all functions on Unix, Windows, Solaris, >> and Mac OS X. >> >> The API doc: http://cr.openjdk.java.net/~rriggs/ph-apidraft/ >> >> The webrev: http://cr.openjdk.java.net/~rriggs/webrev-ph >> >> Issue: JDK-8077350 >> Process API Updates Implementation >> >> The code is in the jdk9 sandbox on branch JDK-8046092-branch. >> >> Please review and comment, Roger > > Hi Roger, > > I have a few comments... > > ProcessHandle JNI interface is same for all platforms and it is reused > in UNIX ProcessImpl for destroying and waiting. Is there some > particular reason why it is not reused in Windows ProcessImpl too? The > Windows impl still uses it's own native methods for destroying and > waiting, but they take "process handles" instead of PIDs. Are handles > less susceptible to recycling? > > I am confused by the method name "supportsDestroyForcibly" too. The > following would be more intuitive in my opinion: > > - destroyIsForcible() > - isDestroyForcible() We're tried several variations including the word 'destroy' and it still seems confusing. I suggested the supportsNormalTermination name in another thread. > > The @implNote for Process.onExit() says: > > 366 * @implNote > 367 * The default implementation of this method employs a thread to > 368 * {@link #waitFor() wait} for process exit, > 369 * which may consume a lot of memory for thread stacks if a > 370 * large number of processes are waited for concurrently. > > That's true for the default implementation in Process but not true for > internal OpenJDK ProcessImpl(s). Should the note say so explicitly so > that users won't be afraid of using this method with internal > implementations? Yes, it should be more specific about ProcessBuilder created instances. > > 371 *

    > 372 * External implementations are advised to override this > method and provide > 373 * more efficient implementation. For example, to delegate to > the underlying > 374 * process, it can simply do the following: > 375 *

    {@code
    >  376      *    public CompletableFuture onExit() {
    >  377      *       return delegate.onExit();
    >  378      *    }
    >  379      * }
    > 380 * ...which in case of implementation of the delegate is used. > > > ...this example is not correct as it exposes the "delegate" Process > instance. It should be something like: > > public CompletableFuture onExit() { > return delegate.onExit().thenApply(p -> this); > } Will fix tomorrow. > > > Otherwise it's nice how this turned out. > > Unrelated to your implementation, I have been thinking of another > small Process API update. Some people find it odd how redirected > in/out/err streams are exposed: > > http://blog.headius.com/2013/06/the-pain-of-broken-subprocess.html yep, I've read that several times. > > They basically don't like: > > - that exposed Input/Output streams are buffered > - that underlying streams are File(Input/Output)Streams which, > although the backing OS implementation are not files but pipes, don't > expose selectable channels so that non-blocking event-based IO could > be performed on them. > - that exposed IO streams are automatically "managed" in UNIX variants > of ProcessImpl which needs subtle "hacks" to do it in a perceptively > transparent way (delayed close, draining input on exit and making it > available after the underlying handle is already closed, ...) > > So I've been playing with the idea of exposing the "real" pipe > channels in last couple of days. Here's the prototype I came up with: > > http://cr.openjdk.java.net/~plevart/jdk9-sandbox/JDK-8046092-branch/Process.PipeChannel/webrev.01/ > > > This adds new Redirect type to the API and 3 new methods to Process > that return Pipe channels when this new Redirect type is used. It's > interesting that no native code changes were necessary. The behavior > of pipes on Windows is a little different (perhaps because the Pipe > NIO API uses sockets under the hood on Windows - why is that? Windows > does have a pipe equivalent). What bothers me is that file handles > opened on files (when redirecting to/from File) can be closed as soon > as the subprocess is started and the subprocess is still able to > read/write from the files (like with UNIX). It's not the same with > pipe (i.e. socket) handles on Windows. They must be closed only after > subprocess exits. > > If this subtle difference between file handles and socket handles on > Windows could be dealt with (perhaps some options exist that affect > subprocess spawning), then the extra waiting thread would not be > needed on Windows. > > So what do you think of this API update? Definitely worthy of a separate thread. It looks promising and addresses some of the issues raised, while moving other problems from the implementation to the application. Such as closing of the channels and cleanup. I worry about how the resources are freed if the code spawning the app doesn't do the cleanup. Will it require hooks (like a finalizer) to do the cleanup? Also, it doesn't help with Martin's goal of being able to implement emacs in Java since it doesn't provide pty control. As you are aware the complexity in Process is to ensure a timely cleanup and allowing the Process to terminate and release the process resources when it was done and not having to wait for the stdout/stderr consumer. Thanks, Roger From brian.burkhalter at oracle.com Tue Apr 14 21:56:56 2015 From: brian.burkhalter at oracle.com (Brian Burkhalter) Date: Tue, 14 Apr 2015 14:56:56 -0700 Subject: [9] RFR of 8075156: (prefs) remove() should disallow the use of the null control character '\u0000' as key In-Reply-To: References: <6AECFBD9-492F-4EA4-B126-478F1B19D5AE@oracle.com> <5520414A.4000804@oracle.com> <21B0A029-9D57-445F-BE5F-5C0D03D7581D@oracle.com> <552D2BA9.2050306@Oracle.com> Message-ID: Please review at your convenience this latest patch modified from the previous one pursuant to the most recent comments. Issue: https://bugs.openjdk.java.net/browse/JDK-8075156 Patch: http://cr.openjdk.java.net/~bpb/8075156/webrev.01/ Summary: * Revise Preferences javadoc to indicate IAE for put*(), get*(), and remove() for NUL control character U+0000 in the key and / or value, as appropriate. * Extend fix of put*() in JDK-8068373 to all platforms by moving functional code up to to AbstractPreferences. * Add fix for get*() and remove() in AbstractPreferences. * Revert FileSystemPreferences changes from JDK-8068373 as these are now handled by AbstractPreferences (note this includes rolling back the more recent year in the copyright as well). * Minor picayune cleanup in WindowsPreferences. * Correct class javadoc of AbstractPreferences which had referred to flush() and sync() as returning boolean type. * Extend existing test to get() and remove() cases. Test passed on all the usual platforms. The CCC request will need to be revised or a new one filed, pending approval of this patch. Thanks, Brian On Apr 14, 2015, at 8:37 AM, Brian Burkhalter wrote: > So barring objections to the contrary from some other quarter, I will clean up the current patch and also address the errors in the class level javadoc that I pointed out in AbstractPreferences. From david.holmes at oracle.com Wed Apr 15 02:24:09 2015 From: david.holmes at oracle.com (David Holmes) Date: Wed, 15 Apr 2015 12:24:09 +1000 Subject: Contracts, subtyping, JDK-8029804 In-Reply-To: <00AA4A51-1622-4FAA-B446-7F9FB8D189DE@oracle.com> References: <00AA4A51-1622-4FAA-B446-7F9FB8D189DE@oracle.com> Message-ID: <552DCBC9.6080202@oracle.com> Hi Pavel, On 14/04/2015 9:57 PM, Pavel Rappo wrote: > Hi, > > I've been looking into an old doc issue [1] on incompleteness in description of > handling incorrect arguments in BufferedWriter.write(String, int, int). > In a nutshell it's concerned that given the following facts: > > 1. Writer.write(String str, int off, int len) > promises to throw IndexOutOfBoundsException > if (off < 0) or (len < 0) or (off+len < 0) or (off+len > str.length()) > > 2. class BufferedWriter extends Writer > > 3. BufferedWriter.write(String s, int off, int len) > states [2] that in contrast to its parent it won't do anything > if (len < 0) > > behaviour of BufferedWriter.write(String s, int off, int len) is unspecified for > other cases mentioned in its parent. > I thought it's very natural to think that you don't need to copy-paste contracts > into children unless they break it or you want to elaborate some details. > Basically because of subtype relationship, general principles of OOP and Liskov > Substitution Principle. > i.e. in this case a line in BufferedWriter.write's javadoc > > * @exception IndexOutOfBoundsException {@inheritDoc} > > is implied. @throws rather than @exception but yes, unfortunately historically people have been unaware of the need to explicitly state in the javadoc that a subclass inherits the unchecked-exceptions of its parent. This is usually an oversight, but of course a subtype is allowed to weaken preconditions. > Unfortunately, BufferedWriter.write disobeys [3] the remainder of the contract > of its parent. So we either have to make additional notes in the javadoc like > with `len < 0` case or go and fix the bug instead. Yep. In this case it seems odd to allow the parents preconditions to be weakened but I can't say whether someone thought there was a valid reason for it. But once the implementation is out of sync with the implied/assumed contract then you are looking at a spec change regardless - either to make the inherited spec clear (and fix the implementation) or to clearly document the change in behaviour. > I wonder if it makes sense to fix those bugs altogether and remove the initial > `len < 0` exceptional behavior. I fully understand that it formally breaks > backwards compatibility because of the cases where such calls were lurking in > code and ran unnoticed. But [2] shows that it wasn't done for some specific use > case but rather was a mistake. Thus I don't think it would be a big stretch to > assume that this thing affects no real world applications. Otherwise people > would have noticed that something is not being written at all. Code that writes nothing when passed a negative 'len' is probably exactly what the user expects. If an exception were originally thrown then to me it seems likely the user would have added the "if (len > 0)" check themselves and so still "write nothing" in this case. So no bug would have been observed. If you start throwing the exception now then existing code may be broken. When the code has been out of sync with the spec for an extended period of time the safe approach is to adapt the spec to the code, not the other way around. David > P.S. I'm very interested in an outcome of this case mainly because I've noticed > some more similar things in java.io package (e.g. [4]). > > Thanks. > > ------------------------------------------------------------------------------- > [1] https://bugs.openjdk.java.net/browse/JDK-8029804 > [2] https://bugs.openjdk.java.net/browse/JDK-4156573 > [3] To be honest, it silently disobeys parent's guarantees, thus some > bizarre things are possible: > > bw.write("abc", 1, Integer.MAX_VALUE); // ok > bw.write("abc", -1, -1); // ok > bw.write("abc", -1, 1); // undeclared StringIndexOutOfBoundsException > > [4] https://bugs.openjdk.java.net/browse/JDK-8067801 > From peter.levart at gmail.com Wed Apr 15 06:31:47 2015 From: peter.levart at gmail.com (Peter Levart) Date: Wed, 15 Apr 2015 08:31:47 +0200 Subject: SelectableChannels and Process API Message-ID: <552E05D3.3080807@gmail.com> Hi Roger, So I started new thread... On 04/14/2015 11:33 PM, Roger Riggs wrote: > > On 4/14/2015 11:47 AM, Peter Levart wrote: >> I have been thinking of another small Process API update. Some people >> find it odd how redirected in/out/err streams are exposed: >> >> http://blog.headius.com/2013/06/the-pain-of-broken-subprocess.html > yep, I've read that several times. To be fair, it's mostly, but not entirely correct. The part that says: " So when the child process exits, the any data waiting to be read from its output stream is drained into a buffer. All of it. In memory. Did you launch a process that writes a gigabyte of data to its output stream and then terminates? Well, friend, I sure hope you have a gigabyte of memory, because the JDK is going to read that sucker in and there's nothing you can do about it. And let's hope there's not more than 2GB of data, since this code basically just grows a byte[], which in Java can only grow to 2GB. If there's more than 2GB of data on that stream, this logic errors out and the data is lost forever." ...is exaggeration. This does not happen as the pipe has a bounded buffer. When subprocess exits, there is at most that much data left in the buffer (64k typically) and only that much is sucked into the Java process and the underlying handle closed. >> >> They basically don't like: >> >> - that exposed Input/Output streams are buffered >> - that underlying streams are File(Input/Output)Streams which, >> although the backing OS implementation are not files but pipes, don't >> expose selectable channels so that non-blocking event-based IO could >> be performed on them. >> - that exposed IO streams are automatically "managed" in UNIX >> variants of ProcessImpl which needs subtle "hacks" to do it in a >> perceptively transparent way (delayed close, draining input on exit >> and making it available after the underlying handle is already >> closed, ...) >> >> So I've been playing with the idea of exposing the "real" pipe >> channels in last couple of days. Here's the prototype I came up with: >> >> http://cr.openjdk.java.net/~plevart/jdk9-sandbox/JDK-8046092-branch/Process.PipeChannel/webrev.01/ >> >> >> This adds new Redirect type to the API and 3 new methods to Process >> that return Pipe channels when this new Redirect type is used. It's >> interesting that no native code changes were necessary. The behavior >> of pipes on Windows is a little different (perhaps because the Pipe >> NIO API uses sockets under the hood on Windows - why is that? Windows >> does have a pipe equivalent). What bothers me is that file handles >> opened on files (when redirecting to/from File) can be closed as soon >> as the subprocess is started and the subprocess is still able to >> read/write from the files (like with UNIX). It's not the same with >> pipe (i.e. socket) handles on Windows. They must be closed only after >> subprocess exits. >> >> If this subtle difference between file handles and socket handles on >> Windows could be dealt with (perhaps some options exist that affect >> subprocess spawning), then the extra waiting thread would not be >> needed on Windows. >> >> So what do you think of this API update? > Definitely worthy of a separate thread. It looks promising and > addresses some of the issues > raised, while moving other problems from the implementation to the > application. > Such as closing of the channels and cleanup. I worry about how the > resources are freed > if the code spawning the app doesn't do the cleanup. Will it require > hooks (like a finalizer) > to do the cleanup? > Also, it doesn't help with Martin's goal of being able to implement > emacs in Java since it doesn't provide pty control. > As you are aware the complexity in Process is to ensure a timely > cleanup and > allowing the Process to terminate and release the process resources > when it was done and not having to wait for the stdout/stderr consumer. I wonder how this automatic stream cleanup really helps in real-world programs. It doesn't help the Process to terminate and release the process resources any sooner as the process terminates on it's own (unless killed) and OS releases it's resources without the outside help anyway. Draining and closing the stream after the process has already exited just releases one file handle (the consuming side of the pipe) in a promptly manner. This could be left to the user and/or finalizer. Draining after the process has already exited does not help the process to exit any sooner as it happens after the fact. A program that doesn't consume the stream can cause the process to hang forever as the pipe's buffer is bounded (64k typically). So draining and closing after the process has exited only potentially helps for the last 64k of the stream and only to release one file handle in a potentially more timely manner. OTOH now that ProcessImpl for UNIX does that (and why does Windows implementation not do that?) sloppy programs might exist that would potentially break if the status quo is not maintained. But new functionality need not be so permissive. I'll take a look at how and if Channel(s) do any kind of automatic cleanup based on reachability and whether this can be bolted on for Process use. I doubt it is possible to drain and close a Channel without disturbing the ongoing Selector IO processing... Regards, Peter > > Thanks, Roger > > From peter.levart at gmail.com Wed Apr 15 07:06:44 2015 From: peter.levart at gmail.com (Peter Levart) Date: Wed, 15 Apr 2015 09:06:44 +0200 Subject: RFR 9: 8077350 Process API Updates Implementation Review In-Reply-To: <552D87BA.9030201@Oracle.com> References: <5526DA4A.6030808@Oracle.com> <552D36A9.5090006@gmail.com> <552D87BA.9030201@Oracle.com> Message-ID: <552E0E04.4080903@gmail.com> Hi Roger, On 04/14/2015 11:33 PM, Roger Riggs wrote: > Hi Peter, > > Thanks for the review. > > On 4/14/2015 11:47 AM, Peter Levart wrote: >> >> On 04/09/2015 10:00 PM, Roger Riggs wrote: >>> Please review the API and implementation of the Process API Updates >>> described inJEP 102 >>> . Please review >>> and comment by April 23rd. >>> >>> The recommendation to make ProcessHandle an interface is included >>> allowing the new functions to be extended by Process subclasses. >>> The implementation covers all functions on Unix, Windows, Solaris, >>> and Mac OS X. >>> >>> The API doc: http://cr.openjdk.java.net/~rriggs/ph-apidraft/ >>> >>> The webrev: http://cr.openjdk.java.net/~rriggs/webrev-ph >>> >>> Issue: JDK-8077350 >>> Process API >>> Updates Implementation >>> >>> The code is in the jdk9 sandbox on branch JDK-8046092-branch. >>> >>> Please review and comment, Roger >> >> Hi Roger, >> >> I have a few comments... >> >> ProcessHandle JNI interface is same for all platforms and it is >> reused in UNIX ProcessImpl for destroying and waiting. Is there some >> particular reason why it is not reused in Windows ProcessImpl too? >> The Windows impl still uses it's own native methods for destroying >> and waiting, but they take "process handles" instead of PIDs. Are >> handles less susceptible to recycling? >> >> I am confused by the method name "supportsDestroyForcibly" too. The >> following would be more intuitive in my opinion: >> >> - destroyIsForcible() >> - isDestroyForcible() > We're tried several variations including the word 'destroy' and it > still seems confusing. > I suggested the supportsNormalTermination name in another thread. Or: - supportsGracefulTermination - supportsGracefulDestroy - supportsDestroyGracefully Regards, Peter From roland.westrelin at oracle.com Wed Apr 15 10:16:59 2015 From: roland.westrelin at oracle.com (Roland Westrelin) Date: Wed, 15 Apr 2015 12:16:59 +0200 Subject: [9] RFR (M): 8057967: CallSite dependency tracking scales devastatingly poorly In-Reply-To: <552527E1.5060102@oracle.com> References: <551C5B92.8060500@oracle.com> <552527E1.5060102@oracle.com> Message-ID: Hi Vladimir, > http://cr.openjdk.java.net/~vlivanov/8057967/webrev.01/hotspot/ In ciCallSite::get_context(), is it safe to manipulate a raw oop the way you do it (with 2 different oops). Can?t it be moved concurrently by the GC? Roland. > http://cr.openjdk.java.net/~vlivanov/8057967/webrev.01/jdk/ > > Best regards, > Vladimir Ivanov > > On 4/1/15 11:56 PM, Vladimir Ivanov wrote: >> http://cr.openjdk.java.net/~vlivanov/8057967/webrev.00/hotspot/ >> http://cr.openjdk.java.net/~vlivanov/8057967/webrev.00/jdk/ >> https://bugs.openjdk.java.net/browse/JDK-8057967 >> >> HotSpot JITs inline very aggressively through CallSites. The >> optimistically treat CallSite target as constant, but record a nmethod >> dependency to invalidate the compiled code once CallSite target changes. >> >> Right now, such dependencies have call site class as a context. This >> context is too coarse and it leads to context pollution: if some >> CallSite target changes, VM needs to enumerate all nmethods which >> depends on call sites of such type. >> >> As performance analysis in the bug report shows, it can sum to >> significant amount of work. >> >> While working on the fix, I investigated 3 approaches: >> (1) unique context per call site >> (2) use CallSite target class >> (3) use a class the CallSite instance is linked to >> >> Considering call sites are ubiquitous (e.g. 10,000s on some octane >> benchmarks), loading a dedicated class for every call site is an >> overkill (even VM anonymous). >> >> CallSite target class >> (MethodHandle.form->LambdaForm.vmentry->MemberName.clazz->Class) is >> also not satisfactory, since it is a compiled LambdaForm VM anonymous >> class, which is heavily shared. It gets context pollution down, but >> still the overhead is quite high. >> >> So, I decided to focus on (3) and ended up with a mixture of (2) & (3). >> >> Comparing to other options, the complications of (3) are: >> - CallSite can stay unlinked (e.g. CallSite.dynamicInvoker()), so >> there should be some default context VM can use >> >> - CallSite instances can be shared and it shouldn't keep the context >> class from unloading; >> >> It motivated a scheme where CallSite context is initialized lazily and >> can change during lifetime. When CallSite is linked with an indy >> instruction, it's context is initialized. Usually, JIT sees CallSite >> instances with initialized context (since it reaches them through indy), >> but if it's not the case and there's no context yet, JIT sets it to >> "default context", which means "use target call site". >> >> I introduced CallSite$DependencyContext, which represents a nmethod >> dependency context and points (indirectly) to a Class used as a context. >> >> Context class is referenced through a phantom reference >> (sun.misc.Cleaner to simplify cleanup). Though it's impossible to >> extract referent using Reference.get(), VM can access it directly by >> reading corresponding field. Unlike other types of references, phantom >> references aren't cleared automatically. It allows VM to access context >> class until cleanup is performed. And cleanup resets the context to >> NULL, in addition to invalidating all relevant dependencies. >> >> There are 3 context states a CallSite instance can be in: >> (1) NULL: no depedencies >> (2) DependencyContext.DEFAULT_CONTEXT: dependencies are stored in >> call site target class >> (3) DependencyContext for some class: dependencies are stored on the >> class DependencyContext instance points to >> >> Every CallSite starts w/o a context (1) and then lazily gets one ((2) or >> (3) depending on the situation). >> >> State transitions: >> (1->3): When a CallSite w/o a context (1) is linked with some indy >> call site, it's owner is recorded as a context (3). >> >> (1->2): When JIT needs to record a dependency on a target of a >> CallSite w/o a context(1), it sets the context to DEFAULT_CONTEXT and >> uses target class to store the dependency. >> >> (3->1): When context class becomes unreachable, a cleanup hook >> invalidates all dependencies on that CallSite and resets the context to >> NULL (1). >> >> Only (3->1) requires dependency invalidation, because there are no >> depedencies in (1) and (2->1) isn't performed. >> >> (1->3) is done in Java code (CallSite.initContext) and (1->2) is >> performed in VM (ciCallSite::get_context()). The updates are performed >> by CAS, so there's no need in additional synchronization. Other >> operations on VM side are volatile (to play well with Java code) and >> performed with Compile_lock held (to avoid races between VM operations). >> >> Some statistics: >> Box2D, latest jdk9-dev >> - CallSite instances: ~22000 >> >> - invalidated nmethods due to CallSite target changes: ~60 >> >> - checked call_site_target_value dependencies: >> - before the fix: ~1,600,000 >> - after the fix: ~600 >> >> Testing: >> - dedicated test which excercises different state transitions >> - jdk/java/lang/invoke, hotspot/test/compiler/jsr292, nashorn >> >> Thanks! >> >> Best regards, >> Vladimir Ivanov From paul.sandoz at oracle.com Wed Apr 15 11:04:49 2015 From: paul.sandoz at oracle.com (Paul Sandoz) Date: Wed, 15 Apr 2015 13:04:49 +0200 Subject: JEP 238: Multi-Version JAR Files In-Reply-To: <551A889C.1030309@ch.ibm.com> References: <553E75B2-C52C-4381-B769-7D3F84089643@oracle.com> <551A889C.1030309@ch.ibm.com> Message-ID: Hi Markus, Sorry for the late reply i have been away for the last 3 weeks. You and your colleagues might be interested in discussion of JEP 238 on org.apache.maven.dev: http://markmail.org/thread/v5ywgdpuprntrvfu#query:+page:1+mid:v5ywgdpuprntrvfu+state:results especially when it gets to the technical discussion of how maven could support the production of MVJARs. On Mar 31, 2015, at 1:44 PM, Markus Keller wrote: > I've discussed this with the Eclipse JDT team. We're very skeptic and we think that JEP 238 goes into a wrong direction. Eclipse JDT does not intend to add special support for it. > > Building such MVJARs will be quite complicated, since it requires having separate classpaths and compiling against multiple JDKs to produce the release-specific class files that should end up in the same MVJAR. That means you either need a preprocessor that would allow to keep JDK-release-specific code in the same *.java file, or you need to maintain and sync separate *.java files in separate source folders. Is it really quite so complicated? especially if it is anticipated that only a small number of sources files are likely to be affected? > Both options are completely counter Java's "write once, run anywhere" idea, whose foundation is to have only one set of source files and no platform-specific compilation switches. This is one of the greatest features of Java. It's what makes reliable code analysis, dependency tracking, and refactoring possible. > The trouble with such maxims is they can be easily co-opted to ones point of view :-) (my comment is in jest, but there is a point too) for example i can reasonably argue that MVJARs are actually increasing the ability to run anywhere, and that benefits all consumers of such JARs. Note that in terms of dependency tracking one is not proposing that the dependencies above the major platform would change. Nor would the API (there may be some form of backward compatible change, see the brief discussion between Moh and myself). I agree that changes would be required to both tooling and IDEs. I am interested in knowing how difficult such changes might be. Are there a series of smallish changes, each of which is not terribly difficult, or is there something fundamentally insurmountable? > Furthermore, the general problem is not specific to the JDK, but also occurs for other libraries. Therefore, a JDK-specific solution would be at the wrong level. > Just because it's JDK specific does not mean it is de-facto at the wrong level. It's attempting to solve a smaller and much simpler problem. > A better solution for such cases is to provide an adapter JAR that makes the new APIs available when running on an older JDK. That way, the problem is solved at the origin, and not again and again for each client. And with "the problem", I mean the problem that the old JDK release didn't offer an API for something that clients should use ASAP, even if they can't require the whole new JDK release right away. > That does not solve the problem of internal or deprecated APIs present in N going away in N+1. Layering JDK classes (in JARS) on top of the JDK platform is not very practical. Such classes often have special treatment, we don't want to recommend using the boot classpath, and i don't think developers will be very happy having using such options and manage additional dependencies associated with the platform. Of course we cannot feasibly backport every new API in N to N-1, N-2 etc. In selective cases that might be possible, but for the core of the JDK it's like pulling on a string of public dependencies, internal dependencies and perhaps more subtle dependencies between javac and hotspot (Unsafe replacements would be particularly tricky). Paul. From forax at univ-mlv.fr Wed Apr 15 11:58:19 2015 From: forax at univ-mlv.fr (Remi Forax) Date: Wed, 15 Apr 2015 13:58:19 +0200 Subject: JEP 238: Multi-Version JAR Files In-Reply-To: References: <553E75B2-C52C-4381-B769-7D3F84089643@oracle.com> <551A889C.1030309@ch.ibm.com> Message-ID: <552E525B.2030209@univ-mlv.fr> Hi Paul, I think you're seriously underestimate the cost of this JEP. You're asking Java devs to: - be able to maintain several codes with different source level compatibility in the same code tree. - add a level of indirection in all tools that crawle/compile Java source code - add a level of indirection in all tools that crawle/rewrite bytecodes all of that to support a feature that: - is not clearly defined - is supposed to only solve cases where delta between versions is small - comes with no help from the JDK (how to detect a version, etc). While I understand the comfort for the end user to have only one big fat jar, it would like to see a prototype that have good answers to all these questions before including it into the JDK. Said simply, tackling such problem requires a JSR not a JEP, because it's a feature which impact a large number of parts of the Java ecosystem. regards, R?mi On 04/15/2015 01:04 PM, Paul Sandoz wrote: > Hi Markus, > > Sorry for the late reply i have been away for the last 3 weeks. > > You and your colleagues might be interested in discussion of JEP 238 on org.apache.maven.dev: > > http://markmail.org/thread/v5ywgdpuprntrvfu#query:+page:1+mid:v5ywgdpuprntrvfu+state:results > > especially when it gets to the technical discussion of how maven could support the production of MVJARs. > > > On Mar 31, 2015, at 1:44 PM, Markus Keller wrote: > >> I've discussed this with the Eclipse JDT team. We're very skeptic and we think that JEP 238 goes into a wrong direction. Eclipse JDT does not intend to add special support for it. >> >> Building such MVJARs will be quite complicated, since it requires having separate classpaths and compiling against multiple JDKs to produce the release-specific class files that should end up in the same MVJAR. That means you either need a preprocessor that would allow to keep JDK-release-specific code in the same *.java file, or you need to maintain and sync separate *.java files in separate source folders. > Is it really quite so complicated? especially if it is anticipated that only a small number of sources files are likely to be affected? > > >> Both options are completely counter Java's "write once, run anywhere" idea, whose foundation is to have only one set of source files and no platform-specific compilation switches. This is one of the greatest features of Java. It's what makes reliable code analysis, dependency tracking, and refactoring possible. >> > The trouble with such maxims is they can be easily co-opted to ones point of view :-) (my comment is in jest, but there is a point too) for example i can reasonably argue that MVJARs are actually increasing the ability to run anywhere, and that benefits all consumers of such JARs. > > Note that in terms of dependency tracking one is not proposing that the dependencies above the major platform would change. Nor would the API (there may be some form of backward compatible change, see the brief discussion between Moh and myself). > > I agree that changes would be required to both tooling and IDEs. I am interested in knowing how difficult such changes might be. Are there a series of smallish changes, each of which is not terribly difficult, or is there something fundamentally insurmountable? > > >> Furthermore, the general problem is not specific to the JDK, but also occurs for other libraries. Therefore, a JDK-specific solution would be at the wrong level. >> > Just because it's JDK specific does not mean it is de-facto at the wrong level. It's attempting to solve a smaller and much simpler problem. > > >> A better solution for such cases is to provide an adapter JAR that makes the new APIs available when running on an older JDK. That way, the problem is solved at the origin, and not again and again for each client. And with "the problem", I mean the problem that the old JDK release didn't offer an API for something that clients should use ASAP, even if they can't require the whole new JDK release right away. >> > That does not solve the problem of internal or deprecated APIs present in N going away in N+1. > > Layering JDK classes (in JARS) on top of the JDK platform is not very practical. Such classes often have special treatment, we don't want to recommend using the boot classpath, and i don't think developers will be very happy having using such options and manage additional dependencies associated with the platform. > > Of course we cannot feasibly backport every new API in N to N-1, N-2 etc. In selective cases that might be possible, but for the core of the JDK it's like pulling on a string of public dependencies, internal dependencies and perhaps more subtle dependencies between javac and hotspot (Unsafe replacements would be particularly tricky). > > Paul. From forax at univ-mlv.fr Wed Apr 15 12:03:10 2015 From: forax at univ-mlv.fr (Remi Forax) Date: Wed, 15 Apr 2015 14:03:10 +0200 Subject: JEP 238: Multi-Version JAR Files In-Reply-To: References: <553E75B2-C52C-4381-B769-7D3F84089643@oracle.com> <551A889C.1030309@ch.ibm.com> Message-ID: <552E537E.4030709@univ-mlv.fr> On 04/15/2015 01:04 PM, Paul Sandoz wrote: > Hi Markus, > > Sorry for the late reply i have been away for the last 3 weeks. > > You and your colleagues might be interested in discussion of JEP 238 on org.apache.maven.dev: > > http://markmail.org/thread/v5ywgdpuprntrvfu#query:+page:1+mid:v5ywgdpuprntrvfu+state:results > > especially when it gets to the technical discussion of how maven could support the production of MVJARs. > > > On Mar 31, 2015, at 1:44 PM, Markus Keller wrote: > >> I've discussed this with the Eclipse JDT team. We're very skeptic and we think that JEP 238 goes into a wrong direction. Eclipse JDT does not intend to add special support for it. >> >> Building such MVJARs will be quite complicated, since it requires having separate classpaths and compiling against multiple JDKs to produce the release-specific class files that should end up in the same MVJAR. That means you either need a preprocessor that would allow to keep JDK-release-specific code in the same *.java file, or you need to maintain and sync separate *.java files in separate source folders. > Is it really quite so complicated? especially if it is anticipated that only a small number of sources files are likely to be affected? > > >> Both options are completely counter Java's "write once, run anywhere" idea, whose foundation is to have only one set of source files and no platform-specific compilation switches. This is one of the greatest features of Java. It's what makes reliable code analysis, dependency tracking, and refactoring possible. >> > The trouble with such maxims is they can be easily co-opted to ones point of view :-) (my comment is in jest, but there is a point too) for example i can reasonably argue that MVJARs are actually increasing the ability to run anywhere, and that benefits all consumers of such JARs. > > Note that in terms of dependency tracking one is not proposing that the dependencies above the major platform would change. Nor would the API (there may be some form of backward compatible change, see the brief discussion between Moh and myself). > > I agree that changes would be required to both tooling and IDEs. I am interested in knowing how difficult such changes might be. Are there a series of smallish changes, each of which is not terribly difficult, or is there something fundamentally insurmountable? > > >> Furthermore, the general problem is not specific to the JDK, but also occurs for other libraries. Therefore, a JDK-specific solution would be at the wrong level. >> > Just because it's JDK specific does not mean it is de-facto at the wrong level. It's attempting to solve a smaller and much simpler problem. > > >> A better solution for such cases is to provide an adapter JAR that makes the new APIs available when running on an older JDK. That way, the problem is solved at the origin, and not again and again for each client. And with "the problem", I mean the problem that the old JDK release didn't offer an API for something that clients should use ASAP, even if they can't require the whole new JDK release right away. >> > That does not solve the problem of internal or deprecated APIs present in N going away in N+1. > > Layering JDK classes (in JARS) on top of the JDK platform is not very practical. Such classes often have special treatment, we don't want to recommend using the boot classpath, and i don't think developers will be very happy having using such options and manage additional dependencies associated with the platform. > > Of course we cannot feasibly backport every new API in N to N-1, N-2 etc. In selective cases that might be possible, but for the core of the JDK it's like pulling on a string of public dependencies, internal dependencies and perhaps more subtle dependencies between javac and hotspot (Unsafe replacements would be particularly tricky). that why most of the tools like the retroweaver [1] rewrite bytecodes because you can replace a dependency to a JDK class to wire it to a class that will come with your code. Note that in that case, you develop and maintain only one version of the code compatible with the newer version and backport the code to the old one, instead of selectively develop part of the code with the new version as you propose. > > Paul. cheers, R?mi [1] http://retroweaver.sourceforge.net/ From magnus.ihse.bursie at oracle.com Wed Apr 15 12:37:24 2015 From: magnus.ihse.bursie at oracle.com (Magnus Ihse Bursie) Date: Wed, 15 Apr 2015 14:37:24 +0200 Subject: Question about system properties and version strings Message-ID: <552E5B84.8060307@oracle.com> When this simple program is run: public class TestSystemVersion { public static void main(String[] args) { System.out.println("1. java.version: " + System.getProperty("java.version")); System.out.println("1. java.runtime.version: " + System.getProperty("java.runtime.version")); System.setProperties(null); System.out.println("2. java.version: " + System.getProperty("java.version")); System.out.println("2. java.runtime.version: " + System.getProperty("java.runtime.version")); } } The output is: 1. java.version: 1.9.0-internal 1. java.runtime.version: 1.9.0-internal-magnusi_2015_04_02_09_24-b00 2. java.version: 1.9.0-internal 2. java.runtime.version: null Is this really expected? I find it surprising. I'd have thought that either *both* strings would have been reset, or none. This behavior stems from the fact that System.setProperties(), when given a null argument, calls initProperties. This is a native method which sets java.version, but not java.runtime.version. However, at system startup, initializeSystemClass() will be called, which apart from initProperties also calls a bunch of other methods to set up initial system properties, for instance sun.misc.Version.init(), which will re-set java.version (even though it is already set at this point), and also set java.runtime.version. /Magnus From paul.sandoz at oracle.com Wed Apr 15 12:44:46 2015 From: paul.sandoz at oracle.com (Paul Sandoz) Date: Wed, 15 Apr 2015 14:44:46 +0200 Subject: JEP 238: Multi-Version JAR Files In-Reply-To: <552E525B.2030209@univ-mlv.fr> References: <553E75B2-C52C-4381-B769-7D3F84089643@oracle.com> <551A889C.1030309@ch.ibm.com> <552E525B.2030209@univ-mlv.fr> Message-ID: Hi Remi, On Apr 15, 2015, at 1:58 PM, Remi Forax wrote: > Hi Paul, > I think you're seriously underestimate the cost of this JEP. That is why we are asking for feedback :-) I want to understand the impact and get some concrete reasons why certain aspects are difficult. > > You're asking Java devs to: > - be able to maintain several codes with different source level compatibility in the same code tree. Yes. > - add a level of indirection in all tools that crawle/compile Java source code > - add a level of indirection in all tools that crawle/rewrite bytecodes > How common is it to statically process the byte codes of a JAR file to produce a new JAR file as opposed to doing that dynamically at runtime? (I know of obfuscating tools, which IIRC were more commonly used for mobile?) Are processed JAR files then re-distributed via say maven or kept internally to be used with a specific stack? Would such tools process use the JarFile class to get access to the JAR file contents? > all of that to support a feature that: > - is not clearly defined To me what is not clearly understood is the potential impact, where as the feature itself is actually fairly simple to grok. > - is supposed to only solve cases where delta between versions is small Yes, it's anticipated there would be a small number of classes that would require changing. > - comes with no help from the JDK (how to detect a version, etc). > We can propose such things for 9. For example, new public methods to JarFile. There will be a public JDK version query API in 9, is that what you mean by "how to detect a version?", or do you mean how can one analyze an MVJAR? (or perhaps both...) Paul. > While I understand the comfort for the end user to have only one big fat jar, it would like to see a prototype that have good answers to all these questions before including it into the JDK. > > Said simply, tackling such problem requires a JSR not a JEP, because it's a feature which impact a large number of parts of the Java ecosystem. > > regards, > R?mi From Alan.Bateman at oracle.com Wed Apr 15 12:49:42 2015 From: Alan.Bateman at oracle.com (Alan Bateman) Date: Wed, 15 Apr 2015 13:49:42 +0100 Subject: Question about system properties and version strings In-Reply-To: <552E5B84.8060307@oracle.com> References: <552E5B84.8060307@oracle.com> Message-ID: <552E5E66.9010502@oracle.com> On 15/04/2015 13:37, Magnus Ihse Bursie wrote: > When this simple program is run: > > public class TestSystemVersion { > public static void main(String[] args) { > System.out.println("1. java.version: " + > System.getProperty("java.version")); > System.out.println("1. java.runtime.version: " + > System.getProperty("java.runtime.version")); > System.setProperties(null); > System.out.println("2. java.version: " + > System.getProperty("java.version")); > System.out.println("2. java.runtime.version: " + > System.getProperty("java.runtime.version")); > } > } > > The output is: > 1. java.version: 1.9.0-internal > 1. java.runtime.version: 1.9.0-internal-magnusi_2015_04_02_09_24-b00 > 2. java.version: 1.9.0-internal > 2. java.runtime.version: null > > Is this really expected? I find it surprising. I'd have thought that > either *both* strings would have been reset, or none. > > This behavior stems from the fact that System.setProperties(), when > given a null argument, calls initProperties. This is a native method > which sets java.version, but not java.runtime.version. However, at > system startup, initializeSystemClass() will be called, which apart > from initProperties also calls a bunch of other methods to set up > initial system properties, for instance sun.misc.Version.init(), which > will re-set java.version (even though it is already set at this > point), and also set java.runtime.version. At one point then Mike Duigou was looking into this via JDK-8022854 but I don't think it was ever completed. -Alan From paul.sandoz at oracle.com Wed Apr 15 12:59:46 2015 From: paul.sandoz at oracle.com (Paul Sandoz) Date: Wed, 15 Apr 2015 14:59:46 +0200 Subject: JEP 238: Multi-Version JAR Files In-Reply-To: <552E537E.4030709@univ-mlv.fr> References: <553E75B2-C52C-4381-B769-7D3F84089643@oracle.com> <551A889C.1030309@ch.ibm.com> <552E537E.4030709@univ-mlv.fr> Message-ID: <1E8FE53C-AFCD-48D8-90D0-A0A88C57ED62@oracle.com> On Apr 15, 2015, at 2:03 PM, Remi Forax wrote: >> Of course we cannot feasibly backport every new API in N to N-1, N-2 etc. In selective cases that might be possible, but for the core of the JDK it's like pulling on a string of public dependencies, internal dependencies and perhaps more subtle dependencies between javac and hotspot (Unsafe replacements would be particularly tricky). > > that why most of the tools like the retroweaver [1] rewrite bytecodes because you can replace a dependency to a JDK class to wire it to a class that will come with your code. > IIUC Retroweaver seemed to hit a sweet spot focusing on transforming language features and some minimal API features (i presume some lambda weaving tooling has/will hit a similar sweet spot, there is at least one but i cannot recall the name). It seems for APIs in general this may require more sophisticated code transformation techniques with additional non-core library support? > Note that in that case, you develop and maintain only one version of the code compatible with the newer version and backport the code to the old one, instead of selectively develop part of the code with the new version as you propose. > And either one publishes X JARs for each platform, or the consumer manages that themselves. Or one trusts this to work in some dynamic fashion. -- In my last email i forgot to point out that a tool (jar for example) that transforms a MVJAR into a platform specific JAR before being operated on by a byte code transforming tool may be a reasonable approach, but still requires some additional action. Paul. From vladimir.x.ivanov at oracle.com Wed Apr 15 15:55:24 2015 From: vladimir.x.ivanov at oracle.com (Vladimir Ivanov) Date: Wed, 15 Apr 2015 18:55:24 +0300 Subject: [9] RFR (M): 8057967: CallSite dependency tracking scales devastatingly poorly In-Reply-To: References: <551C5B92.8060500@oracle.com> <552527E1.5060102@oracle.com> Message-ID: <552E89EC.7080900@oracle.com> Roland, thanks for looking into the fix! You are right. I moved VM_ENTRY_MARK to the beginning of the method [1]. Updated webrev in place. http://cr.openjdk.java.net/~vlivanov/8057967/webrev.01/ Best regards, Vladimir Ivanov [1] diff --git a/src/share/vm/ci/ciCallSite.cpp b/src/share/vm/ci/ciCallSite.cpp --- a/src/share/vm/ci/ciCallSite.cpp +++ b/src/share/vm/ci/ciCallSite.cpp @@ -55,6 +55,8 @@ // Return the target MethodHandle of this CallSite. ciKlass* ciCallSite::get_context() { assert(!is_constant_call_site(), ""); + + VM_ENTRY_MARK; oop call_site_oop = get_oop(); InstanceKlass* ctxk = MethodHandles::get_call_site_context(call_site_oop); if (ctxk == NULL) { @@ -63,7 +65,6 @@ java_lang_invoke_CallSite::set_context_cas(call_site_oop, def_context_oop, /*expected=*/NULL); ctxk = MethodHandles::get_call_site_context(call_site_oop); } - VM_ENTRY_MARK; return (CURRENT_ENV->get_metadata(ctxk))->as_klass(); } On 4/15/15 1:16 PM, Roland Westrelin wrote: > Hi Vladimir, > >> http://cr.openjdk.java.net/~vlivanov/8057967/webrev.01/hotspot/ > > In ciCallSite::get_context(), is it safe to manipulate a raw oop the way you do it (with 2 different oops). Can?t it be moved concurrently by the GC? > > Roland. > >> http://cr.openjdk.java.net/~vlivanov/8057967/webrev.01/jdk/ >> >> Best regards, >> Vladimir Ivanov >> >> On 4/1/15 11:56 PM, Vladimir Ivanov wrote: >>> http://cr.openjdk.java.net/~vlivanov/8057967/webrev.00/hotspot/ >>> http://cr.openjdk.java.net/~vlivanov/8057967/webrev.00/jdk/ >>> https://bugs.openjdk.java.net/browse/JDK-8057967 >>> >>> HotSpot JITs inline very aggressively through CallSites. The >>> optimistically treat CallSite target as constant, but record a nmethod >>> dependency to invalidate the compiled code once CallSite target changes. >>> >>> Right now, such dependencies have call site class as a context. This >>> context is too coarse and it leads to context pollution: if some >>> CallSite target changes, VM needs to enumerate all nmethods which >>> depends on call sites of such type. >>> >>> As performance analysis in the bug report shows, it can sum to >>> significant amount of work. >>> >>> While working on the fix, I investigated 3 approaches: >>> (1) unique context per call site >>> (2) use CallSite target class >>> (3) use a class the CallSite instance is linked to >>> >>> Considering call sites are ubiquitous (e.g. 10,000s on some octane >>> benchmarks), loading a dedicated class for every call site is an >>> overkill (even VM anonymous). >>> >>> CallSite target class >>> (MethodHandle.form->LambdaForm.vmentry->MemberName.clazz->Class) is >>> also not satisfactory, since it is a compiled LambdaForm VM anonymous >>> class, which is heavily shared. It gets context pollution down, but >>> still the overhead is quite high. >>> >>> So, I decided to focus on (3) and ended up with a mixture of (2) & (3). >>> >>> Comparing to other options, the complications of (3) are: >>> - CallSite can stay unlinked (e.g. CallSite.dynamicInvoker()), so >>> there should be some default context VM can use >>> >>> - CallSite instances can be shared and it shouldn't keep the context >>> class from unloading; >>> >>> It motivated a scheme where CallSite context is initialized lazily and >>> can change during lifetime. When CallSite is linked with an indy >>> instruction, it's context is initialized. Usually, JIT sees CallSite >>> instances with initialized context (since it reaches them through indy), >>> but if it's not the case and there's no context yet, JIT sets it to >>> "default context", which means "use target call site". >>> >>> I introduced CallSite$DependencyContext, which represents a nmethod >>> dependency context and points (indirectly) to a Class used as a context. >>> >>> Context class is referenced through a phantom reference >>> (sun.misc.Cleaner to simplify cleanup). Though it's impossible to >>> extract referent using Reference.get(), VM can access it directly by >>> reading corresponding field. Unlike other types of references, phantom >>> references aren't cleared automatically. It allows VM to access context >>> class until cleanup is performed. And cleanup resets the context to >>> NULL, in addition to invalidating all relevant dependencies. >>> >>> There are 3 context states a CallSite instance can be in: >>> (1) NULL: no depedencies >>> (2) DependencyContext.DEFAULT_CONTEXT: dependencies are stored in >>> call site target class >>> (3) DependencyContext for some class: dependencies are stored on the >>> class DependencyContext instance points to >>> >>> Every CallSite starts w/o a context (1) and then lazily gets one ((2) or >>> (3) depending on the situation). >>> >>> State transitions: >>> (1->3): When a CallSite w/o a context (1) is linked with some indy >>> call site, it's owner is recorded as a context (3). >>> >>> (1->2): When JIT needs to record a dependency on a target of a >>> CallSite w/o a context(1), it sets the context to DEFAULT_CONTEXT and >>> uses target class to store the dependency. >>> >>> (3->1): When context class becomes unreachable, a cleanup hook >>> invalidates all dependencies on that CallSite and resets the context to >>> NULL (1). >>> >>> Only (3->1) requires dependency invalidation, because there are no >>> depedencies in (1) and (2->1) isn't performed. >>> >>> (1->3) is done in Java code (CallSite.initContext) and (1->2) is >>> performed in VM (ciCallSite::get_context()). The updates are performed >>> by CAS, so there's no need in additional synchronization. Other >>> operations on VM side are volatile (to play well with Java code) and >>> performed with Compile_lock held (to avoid races between VM operations). >>> >>> Some statistics: >>> Box2D, latest jdk9-dev >>> - CallSite instances: ~22000 >>> >>> - invalidated nmethods due to CallSite target changes: ~60 >>> >>> - checked call_site_target_value dependencies: >>> - before the fix: ~1,600,000 >>> - after the fix: ~600 >>> >>> Testing: >>> - dedicated test which excercises different state transitions >>> - jdk/java/lang/invoke, hotspot/test/compiler/jsr292, nashorn >>> >>> Thanks! >>> >>> Best regards, >>> Vladimir Ivanov > From alexander.v.stepanov at oracle.com Wed Apr 15 16:12:05 2015 From: alexander.v.stepanov at oracle.com (alexander stepanov) Date: Wed, 15 Apr 2015 19:12:05 +0300 Subject: RFR [9] 8077332: tidy warnings from javax/xml In-Reply-To: <552C08C2.4030503@oracle.com> References: <5527F132.80408@oracle.com> <552815F4.4050005@oracle.com> <552BA6FD.5000706@oracle.com> <552BABBA.6050903@oracle.com> <552C08C2.4030503@oracle.com> Message-ID: <552E8DD5.3080207@oracle.com> Hello Joe, The copyright changes were reverted. Please review the updated fix: http://cr.openjdk.java.net/~avstepan/8077332/webrev.01/ ("" replaced with "{@code}", removed unnecessary "

    ", used "@literal" tag). Thanks, Alexander On 13.04.2015 21:19, huizhe wang wrote: > > On 4/13/2015 4:42 AM, Alan Bateman wrote: >> On 13/04/2015 12:22, alexander stepanov wrote: >>> Hello Joe, >>> >>> Thank you for the notes; >>> >>> > Copyright year shall not be changed. >>> >>> That seems to be a bit controversial point; sometimes (while >>> cleaning docs) I was asked to do that, other times - not to do that. >>> Our internal policy seemingly assigns to change the 2nd date every >>> time the sources were touched (but that may be a question of >>> ambiguous interpretation). >>> >>> But of course I can easily revert these changes if you're totally >>> sure it should be done. >>> >> This has always been confusing. Some areas insist on updating the >> copyright dates, others don't. AFAIK, it has always been optional. I >> think the original assumption was that the update_copyright_year >> script (in the top-level repo) be run periodically to do bulk >> updates. Unfortunately that script doesn't seem to be run very often >> now and this strengthens the case to update the dates on a continuous >> basis. I have not come across the argument that html tidy tasks that >> don't change the javadoc should not update the copyright date. The >> general topic probably should move to jdk9-dev and get this decided >> once and documented in the developer guide. > > I think the key question to ask is: is this the code I can claim > Copyright with? To me, format, code style, html tags and other minor > changes, these are not code changes one can claim copyright with. > > The date of a Copyright establishes how far back the claim is made. In > case where the work is substantially revised, a new Copyright claim is > established, which is what the 2nd year is about. > > In this case, esp. for the JAXP API (e.g. javax.xml.datatype), I'd > like to see the years maintained because those are the years the API > was designed and modified. The "tidy warnings" change did not change > the API. > > -Joe > >> >> -Alan > From roland.westrelin at oracle.com Wed Apr 15 16:43:04 2015 From: roland.westrelin at oracle.com (Roland Westrelin) Date: Wed, 15 Apr 2015 18:43:04 +0200 Subject: [9] RFR (M): 8057967: CallSite dependency tracking scales devastatingly poorly In-Reply-To: <552E89EC.7080900@oracle.com> References: <551C5B92.8060500@oracle.com> <552527E1.5060102@oracle.com> <552E89EC.7080900@oracle.com> Message-ID: > http://cr.openjdk.java.net/~vlivanov/8057967/webrev.01/ That looks good to me. Roland. From Roger.Riggs at Oracle.com Wed Apr 15 16:50:07 2015 From: Roger.Riggs at Oracle.com (Roger Riggs) Date: Wed, 15 Apr 2015 12:50:07 -0400 Subject: [9] RFR of 8075156: (prefs) remove() should disallow the use of the null control character '\u0000' as key In-Reply-To: References: <6AECFBD9-492F-4EA4-B126-478F1B19D5AE@oracle.com> <5520414A.4000804@oracle.com> <21B0A029-9D57-445F-BE5F-5C0D03D7581D@oracle.com> <552D2BA9.2050306@Oracle.com> Message-ID: <552E96BF.5050008@Oracle.com> Hi Brian, Looks fine as is. But I'm curious why CODE_POINT_U000 is defined as String instead of char? The indexOf() operation is more efficient for single characters. Thanks, Roger On 4/14/2015 5:56 PM, Brian Burkhalter wrote: > Please review at your convenience this latest patch modified from the previous one pursuant to the most recent comments. > > Issue: https://bugs.openjdk.java.net/browse/JDK-8075156 > Patch: http://cr.openjdk.java.net/~bpb/8075156/webrev.01/ > > Summary: > > * Revise Preferences javadoc to indicate IAE for put*(), get*(), and remove() for NUL control character U+0000 in the key and / or value, as appropriate. > * Extend fix of put*() in JDK-8068373 to all platforms by moving functional code up to to AbstractPreferences. > * Add fix for get*() and remove() in AbstractPreferences. > * Revert FileSystemPreferences changes from JDK-8068373 as these are now handled by AbstractPreferences (note this includes rolling back the more recent year in the copyright as well). > * Minor picayune cleanup in WindowsPreferences. > * Correct class javadoc of AbstractPreferences which had referred to flush() and sync() as returning boolean type. > * Extend existing test to get() and remove() cases. > > Test passed on all the usual platforms. > > The CCC request will need to be revised or a new one filed, pending approval of this patch. > > Thanks, > > Brian > > On Apr 14, 2015, at 8:37 AM, Brian Burkhalter wrote: > >> So barring objections to the contrary from some other quarter, I will clean up the current patch and also address the errors in the class level javadoc that I pointed out in AbstractPreferences. From brian.burkhalter at oracle.com Wed Apr 15 17:08:27 2015 From: brian.burkhalter at oracle.com (Brian Burkhalter) Date: Wed, 15 Apr 2015 10:08:27 -0700 Subject: [9] RFR of 8075156: (prefs) remove() should disallow the use of the null control character '\u0000' as key In-Reply-To: <552E96BF.5050008@Oracle.com> References: <6AECFBD9-492F-4EA4-B126-478F1B19D5AE@oracle.com> <5520414A.4000804@oracle.com> <21B0A029-9D57-445F-BE5F-5C0D03D7581D@oracle.com> <552D2BA9.2050306@Oracle.com> <552E96BF.5050008@Oracle.com> Message-ID: <1285247E-541A-4211-8DCF-69A76B08C205@oracle.com> Hi Roger, On Apr 15, 2015, at 9:50 AM, Roger Riggs wrote: > Looks fine as is. Thanks for reviewing it. > But I'm curious why CODE_POINT_U000 is defined as String instead of char? > The indexOf() operation is more efficient for single characters. Probably because I had initially used contains(CharSequence) instead of indexOf(String) and when I changed the former to the latter I did not change the constant. I will modify this per your suggestion. Thanks, Brian From martinrb at google.com Wed Apr 15 17:59:03 2015 From: martinrb at google.com (Martin Buchholz) Date: Wed, 15 Apr 2015 10:59:03 -0700 Subject: SelectableChannels and Process API In-Reply-To: <552E05D3.3080807@gmail.com> References: <552E05D3.3080807@gmail.com> Message-ID: I was at least partly responsible for the pipe buffer cleanup code. Subprocess terminates, but may have written some data to the pipe buffer (typically 4k on Linux). Usually the pipe buffer is empty, but in case it's not, you don't want to lose the straggler data, you want to drain it and close the file descriptor, because it's easier to manage the memory than the fd. Messy, but I didn't see a better way. On Tue, Apr 14, 2015 at 11:31 PM, Peter Levart wrote: > Hi Roger, > > So I started new thread... > > > On 04/14/2015 11:33 PM, Roger Riggs wrote: > >> >> On 4/14/2015 11:47 AM, Peter Levart wrote: >> >>> I have been thinking of another small Process API update. Some people >>> find it odd how redirected in/out/err streams are exposed: >>> >>> http://blog.headius.com/2013/06/the-pain-of-broken-subprocess.html >>> >> yep, I've read that several times. >> > > To be fair, it's mostly, but not entirely correct. The part that says: > > " So when the child process exits, the any data waiting to be read from > its output stream is drained into a buffer. All of it. In memory. > > Did you launch a process that writes a gigabyte of data to its output > stream and then terminates? Well, friend, I sure hope you have a gigabyte > of memory, because the JDK is going to read that sucker in and there's > nothing you can do about it. And let's hope there's not more than 2GB of > data, since this code basically just grows a byte[], which in Java can only > grow to 2GB. If there's more than 2GB of data on that stream, this logic > errors out and the data is lost forever." > > ...is exaggeration. This does not happen as the pipe has a bounded buffer. > When subprocess exits, there is at most that much data left in the buffer > (64k typically) and only that much is sucked into the Java process and the > underlying handle closed. > > >>> They basically don't like: >>> >>> - that exposed Input/Output streams are buffered >>> - that underlying streams are File(Input/Output)Streams which, although >>> the backing OS implementation are not files but pipes, don't expose >>> selectable channels so that non-blocking event-based IO could be performed >>> on them. >>> - that exposed IO streams are automatically "managed" in UNIX variants >>> of ProcessImpl which needs subtle "hacks" to do it in a perceptively >>> transparent way (delayed close, draining input on exit and making it >>> available after the underlying handle is already closed, ...) >>> >>> So I've been playing with the idea of exposing the "real" pipe channels >>> in last couple of days. Here's the prototype I came up with: >>> >>> http://cr.openjdk.java.net/~plevart/jdk9-sandbox/JDK- >>> 8046092-branch/Process.PipeChannel/webrev.01/ >>> >>> This adds new Redirect type to the API and 3 new methods to Process that >>> return Pipe channels when this new Redirect type is used. It's interesting >>> that no native code changes were necessary. The behavior of pipes on >>> Windows is a little different (perhaps because the Pipe NIO API uses >>> sockets under the hood on Windows - why is that? Windows does have a pipe >>> equivalent). What bothers me is that file handles opened on files (when >>> redirecting to/from File) can be closed as soon as the subprocess is >>> started and the subprocess is still able to read/write from the files (like >>> with UNIX). It's not the same with pipe (i.e. socket) handles on Windows. >>> They must be closed only after subprocess exits. >>> >>> If this subtle difference between file handles and socket handles on >>> Windows could be dealt with (perhaps some options exist that affect >>> subprocess spawning), then the extra waiting thread would not be needed on >>> Windows. >>> >>> So what do you think of this API update? >>> >> Definitely worthy of a separate thread. It looks promising and addresses >> some of the issues >> raised, while moving other problems from the implementation to the >> application. >> Such as closing of the channels and cleanup. I worry about how the >> resources are freed >> if the code spawning the app doesn't do the cleanup. Will it require >> hooks (like a finalizer) >> to do the cleanup? >> Also, it doesn't help with Martin's goal of being able to implement >> emacs in Java since it doesn't provide pty control. >> As you are aware the complexity in Process is to ensure a timely cleanup >> and >> allowing the Process to terminate and release the process resources >> when it was done and not having to wait for the stdout/stderr consumer. >> > > I wonder how this automatic stream cleanup really helps in real-world > programs. It doesn't help the Process to terminate and release the process > resources any sooner as the process terminates on it's own (unless killed) > and OS releases it's resources without the outside help anyway. Draining > and closing the stream after the process has already exited just releases > one file handle (the consuming side of the pipe) in a promptly manner. This > could be left to the user and/or finalizer. Draining after the process has > already exited does not help the process to exit any sooner as it happens > after the fact. A program that doesn't consume the stream can cause the > process to hang forever as the pipe's buffer is bounded (64k typically). So > draining and closing after the process has exited only potentially helps > for the last 64k of the stream and only to release one file handle in a > potentially more timely manner. > > OTOH now that ProcessImpl for UNIX does that (and why does Windows > implementation not do that?) sloppy programs might exist that would > potentially break if the status quo is not maintained. > > But new functionality need not be so permissive. I'll take a look at how > and if Channel(s) do any kind of automatic cleanup based on reachability > and whether this can be bolted on for Process use. I doubt it is possible > to drain and close a Channel without disturbing the ongoing Selector IO > processing... > > Regards, Peter > > >> Thanks, Roger >> >> >> > From Roger.Riggs at Oracle.com Wed Apr 15 18:11:45 2015 From: Roger.Riggs at Oracle.com (Roger Riggs) Date: Wed, 15 Apr 2015 14:11:45 -0400 Subject: SelectableChannels and Process API In-Reply-To: <552E05D3.3080807@gmail.com> References: <552E05D3.3080807@gmail.com> Message-ID: <552EA9E1.2060600@Oracle.com> Hi Peter, I don't know the history behind the stream draining in ProcessImpl. I understood it to be a performance/scalability issue. Maybe Martin, Alan, or someone else can fill in the history. Roger On 4/15/2015 2:31 AM, Peter Levart wrote: > Hi Roger, > > So I started new thread... > > > On 04/14/2015 11:33 PM, Roger Riggs wrote: >> >> On 4/14/2015 11:47 AM, Peter Levart wrote: >>> I have been thinking of another small Process API update. Some >>> people find it odd how redirected in/out/err streams are exposed: >>> >>> http://blog.headius.com/2013/06/the-pain-of-broken-subprocess.html >> yep, I've read that several times. > > To be fair, it's mostly, but not entirely correct. The part that says: > > " So when the child process exits, the any data waiting to be read > from its output stream is drained into a buffer. All of it. In memory. > > Did you launch a process that writes a gigabyte of data to its output > stream and then terminates? Well, friend, I sure hope you have a > gigabyte of memory, because the JDK is going to read that sucker in > and there's nothing you can do about it. And let's hope there's not > more than 2GB of data, since this code basically just grows a byte[], > which in Java can only grow to 2GB. If there's more than 2GB of data > on that stream, this logic errors out and the data is lost forever." > > ...is exaggeration. This does not happen as the pipe has a bounded > buffer. When subprocess exits, there is at most that much data left in > the buffer (64k typically) and only that much is sucked into the Java > process and the underlying handle closed. > >>> >>> They basically don't like: >>> >>> - that exposed Input/Output streams are buffered >>> - that underlying streams are File(Input/Output)Streams which, >>> although the backing OS implementation are not files but pipes, >>> don't expose selectable channels so that non-blocking event-based IO >>> could be performed on them. >>> - that exposed IO streams are automatically "managed" in UNIX >>> variants of ProcessImpl which needs subtle "hacks" to do it in a >>> perceptively transparent way (delayed close, draining input on exit >>> and making it available after the underlying handle is already >>> closed, ...) >>> >>> So I've been playing with the idea of exposing the "real" pipe >>> channels in last couple of days. Here's the prototype I came up with: >>> >>> http://cr.openjdk.java.net/~plevart/jdk9-sandbox/JDK-8046092-branch/Process.PipeChannel/webrev.01/ >>> >>> >>> This adds new Redirect type to the API and 3 new methods to Process >>> that return Pipe channels when this new Redirect type is used. It's >>> interesting that no native code changes were necessary. The behavior >>> of pipes on Windows is a little different (perhaps because the Pipe >>> NIO API uses sockets under the hood on Windows - why is that? >>> Windows does have a pipe equivalent). What bothers me is that file >>> handles opened on files (when redirecting to/from File) can be >>> closed as soon as the subprocess is started and the subprocess is >>> still able to read/write from the files (like with UNIX). It's not >>> the same with pipe (i.e. socket) handles on Windows. They must be >>> closed only after subprocess exits. >>> >>> If this subtle difference between file handles and socket handles on >>> Windows could be dealt with (perhaps some options exist that affect >>> subprocess spawning), then the extra waiting thread would not be >>> needed on Windows. >>> >>> So what do you think of this API update? >> Definitely worthy of a separate thread. It looks promising and >> addresses some of the issues >> raised, while moving other problems from the implementation to the >> application. >> Such as closing of the channels and cleanup. I worry about how the >> resources are freed >> if the code spawning the app doesn't do the cleanup. Will it require >> hooks (like a finalizer) >> to do the cleanup? >> Also, it doesn't help with Martin's goal of being able to implement >> emacs in Java since it doesn't provide pty control. >> As you are aware the complexity in Process is to ensure a timely >> cleanup and >> allowing the Process to terminate and release the process resources >> when it was done and not having to wait for the stdout/stderr consumer. > > I wonder how this automatic stream cleanup really helps in real-world > programs. It doesn't help the Process to terminate and release the > process resources any sooner as the process terminates on it's own > (unless killed) and OS releases it's resources without the outside > help anyway. Draining and closing the stream after the process has > already exited just releases one file handle (the consuming side of > the pipe) in a promptly manner. This could be left to the user and/or > finalizer. Draining after the process has already exited does not help > the process to exit any sooner as it happens after the fact. A program > that doesn't consume the stream can cause the process to hang forever > as the pipe's buffer is bounded (64k typically). So draining and > closing after the process has exited only potentially helps for the > last 64k of the stream and only to release one file handle in a > potentially more timely manner. > > OTOH now that ProcessImpl for UNIX does that (and why does Windows > implementation not do that?) sloppy programs might exist that would > potentially break if the status quo is not maintained. I think Windows use of handles makes sure they are open for as long as any process holds a handle, so they don't get prematurely closed. > > But new functionality need not be so permissive. I'll take a look at > how and if Channel(s) do any kind of automatic cleanup based on > reachability and whether this can be bolted on for Process use. I > doubt it is possible to drain and close a Channel without disturbing > the ongoing Selector IO processing... > > Regards, Peter > >> >> Thanks, Roger >> >> > From Roger.Riggs at Oracle.com Wed Apr 15 18:14:58 2015 From: Roger.Riggs at Oracle.com (Roger Riggs) Date: Wed, 15 Apr 2015 14:14:58 -0400 Subject: SelectableChannels and Process API In-Reply-To: References: <552E05D3.3080807@gmail.com> Message-ID: <552EAAA2.2010109@Oracle.com> Hi Martin, That sounds like finalization of the FileDescriptor, but perhaps a mechanism built on PhantomRef would be easier enough to maintain and can leave the data in the pipe. Roger On 4/15/2015 1:59 PM, Martin Buchholz wrote: > I was at least partly responsible for the pipe buffer cleanup code. > > Subprocess terminates, but may have written some data to the pipe > buffer (typically 4k on Linux). Usually the pipe buffer is empty, but > in case it's not, you don't want to lose the straggler data, you want > to drain it and close the file descriptor, because it's easier to > manage the memory than the fd. Messy, but I didn't see a better way. > > On Tue, Apr 14, 2015 at 11:31 PM, Peter Levart > wrote: > > Hi Roger, > > So I started new thread... > > > On 04/14/2015 11:33 PM, Roger Riggs wrote: > > > On 4/14/2015 11:47 AM, Peter Levart wrote: > > I have been thinking of another small Process API update. > Some people find it odd how redirected in/out/err streams > are exposed: > > http://blog.headius.com/2013/06/the-pain-of-broken-subprocess.html > > yep, I've read that several times. > > > To be fair, it's mostly, but not entirely correct. The part that says: > > " So when the child process exits, the any data waiting to be read > from its output stream is drained into a buffer. All of it. In memory. > > Did you launch a process that writes a gigabyte of data to its > output stream and then terminates? Well, friend, I sure hope you > have a gigabyte of memory, because the JDK is going to read that > sucker in and there's nothing you can do about it. And let's hope > there's not more than 2GB of data, since this code basically just > grows a byte[], which in Java can only grow to 2GB. If there's > more than 2GB of data on that stream, this logic errors out and > the data is lost forever." > > ...is exaggeration. This does not happen as the pipe has a bounded > buffer. When subprocess exits, there is at most that much data > left in the buffer (64k typically) and only that much is sucked > into the Java process and the underlying handle closed. > > > They basically don't like: > > - that exposed Input/Output streams are buffered > - that underlying streams are File(Input/Output)Streams > which, although the backing OS implementation are not > files but pipes, don't expose selectable channels so that > non-blocking event-based IO could be performed on them. > - that exposed IO streams are automatically "managed" in > UNIX variants of ProcessImpl which needs subtle "hacks" to > do it in a perceptively transparent way (delayed close, > draining input on exit and making it available after the > underlying handle is already closed, ...) > > So I've been playing with the idea of exposing the "real" > pipe channels in last couple of days. Here's the prototype > I came up with: > > http://cr.openjdk.java.net/~plevart/jdk9-sandbox/JDK-8046092-branch/Process.PipeChannel/webrev.01/ > > > > This adds new Redirect type to the API and 3 new methods > to Process that return Pipe channels when this new > Redirect type is used. It's interesting that no native > code changes were necessary. The behavior of pipes on > Windows is a little different (perhaps because the Pipe > NIO API uses sockets under the hood on Windows - why is > that? Windows does have a pipe equivalent). What bothers > me is that file handles opened on files (when redirecting > to/from File) can be closed as soon as the subprocess is > started and the subprocess is still able to read/write > from the files (like with UNIX). It's not the same with > pipe (i.e. socket) handles on Windows. They must be closed > only after subprocess exits. > > If this subtle difference between file handles and socket > handles on Windows could be dealt with (perhaps some > options exist that affect subprocess spawning), then the > extra waiting thread would not be needed on Windows. > > So what do you think of this API update? > > Definitely worthy of a separate thread. It looks promising > and addresses some of the issues > raised, while moving other problems from the implementation to > the application. > Such as closing of the channels and cleanup. I worry about > how the resources are freed > if the code spawning the app doesn't do the cleanup. Will it > require hooks (like a finalizer) > to do the cleanup? > Also, it doesn't help with Martin's goal of being able to > implement > emacs in Java since it doesn't provide pty control. > As you are aware the complexity in Process is to ensure a > timely cleanup and > allowing the Process to terminate and release the process > resources > when it was done and not having to wait for the stdout/stderr > consumer. > > > I wonder how this automatic stream cleanup really helps in > real-world programs. It doesn't help the Process to terminate and > release the process resources any sooner as the process terminates > on it's own (unless killed) and OS releases it's resources without > the outside help anyway. Draining and closing the stream after the > process has already exited just releases one file handle (the > consuming side of the pipe) in a promptly manner. This could be > left to the user and/or finalizer. Draining after the process has > already exited does not help the process to exit any sooner as it > happens after the fact. A program that doesn't consume the stream > can cause the process to hang forever as the pipe's buffer is > bounded (64k typically). So draining and closing after the process > has exited only potentially helps for the last 64k of the stream > and only to release one file handle in a potentially more timely > manner. > > OTOH now that ProcessImpl for UNIX does that (and why does Windows > implementation not do that?) sloppy programs might exist that > would potentially break if the status quo is not maintained. > > But new functionality need not be so permissive. I'll take a look > at how and if Channel(s) do any kind of automatic cleanup based on > reachability and whether this can be bolted on for Process use. I > doubt it is possible to drain and close a Channel without > disturbing the ongoing Selector IO processing... > > Regards, Peter > > > Thanks, Roger > > > > From brian.burkhalter at oracle.com Wed Apr 15 18:41:49 2015 From: brian.burkhalter at oracle.com (Brian Burkhalter) Date: Wed, 15 Apr 2015 11:41:49 -0700 Subject: [9] RFR of 8075156: (prefs) remove() should disallow the use of the null control character '\u0000' as key In-Reply-To: <1285247E-541A-4211-8DCF-69A76B08C205@oracle.com> References: <6AECFBD9-492F-4EA4-B126-478F1B19D5AE@oracle.com> <5520414A.4000804@oracle.com> <21B0A029-9D57-445F-BE5F-5C0D03D7581D@oracle.com> <552D2BA9.2050306@Oracle.com> <552E96BF.5050008@Oracle.com> <1285247E-541A-4211-8DCF-69A76B08C205@oracle.com> Message-ID: <9D79D3BD-01DE-476E-AE7F-040BAB525043@oracle.com> Updated and hopefully final patch here: http://cr.openjdk.java.net/~bpb/8075156/webrev.02/ Test run in progress. Barring any objections I assume that changing CODE_POINT_U0000 from a String to an int does not require another Reviewer approval, so I will go ahead and push the fix after the yet to be refreshed CCC request is approved, if it is. Thanks, Brian On Apr 15, 2015, at 10:08 AM, Brian Burkhalter wrote: >> But I'm curious why CODE_POINT_U000 is defined as String instead of char? >> The indexOf() operation is more efficient for single characters. > > Probably because I had initially used contains(CharSequence) instead of indexOf(String) and when I changed the former to the latter I did not change the constant. I will modify this per your suggestion. From Roger.Riggs at Oracle.com Wed Apr 15 18:53:46 2015 From: Roger.Riggs at Oracle.com (Roger Riggs) Date: Wed, 15 Apr 2015 14:53:46 -0400 Subject: [9] RFR of 8075156: (prefs) remove() should disallow the use of the null control character '\u0000' as key In-Reply-To: <9D79D3BD-01DE-476E-AE7F-040BAB525043@oracle.com> References: <6AECFBD9-492F-4EA4-B126-478F1B19D5AE@oracle.com> <5520414A.4000804@oracle.com> <21B0A029-9D57-445F-BE5F-5C0D03D7581D@oracle.com> <552D2BA9.2050306@Oracle.com> <552E96BF.5050008@Oracle.com> <1285247E-541A-4211-8DCF-69A76B08C205@oracle.com> <9D79D3BD-01DE-476E-AE7F-040BAB525043@oracle.com> Message-ID: <552EB3BA.3040807@Oracle.com> Hi Brian, Looks fine to me. Thanks, Roger On 4/15/2015 2:41 PM, Brian Burkhalter wrote: > Updated and hopefully final patch here: > > http://cr.openjdk.java.net/~bpb/8075156/webrev.02/ > > Test run in progress. > > Barring any objections I assume that changing CODE_POINT_U0000 from a String to an int does not require another Reviewer approval, so I will go ahead and push the fix after the yet to be refreshed CCC request is approved, if it is. > > Thanks, > > Brian > > On Apr 15, 2015, at 10:08 AM, Brian Burkhalter wrote: > >>> But I'm curious why CODE_POINT_U000 is defined as String instead of char? >>> The indexOf() operation is more efficient for single characters. >> Probably because I had initially used contains(CharSequence) instead of indexOf(String) and when I changed the former to the latter I did not change the constant. I will modify this per your suggestion. From huizhe.wang at oracle.com Wed Apr 15 19:23:33 2015 From: huizhe.wang at oracle.com (huizhe wang) Date: Wed, 15 Apr 2015 12:23:33 -0700 Subject: RFR (JAXP): 8042244 : Re-examine the supportedness of non-SE org.w3c.dom.** API Message-ID: <552EBAB5.504@oracle.com> Please review the change related to the non-SE org.w3c.dom.** API: org.w3c.dom.css, org.w3c.dom.html, org.w3c.dom.stylesheets, org.w3c.dom.xpath. They came into Java SE along with the DOM API, but were not part of the Java SE and JAXP specification. For css, html and stylesheets, there is no implementation in the Java SE, while for xpath, an experimental one. These types should not be exported through the java.xml module. Considering that there are references to them, we're moving them into a JDK module called jdk.xml.dom. The experimental DOM 3 XPath thus is no longer available through the DOM API (DOMImplementation). Please review: JAXP change: http://cr.openjdk.java.net/~joehw/jdk9/8042244/webrev/ module.xml: http://cr.openjdk.java.net/~joehw/jdk9/8042244/jdk/webrev/ JBS: 8042244 : Re-examine the supportedness of non-SE org.w3c.dom.** API Thanks, Joe From peter.levart at gmail.com Wed Apr 15 19:31:18 2015 From: peter.levart at gmail.com (Peter Levart) Date: Wed, 15 Apr 2015 21:31:18 +0200 Subject: SelectableChannels and Process API In-Reply-To: References: <552E05D3.3080807@gmail.com> Message-ID: <552EBC86.7040903@gmail.com> On 04/15/2015 07:59 PM, Martin Buchholz wrote: > I was at least partly responsible for the pipe buffer cleanup code. > > Subprocess terminates, but may have written some data to the pipe > buffer (typically 4k on Linux). Usually the pipe buffer is empty, but > in case it's not, you don't want to lose the straggler data, you want > to drain it and close the file descriptor, because it's easier to > manage the memory than the fd. Messy, but I didn't see a better way. But the data would stay there (in the pipe's buffer) until it is read by the user. The producing end of pipe may already be closed, but the consuming end is still open. You would just have to keep the file descriptor open and let user drain and close it (or leave it to FileInputStream finalizer to close it). Yes, a file descriptor will be potentially open some more time, but you wouldn't loose any data. That's how Windows implementation works, I think. There's not reaper thread in Windows that would trigger asynchronous actions when subprocess exits. Regards, Peter > > On Tue, Apr 14, 2015 at 11:31 PM, Peter Levart > wrote: > > Hi Roger, > > So I started new thread... > > > On 04/14/2015 11:33 PM, Roger Riggs wrote: > > > On 4/14/2015 11:47 AM, Peter Levart wrote: > > I have been thinking of another small Process API update. > Some people find it odd how redirected in/out/err streams > are exposed: > > http://blog.headius.com/2013/06/the-pain-of-broken-subprocess.html > > yep, I've read that several times. > > > To be fair, it's mostly, but not entirely correct. The part that says: > > " So when the child process exits, the any data waiting to be read > from its output stream is drained into a buffer. All of it. In memory. > > Did you launch a process that writes a gigabyte of data to its > output stream and then terminates? Well, friend, I sure hope you > have a gigabyte of memory, because the JDK is going to read that > sucker in and there's nothing you can do about it. And let's hope > there's not more than 2GB of data, since this code basically just > grows a byte[], which in Java can only grow to 2GB. If there's > more than 2GB of data on that stream, this logic errors out and > the data is lost forever." > > ...is exaggeration. This does not happen as the pipe has a bounded > buffer. When subprocess exits, there is at most that much data > left in the buffer (64k typically) and only that much is sucked > into the Java process and the underlying handle closed. > > > They basically don't like: > > - that exposed Input/Output streams are buffered > - that underlying streams are File(Input/Output)Streams > which, although the backing OS implementation are not > files but pipes, don't expose selectable channels so that > non-blocking event-based IO could be performed on them. > - that exposed IO streams are automatically "managed" in > UNIX variants of ProcessImpl which needs subtle "hacks" to > do it in a perceptively transparent way (delayed close, > draining input on exit and making it available after the > underlying handle is already closed, ...) > > So I've been playing with the idea of exposing the "real" > pipe channels in last couple of days. Here's the prototype > I came up with: > > http://cr.openjdk.java.net/~plevart/jdk9-sandbox/JDK-8046092-branch/Process.PipeChannel/webrev.01/ > > > > This adds new Redirect type to the API and 3 new methods > to Process that return Pipe channels when this new > Redirect type is used. It's interesting that no native > code changes were necessary. The behavior of pipes on > Windows is a little different (perhaps because the Pipe > NIO API uses sockets under the hood on Windows - why is > that? Windows does have a pipe equivalent). What bothers > me is that file handles opened on files (when redirecting > to/from File) can be closed as soon as the subprocess is > started and the subprocess is still able to read/write > from the files (like with UNIX). It's not the same with > pipe (i.e. socket) handles on Windows. They must be closed > only after subprocess exits. > > If this subtle difference between file handles and socket > handles on Windows could be dealt with (perhaps some > options exist that affect subprocess spawning), then the > extra waiting thread would not be needed on Windows. > > So what do you think of this API update? > > Definitely worthy of a separate thread. It looks promising > and addresses some of the issues > raised, while moving other problems from the implementation to > the application. > Such as closing of the channels and cleanup. I worry about > how the resources are freed > if the code spawning the app doesn't do the cleanup. Will it > require hooks (like a finalizer) > to do the cleanup? > Also, it doesn't help with Martin's goal of being able to > implement > emacs in Java since it doesn't provide pty control. > As you are aware the complexity in Process is to ensure a > timely cleanup and > allowing the Process to terminate and release the process > resources > when it was done and not having to wait for the stdout/stderr > consumer. > > > I wonder how this automatic stream cleanup really helps in > real-world programs. It doesn't help the Process to terminate and > release the process resources any sooner as the process terminates > on it's own (unless killed) and OS releases it's resources without > the outside help anyway. Draining and closing the stream after the > process has already exited just releases one file handle (the > consuming side of the pipe) in a promptly manner. This could be > left to the user and/or finalizer. Draining after the process has > already exited does not help the process to exit any sooner as it > happens after the fact. A program that doesn't consume the stream > can cause the process to hang forever as the pipe's buffer is > bounded (64k typically). So draining and closing after the process > has exited only potentially helps for the last 64k of the stream > and only to release one file handle in a potentially more timely > manner. > > OTOH now that ProcessImpl for UNIX does that (and why does Windows > implementation not do that?) sloppy programs might exist that > would potentially break if the status quo is not maintained. > > But new functionality need not be so permissive. I'll take a look > at how and if Channel(s) do any kind of automatic cleanup based on > reachability and whether this can be bolted on for Process use. I > doubt it is possible to drain and close a Channel without > disturbing the ongoing Selector IO processing... > > Regards, Peter > > > Thanks, Roger > > > > From martinrb at google.com Wed Apr 15 19:54:34 2015 From: martinrb at google.com (Martin Buchholz) Date: Wed, 15 Apr 2015 12:54:34 -0700 Subject: SelectableChannels and Process API In-Reply-To: <552EBC86.7040903@gmail.com> References: <552E05D3.3080807@gmail.com> <552EBC86.7040903@gmail.com> Message-ID: I have internalized the idea that finalization is a method of last resort. If there's a chance to free some OS resource by doing some work NOW, do it, and don't leave it for a finalizer to do later. On Wed, Apr 15, 2015 at 12:31 PM, Peter Levart wrote: > > > On 04/15/2015 07:59 PM, Martin Buchholz wrote: > > I was at least partly responsible for the pipe buffer cleanup code. > > Subprocess terminates, but may have written some data to the pipe buffer > (typically 4k on Linux). Usually the pipe buffer is empty, but in case > it's not, you don't want to lose the straggler data, you want to drain it > and close the file descriptor, because it's easier to manage the memory > than the fd. Messy, but I didn't see a better way. > > > But the data would stay there (in the pipe's buffer) until it is read by > the user. The producing end of pipe may already be closed, but the > consuming end is still open. You would just have to keep the file > descriptor open and let user drain and close it (or leave it to > FileInputStream finalizer to close it). Yes, a file descriptor will be > potentially open some more time, but you wouldn't loose any data. That's > how Windows implementation works, I think. There's not reaper thread in > Windows that would trigger asynchronous actions when subprocess exits. > > Regards, Peter > > > > On Tue, Apr 14, 2015 at 11:31 PM, Peter Levart > wrote: > >> Hi Roger, >> >> So I started new thread... >> >> >> On 04/14/2015 11:33 PM, Roger Riggs wrote: >> >>> >>> On 4/14/2015 11:47 AM, Peter Levart wrote: >>> >>>> I have been thinking of another small Process API update. Some people >>>> find it odd how redirected in/out/err streams are exposed: >>>> >>>> http://blog.headius.com/2013/06/the-pain-of-broken-subprocess.html >>>> >>> yep, I've read that several times. >>> >> >> To be fair, it's mostly, but not entirely correct. The part that says: >> >> " So when the child process exits, the any data waiting to be read from >> its output stream is drained into a buffer. All of it. In memory. >> >> Did you launch a process that writes a gigabyte of data to its output >> stream and then terminates? Well, friend, I sure hope you have a gigabyte >> of memory, because the JDK is going to read that sucker in and there's >> nothing you can do about it. And let's hope there's not more than 2GB of >> data, since this code basically just grows a byte[], which in Java can only >> grow to 2GB. If there's more than 2GB of data on that stream, this logic >> errors out and the data is lost forever." >> >> ...is exaggeration. This does not happen as the pipe has a bounded >> buffer. When subprocess exits, there is at most that much data left in the >> buffer (64k typically) and only that much is sucked into the Java process >> and the underlying handle closed. >> >> >>>> They basically don't like: >>>> >>>> - that exposed Input/Output streams are buffered >>>> - that underlying streams are File(Input/Output)Streams which, although >>>> the backing OS implementation are not files but pipes, don't expose >>>> selectable channels so that non-blocking event-based IO could be performed >>>> on them. >>>> - that exposed IO streams are automatically "managed" in UNIX variants >>>> of ProcessImpl which needs subtle "hacks" to do it in a perceptively >>>> transparent way (delayed close, draining input on exit and making it >>>> available after the underlying handle is already closed, ...) >>>> >>>> So I've been playing with the idea of exposing the "real" pipe channels >>>> in last couple of days. Here's the prototype I came up with: >>>> >>>> >>>> http://cr.openjdk.java.net/~plevart/jdk9-sandbox/JDK-8046092-branch/Process.PipeChannel/webrev.01/ >>>> >>>> This adds new Redirect type to the API and 3 new methods to Process >>>> that return Pipe channels when this new Redirect type is used. It's >>>> interesting that no native code changes were necessary. The behavior of >>>> pipes on Windows is a little different (perhaps because the Pipe NIO API >>>> uses sockets under the hood on Windows - why is that? Windows does have a >>>> pipe equivalent). What bothers me is that file handles opened on files >>>> (when redirecting to/from File) can be closed as soon as the subprocess is >>>> started and the subprocess is still able to read/write from the files (like >>>> with UNIX). It's not the same with pipe (i.e. socket) handles on Windows. >>>> They must be closed only after subprocess exits. >>>> >>>> If this subtle difference between file handles and socket handles on >>>> Windows could be dealt with (perhaps some options exist that affect >>>> subprocess spawning), then the extra waiting thread would not be needed on >>>> Windows. >>>> >>>> So what do you think of this API update? >>>> >>> Definitely worthy of a separate thread. It looks promising and >>> addresses some of the issues >>> raised, while moving other problems from the implementation to the >>> application. >>> Such as closing of the channels and cleanup. I worry about how the >>> resources are freed >>> if the code spawning the app doesn't do the cleanup. Will it require >>> hooks (like a finalizer) >>> to do the cleanup? >>> Also, it doesn't help with Martin's goal of being able to implement >>> emacs in Java since it doesn't provide pty control. >>> As you are aware the complexity in Process is to ensure a timely cleanup >>> and >>> allowing the Process to terminate and release the process resources >>> when it was done and not having to wait for the stdout/stderr consumer. >>> >> >> I wonder how this automatic stream cleanup really helps in real-world >> programs. It doesn't help the Process to terminate and release the process >> resources any sooner as the process terminates on it's own (unless killed) >> and OS releases it's resources without the outside help anyway. Draining >> and closing the stream after the process has already exited just releases >> one file handle (the consuming side of the pipe) in a promptly manner. This >> could be left to the user and/or finalizer. Draining after the process has >> already exited does not help the process to exit any sooner as it happens >> after the fact. A program that doesn't consume the stream can cause the >> process to hang forever as the pipe's buffer is bounded (64k typically). So >> draining and closing after the process has exited only potentially helps >> for the last 64k of the stream and only to release one file handle in a >> potentially more timely manner. >> >> OTOH now that ProcessImpl for UNIX does that (and why does Windows >> implementation not do that?) sloppy programs might exist that would >> potentially break if the status quo is not maintained. >> >> But new functionality need not be so permissive. I'll take a look at how >> and if Channel(s) do any kind of automatic cleanup based on reachability >> and whether this can be bolted on for Process use. I doubt it is possible >> to drain and close a Channel without disturbing the ongoing Selector IO >> processing... >> >> Regards, Peter >> >> >>> Thanks, Roger >>> >>> >>> >> > > From Alan.Bateman at oracle.com Wed Apr 15 20:52:59 2015 From: Alan.Bateman at oracle.com (Alan Bateman) Date: Wed, 15 Apr 2015 21:52:59 +0100 Subject: RFR (JAXP): 8042244 : Re-examine the supportedness of non-SE org.w3c.dom.** API In-Reply-To: <552EBAB5.504@oracle.com> References: <552EBAB5.504@oracle.com> Message-ID: <552ECFAB.7070109@oracle.com> On 15/04/2015 20:23, huizhe wang wrote: > Please review the change related to the non-SE org.w3c.dom.** API: > org.w3c.dom.css, org.w3c.dom.html, org.w3c.dom.stylesheets, > org.w3c.dom.xpath. > > They came into Java SE along with the DOM API, but were not part of > the Java SE and JAXP specification. For css, html and stylesheets, > there is no implementation in the Java SE, while for xpath, an > experimental one. These types should not be exported through the > java.xml module. Considering that there are references to them, we're > moving them into a JDK module called jdk.xml.dom. The experimental DOM > 3 XPath thus is no longer available through the DOM API > (DOMImplementation). > > Please review: > JAXP change: > http://cr.openjdk.java.net/~joehw/jdk9/8042244/webrev/ > > module.xml: > http://cr.openjdk.java.net/~joehw/jdk9/8042244/jdk/webrev/ This looks okay to me and I think you have everything covered. I wonder if there is any scope to add a SUID to XPathException.java rather than suppressing the warning. -Alan From forax at univ-mlv.fr Wed Apr 15 21:00:06 2015 From: forax at univ-mlv.fr (Remi Forax) Date: Wed, 15 Apr 2015 23:00:06 +0200 Subject: JEP 238: Multi-Version JAR Files In-Reply-To: <1E8FE53C-AFCD-48D8-90D0-A0A88C57ED62@oracle.com> References: <553E75B2-C52C-4381-B769-7D3F84089643@oracle.com> <551A889C.1030309@ch.ibm.com> <552E537E.4030709@univ-mlv.fr> <1E8FE53C-AFCD-48D8-90D0-A0A88C57ED62@oracle.com> Message-ID: <552ED156.7090502@univ-mlv.fr> On 04/15/2015 02:59 PM, Paul Sandoz wrote: > On Apr 15, 2015, at 2:03 PM, Remi Forax wrote: >>> Of course we cannot feasibly backport every new API in N to N-1, N-2 etc. In selective cases that might be possible, but for the core of the JDK it's like pulling on a string of public dependencies, internal dependencies and perhaps more subtle dependencies between javac and hotspot (Unsafe replacements would be particularly tricky). >> that why most of the tools like the retroweaver [1] rewrite bytecodes because you can replace a dependency to a JDK class to wire it to a class that will come with your code. >> > IIUC Retroweaver seemed to hit a sweet spot focusing on transforming language features and some minimal API features (i presume some lambda weaving tooling has/will hit a similar sweet spot, there is at least one but i cannot recall the name). It's harder to write a rewriter from 1.8 to 1.7 because lambda means Stream and collection.stream() means default method which is hard to simulate just using bytecode rewriting (the only way I know is to use invokedynamic for that which is fun but will require a lot of testing). > > It seems for APIs in general this may require more sophisticated code transformation techniques with additional non-core library support? yes > > >> Note that in that case, you develop and maintain only one version of the code compatible with the newer version and backport the code to the old one, instead of selectively develop part of the code with the new version as you propose. >> > And either one publishes X JARs for each platform, or the consumer manages that themselves. Or one trusts this to work in some dynamic fashion. > > -- > > In my last email i forgot to point out that a tool (jar for example) that transforms a MVJAR into a platform specific JAR before being operated on by a byte code transforming tool may be a reasonable approach, but still requires some additional action. > > Paul. > R?mi From forax at univ-mlv.fr Wed Apr 15 21:24:10 2015 From: forax at univ-mlv.fr (Remi Forax) Date: Wed, 15 Apr 2015 23:24:10 +0200 Subject: JEP 238: Multi-Version JAR Files In-Reply-To: References: <553E75B2-C52C-4381-B769-7D3F84089643@oracle.com> <551A889C.1030309@ch.ibm.com> <552E525B.2030209@univ-mlv.fr> Message-ID: <552ED6FA.8050705@univ-mlv.fr> On 04/15/2015 02:44 PM, Paul Sandoz wrote: > Hi Remi, > > On Apr 15, 2015, at 1:58 PM, Remi Forax wrote: > >> Hi Paul, >> I think you're seriously underestimate the cost of this JEP. > That is why we are asking for feedback :-) I want to understand the impact and get some concrete reasons why certain aspects are difficult. > > >> You're asking Java devs to: >> - be able to maintain several codes with different source level compatibility in the same code tree. > Yes. Maintaining one code with a different source level than the installed JDK is still not fully solved, i.e. you still need to have either an old rt.jar or a kind of meta-description of it. This can be solved more easily with modules but we aren't yet there. > > >> - add a level of indirection in all tools that crawle/compile Java source code >> - add a level of indirection in all tools that crawle/rewrite bytecodes >> > How common is it to statically process the byte codes of a JAR file to produce a new JAR file as opposed to doing that dynamically at runtime? (I know of obfuscating tools, which IIRC were more commonly used for mobile?) From my experience, most of tools that do rewriting at runtime are able to do rewriting at compile time (or install time). > > Are processed JAR files then re-distributed via say maven or kept internally to be used with a specific stack? By example for ASM, we publish several artifacts from the same source, ones are 1.3 compatible (asm.jar), others are 1.5 compatibles (asm-all.jar). So users that run on embedded device can still use ASM. > > Would such tools process use the JarFile class to get access to the JAR file contents? either jar file or class files directly. > > >> all of that to support a feature that: >> - is not clearly defined > To me what is not clearly understood is the potential impact, where as the feature itself is actually fairly simple to grok. I agree, the idea is simple to grok, not it's perimeter. > > >> - is supposed to only solve cases where delta between versions is small > Yes, it's anticipated there would be a small number of classes that would require changing. > > >> - comes with no help from the JDK (how to detect a version, etc). >> > We can propose such things for 9. For example, new public methods to JarFile. There will be a public JDK version query API in 9, is that what you mean by "how to detect a version?", or do you mean how can one analyze an MVJAR? (or perhaps both...) How to analyze a MVJAR given that you usually have only one version of the JDK installed ? > > Paul. R?mi > > >> While I understand the comfort for the end user to have only one big fat jar, it would like to see a prototype that have good answers to all these questions before including it into the JDK. >> >> Said simply, tackling such problem requires a JSR not a JEP, because it's a feature which impact a large number of parts of the Java ecosystem. >> >> regards, >> R?mi From lance.andersen at oracle.com Wed Apr 15 21:26:21 2015 From: lance.andersen at oracle.com (Lance Andersen) Date: Wed, 15 Apr 2015 17:26:21 -0400 Subject: RFR (JAXP): 8042244 : Re-examine the supportedness of non-SE org.w3c.dom.** API In-Reply-To: <552EBAB5.504@oracle.com> References: <552EBAB5.504@oracle.com> Message-ID: Looks OK other than what Alan suggested which I would think we could add the SUID given it is in our code base. Please check DOMXPathTest as it looks like you were bit by netbeans formatting for the comment for test(). Same is true for some of the other classes where in some cases there is an empty line before the start of a method comment and others there is not (HTMLTableCellElement.java is an example). If you have time, it would be nice to be consistent, but I have seen netbeans to strange things when you format similar to what you are seeing (though I am not sure you are using netbeans) Best Lance On Apr 15, 2015, at 3:23 PM, huizhe wang wrote: > Please review the change related to the non-SE org.w3c.dom.** API: org.w3c.dom.css, org.w3c.dom.html, org.w3c.dom.stylesheets, org.w3c.dom.xpath. > > They came into Java SE along with the DOM API, but were not part of the Java SE and JAXP specification. For css, html and stylesheets, there is no implementation in the Java SE, while for xpath, an experimental one. These types should not be exported through the java.xml module. Considering that there are references to them, we're moving them into a JDK module called jdk.xml.dom. The experimental DOM 3 XPath thus is no longer available through the DOM API (DOMImplementation). > > Please review: > JAXP change: > http://cr.openjdk.java.net/~joehw/jdk9/8042244/webrev/ > > module.xml: > http://cr.openjdk.java.net/~joehw/jdk9/8042244/jdk/webrev/ > > JBS: 8042244 : Re-examine the supportedness of non-SE org.w3c.dom.** API > > Thanks, > Joe > > > Lance Andersen| Principal Member of Technical Staff | +1.781.442.2037 Oracle Java Engineering 1 Network Drive Burlington, MA 01803 Lance.Andersen at oracle.com From huizhe.wang at oracle.com Wed Apr 15 22:11:26 2015 From: huizhe.wang at oracle.com (huizhe wang) Date: Wed, 15 Apr 2015 15:11:26 -0700 Subject: RFR (JAXP): 8042244 : Re-examine the supportedness of non-SE org.w3c.dom.** API In-Reply-To: References: <552EBAB5.504@oracle.com> Message-ID: <552EE20E.3090601@oracle.com> Hi Alan, Lance, On 4/15/2015 2:26 PM, Lance Andersen wrote: > Looks OK other than what Alan suggested which I would think we could > add the SUID given it is in our code base. You guessed it right. It was the upstream source that was on my mind when I decided not to add a SUID. Yes, it's in our code base. But what if they later add a SUID? Ivan submitted a patch to this alias in which he tried to fix the serial warnings for the jaxp/bcel classes by adding SUIDs. However, the upstream BCEL had been updated with different SUIDs. So I thought it's safer to suppress the warning. I saw previous patches where serial warnings were suppressed instead of fixed with SUIDs. > > Please check DOMXPathTest as it looks like you were bit by netbeans > formatting for the comment for test(). Same is true for some of the > other classes where in some cases there is an empty line before the > start of a method comment and others there is not > (HTMLTableCellElement.java is an example). If you have time, it would > be nice to be consistent, but I have seen netbeans to strange things > when you format similar to what you are seeing (though I am not sure > you are using netbeans) I re-generated the webrev for DOMXPathTest. As for the DOM css/html/stylesheets/xpath classes, I wish to ask forgiveness :-) This is a quick move, short of remove. Theoretically, they could have been removed. So I thought it's probably not worth spending the time taking care of the formatting issues (old tags for that matter). Cheers, Joe > > Best > Lance > > > On Apr 15, 2015, at 3:23 PM, huizhe wang > wrote: > >> Please review the change related to the non-SE org.w3c.dom.** API: >> org.w3c.dom.css, org.w3c.dom.html, org.w3c.dom.stylesheets, >> org.w3c.dom.xpath. >> >> They came into Java SE along with the DOM API, but were not part of >> the Java SE and JAXP specification. For css, html and stylesheets, >> there is no implementation in the Java SE, while for xpath, an >> experimental one. These types should not be exported through the >> java.xml module. Considering that there are references to them, we're >> moving them into a JDK module called jdk.xml.dom. The experimental >> DOM 3 XPath thus is no longer available through the DOM API >> (DOMImplementation). >> >> Please review: >> JAXP change: >> http://cr.openjdk.java.net/~joehw/jdk9/8042244/webrev/ >> >> >> module.xml: >> http://cr.openjdk.java.net/~joehw/jdk9/8042244/jdk/webrev/ >> >> JBS: 8042244 : Re-examine the supportedness of non-SE org.w3c.dom.** >> API >> >> Thanks, >> Joe >> >> >> > > > > Lance > Andersen| Principal Member of Technical Staff | +1.781.442.2037 > Oracle Java Engineering > 1 Network Drive > Burlington, MA 01803 > Lance.Andersen at oracle.com > > > From lance.andersen at oracle.com Wed Apr 15 22:22:23 2015 From: lance.andersen at oracle.com (Lance Andersen) Date: Wed, 15 Apr 2015 18:22:23 -0400 Subject: RFR (JAXP): 8042244 : Re-examine the supportedness of non-SE org.w3c.dom.** API In-Reply-To: <552EE20E.3090601@oracle.com> References: <552EBAB5.504@oracle.com> <552EE20E.3090601@oracle.com> Message-ID: Hi Joe, On Apr 15, 2015, at 6:11 PM, huizhe wang wrote: > Hi Alan, Lance, > > On 4/15/2015 2:26 PM, Lance Andersen wrote: >> Looks OK other than what Alan suggested which I would think we could add the SUID given it is in our code base. > > You guessed it right. It was the upstream source that was on my mind when I decided not to add a SUID. Yes, it's in our code base. But what if they later add a SUID? Ivan submitted a patch to this alias in which he tried to fix the serial warnings for the jaxp/bcel classes by adding SUIDs. However, the upstream BCEL had been updated with different SUIDs. So I thought it's safer to suppress the warning. I saw previous patches where serial warnings were suppressed instead of fixed with SUIDs. They are adding SUIDs but not using the default SUID? That could cause some problems. I just went through an exercise with JMSException where the class was tweaked but did not have a SUID so the default value changed and caused failures in WLS resulting in a JMS MR to fix :-( Just something to watch over if nothing can be done in the short term. > >> >> Please check DOMXPathTest as it looks like you were bit by netbeans formatting for the comment for test(). Same is true for some of the other classes where in some cases there is an empty line before the start of a method comment and others there is not (HTMLTableCellElement.java is an example). If you have time, it would be nice to be consistent, but I have seen netbeans to strange things when you format similar to what you are seeing (though I am not sure you are using netbeans) > > I re-generated the webrev for DOMXPathTest. As for the DOM css/html/stylesheets/xpath classes, I wish to ask forgiveness :-) This is a quick move, short of remove. Theoretically, they could have been removed. So I thought it's probably not worth spending the time taking care of the formatting issues (old tags for that matter). This was not a big deal, I just wanted to point it out and let you decide. > > Cheers, > Joe > >> >> Best >> Lance >> >> >> On Apr 15, 2015, at 3:23 PM, huizhe wang wrote: >> >>> Please review the change related to the non-SE org.w3c.dom.** API: org.w3c.dom.css, org.w3c.dom.html, org.w3c.dom.stylesheets, org.w3c.dom.xpath. >>> >>> They came into Java SE along with the DOM API, but were not part of the Java SE and JAXP specification. For css, html and stylesheets, there is no implementation in the Java SE, while for xpath, an experimental one. These types should not be exported through the java.xml module. Considering that there are references to them, we're moving them into a JDK module called jdk.xml.dom. The experimental DOM 3 XPath thus is no longer available through the DOM API (DOMImplementation). >>> >>> Please review: >>> JAXP change: >>> http://cr.openjdk.java.net/~joehw/jdk9/8042244/webrev/ >>> >>> module.xml: >>> http://cr.openjdk.java.net/~joehw/jdk9/8042244/jdk/webrev/ >>> >>> JBS: 8042244 : Re-examine the supportedness of non-SE org.w3c.dom.** API >>> >>> Thanks, >>> Joe >>> >>> >>> >> >> >> >> Lance Andersen| Principal Member of Technical Staff | +1.781.442.2037 >> Oracle Java Engineering >> 1 Network Drive >> Burlington, MA 01803 >> Lance.Andersen at oracle.com >> >> >> > Lance Andersen| Principal Member of Technical Staff | +1.781.442.2037 Oracle Java Engineering 1 Network Drive Burlington, MA 01803 Lance.Andersen at oracle.com From joe.darcy at oracle.com Wed Apr 15 23:58:03 2015 From: joe.darcy at oracle.com (Joseph D. Darcy) Date: Wed, 15 Apr 2015 16:58:03 -0700 Subject: JEP 238: Multi-Version JAR Files In-Reply-To: <552ED6FA.8050705@univ-mlv.fr> References: <553E75B2-C52C-4381-B769-7D3F84089643@oracle.com> <551A889C.1030309@ch.ibm.com> <552E525B.2030209@univ-mlv.fr> <552ED6FA.8050705@univ-mlv.fr> Message-ID: <552EFB0B.3000601@oracle.com> Note that one possible feature of JDK 9 is a -platform N option to javac which would allow compiling against older versions of the platform libraries: JEP draft: Compile for Specific Platform Version http://openjdk.java.net/jeps/8058150 This feature would address some of the concerns raised below. -Joe On 4/15/2015 2:24 PM, Remi Forax wrote: > > On 04/15/2015 02:44 PM, Paul Sandoz wrote: >> Hi Remi, >> >> On Apr 15, 2015, at 1:58 PM, Remi Forax wrote: >> >>> Hi Paul, >>> I think you're seriously underestimate the cost of this JEP. >> That is why we are asking for feedback :-) I want to understand the >> impact and get some concrete reasons why certain aspects are difficult. >> >> >>> You're asking Java devs to: >>> - be able to maintain several codes with different source level >>> compatibility in the same code tree. >> Yes. > > Maintaining one code with a different source level than the installed > JDK is still not fully solved, > i.e. you still need to have either an old rt.jar or a kind of > meta-description of it. > This can be solved more easily with modules but we aren't yet there. > >> >> >>> - add a level of indirection in all tools that crawle/compile Java >>> source code >>> - add a level of indirection in all tools that crawle/rewrite bytecodes >>> >> How common is it to statically process the byte codes of a JAR file >> to produce a new JAR file as opposed to doing that dynamically at >> runtime? (I know of obfuscating tools, which IIRC were more commonly >> used for mobile?) > > From my experience, most of tools that do rewriting at runtime are > able to do rewriting at compile time > (or install time). > >> >> Are processed JAR files then re-distributed via say maven or kept >> internally to be used with a specific stack? > > By example for ASM, we publish several artifacts from the same source, > ones are 1.3 compatible (asm.jar), others are 1.5 compatibles > (asm-all.jar). So users that run on embedded device can still use ASM. > >> >> Would such tools process use the JarFile class to get access to the >> JAR file contents? > > either jar file or class files directly. > >> >> >>> all of that to support a feature that: >>> - is not clearly defined >> To me what is not clearly understood is the potential impact, where >> as the feature itself is actually fairly simple to grok. > > I agree, the idea is simple to grok, not it's perimeter. > >> >> >>> - is supposed to only solve cases where delta between versions is small >> Yes, it's anticipated there would be a small number of classes that >> would require changing. >> >> >>> - comes with no help from the JDK (how to detect a version, etc). >>> >> We can propose such things for 9. For example, new public methods to >> JarFile. There will be a public JDK version query API in 9, is that >> what you mean by "how to detect a version?", or do you mean how can >> one analyze an MVJAR? (or perhaps both...) > > How to analyze a MVJAR given that you usually have only one version of > the JDK installed ? > >> >> Paul. > > R?mi > >> >> >>> While I understand the comfort for the end user to have only one big >>> fat jar, it would like to see a prototype that have good answers to >>> all these questions before including it into the JDK. >>> >>> Said simply, tackling such problem requires a JSR not a JEP, because >>> it's a feature which impact a large number of parts of the Java >>> ecosystem. >>> >>> regards, >>> R?mi > From huizhe.wang at oracle.com Thu Apr 16 03:47:46 2015 From: huizhe.wang at oracle.com (huizhe wang) Date: Wed, 15 Apr 2015 20:47:46 -0700 Subject: RFR (JAXP): 8042244 : Re-examine the supportedness of non-SE org.w3c.dom.** API In-Reply-To: References: <552EBAB5.504@oracle.com> <552EE20E.3090601@oracle.com> Message-ID: <552F30E2.5060707@oracle.com> On 4/15/2015 3:22 PM, Lance Andersen wrote: > Hi Joe, > > On Apr 15, 2015, at 6:11 PM, huizhe wang > wrote: > >> Hi Alan, Lance, >> >> On 4/15/2015 2:26 PM, Lance Andersen wrote: >>> Looks OK other than what Alan suggested which I would think we could >>> add the SUID given it is in our code base. >> >> You guessed it right. It was the upstream source that was on my mind >> when I decided not to add a SUID. Yes, it's in our code base. But >> what if they later add a SUID? Ivan submitted a patch to this alias >> in which he tried to fix the serial warnings for the jaxp/bcel >> classes by adding SUIDs. However, the upstream BCEL had been updated >> with different SUIDs. So I thought it's safer to suppress the >> warning. I saw previous patches where serial warnings were suppressed >> instead of fixed with SUIDs. > > They are adding SUIDs but not using the default SUID? That could > cause some problems. I just went through an exercise with > JMSException where the class was tweaked but did not have a SUID so > the default value changed and caused failures in WLS resulting in a > JMS MR to fix :-( > > Just something to watch over if nothing can be done in the short term. I added the SUID. They are using the default. However, as I mentioned, they've upgraded to a new version. We can have more discussion on the topic of serialization compatibility offline. >> >>> >>> Please check DOMXPathTest as it looks like you were bit by netbeans >>> formatting for the comment for test(). Same is true for some of the >>> other classes where in some cases there is an empty line before the >>> start of a method comment and others there is not >>> (HTMLTableCellElement.java is an example). If you have time, it >>> would be nice to be consistent, but I have seen netbeans to strange >>> things when you format similar to what you are seeing (though I am >>> not sure you are using netbeans) >> >> I re-generated the webrev for DOMXPathTest. As for the DOM >> css/html/stylesheets/xpath classes, I wish to ask forgiveness :-) >> This is a quick move, short of remove. Theoretically, they could have >> been removed. So I thought it's probably not worth spending the time >> taking care of the formatting issues (old tags for that matter). > > This was not a big deal, I just wanted to point it out and let you decide. Ok, thanks! Joe >> >> Cheers, >> Joe >> >>> >>> Best >>> Lance >>> >>> >>> On Apr 15, 2015, at 3:23 PM, huizhe wang >> > wrote: >>> >>>> Please review the change related to the non-SE org.w3c.dom.** API: >>>> org.w3c.dom.css, org.w3c.dom.html, org.w3c.dom.stylesheets, >>>> org.w3c.dom.xpath. >>>> >>>> They came into Java SE along with the DOM API, but were not part of >>>> the Java SE and JAXP specification. For css, html and stylesheets, >>>> there is no implementation in the Java SE, while for xpath, an >>>> experimental one. These types should not be exported through the >>>> java.xml module. Considering that there are references to them, >>>> we're moving them into a JDK module called jdk.xml.dom. The >>>> experimental DOM 3 XPath thus is no longer available through the >>>> DOM API (DOMImplementation). >>>> >>>> Please review: >>>> JAXP change: >>>> http://cr.openjdk.java.net/~joehw/jdk9/8042244/webrev/ >>>> >>>> >>>> module.xml: >>>> http://cr.openjdk.java.net/~joehw/jdk9/8042244/jdk/webrev/ >>>> >>>> JBS: 8042244 : Re-examine the supportedness of non-SE >>>> org.w3c.dom.** API >>>> >>>> Thanks, >>>> Joe >>>> >>>> >>>> >>> >>> >>> >>> >>> Lance >>> Andersen| Principal Member of Technical Staff | +1.781.442.2037 >>> Oracle Java Engineering >>> 1 Network Drive >>> Burlington, MA 01803 >>> Lance.Andersen at oracle.com >>> >>> >>> >> > > > > Lance > Andersen| Principal Member of Technical Staff | +1.781.442.2037 > Oracle Java Engineering > 1 Network Drive > Burlington, MA 01803 > Lance.Andersen at oracle.com > > > From aph at redhat.com Thu Apr 16 10:56:01 2015 From: aph at redhat.com (Andrew Haley) Date: Thu, 16 Apr 2015 11:56:01 +0100 Subject: Places we should use the new ByteBuffer intrinsics In-Reply-To: <55127C35.8000108@redhat.com> References: <550330CE.3030607@redhat.com> <550710BD.5060301@redhat.com> <440070D1-AFBF-4D3A-9825-0659BA280ADC@oracle.com> <5508325C.4000108@redhat.com> <550A90CE.9080901@redhat.com> <550AF27F.4050305@oracle.com> <550AFA3C.5030002@oracle.com> <550AFF16.9080600@oracle.com> <550B350B.6040602@oracle.com> <550C460F.1090302@redhat.com> <550C989A.5010203@oracle.com> <550D57B1.602@redhat.com> <550D9D02.1020303@oracle.com> <55105C0A.8070305@redhat.com> <55108130.2010207@oracle.com> <55111D21.1020502@redhat.com> <5511F5EA.6010102@oracle.com> <55127C35.8000108@redhat.com> Message-ID: <552F9541.10903@redhat.com> We discussed where we should be using the new Unsafe unaligned intrinsics. I found these: ByteBufferAs$Type$Buffer. These use slow bytewise accesses, and should be converted. DirectByteBuffer. This probes for unaligned memory support and uses byte-by-byte accesses if it isn't available. We should probably convert it after doing some performance measurements. sun.security.provider.ByteArrayAccess. This uses a lot of hand-carved custom code to handle data which largely duplicates that now in Unsafe, but big-endian platforms (and little-endian ones which don't support unaligned accesses) always use byte-by-byte accesses for unaligned data. Again, we should probably convert it after doing some performance measurements. Andrew. From alexander.v.stepanov at oracle.com Thu Apr 16 12:48:19 2015 From: alexander.v.stepanov at oracle.com (alexander stepanov) Date: Thu, 16 Apr 2015 15:48:19 +0300 Subject: RFR [9] 8077332: tidy warnings from javax/xml In-Reply-To: <552E8DD5.3080207@oracle.com> References: <5527F132.80408@oracle.com> <552815F4.4050005@oracle.com> <552BA6FD.5000706@oracle.com> <552BABBA.6050903@oracle.com> <552C08C2.4030503@oracle.com> <552E8DD5.3080207@oracle.com> Message-ID: <552FAF93.9020500@oracle.com> Please note also that a couple of new files were touched: http://cr.openjdk.java.net/~avstepan/8077332/webrev.01/jaxws/src/java.annotations.common/share/classes/javax/annotation/PostConstruct.java.udiff.html http://cr.openjdk.java.net/~avstepan/8077332/webrev.01/jaxws/src/java.annotations.common/share/classes/javax/annotation/PreDestroy.java.udiff.html On 15.04.2015 19:12, alexander stepanov wrote: > Hello Joe, > > The copyright changes were reverted. > > Please review the updated fix: > http://cr.openjdk.java.net/~avstepan/8077332/webrev.01/ > > ("" replaced with "{@code}", removed unnecessary "

    ", > used "@literal" tag). > > Thanks, > Alexander > > > On 13.04.2015 21:19, huizhe wang wrote: >> >> On 4/13/2015 4:42 AM, Alan Bateman wrote: >>> On 13/04/2015 12:22, alexander stepanov wrote: >>>> Hello Joe, >>>> >>>> Thank you for the notes; >>>> >>>> > Copyright year shall not be changed. >>>> >>>> That seems to be a bit controversial point; sometimes (while >>>> cleaning docs) I was asked to do that, other times - not to do >>>> that. Our internal policy seemingly assigns to change the 2nd date >>>> every time the sources were touched (but that may be a question of >>>> ambiguous interpretation). >>>> >>>> But of course I can easily revert these changes if you're totally >>>> sure it should be done. >>>> >>> This has always been confusing. Some areas insist on updating the >>> copyright dates, others don't. AFAIK, it has always been optional. I >>> think the original assumption was that the update_copyright_year >>> script (in the top-level repo) be run periodically to do bulk >>> updates. Unfortunately that script doesn't seem to be run very often >>> now and this strengthens the case to update the dates on a >>> continuous basis. I have not come across the argument that html tidy >>> tasks that don't change the javadoc should not update the copyright >>> date. The general topic probably should move to jdk9-dev and get >>> this decided once and documented in the developer guide. >> >> I think the key question to ask is: is this the code I can claim >> Copyright with? To me, format, code style, html tags and other minor >> changes, these are not code changes one can claim copyright with. >> >> The date of a Copyright establishes how far back the claim is made. >> In case where the work is substantially revised, a new Copyright >> claim is established, which is what the 2nd year is about. >> >> In this case, esp. for the JAXP API (e.g. javax.xml.datatype), I'd >> like to see the years maintained because those are the years the API >> was designed and modified. The "tidy warnings" change did not change >> the API. >> >> -Joe >> >>> >>> -Alan >> > From paul.sandoz at oracle.com Thu Apr 16 13:25:33 2015 From: paul.sandoz at oracle.com (Paul Sandoz) Date: Thu, 16 Apr 2015 15:25:33 +0200 Subject: Places we should use the new ByteBuffer intrinsics In-Reply-To: <552F9541.10903@redhat.com> References: <550330CE.3030607@redhat.com> <550710BD.5060301@redhat.com> <440070D1-AFBF-4D3A-9825-0659BA280ADC@oracle.com> <5508325C.4000108@redhat.com> <550A90CE.9080901@redhat.com> <550AF27F.4050305@oracle.com> <550AFA3C.5030002@oracle.com> <550AFF16.9080600@oracle.com> <550B350B.6040602@oracle.com> <550C460F.1090302@redhat.com> <550C989A.5010203@oracle.com> <550D57B1.602@redhat.com> <550D9D02.1020303@oracle.com> <55105C0A.8070305@redhat.com> <55108130.2010207@oracle.com> <55111D21.1020502@redhat.com> <5511F5EA.6010102@oracle.com> <55127C35.8000108@redhat.com> <552F9541.10903@redhat.com> Message-ID: On Apr 16, 2015, at 12:56 PM, Andrew Haley wrote: > We discussed where we should be using the new Unsafe unaligned > intrinsics. > > I found these: > They look like good candidates. I did a quick search in the JDK src code (usages of getByte/Short/Int/Long) and could not find any others. > ByteBufferAs$Type$Buffer. These use slow bytewise accesses, > and should be converted. > > DirectByteBuffer. This probes for unaligned memory support > and uses byte-by-byte accesses if it isn't available. We > should probably convert it after doing some performance > measurements. > That should be a nice cleanup, i would be surprised if it resulted in any performance issues but it would be good to check as you say. > sun.security.provider.ByteArrayAccess. This uses a lot of > hand-carved custom code to handle data which largely > duplicates that now in Unsafe, but big-endian platforms (and > little-endian ones which don't support unaligned accesses) > always use byte-by-byte accesses for unaligned data. Again, > we should probably convert it after doing some performance > measurements. > There is also an assumption in the following comment in sun.security.provider.ByteArrayAccess.b2lBig that i presume is no longer relevant: // In the current HotSpot memory layout, the first element of a // byte[] is only 32-bit aligned, not 64-bit. // That means we could use getLong() only for offset 4, 12, etc., // which would rarely occur in practice. Instead, we use an // optimization that uses getInt() so that it works for offset 0. Paul. From alexander.v.stepanov at oracle.com Thu Apr 16 14:07:02 2015 From: alexander.v.stepanov at oracle.com (alexander stepanov) Date: Thu, 16 Apr 2015 17:07:02 +0300 Subject: RFR [9] 8077332: tidy warnings from javax/xml In-Reply-To: <552FAF93.9020500@oracle.com> References: <5527F132.80408@oracle.com> <552815F4.4050005@oracle.com> <552BA6FD.5000706@oracle.com> <552BABBA.6050903@oracle.com> <552C08C2.4030503@oracle.com> <552E8DD5.3080207@oracle.com> <552FAF93.9020500@oracle.com> Message-ID: <552FC206.3090308@oracle.com> I'm sorry, two extra files touched - http://cr.openjdk.java.net/~avstepan/8077332/webrev.01/jaxws/src/java.activation/share/classes/javax/activation/MailcapCommandMap.java.udiff.html http://cr.openjdk.java.net/~avstepan/8077332/webrev.01/jaxws/src/java.activation/share/classes/javax/activation/MimetypesFileTypeMap.java.udiff.html Hopefully that's all for this bug... Thanks, Alexander On 16.04.2015 15:48, alexander stepanov wrote: > Please note also that a couple of new files were touched: > > http://cr.openjdk.java.net/~avstepan/8077332/webrev.01/jaxws/src/java.annotations.common/share/classes/javax/annotation/PostConstruct.java.udiff.html > > > http://cr.openjdk.java.net/~avstepan/8077332/webrev.01/jaxws/src/java.annotations.common/share/classes/javax/annotation/PreDestroy.java.udiff.html > > > > On 15.04.2015 19:12, alexander stepanov wrote: >> Hello Joe, >> >> The copyright changes were reverted. >> >> Please review the updated fix: >> http://cr.openjdk.java.net/~avstepan/8077332/webrev.01/ >> >> ("" replaced with "{@code}", removed unnecessary "

    ", >> used "@literal" tag). >> >> Thanks, >> Alexander >> >> >> On 13.04.2015 21:19, huizhe wang wrote: >>> >>> On 4/13/2015 4:42 AM, Alan Bateman wrote: >>>> On 13/04/2015 12:22, alexander stepanov wrote: >>>>> Hello Joe, >>>>> >>>>> Thank you for the notes; >>>>> >>>>> > Copyright year shall not be changed. >>>>> >>>>> That seems to be a bit controversial point; sometimes (while >>>>> cleaning docs) I was asked to do that, other times - not to do >>>>> that. Our internal policy seemingly assigns to change the 2nd date >>>>> every time the sources were touched (but that may be a question of >>>>> ambiguous interpretation). >>>>> >>>>> But of course I can easily revert these changes if you're totally >>>>> sure it should be done. >>>>> >>>> This has always been confusing. Some areas insist on updating the >>>> copyright dates, others don't. AFAIK, it has always been optional. >>>> I think the original assumption was that the update_copyright_year >>>> script (in the top-level repo) be run periodically to do bulk >>>> updates. Unfortunately that script doesn't seem to be run very >>>> often now and this strengthens the case to update the dates on a >>>> continuous basis. I have not come across the argument that html >>>> tidy tasks that don't change the javadoc should not update the >>>> copyright date. The general topic probably should move to jdk9-dev >>>> and get this decided once and documented in the developer guide. >>> >>> I think the key question to ask is: is this the code I can claim >>> Copyright with? To me, format, code style, html tags and other minor >>> changes, these are not code changes one can claim copyright with. >>> >>> The date of a Copyright establishes how far back the claim is made. >>> In case where the work is substantially revised, a new Copyright >>> claim is established, which is what the 2nd year is about. >>> >>> In this case, esp. for the JAXP API (e.g. javax.xml.datatype), I'd >>> like to see the years maintained because those are the years the API >>> was designed and modified. The "tidy warnings" change did not change >>> the API. >>> >>> -Joe >>> >>>> >>>> -Alan >>> >> > From mandy.chung at oracle.com Thu Apr 16 16:43:21 2015 From: mandy.chung at oracle.com (Mandy Chung) Date: Thu, 16 Apr 2015 09:43:21 -0700 Subject: RFR (JAXP): 8042244 : Re-examine the supportedness of non-SE org.w3c.dom.** API In-Reply-To: <552EBAB5.504@oracle.com> References: <552EBAB5.504@oracle.com> Message-ID: <552FE6A9.3080905@oracle.com> On 4/15/15 12:23 PM, huizhe wang wrote: > Please review the change related to the non-SE org.w3c.dom.** API: > org.w3c.dom.css, org.w3c.dom.html, org.w3c.dom.stylesheets, > org.w3c.dom.xpath. > > They came into Java SE along with the DOM API, but were not part of > the Java SE and JAXP specification. For css, html and stylesheets, > there is no implementation in the Java SE, while for xpath, an > experimental one. These types should not be exported through the > java.xml module. Considering that there are references to them, we're > moving them into a JDK module called jdk.xml.dom. The experimental DOM > 3 XPath thus is no longer available through the DOM API > (DOMImplementation). > > Please review: > JAXP change: > http://cr.openjdk.java.net/~joehw/jdk9/8042244/webrev/ > > module.xml: > http://cr.openjdk.java.net/~joehw/jdk9/8042244/jdk/webrev/ This looks good. I reviewed the updated webrev with SUID added in XPathException which is the right thing to do. Thanks for taking on this on. Mandy From huizhe.wang at oracle.com Thu Apr 16 16:57:48 2015 From: huizhe.wang at oracle.com (huizhe wang) Date: Thu, 16 Apr 2015 09:57:48 -0700 Subject: RFR [9] 8077332: tidy warnings from javax/xml In-Reply-To: <552FC206.3090308@oracle.com> References: <5527F132.80408@oracle.com> <552815F4.4050005@oracle.com> <552BA6FD.5000706@oracle.com> <552BABBA.6050903@oracle.com> <552C08C2.4030503@oracle.com> <552E8DD5.3080207@oracle.com> <552FAF93.9020500@oracle.com> <552FC206.3090308@oracle.com> Message-ID: <552FEA0C.1050904@oracle.com> Hi Alexander, Looks very good. Thanks for making all the changes! Please note that for the JAXWS, you may need to check with JAXWS/Miran (miroslav.kos at oracle.com). Changes to JAXWS generally goes into the standalone first. They do periodic integration. For the jaxp portion: --- old/src/java.xml/share/classes/javax/xml/datatype/Duration.java 2015-04-16 13:50:25.249473095 +0400 +++ new/src/java.xml/share/classes/javax/xml/datatype/Duration.java 2015-04-16 13:50:25.161473099 +0400 @@ -725,37 +725,37 @@ * - * @return the relationship between this Durationand duration parameter as + * @return the relationship between {@code this} {@code Duration}and {@code duration} parameter as [jw] I saw in a few cases where two @code tags are next to each other, you may do a s/} {@code//g to combine them. A space is also missing before 'and': e.g. {@code Duration} and. --- old/src/java.xml/share/classes/javax/xml/stream/XMLStreamReader.java 2015-04-16 13:50:28.197472963 +0400 +++ new/src/java.xml/share/classes/javax/xml/stream/XMLStreamReader.java 2015-04-16 13:50:28.105472967 +0400 @@ -542,7 +543,7 @@ * If the number of characters actually copied is less than the "length", then there is no more text. * Otherwise, subsequent calls need to be made until all text has been retrieved. For example: * - * + * {@code * int length = 1024; * char[] myBuffer = new char[ length ]; * @@ -553,7 +554,7 @@ * if (nCopied < length) * break; * } - * + * } [jw] as I mentioned,
     is needed for the code snippet.
    
    
    BTW, have you compiled and verified the Javadoc after the changes?
    
    Thanks,
    Joe
    
    On 4/16/2015 7:07 AM, alexander stepanov wrote:
    > I'm sorry, two extra files touched -
    > http://cr.openjdk.java.net/~avstepan/8077332/webrev.01/jaxws/src/java.activation/share/classes/javax/activation/MailcapCommandMap.java.udiff.html 
    >
    > http://cr.openjdk.java.net/~avstepan/8077332/webrev.01/jaxws/src/java.activation/share/classes/javax/activation/MimetypesFileTypeMap.java.udiff.html 
    >
    >
    > Hopefully that's all for this bug...
    >
    > Thanks,
    > Alexander
    >
    > On 16.04.2015 15:48, alexander stepanov wrote:
    >> Please note also that a couple of new files were touched:
    >>
    >> http://cr.openjdk.java.net/~avstepan/8077332/webrev.01/jaxws/src/java.annotations.common/share/classes/javax/annotation/PostConstruct.java.udiff.html 
    >>  
    >>
    >> http://cr.openjdk.java.net/~avstepan/8077332/webrev.01/jaxws/src/java.annotations.common/share/classes/javax/annotation/PreDestroy.java.udiff.html 
    >>  
    >>
    >>
    >> On 15.04.2015 19:12, alexander stepanov wrote:
    >>> Hello Joe,
    >>>
    >>> The copyright changes were reverted.
    >>>
    >>> Please review the updated fix:
    >>> http://cr.openjdk.java.net/~avstepan/8077332/webrev.01/
    >>>
    >>> ("" replaced with "{@code}", removed unnecessary 
    >>> "

    ", used "@literal" tag). >>> >>> Thanks, >>> Alexander >>> >>> >>> On 13.04.2015 21:19, huizhe wang wrote: >>>> >>>> On 4/13/2015 4:42 AM, Alan Bateman wrote: >>>>> On 13/04/2015 12:22, alexander stepanov wrote: >>>>>> Hello Joe, >>>>>> >>>>>> Thank you for the notes; >>>>>> >>>>>> > Copyright year shall not be changed. >>>>>> >>>>>> That seems to be a bit controversial point; sometimes (while >>>>>> cleaning docs) I was asked to do that, other times - not to do >>>>>> that. Our internal policy seemingly assigns to change the 2nd >>>>>> date every time the sources were touched (but that may be a >>>>>> question of ambiguous interpretation). >>>>>> >>>>>> But of course I can easily revert these changes if you're totally >>>>>> sure it should be done. >>>>>> >>>>> This has always been confusing. Some areas insist on updating the >>>>> copyright dates, others don't. AFAIK, it has always been optional. >>>>> I think the original assumption was that the update_copyright_year >>>>> script (in the top-level repo) be run periodically to do bulk >>>>> updates. Unfortunately that script doesn't seem to be run very >>>>> often now and this strengthens the case to update the dates on a >>>>> continuous basis. I have not come across the argument that html >>>>> tidy tasks that don't change the javadoc should not update the >>>>> copyright date. The general topic probably should move to jdk9-dev >>>>> and get this decided once and documented in the developer guide. >>>> >>>> I think the key question to ask is: is this the code I can claim >>>> Copyright with? To me, format, code style, html tags and other >>>> minor changes, these are not code changes one can claim copyright >>>> with. >>>> >>>> The date of a Copyright establishes how far back the claim is made. >>>> In case where the work is substantially revised, a new Copyright >>>> claim is established, which is what the 2nd year is about. >>>> >>>> In this case, esp. for the JAXP API (e.g. javax.xml.datatype), I'd >>>> like to see the years maintained because those are the years the >>>> API was designed and modified. The "tidy warnings" change did not >>>> change the API. >>>> >>>> -Joe >>>> >>>>> >>>>> -Alan >>>> >>> >> > From lance.andersen at oracle.com Thu Apr 16 16:58:03 2015 From: lance.andersen at oracle.com (Lance Andersen) Date: Thu, 16 Apr 2015 12:58:03 -0400 Subject: RFR [9] 8077332: tidy warnings from javax/xml In-Reply-To: <552FC206.3090308@oracle.com> References: <5527F132.80408@oracle.com> <552815F4.4050005@oracle.com> <552BA6FD.5000706@oracle.com> <552BABBA.6050903@oracle.com> <552C08C2.4030503@oracle.com> <552E8DD5.3080207@oracle.com> <552FAF93.9020500@oracle.com> <552FC206.3090308@oracle.com> Message-ID: <943820B6-EAC1-4933-BEC1-47D4695D6FF0@oracle.com> Hi Alexander, These seem to be OK Best Lance On Apr 16, 2015, at 10:07 AM, alexander stepanov wrote: > I'm sorry, two extra files touched - > http://cr.openjdk.java.net/~avstepan/8077332/webrev.01/jaxws/src/java.activation/share/classes/javax/activation/MailcapCommandMap.java.udiff.html > http://cr.openjdk.java.net/~avstepan/8077332/webrev.01/jaxws/src/java.activation/share/classes/javax/activation/MimetypesFileTypeMap.java.udiff.html > > Hopefully that's all for this bug... > > Thanks, > Alexander > > On 16.04.2015 15:48, alexander stepanov wrote: >> Please note also that a couple of new files were touched: >> >> http://cr.openjdk.java.net/~avstepan/8077332/webrev.01/jaxws/src/java.annotations.common/share/classes/javax/annotation/PostConstruct.java.udiff.html >> http://cr.openjdk.java.net/~avstepan/8077332/webrev.01/jaxws/src/java.annotations.common/share/classes/javax/annotation/PreDestroy.java.udiff.html >> >> On 15.04.2015 19:12, alexander stepanov wrote: >>> Hello Joe, >>> >>> The copyright changes were reverted. >>> >>> Please review the updated fix: >>> http://cr.openjdk.java.net/~avstepan/8077332/webrev.01/ >>> >>> ("" replaced with "{@code}", removed unnecessary "

    ", used "@literal" tag). >>> >>> Thanks, >>> Alexander >>> >>> >>> On 13.04.2015 21:19, huizhe wang wrote: >>>> >>>> On 4/13/2015 4:42 AM, Alan Bateman wrote: >>>>> On 13/04/2015 12:22, alexander stepanov wrote: >>>>>> Hello Joe, >>>>>> >>>>>> Thank you for the notes; >>>>>> >>>>>> > Copyright year shall not be changed. >>>>>> >>>>>> That seems to be a bit controversial point; sometimes (while cleaning docs) I was asked to do that, other times - not to do that. Our internal policy seemingly assigns to change the 2nd date every time the sources were touched (but that may be a question of ambiguous interpretation). >>>>>> >>>>>> But of course I can easily revert these changes if you're totally sure it should be done. >>>>>> >>>>> This has always been confusing. Some areas insist on updating the copyright dates, others don't. AFAIK, it has always been optional. I think the original assumption was that the update_copyright_year script (in the top-level repo) be run periodically to do bulk updates. Unfortunately that script doesn't seem to be run very often now and this strengthens the case to update the dates on a continuous basis. I have not come across the argument that html tidy tasks that don't change the javadoc should not update the copyright date. The general topic probably should move to jdk9-dev and get this decided once and documented in the developer guide. >>>> >>>> I think the key question to ask is: is this the code I can claim Copyright with? To me, format, code style, html tags and other minor changes, these are not code changes one can claim copyright with. >>>> >>>> The date of a Copyright establishes how far back the claim is made. In case where the work is substantially revised, a new Copyright claim is established, which is what the 2nd year is about. >>>> >>>> In this case, esp. for the JAXP API (e.g. javax.xml.datatype), I'd like to see the years maintained because those are the years the API was designed and modified. The "tidy warnings" change did not change the API. >>>> >>>> -Joe >>>> >>>>> >>>>> -Alan >>>> >>> >> > Lance Andersen| Principal Member of Technical Staff | +1.781.442.2037 Oracle Java Engineering 1 Network Drive Burlington, MA 01803 Lance.Andersen at oracle.com From huizhe.wang at oracle.com Thu Apr 16 17:00:56 2015 From: huizhe.wang at oracle.com (huizhe wang) Date: Thu, 16 Apr 2015 10:00:56 -0700 Subject: RFR (JAXP): 8042244 : Re-examine the supportedness of non-SE org.w3c.dom.** API In-Reply-To: <552FE6A9.3080905@oracle.com> References: <552EBAB5.504@oracle.com> <552FE6A9.3080905@oracle.com> Message-ID: <552FEAC8.9060901@oracle.com> Thanks Mandy! Joe On 4/16/2015 9:43 AM, Mandy Chung wrote: > On 4/15/15 12:23 PM, huizhe wang wrote: >> Please review the change related to the non-SE org.w3c.dom.** API: >> org.w3c.dom.css, org.w3c.dom.html, org.w3c.dom.stylesheets, >> org.w3c.dom.xpath. >> >> They came into Java SE along with the DOM API, but were not part of >> the Java SE and JAXP specification. For css, html and stylesheets, >> there is no implementation in the Java SE, while for xpath, an >> experimental one. These types should not be exported through the >> java.xml module. Considering that there are references to them, we're >> moving them into a JDK module called jdk.xml.dom. The experimental >> DOM 3 XPath thus is no longer available through the DOM API >> (DOMImplementation). >> >> Please review: >> JAXP change: >> http://cr.openjdk.java.net/~joehw/jdk9/8042244/webrev/ >> >> module.xml: >> http://cr.openjdk.java.net/~joehw/jdk9/8042244/jdk/webrev/ > > This looks good. I reviewed the updated webrev with SUID added in > XPathException which is the right thing to do. > > Thanks for taking on this on. > > Mandy > From aph at redhat.com Thu Apr 16 17:07:44 2015 From: aph at redhat.com (Andrew Haley) Date: Thu, 16 Apr 2015 18:07:44 +0100 Subject: RFR: 8073093: AARCH64: C2 generates poor code for ByteBuffer accesses In-Reply-To: <54E4FD45.5090106@oracle.com> References: <20150213230416.5E7B617FDAA@rebar.astron.com> <54DE8BB7.5050801@oracle.com> <54DE9140.3040604@oracle.com> <54E30C38.8000303@redhat.com> <54E31144.3040504@redhat.com> <54E314BF.3010205@redhat.com> <54E31677.1050209@redhat.com> <54E31CA6.6030609@redhat.com> <54E31DA0.2040901@redhat.com> <54E34EAF.6000802@redhat.com> <54E457E0.20408@redhat.com> <54E45842.9030102@redhat.com> <54E473D1.8000506@redhat.com> <54E4FD45.5090106@oracle.com> Message-ID: <552FEC60.3060308@redhat.com> On 02/18/2015 08:59 PM, Vladimir Kozlov wrote: > The code which eliminates MemBars for scalarized objects was added in jdk8: > > http://hg.openjdk.java.net/jdk9/jdk9/hotspot/rev/6f3fd5150b67 Right enough, but it only works with boxed objects. The Precedent of the MemBarNode is needed by MemBarNode::Ideal, and it's checked for: // Eliminate volatile MemBars for scalar replaced objects. if (can_reshape && req() == (Precedent+1)) { ... think about eliminating the MemBar So if there's no Precedent, none of the barrier elimination is done. The only thing that sets the MemBar's Precedent is here: In parse::do_put_xxx // Preserve allocation ptr to create precedent edge to it in membar // generated on exit from constructor. if (C->eliminate_boxing() && adr_type->isa_oopptr() && adr_type->is_oopptr()->is_ptr_to_boxed_value() && AllocateNode::Ideal_allocation(obj, &_gvn) != NULL) { set_alloc_with_final(obj); } The barrier is created in parse1, and uses alloc_with_final: if (method()->is_initializer() && (wrote_final() || PPC64_ONLY(wrote_volatile() ||) (AlwaysSafeConstructors && wrote_fields()))) { _exits.insert_mem_bar(Op_MemBarRelease, alloc_with_final()); So, it looks to me as though even the most trivial user-defined constructors with final fields will never eliminate barriers. I don't know what the thinking is here. Why does it matter whether the type being constructed is a boxed value? Andrew. From alexander.v.stepanov at oracle.com Thu Apr 16 17:12:40 2015 From: alexander.v.stepanov at oracle.com (alexander stepanov) Date: Thu, 16 Apr 2015 20:12:40 +0300 Subject: RFR [9] 8077332: tidy warnings from javax/xml In-Reply-To: <552FEA0C.1050904@oracle.com> References: <5527F132.80408@oracle.com> <552815F4.4050005@oracle.com> <552BA6FD.5000706@oracle.com> <552BABBA.6050903@oracle.com> <552C08C2.4030503@oracle.com> <552E8DD5.3080207@oracle.com> <552FAF93.9020500@oracle.com> <552FC206.3090308@oracle.com> <552FEA0C.1050904@oracle.com> Message-ID: <552FED88.9090703@oracle.com> Hello Joe, Thanks! > as I mentioned,
     is needed for the code snippet.
    Oh, yes, that was that was forgotten.
    
     > BTW, have you compiled
    Yes; some javadoc errors were fixed as well
    
     > and verified the Javadoc after the changes?
    Only briefly. So as the above example shows I have to look it over once 
    again (at least for files where the changes weren't trivial); will do that.
    
     > Please note that for the JAXWS, you may need to check with JAXWS/Miran
    Yes, I'll contact him, thanks.
    
    Regards,
    Alexander
    
    On 16.04.2015 19:57, huizhe wang wrote:
    > Hi Alexander,
    >
    > Looks very good. Thanks for making all the changes!
    >
    > Please note that for the JAXWS, you may need to check with JAXWS/Miran 
    > (miroslav.kos at oracle.com). Changes to JAXWS generally goes into the 
    > standalone first. They do periodic integration.
    >
    > For the jaxp portion:
    > --- old/src/java.xml/share/classes/javax/xml/datatype/Duration.java 
    > 2015-04-16 13:50:25.249473095 +0400
    > +++ new/src/java.xml/share/classes/javax/xml/datatype/Duration.java 
    > 2015-04-16 13:50:25.161473099 +0400
    >
    > @@ -725,37 +725,37 @@
    >
    >       *
    > -     * @return the relationship between this 
    > Durationand duration parameter as
    > +     * @return the relationship between {@code this} {@code 
    > Duration}and {@code duration} parameter as
    >
    > [jw] I saw in a few cases where two @code tags are next to each other, 
    > you may do a s/} {@code//g to combine them. A space is also missing 
    > before 'and': e.g. {@code Duration} and.
    >
    >
    > --- 
    > old/src/java.xml/share/classes/javax/xml/stream/XMLStreamReader.java 
    > 2015-04-16 13:50:28.197472963 +0400
    > +++ 
    > new/src/java.xml/share/classes/javax/xml/stream/XMLStreamReader.java 
    > 2015-04-16 13:50:28.105472967 +0400
    >
    > @@ -542,7 +543,7 @@
    >     * If the number of characters actually copied is less than the 
    > "length", then there is no more text.
    >     * Otherwise, subsequent calls need to be made until all text has 
    > been retrieved. For example:
    >     *
    > -   *
    > +   * {@code
    >     * int length = 1024;
    >     * char[] myBuffer = new char[ length ];
    >     *
    > @@ -553,7 +554,7 @@
    >     *   if (nCopied < length)
    >     *       break;
    >     * }
    > -   * 
    > +   * }
    >
    > [jw] as I mentioned, 
     is needed for the code snippet.
    >
    >
    > BTW, have you compiled and verified the Javadoc after the changes?
    >
    > Thanks,
    > Joe
    >
    > On 4/16/2015 7:07 AM, alexander stepanov wrote:
    >> I'm sorry, two extra files touched -
    >> http://cr.openjdk.java.net/~avstepan/8077332/webrev.01/jaxws/src/java.activation/share/classes/javax/activation/MailcapCommandMap.java.udiff.html 
    >>
    >> http://cr.openjdk.java.net/~avstepan/8077332/webrev.01/jaxws/src/java.activation/share/classes/javax/activation/MimetypesFileTypeMap.java.udiff.html 
    >>
    >>
    >> Hopefully that's all for this bug...
    >>
    >> Thanks,
    >> Alexander
    >>
    >> On 16.04.2015 15:48, alexander stepanov wrote:
    >>> Please note also that a couple of new files were touched:
    >>>
    >>> http://cr.openjdk.java.net/~avstepan/8077332/webrev.01/jaxws/src/java.annotations.common/share/classes/javax/annotation/PostConstruct.java.udiff.html 
    >>>  
    >>>
    >>> http://cr.openjdk.java.net/~avstepan/8077332/webrev.01/jaxws/src/java.annotations.common/share/classes/javax/annotation/PreDestroy.java.udiff.html 
    >>>  
    >>>
    >>>
    >>> On 15.04.2015 19:12, alexander stepanov wrote:
    >>>> Hello Joe,
    >>>>
    >>>> The copyright changes were reverted.
    >>>>
    >>>> Please review the updated fix:
    >>>> http://cr.openjdk.java.net/~avstepan/8077332/webrev.01/
    >>>>
    >>>> ("" replaced with "{@code}", removed unnecessary 
    >>>> "

    ", used "@literal" tag). >>>> >>>> Thanks, >>>> Alexander >>>> >>>> >>>> On 13.04.2015 21:19, huizhe wang wrote: >>>>> >>>>> On 4/13/2015 4:42 AM, Alan Bateman wrote: >>>>>> On 13/04/2015 12:22, alexander stepanov wrote: >>>>>>> Hello Joe, >>>>>>> >>>>>>> Thank you for the notes; >>>>>>> >>>>>>> > Copyright year shall not be changed. >>>>>>> >>>>>>> That seems to be a bit controversial point; sometimes (while >>>>>>> cleaning docs) I was asked to do that, other times - not to do >>>>>>> that. Our internal policy seemingly assigns to change the 2nd >>>>>>> date every time the sources were touched (but that may be a >>>>>>> question of ambiguous interpretation). >>>>>>> >>>>>>> But of course I can easily revert these changes if you're >>>>>>> totally sure it should be done. >>>>>>> >>>>>> This has always been confusing. Some areas insist on updating the >>>>>> copyright dates, others don't. AFAIK, it has always been >>>>>> optional. I think the original assumption was that the >>>>>> update_copyright_year script (in the top-level repo) be run >>>>>> periodically to do bulk updates. Unfortunately that script >>>>>> doesn't seem to be run very often now and this strengthens the >>>>>> case to update the dates on a continuous basis. I have not come >>>>>> across the argument that html tidy tasks that don't change the >>>>>> javadoc should not update the copyright date. The general topic >>>>>> probably should move to jdk9-dev and get this decided once and >>>>>> documented in the developer guide. >>>>> >>>>> I think the key question to ask is: is this the code I can claim >>>>> Copyright with? To me, format, code style, html tags and other >>>>> minor changes, these are not code changes one can claim copyright >>>>> with. >>>>> >>>>> The date of a Copyright establishes how far back the claim is >>>>> made. In case where the work is substantially revised, a new >>>>> Copyright claim is established, which is what the 2nd year is about. >>>>> >>>>> In this case, esp. for the JAXP API (e.g. javax.xml.datatype), I'd >>>>> like to see the years maintained because those are the years the >>>>> API was designed and modified. The "tidy warnings" change did not >>>>> change the API. >>>>> >>>>> -Joe >>>>> >>>>>> >>>>>> -Alan >>>>> >>>> >>> >> > From alexander.v.stepanov at oracle.com Thu Apr 16 17:13:10 2015 From: alexander.v.stepanov at oracle.com (alexander stepanov) Date: Thu, 16 Apr 2015 20:13:10 +0300 Subject: RFR [9] 8077332: tidy warnings from javax/xml In-Reply-To: <943820B6-EAC1-4933-BEC1-47D4695D6FF0@oracle.com> References: <5527F132.80408@oracle.com> <552815F4.4050005@oracle.com> <552BA6FD.5000706@oracle.com> <552BABBA.6050903@oracle.com> <552C08C2.4030503@oracle.com> <552E8DD5.3080207@oracle.com> <552FAF93.9020500@oracle.com> <552FC206.3090308@oracle.com> <943820B6-EAC1-4933-BEC1-47D4695D6FF0@oracle.com> Message-ID: <552FEDA6.5000805@oracle.com> Hello Lance, Thanks. Regards, Alexander On 16.04.2015 19:58, Lance Andersen wrote: > Hi Alexander, > > These seem to be OK > > Best > Lance > On Apr 16, 2015, at 10:07 AM, alexander stepanov > > wrote: > >> I'm sorry, two extra files touched - >> http://cr.openjdk.java.net/~avstepan/8077332/webrev.01/jaxws/src/java.activation/share/classes/javax/activation/MailcapCommandMap.java.udiff.html >> >> http://cr.openjdk.java.net/~avstepan/8077332/webrev.01/jaxws/src/java.activation/share/classes/javax/activation/MimetypesFileTypeMap.java.udiff.html >> >> Hopefully that's all for this bug... >> >> Thanks, >> Alexander >> >> On 16.04.2015 15:48, alexander stepanov wrote: >>> Please note also that a couple of new files were touched: >>> >>> http://cr.openjdk.java.net/~avstepan/8077332/webrev.01/jaxws/src/java.annotations.common/share/classes/javax/annotation/PostConstruct.java.udiff.html >>> >>> >>> http://cr.openjdk.java.net/~avstepan/8077332/webrev.01/jaxws/src/java.annotations.common/share/classes/javax/annotation/PreDestroy.java.udiff.html >>> >>> >>> >>> On 15.04.2015 19:12, alexander stepanov wrote: >>>> Hello Joe, >>>> >>>> The copyright changes were reverted. >>>> >>>> Please review the updated fix: >>>> http://cr.openjdk.java.net/~avstepan/8077332/webrev.01/ >>>> >>>> ("" replaced with "{@code}", removed unnecessary >>>> "

    ", used "@literal" tag). >>>> >>>> Thanks, >>>> Alexander >>>> >>>> >>>> On 13.04.2015 21:19, huizhe wang wrote: >>>>> >>>>> On 4/13/2015 4:42 AM, Alan Bateman wrote: >>>>>> On 13/04/2015 12:22, alexander stepanov wrote: >>>>>>> Hello Joe, >>>>>>> >>>>>>> Thank you for the notes; >>>>>>> >>>>>>> > Copyright year shall not be changed. >>>>>>> >>>>>>> That seems to be a bit controversial point; sometimes (while >>>>>>> cleaning docs) I was asked to do that, other times - not to do >>>>>>> that. Our internal policy seemingly assigns to change the 2nd >>>>>>> date every time the sources were touched (but that may be a >>>>>>> question of ambiguous interpretation). >>>>>>> >>>>>>> But of course I can easily revert these changes if you're >>>>>>> totally sure it should be done. >>>>>>> >>>>>> This has always been confusing. Some areas insist on updating the >>>>>> copyright dates, others don't. AFAIK, it has always been >>>>>> optional. I think the original assumption was that the >>>>>> update_copyright_year script (in the top-level repo) be run >>>>>> periodically to do bulk updates. Unfortunately that script >>>>>> doesn't seem to be run very often now and this strengthens the >>>>>> case to update the dates on a continuous basis. I have not come >>>>>> across the argument that html tidy tasks that don't change the >>>>>> javadoc should not update the copyright date. The general topic >>>>>> probably should move to jdk9-dev and get this decided once and >>>>>> documented in the developer guide. >>>>> >>>>> I think the key question to ask is: is this the code I can claim >>>>> Copyright with? To me, format, code style, html tags and other >>>>> minor changes, these are not code changes one can claim copyright >>>>> with. >>>>> >>>>> The date of a Copyright establishes how far back the claim is >>>>> made. In case where the work is substantially revised, a new >>>>> Copyright claim is established, which is what the 2nd year is about. >>>>> >>>>> In this case, esp. for the JAXP API (e.g. javax.xml.datatype), I'd >>>>> like to see the years maintained because those are the years the >>>>> API was designed and modified. The "tidy warnings" change did not >>>>> change the API. >>>>> >>>>> -Joe >>>>> >>>>>> >>>>>> -Alan >>>>> >>>> >>> >> > > > > Lance > Andersen| Principal Member of Technical Staff | +1.781.442.2037 > Oracle Java Engineering > 1 Network Drive > Burlington, MA 01803 > Lance.Andersen at oracle.com > > > From joe.darcy at oracle.com Thu Apr 16 18:08:52 2015 From: joe.darcy at oracle.com (joe darcy) Date: Thu, 16 Apr 2015 11:08:52 -0700 Subject: JDK 9 RFR of adding missing javadoc to javax.transaction Message-ID: <552FFAB4.8080201@oracle.com> Hello, While preparing to turn on doclint build warnings on more modules, I noticed there are missing javadoc comments on various classes in javax.transaction. Please review the patch below which add in some obvious javadoc. Thanks, -Joe diff -r 488af0e8ee33 src/java.transaction/share/classes/javax/transaction/InvalidTransactionException.java --- a/src/java.transaction/share/classes/javax/transaction/InvalidTransactionException.java Thu Apr 16 10:44:23 2015 -0700 +++ b/src/java.transaction/share/classes/javax/transaction/InvalidTransactionException.java Thu Apr 16 11:07:12 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2015, 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 @@ -39,10 +39,17 @@ @SuppressWarnings("serial") // serialVersionUID intentionally omitted public class InvalidTransactionException extends java.rmi.RemoteException { + /** + * Constructs an {@code InvalidTransactionException}. + */ public InvalidTransactionException() { super(); } + /** + * Constructs an {@code InvalidTransactionException}. + * @param msg the detail message + */ public InvalidTransactionException(String msg) { super(msg); } diff -r 488af0e8ee33 src/java.transaction/share/classes/javax/transaction/TransactionRequiredException.java --- a/src/java.transaction/share/classes/javax/transaction/TransactionRequiredException.java Thu Apr 16 10:44:23 2015 -0700 +++ b/src/java.transaction/share/classes/javax/transaction/TransactionRequiredException.java Thu Apr 16 11:07:12 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2015, 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 @@ -38,10 +38,17 @@ @SuppressWarnings("serial") // serialVersionUID intentionally omitted public class TransactionRequiredException extends java.rmi.RemoteException { + /** + * Constructs a {@code TransactionRequiredException}. + */ public TransactionRequiredException() { super(); } + /** + * Constructs a {@code TransactionRequiredException}. + * @param msg the detail message + */ public TransactionRequiredException(String msg) { super(msg); } diff -r 488af0e8ee33 src/java.transaction/share/classes/javax/transaction/TransactionRolledbackException.java --- a/src/java.transaction/share/classes/javax/transaction/TransactionRolledbackException.java Thu Apr 16 10:44:23 2015 -0700 +++ b/src/java.transaction/share/classes/javax/transaction/TransactionRolledbackException.java Thu Apr 16 11:07:12 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2015, 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 @@ -41,10 +41,17 @@ @SuppressWarnings("serial") // serialVersionUID intentionally omitted public class TransactionRolledbackException extends java.rmi.RemoteException { + /** + * Constructs a {@code TransactionRolledbackException}. + */ public TransactionRolledbackException() { super(); } + /** + * Constructs a {@code TransactionRolledbackException}. + * @param msg the detail message + */ public TransactionRolledbackException(String msg) { super(msg); } From Roger.Riggs at Oracle.com Thu Apr 16 18:24:17 2015 From: Roger.Riggs at Oracle.com (Roger Riggs) Date: Thu, 16 Apr 2015 14:24:17 -0400 Subject: JDK 9 RFR of adding missing javadoc to javax.transaction In-Reply-To: <552FFAB4.8080201@oracle.com> References: <552FFAB4.8080201@oracle.com> Message-ID: <552FFE51.3050202@Oracle.com> Hi Joe, Looks fine. Roger On 4/16/2015 2:08 PM, joe darcy wrote: > Hello, > > While preparing to turn on doclint build warnings on more modules, I > noticed there are missing javadoc comments on various classes in > javax.transaction. > > Please review the patch below which add in some obvious javadoc. > > Thanks, > > -Joe > > diff -r 488af0e8ee33 > src/java.transaction/share/classes/javax/transaction/InvalidTransactionException.java > --- > a/src/java.transaction/share/classes/javax/transaction/InvalidTransactionException.java > Thu Apr 16 10:44:23 2015 -0700 > +++ > b/src/java.transaction/share/classes/javax/transaction/InvalidTransactionException.java > Thu Apr 16 11:07:12 2015 -0700 > @@ -1,5 +1,5 @@ > /* > - * Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights > reserved. > + * Copyright (c) 1998, 2015, 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 > @@ -39,10 +39,17 @@ > @SuppressWarnings("serial") // serialVersionUID > intentionally omitted > public class InvalidTransactionException extends > java.rmi.RemoteException { > > + /** > + * Constructs an {@code InvalidTransactionException}. > + */ > public InvalidTransactionException() { > super(); > } > > + /** > + * Constructs an {@code InvalidTransactionException}. > + * @param msg the detail message > + */ > public InvalidTransactionException(String msg) { > super(msg); > } > diff -r 488af0e8ee33 > src/java.transaction/share/classes/javax/transaction/TransactionRequiredException.java > --- > a/src/java.transaction/share/classes/javax/transaction/TransactionRequiredException.java > Thu Apr 16 10:44:23 2015 -0700 > +++ > b/src/java.transaction/share/classes/javax/transaction/TransactionRequiredException.java > Thu Apr 16 11:07:12 2015 -0700 > @@ -1,5 +1,5 @@ > /* > - * Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights > reserved. > + * Copyright (c) 1998, 2015, 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 > @@ -38,10 +38,17 @@ > @SuppressWarnings("serial") // serialVersionUID > intentionally omitted > public class TransactionRequiredException extends > java.rmi.RemoteException { > > + /** > + * Constructs a {@code TransactionRequiredException}. > + */ > public TransactionRequiredException() { > super(); > } > > + /** > + * Constructs a {@code TransactionRequiredException}. > + * @param msg the detail message > + */ > public TransactionRequiredException(String msg) { > super(msg); > } > diff -r 488af0e8ee33 > src/java.transaction/share/classes/javax/transaction/TransactionRolledbackException.java > --- > a/src/java.transaction/share/classes/javax/transaction/TransactionRolledbackException.java > Thu Apr 16 10:44:23 2015 -0700 > +++ > b/src/java.transaction/share/classes/javax/transaction/TransactionRolledbackException.java > Thu Apr 16 11:07:12 2015 -0700 > @@ -1,5 +1,5 @@ > /* > - * Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights > reserved. > + * Copyright (c) 1998, 2015, 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 > @@ -41,10 +41,17 @@ > @SuppressWarnings("serial") // serialVersionUID > intentionally omitted > public class TransactionRolledbackException extends > java.rmi.RemoteException { > > + /** > + * Constructs a {@code TransactionRolledbackException}. > + */ > public TransactionRolledbackException() { > super(); > } > > + /** > + * Constructs a {@code TransactionRolledbackException}. > + * @param msg the detail message > + */ > public TransactionRolledbackException(String msg) { > super(msg); > } From lance.andersen at oracle.com Thu Apr 16 18:27:23 2015 From: lance.andersen at oracle.com (Lance Andersen) Date: Thu, 16 Apr 2015 14:27:23 -0400 Subject: JDK 9 RFR of adding missing javadoc to javax.transaction In-Reply-To: <552FFAB4.8080201@oracle.com> References: <552FFAB4.8080201@oracle.com> Message-ID: <3C3C812C-2A77-4C44-BC29-FB9069E9CC39@oracle.com> Hi Joe, This Looks OK. I have already had discussions with the Java EE leads about adding the SUID and pushing the changes back upstream (and updating other classes in upstream javax.transaction as needed. I will be doing that soon and will push these changes as well. Best, Lance On Apr 16, 2015, at 2:08 PM, joe darcy wrote: > Hello, > > While preparing to turn on doclint build warnings on more modules, I noticed there are missing javadoc comments on various classes in javax.transaction. > > Please review the patch below which add in some obvious javadoc. > > Thanks, > > -Joe > > diff -r 488af0e8ee33 src/java.transaction/share/classes/javax/transaction/InvalidTransactionException.java > --- a/src/java.transaction/share/classes/javax/transaction/InvalidTransactionException.java Thu Apr 16 10:44:23 2015 -0700 > +++ b/src/java.transaction/share/classes/javax/transaction/InvalidTransactionException.java Thu Apr 16 11:07:12 2015 -0700 > @@ -1,5 +1,5 @@ > /* > - * Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved. > + * Copyright (c) 1998, 2015, 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 > @@ -39,10 +39,17 @@ > @SuppressWarnings("serial") // serialVersionUID intentionally omitted > public class InvalidTransactionException extends java.rmi.RemoteException { > > + /** > + * Constructs an {@code InvalidTransactionException}. > + */ > public InvalidTransactionException() { > super(); > } > > + /** > + * Constructs an {@code InvalidTransactionException}. > + * @param msg the detail message > + */ > public InvalidTransactionException(String msg) { > super(msg); > } > diff -r 488af0e8ee33 src/java.transaction/share/classes/javax/transaction/TransactionRequiredException.java > --- a/src/java.transaction/share/classes/javax/transaction/TransactionRequiredException.java Thu Apr 16 10:44:23 2015 -0700 > +++ b/src/java.transaction/share/classes/javax/transaction/TransactionRequiredException.java Thu Apr 16 11:07:12 2015 -0700 > @@ -1,5 +1,5 @@ > /* > - * Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved. > + * Copyright (c) 1998, 2015, 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 > @@ -38,10 +38,17 @@ > @SuppressWarnings("serial") // serialVersionUID intentionally omitted > public class TransactionRequiredException extends java.rmi.RemoteException { > > + /** > + * Constructs a {@code TransactionRequiredException}. > + */ > public TransactionRequiredException() { > super(); > } > > + /** > + * Constructs a {@code TransactionRequiredException}. > + * @param msg the detail message > + */ > public TransactionRequiredException(String msg) { > super(msg); > } > diff -r 488af0e8ee33 src/java.transaction/share/classes/javax/transaction/TransactionRolledbackException.java > --- a/src/java.transaction/share/classes/javax/transaction/TransactionRolledbackException.java Thu Apr 16 10:44:23 2015 -0700 > +++ b/src/java.transaction/share/classes/javax/transaction/TransactionRolledbackException.java Thu Apr 16 11:07:12 2015 -0700 > @@ -1,5 +1,5 @@ > /* > - * Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved. > + * Copyright (c) 1998, 2015, 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 > @@ -41,10 +41,17 @@ > @SuppressWarnings("serial") // serialVersionUID intentionally omitted > public class TransactionRolledbackException extends java.rmi.RemoteException { > > + /** > + * Constructs a {@code TransactionRolledbackException}. > + */ > public TransactionRolledbackException() { > super(); > } > > + /** > + * Constructs a {@code TransactionRolledbackException}. > + * @param msg the detail message > + */ > public TransactionRolledbackException(String msg) { > super(msg); > } Lance Andersen| Principal Member of Technical Staff | +1.781.442.2037 Oracle Java Engineering 1 Network Drive Burlington, MA 01803 Lance.Andersen at oracle.com From joe.darcy at oracle.com Thu Apr 16 18:28:52 2015 From: joe.darcy at oracle.com (joe darcy) Date: Thu, 16 Apr 2015 11:28:52 -0700 Subject: JDK 9 RFR of adding missing javadoc to javax.transaction In-Reply-To: <3C3C812C-2A77-4C44-BC29-FB9069E9CC39@oracle.com> References: <552FFAB4.8080201@oracle.com> <3C3C812C-2A77-4C44-BC29-FB9069E9CC39@oracle.com> Message-ID: <552FFF64.5040201@oracle.com> Hi Lance, On 4/16/2015 11:27 AM, Lance Andersen wrote: > Hi Joe, > > This Looks OK. I have already had discussions with the Java EE leads > about adding the SUID and pushing the changes back upstream (and > updating other classes in upstream javax.transaction as needed. > I will be doing that soon and will push these changes as well. Thanks for offering to take care of that; cheers, -Joe > > Best, > Lance > On Apr 16, 2015, at 2:08 PM, joe darcy > wrote: > >> Hello, >> >> While preparing to turn on doclint build warnings on more modules, I >> noticed there are missing javadoc comments on various classes in >> javax.transaction. >> >> Please review the patch below which add in some obvious javadoc. >> >> Thanks, >> >> -Joe >> >> diff -r 488af0e8ee33 >> src/java.transaction/share/classes/javax/transaction/InvalidTransactionException.java >> --- >> a/src/java.transaction/share/classes/javax/transaction/InvalidTransactionException.java >> Thu Apr 16 10:44:23 2015 -0700 >> +++ >> b/src/java.transaction/share/classes/javax/transaction/InvalidTransactionException.java >> Thu Apr 16 11:07:12 2015 -0700 >> @@ -1,5 +1,5 @@ >> /* >> - * Copyright (c) 1998, 1999, Oracle and/or its affiliates. All >> rights reserved. >> + * Copyright (c) 1998, 2015, 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 >> @@ -39,10 +39,17 @@ >> @SuppressWarnings("serial") // serialVersionUID >> intentionally omitted >> public class InvalidTransactionException extends >> java.rmi.RemoteException { >> >> + /** >> + * Constructs an {@code InvalidTransactionException}. >> + */ >> public InvalidTransactionException() { >> super(); >> } >> >> + /** >> + * Constructs an {@code InvalidTransactionException}. >> + * @param msg the detail message >> + */ >> public InvalidTransactionException(String msg) { >> super(msg); >> } >> diff -r 488af0e8ee33 >> src/java.transaction/share/classes/javax/transaction/TransactionRequiredException.java >> --- >> a/src/java.transaction/share/classes/javax/transaction/TransactionRequiredException.java >> Thu Apr 16 10:44:23 2015 -0700 >> +++ >> b/src/java.transaction/share/classes/javax/transaction/TransactionRequiredException.java >> Thu Apr 16 11:07:12 2015 -0700 >> @@ -1,5 +1,5 @@ >> /* >> - * Copyright (c) 1998, 1999, Oracle and/or its affiliates. All >> rights reserved. >> + * Copyright (c) 1998, 2015, 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 >> @@ -38,10 +38,17 @@ >> @SuppressWarnings("serial") // serialVersionUID >> intentionally omitted >> public class TransactionRequiredException extends >> java.rmi.RemoteException { >> >> + /** >> + * Constructs a {@code TransactionRequiredException}. >> + */ >> public TransactionRequiredException() { >> super(); >> } >> >> + /** >> + * Constructs a {@code TransactionRequiredException}. >> + * @param msg the detail message >> + */ >> public TransactionRequiredException(String msg) { >> super(msg); >> } >> diff -r 488af0e8ee33 >> src/java.transaction/share/classes/javax/transaction/TransactionRolledbackException.java >> --- >> a/src/java.transaction/share/classes/javax/transaction/TransactionRolledbackException.java >> Thu Apr 16 10:44:23 2015 -0700 >> +++ >> b/src/java.transaction/share/classes/javax/transaction/TransactionRolledbackException.java >> Thu Apr 16 11:07:12 2015 -0700 >> @@ -1,5 +1,5 @@ >> /* >> - * Copyright (c) 1998, 1999, Oracle and/or its affiliates. All >> rights reserved. >> + * Copyright (c) 1998, 2015, 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 >> @@ -41,10 +41,17 @@ >> @SuppressWarnings("serial") // serialVersionUID >> intentionally omitted >> public class TransactionRolledbackException extends >> java.rmi.RemoteException { >> >> + /** >> + * Constructs a {@code TransactionRolledbackException}. >> + */ >> public TransactionRolledbackException() { >> super(); >> } >> >> + /** >> + * Constructs a {@code TransactionRolledbackException}. >> + * @param msg the detail message >> + */ >> public TransactionRolledbackException(String msg) { >> super(msg); >> } > > > > Lance > Andersen| Principal Member of Technical Staff | +1.781.442.2037 > Oracle Java Engineering > 1 Network Drive > Burlington, MA 01803 > Lance.Andersen at oracle.com > > > From Alan.Bateman at oracle.com Thu Apr 16 18:29:18 2015 From: Alan.Bateman at oracle.com (Alan Bateman) Date: Thu, 16 Apr 2015 19:29:18 +0100 Subject: JDK 9 RFR of adding missing javadoc to javax.transaction In-Reply-To: <552FFAB4.8080201@oracle.com> References: <552FFAB4.8080201@oracle.com> Message-ID: <552FFF7E.6020206@oracle.com> This looks okay but I think we should get Lance to check the EE folks because this area has a standalone JSR. It came up a few months too with the SUID and I think Lance is following up with them on that too. -Alan On 16/04/2015 19:08, joe darcy wrote: > Hello, > > While preparing to turn on doclint build warnings on more modules, I > noticed there are missing javadoc comments on various classes in > javax.transaction. > > Please review the patch below which add in some obvious javadoc. > > Thanks, > > -Joe > > diff -r 488af0e8ee33 > src/java.transaction/share/classes/javax/transaction/InvalidTransactionException.java > --- > a/src/java.transaction/share/classes/javax/transaction/InvalidTransactionException.java > Thu Apr 16 10:44:23 2015 -0700 > +++ > b/src/java.transaction/share/classes/javax/transaction/InvalidTransactionException.java > Thu Apr 16 11:07:12 2015 -0700 > @@ -1,5 +1,5 @@ > /* > - * Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights > reserved. > + * Copyright (c) 1998, 2015, 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 > @@ -39,10 +39,17 @@ > @SuppressWarnings("serial") // serialVersionUID > intentionally omitted > public class InvalidTransactionException extends > java.rmi.RemoteException { > > + /** > + * Constructs an {@code InvalidTransactionException}. > + */ > public InvalidTransactionException() { > super(); > } > > + /** > + * Constructs an {@code InvalidTransactionException}. > + * @param msg the detail message > + */ > public InvalidTransactionException(String msg) { > super(msg); > } > diff -r 488af0e8ee33 > src/java.transaction/share/classes/javax/transaction/TransactionRequiredException.java > --- > a/src/java.transaction/share/classes/javax/transaction/TransactionRequiredException.java > Thu Apr 16 10:44:23 2015 -0700 > +++ > b/src/java.transaction/share/classes/javax/transaction/TransactionRequiredException.java > Thu Apr 16 11:07:12 2015 -0700 > @@ -1,5 +1,5 @@ > /* > - * Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights > reserved. > + * Copyright (c) 1998, 2015, 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 > @@ -38,10 +38,17 @@ > @SuppressWarnings("serial") // serialVersionUID > intentionally omitted > public class TransactionRequiredException extends > java.rmi.RemoteException { > > + /** > + * Constructs a {@code TransactionRequiredException}. > + */ > public TransactionRequiredException() { > super(); > } > > + /** > + * Constructs a {@code TransactionRequiredException}. > + * @param msg the detail message > + */ > public TransactionRequiredException(String msg) { > super(msg); > } > diff -r 488af0e8ee33 > src/java.transaction/share/classes/javax/transaction/TransactionRolledbackException.java > --- > a/src/java.transaction/share/classes/javax/transaction/TransactionRolledbackException.java > Thu Apr 16 10:44:23 2015 -0700 > +++ > b/src/java.transaction/share/classes/javax/transaction/TransactionRolledbackException.java > Thu Apr 16 11:07:12 2015 -0700 > @@ -1,5 +1,5 @@ > /* > - * Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights > reserved. > + * Copyright (c) 1998, 2015, 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 > @@ -41,10 +41,17 @@ > @SuppressWarnings("serial") // serialVersionUID > intentionally omitted > public class TransactionRolledbackException extends > java.rmi.RemoteException { > > + /** > + * Constructs a {@code TransactionRolledbackException}. > + */ > public TransactionRolledbackException() { > super(); > } > > + /** > + * Constructs a {@code TransactionRolledbackException}. > + * @param msg the detail message > + */ > public TransactionRolledbackException(String msg) { > super(msg); > } From vladimir.x.ivanov at oracle.com Thu Apr 16 18:56:23 2015 From: vladimir.x.ivanov at oracle.com (Vladimir Ivanov) Date: Thu, 16 Apr 2015 21:56:23 +0300 Subject: [9] RFR (M): 8057967: CallSite dependency tracking scales devastatingly poorly In-Reply-To: References: <551C5B92.8060500@oracle.com> <552527E1.5060102@oracle.com> <552E89EC.7080900@oracle.com> Message-ID: <553005D7.2070102@oracle.com> Roland, thanks a lot for the review! Best regards, Vladimir Ivanov On 4/15/15 7:43 PM, Roland Westrelin wrote: >> http://cr.openjdk.java.net/~vlivanov/8057967/webrev.01/ > > That looks good to me. > > Roland. > From thomas.stuefe at gmail.com Thu Apr 16 19:01:50 2015 From: thomas.stuefe at gmail.com (=?UTF-8?Q?Thomas_St=C3=BCfe?=) Date: Thu, 16 Apr 2015 21:01:50 +0200 Subject: RFR 9: 8077350 Process API Updates Implementation Review In-Reply-To: <55296E19.3040204@Oracle.com> References: <5526DA4A.6030808@Oracle.com> <55296E19.3040204@Oracle.com> Message-ID: Hi Roger, thank you for your answer! The reason I take an interest is not just theoretical. We (SAP) use our JVM for our test infrastructure and we had exactly the problem allChildren() is designed to solve: killing a process tree related to a specific tests (similar to jtreg tests) in case of errors or hangs. We have test machines running large workloads of tests in parallel and we reach pid wraparound - depending on the OS - quite fast. We solved this by adding process groups to Process.java and we are very happy with this solution. We are able to quickly kill a whole process tree, cleanly and completely, without ambiguity or risk to other tests. Of course we had to add this support as a "sideways hack" in order to not change the official Process.java interface. Therefore I was hoping that with JEP 102, we would get official support for process groups. Unfortunately, seems the decision is already done and we are too late in the discussion :( see my other comments inline. On Sat, Apr 11, 2015 at 8:55 PM, Roger Riggs wrote: > Hi Thomas, > > Thanks for the comments. > > On 4/11/2015 8:31 AM, Thomas St?fe wrote: > > Hi Roger, > > I have a question about getChildren() and getAllChildren(). > > I assume the point of those functions is to implement point 4 of JEP 102 > ("The ability to deal with process trees, in particular some means to > destroy a process tree."), by returning a collection of PIDs which are the > children of the process and then killing them? > > Earlier versions included a killProcess tree method but it was recommended > to leave > the exact algorithm to kill processes to the caller. > > > However, I am not sure that this can be implemented in a safe way, at > least on UNIX, because - as Martin already pointed out - of PID recycling. > I do not see how you can prevent allChildren() from returning PIDs which > may be already reaped and recyled when you use them later. How do you > prevent that? > > Unless there is an extended time between getting the children and > destroying them the pids will still be valid. > Why? Child process may be getting reaped the instant you are done reading it from /proc, and pid may have been recycled by the OS right away and already pointing to another process when allChildren() returns. If a process lives about as long as it takes the system to reach a pid wraparound to the same pid value, its pid could be recycled right after it is reaped, or? Sure, the longer you wait, the higher the chance of this to happen, but it may happen right away. As Martin said, we had those races in the kill() code since a long time, but children()/allChildren() could make those error more probable, because now more processes are involved. Especially if you use allChildren to kill a deep process tree. And there is nothing in the javadoc warning the user about this scenario. You would just happen from time to time to kill an unrelated process. Those problems are hard to debug. The technique of caching the start time can prevent that case; though it > has AFAIK not been a problem. > How would that work? User should, before issuing the kill, compare start time of process to kill with cached start time? > Note even if your coding is bulletproof, that allChildren() will also > return PIDs of sub processes which are completely unrelated to you and > Process.java - they could have been forked by some third party native code > which just happens to run in parallel in the same process. There, you have > no control about when it gets reaped. It might already have been reaped by > the time allChildren() returns, and now the same PID got recycled as > another, unrelated process. > > Of course, the best case is for an application to spawn and manage its own > processes > and handle there proper termination. > The use cases for children/allChildren are focused on > supervisory/executive functions > that monitor a running system and can cleanup even in the case of > unexpected failures. > All management of processes is subject to OS limitations, if the PID were > from a completely > different process tree, the ordinary destroy/info functions would not be > available > unless the process was running as a privileged os user (same as any other > native application). > Could you explain this please? If both trees run under the same user, why should I not be able to kill a process from a different tree? > If I am right, it would not be sufficient to state "There is no guarantee > that a process is alive." - it may be alive but by now be a different > process altogether. This makes "allChildren()" useless for many cases, > because the returned information may already be obsolete the moment the > function returns. > > The caching of startTime can remove the ambiguity. > > > Of course I may something missing here? > > But if I got all that right and the sole purpose of allChildren() is to > be able to kill them (or otherwise signal them), why not use process > groups? Process groups would be the traditional way on POSIX platforms to > handle process trees, and they are also available on Windows in the form of > Job Objects. > > Using process groups to signal sub process trees would be safe, would > not rely on PID identity, and would be more efficient. Also way less > coding. Also, it would be an old, established pattern - process groups have > been around for a long time. Also, using process groups it is possible to > break away from a group, so a program below you which wants to run as a > demon can do so by removing itself from the process group and thus escaping > your kill. > > On Windows we have Job objects, and I think there are enough > similarities to POSIX process groups to abstract them into something > platform independent. > > Earlier discussions of process termination and exit value reaping > considered > using process groups but it became evident that the Java runtime needed to > be very careful to not interfere with processes that might be spawned and > controlled by native libraries and that process groups would only increase > complexity and the interactions. > > Thanks, Roger > > Thanks! Thomas From Ulf.Zibis at CoSoCo.de Thu Apr 16 21:54:14 2015 From: Ulf.Zibis at CoSoCo.de (Ulf Zibis) Date: Thu, 16 Apr 2015 23:54:14 +0200 Subject: Places we should use the new ByteBuffer intrinsics In-Reply-To: References: <550330CE.3030607@redhat.com> <550710BD.5060301@redhat.com> <440070D1-AFBF-4D3A-9825-0659BA280ADC@oracle.com> <5508325C.4000108@redhat.com> <550A90CE.9080901@redhat.com> <550AF27F.4050305@oracle.com> <550AFA3C.5030002@oracle.com> <550AFF16.9080600@oracle.com> <550B350B.6040602@oracle.com> <550C460F.1090302@redhat.com> <550C989A.5010203@oracle.com> <550D57B1.602@redhat.com> <550D9D02.1020303@oracle.com> <55105C0A.8070305@redhat.com> <55108130.2010207@oracle.com> <55111D21.1020502@redhat.com> <5511F5EA.6010102@oracle.com> <55127C35.8000108@redhat.com> <552F9541.10903@redhat.com> Message-ID: <55302F86.3010208@CoSoCo.de> Am 16.04.2015 um 15:25 schrieb Paul Sandoz: > They look like good candidates. I did a quick search in the JDK src code (usages of getByte/Short/Int/Long) and could not find any others. I guess there are plenty of candidates in coders of sun.nio.cs. At the end it wouldn't make me wonder if we could get rid of the "if (src.hasArray())"-fork. -Ulf From Ulf.Zibis at CoSoCo.de Thu Apr 16 21:57:11 2015 From: Ulf.Zibis at CoSoCo.de (Ulf Zibis) Date: Thu, 16 Apr 2015 23:57:11 +0200 Subject: Places we should use the new ByteBuffer intrinsics In-Reply-To: References: <550330CE.3030607@redhat.com> <550710BD.5060301@redhat.com> <440070D1-AFBF-4D3A-9825-0659BA280ADC@oracle.com> <5508325C.4000108@redhat.com> <550A90CE.9080901@redhat.com> <550AF27F.4050305@oracle.com> <550AFA3C.5030002@oracle.com> <550AFF16.9080600@oracle.com> <550B350B.6040602@oracle.com> <550C460F.1090302@redhat.com> <550C989A.5010203@oracle.com> <550D57B1.602@redhat.com> <550D9D02.1020303@oracle.com> <55105C0A.8070305@redhat.com> <55108130.2010207@oracle.com> <55111D21.1020502@redhat.com> <5511F5EA.6010102@oracle.com> <55127C35.8000108@redhat.com> <552F9541.10903@redhat.com> Message-ID: <55303037.4040907@CoSoCo.de> Am 16.04.2015 um 15:25 schrieb Paul Sandoz: > They look like good candidates. I did a quick search in the JDK src code (usages of getByte/Short/Int/Long) and could not find any others. I guess there are plenty of candidates in coders of sun.nio.cs. Additionally: For some coders it may be reasonable to have get3Bytes() and put3Bytes() methods. At the end it wouldn't make me wonder if we could get rid of the "if (src.hasArray())"-fork. -Ulf From vladimir.kozlov at oracle.com Thu Apr 16 23:04:15 2015 From: vladimir.kozlov at oracle.com (Vladimir Kozlov) Date: Thu, 16 Apr 2015 16:04:15 -0700 Subject: RFR: 8073093: AARCH64: C2 generates poor code for ByteBuffer accesses In-Reply-To: <552FEC60.3060308@redhat.com> References: <20150213230416.5E7B617FDAA@rebar.astron.com> <54DE8BB7.5050801@oracle.com> <54DE9140.3040604@oracle.com> <54E30C38.8000303@redhat.com> <54E31144.3040504@redhat.com> <54E314BF.3010205@redhat.com> <54E31677.1050209@redhat.com> <54E31CA6.6030609@redhat.com> <54E31DA0.2040901@redhat.com> <54E34EAF.6000802@redhat.com> <54E457E0.20408@redhat.com> <54E45842.9030102@redhat.com> <54E473D1.8000506@redhat.com> <54E4FD45.5090106@oracle.com> <552FEC60.3060308@redhat.com> Message-ID: <55303FEF.1010402@oracle.com> Because that code was added and tested only for boxed objects (goal of 6934604) - I wanted to avoid wider effects of those changes. I think we can remove the limitation now in jd9 sources since we have enough time to tests it. Regards, Vladimir On 4/16/15 10:07 AM, Andrew Haley wrote: > On 02/18/2015 08:59 PM, Vladimir Kozlov wrote: >> The code which eliminates MemBars for scalarized objects was added in jdk8: >> >> http://hg.openjdk.java.net/jdk9/jdk9/hotspot/rev/6f3fd5150b67 > > Right enough, but it only works with boxed objects. The > Precedent of the MemBarNode is needed by MemBarNode::Ideal, > and it's checked for: > > // Eliminate volatile MemBars for scalar replaced objects. > if (can_reshape && req() == (Precedent+1)) { > ... think about eliminating the MemBar > > So if there's no Precedent, none of the barrier elimination is done. > > The only thing that sets the MemBar's Precedent is here: > > In parse::do_put_xxx > > // Preserve allocation ptr to create precedent edge to it in membar > // generated on exit from constructor. > if (C->eliminate_boxing() && > adr_type->isa_oopptr() && adr_type->is_oopptr()->is_ptr_to_boxed_value() && > AllocateNode::Ideal_allocation(obj, &_gvn) != NULL) { > set_alloc_with_final(obj); > } > > The barrier is created in parse1, and uses alloc_with_final: > > if (method()->is_initializer() && > (wrote_final() || > PPC64_ONLY(wrote_volatile() ||) > (AlwaysSafeConstructors && wrote_fields()))) { > _exits.insert_mem_bar(Op_MemBarRelease, alloc_with_final()); > > So, it looks to me as though even the most trivial user-defined > constructors with final fields will never eliminate barriers. > > I don't know what the thinking is here. Why does it matter whether > the type being constructed is a boxed value? > > Andrew. > From staffan.larsen at oracle.com Fri Apr 17 06:40:31 2015 From: staffan.larsen at oracle.com (Staffan Larsen) Date: Fri, 17 Apr 2015 08:40:31 +0200 Subject: RFR 9: 8077350 Process API Updates Implementation Review In-Reply-To: References: <5526DA4A.6030808@Oracle.com> <55296E19.3040204@Oracle.com> Message-ID: > On 16 apr 2015, at 21:01, Thomas St?fe wrote: > > Hi Roger, > > thank you for your answer! > > The reason I take an interest is not just theoretical. We (SAP) use our JVM > for our test infrastructure and we had exactly the problem allChildren() is > designed to solve: killing a process tree related to a specific tests > (similar to jtreg tests) in case of errors or hangs. We have test machines > running large workloads of tests in parallel and we reach pid wraparound - > depending on the OS - quite fast. > > We solved this by adding process groups to Process.java and we are very > happy with this solution. We are able to quickly kill a whole process tree, > cleanly and completely, without ambiguity or risk to other tests. Of course > we had to add this support as a "sideways hack" in order to not change the > official Process.java interface. Therefore I was hoping that with JEP 102, > we would get official support for process groups. Unfortunately, seems the > decision is already done and we are too late in the discussion :( Interestingly we are hoping to use allChildren() to kill process trees in jtreg - exactly the use case you are describing. I haven?t been testing the current approach in allChildren(), but it seems your experience indicates that it will not be a perfect fit for the use case. In a previous test framework I was involved in we also used process groups for this with good results. This does beg the question: if the current approach isn?t useful for our own testing purposes, when is it useful? Thanks, /Staffan > > see my other comments inline. > > On Sat, Apr 11, 2015 at 8:55 PM, Roger Riggs > wrote: > >> Hi Thomas, >> >> Thanks for the comments. >> >> On 4/11/2015 8:31 AM, Thomas St?fe wrote: >> >> Hi Roger, >> >> I have a question about getChildren() and getAllChildren(). >> >> I assume the point of those functions is to implement point 4 of JEP 102 >> ("The ability to deal with process trees, in particular some means to >> destroy a process tree."), by returning a collection of PIDs which are the >> children of the process and then killing them? >> >> Earlier versions included a killProcess tree method but it was recommended >> to leave >> the exact algorithm to kill processes to the caller. >> >> >> However, I am not sure that this can be implemented in a safe way, at >> least on UNIX, because - as Martin already pointed out - of PID recycling. >> I do not see how you can prevent allChildren() from returning PIDs which >> may be already reaped and recyled when you use them later. How do you >> prevent that? >> >> Unless there is an extended time between getting the children and >> destroying them the pids will still be valid. >> > > Why? Child process may be getting reaped the instant you are done reading > it from /proc, and pid may have been recycled by the OS right away and > already pointing to another process when allChildren() returns. If a > process lives about as long as it takes the system to reach a pid > wraparound to the same pid value, its pid could be recycled right after it > is reaped, or? Sure, the longer you wait, the higher the chance of this to > happen, but it may happen right away. > > As Martin said, we had those races in the kill() code since a long time, > but children()/allChildren() could make those error more probable, because > now more processes are involved. Especially if you use allChildren to kill > a deep process tree. And there is nothing in the javadoc warning the user > about this scenario. You would just happen from time to time to kill an > unrelated process. Those problems are hard to debug. > > The technique of caching the start time can prevent that case; though it >> has AFAIK not been a problem. >> > > How would that work? User should, before issuing the kill, compare start > time of process to kill with cached start time? > >> Note even if your coding is bulletproof, that allChildren() will also >> return PIDs of sub processes which are completely unrelated to you and >> Process.java - they could have been forked by some third party native code >> which just happens to run in parallel in the same process. There, you have >> no control about when it gets reaped. It might already have been reaped by >> the time allChildren() returns, and now the same PID got recycled as >> another, unrelated process. >> >> Of course, the best case is for an application to spawn and manage its own >> processes >> and handle there proper termination. >> The use cases for children/allChildren are focused on >> supervisory/executive functions >> that monitor a running system and can cleanup even in the case of >> unexpected failures. >> > All management of processes is subject to OS limitations, if the PID were >> from a completely >> different process tree, the ordinary destroy/info functions would not be >> available >> unless the process was running as a privileged os user (same as any other >> native application). >> > > Could you explain this please? If both trees run under the same user, why > should I not be able to kill a process from a different tree? > >> If I am right, it would not be sufficient to state "There is no guarantee >> that a process is alive." - it may be alive but by now be a different >> process altogether. This makes "allChildren()" useless for many cases, >> because the returned information may already be obsolete the moment the >> function returns. >> >> The caching of startTime can remove the ambiguity. >> > >> >> Of course I may something missing here? >> >> But if I got all that right and the sole purpose of allChildren() is to >> be able to kill them (or otherwise signal them), why not use process >> groups? Process groups would be the traditional way on POSIX platforms to >> handle process trees, and they are also available on Windows in the form of >> Job Objects. >> >> Using process groups to signal sub process trees would be safe, would >> not rely on PID identity, and would be more efficient. Also way less >> coding. Also, it would be an old, established pattern - process groups have >> been around for a long time. Also, using process groups it is possible to >> break away from a group, so a program below you which wants to run as a >> demon can do so by removing itself from the process group and thus escaping >> your kill. >> >> On Windows we have Job objects, and I think there are enough >> similarities to POSIX process groups to abstract them into something >> platform independent. >> >> Earlier discussions of process termination and exit value reaping >> considered >> using process groups but it became evident that the Java runtime needed to >> be very careful to not interfere with processes that might be spawned and >> controlled by native libraries and that process groups would only increase >> complexity and the interactions. >> > >> Thanks, Roger >> >> > Thanks! Thomas From peter.levart at gmail.com Fri Apr 17 08:05:35 2015 From: peter.levart at gmail.com (Peter Levart) Date: Fri, 17 Apr 2015 10:05:35 +0200 Subject: RFR 9: 8077350 Process API Updates Implementation Review In-Reply-To: <55296E19.3040204@Oracle.com> References: <5526DA4A.6030808@Oracle.com> <55296E19.3040204@Oracle.com> Message-ID: <5530BECF.60903@gmail.com> Hi Roger, Retrieving and caching the process start time as soon as ProcessHandle is instantiated might be a good idea. "destroy" native code would then use pid *and* start time to check the identity of the process before killing it. At least on Linux (/proc//stat) and Solaris (/proc//status) it is not necessary to open those special files and read them. Just doing stat() on them and using the st_mtime will get you the process start time. I see AIX shares native code with Linux (unix), so perhaps AIX does the same. Mac OSX and Windows have special calls... In case OS does not allow retrieving the start time (not owner or similar), it should be cached as some "undefined" value and treated the same when destroying. If while obtaining the ProcessHandle *and* while destorying the process, the start time of the process with a particular pid is "undefined" then there are two options: 1 - don't kill the process 2 - kill the process They might actually be no different as the reason of not being able to retrieve the start time (not owner) might prevent the process from being killed too, so option 2 could be used to allow killing on any hypothetical platforms that don't support retrieving start time and it is no worse than current implementation anyway. What do you think? Regards, Peter On 04/11/2015 08:55 PM, Roger Riggs wrote: > Hi Thomas, > > Thanks for the comments. > > On 4/11/2015 8:31 AM, Thomas St?fe wrote: >> Hi Roger, >> >> I have a question about getChildren() and getAllChildren(). >> >> I assume the point of those functions is to implement point 4 of JEP >> 102 ("The ability to deal with process trees, in particular some >> means to destroy a process tree."), by returning a collection of PIDs >> which are the children of the process and then killing them? > Earlier versions included a killProcess tree method but it was > recommended to leave > the exact algorithm to kill processes to the caller. >> >> However, I am not sure that this can be implemented in a safe way, at >> least on UNIX, because - as Martin already pointed out - of PID >> recycling. I do not see how you can prevent allChildren() from >> returning PIDs which may be already reaped and recyled when you use >> them later. How do you prevent that? > Unless there is an extended time between getting the children and > destroying them the pids will still be valid. > The technique of caching the start time can prevent that case; though > it has AFAIK not been a problem. >> >> Note even if your coding is bulletproof, that allChildren() will also >> return PIDs of sub processes which are completely unrelated to you >> and Process.java - they could have been forked by some third party >> native code which just happens to run in parallel in the same >> process. There, you have no control about when it gets reaped. It >> might already have been reaped by the time allChildren() returns, and >> now the same PID got recycled as another, unrelated process. > Of course, the best case is for an application to spawn and manage its > own processes > and handle there proper termination. > The use cases for children/allChildren are focused on > supervisory/executive functions > that monitor a running system and can cleanup even in the case of > unexpected failures. > All management of processes is subject to OS limitations, if the PID > were from a completely > different process tree, the ordinary destroy/info functions would not > be available > unless the process was running as a privileged os user (same as any > other native application). > >> >> If I am right, it would not be sufficient to state "There is no >> guarantee that a process is alive." - it may be alive but by now be a >> different process altogether. This makes "allChildren()" useless for >> many cases, because the returned information may already be obsolete >> the moment the function returns. > The caching of startTime can remove the ambiguity. >> >> Of course I may something missing here? >> >> But if I got all that right and the sole purpose of allChildren() is >> to be able to kill them (or otherwise signal them), why not use >> process groups? Process groups would be the traditional way on POSIX >> platforms to handle process trees, and they are also available on >> Windows in the form of Job Objects. >> >> Using process groups to signal sub process trees would be safe, would >> not rely on PID identity, and would be more efficient. Also way less >> coding. Also, it would be an old, established pattern - process >> groups have been around for a long time. Also, using process groups >> it is possible to break away from a group, so a program below you >> which wants to run as a demon can do so by removing itself from the >> process group and thus escaping your kill. >> >> On Windows we have Job objects, and I think there are enough >> similarities to POSIX process groups to abstract them into something >> platform independent. > Earlier discussions of process termination and exit value reaping > considered > using process groups but it became evident that the Java runtime > needed to > be very careful to not interfere with processes that might be spawned and > controlled by native libraries and that process groups would only > increase > complexity and the interactions. > >> >> The only problem I think is that the API would have somehow to be >> changed. Either by directly reflecting the use of process groups, or >> at least by removing allChildren() and replacing it with something >> like "killAllChildren()" or "signalAllChildren()". > > Thanks, Roger > >> >> Kind Regards, Thomas >> >> >> >> >> >> >> >> >> >> >> >> On Thu, Apr 9, 2015 at 10:00 PM, Roger Riggs > > wrote: >> >> Please review the API and implementation of the Process API Updates >> described inJEP 102 >> . Please review >> and comment by April 23rd. >> >> The recommendation to make ProcessHandle an interface is included >> allowing the new functions to be extended by Process subclasses. >> The implementation covers all functions on Unix, Windows, Solaris, >> and Mac OS X. >> >> The API doc: http://cr.openjdk.java.net/~rriggs/ph-apidraft/ >> >> >> The webrev: http://cr.openjdk.java.net/~rriggs/webrev-ph >> >> >> Issue: JDK-8077350 >> Process API >> Updates Implementation >> >> The code is in the jdk9 sandbox on branch JDK-8046092-branch. >> >> Please review and comment, Roger >> >> >> >> On Thu, Apr 9, 2015 at 10:00 PM, Roger Riggs > > wrote: >> >> Please review the API and implementation of the Process API Updates >> described inJEP 102 >> . Please review >> and comment by April 23rd. >> >> The recommendation to make ProcessHandle an interface is included >> allowing the new functions to be extended by Process subclasses. >> The implementation covers all functions on Unix, Windows, Solaris, >> and Mac OS X. >> >> The API doc: http://cr.openjdk.java.net/~rriggs/ph-apidraft/ >> >> >> The webrev: http://cr.openjdk.java.net/~rriggs/webrev-ph >> >> >> Issue: JDK-8077350 >> Process API >> Updates Implementation >> >> The code is in the jdk9 sandbox on branch JDK-8046092-branch. >> >> Please review and comment, Roger >> >> > From thomas.stuefe at gmail.com Fri Apr 17 08:14:42 2015 From: thomas.stuefe at gmail.com (=?UTF-8?Q?Thomas_St=C3=BCfe?=) Date: Fri, 17 Apr 2015 10:14:42 +0200 Subject: RFR 9: 8077350 Process API Updates Implementation Review In-Reply-To: References: <5526DA4A.6030808@Oracle.com> <55296E19.3040204@Oracle.com> Message-ID: On Fri, Apr 17, 2015 at 8:40 AM, Staffan Larsen wrote: > > On 16 apr 2015, at 21:01, Thomas St?fe wrote: > > Hi Roger, > > thank you for your answer! > > The reason I take an interest is not just theoretical. We (SAP) use our JVM > for our test infrastructure and we had exactly the problem allChildren() is > designed to solve: killing a process tree related to a specific tests > (similar to jtreg tests) in case of errors or hangs. We have test machines > running large workloads of tests in parallel and we reach pid wraparound - > depending on the OS - quite fast. > > We solved this by adding process groups to Process.java and we are very > happy with this solution. We are able to quickly kill a whole process tree, > cleanly and completely, without ambiguity or risk to other tests. Of course > we had to add this support as a "sideways hack" in order to not change the > official Process.java interface. Therefore I was hoping that with JEP 102, > we would get official support for process groups. Unfortunately, seems the > decision is already done and we are too late in the discussion :( > > > Interestingly we are hoping to use allChildren() to kill process trees in > jtreg - exactly the use case you are describing. I haven?t been testing the > current approach in allChildren(), but it seems your experience indicates > that it will not be a perfect fit for the use case. In a previous test > framework I was involved in we also used process groups for this with good > results. This does beg the question: if the current approach isn?t useful > for our own testing purposes, when is it useful? > > Monitoring, I guess. Like writing your own pstree. But not for anything requiring you to send signals to those pids. ..Thomas > Thanks, > /Staffan > > > see my other comments inline. > > On Sat, Apr 11, 2015 at 8:55 PM, Roger Riggs > wrote: > > Hi Thomas, > > Thanks for the comments. > > On 4/11/2015 8:31 AM, Thomas St?fe wrote: > > Hi Roger, > > I have a question about getChildren() and getAllChildren(). > > I assume the point of those functions is to implement point 4 of JEP 102 > ("The ability to deal with process trees, in particular some means to > destroy a process tree."), by returning a collection of PIDs which are the > children of the process and then killing them? > > Earlier versions included a killProcess tree method but it was recommended > to leave > the exact algorithm to kill processes to the caller. > > > However, I am not sure that this can be implemented in a safe way, at > least on UNIX, because - as Martin already pointed out - of PID recycling. > I do not see how you can prevent allChildren() from returning PIDs which > may be already reaped and recyled when you use them later. How do you > prevent that? > > Unless there is an extended time between getting the children and > destroying them the pids will still be valid. > > > Why? Child process may be getting reaped the instant you are done reading > it from /proc, and pid may have been recycled by the OS right away and > already pointing to another process when allChildren() returns. If a > process lives about as long as it takes the system to reach a pid > wraparound to the same pid value, its pid could be recycled right after it > is reaped, or? Sure, the longer you wait, the higher the chance of this to > happen, but it may happen right away. > > As Martin said, we had those races in the kill() code since a long time, > but children()/allChildren() could make those error more probable, because > now more processes are involved. Especially if you use allChildren to kill > a deep process tree. And there is nothing in the javadoc warning the user > about this scenario. You would just happen from time to time to kill an > unrelated process. Those problems are hard to debug. > > The technique of caching the start time can prevent that case; though it > > has AFAIK not been a problem. > > > How would that work? User should, before issuing the kill, compare start > time of process to kill with cached start time? > > Note even if your coding is bulletproof, that allChildren() will also > return PIDs of sub processes which are completely unrelated to you and > Process.java - they could have been forked by some third party native code > which just happens to run in parallel in the same process. There, you have > no control about when it gets reaped. It might already have been reaped by > the time allChildren() returns, and now the same PID got recycled as > another, unrelated process. > > Of course, the best case is for an application to spawn and manage its own > processes > and handle there proper termination. > The use cases for children/allChildren are focused on > supervisory/executive functions > that monitor a running system and can cleanup even in the case of > unexpected failures. > > All management of processes is subject to OS limitations, if the PID were > > from a completely > different process tree, the ordinary destroy/info functions would not be > available > unless the process was running as a privileged os user (same as any other > native application). > > > Could you explain this please? If both trees run under the same user, why > should I not be able to kill a process from a different tree? > > If I am right, it would not be sufficient to state "There is no guarantee > that a process is alive." - it may be alive but by now be a different > process altogether. This makes "allChildren()" useless for many cases, > because the returned information may already be obsolete the moment the > function returns. > > The caching of startTime can remove the ambiguity. > > > > Of course I may something missing here? > > But if I got all that right and the sole purpose of allChildren() is to > be able to kill them (or otherwise signal them), why not use process > groups? Process groups would be the traditional way on POSIX platforms to > handle process trees, and they are also available on Windows in the form of > Job Objects. > > Using process groups to signal sub process trees would be safe, would > not rely on PID identity, and would be more efficient. Also way less > coding. Also, it would be an old, established pattern - process groups have > been around for a long time. Also, using process groups it is possible to > break away from a group, so a program below you which wants to run as a > demon can do so by removing itself from the process group and thus escaping > your kill. > > On Windows we have Job objects, and I think there are enough > similarities to POSIX process groups to abstract them into something > platform independent. > > Earlier discussions of process termination and exit value reaping > considered > using process groups but it became evident that the Java runtime needed to > be very careful to not interfere with processes that might be spawned and > controlled by native libraries and that process groups would only increase > complexity and the interactions. > > > Thanks, Roger > > > Thanks! Thomas > > > From thomas.stuefe at gmail.com Fri Apr 17 08:22:29 2015 From: thomas.stuefe at gmail.com (=?UTF-8?Q?Thomas_St=C3=BCfe?=) Date: Fri, 17 Apr 2015 10:22:29 +0200 Subject: RFR 9: 8077350 Process API Updates Implementation Review In-Reply-To: <5526DA4A.6030808@Oracle.com> References: <5526DA4A.6030808@Oracle.com> Message-ID: Hi Roger, aside from the recycle-pid-question, one additional remark: in ProcessHandleImpl_unix.c, Java_java_lang_ProcessHandleImpl_isAlive0, you call kill(pid, 0) for the liveness check. If you have not the necessary permissions to do this call, this may fail with EPERM. In this case, isAlive() will return false, but the process exists, which strictly spoken is a lie. Caller may base actions on this, e.g. try to clean up resources for a process he thinks is dead. We actually had this problem, and our version of isAlive() grew to be more elaborate over time. Basically, we do: 1) first try kill(0). If EPERM: 2) try read /proc on OSes which have /proc. 3) do a system("ps"). Alternativly, one may report EPERM to the caller - with an exception or an extension of the return value - and leave it up to him what to do. Kind Regards, Thomas On Thu, Apr 9, 2015 at 10:00 PM, Roger Riggs wrote: > Please review the API and implementation of the Process API Updates > described inJEP 102 . > Please review and comment by April 23rd. > > The recommendation to make ProcessHandle an interface is included > allowing the new functions to be extended by Process subclasses. > The implementation covers all functions on Unix, Windows, Solaris, and Mac > OS X. > > The API doc: http://cr.openjdk.java.net/~rriggs/ph-apidraft/ > > The webrev: http://cr.openjdk.java.net/~rriggs/webrev-ph > > Issue: JDK-8077350 > Process API Updates Implementation > > The code is in the jdk9 sandbox on branch JDK-8046092-branch. > > Please review and comment, Roger > From alexander.v.stepanov at oracle.com Fri Apr 17 11:36:19 2015 From: alexander.v.stepanov at oracle.com (alexander stepanov) Date: Fri, 17 Apr 2015 14:36:19 +0300 Subject: RFR [9] 8077332: tidy warnings from javax/xml In-Reply-To: <552FEA0C.1050904@oracle.com> References: <5527F132.80408@oracle.com> <552815F4.4050005@oracle.com> <552BA6FD.5000706@oracle.com> <552BABBA.6050903@oracle.com> <552C08C2.4030503@oracle.com> <552E8DD5.3080207@oracle.com> <552FAF93.9020500@oracle.com> <552FC206.3090308@oracle.com> <552FEA0C.1050904@oracle.com> Message-ID: <5530F033.2050609@oracle.com> Hello Joe, > [jw] as I mentioned,
     is needed for the code snippet.
    Fixed, please see
    http://cr.openjdk.java.net/~avstepan/8077332/webrev.01/jaxp/src/java.xml/share/classes/javax/xml/stream/XMLStreamReader.java.udiff.html
    
      > [jw] I saw in a few cases where two @code tags are next to each other
    Fixed in a couple of places.
    
    Regards,
    Alexander
    
    On 16.04.2015 19:57, huizhe wang wrote:
    > Hi Alexander,
    >
    > Looks very good. Thanks for making all the changes!
    >
    > Please note that for the JAXWS, you may need to check with JAXWS/Miran 
    > (miroslav.kos at oracle.com). Changes to JAXWS generally goes into the 
    > standalone first. They do periodic integration.
    >
    > For the jaxp portion:
    > --- old/src/java.xml/share/classes/javax/xml/datatype/Duration.java 
    > 2015-04-16 13:50:25.249473095 +0400
    > +++ new/src/java.xml/share/classes/javax/xml/datatype/Duration.java 
    > 2015-04-16 13:50:25.161473099 +0400
    >
    > @@ -725,37 +725,37 @@
    >
    >       *
    > -     * @return the relationship between this 
    > Durationand duration parameter as
    > +     * @return the relationship between {@code this} {@code 
    > Duration}and {@code duration} parameter as
    >
    > [jw] I saw in a few cases where two @code tags are next to each other, 
    > you may do a s/} {@code//g to combine them. A space is also missing 
    > before 'and': e.g. {@code Duration} and.
    >
    >
    > --- 
    > old/src/java.xml/share/classes/javax/xml/stream/XMLStreamReader.java 
    > 2015-04-16 13:50:28.197472963 +0400
    > +++ 
    > new/src/java.xml/share/classes/javax/xml/stream/XMLStreamReader.java 
    > 2015-04-16 13:50:28.105472967 +0400
    >
    > @@ -542,7 +543,7 @@
    >     * If the number of characters actually copied is less than the 
    > "length", then there is no more text.
    >     * Otherwise, subsequent calls need to be made until all text has 
    > been retrieved. For example:
    >     *
    > -   *
    > +   * {@code
    >     * int length = 1024;
    >     * char[] myBuffer = new char[ length ];
    >     *
    > @@ -553,7 +554,7 @@
    >     *   if (nCopied < length)
    >     *       break;
    >     * }
    > -   * 
    > +   * }
    >
    > [jw] as I mentioned, 
     is needed for the code snippet.
    >
    >
    > BTW, have you compiled and verified the Javadoc after the changes?
    >
    > Thanks,
    > Joe
    >
    > On 4/16/2015 7:07 AM, alexander stepanov wrote:
    >> I'm sorry, two extra files touched -
    >> http://cr.openjdk.java.net/~avstepan/8077332/webrev.01/jaxws/src/java.activation/share/classes/javax/activation/MailcapCommandMap.java.udiff.html 
    >>
    >> http://cr.openjdk.java.net/~avstepan/8077332/webrev.01/jaxws/src/java.activation/share/classes/javax/activation/MimetypesFileTypeMap.java.udiff.html 
    >>
    >>
    >> Hopefully that's all for this bug...
    >>
    >> Thanks,
    >> Alexander
    >>
    >> On 16.04.2015 15:48, alexander stepanov wrote:
    >>> Please note also that a couple of new files were touched:
    >>>
    >>> http://cr.openjdk.java.net/~avstepan/8077332/webrev.01/jaxws/src/java.annotations.common/share/classes/javax/annotation/PostConstruct.java.udiff.html 
    >>>  
    >>>
    >>> http://cr.openjdk.java.net/~avstepan/8077332/webrev.01/jaxws/src/java.annotations.common/share/classes/javax/annotation/PreDestroy.java.udiff.html 
    >>>  
    >>>
    >>>
    >>> On 15.04.2015 19:12, alexander stepanov wrote:
    >>>> Hello Joe,
    >>>>
    >>>> The copyright changes were reverted.
    >>>>
    >>>> Please review the updated fix:
    >>>> http://cr.openjdk.java.net/~avstepan/8077332/webrev.01/
    >>>>
    >>>> ("" replaced with "{@code}", removed unnecessary 
    >>>> "

    ", used "@literal" tag). >>>> >>>> Thanks, >>>> Alexander >>>> >>>> >>>> On 13.04.2015 21:19, huizhe wang wrote: >>>>> >>>>> On 4/13/2015 4:42 AM, Alan Bateman wrote: >>>>>> On 13/04/2015 12:22, alexander stepanov wrote: >>>>>>> Hello Joe, >>>>>>> >>>>>>> Thank you for the notes; >>>>>>> >>>>>>> > Copyright year shall not be changed. >>>>>>> >>>>>>> That seems to be a bit controversial point; sometimes (while >>>>>>> cleaning docs) I was asked to do that, other times - not to do >>>>>>> that. Our internal policy seemingly assigns to change the 2nd >>>>>>> date every time the sources were touched (but that may be a >>>>>>> question of ambiguous interpretation). >>>>>>> >>>>>>> But of course I can easily revert these changes if you're >>>>>>> totally sure it should be done. >>>>>>> >>>>>> This has always been confusing. Some areas insist on updating the >>>>>> copyright dates, others don't. AFAIK, it has always been >>>>>> optional. I think the original assumption was that the >>>>>> update_copyright_year script (in the top-level repo) be run >>>>>> periodically to do bulk updates. Unfortunately that script >>>>>> doesn't seem to be run very often now and this strengthens the >>>>>> case to update the dates on a continuous basis. I have not come >>>>>> across the argument that html tidy tasks that don't change the >>>>>> javadoc should not update the copyright date. The general topic >>>>>> probably should move to jdk9-dev and get this decided once and >>>>>> documented in the developer guide. >>>>> >>>>> I think the key question to ask is: is this the code I can claim >>>>> Copyright with? To me, format, code style, html tags and other >>>>> minor changes, these are not code changes one can claim copyright >>>>> with. >>>>> >>>>> The date of a Copyright establishes how far back the claim is >>>>> made. In case where the work is substantially revised, a new >>>>> Copyright claim is established, which is what the 2nd year is about. >>>>> >>>>> In this case, esp. for the JAXP API (e.g. javax.xml.datatype), I'd >>>>> like to see the years maintained because those are the years the >>>>> API was designed and modified. The "tidy warnings" change did not >>>>> change the API. >>>>> >>>>> -Joe >>>>> >>>>>> >>>>>> -Alan >>>>> >>>> >>> >> > From magnus.ihse.bursie at oracle.com Fri Apr 17 12:52:23 2015 From: magnus.ihse.bursie at oracle.com (Magnus Ihse Bursie) Date: Fri, 17 Apr 2015 14:52:23 +0200 Subject: RFR: JDK-8074859 Turn on warnings as error Message-ID: <55310207.9050207@oracle.com> With JDK-8074096, the number of warnings in the product was reduced to a minimum. This enables the next step, which is turning on the respective compiler flags that turns warnings into errors. In the long run, this is the only way to keep the warnings from creeping back. Even with JDK-8074096, the product does not build 100% warning free. This is due to some warnings that cannot be disabled, or (in one case) where C and C++ code is mixed, and warnings for both languages cannot be used. A system similar to the one introduced in JDK-8074096 is therefore needed, in which individual libraries can be exempted from this flag, until such warnings are fixed. A library can thus disable warnings as errors with WARNINGS_AS_ERRORS := false, or (better) use a toolchain-specific version, e.g WARNINGS_AS_ERRORS_gcc := false. This is intended as a temporary measure, though. The long-term solution is reasonably to fix the warnings and remove that argument. Also, different versions of compilers can generate a different set of warnings. It is therefore necessary to be able to turn off this globally. Therefor a new flag for configure is introduced: --disable-warnings-as-errors. While the code compiles without errors on the build systems used internally at Oracle, this might not be the case on other combinations of operating system versions and toolchain versions. To facilitate for unexpecting developers, a help message is added if the build fails, that suggests using --disable-warnings-as-errors. This solution was chosen as a compromise between the "hard core" solution of turning on warnings as errors by default for anyone, and the cowar... erm, conservative solution of checking if the compiler versions exactly match what's used inside Oracle (and therefore regularly tested), and only turn it on in that case. Similarly to JDK-8074096, I intend to file follow-up bugs for each individual library that got a WARNINGS_AS_ERRORS_* := false. Bug: https://bugs.openjdk.java.net/browse/JDK-8074859 WebRev for top: http://cr.openjdk.java.net/~ihse/JDK-8074859-warnings-as-errors-top/webrev.01 WebRev for jdk: http://cr.openjdk.java.net/~ihse/JDK-8074859-warnings-as-errors-jdk/webrev.01 Some comments: * I needed to add a few more DISABLED_WARNINGS. For windows, this is most likely due to the recent compiler change. For other libraries, I'm not sure, but it might well be the result of recent changes that has introduced new warnings. If so, it highlights the need of this patch to keep the build warning free. * For a few libraries and toolchains, there is *both* WARNINGS_AS_ERRORS := false and a DISABLED_WARNINGS list. This is the case if not all warnings are possible to disable. * I have removed some incorrect uses of SHARED_LIBRARY_FLAGS. This is included in our JDK LDFLAGS, so it should not be set separately, and definitely not as CFLAGS. (This caused compiler warnings, which now turned into errors.) However, a more suitable long-term solution is probably to move the knowledge of how to create shared libraries more specifically into SetupNativeCompilation, and not set it as part of the JDK flags. /Magnus From aleksej.efimov at oracle.com Fri Apr 17 13:31:48 2015 From: aleksej.efimov at oracle.com (Aleksej Efimov) Date: Fri, 17 Apr 2015 16:31:48 +0300 Subject: RFR: 8078057: Reapply fixes for 8073361, 8073374, 8073696 Message-ID: <55310B44.3050904@oracle.com> Hello, The latest JAXWS [1] integration to JDK9 reverted back three bug fixes in JAXWS repository: https://bugs.openjdk.java.net/browse/JDK-8073374 https://bugs.openjdk.java.net/browse/JDK-8073696 https://bugs.openjdk.java.net/browse/JDK-8073361 It was caused by skipped integration to upstream JAXB/WS projects. Now the fixes is applied to upstream projects and the proposed fix [2] reapplies jaxws parts of these fixes in jdk9. JPRT testing shows no regression tests failures. Please, review the proposed changes. With Best Regards, Aleksej [1] Latest JAXWS integration: https://bugs.openjdk.java.net/browse/JDK-8076549 [2] Webrev: http://cr.openjdk.java.net/~aefimov/8078057/00 [3] JBS issue: https://bugs.openjdk.java.net/browse/JDK-8078057 From mandy.chung at oracle.com Fri Apr 17 13:43:56 2015 From: mandy.chung at oracle.com (Mandy Chung) Date: Fri, 17 Apr 2015 06:43:56 -0700 Subject: RFR: 8078057: Reapply fixes for 8073361, 8073374, 8073696 In-Reply-To: <55310B44.3050904@oracle.com> References: <55310B44.3050904@oracle.com> Message-ID: <55310E1C.5090605@oracle.com> The change looks good to me. thanks Mandy On 4/17/2015 6:31 AM, Aleksej Efimov wrote: > Hello, > > The latest JAXWS [1] integration to JDK9 reverted back three bug fixes > in JAXWS repository: > https://bugs.openjdk.java.net/browse/JDK-8073374 > https://bugs.openjdk.java.net/browse/JDK-8073696 > https://bugs.openjdk.java.net/browse/JDK-8073361 > > It was caused by skipped integration to upstream JAXB/WS projects. Now > the fixes is applied to upstream projects and the proposed fix [2] > reapplies jaxws parts of these fixes in jdk9. > JPRT testing shows no regression tests failures. > > Please, review the proposed changes. > > With Best Regards, > Aleksej > > [1] Latest JAXWS integration: > https://bugs.openjdk.java.net/browse/JDK-8076549 > [2] Webrev: http://cr.openjdk.java.net/~aefimov/8078057/00 > [3] JBS issue: https://bugs.openjdk.java.net/browse/JDK-8078057 From Alan.Bateman at oracle.com Fri Apr 17 13:58:39 2015 From: Alan.Bateman at oracle.com (Alan Bateman) Date: Fri, 17 Apr 2015 14:58:39 +0100 Subject: RFR: 8078057: Reapply fixes for 8073361, 8073374, 8073696 In-Reply-To: <55310B44.3050904@oracle.com> References: <55310B44.3050904@oracle.com> Message-ID: <5531118F.8010903@oracle.com> On 17/04/2015 14:31, Aleksej Efimov wrote: > Hello, > > The latest JAXWS [1] integration to JDK9 reverted back three bug fixes > in JAXWS repository: > https://bugs.openjdk.java.net/browse/JDK-8073374 > https://bugs.openjdk.java.net/browse/JDK-8073696 > https://bugs.openjdk.java.net/browse/JDK-8073361 > > It was caused by skipped integration to upstream JAXB/WS projects. Now > the fixes is applied to upstream projects and the proposed fix [2] > reapplies jaxws parts of these fixes in jdk9. The re-apply looks good to me too. -Alan. From aleksej.efimov at oracle.com Fri Apr 17 14:06:48 2015 From: aleksej.efimov at oracle.com (Aleksej Efimov) Date: Fri, 17 Apr 2015 17:06:48 +0300 Subject: RFR: 8078057: Reapply fixes for 8073361, 8073374, 8073696 In-Reply-To: <5531118F.8010903@oracle.com> References: <55310B44.3050904@oracle.com> <5531118F.8010903@oracle.com> Message-ID: <55311378.9000704@oracle.com> Mandy, Alan, Thanks for reviews. With Best Regards, Aleksej On 04/17/2015 04:58 PM, Alan Bateman wrote: > On 17/04/2015 14:31, Aleksej Efimov wrote: >> Hello, >> >> The latest JAXWS [1] integration to JDK9 reverted back three bug >> fixes in JAXWS repository: >> https://bugs.openjdk.java.net/browse/JDK-8073374 >> https://bugs.openjdk.java.net/browse/JDK-8073696 >> https://bugs.openjdk.java.net/browse/JDK-8073361 >> >> It was caused by skipped integration to upstream JAXB/WS projects. >> Now the fixes is applied to upstream projects and the proposed fix >> [2] reapplies jaxws parts of these fixes in jdk9. > The re-apply looks good to me too. > > -Alan. From aleksej.efimov at oracle.com Fri Apr 17 16:29:45 2015 From: aleksej.efimov at oracle.com (Aleksej Efimov) Date: Fri, 17 Apr 2015 19:29:45 +0300 Subject: RFR: 8071968: javax/xml/ws/8046817/GenerateEnumSchema.java failed on Windows platform Message-ID: <553134F9.4010102@oracle.com> Hello, Please, review an exclusion of GenerateEnumSchema.java from ProblemList.txt [1]. The problem was fixed in upstream JAXWS project and was bringed over to JDK as part of sync-up process [2]. The test passes on all platforms after exclusion on JDK9 JPRT builds. With Best Regards, Aleksej [1] Webrev: http://cr.openjdk.java.net/~aefimov/8071968/9/00 [2] JAXWS integration: https://bugs.openjdk.java.net/browse/JDK-8076549 [3] JBS: https://bugs.openjdk.java.net/browse/JDK-8071968 From huizhe.wang at oracle.com Fri Apr 17 16:33:26 2015 From: huizhe.wang at oracle.com (huizhe wang) Date: Fri, 17 Apr 2015 09:33:26 -0700 Subject: RFR [9] 8077332: tidy warnings from javax/xml In-Reply-To: <5530F033.2050609@oracle.com> References: <5527F132.80408@oracle.com> <552815F4.4050005@oracle.com> <552BA6FD.5000706@oracle.com> <552BABBA.6050903@oracle.com> <552C08C2.4030503@oracle.com> <552E8DD5.3080207@oracle.com> <552FAF93.9020500@oracle.com> <552FC206.3090308@oracle.com> <552FEA0C.1050904@oracle.com> <5530F033.2050609@oracle.com> Message-ID: <553135D6.4000507@oracle.com> Hi Alexander, That fixed the issue in the existing Javadoc. The JAXP changes look good now. Thanks for doing this! Best, Joe On 4/17/2015 4:36 AM, alexander stepanov wrote: > Hello Joe, > > > [jw] as I mentioned,
     is needed for the code snippet.
    > Fixed, please see
    > http://cr.openjdk.java.net/~avstepan/8077332/webrev.01/jaxp/src/java.xml/share/classes/javax/xml/stream/XMLStreamReader.java.udiff.html 
    >
    >
    >  > [jw] I saw in a few cases where two @code tags are next to each other
    > Fixed in a couple of places.
    >
    > Regards,
    > Alexander
    >
    > On 16.04.2015 19:57, huizhe wang wrote:
    >> Hi Alexander,
    >>
    >> Looks very good. Thanks for making all the changes!
    >>
    >> Please note that for the JAXWS, you may need to check with 
    >> JAXWS/Miran (miroslav.kos at oracle.com). Changes to JAXWS generally 
    >> goes into the standalone first. They do periodic integration.
    >>
    >> For the jaxp portion:
    >> --- old/src/java.xml/share/classes/javax/xml/datatype/Duration.java 
    >> 2015-04-16 13:50:25.249473095 +0400
    >> +++ new/src/java.xml/share/classes/javax/xml/datatype/Duration.java 
    >> 2015-04-16 13:50:25.161473099 +0400
    >>
    >> @@ -725,37 +725,37 @@
    >>
    >>       *
    >> -     * @return the relationship between this 
    >> Durationand duration parameter as
    >> +     * @return the relationship between {@code this} {@code 
    >> Duration}and {@code duration} parameter as
    >>
    >> [jw] I saw in a few cases where two @code tags are next to each 
    >> other, you may do a s/} {@code//g to combine them. A space is also 
    >> missing before 'and': e.g. {@code Duration} and.
    >>
    >>
    >> --- 
    >> old/src/java.xml/share/classes/javax/xml/stream/XMLStreamReader.java 
    >> 2015-04-16 13:50:28.197472963 +0400
    >> +++ 
    >> new/src/java.xml/share/classes/javax/xml/stream/XMLStreamReader.java 
    >> 2015-04-16 13:50:28.105472967 +0400
    >>
    >> @@ -542,7 +543,7 @@
    >>     * If the number of characters actually copied is less than the 
    >> "length", then there is no more text.
    >>     * Otherwise, subsequent calls need to be made until all text has 
    >> been retrieved. For example:
    >>     *
    >> -   *
    >> +   * {@code
    >>     * int length = 1024;
    >>     * char[] myBuffer = new char[ length ];
    >>     *
    >> @@ -553,7 +554,7 @@
    >>     *   if (nCopied < length)
    >>     *       break;
    >>     * }
    >> -   * 
    >> +   * }
    >>
    >> [jw] as I mentioned, 
     is needed for the code snippet.
    >>
    >>
    >> BTW, have you compiled and verified the Javadoc after the changes?
    >>
    >> Thanks,
    >> Joe
    >>
    >> On 4/16/2015 7:07 AM, alexander stepanov wrote:
    >>> I'm sorry, two extra files touched -
    >>> http://cr.openjdk.java.net/~avstepan/8077332/webrev.01/jaxws/src/java.activation/share/classes/javax/activation/MailcapCommandMap.java.udiff.html 
    >>>
    >>> http://cr.openjdk.java.net/~avstepan/8077332/webrev.01/jaxws/src/java.activation/share/classes/javax/activation/MimetypesFileTypeMap.java.udiff.html 
    >>>
    >>>
    >>> Hopefully that's all for this bug...
    >>>
    >>> Thanks,
    >>> Alexander
    >>>
    >>> On 16.04.2015 15:48, alexander stepanov wrote:
    >>>> Please note also that a couple of new files were touched:
    >>>>
    >>>> http://cr.openjdk.java.net/~avstepan/8077332/webrev.01/jaxws/src/java.annotations.common/share/classes/javax/annotation/PostConstruct.java.udiff.html 
    >>>>  
    >>>>
    >>>> http://cr.openjdk.java.net/~avstepan/8077332/webrev.01/jaxws/src/java.annotations.common/share/classes/javax/annotation/PreDestroy.java.udiff.html 
    >>>>  
    >>>>
    >>>>
    >>>> On 15.04.2015 19:12, alexander stepanov wrote:
    >>>>> Hello Joe,
    >>>>>
    >>>>> The copyright changes were reverted.
    >>>>>
    >>>>> Please review the updated fix:
    >>>>> http://cr.openjdk.java.net/~avstepan/8077332/webrev.01/
    >>>>>
    >>>>> ("" replaced with "{@code}", removed unnecessary 
    >>>>> "

    ", used "@literal" tag). >>>>> >>>>> Thanks, >>>>> Alexander >>>>> >>>>> >>>>> On 13.04.2015 21:19, huizhe wang wrote: >>>>>> >>>>>> On 4/13/2015 4:42 AM, Alan Bateman wrote: >>>>>>> On 13/04/2015 12:22, alexander stepanov wrote: >>>>>>>> Hello Joe, >>>>>>>> >>>>>>>> Thank you for the notes; >>>>>>>> >>>>>>>> > Copyright year shall not be changed. >>>>>>>> >>>>>>>> That seems to be a bit controversial point; sometimes (while >>>>>>>> cleaning docs) I was asked to do that, other times - not to do >>>>>>>> that. Our internal policy seemingly assigns to change the 2nd >>>>>>>> date every time the sources were touched (but that may be a >>>>>>>> question of ambiguous interpretation). >>>>>>>> >>>>>>>> But of course I can easily revert these changes if you're >>>>>>>> totally sure it should be done. >>>>>>>> >>>>>>> This has always been confusing. Some areas insist on updating >>>>>>> the copyright dates, others don't. AFAIK, it has always been >>>>>>> optional. I think the original assumption was that the >>>>>>> update_copyright_year script (in the top-level repo) be run >>>>>>> periodically to do bulk updates. Unfortunately that script >>>>>>> doesn't seem to be run very often now and this strengthens the >>>>>>> case to update the dates on a continuous basis. I have not come >>>>>>> across the argument that html tidy tasks that don't change the >>>>>>> javadoc should not update the copyright date. The general topic >>>>>>> probably should move to jdk9-dev and get this decided once and >>>>>>> documented in the developer guide. >>>>>> >>>>>> I think the key question to ask is: is this the code I can claim >>>>>> Copyright with? To me, format, code style, html tags and other >>>>>> minor changes, these are not code changes one can claim copyright >>>>>> with. >>>>>> >>>>>> The date of a Copyright establishes how far back the claim is >>>>>> made. In case where the work is substantially revised, a new >>>>>> Copyright claim is established, which is what the 2nd year is about. >>>>>> >>>>>> In this case, esp. for the JAXP API (e.g. javax.xml.datatype), >>>>>> I'd like to see the years maintained because those are the years >>>>>> the API was designed and modified. The "tidy warnings" change did >>>>>> not change the API. >>>>>> >>>>>> -Joe >>>>>> >>>>>>> >>>>>>> -Alan >>>>>> >>>>> >>>> >>> >> > From alexander.v.stepanov at oracle.com Fri Apr 17 16:39:12 2015 From: alexander.v.stepanov at oracle.com (alexander stepanov) Date: Fri, 17 Apr 2015 19:39:12 +0300 Subject: RFR [9] 8077332: tidy warnings from javax/xml In-Reply-To: <553135D6.4000507@oracle.com> References: <5527F132.80408@oracle.com> <552815F4.4050005@oracle.com> <552BA6FD.5000706@oracle.com> <552BABBA.6050903@oracle.com> <552C08C2.4030503@oracle.com> <552E8DD5.3080207@oracle.com> <552FAF93.9020500@oracle.com> <552FC206.3090308@oracle.com> <552FEA0C.1050904@oracle.com> <5530F033.2050609@oracle.com> <553135D6.4000507@oracle.com> Message-ID: <55313730.3010607@oracle.com> Thanks! Regards, Alexander On 17.04.2015 19:33, huizhe wang wrote: > Hi Alexander, > > That fixed the issue in the existing Javadoc. The JAXP changes look > good now. > > Thanks for doing this! > > Best, > Joe > > On 4/17/2015 4:36 AM, alexander stepanov wrote: >> Hello Joe, >> >> > [jw] as I mentioned,
     is needed for the code snippet.
    >> Fixed, please see
    >> http://cr.openjdk.java.net/~avstepan/8077332/webrev.01/jaxp/src/java.xml/share/classes/javax/xml/stream/XMLStreamReader.java.udiff.html 
    >>
    >>
    >>  > [jw] I saw in a few cases where two @code tags are next to each other
    >> Fixed in a couple of places.
    >>
    >> Regards,
    >> Alexander
    >>
    >> On 16.04.2015 19:57, huizhe wang wrote:
    >>> Hi Alexander,
    >>>
    >>> Looks very good. Thanks for making all the changes!
    >>>
    >>> Please note that for the JAXWS, you may need to check with 
    >>> JAXWS/Miran (miroslav.kos at oracle.com). Changes to JAXWS generally 
    >>> goes into the standalone first. They do periodic integration.
    >>>
    >>> For the jaxp portion:
    >>> --- old/src/java.xml/share/classes/javax/xml/datatype/Duration.java 
    >>> 2015-04-16 13:50:25.249473095 +0400
    >>> +++ new/src/java.xml/share/classes/javax/xml/datatype/Duration.java 
    >>> 2015-04-16 13:50:25.161473099 +0400
    >>>
    >>> @@ -725,37 +725,37 @@
    >>>
    >>>       *
    >>> -     * @return the relationship between this 
    >>> Durationand duration parameter as
    >>> +     * @return the relationship between {@code this} {@code 
    >>> Duration}and {@code duration} parameter as
    >>>
    >>> [jw] I saw in a few cases where two @code tags are next to each 
    >>> other, you may do a s/} {@code//g to combine them. A space is also 
    >>> missing before 'and': e.g. {@code Duration} and.
    >>>
    >>>
    >>> --- 
    >>> old/src/java.xml/share/classes/javax/xml/stream/XMLStreamReader.java 
    >>> 2015-04-16 13:50:28.197472963 +0400
    >>> +++ 
    >>> new/src/java.xml/share/classes/javax/xml/stream/XMLStreamReader.java 
    >>> 2015-04-16 13:50:28.105472967 +0400
    >>>
    >>> @@ -542,7 +543,7 @@
    >>>     * If the number of characters actually copied is less than the 
    >>> "length", then there is no more text.
    >>>     * Otherwise, subsequent calls need to be made until all text has 
    >>> been retrieved. For example:
    >>>     *
    >>> -   *
    >>> +   * {@code
    >>>     * int length = 1024;
    >>>     * char[] myBuffer = new char[ length ];
    >>>     *
    >>> @@ -553,7 +554,7 @@
    >>>     *   if (nCopied < length)
    >>>     *       break;
    >>>     * }
    >>> -   * 
    >>> +   * }
    >>>
    >>> [jw] as I mentioned, 
     is needed for the code snippet.
    >>>
    >>>
    >>> BTW, have you compiled and verified the Javadoc after the changes?
    >>>
    >>> Thanks,
    >>> Joe
    >>>
    >>> On 4/16/2015 7:07 AM, alexander stepanov wrote:
    >>>> I'm sorry, two extra files touched -
    >>>> http://cr.openjdk.java.net/~avstepan/8077332/webrev.01/jaxws/src/java.activation/share/classes/javax/activation/MailcapCommandMap.java.udiff.html 
    >>>>
    >>>> http://cr.openjdk.java.net/~avstepan/8077332/webrev.01/jaxws/src/java.activation/share/classes/javax/activation/MimetypesFileTypeMap.java.udiff.html 
    >>>>
    >>>>
    >>>> Hopefully that's all for this bug...
    >>>>
    >>>> Thanks,
    >>>> Alexander
    >>>>
    >>>> On 16.04.2015 15:48, alexander stepanov wrote:
    >>>>> Please note also that a couple of new files were touched:
    >>>>>
    >>>>> http://cr.openjdk.java.net/~avstepan/8077332/webrev.01/jaxws/src/java.annotations.common/share/classes/javax/annotation/PostConstruct.java.udiff.html 
    >>>>>  
    >>>>>
    >>>>> http://cr.openjdk.java.net/~avstepan/8077332/webrev.01/jaxws/src/java.annotations.common/share/classes/javax/annotation/PreDestroy.java.udiff.html 
    >>>>>  
    >>>>>
    >>>>>
    >>>>> On 15.04.2015 19:12, alexander stepanov wrote:
    >>>>>> Hello Joe,
    >>>>>>
    >>>>>> The copyright changes were reverted.
    >>>>>>
    >>>>>> Please review the updated fix:
    >>>>>> http://cr.openjdk.java.net/~avstepan/8077332/webrev.01/
    >>>>>>
    >>>>>> ("" replaced with "{@code}", removed unnecessary 
    >>>>>> "

    ", used "@literal" tag). >>>>>> >>>>>> Thanks, >>>>>> Alexander >>>>>> >>>>>> >>>>>> On 13.04.2015 21:19, huizhe wang wrote: >>>>>>> >>>>>>> On 4/13/2015 4:42 AM, Alan Bateman wrote: >>>>>>>> On 13/04/2015 12:22, alexander stepanov wrote: >>>>>>>>> Hello Joe, >>>>>>>>> >>>>>>>>> Thank you for the notes; >>>>>>>>> >>>>>>>>> > Copyright year shall not be changed. >>>>>>>>> >>>>>>>>> That seems to be a bit controversial point; sometimes (while >>>>>>>>> cleaning docs) I was asked to do that, other times - not to do >>>>>>>>> that. Our internal policy seemingly assigns to change the 2nd >>>>>>>>> date every time the sources were touched (but that may be a >>>>>>>>> question of ambiguous interpretation). >>>>>>>>> >>>>>>>>> But of course I can easily revert these changes if you're >>>>>>>>> totally sure it should be done. >>>>>>>>> >>>>>>>> This has always been confusing. Some areas insist on updating >>>>>>>> the copyright dates, others don't. AFAIK, it has always been >>>>>>>> optional. I think the original assumption was that the >>>>>>>> update_copyright_year script (in the top-level repo) be run >>>>>>>> periodically to do bulk updates. Unfortunately that script >>>>>>>> doesn't seem to be run very often now and this strengthens the >>>>>>>> case to update the dates on a continuous basis. I have not come >>>>>>>> across the argument that html tidy tasks that don't change the >>>>>>>> javadoc should not update the copyright date. The general topic >>>>>>>> probably should move to jdk9-dev and get this decided once and >>>>>>>> documented in the developer guide. >>>>>>> >>>>>>> I think the key question to ask is: is this the code I can claim >>>>>>> Copyright with? To me, format, code style, html tags and other >>>>>>> minor changes, these are not code changes one can claim >>>>>>> copyright with. >>>>>>> >>>>>>> The date of a Copyright establishes how far back the claim is >>>>>>> made. In case where the work is substantially revised, a new >>>>>>> Copyright claim is established, which is what the 2nd year is >>>>>>> about. >>>>>>> >>>>>>> In this case, esp. for the JAXP API (e.g. javax.xml.datatype), >>>>>>> I'd like to see the years maintained because those are the years >>>>>>> the API was designed and modified. The "tidy warnings" change >>>>>>> did not change the API. >>>>>>> >>>>>>> -Joe >>>>>>> >>>>>>>> >>>>>>>> -Alan >>>>>>> >>>>>> >>>>> >>>> >>> >> > From lance.andersen at oracle.com Fri Apr 17 16:44:08 2015 From: lance.andersen at oracle.com (Lance Andersen) Date: Fri, 17 Apr 2015 12:44:08 -0400 Subject: RFR: 8071968: javax/xml/ws/8046817/GenerateEnumSchema.java failed on Windows platform In-Reply-To: <553134F9.4010102@oracle.com> References: <553134F9.4010102@oracle.com> Message-ID: Hi Aleksej, To be clear, you are just removing the test from the ProblemList.txt as the bug has since been fixed. The change looks OK. Best Lance On Apr 17, 2015, at 12:29 PM, Aleksej Efimov wrote: > Hello, > > Please, review an exclusion of GenerateEnumSchema.java from ProblemList.txt [1]. The problem was fixed in upstream JAXWS project and was bringed over to JDK as part of sync-up process [2]. The test passes on all platforms after exclusion on JDK9 JPRT builds. > > With Best Regards, > Aleksej > > [1] Webrev: http://cr.openjdk.java.net/~aefimov/8071968/9/00 > [2] JAXWS integration: https://bugs.openjdk.java.net/browse/JDK-8076549 > [3] JBS: https://bugs.openjdk.java.net/browse/JDK-8071968 Lance Andersen| Principal Member of Technical Staff | +1.781.442.2037 Oracle Java Engineering 1 Network Drive Burlington, MA 01803 Lance.Andersen at oracle.com From aleksej.efimov at oracle.com Fri Apr 17 16:49:45 2015 From: aleksej.efimov at oracle.com (Aleksej Efimov) Date: Fri, 17 Apr 2015 19:49:45 +0300 Subject: RFR: 8071968: javax/xml/ws/8046817/GenerateEnumSchema.java failed on Windows platform In-Reply-To: References: <553134F9.4010102@oracle.com> Message-ID: <553139A9.4010809@oracle.com> Hi Lance, Correct - bug is fixed by [2], just removing the test from problem list. Thank you for the review. Best Regards, Aleksej On 04/17/2015 07:44 PM, Lance Andersen wrote: > Hi Aleksej, > > To be clear, you are just removing the test from the ProblemList.txt > as the bug has since been fixed. > > The change looks OK. > > Best > Lance > On Apr 17, 2015, at 12:29 PM, Aleksej Efimov > > wrote: > >> Hello, >> >> Please, review an exclusion of GenerateEnumSchema.java from >> ProblemList.txt [1]. The problem was fixed in upstream JAXWS project >> and was bringed over to JDK as part of sync-up process [2]. The test >> passes on all platforms after exclusion on JDK9 JPRT builds. >> >> With Best Regards, >> Aleksej >> >> [1] Webrev: http://cr.openjdk.java.net/~aefimov/8071968/9/00 >> >> [2] JAXWS integration: https://bugs.openjdk.java.net/browse/JDK-8076549 >> [3] JBS: https://bugs.openjdk.java.net/browse/JDK-8071968 > > > > Lance > Andersen| Principal Member of Technical Staff | +1.781.442.2037 > Oracle Java Engineering > 1 Network Drive > Burlington, MA 01803 > Lance.Andersen at oracle.com > > > From Roger.Riggs at Oracle.com Fri Apr 17 16:53:03 2015 From: Roger.Riggs at Oracle.com (Roger Riggs) Date: Fri, 17 Apr 2015 12:53:03 -0400 Subject: RFR 9: 8077350 Process API Updates Implementation Review In-Reply-To: <5530BECF.60903@gmail.com> References: <5526DA4A.6030808@Oracle.com> <55296E19.3040204@Oracle.com> <5530BECF.60903@gmail.com> Message-ID: <55313A6F.4070208@Oracle.com> Hi Peter, On 4/17/2015 4:05 AM, Peter Levart wrote: > Hi Roger, > > Retrieving and caching the process start time as soon as ProcessHandle > is instantiated might be a good idea. "destroy" native code would then > use pid *and* start time to check the identity of the process before > killing it. Yes, though it does raise a question about how to specify PH.equals(). Either the start time is explicitly mentioned (and is repeatable and testable) or it is vague and refers to some implementation specific value that uniquely identifies the process; and is less testable. > > At least on Linux (/proc//stat) and Solaris (/proc//status) > it is not necessary to open those special files and read them. Just > doing stat() on them and using the st_mtime will get you the process > start time. I see AIX shares native code with Linux (unix), so perhaps > AIX does the same. Mac OSX and Windows have special calls... That is less expensive. But opening /proc//stat is necessary for allChildren to get and filter on the parent and can provide the starttime as well. stat would be useful for allProcesses which does not need the parent. > > In case OS does not allow retrieving the start time (not owner or > similar), it should be cached as some "undefined" value and treated > the same when destroying. If while obtaining the ProcessHandle *and* > while destroying the process, the start time of the process with a > particular pid is "undefined" then there are two options: > > 1 - don't kill the process > 2 - kill the process > > They might actually be no different as the reason of not being able to > retrieve the start time (not owner) might prevent the process from > being killed too, so option 2 could be used to allow killing on any > hypothetical platforms that don't support retrieving start time and it > is no worse than current implementation anyway. Destroy is a best-effort method; it is not guaranteed to result in termination, though the docs are a bit weak on this point. I'd go for option 2, anyone using the API is looking for results on processes they already know something about (mostly), so there's no reason to be particularly conservative about. If the caller is trying to be more conservative, they can maintain their own extra information about the processes they are managing. > > What do you think? I'd like to pick this up as a separate change, and get the current one in first. Roger From Roger.Riggs at Oracle.com Fri Apr 17 16:56:31 2015 From: Roger.Riggs at Oracle.com (Roger Riggs) Date: Fri, 17 Apr 2015 12:56:31 -0400 Subject: RFR 9: 8077350 Process API Updates Implementation Review In-Reply-To: References: <5526DA4A.6030808@Oracle.com> Message-ID: <55313B3F.7020101@Oracle.com> Hi Thomas, On 4/17/2015 4:22 AM, Thomas St?fe wrote: > Hi Roger, > > aside from the recycle-pid-question, one additional remark: > > in ProcessHandleImpl_unix.c, > Java_java_lang_ProcessHandleImpl_isAlive0, you call kill(pid, 0) for > the liveness check. > > If you have not the necessary permissions to do this call, this may > fail with EPERM. In this case, isAlive() will return false, but the > process exists, which strictly spoken is a lie. > > Caller may base actions on this, e.g. try to clean up resources for a > process he thinks is dead. > > We actually had this problem, and our version of isAlive() grew to be > more elaborate over time. Basically, we do: > > 1) first try kill(0). If EPERM: > 2) try read /proc on OSes which have /proc. > 3) do a system("ps"). > > Alternativly, one may report EPERM to the caller - with an exception > or an extension of the return value - and leave it up to him what to do. Good to have the experienced input. I'd been trying to keep the code simple but it seems more complexity is needed to be robust. I'm not sure I'd go as far as invoking ps; it too might fail for a number of reasons. That would be a good case to throw an exception if the liveness cannot be determined. Thanks, Roger > > Kind Regards, Thomas > > > > > On Thu, Apr 9, 2015 at 10:00 PM, Roger Riggs > wrote: > > Please review the API and implementation of the Process API Updates > described inJEP 102 > . Please review > and comment by April 23rd. > > The recommendation to make ProcessHandle an interface is included > allowing the new functions to be extended by Process subclasses. > The implementation covers all functions on Unix, Windows, Solaris, > and Mac OS X. > > The API doc: http://cr.openjdk.java.net/~rriggs/ph-apidraft/ > > > The webrev: http://cr.openjdk.java.net/~rriggs/webrev-ph > > > Issue: JDK-8077350 > Process API > Updates Implementation > > The code is in the jdk9 sandbox on branch JDK-8046092-branch. > > Please review and comment, Roger > > From Roger.Riggs at Oracle.com Fri Apr 17 17:05:32 2015 From: Roger.Riggs at Oracle.com (Roger Riggs) Date: Fri, 17 Apr 2015 13:05:32 -0400 Subject: RFR 9: 8077350 Process API Updates Implementation Review In-Reply-To: References: <5526DA4A.6030808@Oracle.com> <55296E19.3040204@Oracle.com> Message-ID: <55313D5C.4060508@Oracle.com> Hi Thomas, On 4/16/2015 3:01 PM, Thomas St?fe wrote: > Hi Roger, > > thank you for your answer! > > The reason I take an interest is not just theoretical. We (SAP) use > our JVM for our test infrastructure and we had exactly the problem > allChildren() is designed to solve: killing a process tree related to > a specific tests (similar to jtreg tests) in case of errors or hangs. > We have test machines running large workloads of tests in parallel and > we reach pid wraparound - depending on the OS - quite fast. > > We solved this by adding process groups to Process.java and we are > very happy with this solution. We are able to quickly kill a whole > process tree, cleanly and completely, without ambiguity or risk to > other tests. Of course we had to add this support as a "sideways hack" > in order to not change the official Process.java interface. Therefore > I was hoping that with JEP 102, we would get official support for > process groups. Unfortunately, seems the decision is already done and > we are too late in the discussion :( It would be interesting to see a description of what you added to/around the API. The reason to avoid them was one of simplicity and non-interference with processes spawned by native libraries. If that complexity can be understood process groups/jobs could fulfill a need in a scalable system. At this point, I'd like to deal with it as a separate request for enhancement. > > see my other comments inline. > > On Sat, Apr 11, 2015 at 8:55 PM, Roger Riggs > wrote: > > Hi Thomas, > > Thanks for the comments. > > On 4/11/2015 8:31 AM, Thomas St?fe wrote: >> Hi Roger, >> >> I have a question about getChildren() and getAllChildren(). >> >> I assume the point of those functions is to implement point 4 of >> JEP 102 ("The ability to deal with process trees, in particular >> some means to destroy a process tree."), by returning a >> collection of PIDs which are the children of the process and then >> killing them? > Earlier versions included a killProcess tree method but it was > recommended to leave > the exact algorithm to kill processes to the caller. >> >> However, I am not sure that this can be implemented in a safe >> way, at least on UNIX, because - as Martin already pointed out - >> of PID recycling. I do not see how you can prevent allChildren() >> from returning PIDs which may be already reaped and recyled when >> you use them later. How do you prevent that? > Unless there is an extended time between getting the children and > destroying them the pids will still be valid. > > > Why? Child process may be getting reaped the instant you are done > reading it from /proc, and pid may have been recycled by the OS right > away and already pointing to another process when allChildren() > returns. If a process lives about as long as it takes the system to > reach a pid wraparound to the same pid value, its pid could be > recycled right after it is reaped, or? Sure, the longer you wait, the > higher the chance of this to happen, but it may happen right away. > > As Martin said, we had those races in the kill() code since a long > time, but children()/allChildren() could make those error more > probable, because now more processes are involved. Especially if you > use allChildren to kill a deep process tree. And there is nothing in > the javadoc warning the user about this scenario. You would just > happen from time to time to kill an unrelated process. Those problems > are hard to debug. > > The technique of caching the start time can prevent that case; > though it has AFAIK not been a problem. > > > How would that work? User should, before issuing the kill, compare > start time of process to kill with cached start time? See Peter's email, he described it more thoroughly that I have in previous emails. > >> Note even if your coding is bulletproof, that allChildren() will >> also return PIDs of sub processes which are completely unrelated >> to you and Process.java - they could have been forked by some >> third party native code which just happens to run in parallel in >> the same process. There, you have no control about when it gets >> reaped. It might already have been reaped by the time >> allChildren() returns, and now the same PID got recycled as >> another, unrelated process. > Of course, the best case is for an application to spawn and manage > its own processes > and handle there proper termination. > The use cases for children/allChildren are focused on > supervisory/executive functions > that monitor a running system and can cleanup even in the case of > unexpected failures. > > All management of processes is subject to OS limitations, if the > PID were from a completely > different process tree, the ordinary destroy/info functions would > not be available > unless the process was running as a privileged os user (same as > any other native application). > > > Could you explain this please? If both trees run under the same user, > why should I not be able to kill a process from a different tree? I was considering the case of a different user; only the OS access controls apply so if it was the same user the processes could be controlled. The PH API does not provide more or less access than the OS. Thanks, Roger >> If I am right, it would not be sufficient to state "There is no >> guarantee that a process is alive." - it may be alive but by now >> be a different process altogether. This makes "allChildren()" >> useless for many cases, because the returned information may >> already be obsolete the moment the function returns. > The caching of startTime can remove the ambiguity. > > >> >> Of course I may something missing here? >> >> But if I got all that right and the sole purpose of allChildren() >> is to be able to kill them (or otherwise signal them), why not >> use process groups? Process groups would be the traditional way >> on POSIX platforms to handle process trees, and they are also >> available on Windows in the form of Job Objects. >> >> Using process groups to signal sub process trees would be safe, >> would not rely on PID identity, and would be more efficient. Also >> way less coding. Also, it would be an old, established pattern - >> process groups have been around for a long time. Also, using >> process groups it is possible to break away from a group, so a >> program below you which wants to run as a demon can do so by >> removing itself from the process group and thus escaping your kill. >> >> On Windows we have Job objects, and I think there are enough >> similarities to POSIX process groups to abstract them into >> something platform independent. > Earlier discussions of process termination and exit value reaping > considered > using process groups but it became evident that the Java runtime > needed to > be very careful to not interfere with processes that might be > spawned and > controlled by native libraries and that process groups would only > increase > complexity and the interactions. > > > Thanks, Roger > > > Thanks! Thomas > From david.lloyd at redhat.com Fri Apr 17 18:44:06 2015 From: david.lloyd at redhat.com (David M. Lloyd) Date: Fri, 17 Apr 2015 13:44:06 -0500 Subject: RFR 9: 8077350 Process API Updates Implementation Review In-Reply-To: <55313A6F.4070208@Oracle.com> References: <5526DA4A.6030808@Oracle.com> <55296E19.3040204@Oracle.com> <5530BECF.60903@gmail.com> <55313A6F.4070208@Oracle.com> Message-ID: <55315476.60908@redhat.com> On 04/17/2015 11:53 AM, Roger Riggs wrote: > Hi Peter, > > On 4/17/2015 4:05 AM, Peter Levart wrote: >> Hi Roger, >> >> Retrieving and caching the process start time as soon as ProcessHandle >> is instantiated might be a good idea. "destroy" native code would then >> use pid *and* start time to check the identity of the process before >> killing it. > Yes, though it does raise a question about how to specify PH.equals(). > Either the start time is explicitly > mentioned (and is repeatable and testable) or it is vague and refers to > some implementation > specific value that uniquely identifies the process; and is less testable. Even with timestamps though, you cannot prevent the PID from being reused in the time window after you verify its timestamp but before you kill it unless it is a direct child process (on UNIX anyway; who knows what Windows does...). I think that this inevitable race should be mentioned in the docs regardless of whether the timestamp thing is implemented (or doc'd) to prevent unrealistic expectations (the api draft link seems to be dead so I didn't see if it already includes this kind of language). >> At least on Linux (/proc//stat) and Solaris (/proc//status) >> it is not necessary to open those special files and read them. Just >> doing stat() on them and using the st_mtime will get you the process >> start time. I see AIX shares native code with Linux (unix), so perhaps >> AIX does the same. Mac OSX and Windows have special calls... > That is less expensive. But opening /proc//stat is necessary for > allChildren to get > and filter on the parent and can provide the starttime as well. > stat would be useful for allProcesses which does not need the parent. >> >> In case OS does not allow retrieving the start time (not owner or >> similar), it should be cached as some "undefined" value and treated >> the same when destroying. If while obtaining the ProcessHandle *and* >> while destroying the process, the start time of the process with a >> particular pid is "undefined" then there are two options: >> >> 1 - don't kill the process >> 2 - kill the process >> >> They might actually be no different as the reason of not being able to >> retrieve the start time (not owner) might prevent the process from >> being killed too, so option 2 could be used to allow killing on any >> hypothetical platforms that don't support retrieving start time and it >> is no worse than current implementation anyway. > Destroy is a best-effort method; it is not guaranteed to result in > termination, though > the docs are a bit weak on this point. > > I'd go for option 2, anyone using the API is looking for results on > processes they > already know something about (mostly), so there's no reason to be > particularly > conservative about. If the caller is trying to be more conservative, > they can maintain > their own extra information about the processes they are managing. > > >> >> What do you think? > I'd like to pick this up as a separate change, and get the current one > in first. > > Roger > > -- - DML From Roger.Riggs at Oracle.com Fri Apr 17 18:57:40 2015 From: Roger.Riggs at Oracle.com (Roger Riggs) Date: Fri, 17 Apr 2015 14:57:40 -0400 Subject: RFR 9: 8077350 Process API Updates Implementation Review In-Reply-To: <55315476.60908@redhat.com> References: <5526DA4A.6030808@Oracle.com> <55296E19.3040204@Oracle.com> <5530BECF.60903@gmail.com> <55313A6F.4070208@Oracle.com> <55315476.60908@redhat.com> Message-ID: <553157A4.4030005@Oracle.com> Hi David, On 4/17/2015 2:44 PM, David M. Lloyd wrote: > On 04/17/2015 11:53 AM, Roger Riggs wrote: >> Hi Peter, >> >> On 4/17/2015 4:05 AM, Peter Levart wrote: >>> Hi Roger, >>> >>> Retrieving and caching the process start time as soon as ProcessHandle >>> is instantiated might be a good idea. "destroy" native code would then >>> use pid *and* start time to check the identity of the process before >>> killing it. >> Yes, though it does raise a question about how to specify PH.equals(). >> Either the start time is explicitly >> mentioned (and is repeatable and testable) or it is vague and refers to >> some implementation >> specific value that uniquely identifies the process; and is less >> testable. > > Even with timestamps though, you cannot prevent the PID from being > reused in the time window after you verify its timestamp but before > you kill it unless it is a direct child process (on UNIX anyway; who > knows what Windows does...). I think that this inevitable race should > be mentioned in the docs regardless of whether the timestamp thing is > implemented (or doc'd) to prevent unrealistic expectations (the api > draft link seems to be dead so I didn't see if it already includes > this kind of language). I can add a note about race conditions to the existing class level javadoc about process information changing asynchronously. "Race conditions can exist between checking the status of a process and acting upon it." But I'm still struck by the oddity of Java needing to provide a better interface to processes than the native OS does. In the native OS, a pid is a pid and the only handle given to applications. So both the app and the os need to be conservative about pid re-use. The link[1] was broken while I replaced it with an update reflecting the recent comments. Thanks, Roger [1] http://cr.openjdk.java.net/~rriggs/phdoc/ > >>> At least on Linux (/proc//stat) and Solaris (/proc//status) >>> it is not necessary to open those special files and read them. Just >>> doing stat() on them and using the st_mtime will get you the process >>> start time. I see AIX shares native code with Linux (unix), so perhaps >>> AIX does the same. Mac OSX and Windows have special calls... >> That is less expensive. But opening /proc//stat is necessary for >> allChildren to get >> and filter on the parent and can provide the starttime as well. >> stat would be useful for allProcesses which does not need the parent. >>> >>> In case OS does not allow retrieving the start time (not owner or >>> similar), it should be cached as some "undefined" value and treated >>> the same when destroying. If while obtaining the ProcessHandle *and* >>> while destroying the process, the start time of the process with a >>> particular pid is "undefined" then there are two options: >>> >>> 1 - don't kill the process >>> 2 - kill the process >>> >>> They might actually be no different as the reason of not being able to >>> retrieve the start time (not owner) might prevent the process from >>> being killed too, so option 2 could be used to allow killing on any >>> hypothetical platforms that don't support retrieving start time and it >>> is no worse than current implementation anyway. >> Destroy is a best-effort method; it is not guaranteed to result in >> termination, though >> the docs are a bit weak on this point. >> >> I'd go for option 2, anyone using the API is looking for results on >> processes they >> already know something about (mostly), so there's no reason to be >> particularly >> conservative about. If the caller is trying to be more conservative, >> they can maintain >> their own extra information about the processes they are managing. >> >> >>> >>> What do you think? >> I'd like to pick this up as a separate change, and get the current one >> in first. >> >> Roger >> >> > From Roger.Riggs at Oracle.com Fri Apr 17 19:12:44 2015 From: Roger.Riggs at Oracle.com (Roger Riggs) Date: Fri, 17 Apr 2015 15:12:44 -0400 Subject: RFR 9: 8077350 Process API Updates Implementation Review (Due 4/23) In-Reply-To: <553157A4.4030005@Oracle.com> References: <5526DA4A.6030808@Oracle.com> <55296E19.3040204@Oracle.com> <5530BECF.60903@gmail.com> <55313A6F.4070208@Oracle.com> <55315476.60908@redhat.com> <553157A4.4030005@Oracle.com> Message-ID: <55315B2C.8060606@Oracle.com> The webrev for ProcessAPI updates has been updated to reflect recent comments. Please review and comment by April 23rd. The updates include: - Renaming Process/ProcessHandle supportsDestroyForcibly to supportsNormalTermination and updating related descriptions - ProcessHandle.destroy/destroyForcible descriptions have more consistent descriptions - ProcessHandle.destroy now returns ProcessHandle to enable fluent use. - Corrected description of default implementation ProcessHandle.onExit The API doc: http://cr.openjdk.java.net/~rriggs/ph-apidraft/ The webrev: http://cr.openjdk.java.net/~rriggs/webrev-ph Issue: JDK-8077350 Process API Updates Implementation The code is in the jdk9 sandbox on branch JDK-8046092-branch. Two issues raised have been filed to be fixed after the current commit: - JDK-8078099 (process) ProcessHandle should uniquely identify processes - JDK-8078108 (process) ProcessHandle.isAlive should be robust From brent.christian at oracle.com Fri Apr 17 20:09:58 2015 From: brent.christian at oracle.com (Brent Christian) Date: Fri, 17 Apr 2015 13:09:58 -0700 Subject: RFR 9: 8048264 : StringBuffer's codePoint methods throw unspecified IndexOutOfBoundsException In-Reply-To: <552CBD75.3050209@oracle.com> References: <552C47F8.2050303@oracle.com> <552CBD75.3050209@oracle.com> Message-ID: <55316896.9040701@oracle.com> On 4/14/15 12:10 AM, Alan Bateman wrote: > On 13/04/2015 23:49, Brent Christian wrote: >> Hello, >> >> Please review this small javadoc change. >> >> It was discovered that some codePoint-related methods in StringBuffer >> are missing documentation for throwing IndexOutOfBoundsException. The >> methods are: >> >> codePointAt(int) >> codePointBefore(int) >> codePointCount(int,int) >> offsetByCodePoints(int,int) >> >> The StringBuilder JavaDoc does have @throws tags for those methods. > This looks okay. Do you have cycles to check if there are any more of > these? It seems that every few years we find more cases where we have > missed the inheritDoc. I'll see if I can find some time to check around. Thanks, -Brent From forax at univ-mlv.fr Fri Apr 17 21:37:49 2015 From: forax at univ-mlv.fr (Remi Forax) Date: Fri, 17 Apr 2015 23:37:49 +0200 Subject: Optional.orElseChain ? Message-ID: <55317D2D.2040900@univ-mlv.fr> Hi guys, I was trying to write a code that uses Optional and I think one method is missing. Let suppose I want to load a type (like a class, an interface, etc) that can come either by reflection, or by using ASM. I will write an interface TypeProvider that is able to load a Type and i will chain the different type providers like this: TypeProvider asmTypeProvider = ... TypeProvider reflectionTypeProvider = ... TypeProvider provider = asmTypeProvider.chain(reflectionTypeProvider).orFail(); so I've implemented TypeProvider like this: public interface TypeProvider { public Optional loadType(String name); public default TypeProvider chain(TypeProvider provider) { return name -> { Optional type = loadType(name); return type.isPresent()? type: provider.loadType(name); }; } public default TypeProvider orFail() { return chain(fail()); } public static TypeProvider fail() { return name -> Optional.empty(); } } As you can see the code is not bad but the code of chain() could be simplified if there was a way on Optional to call a Supplier of Optional if an Optional is empty. Currently, orElse() takes a value, orElseGet takes a lambda that will return a value and there is no method that takes a lambda and return an Optional (like flatMap but but with a supplier that will be called if the Optional is empty). If we add the method orElseChain(Supplier> supplier) perhaps with a better name ?, then the code of chain is better: public default TypeProvider chain(TypeProvider provider) { return name -> loadType(name).orElseChain(() -> provider.loadType(name)); } Am i the only one to think that this method is missing ? regards, R?mi From stevenschlansker at gmail.com Fri Apr 17 22:01:29 2015 From: stevenschlansker at gmail.com (Steven Schlansker) Date: Fri, 17 Apr 2015 15:01:29 -0700 Subject: Optional.orElseChain ? In-Reply-To: <55317D2D.2040900@univ-mlv.fr> References: <55317D2D.2040900@univ-mlv.fr> Message-ID: <31B795E5-485D-4190-BB61-D7C72624C33A@gmail.com> On Apr 17, 2015, at 2:37 PM, Remi Forax wrote: > As you can see the code is not bad but the code of chain() could be simplified > if there was a way on Optional to call a Supplier of Optional if an Optional is empty. > Currently, orElse() takes a value, orElseGet takes a lambda that will return a value > and there is no method that takes a lambda and return an Optional > (like flatMap but but with a supplier that will be called if the Optional is empty). > > If we add the method orElseChain(Supplier> supplier) > perhaps with a better name ?, then the code of chain is better: > > public default TypeProvider chain(TypeProvider provider) { > return name -> loadType(name).orElseChain(() -> provider.loadType(name)); > } > > Am i the only one to think that this method is missing ? We actually ran into the exact same problem, and wrote the following helper method: public static Optional unlessOpt(@Nonnull Optional first, Supplier> second) { return first.isPresent() ? first : second.get(); } I don't think it's precisely the same as your solution, but it definitely indicates a missing method. From andreas.lundblad at oracle.com Fri Apr 17 23:58:35 2015 From: andreas.lundblad at oracle.com (Andreas Lundblad) Date: Sat, 18 Apr 2015 01:58:35 +0200 Subject: Optional.orElseChain ? In-Reply-To: <31B795E5-485D-4190-BB61-D7C72624C33A@gmail.com> References: <55317D2D.2040900@univ-mlv.fr> <31B795E5-485D-4190-BB61-D7C72624C33A@gmail.com> Message-ID: <20150417235834.GG27809@e6430> On Fri, Apr 17, 2015 at 03:01:29PM -0700, Steven Schlansker wrote: > > On Apr 17, 2015, at 2:37 PM, Remi Forax wrote: > > As you can see the code is not bad but the code of chain() could be simplified > > if there was a way on Optional to call a Supplier of Optional if an Optional is empty. > > Currently, orElse() takes a value, orElseGet takes a lambda that will return a value > > and there is no method that takes a lambda and return an Optional > > (like flatMap but but with a supplier that will be called if the Optional is empty). > > > > If we add the method orElseChain(Supplier> supplier) > > perhaps with a better name ?, then the code of chain is better: > > > > public default TypeProvider chain(TypeProvider provider) { > > return name -> loadType(name).orElseChain(() -> provider.loadType(name)); > > } > > > > Am i the only one to think that this method is missing ? > > We actually ran into the exact same problem, and wrote the following helper method: > > public static Optional unlessOpt(@Nonnull Optional first, Supplier> second) { > return first.isPresent() ? first : second.get(); > } > > I don't think it's precisely the same as your solution, but it definitely indicates a missing method. There are similar discussion here: http://stackoverflow.com/questions/24599996/get-value-from-one-optional-or-another and here: http://stackoverflow.com/questions/28818506/java-8-optional-orelse-optional -- Andreas From forax at univ-mlv.fr Sat Apr 18 09:46:10 2015 From: forax at univ-mlv.fr (Remi Forax) Date: Sat, 18 Apr 2015 11:46:10 +0200 Subject: Optional.orElseChain ? In-Reply-To: <20150417235834.GG27809@e6430> References: <55317D2D.2040900@univ-mlv.fr> <31B795E5-485D-4190-BB61-D7C72624C33A@gmail.com> <20150417235834.GG27809@e6430> Message-ID: <553227E2.4040307@univ-mlv.fr> On 04/18/2015 01:58 AM, Andreas Lundblad wrote: > On Fri, Apr 17, 2015 at 03:01:29PM -0700, Steven Schlansker wrote: >> On Apr 17, 2015, at 2:37 PM, Remi Forax wrote: >>> As you can see the code is not bad but the code of chain() could be simplified >>> if there was a way on Optional to call a Supplier of Optional if an Optional is empty. >>> Currently, orElse() takes a value, orElseGet takes a lambda that will return a value >>> and there is no method that takes a lambda and return an Optional >>> (like flatMap but but with a supplier that will be called if the Optional is empty). >>> >>> If we add the method orElseChain(Supplier> supplier) >>> perhaps with a better name ?, then the code of chain is better: >>> >>> public default TypeProvider chain(TypeProvider provider) { >>> return name -> loadType(name).orElseChain(() -> provider.loadType(name)); >>> } >>> >>> Am i the only one to think that this method is missing ? >> We actually ran into the exact same problem, and wrote the following helper method: >> >> public static Optional unlessOpt(@Nonnull Optional first, Supplier> second) { >> return first.isPresent() ? first : second.get(); >> } >> >> I don't think it's precisely the same as your solution, but it definitely indicates a missing method. > There are similar discussion here: > http://stackoverflow.com/questions/24599996/get-value-from-one-optional-or-another > > and here: > http://stackoverflow.com/questions/28818506/java-8-optional-orelse-optional Thanks Andreas, the second link provides a clever answer (which as usually with StackOverflow is not the most voted answer :( ), return name -> loadType(name).map(Optional::of).orElseGet(() -> provider.loadType(name)); by mapping using Optional::of, it creates an Optional of Optional then orElseGet can be used to unwrap it to either an Optional or if the Optional inside the Optional is empty by calling the supplier. while this solution works, it creates an Optional of Optional just to workaround the fact that there is no method orElseChain/orElseOptional. > > -- Andreas cheers, R?mi From thomas.stuefe at gmail.com Sat Apr 18 18:27:12 2015 From: thomas.stuefe at gmail.com (=?UTF-8?Q?Thomas_St=C3=BCfe?=) Date: Sat, 18 Apr 2015 20:27:12 +0200 Subject: RFR 9: 8077350 Process API Updates Implementation Review In-Reply-To: <55313D5C.4060508@Oracle.com> References: <5526DA4A.6030808@Oracle.com> <55296E19.3040204@Oracle.com> <55313D5C.4060508@Oracle.com> Message-ID: Hi Roger, On Fri, Apr 17, 2015 at 7:05 PM, Roger Riggs wrote: > Hi Thomas, > > On 4/16/2015 3:01 PM, Thomas St?fe wrote: > > Hi Roger, > > thank you for your answer! > > The reason I take an interest is not just theoretical. We (SAP) use our > JVM for our test infrastructure and we had exactly the problem > allChildren() is designed to solve: killing a process tree related to a > specific tests (similar to jtreg tests) in case of errors or hangs. We have > test machines running large workloads of tests in parallel and we reach pid > wraparound - depending on the OS - quite fast. > > We solved this by adding process groups to Process.java and we are very > happy with this solution. We are able to quickly kill a whole process tree, > cleanly and completely, without ambiguity or risk to other tests. Of course > we had to add this support as a "sideways hack" in order to not change the > official Process.java interface. Therefore I was hoping that with JEP 102, > we would get official support for process groups. Unfortunately, seems the > decision is already done and we are too late in the discussion :( > > It would be interesting to see a description of what you added to/around > the API. > Very simple really, all we did was to add a flag to Runtime.exec - ultimately exposed via ProcessBuilder - to make the child process leader of a new process group. This flag just triggered a setpgid() call between fork() and exec() in the child process. This caused creation of a new process group with child process as leader. Now you could kill the whole tree with kill(-pid). On Windows we implemented it with Jobs. It was all simple because we did never aim to bring process groups with all their features to the JDK, we just needed a way to kill a tree of child processes, which is a rather specific problem. The reason to avoid them was one of simplicity and non-interference with > processes > spawned by native libraries. > See, that I don't understand, you still interfere with them by returning all child pids - be they spawned by java or by native libs. Or do you mean you offload responsibility to the caller - so he should decide whether to kill the child pids indiscriminately or be more careful? > If that complexity can be understood process groups/jobs > could fulfill a need in a scalable system. > > I think process groups could be added to the API if they are well documented (which admittedly will be difficult in a platform-neutral way). Basically, process groups are a tool like all others, and the caller must think before using it like with every other tool. > At this point, I'd like to deal with it as a separate request for > enhancement. > Sure! Thanks for listening. Kind Regards, Thoams > > > > see my other comments inline. > > On Sat, Apr 11, 2015 at 8:55 PM, Roger Riggs > wrote: > >> Hi Thomas, >> >> Thanks for the comments. >> >> On 4/11/2015 8:31 AM, Thomas St?fe wrote: >> >> Hi Roger, >> >> I have a question about getChildren() and getAllChildren(). >> >> I assume the point of those functions is to implement point 4 of JEP 102 >> ("The ability to deal with process trees, in particular some means to >> destroy a process tree."), by returning a collection of PIDs which are the >> children of the process and then killing them? >> >> Earlier versions included a killProcess tree method but it was >> recommended to leave >> the exact algorithm to kill processes to the caller. >> >> >> However, I am not sure that this can be implemented in a safe way, at >> least on UNIX, because - as Martin already pointed out - of PID recycling. >> I do not see how you can prevent allChildren() from returning PIDs which >> may be already reaped and recyled when you use them later. How do you >> prevent that? >> >> Unless there is an extended time between getting the children and >> destroying them the pids will still be valid. >> > > Why? Child process may be getting reaped the instant you are done > reading it from /proc, and pid may have been recycled by the OS right away > and already pointing to another process when allChildren() returns. If a > process lives about as long as it takes the system to reach a pid > wraparound to the same pid value, its pid could be recycled right after it > is reaped, or? Sure, the longer you wait, the higher the chance of this to > happen, but it may happen right away. > > As Martin said, we had those races in the kill() code since a long time, > but children()/allChildren() could make those error more probable, because > now more processes are involved. Especially if you use allChildren to kill > a deep process tree. And there is nothing in the javadoc warning the user > about this scenario. You would just happen from time to time to kill an > unrelated process. Those problems are hard to debug. > > The technique of caching the start time can prevent that case; though it >> has AFAIK not been a problem. >> > > How would that work? User should, before issuing the kill, compare start > time of process to kill with cached start time? > > See Peter's email, he described it more thoroughly that I have in previous > emails. > > Note even if your coding is bulletproof, that allChildren() will also >> return PIDs of sub processes which are completely unrelated to you and >> Process.java - they could have been forked by some third party native code >> which just happens to run in parallel in the same process. There, you have >> no control about when it gets reaped. It might already have been reaped by >> the time allChildren() returns, and now the same PID got recycled as >> another, unrelated process. >> >> Of course, the best case is for an application to spawn and manage its >> own processes >> and handle there proper termination. >> The use cases for children/allChildren are focused on >> supervisory/executive functions >> that monitor a running system and can cleanup even in the case of >> unexpected failures. >> > All management of processes is subject to OS limitations, if the PID >> were from a completely >> different process tree, the ordinary destroy/info functions would not be >> available >> unless the process was running as a privileged os user (same as any other >> native application). >> > > Could you explain this please? If both trees run under the same user, > why should I not be able to kill a process from a different tree? > > I was considering the case of a different user; only the OS access > controls apply > so if it was the same user the processes could be controlled. > The PH API does not provide more or less access than the OS. > > Thanks, Roger > > > If I am right, it would not be sufficient to state "There is no >> guarantee that a process is alive." - it may be alive but by now be a >> different process altogether. This makes "allChildren()" useless for many >> cases, because the returned information may already be obsolete the moment >> the function returns. >> >> The caching of startTime can remove the ambiguity. >> > >> >> Of course I may something missing here? >> >> But if I got all that right and the sole purpose of allChildren() is to >> be able to kill them (or otherwise signal them), why not use process >> groups? Process groups would be the traditional way on POSIX platforms to >> handle process trees, and they are also available on Windows in the form of >> Job Objects. >> >> Using process groups to signal sub process trees would be safe, would >> not rely on PID identity, and would be more efficient. Also way less >> coding. Also, it would be an old, established pattern - process groups have >> been around for a long time. Also, using process groups it is possible to >> break away from a group, so a program below you which wants to run as a >> demon can do so by removing itself from the process group and thus escaping >> your kill. >> >> On Windows we have Job objects, and I think there are enough >> similarities to POSIX process groups to abstract them into something >> platform independent. >> >> Earlier discussions of process termination and exit value reaping >> considered >> using process groups but it became evident that the Java runtime needed to >> be very careful to not interfere with processes that might be spawned and >> controlled by native libraries and that process groups would only increase >> complexity and the interactions. >> > >> Thanks, Roger >> >> > Thanks! Thomas > > > > From thomas.stuefe at gmail.com Sat Apr 18 18:44:49 2015 From: thomas.stuefe at gmail.com (=?UTF-8?Q?Thomas_St=C3=BCfe?=) Date: Sat, 18 Apr 2015 20:44:49 +0200 Subject: RFR 9: 8077350 Process API Updates Implementation Review In-Reply-To: <553157A4.4030005@Oracle.com> References: <5526DA4A.6030808@Oracle.com> <55296E19.3040204@Oracle.com> <5530BECF.60903@gmail.com> <55313A6F.4070208@Oracle.com> <55315476.60908@redhat.com> <553157A4.4030005@Oracle.com> Message-ID: Hi Roger, On Fri, Apr 17, 2015 at 8:57 PM, Roger Riggs wrote: > Hi David, > > On 4/17/2015 2:44 PM, David M. Lloyd wrote: > >> On 04/17/2015 11:53 AM, Roger Riggs wrote: >> >>> Hi Peter, >>> >>> On 4/17/2015 4:05 AM, Peter Levart wrote: >>> >>>> Hi Roger, >>>> >>>> Retrieving and caching the process start time as soon as ProcessHandle >>>> is instantiated might be a good idea. "destroy" native code would then >>>> use pid *and* start time to check the identity of the process before >>>> killing it. >>>> >>> Yes, though it does raise a question about how to specify PH.equals(). >>> Either the start time is explicitly >>> mentioned (and is repeatable and testable) or it is vague and refers to >>> some implementation >>> specific value that uniquely identifies the process; and is less >>> testable. >>> >> >> Even with timestamps though, you cannot prevent the PID from being reused >> in the time window after you verify its timestamp but before you kill it >> unless it is a direct child process (on UNIX anyway; who knows what Windows >> does...). I think that this inevitable race should be mentioned in the >> docs regardless of whether the timestamp thing is implemented (or doc'd) to >> prevent unrealistic expectations (the api draft link seems to be dead so I >> didn't see if it already includes this kind of language). >> > I can add a note about race conditions to the existing class level > javadoc about process information changing asynchronously. > > "Race conditions can exist between checking the status of a process and > acting upon it." > > But I'm still struck by the oddity of Java needing to provide a better > interface > to processes than the native OS does. In the native OS, a pid is a pid and > the only handle given to applications. So both the app and the os need to > be conservative about pid re-use. > > The problem is the audience. Every UNIX system programmer knows about the dangers of pid recycling. Java programmers don't, and your API promises a robustness and simplicity which it unfortunately cannot deliver. No one will expect a ProcessHandle returned by allChildren suddenly to refer to a totally different process. Therefore I also think the dangers should be clearly mentioned in the java doc. Regards, Thomas > The link[1] was broken while I replaced it with an update reflecting the > recent comments. > > Thanks, Roger > > [1] http://cr.openjdk.java.net/~rriggs/phdoc/ > > > >> At least on Linux (/proc//stat) and Solaris (/proc//status) >>>> it is not necessary to open those special files and read them. Just >>>> doing stat() on them and using the st_mtime will get you the process >>>> start time. I see AIX shares native code with Linux (unix), so perhaps >>>> AIX does the same. Mac OSX and Windows have special calls... >>>> >>> That is less expensive. But opening /proc//stat is necessary for >>> allChildren to get >>> and filter on the parent and can provide the starttime as well. >>> stat would be useful for allProcesses which does not need the parent. >>> >>>> >>>> In case OS does not allow retrieving the start time (not owner or >>>> similar), it should be cached as some "undefined" value and treated >>>> the same when destroying. If while obtaining the ProcessHandle *and* >>>> while destroying the process, the start time of the process with a >>>> particular pid is "undefined" then there are two options: >>>> >>>> 1 - don't kill the process >>>> 2 - kill the process >>>> >>>> They might actually be no different as the reason of not being able to >>>> retrieve the start time (not owner) might prevent the process from >>>> being killed too, so option 2 could be used to allow killing on any >>>> hypothetical platforms that don't support retrieving start time and it >>>> is no worse than current implementation anyway. >>>> >>> Destroy is a best-effort method; it is not guaranteed to result in >>> termination, though >>> the docs are a bit weak on this point. >>> >>> I'd go for option 2, anyone using the API is looking for results on >>> processes they >>> already know something about (mostly), so there's no reason to be >>> particularly >>> conservative about. If the caller is trying to be more conservative, >>> they can maintain >>> their own extra information about the processes they are managing. >>> >>> >>> >>>> What do you think? >>>> >>> I'd like to pick this up as a separate change, and get the current one >>> in first. >>> >>> Roger >>> >>> >>> >> > From erik.joelsson at oracle.com Mon Apr 20 07:02:13 2015 From: erik.joelsson at oracle.com (Erik Joelsson) Date: Mon, 20 Apr 2015 09:02:13 +0200 Subject: RFR: JDK-8074859 Turn on warnings as error In-Reply-To: <55310207.9050207@oracle.com> References: <55310207.9050207@oracle.com> Message-ID: <5534A475.2090909@oracle.com> Looks good to me. /Erik On 2015-04-17 14:52, Magnus Ihse Bursie wrote: > With JDK-8074096, the number of warnings in the product was reduced to > a minimum. This enables the next step, which is turning on the > respective compiler flags that turns warnings into errors. In the long > run, this is the only way to keep the warnings from creeping back. > > Even with JDK-8074096, the product does not build 100% warning free. > This is due to some warnings that cannot be disabled, or (in one case) > where C and C++ code is mixed, and warnings for both languages cannot > be used. A system similar to the one introduced in JDK-8074096 is > therefore needed, in which individual libraries can be exempted from > this flag, until such warnings are fixed. A library can thus disable > warnings as errors with WARNINGS_AS_ERRORS := false, or (better) use a > toolchain-specific version, e.g WARNINGS_AS_ERRORS_gcc := false. This > is intended as a temporary measure, though. The long-term solution is > reasonably to fix the warnings and remove that argument. > > Also, different versions of compilers can generate a different set of > warnings. It is therefore necessary to be able to turn off this > globally. Therefor a new flag for configure is introduced: > --disable-warnings-as-errors. > > While the code compiles without errors on the build systems used > internally at Oracle, this might not be the case on other combinations > of operating system versions and toolchain versions. To facilitate for > unexpecting developers, a help message is added if the build fails, > that suggests using --disable-warnings-as-errors. This solution was > chosen as a compromise between the "hard core" solution of turning on > warnings as errors by default for anyone, and the cowar... erm, > conservative solution of checking if the compiler versions exactly > match what's used inside Oracle (and therefore regularly tested), and > only turn it on in that case. > > Similarly to JDK-8074096, I intend to file follow-up bugs for each > individual library that got a WARNINGS_AS_ERRORS_* := false. > > Bug: https://bugs.openjdk.java.net/browse/JDK-8074859 > WebRev for top: > http://cr.openjdk.java.net/~ihse/JDK-8074859-warnings-as-errors-top/webrev.01 > WebRev for jdk: > http://cr.openjdk.java.net/~ihse/JDK-8074859-warnings-as-errors-jdk/webrev.01 > > Some comments: > > * I needed to add a few more DISABLED_WARNINGS. For windows, this is > most likely due to the recent compiler change. For other libraries, > I'm not sure, but it might well be the result of recent changes that > has introduced new warnings. If so, it highlights the need of this > patch to keep the build warning free. > > * For a few libraries and toolchains, there is *both* > WARNINGS_AS_ERRORS := false and a DISABLED_WARNINGS list. This is the > case if not all warnings are possible to disable. > > * I have removed some incorrect uses of SHARED_LIBRARY_FLAGS. This is > included in our JDK LDFLAGS, so it should not be set separately, and > definitely not as CFLAGS. (This caused compiler warnings, which now > turned into errors.) However, a more suitable long-term solution is > probably to move the knowledge of how to create shared libraries more > specifically into SetupNativeCompilation, and not set it as part of > the JDK flags. > > /Magnus From paul.sandoz at oracle.com Mon Apr 20 11:39:23 2015 From: paul.sandoz at oracle.com (Paul Sandoz) Date: Mon, 20 Apr 2015 13:39:23 +0200 Subject: Optional.orElseChain ? In-Reply-To: <55317D2D.2040900@univ-mlv.fr> References: <55317D2D.2040900@univ-mlv.fr> Message-ID: <19ADDB4E-2F30-4926-ACF3-2A775CE525CA@oracle.com> Hi Remi, I was gonna propose the same trick you mentioned in your last email :-) Similar tricks are possible for other cases like an equivalent of the recently added ifPresentOrElse, but that was considered a little obtuse. On Apr 17, 2015, at 11:37 PM, Remi Forax wrote: > Hi guys, > I was trying to write a code that uses Optional and I think one method is missing. > There is always one more (or four more including the primitive variants) :-) We avoided supporting both the present and absent axes in the intermediate operations (e.g. additional methods with a supplier on absence). This seems like a special intermediate operation, injecting an alternative optional on absence, rather than associated with the orElse terminal operations that return T: public Optional or(Supplier> mapper) { Objects.requireNonNull(mapper); if (isPresent()) { return this; } else { return Objects.requireNonNull(mapper.get()); } } But it has some terminal like qualities to it. It really only makes sense once, or once after each flatMap. I am concerned that a bunch of these sprinkled within a sequence of fluent calls might make it hard to reason about. As such a static method might be more appropriate, but then it's easy for someone to add one in their own code: static Optional or(Optional a, Supplier> b) { Objects.requireNonNull(a); Objects.requireNonNull(b); return a.isPresent() ? a : Objects.requireNonNull(b.get()); } static Optional or(Optional a, Optional b) { Objects.requireNonNull(a); Objects.requireNonNull(b); return a.isPresent() ? a : b; } Perhaps the non-obvious thing about these is a null return should not be allowed. I am somewhat on the fence here... Paul. > Let suppose I want to load a type (like a class, an interface, etc) that can come > either by reflection, or by using ASM. > I will write an interface TypeProvider that is able to load a Type and > i will chain the different type providers like this: > > TypeProvider asmTypeProvider = ... > TypeProvider reflectionTypeProvider = ... > TypeProvider provider = > asmTypeProvider.chain(reflectionTypeProvider).orFail(); > > so I've implemented TypeProvider like this: > > public interface TypeProvider { > public Optional loadType(String name); > > public default TypeProvider chain(TypeProvider provider) { > return name -> { > Optional type = loadType(name); > return type.isPresent()? type: provider.loadType(name); > }; > } > > public default TypeProvider orFail() { > return chain(fail()); > } > > public static TypeProvider fail() { > return name -> Optional.empty(); > } > } > > As you can see the code is not bad but the code of chain() could be simplified > if there was a way on Optional to call a Supplier of Optional if an Optional is empty. > Currently, orElse() takes a value, orElseGet takes a lambda that will return a value > and there is no method that takes a lambda and return an Optional > (like flatMap but but with a supplier that will be called if the Optional is empty). > > If we add the method orElseChain(Supplier> supplier) > perhaps with a better name ?, then the code of chain is better: > > public default TypeProvider chain(TypeProvider provider) { > return name -> loadType(name).orElseChain(() -> provider.loadType(name)); > } > > Am i the only one to think that this method is missing ? > > regards, > R?mi > From sgehwolf at redhat.com Mon Apr 20 12:02:13 2015 From: sgehwolf at redhat.com (Severin Gehwolf) Date: Mon, 20 Apr 2015 14:02:13 +0200 Subject: RFR(xs): 6991580: IPv6 Nameservers in resolv.conf throws NumberFormatException Message-ID: <1429531333.3444.14.camel@redhat.com> Hi, Could I please get a review and a sponsor for the following patch? The issue is that JDK's internal /etc/resolv.conf nameserver parsing does not properly account for IPv6 addresses on Linux/Unix. While the code in com.sun.jndi.dns.DnsClient seems to support IPv6 addresses passed in via the servers list in the constructor it expects IPv6 addresses to be wrapped in '[' and ']' respectively. However, sun.net.dns.ResolverConfigurationImpl does no wrapping of IPv6 addresses when parsing "nameserver" keywords from /etc/resolv.conf, thus breaking DnsClient's contract. The fix is to properly wrap IPv6 literal addresses in '[' and ']' if not already wrapped. Bug: https://bugs.openjdk.java.net/browse/JDK-6991580 Webrev: http://cr.openjdk.java.net/~sgehwolf/webrevs/JDK-6991580/webrev.01/ Testing done: Added regression test fails for unpatched 9 and passes for patched 9. Thanks, Severin From sgehwolf at redhat.com Mon Apr 20 12:14:46 2015 From: sgehwolf at redhat.com (Severin Gehwolf) Date: Mon, 20 Apr 2015 14:14:46 +0200 Subject: RFR(xs): 6991580: IPv6 Nameservers in resolv.conf throws NumberFormatException In-Reply-To: <1429531333.3444.14.camel@redhat.com> References: <1429531333.3444.14.camel@redhat.com> Message-ID: <1429532086.3444.15.camel@redhat.com> Adding in net-dev. On Mon, 2015-04-20 at 14:02 +0200, Severin Gehwolf wrote: > Hi, > > Could I please get a review and a sponsor for the following patch? > > The issue is that JDK's internal /etc/resolv.conf nameserver parsing > does not properly account for IPv6 addresses on Linux/Unix. While the > code in com.sun.jndi.dns.DnsClient seems to support IPv6 addresses > passed in via the servers list in the constructor it expects IPv6 > addresses to be wrapped in '[' and ']' respectively. However, > sun.net.dns.ResolverConfigurationImpl does no wrapping of IPv6 addresses > when parsing "nameserver" keywords from /etc/resolv.conf, thus breaking > DnsClient's contract. > > The fix is to properly wrap IPv6 literal addresses in '[' and ']' if not > already wrapped. > > Bug: https://bugs.openjdk.java.net/browse/JDK-6991580 > Webrev: > http://cr.openjdk.java.net/~sgehwolf/webrevs/JDK-6991580/webrev.01/ > > Testing done: Added regression test fails for unpatched 9 and passes for > patched 9. > > Thanks, > Severin > From paul.sandoz at oracle.com Mon Apr 20 13:01:58 2015 From: paul.sandoz at oracle.com (Paul Sandoz) Date: Mon, 20 Apr 2015 15:01:58 +0200 Subject: RFR 9: 8077350 Process API Updates Implementation Review (Due 4/23) In-Reply-To: <55315B2C.8060606@Oracle.com> References: <5526DA4A.6030808@Oracle.com> <55296E19.3040204@Oracle.com> <5530BECF.60903@gmail.com> <55313A6F.4070208@Oracle.com> <55315476.60908@redhat.com> <553157A4.4030005@Oracle.com> <55315B2C.8060606@Oracle.com> Message-ID: <48F09E53-DF02-4FFA-850F-47F8A1E5EA3F@oracle.com> Hi Roger, I am not sure you have the @implSpec/@implNote quite correct on the new methods of Process. For example, for Process.toHandle i would expect something like: ... @implSpec This implementation throws an instance of UnsupportedOperationException and performs no other action. Sub-types should override this method, ensuring that calling methods (getPid etc.) of this class, that are not overridden, operate on the returned ProcessHandle. The @implSpec should refer to the implementation in Process itself, and the @implNote cannot be used for any normative statements. The document for Process.gePid (and similarly those methods depending on toHandle) could then be: ... @implSpec This implementation returns a process id as follows: toHandle().getPid(); In this respect is there a need to say anything about the behaviour of a Process created by ProcessBuilder? It might be useful to have some general guidance for sub-types on the class doc of Process e.g. saying they only need to override toHandle but may override some or all dependent methods as appropriate. Paul. On Apr 17, 2015, at 9:12 PM, Roger Riggs wrote: > The webrev for ProcessAPI updates has been updated to reflect recent comments. > Please review and comment by April 23rd. > > The updates include: > - Renaming Process/ProcessHandle supportsDestroyForcibly to supportsNormalTermination > and updating related descriptions > - ProcessHandle.destroy/destroyForcible descriptions have more consistent descriptions > - ProcessHandle.destroy now returns ProcessHandle to enable fluent use. > - Corrected description of default implementation ProcessHandle.onExit > > The API doc: http://cr.openjdk.java.net/~rriggs/ph-apidraft/ > > The webrev: http://cr.openjdk.java.net/~rriggs/webrev-ph > > Issue: JDK-8077350 Process API Updates Implementation > > The code is in the jdk9 sandbox on branch JDK-8046092-branch. > > Two issues raised have been filed to be fixed after the current commit: > - JDK-8078099 (process) ProcessHandle should uniquely identify processes > - JDK-8078108 (process) ProcessHandle.isAlive should be robust From forax at univ-mlv.fr Mon Apr 20 14:27:37 2015 From: forax at univ-mlv.fr (Remi Forax) Date: Mon, 20 Apr 2015 16:27:37 +0200 Subject: Optional.orElseChain ? In-Reply-To: <19ADDB4E-2F30-4926-ACF3-2A775CE525CA@oracle.com> References: <55317D2D.2040900@univ-mlv.fr> <19ADDB4E-2F30-4926-ACF3-2A775CE525CA@oracle.com> Message-ID: <55350CD9.6040002@univ-mlv.fr> On 04/20/2015 01:39 PM, Paul Sandoz wrote: > Hi Remi, > > I was gonna propose the same trick you mentioned in your last email :-) yes, it's the same as optional.map(Stream::of).orElseGet(() -> Stream.empty()) (I use orElseGet() because Stream.empty() is not a constant !). > > Similar tricks are possible for other cases like an equivalent of the recently added ifPresentOrElse, but that was considered a little obtuse. > > > On Apr 17, 2015, at 11:37 PM, Remi Forax wrote: >> Hi guys, >> I was trying to write a code that uses Optional and I think one method is missing. >> > There is always one more (or four more including the primitive variants) :-) Yes, yet another one. Note that technically, the only thing you need is to be able to do pattern matching on the two states, so if you have a way to do a flatMap() for the case with a value and a flatMap() for the case with no value, you're done. Doing a flatMap for the case with no value is exactly what you have called 'or'. So it's yet another method to add but it's the last one :) > > We avoided supporting both the present and absent axes in the intermediate operations (e.g. additional methods with a supplier on absence). > > This seems like a special intermediate operation, injecting an alternative optional on absence, rather than associated with the orElse terminal operations that return T: > > public Optional or(Supplier> mapper) { > Objects.requireNonNull(mapper); > if (isPresent()) { > return this; > } else { > return Objects.requireNonNull(mapper.get()); > } > } yes, > > But it has some terminal like qualities to it. It really only makes sense once, or once after each flatMap. I am concerned that a bunch of these sprinkled within a sequence of fluent calls might make it hard to reason about. > > As such a static method might be more appropriate, but then it's easy for someone to add one in their own code: > > static Optional or(Optional a, Supplier> b) { > Objects.requireNonNull(a); > Objects.requireNonNull(b); > return a.isPresent() ? a : Objects.requireNonNull(b.get()); > } > > static Optional or(Optional a, Optional b) { > Objects.requireNonNull(a); > Objects.requireNonNull(b); > return a.isPresent() ? a : b; > } > > Perhaps the non-obvious thing about these is a null return should not be allowed. But mixing static methods and instance methods is not readable too, instance methods goes left to right and static methods goes right to left. > > I am somewhat on the fence here... If you only knew the power of the Dark Side :) > > Paul. R?mi > > >> Let suppose I want to load a type (like a class, an interface, etc) that can come >> either by reflection, or by using ASM. >> I will write an interface TypeProvider that is able to load a Type and >> i will chain the different type providers like this: >> >> TypeProvider asmTypeProvider = ... >> TypeProvider reflectionTypeProvider = ... >> TypeProvider provider = >> asmTypeProvider.chain(reflectionTypeProvider).orFail(); >> >> so I've implemented TypeProvider like this: >> >> public interface TypeProvider { >> public Optional loadType(String name); >> >> public default TypeProvider chain(TypeProvider provider) { >> return name -> { >> Optional type = loadType(name); >> return type.isPresent()? type: provider.loadType(name); >> }; >> } >> >> public default TypeProvider orFail() { >> return chain(fail()); >> } >> >> public static TypeProvider fail() { >> return name -> Optional.empty(); >> } >> } >> >> As you can see the code is not bad but the code of chain() could be simplified >> if there was a way on Optional to call a Supplier of Optional if an Optional is empty. >> Currently, orElse() takes a value, orElseGet takes a lambda that will return a value >> and there is no method that takes a lambda and return an Optional >> (like flatMap but but with a supplier that will be called if the Optional is empty). >> >> If we add the method orElseChain(Supplier> supplier) >> perhaps with a better name ?, then the code of chain is better: >> >> public default TypeProvider chain(TypeProvider provider) { >> return name -> loadType(name).orElseChain(() -> provider.loadType(name)); >> } >> >> Am i the only one to think that this method is missing ? >> >> regards, >> R?mi >> From alexander.v.stepanov at oracle.com Mon Apr 20 15:01:00 2015 From: alexander.v.stepanov at oracle.com (alexander stepanov) Date: Mon, 20 Apr 2015 18:01:00 +0300 Subject: RFR [9] 8038764: tidy warnings cleanup for javax.activation Message-ID: <553514AC.9050901@oracle.com> Hello, Could you please review the fix http://cr.openjdk.java.net/~avstepan/8038764/webrev.00/ for the following bug: https://bugs.openjdk.java.net/browse/JDK-8038764 Just a minor HTML markup fix (few 'trimming empty

    ' warnings fixed). Probably the code affected is an upstream. Regards, Alexander From pavel.rappo at oracle.com Mon Apr 20 15:10:10 2015 From: pavel.rappo at oracle.com (Pavel Rappo) Date: Mon, 20 Apr 2015 16:10:10 +0100 Subject: RFR JDK-8029689: (spec) Reader.read(char[], int, int) throws unspecified IndexOutOfBoundsException Message-ID: <397916B4-BE8B-43F4-8380-366312EFED39@oracle.com> Hi everyone, Could you please review my change for JDK-8029689 http://cr.openjdk.java.net/~prappo/8029689/webrev.00/ ------------------------------------------------------------------------------- There is a long-standing issue when platform implementations of java.io.Reader throw IndexOutOfBoundsException for bounds checks from inherited java.io.Reader.read(char[], int, int) method though java.io.Reader itself does not specify this situation. Suggested solution is to update the contract of java.io.Reader.read(char[], int, int) and its publicly exported descendants to capture the implied preconditions for reading range and the array size. Given that throwing IOBE in this situation is a de facto standard, this change won't bring any kind of incompatibility, though to stay compliant 3rd party implementations may need to be updated. -Pavel From lance.andersen at oracle.com Mon Apr 20 15:10:07 2015 From: lance.andersen at oracle.com (Lance Andersen) Date: Mon, 20 Apr 2015 11:10:07 -0400 Subject: RFR [9] 8038764: tidy warnings cleanup for javax.activation In-Reply-To: <553514AC.9050901@oracle.com> References: <553514AC.9050901@oracle.com> Message-ID: <0DC2204D-79C6-434D-A311-5374C4D55BE6@oracle.com> Looks fine. Need to get this into the upstream project though so they are not lost on the next update Best Lance On Apr 20, 2015, at 11:01 AM, alexander stepanov wrote: > Hello, > > Could you please review the fix > http://cr.openjdk.java.net/~avstepan/8038764/webrev.00/ > > for the following bug: > https://bugs.openjdk.java.net/browse/JDK-8038764 > > Just a minor HTML markup fix (few 'trimming empty

    ' warnings fixed). > > Probably the code affected is an upstream. > > Regards, > Alexander Lance Andersen| Principal Member of Technical Staff | +1.781.442.2037 Oracle Java Engineering 1 Network Drive Burlington, MA 01803 Lance.Andersen at oracle.com From alexander.v.stepanov at oracle.com Mon Apr 20 15:15:16 2015 From: alexander.v.stepanov at oracle.com (alexander stepanov) Date: Mon, 20 Apr 2015 18:15:16 +0300 Subject: RFR [9] 8038764: tidy warnings cleanup for javax.activation In-Reply-To: <0DC2204D-79C6-434D-A311-5374C4D55BE6@oracle.com> References: <553514AC.9050901@oracle.com> <0DC2204D-79C6-434D-A311-5374C4D55BE6@oracle.com> Message-ID: <55351804.5020803@oracle.com> Thanks! On 20.04.2015 18:10, Lance Andersen wrote: > Looks fine. Need to get this into the upstream project though so they > are not lost on the next update > > Best > Lance > On Apr 20, 2015, at 11:01 AM, alexander stepanov > > wrote: > >> Hello, >> >> Could you please review the fix >> http://cr.openjdk.java.net/~avstepan/8038764/webrev.00/ >> >> >> for the following bug: >> https://bugs.openjdk.java.net/browse/JDK-8038764 >> >> Just a minor HTML markup fix (few 'trimming empty

    ' warnings fixed). >> >> Probably the code affected is an upstream. >> >> Regards, >> Alexander > > > > Lance > Andersen| Principal Member of Technical Staff | +1.781.442.2037 > Oracle Java Engineering > 1 Network Drive > Burlington, MA 01803 > Lance.Andersen at oracle.com > > > From lance.andersen at oracle.com Mon Apr 20 15:17:40 2015 From: lance.andersen at oracle.com (Lance Andersen) Date: Mon, 20 Apr 2015 11:17:40 -0400 Subject: RFR JDK-8029689: (spec) Reader.read(char[], int, int) throws unspecified IndexOutOfBoundsException In-Reply-To: <397916B4-BE8B-43F4-8380-366312EFED39@oracle.com> References: <397916B4-BE8B-43F4-8380-366312EFED39@oracle.com> Message-ID: <83C8ED6F-B6C5-4231-97DA-02876435CE42@oracle.com> Hi Pavel, So we are just documenting/clarifying the current behavior from what I can tell from the change? If so, this looks OK assuming you have an approved CCC? The test seems fine. I am assuming there should not be any issues here but would be good to hear from others on this change as well Best Lance On Apr 20, 2015, at 11:10 AM, Pavel Rappo wrote: > > Hi everyone, > > Could you please review my change for JDK-8029689 > > http://cr.openjdk.java.net/~prappo/8029689/webrev.00/ > > ------------------------------------------------------------------------------- > There is a long-standing issue when platform implementations of java.io.Reader > throw IndexOutOfBoundsException for bounds checks from inherited > java.io.Reader.read(char[], int, int) method though java.io.Reader itself does > not specify this situation. > > Suggested solution is to update the contract of java.io.Reader.read(char[], int, > int) and its publicly exported descendants to capture the implied preconditions > for reading range and the array size. > > Given that throwing IOBE in this situation is a de facto standard, this change > won't bring any kind of incompatibility, though to stay compliant 3rd party > implementations may need to be updated. > > -Pavel > Lance Andersen| Principal Member of Technical Staff | +1.781.442.2037 Oracle Java Engineering 1 Network Drive Burlington, MA 01803 Lance.Andersen at oracle.com From chris.hegarty at oracle.com Mon Apr 20 15:24:15 2015 From: chris.hegarty at oracle.com (Chris Hegarty) Date: Mon, 20 Apr 2015 16:24:15 +0100 Subject: RFR JDK-8029689: (spec) Reader.read(char[], int, int) throws unspecified IndexOutOfBoundsException In-Reply-To: <83C8ED6F-B6C5-4231-97DA-02876435CE42@oracle.com> References: <397916B4-BE8B-43F4-8380-366312EFED39@oracle.com> <83C8ED6F-B6C5-4231-97DA-02876435CE42@oracle.com> Message-ID: <55351A1F.3030206@oracle.com> On 20/04/15 16:17, Lance Andersen wrote: > Hi Pavel, > > So we are just documenting/clarifying the current behavior from what I can tell from the change? Looking at the testcase, it passes with the current JDK 9 ( and 8 ), so this is just documenting existing behavior. > If so, this looks OK assuming you have an approved CCC? The test seems fine. A CCC will be needed, and should be submitted after successful review. > I am assuming there should not be any issues here but would be good to hear from others on this change as well Right. We do this ( clarify spec from existing behavior) in other areas too. Given that this is the current behavior of existing platform subtypes, then this change is only specifying existing behavior. Since there are no implementation changes, then Third party Reader subtypes will continue to function as before, but they may need to be updated at some point in the future. -Chris. > Best > Lance > On Apr 20, 2015, at 11:10 AM, Pavel Rappo wrote: > >> >> Hi everyone, >> >> Could you please review my change for JDK-8029689 >> >> http://cr.openjdk.java.net/~prappo/8029689/webrev.00/ >> >> ------------------------------------------------------------------------------- >> There is a long-standing issue when platform implementations of java.io.Reader >> throw IndexOutOfBoundsException for bounds checks from inherited >> java.io.Reader.read(char[], int, int) method though java.io.Reader itself does >> not specify this situation. >> >> Suggested solution is to update the contract of java.io.Reader.read(char[], int, >> int) and its publicly exported descendants to capture the implied preconditions >> for reading range and the array size. >> >> Given that throwing IOBE in this situation is a de facto standard, this change >> won't bring any kind of incompatibility, though to stay compliant 3rd party >> implementations may need to be updated. >> >> -Pavel >> > > > > Lance Andersen| Principal Member of Technical Staff | +1.781.442.2037 > Oracle Java Engineering > 1 Network Drive > Burlington, MA 01803 > Lance.Andersen at oracle.com > > > From Alan.Bateman at oracle.com Mon Apr 20 15:26:06 2015 From: Alan.Bateman at oracle.com (Alan Bateman) Date: Mon, 20 Apr 2015 16:26:06 +0100 Subject: RFR [9] 8038764: tidy warnings cleanup for javax.activation In-Reply-To: <553514AC.9050901@oracle.com> References: <553514AC.9050901@oracle.com> Message-ID: <55351A8E.2090800@oracle.com> On 20/04/2015 16:01, alexander stepanov wrote: > Hello, > > Could you please review the fix > http://cr.openjdk.java.net/~avstepan/8038764/webrev.00/ > > for the following bug: > https://bugs.openjdk.java.net/browse/JDK-8038764 > > Just a minor HTML markup fix (few 'trimming empty

    ' warnings fixed). > > Probably the code affected is an upstream. > I don't think there has been any significant changes to JAF for a long time but best to coordinate with Mirsolav Kos to see if should be pushed to somewhere upstream. -Alan From Roger.Riggs at Oracle.com Mon Apr 20 15:49:43 2015 From: Roger.Riggs at Oracle.com (Roger Riggs) Date: Mon, 20 Apr 2015 11:49:43 -0400 Subject: RFR 9: 8077350 Process API Updates Implementation Review (Due 4/23) In-Reply-To: <48F09E53-DF02-4FFA-850F-47F8A1E5EA3F@oracle.com> References: <5526DA4A.6030808@Oracle.com> <55296E19.3040204@Oracle.com> <5530BECF.60903@gmail.com> <55313A6F.4070208@Oracle.com> <55315476.60908@redhat.com> <553157A4.4030005@Oracle.com> <55315B2C.8060606@Oracle.com> <48F09E53-DF02-4FFA-850F-47F8A1E5EA3F@oracle.com> Message-ID: <55352017.9050903@Oracle.com> Hi Paul, On 4/20/2015 9:01 AM, Paul Sandoz wrote: > Hi Roger, > > I am not sure you have the @implSpec/@implNote quite correct on the new methods of Process. > > For example, for Process.toHandle i would expect something like: > > ... > > @implSpec > This implementation throws an instance of UnsupportedOperationException and > performs no other action. Sub-types should override this method, ensuring that > calling methods (getPid etc.) of this class, that are not overridden, operate on the > returned ProcessHandle. > > The @implSpec should refer to the implementation in Process itself, and the @implNote cannot be used for any normative statements. Thanks for the reminder and suggested text. I updated the @implSpec clauses. Some @implNotes describe the JDK implementation and some developers will rely on the implementation specifics and to some degree define the expected behaviors. > > > The document for Process.getPid (and similarly those methods depending on toHandle) could then be: > > ... > @implSpec > This implementation returns a process id as follows: > > toHandle().getPid(); > > > In this respect is there a need to say anything about the behaviour of a Process created by ProcessBuilder? The ProcessBuilder produced subclasses of Process implement the spec so no additional description is needed. > > It might be useful to have some general guidance for sub-types on the class doc of Process e.g. saying they only need to override toHandle but may override some or all dependent methods as appropriate. It does not add much but I added a paragraph to the Process class javadoc. There are not many subclasses of Process outside the JDK. The webrev[1] and javadoc[2] have been updated in place. Thanks, Roger [1] http://cr.openjdk.java.net/~rriggs/webrev-ph [2] http://cr.openjdk.java.net/~rriggs/ph-apidraft/ > > Paul. > > On Apr 17, 2015, at 9:12 PM, Roger Riggs wrote: > >> The webrev for ProcessAPI updates has been updated to reflect recent comments. >> Please review and comment by April 23rd. >> >> The updates include: >> - Renaming Process/ProcessHandle supportsDestroyForcibly to supportsNormalTermination >> and updating related descriptions >> - ProcessHandle.destroy/destroyForcible descriptions have more consistent descriptions >> - ProcessHandle.destroy now returns ProcessHandle to enable fluent use. >> - Corrected description of default implementation ProcessHandle.onExit >> >> The API doc: http://cr.openjdk.java.net/~rriggs/ph-apidraft/ >> >> The webrev: http://cr.openjdk.java.net/~rriggs/webrev-ph >> >> Issue: JDK-8077350 Process API Updates Implementation >> >> The code is in the jdk9 sandbox on branch JDK-8046092-branch. >> >> Two issues raised have been filed to be fixed after the current commit: >> - JDK-8078099 (process) ProcessHandle should uniquely identify processes >> - JDK-8078108 (process) ProcessHandle.isAlive should be robust From Roger.Riggs at Oracle.com Mon Apr 20 15:53:47 2015 From: Roger.Riggs at Oracle.com (Roger Riggs) Date: Mon, 20 Apr 2015 11:53:47 -0400 Subject: RFR 9: 8077350 Process API Updates Implementation Review In-Reply-To: References: <5526DA4A.6030808@Oracle.com> <55296E19.3040204@Oracle.com> <5530BECF.60903@gmail.com> <55313A6F.4070208@Oracle.com> <55315476.60908@redhat.com> <553157A4.4030005@Oracle.com> Message-ID: <5535210B.9020600@Oracle.com> Hi Thomas, I expanded the ProcessHandle class javadoc [1] paragraph to include the caution about process id reuse. Thanks, Roger [1] http://cr.openjdk.java.net/~rriggs/ph-apidraft/java/lang/ProcessHandle.html On 4/18/2015 2:44 PM, Thomas St?fe wrote: > Hi Roger, > > On Fri, Apr 17, 2015 at 8:57 PM, Roger Riggs > wrote: > > Hi David, > > On 4/17/2015 2:44 PM, David M. Lloyd wrote: > > On 04/17/2015 11:53 AM, Roger Riggs wrote: > > Hi Peter, > > On 4/17/2015 4:05 AM, Peter Levart wrote: > > Hi Roger, > > Retrieving and caching the process start time as soon > as ProcessHandle > is instantiated might be a good idea. "destroy" native > code would then > use pid *and* start time to check the identity of the > process before > killing it. > > Yes, though it does raise a question about how to specify > PH.equals(). > Either the start time is explicitly > mentioned (and is repeatable and testable) or it is vague > and refers to > some implementation > specific value that uniquely identifies the process; and > is less testable. > > > Even with timestamps though, you cannot prevent the PID from > being reused in the time window after you verify its timestamp > but before you kill it unless it is a direct child process (on > UNIX anyway; who knows what Windows does...). I think that > this inevitable race should be mentioned in the docs > regardless of whether the timestamp thing is implemented (or > doc'd) to prevent unrealistic expectations (the api draft link > seems to be dead so I didn't see if it already includes this > kind of language). > > I can add a note about race conditions to the existing class level > javadoc about process information changing asynchronously. > > "Race conditions can exist between checking the status of a > process and acting upon it." > > But I'm still struck by the oddity of Java needing to provide a > better interface > to processes than the native OS does. In the native OS, a pid is > a pid and > the only handle given to applications. So both the app and the os > need to > be conservative about pid re-use. > > The problem is the audience. Every UNIX system programmer knows about > the dangers of pid recycling. Java programmers don't, and your API > promises a robustness and simplicity which it unfortunately cannot > deliver. No one will expect a ProcessHandle returned by allChildren > suddenly to refer to a totally different process. Therefore I also > think the dangers should be clearly mentioned in the java doc. > > Regards, Thomas > > The link[1] was broken while I replaced it with an update > reflecting the recent comments. > > Thanks, Roger > > [1] http://cr.openjdk.java.net/~rriggs/phdoc/ > > > > > At least on Linux (/proc//stat) and Solaris > (/proc//status) > it is not necessary to open those special files and > read them. Just > doing stat() on them and using the st_mtime will get > you the process > start time. I see AIX shares native code with Linux > (unix), so perhaps > AIX does the same. Mac OSX and Windows have special > calls... > > That is less expensive. But opening /proc//stat is > necessary for > allChildren to get > and filter on the parent and can provide the starttime as > well. > stat would be useful for allProcesses which does not need > the parent. > > > In case OS does not allow retrieving the start time > (not owner or > similar), it should be cached as some "undefined" > value and treated > the same when destroying. If while obtaining the > ProcessHandle *and* > while destroying the process, the start time of the > process with a > particular pid is "undefined" then there are two options: > > 1 - don't kill the process > 2 - kill the process > > They might actually be no different as the reason of > not being able to > retrieve the start time (not owner) might prevent the > process from > being killed too, so option 2 could be used to allow > killing on any > hypothetical platforms that don't support retrieving > start time and it > is no worse than current implementation anyway. > > Destroy is a best-effort method; it is not guaranteed to > result in > termination, though > the docs are a bit weak on this point. > > I'd go for option 2, anyone using the API is looking for > results on > processes they > already know something about (mostly), so there's no > reason to be > particularly > conservative about. If the caller is trying to be more > conservative, > they can maintain > their own extra information about the processes they are > managing. > > > > What do you think? > > I'd like to pick this up as a separate change, and get the > current one > in first. > > Roger > > > > > From thomas.stuefe at gmail.com Mon Apr 20 15:57:06 2015 From: thomas.stuefe at gmail.com (=?UTF-8?Q?Thomas_St=C3=BCfe?=) Date: Mon, 20 Apr 2015 17:57:06 +0200 Subject: RFR 9: 8077350 Process API Updates Implementation Review In-Reply-To: <5535210B.9020600@Oracle.com> References: <5526DA4A.6030808@Oracle.com> <55296E19.3040204@Oracle.com> <5530BECF.60903@gmail.com> <55313A6F.4070208@Oracle.com> <55315476.60908@redhat.com> <553157A4.4030005@Oracle.com> <5535210B.9020600@Oracle.com> Message-ID: Hi Roger, thanks! Maybe better: "When using ProcessHandles avoid assumptions about the state or liveness of the underlying process." -> "When using ProcessHandles avoid assumptions about liveness or identity of the underlying process." Regards, Thomas On Mon, Apr 20, 2015 at 5:53 PM, Roger Riggs wrote: > Hi Thomas, > > I expanded the ProcessHandle class javadoc [1] paragraph to include the > caution about process id reuse. > > Thanks, Roger > > [1] > http://cr.openjdk.java.net/~rriggs/ph-apidraft/java/lang/ProcessHandle.html > > > On 4/18/2015 2:44 PM, Thomas St?fe wrote: > > Hi Roger, > > On Fri, Apr 17, 2015 at 8:57 PM, Roger Riggs > wrote: > >> Hi David, >> >> On 4/17/2015 2:44 PM, David M. Lloyd wrote: >> >>> On 04/17/2015 11:53 AM, Roger Riggs wrote: >>> >>>> Hi Peter, >>>> >>>> On 4/17/2015 4:05 AM, Peter Levart wrote: >>>> >>>>> Hi Roger, >>>>> >>>>> Retrieving and caching the process start time as soon as ProcessHandle >>>>> is instantiated might be a good idea. "destroy" native code would then >>>>> use pid *and* start time to check the identity of the process before >>>>> killing it. >>>>> >>>> Yes, though it does raise a question about how to specify PH.equals(). >>>> Either the start time is explicitly >>>> mentioned (and is repeatable and testable) or it is vague and refers to >>>> some implementation >>>> specific value that uniquely identifies the process; and is less >>>> testable. >>>> >>> >>> Even with timestamps though, you cannot prevent the PID from being >>> reused in the time window after you verify its timestamp but before you >>> kill it unless it is a direct child process (on UNIX anyway; who knows what >>> Windows does...). I think that this inevitable race should be mentioned in >>> the docs regardless of whether the timestamp thing is implemented (or >>> doc'd) to prevent unrealistic expectations (the api draft link seems to be >>> dead so I didn't see if it already includes this kind of language). >>> >> I can add a note about race conditions to the existing class level >> javadoc about process information changing asynchronously. >> >> "Race conditions can exist between checking the status of a process and >> acting upon it." >> >> But I'm still struck by the oddity of Java needing to provide a better >> interface >> to processes than the native OS does. In the native OS, a pid is a pid >> and >> the only handle given to applications. So both the app and the os need to >> be conservative about pid re-use. >> >> > The problem is the audience. Every UNIX system programmer knows about the > dangers of pid recycling. Java programmers don't, and your API promises a > robustness and simplicity which it unfortunately cannot deliver. No one > will expect a ProcessHandle returned by allChildren suddenly to refer to a > totally different process. Therefore I also think the dangers should be > clearly mentioned in the java doc. > > Regards, Thomas > > > >> The link[1] was broken while I replaced it with an update reflecting the >> recent comments. >> >> Thanks, Roger >> >> [1] http://cr.openjdk.java.net/~rriggs/phdoc/ >> >> >> >>> At least on Linux (/proc//stat) and Solaris (/proc//status) >>>>> it is not necessary to open those special files and read them. Just >>>>> doing stat() on them and using the st_mtime will get you the process >>>>> start time. I see AIX shares native code with Linux (unix), so perhaps >>>>> AIX does the same. Mac OSX and Windows have special calls... >>>>> >>>> That is less expensive. But opening /proc//stat is necessary for >>>> allChildren to get >>>> and filter on the parent and can provide the starttime as well. >>>> stat would be useful for allProcesses which does not need the parent. >>>> >>>>> >>>>> In case OS does not allow retrieving the start time (not owner or >>>>> similar), it should be cached as some "undefined" value and treated >>>>> the same when destroying. If while obtaining the ProcessHandle *and* >>>>> while destroying the process, the start time of the process with a >>>>> particular pid is "undefined" then there are two options: >>>>> >>>>> 1 - don't kill the process >>>>> 2 - kill the process >>>>> >>>>> They might actually be no different as the reason of not being able to >>>>> retrieve the start time (not owner) might prevent the process from >>>>> being killed too, so option 2 could be used to allow killing on any >>>>> hypothetical platforms that don't support retrieving start time and it >>>>> is no worse than current implementation anyway. >>>>> >>>> Destroy is a best-effort method; it is not guaranteed to result in >>>> termination, though >>>> the docs are a bit weak on this point. >>>> >>>> I'd go for option 2, anyone using the API is looking for results on >>>> processes they >>>> already know something about (mostly), so there's no reason to be >>>> particularly >>>> conservative about. If the caller is trying to be more conservative, >>>> they can maintain >>>> their own extra information about the processes they are managing. >>>> >>>> >>>> >>>>> What do you think? >>>>> >>>> I'd like to pick this up as a separate change, and get the current one >>>> in first. >>>> >>>> Roger >>>> >>>> >>>> >>> >> > > From gnu.andrew at redhat.com Mon Apr 20 16:24:24 2015 From: gnu.andrew at redhat.com (Andrew Hughes) Date: Mon, 20 Apr 2015 12:24:24 -0400 (EDT) Subject: RFR(xs): 6991580: IPv6 Nameservers in resolv.conf throws NumberFormatException In-Reply-To: <1429532086.3444.15.camel@redhat.com> References: <1429531333.3444.14.camel@redhat.com> <1429532086.3444.15.camel@redhat.com> Message-ID: <692561968.2911058.1429547064809.JavaMail.zimbra@redhat.com> ----- Original Message ----- > Adding in net-dev. > > On Mon, 2015-04-20 at 14:02 +0200, Severin Gehwolf wrote: > > Hi, > > > > Could I please get a review and a sponsor for the following patch? > > > > The issue is that JDK's internal /etc/resolv.conf nameserver parsing > > does not properly account for IPv6 addresses on Linux/Unix. While the > > code in com.sun.jndi.dns.DnsClient seems to support IPv6 addresses > > passed in via the servers list in the constructor it expects IPv6 > > addresses to be wrapped in '[' and ']' respectively. However, > > sun.net.dns.ResolverConfigurationImpl does no wrapping of IPv6 addresses > > when parsing "nameserver" keywords from /etc/resolv.conf, thus breaking > > DnsClient's contract. > > > > The fix is to properly wrap IPv6 literal addresses in '[' and ']' if not > > already wrapped. > > > > Bug: https://bugs.openjdk.java.net/browse/JDK-6991580 > > Webrev: > > http://cr.openjdk.java.net/~sgehwolf/webrevs/JDK-6991580/webrev.01/ > > > > Testing done: Added regression test fails for unpatched 9 and passes for > > patched 9. > > > > Thanks, > > Severin > > > > > > It'd be better to provide public nameservers in the test comment so everyone is able to run this test if they update /etc/resolv.conf appropriately. Google provides some: https://developers.google.com/speed/public-dns/docs/using $ host redhat.com 2001:4860:4860::8888 Using domain server: Name: 2001:4860:4860::8888 Address: 2001:4860:4860::8888#53 Aliases: redhat.com has address 209.132.183.105 -- Andrew :) Free Java Software Engineer Red Hat, Inc. (http://www.redhat.com) PGP Key: ed25519/35964222 (hkp://keys.gnupg.net) Fingerprint = 5132 579D D154 0ED2 3E04 C5A0 CFDA 0F9B 3596 4222 PGP Key: rsa4096/248BDC07 (hkp://keys.gnupg.net) Fingerprint = EC5A 1F5E C0AD 1D15 8F1F 8F91 3B96 A578 248B DC07 From paul.sandoz at oracle.com Mon Apr 20 16:33:52 2015 From: paul.sandoz at oracle.com (Paul Sandoz) Date: Mon, 20 Apr 2015 18:33:52 +0200 Subject: RFR 9: 8077350 Process API Updates Implementation Review (Due 4/23) In-Reply-To: <55352017.9050903@Oracle.com> References: <5526DA4A.6030808@Oracle.com> <55296E19.3040204@Oracle.com> <5530BECF.60903@gmail.com> <55313A6F.4070208@Oracle.com> <55315476.60908@redhat.com> <553157A4.4030005@Oracle.com> <55315B2C.8060606@Oracle.com> <48F09E53-DF02-4FFA-850F-47F8A1E5EA3F@oracle.com> <55352017.9050903@Oracle.com> Message-ID: On Apr 20, 2015, at 5:49 PM, Roger Riggs wrote: > Hi Paul, > > On 4/20/2015 9:01 AM, Paul Sandoz wrote: >> Hi Roger, >> >> I am not sure you have the @implSpec/@implNote quite correct on the new methods of Process. >> >> For example, for Process.toHandle i would expect something like: >> >> ... >> >> @implSpec >> This implementation throws an instance of UnsupportedOperationException and >> performs no other action. Sub-types should override this method, ensuring that >> calling methods (getPid etc.) of this class, that are not overridden, operate on the >> returned ProcessHandle. >> >> The @implSpec should refer to the implementation in Process itself, and the @implNote cannot be used for any normative statements. > Thanks for the reminder and suggested text. I updated the @implSpec clauses. > I spotted another one here: 281 /** 282 * Returns {@code true} if the implementation of {@link #destroy} is to 283 * normally terminate the process, 284 * Returns {@code false} if the implementation of {@code destroy} 285 * forcibly and immediately terminates the process. 286 * 287 * @implSpec 288 * Processes returned from ProcessBuilder support this operation to 289 * return true or false depending on the platform implementation. 290 * 291 * @return {@code true} if the implementation of {@link #destroy} is to 292 * normally terminate the process; 293 * otherwise, {@link #destroy} forcibly terminates the process 294 * @throws UnsupportedOperationException if the Process implementation 295 * does not support this operation 296 * @since 1.9 297 */ 298 public boolean supportsNormalTermination() { 299 throw new UnsupportedOperationException("supportsNormalTermination not supported for " + this.getClass().toString()); 300 } The docs of Process.onExit might also require some tweaks. I dunno how much wiggle room there is with the current implementation, perhaps very little? 415 /** 416 * Returns a ProcessHandle for the Process. 417 * 418 * @implSpec 419 * This implementation throws an instance of UnsupportedOperationException 420 * and performs no other action. ... 446 * @implSpec 447 * The implementation of this method returns information about the process as: 448 * {@link #toHandle toHandle().info()}. Best to be consistent with either "This implementation ..." or "The implementation of this method ..." rather than a mix. I prefer the former as it is more concise. Up to you. > Some @implNotes describe the JDK implementation and some developers will > rely on the implementation specifics and to some degree define the expected behaviors. One way of thinking about this is that the developers writing the TCK tests will pay close attention to @implSpec and need not do so for @implNote. >> >> >> The document for Process.getPid (and similarly those methods depending on toHandle) could then be: >> >> ... >> @implSpec >> This implementation returns a process id as follows: >> >> toHandle().getPid(); >> >> >> In this respect is there a need to say anything about the behaviour of a Process created by ProcessBuilder? > The ProcessBuilder produced subclasses of Process implement the spec > so no additional description is needed. >> >> It might be useful to have some general guidance for sub-types on the class doc of Process e.g. saying they only need to override toHandle but may override some or all dependent methods as appropriate. > It does not add much but I added a paragraph to the Process class javadoc. > There are not many subclasses of Process outside the JDK. > Ok. Paul. > The webrev[1] and javadoc[2] have been updated in place. > > Thanks, Roger > > [1] http://cr.openjdk.java.net/~rriggs/webrev-ph > [2] http://cr.openjdk.java.net/~rriggs/ph-apidraft/ From Roger.Riggs at Oracle.com Mon Apr 20 17:18:03 2015 From: Roger.Riggs at Oracle.com (Roger Riggs) Date: Mon, 20 Apr 2015 13:18:03 -0400 Subject: RFR 9: 8077350 Process API Updates Implementation Review In-Reply-To: References: <5526DA4A.6030808@Oracle.com> <55296E19.3040204@Oracle.com> <5530BECF.60903@gmail.com> <55313A6F.4070208@Oracle.com> <55315476.60908@redhat.com> <553157A4.4030005@Oracle.com> <5535210B.9020600@Oracle.com> Message-ID: <553534CB.6080503@Oracle.com> ok, thanks, roger On 4/20/2015 11:57 AM, Thomas St?fe wrote: > Hi Roger, > > thanks! > > Maybe better: > > "When using ProcessHandles avoid assumptions about the state or > liveness of the underlying process." > -> "When using ProcessHandles avoid assumptions about liveness or > identity of the underlying process." > > Regards, Thomas > > > On Mon, Apr 20, 2015 at 5:53 PM, Roger Riggs > wrote: > > Hi Thomas, > > I expanded the ProcessHandle class javadoc [1] paragraph to > include the > caution about process id reuse. > > Thanks, Roger > > [1] > http://cr.openjdk.java.net/~rriggs/ph-apidraft/java/lang/ProcessHandle.html > > > > > On 4/18/2015 2:44 PM, Thomas St?fe wrote: >> Hi Roger, >> >> On Fri, Apr 17, 2015 at 8:57 PM, Roger Riggs >> > wrote: >> >> Hi David, >> >> On 4/17/2015 2:44 PM, David M. Lloyd wrote: >> >> On 04/17/2015 11:53 AM, Roger Riggs wrote: >> >> Hi Peter, >> >> On 4/17/2015 4:05 AM, Peter Levart wrote: >> >> Hi Roger, >> >> Retrieving and caching the process start time as >> soon as ProcessHandle >> is instantiated might be a good idea. "destroy" >> native code would then >> use pid *and* start time to check the identity of >> the process before >> killing it. >> >> Yes, though it does raise a question about how to >> specify PH.equals(). >> Either the start time is explicitly >> mentioned (and is repeatable and testable) or it is >> vague and refers to >> some implementation >> specific value that uniquely identifies the process; >> and is less testable. >> >> >> Even with timestamps though, you cannot prevent the PID >> from being reused in the time window after you verify its >> timestamp but before you kill it unless it is a direct >> child process (on UNIX anyway; who knows what Windows >> does...). I think that this inevitable race should be >> mentioned in the docs regardless of whether the timestamp >> thing is implemented (or doc'd) to prevent unrealistic >> expectations (the api draft link seems to be dead so I >> didn't see if it already includes this kind of language). >> >> I can add a note about race conditions to the existing class >> level >> javadoc about process information changing asynchronously. >> >> "Race conditions can exist between checking the status of a >> process and acting upon it." >> >> But I'm still struck by the oddity of Java needing to provide >> a better interface >> to processes than the native OS does. In the native OS, a >> pid is a pid and >> the only handle given to applications. So both the app and >> the os need to >> be conservative about pid re-use. >> >> The problem is the audience. Every UNIX system programmer knows >> about the dangers of pid recycling. Java programmers don't, and >> your API promises a robustness and simplicity which it >> unfortunately cannot deliver. No one will expect a ProcessHandle >> returned by allChildren suddenly to refer to a totally different >> process. Therefore I also think the dangers should be clearly >> mentioned in the java doc. >> >> Regards, Thomas >> >> The link[1] was broken while I replaced it with an update >> reflecting the recent comments. >> >> Thanks, Roger >> >> [1] http://cr.openjdk.java.net/~rriggs/phdoc/ >> >> >> >> >> At least on Linux (/proc//stat) and Solaris >> (/proc//status) >> it is not necessary to open those special files >> and read them. Just >> doing stat() on them and using the st_mtime will >> get you the process >> start time. I see AIX shares native code with >> Linux (unix), so perhaps >> AIX does the same. Mac OSX and Windows have >> special calls... >> >> That is less expensive. But opening /proc//stat >> is necessary for >> allChildren to get >> and filter on the parent and can provide the >> starttime as well. >> stat would be useful for allProcesses which does not >> need the parent. >> >> >> In case OS does not allow retrieving the start >> time (not owner or >> similar), it should be cached as some "undefined" >> value and treated >> the same when destroying. If while obtaining the >> ProcessHandle *and* >> while destroying the process, the start time of >> the process with a >> particular pid is "undefined" then there are two >> options: >> >> 1 - don't kill the process >> 2 - kill the process >> >> They might actually be no different as the reason >> of not being able to >> retrieve the start time (not owner) might prevent >> the process from >> being killed too, so option 2 could be used to >> allow killing on any >> hypothetical platforms that don't support >> retrieving start time and it >> is no worse than current implementation anyway. >> >> Destroy is a best-effort method; it is not >> guaranteed to result in >> termination, though >> the docs are a bit weak on this point. >> >> I'd go for option 2, anyone using the API is looking >> for results on >> processes they >> already know something about (mostly), so there's no >> reason to be >> particularly >> conservative about. If the caller is trying to be >> more conservative, >> they can maintain >> their own extra information about the processes they >> are managing. >> >> >> >> What do you think? >> >> I'd like to pick this up as a separate change, and >> get the current one >> in first. >> >> Roger >> >> >> >> >> > > From sgehwolf at redhat.com Mon Apr 20 17:32:20 2015 From: sgehwolf at redhat.com (Severin Gehwolf) Date: Mon, 20 Apr 2015 19:32:20 +0200 Subject: RFR(xs): 6991580: IPv6 Nameservers in resolv.conf throws NumberFormatException In-Reply-To: <692561968.2911058.1429547064809.JavaMail.zimbra@redhat.com> References: <1429531333.3444.14.camel@redhat.com> <1429532086.3444.15.camel@redhat.com> <692561968.2911058.1429547064809.JavaMail.zimbra@redhat.com> Message-ID: <1429551140.3444.39.camel@redhat.com> On Mon, 2015-04-20 at 12:24 -0400, Andrew Hughes wrote: > ----- Original Message ----- > > Adding in net-dev. > > > > On Mon, 2015-04-20 at 14:02 +0200, Severin Gehwolf wrote: > > > Hi, > > > > > > Could I please get a review and a sponsor for the following patch? > > > > > > The issue is that JDK's internal /etc/resolv.conf nameserver parsing > > > does not properly account for IPv6 addresses on Linux/Unix. While the > > > code in com.sun.jndi.dns.DnsClient seems to support IPv6 addresses > > > passed in via the servers list in the constructor it expects IPv6 > > > addresses to be wrapped in '[' and ']' respectively. However, > > > sun.net.dns.ResolverConfigurationImpl does no wrapping of IPv6 addresses > > > when parsing "nameserver" keywords from /etc/resolv.conf, thus breaking > > > DnsClient's contract. > > > > > > The fix is to properly wrap IPv6 literal addresses in '[' and ']' if not > > > already wrapped. > > > > > > Bug: https://bugs.openjdk.java.net/browse/JDK-6991580 > > > Webrev: > > > http://cr.openjdk.java.net/~sgehwolf/webrevs/JDK-6991580/webrev.01/ > > > > > > Testing done: Added regression test fails for unpatched 9 and passes for > > > patched 9. > > > > > > Thanks, > > > Severin > > > > > > > > > > > > > It'd be better to provide public nameservers in the test comment so everyone > is able to run this test if they update /etc/resolv.conf appropriately. OK fixed: http://cr.openjdk.java.net/~sgehwolf/webrevs/JDK-6991580/webrev.02/ FWIW, I don't think the test needs IP addresses of DNS servers to be functional, though. All it really does is passing it to InetAddress.getByName(). Prior this patch DnsClient fails to parse the IP literals. > Google provides some: https://developers.google.com/speed/public-dns/docs/using > > $ host redhat.com 2001:4860:4860::8888 > Using domain server: > Name: 2001:4860:4860::8888 > Address: 2001:4860:4860::8888#53 > Aliases: > > redhat.com has address 209.132.183.105 On my F21 machine: $ host redhat.com 2001:4860:4860::8888 ;; connection timed out; no servers could be reached But the test still works with a patched JDK: [...] DEBUG: 'nameserver = 127.0.0.1' DEBUG: 'nameserver = [2001:4860:4860::8888]' DEBUG: ==> Found IPv6 address in servers list: [2001:4860:4860::8888] DEBUG: 'nameserver = [::1]:5353' DEBUG: ==> Found IPv6 address in servers list: [::1]:5353 DEBUG: 'nameserver = 127.0.0.1:5353' PASS: Found IPv6 address and DnsClient parsed it correctly. Contrast this to unpatched: [...] DEBUG: 'nameserver = 127.0.0.1' DEBUG: 'nameserver = 2001:4860:4860::8888' DEBUG: ==> Found IPv6 address in servers list: 2001:4860:4860::8888 DEBUG: 'nameserver = [::1]:5353' DEBUG: ==> Found IPv6 address in servers list: [::1]:5353 DEBUG: 'nameserver = 127.0.0.1:5353' Exception in thread "main" java.lang.RuntimeException: FAIL: Tried to parse non-[]-encapsulated IPv6 address. at IPv6NameserverPlatformParsingTest.main(IPv6NameserverPlatformParsingTest.java:59) Caused by: java.lang.NumberFormatException: For input string: "4860:4860::8888" at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65) at java.lang.Integer.parseInt(Integer.java:580) at java.lang.Integer.parseInt(Integer.java:615) at com.sun.jndi.dns.DnsClient.(DnsClient.java:127) at IPv6NameserverPlatformParsingTest.main(IPv6NameserverPlatformParsingTest.java:57) Cheers, Severin From Roger.Riggs at Oracle.com Mon Apr 20 17:33:44 2015 From: Roger.Riggs at Oracle.com (Roger Riggs) Date: Mon, 20 Apr 2015 13:33:44 -0400 Subject: RFR 9: 8077350 Process API Updates Implementation Review (Due 4/23) In-Reply-To: References: <5526DA4A.6030808@Oracle.com> <55296E19.3040204@Oracle.com> <5530BECF.60903@gmail.com> <55313A6F.4070208@Oracle.com> <55315476.60908@redhat.com> <553157A4.4030005@Oracle.com> <55315B2C.8060606@Oracle.com> <48F09E53-DF02-4FFA-850F-47F8A1E5EA3F@oracle.com> <55352017.9050903@Oracle.com> Message-ID: <55353878.2060204@Oracle.com> Hi Paul, There are statements in Process about the specified behavior of Processes created by ProcessBuilder. That's why I included them in the @implSpec clause. If @implSpec is only for the specifics of the method itself then where should the behavior of ProcessBuilder created instances be specified? Thanks, Roger On 4/20/2015 12:33 PM, Paul Sandoz wrote: > On Apr 20, 2015, at 5:49 PM, Roger Riggs wrote: > >> Hi Paul, >> >> On 4/20/2015 9:01 AM, Paul Sandoz wrote: >>> Hi Roger, >>> >>> I am not sure you have the @implSpec/@implNote quite correct on the new methods of Process. >>> >>> For example, for Process.toHandle i would expect something like: >>> >>> ... >>> >>> @implSpec >>> This implementation throws an instance of UnsupportedOperationException and >>> performs no other action. Sub-types should override this method, ensuring that >>> calling methods (getPid etc.) of this class, that are not overridden, operate on the >>> returned ProcessHandle. >>> >>> The @implSpec should refer to the implementation in Process itself, and the @implNote cannot be used for any normative statements. >> Thanks for the reminder and suggested text. I updated the @implSpec clauses. >> > I spotted another one here: > > 281 /** > 282 * Returns {@code true} if the implementation of {@link #destroy} is to > 283 * normally terminate the process, > 284 * Returns {@code false} if the implementation of {@code destroy} > 285 * forcibly and immediately terminates the process. > 286 * > 287 * @implSpec > 288 * Processes returned from ProcessBuilder support this operation to > 289 * return true or false depending on the platform implementation. > 290 * > 291 * @return {@code true} if the implementation of {@link #destroy} is to > 292 * normally terminate the process; > 293 * otherwise, {@link #destroy} forcibly terminates the process > 294 * @throws UnsupportedOperationException if the Process implementation > 295 * does not support this operation > 296 * @since 1.9 > 297 */ > 298 public boolean supportsNormalTermination() { > 299 throw new UnsupportedOperationException("supportsNormalTermination not supported for " + this.getClass().toString()); > 300 } > > > The docs of Process.onExit might also require some tweaks. I dunno how much wiggle room there is with the current implementation, perhaps very little? > > > 415 /** > 416 * Returns a ProcessHandle for the Process. > 417 * > 418 * @implSpec > 419 * This implementation throws an instance of UnsupportedOperationException > 420 * and performs no other action. > ... > 446 * @implSpec > 447 * The implementation of this method returns information about the process as: > 448 * {@link #toHandle toHandle().info()}. > > Best to be consistent with either "This implementation ..." or "The implementation of this method ..." rather than a mix. I prefer the former as it is more concise. Up to you. > > >> Some @implNotes describe the JDK implementation and some developers will >> rely on the implementation specifics and to some degree define the expected behaviors. > One way of thinking about this is that the developers writing the TCK tests will pay close attention to @implSpec and need not do so for @implNote. > > >>> >>> The document for Process.getPid (and similarly those methods depending on toHandle) could then be: >>> >>> ... >>> @implSpec >>> This implementation returns a process id as follows: >>> >>> toHandle().getPid(); >>> >>> >>> In this respect is there a need to say anything about the behaviour of a Process created by ProcessBuilder? >> The ProcessBuilder produced subclasses of Process implement the spec >> so no additional description is needed. >>> It might be useful to have some general guidance for sub-types on the class doc of Process e.g. saying they only need to override toHandle but may override some or all dependent methods as appropriate. >> It does not add much but I added a paragraph to the Process class javadoc. >> There are not many subclasses of Process outside the JDK. >> > Ok. > > Paul. > >> The webrev[1] and javadoc[2] have been updated in place. >> >> Thanks, Roger >> >> [1] http://cr.openjdk.java.net/~rriggs/webrev-ph >> [2] http://cr.openjdk.java.net/~rriggs/ph-apidraft/ From aleksej.efimov at oracle.com Mon Apr 20 18:00:16 2015 From: aleksej.efimov at oracle.com (Aleksej Efimov) Date: Mon, 20 Apr 2015 21:00:16 +0300 Subject: RFR: 8073357: schema1.xsd has wrong content. Sequence of the enum values has been changed Message-ID: <55353EB0.7020407@oracle.com> Hello, The JDK9 schemagen tool hadn't preserved order of the enum values [1] and it was fixed in standalone project and was synced to JDK as part of JAXWS integration [2]. Can I have a review for the 'test/javax/xml/ws/8046817/GenerateEnumSchema.java' test update [3] to include test case for this functionality. The test and the partial backport of [2] will be backported to JDK8. The modified test shows no failures with JPRT on all platforms. With Best Regards, Aleksej [1] JBS bug: https://bugs.openjdk.java.net/browse/JDK-8073357 [2] JAXWS integration: https://bugs.openjdk.java.net/browse/JDK-8076549 [3] Webrev: http://cr.openjdk.java.net/~aefimov/8073357/9/00/ From paul.sandoz at oracle.com Mon Apr 20 18:26:29 2015 From: paul.sandoz at oracle.com (Paul Sandoz) Date: Mon, 20 Apr 2015 20:26:29 +0200 Subject: RFR 9: 8077350 Process API Updates Implementation Review (Due 4/23) In-Reply-To: <55353878.2060204@Oracle.com> References: <5526DA4A.6030808@Oracle.com> <55296E19.3040204@Oracle.com> <5530BECF.60903@gmail.com> <55313A6F.4070208@Oracle.com> <55315476.60908@redhat.com> <553157A4.4030005@Oracle.com> <55315B2C.8060606@Oracle.com> <48F09E53-DF02-4FFA-850F-47F8A1E5EA3F@oracle.com> <55352017.9050903@Oracle.com> <55353878.2060204@Oracle.com> Message-ID: On Apr 20, 2015, at 7:33 PM, Roger Riggs wrote: > Hi Paul, > > There are statements in Process about the specified behavior of Processes > created by ProcessBuilder. That's why I included them in the @implSpec clause. > If @implSpec is only for the specifics of the method itself then where > should the behavior of ProcessBuilder created instances be specified? > I think the @implNote you have on Process.onExit about Processes from ProcessBuilder being more efficient is fine, but that @implNote also appears to mix stuff that is @implSpec for the method itself. For Process.supportsNormalTermination i would presume the @implSpec should be similar to that of toHandle. I don't think there needs to be anything said about Process from ProcessBuilder on this method this as it should "naturally" conform to what is stated. Perhaps you can state something in the class doc of Process and or ProcessBuilder about the behaviour of such Process instances? It would seem to flow from the general statement you added to Process about overriding. Paul. > Thanks, Roger > > > > On 4/20/2015 12:33 PM, Paul Sandoz wrote: >> On Apr 20, 2015, at 5:49 PM, Roger Riggs wrote: >> >>> Hi Paul, >>> >>> On 4/20/2015 9:01 AM, Paul Sandoz wrote: >>>> Hi Roger, >>>> >>>> I am not sure you have the @implSpec/@implNote quite correct on the new methods of Process. >>>> >>>> For example, for Process.toHandle i would expect something like: >>>> >>>> ... >>>> >>>> @implSpec >>>> This implementation throws an instance of UnsupportedOperationException and >>>> performs no other action. Sub-types should override this method, ensuring that >>>> calling methods (getPid etc.) of this class, that are not overridden, operate on the >>>> returned ProcessHandle. >>>> >>>> The @implSpec should refer to the implementation in Process itself, and the @implNote cannot be used for any normative statements. >>> Thanks for the reminder and suggested text. I updated the @implSpec clauses. >>> >> I spotted another one here: >> >> 281 /** >> 282 * Returns {@code true} if the implementation of {@link #destroy} is to >> 283 * normally terminate the process, >> 284 * Returns {@code false} if the implementation of {@code destroy} >> 285 * forcibly and immediately terminates the process. >> 286 * >> 287 * @implSpec >> 288 * Processes returned from ProcessBuilder support this operation to >> 289 * return true or false depending on the platform implementation. >> 290 * >> 291 * @return {@code true} if the implementation of {@link #destroy} is to >> 292 * normally terminate the process; >> 293 * otherwise, {@link #destroy} forcibly terminates the process >> 294 * @throws UnsupportedOperationException if the Process implementation >> 295 * does not support this operation >> 296 * @since 1.9 >> 297 */ >> 298 public boolean supportsNormalTermination() { >> 299 throw new UnsupportedOperationException("supportsNormalTermination not supported for " + this.getClass().toString()); >> 300 } >> >> >> The docs of Process.onExit might also require some tweaks. I dunno how much wiggle room there is with the current implementation, perhaps very little? >> >> >> 415 /** >> 416 * Returns a ProcessHandle for the Process. >> 417 * >> 418 * @implSpec >> 419 * This implementation throws an instance of UnsupportedOperationException >> 420 * and performs no other action. >> ... >> 446 * @implSpec >> 447 * The implementation of this method returns information about the process as: >> 448 * {@link #toHandle toHandle().info()}. >> >> Best to be consistent with either "This implementation ..." or "The implementation of this method ..." rather than a mix. I prefer the former as it is more concise. Up to you. >> >> >>> Some @implNotes describe the JDK implementation and some developers will >>> rely on the implementation specifics and to some degree define the expected behaviors. >> One way of thinking about this is that the developers writing the TCK tests will pay close attention to @implSpec and need not do so for @implNote. >> >> >>>> >>>> The document for Process.getPid (and similarly those methods depending on toHandle) could then be: >>>> >>>> ... >>>> @implSpec >>>> This implementation returns a process id as follows: >>>> >>>> toHandle().getPid(); >>>> >>>> >>>> In this respect is there a need to say anything about the behaviour of a Process created by ProcessBuilder? >>> The ProcessBuilder produced subclasses of Process implement the spec >>> so no additional description is needed. >>>> It might be useful to have some general guidance for sub-types on the class doc of Process e.g. saying they only need to override toHandle but may override some or all dependent methods as appropriate. >>> It does not add much but I added a paragraph to the Process class javadoc. >>> There are not many subclasses of Process outside the JDK. >>> >> Ok. >> >> Paul. >> >>> The webrev[1] and javadoc[2] have been updated in place. >>> >>> Thanks, Roger >>> >>> [1] http://cr.openjdk.java.net/~rriggs/webrev-ph >>> [2] http://cr.openjdk.java.net/~rriggs/ph-apidraft/ > From Roger.Riggs at Oracle.com Mon Apr 20 18:42:01 2015 From: Roger.Riggs at Oracle.com (Roger Riggs) Date: Mon, 20 Apr 2015 14:42:01 -0400 Subject: RFR 9: 8077350 Process API Updates Implementation Review (Due 4/23) In-Reply-To: References: <5526DA4A.6030808@Oracle.com> <55296E19.3040204@Oracle.com> <5530BECF.60903@gmail.com> <55313A6F.4070208@Oracle.com> <55315476.60908@redhat.com> <553157A4.4030005@Oracle.com> <55315B2C.8060606@Oracle.com> <48F09E53-DF02-4FFA-850F-47F8A1E5EA3F@oracle.com> <55352017.9050903@Oracle.com> <55353878.2060204@Oracle.com> Message-ID: <55354879.1080005@Oracle.com> Hi Paul, On 4/20/2015 2:26 PM, Paul Sandoz wrote: > On Apr 20, 2015, at 7:33 PM, Roger Riggs wrote: > >> Hi Paul, >> >> There are statements in Process about the specified behavior of Processes >> created by ProcessBuilder. That's why I included them in the @implSpec clause. >> If @implSpec is only for the specifics of the method itself then where >> should the behavior of ProcessBuilder created instances be specified? >> > I think the @implNote you have on Process.onExit about Processes from ProcessBuilder being more efficient is fine, but that @implNote also appears to mix stuff that is @implSpec for the method itself. I don't see anything in that @implNote that is spec; just informative. > > For Process.supportsNormalTermination i would presume the @implSpec should be similar to that of toHandle. I don't think there needs to be anything said about Process from ProcessBuilder on this method this as it should "naturally" conform to what is stated. ok on the first part. But somewhere, it needs to state that ProcessBuilder created Processes are overloaded to return true/false; otherwise it would be assumed they also throw UOE. > > Perhaps you can state something in the class doc of Process and or ProcessBuilder about the behaviour of such Process instances? It would seem to flow from the general statement you added to Process about overriding. It may be more a question about consistency of where things are specified. The current spec for Process includes spec for ProcessBuilder created instances. Most developers will read Process (but not ProcessBuilder) to find the details. Only ProcessBuilder.start() says any specific about the created Process. I'll see what I make sense. Thanks, Roger > > Paul. > > >> Thanks, Roger >> >> >> >> On 4/20/2015 12:33 PM, Paul Sandoz wrote: >>> On Apr 20, 2015, at 5:49 PM, Roger Riggs wrote: >>> >>>> Hi Paul, >>>> >>>> On 4/20/2015 9:01 AM, Paul Sandoz wrote: >>>>> Hi Roger, >>>>> >>>>> I am not sure you have the @implSpec/@implNote quite correct on the new methods of Process. >>>>> >>>>> For example, for Process.toHandle i would expect something like: >>>>> >>>>> ... >>>>> >>>>> @implSpec >>>>> This implementation throws an instance of UnsupportedOperationException and >>>>> performs no other action. Sub-types should override this method, ensuring that >>>>> calling methods (getPid etc.) of this class, that are not overridden, operate on the >>>>> returned ProcessHandle. >>>>> >>>>> The @implSpec should refer to the implementation in Process itself, and the @implNote cannot be used for any normative statements. >>>> Thanks for the reminder and suggested text. I updated the @implSpec clauses. >>>> >>> I spotted another one here: >>> >>> 281 /** >>> 282 * Returns {@code true} if the implementation of {@link #destroy} is to >>> 283 * normally terminate the process, >>> 284 * Returns {@code false} if the implementation of {@code destroy} >>> 285 * forcibly and immediately terminates the process. >>> 286 * >>> 287 * @implSpec >>> 288 * Processes returned from ProcessBuilder support this operation to >>> 289 * return true or false depending on the platform implementation. >>> 290 * >>> 291 * @return {@code true} if the implementation of {@link #destroy} is to >>> 292 * normally terminate the process; >>> 293 * otherwise, {@link #destroy} forcibly terminates the process >>> 294 * @throws UnsupportedOperationException if the Process implementation >>> 295 * does not support this operation >>> 296 * @since 1.9 >>> 297 */ >>> 298 public boolean supportsNormalTermination() { >>> 299 throw new UnsupportedOperationException("supportsNormalTermination not supported for " + this.getClass().toString()); >>> 300 } >>> >>> >>> The docs of Process.onExit might also require some tweaks. I dunno how much wiggle room there is with the current implementation, perhaps very little? >>> >>> >>> 415 /** >>> 416 * Returns a ProcessHandle for the Process. >>> 417 * >>> 418 * @implSpec >>> 419 * This implementation throws an instance of UnsupportedOperationException >>> 420 * and performs no other action. >>> ... >>> 446 * @implSpec >>> 447 * The implementation of this method returns information about the process as: >>> 448 * {@link #toHandle toHandle().info()}. >>> >>> Best to be consistent with either "This implementation ..." or "The implementation of this method ..." rather than a mix. I prefer the former as it is more concise. Up to you. >>> >>> >>>> Some @implNotes describe the JDK implementation and some developers will >>>> rely on the implementation specifics and to some degree define the expected behaviors. >>> One way of thinking about this is that the developers writing the TCK tests will pay close attention to @implSpec and need not do so for @implNote. >>> >>> >>>>> The document for Process.getPid (and similarly those methods depending on toHandle) could then be: >>>>> >>>>> ... >>>>> @implSpec >>>>> This implementation returns a process id as follows: >>>>> >>>>> toHandle().getPid(); >>>>> >>>>> >>>>> In this respect is there a need to say anything about the behaviour of a Process created by ProcessBuilder? >>>> The ProcessBuilder produced subclasses of Process implement the spec >>>> so no additional description is needed. >>>>> It might be useful to have some general guidance for sub-types on the class doc of Process e.g. saying they only need to override toHandle but may override some or all dependent methods as appropriate. >>>> It does not add much but I added a paragraph to the Process class javadoc. >>>> There are not many subclasses of Process outside the JDK. >>>> >>> Ok. >>> >>> Paul. >>> >>>> The webrev[1] and javadoc[2] have been updated in place. >>>> >>>> Thanks, Roger >>>> >>>> [1] http://cr.openjdk.java.net/~rriggs/webrev-ph >>>> [2] http://cr.openjdk.java.net/~rriggs/ph-apidraft/ From lance.andersen at oracle.com Mon Apr 20 20:22:10 2015 From: lance.andersen at oracle.com (Lance Andersen) Date: Mon, 20 Apr 2015 16:22:10 -0400 Subject: RFR: 8073357: schema1.xsd has wrong content. Sequence of the enum values has been changed In-Reply-To: <55353EB0.7020407@oracle.com> References: <55353EB0.7020407@oracle.com> Message-ID: <20164241-BB66-4F2B-AE19-67BC434157D7@oracle.com> Hi Aleksej, The updates to the test seem reasonable. Best Lance On Apr 20, 2015, at 2:00 PM, Aleksej Efimov wrote: > Hello, > > The JDK9 schemagen tool hadn't preserved order of the enum values [1] and it was fixed in standalone project and was synced to JDK as part of JAXWS integration [2]. > Can I have a review for the 'test/javax/xml/ws/8046817/GenerateEnumSchema.java' test update [3] to include test case for this functionality. The test and the partial backport of [2] will be backported to JDK8. > The modified test shows no failures with JPRT on all platforms. > > With Best Regards, > Aleksej > > [1] JBS bug: https://bugs.openjdk.java.net/browse/JDK-8073357 > [2] JAXWS integration: https://bugs.openjdk.java.net/browse/JDK-8076549 > [3] Webrev: http://cr.openjdk.java.net/~aefimov/8073357/9/00/ Lance Andersen| Principal Member of Technical Staff | +1.781.442.2037 Oracle Java Engineering 1 Network Drive Burlington, MA 01803 Lance.Andersen at oracle.com From huizhe.wang at oracle.com Mon Apr 20 23:28:42 2015 From: huizhe.wang at oracle.com (huizhe wang) Date: Mon, 20 Apr 2015 16:28:42 -0700 Subject: RFR: 8073357: schema1.xsd has wrong content. Sequence of the enum values has been changed In-Reply-To: <20164241-BB66-4F2B-AE19-67BC434157D7@oracle.com> References: <55353EB0.7020407@oracle.com> <20164241-BB66-4F2B-AE19-67BC434157D7@oracle.com> Message-ID: <55358BAA.6020707@oracle.com> Hi Aleksej, You may also consider using a golden/expected output file to be compared with the output. It makes a test more readable (easily see what's expected), easier to maintain with a separated golden file than multiple literal strings in the test, and technically simpler logic (e.g. runSchemaGen and then compareResult) and without opening the output file multiple times. Regards, Joe On 4/20/2015 1:22 PM, Lance Andersen wrote: > Hi Aleksej, > > The updates to the test seem reasonable. > > Best > Lance > On Apr 20, 2015, at 2:00 PM, Aleksej Efimov wrote: > >> Hello, >> >> The JDK9 schemagen tool hadn't preserved order of the enum values [1] and it was fixed in standalone project and was synced to JDK as part of JAXWS integration [2]. >> Can I have a review for the 'test/javax/xml/ws/8046817/GenerateEnumSchema.java' test update [3] to include test case for this functionality. The test and the partial backport of [2] will be backported to JDK8. >> The modified test shows no failures with JPRT on all platforms. >> >> With Best Regards, >> Aleksej >> >> [1] JBS bug: https://bugs.openjdk.java.net/browse/JDK-8073357 >> [2] JAXWS integration: https://bugs.openjdk.java.net/browse/JDK-8076549 >> [3] Webrev: http://cr.openjdk.java.net/~aefimov/8073357/9/00/ > > > Lance Andersen| Principal Member of Technical Staff | +1.781.442.2037 > Oracle Java Engineering > 1 Network Drive > Burlington, MA 01803 > Lance.Andersen at oracle.com > > > From david.holmes at oracle.com Tue Apr 21 02:00:02 2015 From: david.holmes at oracle.com (David Holmes) Date: Tue, 21 Apr 2015 12:00:02 +1000 Subject: RFR JDK-8029689: (spec) Reader.read(char[], int, int) throws unspecified IndexOutOfBoundsException In-Reply-To: <55351A1F.3030206@oracle.com> References: <397916B4-BE8B-43F4-8380-366312EFED39@oracle.com> <83C8ED6F-B6C5-4231-97DA-02876435CE42@oracle.com> <55351A1F.3030206@oracle.com> Message-ID: <5535AF22.1090500@oracle.com> On 21/04/2015 1:24 AM, Chris Hegarty wrote: > > On 20/04/15 16:17, Lance Andersen wrote: >> Hi Pavel, >> >> So we are just documenting/clarifying the current behavior from what I >> can tell from the change? > > Looking at the testcase, it passes with the current JDK 9 ( and 8 ), so > this is just documenting existing behavior. Right. The assumption is that original authors overlooked the fact that the @exception/@throws for unchecked exceptions would not automatically be inherited by subclasses, and that in fact those subclasses (in this case) should indeed have inherited the same preconditions from the parent. David > > If so, this looks OK assuming you have an approved CCC? The test > seems fine. > > A CCC will be needed, and should be submitted after successful review. > >> I am assuming there should not be any issues here but would be good to >> hear from others on this change as well > > Right. We do this ( clarify spec from existing behavior) in other areas > too. > > Given that this is the current behavior of existing platform subtypes, > then this change is only specifying existing behavior. Since there are > no implementation changes, then Third party Reader subtypes will > continue to function as before, but they may need to be updated at some > point in the future. > > -Chris. > >> Best >> Lance >> On Apr 20, 2015, at 11:10 AM, Pavel Rappo wrote: >> >>> >>> Hi everyone, >>> >>> Could you please review my change for JDK-8029689 >>> >>> http://cr.openjdk.java.net/~prappo/8029689/webrev.00/ >>> >>> ------------------------------------------------------------------------------- >>> >>> There is a long-standing issue when platform implementations of >>> java.io.Reader >>> throw IndexOutOfBoundsException for bounds checks from inherited >>> java.io.Reader.read(char[], int, int) method though java.io.Reader >>> itself does >>> not specify this situation. >>> >>> Suggested solution is to update the contract of >>> java.io.Reader.read(char[], int, >>> int) and its publicly exported descendants to capture the implied >>> preconditions >>> for reading range and the array size. >>> >>> Given that throwing IOBE in this situation is a de facto standard, >>> this change >>> won't bring any kind of incompatibility, though to stay compliant 3rd >>> party >>> implementations may need to be updated. >>> >>> -Pavel >>> >> >> >> >> Lance Andersen| Principal Member of Technical Staff | +1.781.442.2037 >> Oracle Java Engineering >> 1 Network Drive >> Burlington, MA 01803 >> Lance.Andersen at oracle.com >> >> >> From chris.hegarty at oracle.com Tue Apr 21 08:08:36 2015 From: chris.hegarty at oracle.com (Chris Hegarty) Date: Tue, 21 Apr 2015 09:08:36 +0100 Subject: RFR JDK-8029689: (spec) Reader.read(char[], int, int) throws unspecified IndexOutOfBoundsException In-Reply-To: <5535AF22.1090500@oracle.com> References: <397916B4-BE8B-43F4-8380-366312EFED39@oracle.com> <83C8ED6F-B6C5-4231-97DA-02876435CE42@oracle.com> <55351A1F.3030206@oracle.com> <5535AF22.1090500@oracle.com> Message-ID: <82418788-57BC-48B1-A6B2-DB760AB9FE47@oracle.com> On 21 Apr 2015, at 03:00, David Holmes wrote: > On 21/04/2015 1:24 AM, Chris Hegarty wrote: >> >> On 20/04/15 16:17, Lance Andersen wrote: >>> Hi Pavel, >>> >>> So we are just documenting/clarifying the current behavior from what I >>> can tell from the change? >> >> Looking at the testcase, it passes with the current JDK 9 ( and 8 ), so >> this is just documenting existing behavior. > > Right. The assumption is that original authors overlooked the fact that the @exception/@throws for unchecked exceptions would not automatically be inherited by subclasses, and that in fact those subclasses (in this case) should indeed have inherited the same preconditions from the parent. All subclasses of java.io.Reader are documenting existing behaviour ( such documentation of uncheck exceptions was not the norm when these classes were originally written, but seems reasonable in this case ). But java.io.Reader.read(String,int,int) is abstract, and as such is having additional specification added ( which should be fine ). The only question is about third party implementations of Reader ( or other non Java SE implementations in the JDK), which may need to be amended to confirm to this ?new? bounds check. Again, I think this should be fine, and seems in line with the evolution policy of core libraries. -Chris. > David > >> > If so, this looks OK assuming you have an approved CCC? The test >> seems fine. >> >> A CCC will be needed, and should be submitted after successful review. >> >>> I am assuming there should not be any issues here but would be good to >>> hear from others on this change as well >> >> Right. We do this ( clarify spec from existing behavior) in other areas >> too. >> >> Given that this is the current behavior of existing platform subtypes, >> then this change is only specifying existing behavior. Since there are >> no implementation changes, then Third party Reader subtypes will >> continue to function as before, but they may need to be updated at some >> point in the future. >> >> -Chris. >> >>> Best >>> Lance >>> On Apr 20, 2015, at 11:10 AM, Pavel Rappo wrote: >>> >>>> >>>> Hi everyone, >>>> >>>> Could you please review my change for JDK-8029689 >>>> >>>> http://cr.openjdk.java.net/~prappo/8029689/webrev.00/ >>>> >>>> ------------------------------------------------------------------------------- >>>> >>>> There is a long-standing issue when platform implementations of >>>> java.io.Reader >>>> throw IndexOutOfBoundsException for bounds checks from inherited >>>> java.io.Reader.read(char[], int, int) method though java.io.Reader >>>> itself does >>>> not specify this situation. >>>> >>>> Suggested solution is to update the contract of >>>> java.io.Reader.read(char[], int, >>>> int) and its publicly exported descendants to capture the implied >>>> preconditions >>>> for reading range and the array size. >>>> >>>> Given that throwing IOBE in this situation is a de facto standard, >>>> this change >>>> won't bring any kind of incompatibility, though to stay compliant 3rd >>>> party >>>> implementations may need to be updated. >>>> >>>> -Pavel >>>> >>> >>> >>> >>> Lance Andersen| Principal Member of Technical Staff | +1.781.442.2037 >>> Oracle Java Engineering >>> 1 Network Drive >>> Burlington, MA 01803 >>> Lance.Andersen at oracle.com >>> >>> >>> From michael.x.mcmahon at oracle.com Tue Apr 21 09:58:33 2015 From: michael.x.mcmahon at oracle.com (Michael McMahon) Date: Tue, 21 Apr 2015 10:58:33 +0100 Subject: RFR(xs): 6991580: IPv6 Nameservers in resolv.conf throws NumberFormatException In-Reply-To: <1429551140.3444.39.camel@redhat.com> References: <1429531333.3444.14.camel@redhat.com> <1429532086.3444.15.camel@redhat.com> <692561968.2911058.1429547064809.JavaMail.zimbra@redhat.com> <1429551140.3444.39.camel@redhat.com> Message-ID: <55361F49.4050700@oracle.com> On 20/04/15 18:32, Severin Gehwolf wrote: > On Mon, 2015-04-20 at 12:24 -0400, Andrew Hughes wrote: >> ----- Original Message ----- >>> Adding in net-dev. >>> >>> On Mon, 2015-04-20 at 14:02 +0200, Severin Gehwolf wrote: >>>> Hi, >>>> >>>> Could I please get a review and a sponsor for the following patch? >>>> >>>> The issue is that JDK's internal /etc/resolv.conf nameserver parsing >>>> does not properly account for IPv6 addresses on Linux/Unix. While the >>>> code in com.sun.jndi.dns.DnsClient seems to support IPv6 addresses >>>> passed in via the servers list in the constructor it expects IPv6 >>>> addresses to be wrapped in '[' and ']' respectively. However, >>>> sun.net.dns.ResolverConfigurationImpl does no wrapping of IPv6 addresses >>>> when parsing "nameserver" keywords from /etc/resolv.conf, thus breaking >>>> DnsClient's contract. >>>> >>>> The fix is to properly wrap IPv6 literal addresses in '[' and ']' if not >>>> already wrapped. >>>> >>>> Bug: https://bugs.openjdk.java.net/browse/JDK-6991580 >>>> Webrev: >>>> http://cr.openjdk.java.net/~sgehwolf/webrevs/JDK-6991580/webrev.01/ >>>> >>>> Testing done: Added regression test fails for unpatched 9 and passes for >>>> patched 9. >>>> >>>> Thanks, >>>> Severin >>>> >>> >>> >>> >> It'd be better to provide public nameservers in the test comment so everyone >> is able to run this test if they update /etc/resolv.conf appropriately. > OK fixed: > http://cr.openjdk.java.net/~sgehwolf/webrevs/JDK-6991580/webrev.02/ > > FWIW, I don't think the test needs IP addresses of DNS servers to be > functional, though. All it really does is passing it to > InetAddress.getByName(). Prior this patch DnsClient fails to parse the > IP literals. That's true, but no harm having a public IP address there anyway. I can sponsor this change for you. - Michael >> Google provides some: https://developers.google.com/speed/public-dns/docs/using >> >> $ host redhat.com 2001:4860:4860::8888 >> Using domain server: >> Name: 2001:4860:4860::8888 >> Address: 2001:4860:4860::8888#53 >> Aliases: >> >> redhat.com has address 209.132.183.105 > On my F21 machine: > $ host redhat.com 2001:4860:4860::8888 > ;; connection timed out; no servers could be reached > > But the test still works with a patched JDK: > [...] > DEBUG: 'nameserver = 127.0.0.1' > DEBUG: 'nameserver = [2001:4860:4860::8888]' > DEBUG: ==> Found IPv6 address in servers list: [2001:4860:4860::8888] > DEBUG: 'nameserver = [::1]:5353' > DEBUG: ==> Found IPv6 address in servers list: [::1]:5353 > DEBUG: 'nameserver = 127.0.0.1:5353' > PASS: Found IPv6 address and DnsClient parsed it correctly. > > Contrast this to unpatched: > [...] > DEBUG: 'nameserver = 127.0.0.1' > DEBUG: 'nameserver = 2001:4860:4860::8888' > DEBUG: ==> Found IPv6 address in servers list: 2001:4860:4860::8888 > DEBUG: 'nameserver = [::1]:5353' > DEBUG: ==> Found IPv6 address in servers list: [::1]:5353 > DEBUG: 'nameserver = 127.0.0.1:5353' > Exception in thread "main" java.lang.RuntimeException: FAIL: Tried to parse non-[]-encapsulated IPv6 address. > at IPv6NameserverPlatformParsingTest.main(IPv6NameserverPlatformParsingTest.java:59) > Caused by: java.lang.NumberFormatException: For input string: "4860:4860::8888" > at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65) > at java.lang.Integer.parseInt(Integer.java:580) > at java.lang.Integer.parseInt(Integer.java:615) > at com.sun.jndi.dns.DnsClient.(DnsClient.java:127) > at IPv6NameserverPlatformParsingTest.main(IPv6NameserverPlatformParsingTest.java:57) > > Cheers, > Severin > From aleksej.efimov at oracle.com Tue Apr 21 12:14:57 2015 From: aleksej.efimov at oracle.com (Aleksej Efimov) Date: Tue, 21 Apr 2015 15:14:57 +0300 Subject: RFR: 8073357: schema1.xsd has wrong content. Sequence of the enum values has been changed In-Reply-To: <55358BAA.6020707@oracle.com> References: <55353EB0.7020407@oracle.com> <20164241-BB66-4F2B-AE19-67BC434157D7@oracle.com> <55358BAA.6020707@oracle.com> Message-ID: <55363F41.5080803@oracle.com> Hi Joe, Thank you for you comments - I have modified the test [1] to avoid multiple file open operations - now the test reads the file content one time after each call to schemagen tool. Golden/expected output is a good suggestion, but we'll depend here on a format of generated schema file - it can be changed in future. So, I better check only for a test specific parts of the generated schema file. With Best Regards, Aleksej [1] http://cr.openjdk.java.net/~aefimov/8073357/9/01/ On 04/21/2015 02:28 AM, huizhe wang wrote: > Hi Aleksej, > > You may also consider using a golden/expected output file to be > compared with the output. It makes a test more readable (easily see > what's expected), easier to maintain with a separated golden file than > multiple literal strings in the test, and technically simpler logic > (e.g. runSchemaGen and then compareResult) and without opening the > output file multiple times. > > Regards, > Joe > > On 4/20/2015 1:22 PM, Lance Andersen wrote: >> Hi Aleksej, >> >> The updates to the test seem reasonable. >> >> Best >> Lance >> On Apr 20, 2015, at 2:00 PM, Aleksej Efimov >> wrote: >> >>> Hello, >>> >>> The JDK9 schemagen tool hadn't preserved order of the enum values >>> [1] and it was fixed in standalone project and was synced to JDK as >>> part of JAXWS integration [2]. >>> Can I have a review for the >>> 'test/javax/xml/ws/8046817/GenerateEnumSchema.java' test update [3] >>> to include test case for this functionality. The test and the >>> partial backport of [2] will be backported to JDK8. >>> The modified test shows no failures with JPRT on all platforms. >>> >>> With Best Regards, >>> Aleksej >>> >>> [1] JBS bug: https://bugs.openjdk.java.net/browse/JDK-8073357 >>> [2] JAXWS integration: https://bugs.openjdk.java.net/browse/JDK-8076549 >>> [3] Webrev: http://cr.openjdk.java.net/~aefimov/8073357/9/00/ >> >> >> Lance Andersen| Principal Member of Technical Staff | +1.781.442.2037 >> Oracle Java Engineering >> 1 Network Drive >> Burlington, MA 01803 >> Lance.Andersen at oracle.com >> >> >> > From paul.sandoz at oracle.com Tue Apr 21 12:29:54 2015 From: paul.sandoz at oracle.com (Paul Sandoz) Date: Tue, 21 Apr 2015 14:29:54 +0200 Subject: RFR 9: 8077350 Process API Updates Implementation Review (Due 4/23) In-Reply-To: <55354879.1080005@Oracle.com> References: <5526DA4A.6030808@Oracle.com> <55296E19.3040204@Oracle.com> <5530BECF.60903@gmail.com> <55313A6F.4070208@Oracle.com> <55315476.60908@redhat.com> <553157A4.4030005@Oracle.com> <55315B2C.8060606@Oracle.com> <48F09E53-DF02-4FFA-850F-47F8A1E5EA3F@oracle.com> <55352017.9050903@Oracle.com> <55353878.2060204@Oracle.com> <55354879.1080005@Oracle.com> Message-ID: <0552E055-9638-4C17-B269-F6C9A020A7BF@oracle.com> On Apr 20, 2015, at 8:42 PM, Roger Riggs wrote: > Hi Paul, > > On 4/20/2015 2:26 PM, Paul Sandoz wrote: >> On Apr 20, 2015, at 7:33 PM, Roger Riggs wrote: >> >>> Hi Paul, >>> >>> There are statements in Process about the specified behavior of Processes >>> created by ProcessBuilder. That's why I included them in the @implSpec clause. >>> If @implSpec is only for the specifics of the method itself then where >>> should the behavior of ProcessBuilder created instances be specified? >>> >> I think the @implNote you have on Process.onExit about Processes from ProcessBuilder being more efficient is fine, but that @implNote also appears to mix stuff that is @implSpec for the method itself. > I don't see anything in that @implNote that is spec; just informative. Process.onExit triggering waitFor to be called asynchronously in another thread seems more spec-like to me (without defining what the executor of the CF is, but we can probably specify what it is not i.e. the CF should be executed on the f/j common pool). How could it be otherwise? Paul. From Roger.Riggs at Oracle.com Tue Apr 21 12:57:38 2015 From: Roger.Riggs at Oracle.com (Roger Riggs) Date: Tue, 21 Apr 2015 08:57:38 -0400 Subject: RFR 9: 8077350 Process API Updates Implementation Review (Due 4/23) In-Reply-To: <0552E055-9638-4C17-B269-F6C9A020A7BF@oracle.com> References: <5526DA4A.6030808@Oracle.com> <55296E19.3040204@Oracle.com> <5530BECF.60903@gmail.com> <55313A6F.4070208@Oracle.com> <55315476.60908@redhat.com> <553157A4.4030005@Oracle.com> <55315B2C.8060606@Oracle.com> <48F09E53-DF02-4FFA-850F-47F8A1E5EA3F@oracle.com> <55352017.9050903@Oracle.com> <55353878.2060204@Oracle.com> <55354879.1080005@Oracle.com> <0552E055-9638-4C17-B269-F6C9A020A7BF@oracle.com> Message-ID: <55364942.5080609@Oracle.com> Hi Paul, On 4/21/2015 8:29 AM, Paul Sandoz wrote: > There are statements in Process about the specified behavior of > Processes created by ProcessBuilder. That's why I included them in the > @implSpec clause. If @implSpec is only for the specifics of the method > itself then where should the behavior of ProcessBuilder created > instances be specified? >>> I think the @implNote you have on Process.onExit about Processes from ProcessBuilder being more efficient is fine, but that @implNote also appears to mix stuff that is @implSpec for the method itself. >> I don't see anything in that @implNote that is spec; just informative. > Process.onExit triggering waitFor to be called asynchronously in another thread seems more spec-like to me (without defining what the executor of the CF is, but we can probably specify what it is not i.e. the CF should be executed on the f/j common pool). How could it be otherwise? The ForkJoinPool is particularly unsuitable for onExit. It has a limited number of threads and pretty much assumes that threads do not block indefinitely. But for this use they block until the process exits. In my testing, the set of threads gets consumed by the first set of onExit calls and then hangs because no more threads are available. The current implementation creates it own pool and spawn threads as needed, but that's an implementation detail. I think the most can be said is that onExit does not block. There's no point in over specifying the default implementation of onExit. Practically, it does not get used because the JDK provided subclasses have use a lighter weight mechanism to wait for process exit and in time other mechanisms that do not consume a thread are likely. Thanks, Roger From vincent.x.ryan at oracle.com Tue Apr 21 13:07:57 2015 From: vincent.x.ryan at oracle.com (Vincent Ryan) Date: Tue, 21 Apr 2015 14:07:57 +0100 Subject: RFR (XS) 8074761: Empty optional parameters of LDAP query are not interpreted as empty In-Reply-To: <2030536.zvpBUlpsvY@thinkpad> References: <2031750.BZlfoUzYlO@thinkpad> <2030536.zvpBUlpsvY@thinkpad> Message-ID: <39F0DC02-9CA9-4B7E-9353-A5D86B5E63FC@oracle.com> Your fix looks good to me. Thanks for contributing the patch. > On 25 Mar 2015, at 14:47, Stanislav Baiduzhyi wrote: > > On Tuesday 10 March 2015 17:18:06 Stanislav Baiduzhyi wrote: >> Hi All, >> >> Please review the patch for LdapURL. Patch fixes the parsing of query part >> of LDAP URL, leaving empty optional fields as null instead of "". >> >> Webrev: >> http://goo.gl/OO0V38 >> >> Bug: >> https://bugs.openjdk.java.net/browse/JDK-8074761 >> >> JTreg: >> http://goo.gl/ermmoh >> >> Details: >> >> RFC 2255 [1] allows any of the query parameters to be empty. Current >> implementation of parsing method extracts substring without checking for >> length, leaving empty fields as "" instead of null. But the code under >> com.sun.jndi.ldap package checks only for null when handling optional >> fields. So the patch modifies the parsing method to avoid substring >> operations on empty fields and leaving them as null instead. >> >> In proposed patch, I was not able to generalize the code, so using similar >> code blocks to make it obvious if additional changes will be required later. >> >> It would be even better to use java.util.Optional for this, but it will be >> compatibility-breaking change, I'm not sure it worth doing even under >> com.sun.* packages. >> >> There is wider test case in RedHat Bugzilla [2], includes OpenDS setup and >> small client app, shows the difference in results between openldap-clients >> with Java-based implementation. Proposed patch fixes the java client >> behaviour. >> >> [1]: https://tools.ietf.org/html/rfc2255#section-3 >> [2]: https://bugzilla.redhat.com/show_bug.cgi?id=1194226 > > A small reminder, please review the webrev quoted above, the patch is > extremely small, and passes the TCK. > > -- > Regards, > Stas > From paul.sandoz at oracle.com Tue Apr 21 13:16:56 2015 From: paul.sandoz at oracle.com (Paul Sandoz) Date: Tue, 21 Apr 2015 15:16:56 +0200 Subject: RFR 9: 8077350 Process API Updates Implementation Review (Due 4/23) In-Reply-To: <55364942.5080609@Oracle.com> References: <5526DA4A.6030808@Oracle.com> <55296E19.3040204@Oracle.com> <5530BECF.60903@gmail.com> <55313A6F.4070208@Oracle.com> <55315476.60908@redhat.com> <553157A4.4030005@Oracle.com> <55315B2C.8060606@Oracle.com> <48F09E53-DF02-4FFA-850F-47F8A1E5EA3F@oracle.com> <55352017.9050903@Oracle.com> <55353878.2060204@Oracle.com> <55354879.1080005@Oracle.com> <0552E055-9638-4C17-B269-F6C9A020A7BF@oracle.com> <55364942.5080609@Oracle.com> Message-ID: <3085423E-1D33-4D12-BAE9-A063D259C4ED@oracle.com> On Apr 21, 2015, at 2:57 PM, Roger Riggs wrote: > Hi Paul, > > On 4/21/2015 8:29 AM, Paul Sandoz wrote: >> There are statements in Process about the specified behavior of Processes created by ProcessBuilder. That's why I included them in the @implSpec clause. If @implSpec is only for the specifics of the method itself then where should the behavior of ProcessBuilder created instances be specified? >>>> I think the @implNote you have on Process.onExit about Processes from ProcessBuilder being more efficient is fine, but that @implNote also appears to mix stuff that is @implSpec for the method itself. >>> I don't see anything in that @implNote that is spec; just informative. >> Process.onExit triggering waitFor to be called asynchronously in another thread seems more spec-like to me (without defining what the executor of the CF is, but we can probably specify what it is not i.e. the CF should be executed on the f/j common pool). Sorry, I meant to say "i.e. the CF should *not* be ...". >> How could it be otherwise? > The ForkJoinPool is particularly unsuitable for onExit. It has a limited number of threads > and pretty much assumes that threads do not block indefinitely. Yes. Even if a managed blocker is used with waitFor + timeouts i would advise against using the F/J common pool. > But for this use they block > until the process exits. In my testing, the set of threads gets consumed by the first set of > onExit calls and then hangs because no more threads are available. > The current implementation creates it own pool and spawn threads as needed, but that's an implementation detail. > I think the most can be said is that onExit does not block. There's no point in over specifying > the default implementation of onExit. I am not suggesting over specifying, but currently it feels under specified by not specifying anything :-) Given that is only so much the Process class impl can do regardless of the JDK vendor it seems we could specify something so sub-types can be better informed about whether they should override or not. Paul. > Practically, it does not get used because the JDK > provided subclasses have use a lighter weight mechanism to wait for process exit and in time > other mechanisms that do not consume a thread are likely. > > Thanks, Roger > From Alan.Bateman at oracle.com Tue Apr 21 13:56:14 2015 From: Alan.Bateman at oracle.com (Alan Bateman) Date: Tue, 21 Apr 2015 14:56:14 +0100 Subject: RFR(xs): 6991580: IPv6 Nameservers in resolv.conf throws NumberFormatException In-Reply-To: <1429551140.3444.39.camel@redhat.com> References: <1429531333.3444.14.camel@redhat.com> <1429532086.3444.15.camel@redhat.com> <692561968.2911058.1429547064809.JavaMail.zimbra@redhat.com> <1429551140.3444.39.camel@redhat.com> Message-ID: <553656FE.9000802@oracle.com> On 20/04/2015 18:32, Severin Gehwolf wrote: > : > OK fixed: > http://cr.openjdk.java.net/~sgehwolf/webrevs/JDK-6991580/webrev.02/ > > FWIW, I don't think the test needs IP addresses of DNS servers to be > functional, though. All it really does is passing it to > InetAddress.getByName(). Prior this patch DnsClient fails to parse the > IP literals. > Can the test be moved to jdk/test/com/sun/jndi/dns as that seems to be where the other tests are? Also I assume this will need a copyright header before it is pushed. -Alan From michael.x.mcmahon at oracle.com Tue Apr 21 15:04:04 2015 From: michael.x.mcmahon at oracle.com (Michael McMahon) Date: Tue, 21 Apr 2015 16:04:04 +0100 Subject: RFR(xs): 6991580: IPv6 Nameservers in resolv.conf throws NumberFormatException In-Reply-To: <553656FE.9000802@oracle.com> References: <1429531333.3444.14.camel@redhat.com> <1429532086.3444.15.camel@redhat.com> <692561968.2911058.1429547064809.JavaMail.zimbra@redhat.com> <1429551140.3444.39.camel@redhat.com> <553656FE.9000802@oracle.com> Message-ID: <553666E4.8030908@oracle.com> On 21/04/15 14:56, Alan Bateman wrote: > > On 20/04/2015 18:32, Severin Gehwolf wrote: >> : >> OK fixed: >> http://cr.openjdk.java.net/~sgehwolf/webrevs/JDK-6991580/webrev.02/ >> >> FWIW, I don't think the test needs IP addresses of DNS servers to be >> functional, though. All it really does is passing it to >> InetAddress.getByName(). Prior this patch DnsClient fails to parse the >> IP literals. >> > Can the test be moved to jdk/test/com/sun/jndi/dns as that seems to be > where the other tests are? Also I assume this will need a copyright > header before it is pushed. > > -Alan I had pushed it already. So, I'll fix it in this webrev http://cr.openjdk.java.net/~michaelm/8078276/webrev.1/ Thanks, Michael From Roger.Riggs at Oracle.com Tue Apr 21 15:06:55 2015 From: Roger.Riggs at Oracle.com (Roger Riggs) Date: Tue, 21 Apr 2015 11:06:55 -0400 Subject: RFR(xs): 6991580: IPv6 Nameservers in resolv.conf throws NumberFormatException In-Reply-To: <553666E4.8030908@oracle.com> References: <1429531333.3444.14.camel@redhat.com> <1429532086.3444.15.camel@redhat.com> <692561968.2911058.1429547064809.JavaMail.zimbra@redhat.com> <1429551140.3444.39.camel@redhat.com> <553656FE.9000802@oracle.com> <553666E4.8030908@oracle.com> Message-ID: <5536678F.4050903@Oracle.com> +1 On 4/21/2015 11:04 AM, Michael McMahon wrote: > On 21/04/15 14:56, Alan Bateman wrote: >> >> On 20/04/2015 18:32, Severin Gehwolf wrote: >>> : >>> OK fixed: >>> http://cr.openjdk.java.net/~sgehwolf/webrevs/JDK-6991580/webrev.02/ >>> >>> FWIW, I don't think the test needs IP addresses of DNS servers to be >>> functional, though. All it really does is passing it to >>> InetAddress.getByName(). Prior this patch DnsClient fails to parse the >>> IP literals. >>> >> Can the test be moved to jdk/test/com/sun/jndi/dns as that seems to >> be where the other tests are? Also I assume this will need a >> copyright header before it is pushed. >> >> -Alan > > I had pushed it already. So, I'll fix it in this webrev > > http://cr.openjdk.java.net/~michaelm/8078276/webrev.1/ > > Thanks, > Michael From Alan.Bateman at oracle.com Tue Apr 21 15:09:30 2015 From: Alan.Bateman at oracle.com (Alan Bateman) Date: Tue, 21 Apr 2015 16:09:30 +0100 Subject: RFR(xs): 6991580: IPv6 Nameservers in resolv.conf throws NumberFormatException In-Reply-To: <553666E4.8030908@oracle.com> References: <1429531333.3444.14.camel@redhat.com> <1429532086.3444.15.camel@redhat.com> <692561968.2911058.1429547064809.JavaMail.zimbra@redhat.com> <1429551140.3444.39.camel@redhat.com> <553656FE.9000802@oracle.com> <553666E4.8030908@oracle.com> Message-ID: <5536682A.6070900@oracle.com> On 21/04/2015 16:04, Michael McMahon wrote: > On 21/04/15 14:56, Alan Bateman wrote: >> : >>> >> Can the test be moved to jdk/test/com/sun/jndi/dns as that seems to >> be where the other tests are? Also I assume this will need a >> copyright header before it is pushed. >> >> -Alan > > I had pushed it already. So, I'll fix it in this webrev > > http://cr.openjdk.java.net/~michaelm/8078276/webrev.1/ Thanks. -Alan. From Roger.Riggs at Oracle.com Tue Apr 21 15:20:15 2015 From: Roger.Riggs at Oracle.com (Roger Riggs) Date: Tue, 21 Apr 2015 11:20:15 -0400 Subject: RFR 9: 8077350 Process API Updates Implementation Review (Due 4/23) In-Reply-To: <3085423E-1D33-4D12-BAE9-A063D259C4ED@oracle.com> References: <5526DA4A.6030808@Oracle.com> <55296E19.3040204@Oracle.com> <5530BECF.60903@gmail.com> <55313A6F.4070208@Oracle.com> <55315476.60908@redhat.com> <553157A4.4030005@Oracle.com> <55315B2C.8060606@Oracle.com> <48F09E53-DF02-4FFA-850F-47F8A1E5EA3F@oracle.com> <55352017.9050903@Oracle.com> <55353878.2060204@Oracle.com> <55354879.1080005@Oracle.com> <0552E055-9638-4C17-B269-F6C9A020A7BF@oracle.com> <55364942.5080609@Oracle.com> <3085423E-1D33-4D12-BAE9-A063D259C4ED@oracle.com> Message-ID: <55366AAF.9090500@Oracle.com> Hi Paul, The onExit() @implNote recommends the subclass delegate to the underlying process. For a simple subclass acting as a proxy or decorator that will provide the best implementation. I'll add the onExit() method to the class level recommendation for Subclasses of Process. Thanks, Roger. On 4/21/2015 9:16 AM, Paul Sandoz wrote: > On Apr 21, 2015, at 2:57 PM, Roger Riggs wrote: > >> Hi Paul, >> >> On 4/21/2015 8:29 AM, Paul Sandoz wrote: >>> There are statements in Process about the specified behavior of Processes created by ProcessBuilder. That's why I included them in the @implSpec clause. If @implSpec is only for the specifics of the method itself then where should the behavior of ProcessBuilder created instances be specified? >>>>> I think the @implNote you have on Process.onExit about Processes from ProcessBuilder being more efficient is fine, but that @implNote also appears to mix stuff that is @implSpec for the method itself. >>>> I don't see anything in that @implNote that is spec; just informative. >>> Process.onExit triggering waitFor to be called asynchronously in another thread seems more spec-like to me (without defining what the executor of the CF is, but we can probably specify what it is not i.e. the CF should be executed on the f/j common pool). > Sorry, I meant to say "i.e. the CF should *not* be ...". > ... > I am not suggesting over specifying, but currently it feels under specified by not specifying anything :-) Given that is only so much the Process class impl can do regardless of the JDK vendor it seems we could specify something so sub-types can be better informed about whether they should override or not. > > Paul. > From thomas.stuefe at gmail.com Tue Apr 21 15:49:02 2015 From: thomas.stuefe at gmail.com (=?UTF-8?Q?Thomas_St=C3=BCfe?=) Date: Tue, 21 Apr 2015 17:49:02 +0200 Subject: RFR 9: 8077350 Process API Updates Implementation Review (Due 4/23) In-Reply-To: <55315B2C.8060606@Oracle.com> References: <5526DA4A.6030808@Oracle.com> <55296E19.3040204@Oracle.com> <5530BECF.60903@gmail.com> <55313A6F.4070208@Oracle.com> <55315476.60908@redhat.com> <553157A4.4030005@Oracle.com> <55315B2C.8060606@Oracle.com> Message-ID: Hi Roger, small remark, I see you at a number of places using the same pattern when reading information from /proc: 342 ret = fread(&psinfo, 1, (sizeof psinfo), fp); 343 fclose(fp); 344 if (ret < 0) { 345 return; 346 } A better way would be to check for the whole size you intended to read: 342 ret = fread(&psinfo, 1, (sizeof psinfo), fp); 343 fclose(fp); 344 if (ret < sizeof(psinfo)) { 345 return; 346 } /proc may get stale while you read it, so make sure fread actually filled the whole output structure, otherwise you may act on partially random memory content. This is not theoretical :) I had exactly this problem on Solaris when reading structures (in our cases /proc/self/lstatus) from /proc. Kind Regards, Thomas On Fri, Apr 17, 2015 at 9:12 PM, Roger Riggs wrote: > The webrev for ProcessAPI updates has been updated to reflect recent > comments. > Please review and comment by April 23rd. > > The updates include: > - Renaming Process/ProcessHandle supportsDestroyForcibly to > supportsNormalTermination > and updating related descriptions > - ProcessHandle.destroy/destroyForcible descriptions have more consistent > descriptions > - ProcessHandle.destroy now returns ProcessHandle to enable fluent use. > - Corrected description of default implementation ProcessHandle.onExit > > The API doc: http://cr.openjdk.java.net/~rriggs/ph-apidraft/ > > The webrev: http://cr.openjdk.java.net/~rriggs/webrev-ph > > Issue: JDK-8077350 > Process API Updates Implementation > > The code is in the jdk9 sandbox on branch JDK-8046092-branch. > > Two issues raised have been filed to be fixed after the current commit: > - JDK-8078099 > (process) ProcessHandle should uniquely identify processes > - JDK-8078108 > (process) ProcessHandle.isAlive should be robust > From paul.sandoz at oracle.com Tue Apr 21 15:49:37 2015 From: paul.sandoz at oracle.com (Paul Sandoz) Date: Tue, 21 Apr 2015 17:49:37 +0200 Subject: RFR 9: 8077350 Process API Updates Implementation Review (Due 4/23) In-Reply-To: <55366AAF.9090500@Oracle.com> References: <5526DA4A.6030808@Oracle.com> <55296E19.3040204@Oracle.com> <5530BECF.60903@gmail.com> <55313A6F.4070208@Oracle.com> <55315476.60908@redhat.com> <553157A4.4030005@Oracle.com> <55315B2C.8060606@Oracle.com> <48F09E53-DF02-4FFA-850F-47F8A1E5EA3F@oracle.com> <55352017.9050903@Oracle.com> <55353878.2060204@Oracle.com> <55354879.1080005@Oracle.com> <0552E055-9638-4C17-B269-F6C9A020A7BF@oracle.com> <55364942.5080609@Oracle.com> <3085423E-1D33-4D12-BAE9-A063D259C4ED@oracle.com> <55366AAF.9090500@Oracle.com> Message-ID: <6CD2297F-C102-42B9-BEC7-6DEF175FF0C0@oracle.com> On Apr 21, 2015, at 5:20 PM, Roger Riggs wrote: > Hi Paul, > > The onExit() @implNote recommends the subclass delegate to the underlying process. I know, but is that recommendation just for our (Oracle's) JDK? Is it subject to change? What if another JDK vendor decides to have a different @implNote without such a recommendation? Sorry to keep labouring the point but i still think you need to have some form of impl spec for this method. Paul. > For a simple subclass acting as a proxy or decorator that will provide the best implementation. > > I'll add the onExit() method to the class level recommendation for Subclasses of Process. > > Thanks, Roger. From Roger.Riggs at Oracle.com Tue Apr 21 15:57:48 2015 From: Roger.Riggs at Oracle.com (Roger Riggs) Date: Tue, 21 Apr 2015 11:57:48 -0400 Subject: RFR 9: 8077350 Process API Updates Implementation Review (Due 4/23) In-Reply-To: References: <5526DA4A.6030808@Oracle.com> <55296E19.3040204@Oracle.com> <5530BECF.60903@gmail.com> <55313A6F.4070208@Oracle.com> <55315476.60908@redhat.com> <553157A4.4030005@Oracle.com> <55315B2C.8060606@Oracle.com> Message-ID: <5536737C.4070806@Oracle.com> Hi Thomas, Good point and more robust. Thanks, Roger On 4/21/2015 11:49 AM, Thomas St?fe wrote: > Hi Roger, > > small remark, I see you at a number of places using the same pattern > when reading information from /proc: > > 342 ret = fread(&psinfo, 1, (sizeof psinfo), fp); > 343 fclose(fp); > 344 if (ret < 0) { > 345 return; > 346 } > > A better way would be to check for the whole size you intended to read: > > 342 ret = fread(&psinfo, 1, (sizeof psinfo), fp); > 343 fclose(fp); > 344 if (ret < sizeof(psinfo)) { > 345 return; > 346 } > > /proc may get stale while you read it, so make sure fread actually > filled the whole output structure, otherwise you may act on partially > random memory content. This is not theoretical :) I had exactly this > problem on Solaris when reading structures (in our cases > /proc/self/lstatus) from /proc. > > Kind Regards, Thomas > > > > > > On Fri, Apr 17, 2015 at 9:12 PM, Roger Riggs > wrote: > > The webrev for ProcessAPI updates has been updated to reflect > recent comments. > Please review and comment by April 23rd. > > The updates include: > - Renaming Process/ProcessHandle supportsDestroyForcibly to > supportsNormalTermination > and updating related descriptions > - ProcessHandle.destroy/destroyForcible descriptions have more > consistent descriptions > - ProcessHandle.destroy now returns ProcessHandle to enable fluent > use. > - Corrected description of default implementation ProcessHandle.onExit > > The API doc: http://cr.openjdk.java.net/~rriggs/ph-apidraft/ > > > The webrev: http://cr.openjdk.java.net/~rriggs/webrev-ph > > > Issue: JDK-8077350 > Process API > Updates Implementation > > The code is in the jdk9 sandbox on branch JDK-8046092-branch. > > Two issues raised have been filed to be fixed after the current > commit: > - JDK-8078099 > (process) ProcessHandle should uniquely identify processes > - JDK-8078108 > (process) ProcessHandle.isAlive should be robust > > From huizhe.wang at oracle.com Tue Apr 21 16:32:43 2015 From: huizhe.wang at oracle.com (huizhe wang) Date: Tue, 21 Apr 2015 09:32:43 -0700 Subject: RFR: 8073357: schema1.xsd has wrong content. Sequence of the enum values has been changed In-Reply-To: <55363F41.5080803@oracle.com> References: <55353EB0.7020407@oracle.com> <20164241-BB66-4F2B-AE19-67BC434157D7@oracle.com> <55358BAA.6020707@oracle.com> <55363F41.5080803@oracle.com> Message-ID: <55367BAB.6030402@oracle.com> On 4/21/2015 5:14 AM, Aleksej Efimov wrote: > Hi Joe, > Thank you for you comments - I have modified the test [1] to avoid > multiple file open operations - now the test reads the file content > one time after each call to schemagen tool. Ok. > Golden/expected output is a good suggestion, but we'll depend here on > a format of generated schema file - it can be changed in future. So, I > better check only for a test specific parts of the generated schema file. First of all, the report was that "schema1.xsd has wrong content", which was why I was looking for schema1.xsd. The lib conforms to the schema specification, thus should be quite stable. XML tests for example, used golden files since 2005, never had issues with the format. I'm fine with your test. But it's something you may consider or talk to Miran. Our "golden" files actually helps catching issues. Best, Joe > > With Best Regards, > Aleksej > > [1] http://cr.openjdk.java.net/~aefimov/8073357/9/01/ > > On 04/21/2015 02:28 AM, huizhe wang wrote: >> Hi Aleksej, >> >> You may also consider using a golden/expected output file to be >> compared with the output. It makes a test more readable (easily see >> what's expected), easier to maintain with a separated golden file >> than multiple literal strings in the test, and technically simpler >> logic (e.g. runSchemaGen and then compareResult) and without opening >> the output file multiple times. >> >> Regards, >> Joe >> >> On 4/20/2015 1:22 PM, Lance Andersen wrote: >>> Hi Aleksej, >>> >>> The updates to the test seem reasonable. >>> >>> Best >>> Lance >>> On Apr 20, 2015, at 2:00 PM, Aleksej Efimov >>> wrote: >>> >>>> Hello, >>>> >>>> The JDK9 schemagen tool hadn't preserved order of the enum values >>>> [1] and it was fixed in standalone project and was synced to JDK as >>>> part of JAXWS integration [2]. >>>> Can I have a review for the >>>> 'test/javax/xml/ws/8046817/GenerateEnumSchema.java' test update [3] >>>> to include test case for this functionality. The test and the >>>> partial backport of [2] will be backported to JDK8. >>>> The modified test shows no failures with JPRT on all platforms. >>>> >>>> With Best Regards, >>>> Aleksej >>>> >>>> [1] JBS bug: https://bugs.openjdk.java.net/browse/JDK-8073357 >>>> [2] JAXWS integration: >>>> https://bugs.openjdk.java.net/browse/JDK-8076549 >>>> [3] Webrev: http://cr.openjdk.java.net/~aefimov/8073357/9/00/ >>> >>> >>> Lance Andersen| Principal Member of Technical Staff | +1.781.442.2037 >>> Oracle Java Engineering >>> 1 Network Drive >>> Burlington, MA 01803 >>> Lance.Andersen at oracle.com >>> >>> >>> >> > From huizhe.wang at oracle.com Tue Apr 21 16:36:52 2015 From: huizhe.wang at oracle.com (huizhe wang) Date: Tue, 21 Apr 2015 09:36:52 -0700 Subject: RFR: 8073357: schema1.xsd has wrong content. Sequence of the enum values has been changed In-Reply-To: <55363F41.5080803@oracle.com> References: <55353EB0.7020407@oracle.com> <20164241-BB66-4F2B-AE19-67BC434157D7@oracle.com> <55358BAA.6020707@oracle.com> <55363F41.5080803@oracle.com> Message-ID: <55367CA4.5040902@oracle.com> On 4/21/2015 5:14 AM, Aleksej Efimov wrote: > Hi Joe, > Thank you for you comments - I have modified the test [1] to avoid > multiple file open operations - now the test reads the file content > one time after each call to schemagen tool. Ok. > Golden/expected output is a good suggestion, but we'll depend here on > a format of generated schema file - it can be changed in future. So, I > better check only for a test specific parts of the generated schema file. The report was "schema1.xsd has wrong content", which was why I was looking for schema1.xsd. The lib conforms to the schema specification, shall therefore be quite stable. Our XML tests for example, used golden files created since 2005. They have not been a problem themselves, rather they are helpful in catching issues / regressions. I'm fine with your test. But it's something you may consider or talk to Miran. Best, Joe > > With Best Regards, > Aleksej > > [1] http://cr.openjdk.java.net/~aefimov/8073357/9/01/ > > On 04/21/2015 02:28 AM, huizhe wang wrote: >> Hi Aleksej, >> >> You may also consider using a golden/expected output file to be >> compared with the output. It makes a test more readable (easily see >> what's expected), easier to maintain with a separated golden file >> than multiple literal strings in the test, and technically simpler >> logic (e.g. runSchemaGen and then compareResult) and without opening >> the output file multiple times. >> >> Regards, >> Joe >> >> On 4/20/2015 1:22 PM, Lance Andersen wrote: >>> Hi Aleksej, >>> >>> The updates to the test seem reasonable. >>> >>> Best >>> Lance >>> On Apr 20, 2015, at 2:00 PM, Aleksej Efimov >>> wrote: >>> >>>> Hello, >>>> >>>> The JDK9 schemagen tool hadn't preserved order of the enum values >>>> [1] and it was fixed in standalone project and was synced to JDK as >>>> part of JAXWS integration [2]. >>>> Can I have a review for the >>>> 'test/javax/xml/ws/8046817/GenerateEnumSchema.java' test update [3] >>>> to include test case for this functionality. The test and the >>>> partial backport of [2] will be backported to JDK8. >>>> The modified test shows no failures with JPRT on all platforms. >>>> >>>> With Best Regards, >>>> Aleksej >>>> >>>> [1] JBS bug: https://bugs.openjdk.java.net/browse/JDK-8073357 >>>> [2] JAXWS integration: >>>> https://bugs.openjdk.java.net/browse/JDK-8076549 >>>> [3] Webrev: http://cr.openjdk.java.net/~aefimov/8073357/9/00/ >>> >>> >>> Lance Andersen| Principal Member of Technical Staff | +1.781.442.2037 >>> Oracle Java Engineering >>> 1 Network Drive >>> Burlington, MA 01803 >>> Lance.Andersen at oracle.com >>> >>> >>> >> > From aleksej.efimov at oracle.com Tue Apr 21 16:50:51 2015 From: aleksej.efimov at oracle.com (Aleksej Efimov) Date: Tue, 21 Apr 2015 19:50:51 +0300 Subject: RFR: 8073357: schema1.xsd has wrong content. Sequence of the enum values has been changed In-Reply-To: <55367CA4.5040902@oracle.com> References: <55353EB0.7020407@oracle.com> <20164241-BB66-4F2B-AE19-67BC434157D7@oracle.com> <55358BAA.6020707@oracle.com> <55363F41.5080803@oracle.com> <55367CA4.5040902@oracle.com> Message-ID: <55367FEB.6090806@oracle.com> On 04/21/2015 07:36 PM, huizhe wang wrote: > > On 4/21/2015 5:14 AM, Aleksej Efimov wrote: >> Hi Joe, >> Thank you for you comments - I have modified the test [1] to avoid >> multiple file open operations - now the test reads the file content >> one time after each call to schemagen tool. > > Ok. > >> Golden/expected output is a good suggestion, but we'll depend here on >> a format of generated schema file - it can be changed in future. So, >> I better check only for a test specific parts of the generated schema >> file. > > The report was "schema1.xsd has wrong content", which was why I was > looking for schema1.xsd. The lib conforms to the schema specification, > shall therefore be quite stable. Our XML tests for example, used > golden files created since 2005. They have not been a problem > themselves, rather they are helpful in catching issues / regressions. > I'm fine with your test. But it's something you may consider or talk > to Miran. True, the title is confusing/not a good one - "schema1.xsd" is a default file name generated by schemagen and plus it was a follow-up to JDK-8046817 bug - we fixed the generation of Enum's, but the order was different than in JDK7. Thanks for explanation about the golden file - we definitely will need to discuss it with you/Miran and I think we should end-up with unified approach for such tests. I will start different thread to discuss it. Best Regards, Aleksej > > Best, > Joe > >> >> With Best Regards, >> Aleksej >> >> [1] http://cr.openjdk.java.net/~aefimov/8073357/9/01/ >> >> On 04/21/2015 02:28 AM, huizhe wang wrote: >>> Hi Aleksej, >>> >>> You may also consider using a golden/expected output file to be >>> compared with the output. It makes a test more readable (easily see >>> what's expected), easier to maintain with a separated golden file >>> than multiple literal strings in the test, and technically simpler >>> logic (e.g. runSchemaGen and then compareResult) and without opening >>> the output file multiple times. >>> >>> Regards, >>> Joe >>> >>> On 4/20/2015 1:22 PM, Lance Andersen wrote: >>>> Hi Aleksej, >>>> >>>> The updates to the test seem reasonable. >>>> >>>> Best >>>> Lance >>>> On Apr 20, 2015, at 2:00 PM, Aleksej Efimov >>>> wrote: >>>> >>>>> Hello, >>>>> >>>>> The JDK9 schemagen tool hadn't preserved order of the enum values >>>>> [1] and it was fixed in standalone project and was synced to JDK >>>>> as part of JAXWS integration [2]. >>>>> Can I have a review for the >>>>> 'test/javax/xml/ws/8046817/GenerateEnumSchema.java' test update >>>>> [3] to include test case for this functionality. The test and the >>>>> partial backport of [2] will be backported to JDK8. >>>>> The modified test shows no failures with JPRT on all platforms. >>>>> >>>>> With Best Regards, >>>>> Aleksej >>>>> >>>>> [1] JBS bug: https://bugs.openjdk.java.net/browse/JDK-8073357 >>>>> [2] JAXWS integration: >>>>> https://bugs.openjdk.java.net/browse/JDK-8076549 >>>>> [3] Webrev: http://cr.openjdk.java.net/~aefimov/8073357/9/00/ >>>> >>>> >>>> Lance Andersen| Principal Member of Technical Staff | +1.781.442.2037 >>>> Oracle Java Engineering >>>> 1 Network Drive >>>> Burlington, MA 01803 >>>> Lance.Andersen at oracle.com >>>> >>>> >>>> >>> >> > From huizhe.wang at oracle.com Tue Apr 21 16:54:41 2015 From: huizhe.wang at oracle.com (huizhe wang) Date: Tue, 21 Apr 2015 09:54:41 -0700 Subject: RFR: 8078139 : jdk.xml.dom should be loaded by the ext class loader Message-ID: <553680D1.2030102@oracle.com> Hi, By JDK-8042244, we moved several org.w3c.dom packages to a module called jdk.xml.dom. This new module shall be loaded by the ext class loader. Please review the patch for the change. http://cr.openjdk.java.net/~joehw/jdk9/8078139/webrev/ Thanks, Joe From mandy.chung at oracle.com Tue Apr 21 17:02:37 2015 From: mandy.chung at oracle.com (Mandy Chung) Date: Tue, 21 Apr 2015 10:02:37 -0700 Subject: RFR: 8078139 : jdk.xml.dom should be loaded by the ext class loader In-Reply-To: <553680D1.2030102@oracle.com> References: <553680D1.2030102@oracle.com> Message-ID: <553682AD.9080602@oracle.com> On 04/21/2015 09:54 AM, huizhe wang wrote: > Hi, > > By JDK-8042244, we moved several org.w3c.dom packages to a module > called jdk.xml.dom. This new module shall be loaded by the ext class > loader. Please review the patch for the change. > > http://cr.openjdk.java.net/~joehw/jdk9/8078139/webrev/ Looks okay. As for the test, you can assert if cls.getClassLoader() != null. line 38 is not necessary. Sorry I didn't catch this in my review. Mandy From Alan.Bateman at oracle.com Tue Apr 21 17:10:07 2015 From: Alan.Bateman at oracle.com (Alan Bateman) Date: Tue, 21 Apr 2015 18:10:07 +0100 Subject: RFR: 8078139 : jdk.xml.dom should be loaded by the ext class loader In-Reply-To: <553680D1.2030102@oracle.com> References: <553680D1.2030102@oracle.com> Message-ID: <5536846F.3080100@oracle.com> On 21/04/2015 17:54, huizhe wang wrote: > Hi, > > By JDK-8042244, we moved several org.w3c.dom packages to a module > called jdk.xml.dom. This new module shall be loaded by the ext class > loader. Please review the patch for the change. > > http://cr.openjdk.java.net/~joehw/jdk9/8078139/webrev/ Looks okay. I assume @test is not needed in this test because it's a TestNG tree, is that right? -Alan From huizhe.wang at oracle.com Tue Apr 21 17:19:13 2015 From: huizhe.wang at oracle.com (huizhe wang) Date: Tue, 21 Apr 2015 10:19:13 -0700 Subject: RFR: 8078139 : jdk.xml.dom should be loaded by the ext class loader In-Reply-To: <5536846F.3080100@oracle.com> References: <553680D1.2030102@oracle.com> <5536846F.3080100@oracle.com> Message-ID: <55368691.8090808@oracle.com> Thanks Mandy, Alan. Fixed the issues. Here's the updated webrev: http://cr.openjdk.java.net/~joehw/jdk9/8078139/webrev/ -Joe On 4/21/2015 10:10 AM, Alan Bateman wrote: > On 21/04/2015 17:54, huizhe wang wrote: >> Hi, >> >> By JDK-8042244, we moved several org.w3c.dom packages to a module >> called jdk.xml.dom. This new module shall be loaded by the ext class >> loader. Please review the patch for the change. >> >> http://cr.openjdk.java.net/~joehw/jdk9/8078139/webrev/ > Looks okay. I assume @test is not needed in this test because it's a > TestNG tree, is that right? > > -Alan From sean.mullan at oracle.com Tue Apr 21 17:26:43 2015 From: sean.mullan at oracle.com (Sean Mullan) Date: Tue, 21 Apr 2015 13:26:43 -0400 Subject: RFR: 8078139 : jdk.xml.dom should be loaded by the ext class loader In-Reply-To: <55368691.8090808@oracle.com> References: <553680D1.2030102@oracle.com> <5536846F.3080100@oracle.com> <55368691.8090808@oracle.com> Message-ID: <55368853.9020509@oracle.com> Do we also need to change the java.policy file to grant specific permissions to the jdk.xml.dom module? --Sean On 04/21/2015 01:19 PM, huizhe wang wrote: > Thanks Mandy, Alan. > > Fixed the issues. Here's the updated webrev: > http://cr.openjdk.java.net/~joehw/jdk9/8078139/webrev/ > > -Joe > > On 4/21/2015 10:10 AM, Alan Bateman wrote: >> On 21/04/2015 17:54, huizhe wang wrote: >>> Hi, >>> >>> By JDK-8042244, we moved several org.w3c.dom packages to a module >>> called jdk.xml.dom. This new module shall be loaded by the ext class >>> loader. Please review the patch for the change. >>> >>> http://cr.openjdk.java.net/~joehw/jdk9/8078139/webrev/ >> Looks okay. I assume @test is not needed in this test because it's a >> TestNG tree, is that right? >> >> -Alan > From vladimir.x.ivanov at oracle.com Tue Apr 21 17:37:04 2015 From: vladimir.x.ivanov at oracle.com (Vladimir Ivanov) Date: Tue, 21 Apr 2015 20:37:04 +0300 Subject: [9] RFR (XS): 8078290: Customize adapted MethodHandle in MH.invoke() case Message-ID: <55368AC0.9020805@oracle.com> http://cr.openjdk.java.net/~vlivanov/8078290/webrev.00/ https://bugs.openjdk.java.net/browse/JDK-8078290 Customization logic introduced in [1] doesn't work as expected for MH.invoke() when asType() conversion happens and cached MH is used. Generic invoker LambdaForm looks like: invoke_002_MT=Lambda(a0:L,a1:L,a2:L)=>{ t3:L=Invokers.checkGenericType(a0:L,a2:L); t4:V=Invokers.checkCustomized(a0:L); t5:L=MethodHandle.invokeBasic(t3:L,a1:L);t5:L} } Original MH(a0) is customized, but adapted MH (t3) is used for invocation. a0 != t3 when MH.asType() conversion happens in Invokers.checkGenericType(). Invoker LambdaForm should have the following structure: invoke_002_MT=Lambda(a0:L,a1:L,a2:L)=>{ t3:L=Invokers.checkGenericType(a0:L,a2:L); t4:V=Invokers.checkCustomized(t3:L); t5:L=MethodHandle.invokeBasic(t3:L,a1:L);t5:L} } Testing: manual (verified invoker LF), microbenchmark, jdk/test/java/lang/invoke, hotspot/test/compiler/jsr292, nashorn Best regards, Vladimir Ivanov From mandy.chung at oracle.com Tue Apr 21 17:36:32 2015 From: mandy.chung at oracle.com (Mandy Chung) Date: Tue, 21 Apr 2015 10:36:32 -0700 Subject: RFR: 8078139 : jdk.xml.dom should be loaded by the ext class loader In-Reply-To: <55368853.9020509@oracle.com> References: <553680D1.2030102@oracle.com> <5536846F.3080100@oracle.com> <55368691.8090808@oracle.com> <55368853.9020509@oracle.com> Message-ID: <55368AA0.6090003@oracle.com> Good point. They are all interfaces that don't require any permission. I'm inclined to suggest the client, e.g. implementation classes, requiring jdk.xml.dom should configure proper permissions for itself as well as permissions required by jdk.xml.dom. Otherwise it would require AllPermissions. Mandy On 04/21/2015 10:26 AM, Sean Mullan wrote: > Do we also need to change the java.policy file to grant specific > permissions to the jdk.xml.dom module? > > --Sean > > On 04/21/2015 01:19 PM, huizhe wang wrote: >> Thanks Mandy, Alan. >> >> Fixed the issues. Here's the updated webrev: >> http://cr.openjdk.java.net/~joehw/jdk9/8078139/webrev/ >> >> -Joe >> >> On 4/21/2015 10:10 AM, Alan Bateman wrote: >>> On 21/04/2015 17:54, huizhe wang wrote: >>>> Hi, >>>> >>>> By JDK-8042244, we moved several org.w3c.dom packages to a module >>>> called jdk.xml.dom. This new module shall be loaded by the ext class >>>> loader. Please review the patch for the change. >>>> >>>> http://cr.openjdk.java.net/~joehw/jdk9/8078139/webrev/ >>> Looks okay. I assume @test is not needed in this test because it's a >>> TestNG tree, is that right? >>> >>> -Alan >> From john.r.rose at oracle.com Tue Apr 21 17:46:39 2015 From: john.r.rose at oracle.com (John Rose) Date: Tue, 21 Apr 2015 10:46:39 -0700 Subject: [9] RFR (XS): 8078290: Customize adapted MethodHandle in MH.invoke() case In-Reply-To: <55368AC0.9020805@oracle.com> References: <55368AC0.9020805@oracle.com> Message-ID: <8F04F195-81D1-44CA-B6F4-88DFCD64B05A@oracle.com> Reviewed. Nice find. ? John > On Apr 21, 2015, at 10:37 AM, Vladimir Ivanov wrote: > > http://cr.openjdk.java.net/~vlivanov/8078290/webrev.00/ > https://bugs.openjdk.java.net/browse/JDK-8078290 > > Customization logic introduced in [1] doesn't work as expected for MH.invoke() when asType() conversion happens and cached MH is used. > > Generic invoker LambdaForm looks like: > > invoke_002_MT=Lambda(a0:L,a1:L,a2:L)=>{ > t3:L=Invokers.checkGenericType(a0:L,a2:L); > t4:V=Invokers.checkCustomized(a0:L); > t5:L=MethodHandle.invokeBasic(t3:L,a1:L);t5:L} > } > > Original MH(a0) is customized, but adapted MH (t3) is used for invocation. a0 != t3 when MH.asType() conversion happens in Invokers.checkGenericType(). > > Invoker LambdaForm should have the following structure: > > invoke_002_MT=Lambda(a0:L,a1:L,a2:L)=>{ > t3:L=Invokers.checkGenericType(a0:L,a2:L); > t4:V=Invokers.checkCustomized(t3:L); > t5:L=MethodHandle.invokeBasic(t3:L,a1:L);t5:L} > } > > Testing: manual (verified invoker LF), microbenchmark, jdk/test/java/lang/invoke, hotspot/test/compiler/jsr292, nashorn > > Best regards, > Vladimir Ivanov From sean.mullan at oracle.com Tue Apr 21 17:48:49 2015 From: sean.mullan at oracle.com (Sean Mullan) Date: Tue, 21 Apr 2015 13:48:49 -0400 Subject: RFR: 8078139 : jdk.xml.dom should be loaded by the ext class loader In-Reply-To: <55368AA0.6090003@oracle.com> References: <553680D1.2030102@oracle.com> <5536846F.3080100@oracle.com> <55368691.8090808@oracle.com> <55368853.9020509@oracle.com> <55368AA0.6090003@oracle.com> Message-ID: <55368D81.6040504@oracle.com> On 04/21/2015 01:36 PM, Mandy Chung wrote: > Good point. They are all interfaces that don't require any permission. Ah, ok. Never mind then. > I'm inclined to suggest the client, e.g. implementation classes, > requiring jdk.xml.dom should configure proper permissions for itself as > well as permissions required by jdk.xml.dom. Yes, but that would require editing the policy file on systems which may not be under your control. --Sean > Otherwise it would require > AllPermissions. > > Mandy > > On 04/21/2015 10:26 AM, Sean Mullan wrote: >> Do we also need to change the java.policy file to grant specific >> permissions to the jdk.xml.dom module? >> >> --Sean >> >> On 04/21/2015 01:19 PM, huizhe wang wrote: >>> Thanks Mandy, Alan. >>> >>> Fixed the issues. Here's the updated webrev: >>> http://cr.openjdk.java.net/~joehw/jdk9/8078139/webrev/ >>> >>> -Joe >>> >>> On 4/21/2015 10:10 AM, Alan Bateman wrote: >>>> On 21/04/2015 17:54, huizhe wang wrote: >>>>> Hi, >>>>> >>>>> By JDK-8042244, we moved several org.w3c.dom packages to a module >>>>> called jdk.xml.dom. This new module shall be loaded by the ext class >>>>> loader. Please review the patch for the change. >>>>> >>>>> http://cr.openjdk.java.net/~joehw/jdk9/8078139/webrev/ >>>> Looks okay. I assume @test is not needed in this test because it's a >>>> TestNG tree, is that right? >>>> >>>> -Alan >>> > From vladimir.x.ivanov at oracle.com Tue Apr 21 18:03:40 2015 From: vladimir.x.ivanov at oracle.com (Vladimir Ivanov) Date: Tue, 21 Apr 2015 21:03:40 +0300 Subject: [9] RFR (XS): 8078290: Customize adapted MethodHandle in MH.invoke() case In-Reply-To: <8F04F195-81D1-44CA-B6F4-88DFCD64B05A@oracle.com> References: <55368AC0.9020805@oracle.com> <8F04F195-81D1-44CA-B6F4-88DFCD64B05A@oracle.com> Message-ID: <553690FC.5080901@oracle.com> Thanks, John. Best regards, Vladimir Ivanov On 4/21/15 8:46 PM, John Rose wrote: > Reviewed. Nice find. > > ? John > >> On Apr 21, 2015, at 10:37 AM, Vladimir Ivanov wrote: >> >> http://cr.openjdk.java.net/~vlivanov/8078290/webrev.00/ >> https://bugs.openjdk.java.net/browse/JDK-8078290 >> >> Customization logic introduced in [1] doesn't work as expected for MH.invoke() when asType() conversion happens and cached MH is used. >> >> Generic invoker LambdaForm looks like: >> >> invoke_002_MT=Lambda(a0:L,a1:L,a2:L)=>{ >> t3:L=Invokers.checkGenericType(a0:L,a2:L); >> t4:V=Invokers.checkCustomized(a0:L); >> t5:L=MethodHandle.invokeBasic(t3:L,a1:L);t5:L} >> } >> >> Original MH(a0) is customized, but adapted MH (t3) is used for invocation. a0 != t3 when MH.asType() conversion happens in Invokers.checkGenericType(). >> >> Invoker LambdaForm should have the following structure: >> >> invoke_002_MT=Lambda(a0:L,a1:L,a2:L)=>{ >> t3:L=Invokers.checkGenericType(a0:L,a2:L); >> t4:V=Invokers.checkCustomized(t3:L); >> t5:L=MethodHandle.invokeBasic(t3:L,a1:L);t5:L} >> } >> >> Testing: manual (verified invoker LF), microbenchmark, jdk/test/java/lang/invoke, hotspot/test/compiler/jsr292, nashorn >> >> Best regards, >> Vladimir Ivanov From mandy.chung at oracle.com Tue Apr 21 18:20:17 2015 From: mandy.chung at oracle.com (Mandy Chung) Date: Tue, 21 Apr 2015 11:20:17 -0700 Subject: RFR: 8078139 : jdk.xml.dom should be loaded by the ext class loader In-Reply-To: <55368D81.6040504@oracle.com> References: <553680D1.2030102@oracle.com> <5536846F.3080100@oracle.com> <55368691.8090808@oracle.com> <55368853.9020509@oracle.com> <55368AA0.6090003@oracle.com> <55368D81.6040504@oracle.com> Message-ID: <553694E1.4040309@oracle.com> On 04/21/2015 10:48 AM, Sean Mullan wrote: > On 04/21/2015 01:36 PM, Mandy Chung wrote: >> Good point. They are all interfaces that don't require any permission. > > Ah, ok. Never mind then. > >> I'm inclined to suggest the client, e.g. implementation classes, >> requiring jdk.xml.dom should configure proper permissions for itself as >> well as permissions required by jdk.xml.dom. > > Yes, but that would require editing the policy file on systems which > may not be under your control. > OK. I think it's better to follow up this after further discussion for the deprivileging work and understand what can or can't be done in editing the policy files. For now, we should keep existing behavior to grant jdk.xml.dom AllPermissions. How does that sound? Joe - the file is in jdk/src/java.base/share/conf/security/java.policy. Mandy > --Sean > >> Otherwise it would require >> AllPermissions. > >> >> Mandy >> >> On 04/21/2015 10:26 AM, Sean Mullan wrote: >>> Do we also need to change the java.policy file to grant specific >>> permissions to the jdk.xml.dom module? >>> >>> --Sean >>> >>> On 04/21/2015 01:19 PM, huizhe wang wrote: >>>> Thanks Mandy, Alan. >>>> >>>> Fixed the issues. Here's the updated webrev: >>>> http://cr.openjdk.java.net/~joehw/jdk9/8078139/webrev/ >>>> >>>> -Joe >>>> >>>> On 4/21/2015 10:10 AM, Alan Bateman wrote: >>>>> On 21/04/2015 17:54, huizhe wang wrote: >>>>>> Hi, >>>>>> >>>>>> By JDK-8042244, we moved several org.w3c.dom packages to a module >>>>>> called jdk.xml.dom. This new module shall be loaded by the ext class >>>>>> loader. Please review the patch for the change. >>>>>> >>>>>> http://cr.openjdk.java.net/~joehw/jdk9/8078139/webrev/ >>>>> Looks okay. I assume @test is not needed in this test because it's a >>>>> TestNG tree, is that right? >>>>> >>>>> -Alan >>>> >> From sean.mullan at oracle.com Tue Apr 21 18:41:40 2015 From: sean.mullan at oracle.com (Sean Mullan) Date: Tue, 21 Apr 2015 14:41:40 -0400 Subject: RFR: 8078139 : jdk.xml.dom should be loaded by the ext class loader In-Reply-To: <553694E1.4040309@oracle.com> References: <553680D1.2030102@oracle.com> <5536846F.3080100@oracle.com> <55368691.8090808@oracle.com> <55368853.9020509@oracle.com> <55368AA0.6090003@oracle.com> <55368D81.6040504@oracle.com> <553694E1.4040309@oracle.com> Message-ID: <553699E4.1030808@oracle.com> On 04/21/2015 02:20 PM, Mandy Chung wrote: > OK. I think it's better to follow up this after further discussion for > the deprivileging work and understand what can or can't be done in > editing the policy files. For now, we should keep existing behavior to > grant jdk.xml.dom AllPermissions. How does that sound? Actually, if all that is in the module is interfaces, and there are no permission checks in default/static methods, I don't think any permissions are necessary. So I think the webrev is fine as is. --Sean From huizhe.wang at oracle.com Tue Apr 21 19:41:48 2015 From: huizhe.wang at oracle.com (huizhe wang) Date: Tue, 21 Apr 2015 12:41:48 -0700 Subject: RFR: 8078139 : jdk.xml.dom should be loaded by the ext class loader In-Reply-To: <553699E4.1030808@oracle.com> References: <553680D1.2030102@oracle.com> <5536846F.3080100@oracle.com> <55368691.8090808@oracle.com> <55368853.9020509@oracle.com> <55368AA0.6090003@oracle.com> <55368D81.6040504@oracle.com> <553694E1.4040309@oracle.com> <553699E4.1030808@oracle.com> Message-ID: <5536A7FC.5080705@oracle.com> On 4/21/2015 11:41 AM, Sean Mullan wrote: > On 04/21/2015 02:20 PM, Mandy Chung wrote: >> OK. I think it's better to follow up this after further discussion for >> the deprivileging work and understand what can or can't be done in >> editing the policy files. For now, we should keep existing behavior to >> grant jdk.xml.dom AllPermissions. How does that sound? > > Actually, if all that is in the module is interfaces, and there are no > permission checks in default/static methods, I don't think any > permissions are necessary. So I think the webrev is fine as is. Thanks Sean. Yes, they are purely interfaces, no default/static methods. The only references to java.xml are a few DOM types that are not restricted. BTW, I also added the @Test annotation back. It does run within JTreg, but not NetBeans as Lance noted. http://sc11137378.us.oracle.com:8080/myhome/openjdk/webrevs/jdk9/8078139/webrev/ Thanks, Joe > > --Sean From joe.darcy at oracle.com Wed Apr 22 02:13:16 2015 From: joe.darcy at oracle.com (Joseph D. Darcy) Date: Tue, 21 Apr 2015 19:13:16 -0700 Subject: JDK 9 RFR of JDK-8078334: Mark regression tests using randomness Message-ID: <553703BC.1070504@oracle.com> Hello, As the next step of implementing "Proposed new policies for JDK 9 regression tests: tiered testing, intermittent failures, and randomness" [1], please review this changeset which adds a "randomness" jtreg keyword and tags 240 regression tests in the jdk repository with the keyword: JDK-8078334: Mark regression tests using randomness http://cr.openjdk.java.net/~darcy/8078334.0/ The update to test/TEST.ROOT is -# The list of keywords supported in the entire test suite -keys=2d dnd i18n intermittent +# The list of keywords supported in the entire test suite. The +# "intermittent" keyword marks tests known to fail intermittently. +# The "randomness" keyword marks tests using randomness with test +# cases differing from run to run. (A test using a fixed random seed +# would not count as "randomness" by this definition.) Extra care +# should be taken to handle test failures of intermittent or +# randomness tests. + +keys=2d dnd i18n intermittent randomness To find the affected files for this fix, I grepped over the regression tests looking for "random" and verified if a random number generated was used in a way where its values would differ from run to run. In particular, as noted above, a java.util.Random random number generator with a fixed seed did *not* qualify a test for the "randomness" keyword. The usual update to the files in this changeset is just + * @key randomness The updated tests are mostly in the core libs and security libs areas with a few serviceability tests too. The list in this bug is not quite exhaustive; I did not include rmi tests or client libraries tests. I verified that running jtreg ... -l -k:randomness . returns the expected number of tests and that the tests continue to pass (or be ignored) when run. One goal of marking the tests using randomness is to help root out some remaining intermittent test failures. If one of the randomness tests is observed to fail intermittently, if it has not already been updated to print out the random seed and be able to accept a particular seed when run, the test should be so modified so that future failures can log the seed value in hopes of reproducing the failure. Brian Burkhalter has proactively made these sorts of changes to the java.math tests earlier in JDK 9. [2] Since most of the randomness tests don't have a history of instability (and due to the unexpected large number of them!), I don't think it is necessary to proactively update all the other tests without evidence of a history of failure. However, when an otherwise unexplained failure is seen, I recommend applying the sort of updates Brian has done in java.math to the failing test(s). Thanks, -Joe [1] http://mail.openjdk.java.net/pipermail/jdk9-dev/2015-March/001991.html [2] JDK-8074460, Always print seeds used in [Splittable]Random instances in java.math tests, https://bugs.openjdk.java.net/browse/JDK-8074460 From Alan.Bateman at oracle.com Wed Apr 22 06:56:15 2015 From: Alan.Bateman at oracle.com (Alan Bateman) Date: Wed, 22 Apr 2015 07:56:15 +0100 Subject: RFR(xs): 6991580: IPv6 Nameservers in resolv.conf throws NumberFormatException In-Reply-To: <553666E4.8030908@oracle.com> References: <1429531333.3444.14.camel@redhat.com> <1429532086.3444.15.camel@redhat.com> <692561968.2911058.1429547064809.JavaMail.zimbra@redhat.com> <1429551140.3444.39.camel@redhat.com> <553656FE.9000802@oracle.com> <553666E4.8030908@oracle.com> Message-ID: <5537460F.7030201@oracle.com> On 21/04/2015 16:04, Michael McMahon wrote: > : > > http://cr.openjdk.java.net/~michaelm/8078276/webrev.1/ Before you push this, shouldn't the test have copyright Red Hat? There's an example in the same directory. -Alan From daniel.fuchs at oracle.com Wed Apr 22 08:31:47 2015 From: daniel.fuchs at oracle.com (Daniel Fuchs) Date: Wed, 22 Apr 2015 10:31:47 +0200 Subject: JDK 9 RFR of JDK-8078334: Mark regression tests using randomness In-Reply-To: <553703BC.1070504@oracle.com> References: <553703BC.1070504@oracle.com> Message-ID: <55375C73.7060001@oracle.com> On 22/04/15 04:13, Joseph D. Darcy wrote: > One goal of marking the tests using randomness is to help root out some > remaining intermittent test failures. If one of the randomness tests is > observed to fail intermittently, if it has not already been updated to > print out the random seed and be able to accept a particular seed when > run, the test should be so modified so that future failures can log the > seed value in hopes of reproducing the failure. Hi Joe, The following logging tests use UUID.randomUUID() to generate a 'unique' file name in order to avoid possible collision if these tests are run concurrently or if some files have been left over from a previous run (some of these use %t - the temporary directory - which has been known to cause intermittent failure in those cases). So I believe that removing randomness, or attempting to make it predictable, would in those specific cases make those tests more prone to intermittent failures. In this light - should these tests still be tagged with the @randomness keyword? test/java/util/logging/CheckZombieLockTest.java test/java/util/logging/FileHandlerLongLimit.java test/java/util/logging/FileHandlerPath.java test/java/util/logging/FileHandlerPatternExceptions.java test/java/util/logging/LogManager/Configuration/ParentLoggerWithHandlerGC.java best regards, -- daniel From sgehwolf at redhat.com Wed Apr 22 08:39:55 2015 From: sgehwolf at redhat.com (Severin Gehwolf) Date: Wed, 22 Apr 2015 10:39:55 +0200 Subject: RFR(xs): 6991580: IPv6 Nameservers in resolv.conf throws NumberFormatException In-Reply-To: <5536682A.6070900@oracle.com> References: <1429531333.3444.14.camel@redhat.com> <1429532086.3444.15.camel@redhat.com> <692561968.2911058.1429547064809.JavaMail.zimbra@redhat.com> <1429551140.3444.39.camel@redhat.com> <553656FE.9000802@oracle.com> <553666E4.8030908@oracle.com> <5536682A.6070900@oracle.com> Message-ID: <1429691995.3491.2.camel@redhat.com> On Tue, 2015-04-21 at 16:09 +0100, Alan Bateman wrote: > On 21/04/2015 16:04, Michael McMahon wrote: > > On 21/04/15 14:56, Alan Bateman wrote: > >> : > >>> > >> Can the test be moved to jdk/test/com/sun/jndi/dns as that seems to > >> be where the other tests are? Also I assume this will need a > >> copyright header before it is pushed. > >> > >> -Alan > > > > I had pushed it already. So, I'll fix it in this webrev > > > > http://cr.openjdk.java.net/~michaelm/8078276/webrev.1/ Thanks Michael, for sponsoring and then moving the test! Cheers, Severin From amy.lu at oracle.com Wed Apr 22 11:19:39 2015 From: amy.lu at oracle.com (Amy Lu) Date: Wed, 22 Apr 2015 19:19:39 +0800 Subject: JDK 9 RFR of JDK-8078334: Mark regression tests using randomness In-Reply-To: <55375C73.7060001@oracle.com> References: <553703BC.1070504@oracle.com> <55375C73.7060001@oracle.com> Message-ID: <553783CB.7050902@oracle.com> On 4/22/15 4:31 PM, Daniel Fuchs wrote: > On 22/04/15 04:13, Joseph D. Darcy wrote: >> One goal of marking the tests using randomness is to help root out some >> remaining intermittent test failures. If one of the randomness tests is >> observed to fail intermittently, if it has not already been updated to >> print out the random seed and be able to accept a particular seed when >> run, the test should be so modified so that future failures can log the >> seed value in hopes of reproducing the failure. > > Hi Joe, > > The following logging tests use UUID.randomUUID() to generate > a 'unique' file name in order to avoid possible collision if > these tests are run concurrently or if some files have been > left over from a previous run (some of these use %t - the temporary > directory - which has been known to cause intermittent > failure in those cases). > > So I believe that removing randomness, or attempting to > make it predictable, would in those specific cases make > those tests more prone to intermittent failures. > > In this light - should these tests still be tagged with > the @randomness keyword? > > test/java/util/logging/CheckZombieLockTest.java > test/java/util/logging/FileHandlerLongLimit.java > test/java/util/logging/FileHandlerPath.java > test/java/util/logging/FileHandlerPatternExceptions.java > test/java/util/logging/LogManager/Configuration/ParentLoggerWithHandlerGC.java > > > > best regards, > > -- daniel I notice similar case in below tests: test/java/util/zip/ZipFile/FinalizeZipFile.java Test need some zip file to test on. Random is used to generate the zip file name. test/java/util/zip/ZipFile/ReadZip.java Random is used to generate a non-existing file name for negative test @randomness might not needed for following tests where test need a zip file to test on, and Random is used to fill some content to the file in createZipFile(). test/java/util/zip/ZipFile/MultiThreadedReadTest.java test/java/util/zip/ZipFile/ClearStaleZipFileInputStreams.java Thanks, Amy From aleksej.efimov at oracle.com Wed Apr 22 14:12:46 2015 From: aleksej.efimov at oracle.com (Aleksej Efimov) Date: Wed, 22 Apr 2015 17:12:46 +0300 Subject: [8u60] Request for approval: 8073357: schema1.xsd has wrong content. Sequence of the enum values has been changed Message-ID: <5537AC5E.5090507@oracle.com> Hello, Can I ask for approval of the JDK-8073357 [2] bug fix [1] to JDK8. The original fix contains only test modifications, but the jaxws part was introduced during JAXWS synchronization [3] in JDK9. The schemagen changes [4] related to the reported failure were backported from JDK9. This partial (ApNavigator.java changes) backport applies cleanly after reshuffling. Test fix backport applies cleanly. JDK build with proposed changes shows no related tests failures with JPRT (jdk_other test group). In case, if it is a subject of review - adding 'core-libs-dev'. Thank you, Aleksej JDK9 changeset: http://hg.openjdk.java.net/jdk9/dev/jdk/rev/2dcdce98a176 JDK9 review: http://mail.openjdk.java.net/pipermail/core-libs-dev/2015-April/032931.html JAXWS integration changeset: http://hg.openjdk.java.net/jdk9/dev/jaxws/rev/f31835b59035 [1] Webrev: http://cr.openjdk.java.net/~aefimov/8073357/8/00/ [2] JBS: https://bugs.openjdk.java.net/browse/JDK-8073357 [3] JAXWS sync bug: https://bugs.openjdk.java.net/browse/JDK-8076549 [4] Backported changes: http://cr.openjdk.java.net/~aefimov/8073357/8/00/jaxws/src/share/jaxws_classes/com/sun/tools/internal/jxc/model/nav/ApNavigator.java.patch From joe.darcy at oracle.com Wed Apr 22 17:02:57 2015 From: joe.darcy at oracle.com (joe darcy) Date: Wed, 22 Apr 2015 10:02:57 -0700 Subject: JDK 9 RFR of JDK-8078334: Mark regression tests using randomness In-Reply-To: <55375C73.7060001@oracle.com> References: <553703BC.1070504@oracle.com> <55375C73.7060001@oracle.com> Message-ID: <5537D441.1070204@oracle.com> Hi Daniel, On 4/22/2015 1:31 AM, Daniel Fuchs wrote: > On 22/04/15 04:13, Joseph D. Darcy wrote: >> One goal of marking the tests using randomness is to help root out some >> remaining intermittent test failures. If one of the randomness tests is >> observed to fail intermittently, if it has not already been updated to >> print out the random seed and be able to accept a particular seed when >> run, the test should be so modified so that future failures can log the >> seed value in hopes of reproducing the failure. > > Hi Joe, > > The following logging tests use UUID.randomUUID() to generate > a 'unique' file name in order to avoid possible collision if > these tests are run concurrently or if some files have been > left over from a previous run (some of these use %t - the temporary > directory - which has been known to cause intermittent > failure in those cases). > > So I believe that removing randomness, or attempting to > make it predictable, would in those specific cases make > those tests more prone to intermittent failures. > > In this light - should these tests still be tagged with > the @randomness keyword? > > test/java/util/logging/CheckZombieLockTest.java > test/java/util/logging/FileHandlerLongLimit.java > test/java/util/logging/FileHandlerPath.java > test/java/util/logging/FileHandlerPatternExceptions.java > test/java/util/logging/LogManager/Configuration/ParentLoggerWithHandlerGC.java > > The randomness label is just meant to be documentation and not pejorative. Its uses in the tests you identify it is more likely to increase rather than decrease stability. However, I still think it is appropriate to mark these tests for their behavior. Thanks, -Joe From sean.coffey at oracle.com Wed Apr 22 17:29:40 2015 From: sean.coffey at oracle.com (=?UTF-8?B?U2XDoW4gQ29mZmV5?=) Date: Wed, 22 Apr 2015 10:29:40 -0700 Subject: [8u60] Request for approval: 8073357: schema1.xsd has wrong content. Sequence of the enum values has been changed In-Reply-To: <5537AC5E.5090507@oracle.com> References: <5537AC5E.5090507@oracle.com> Message-ID: <5537DA84.3070004@oracle.com> Approved. Please get a peer review before pushing the changes. Regards, Sean. On 22/04/15 07:12, Aleksej Efimov wrote: > Hello, > > Can I ask for approval of the JDK-8073357 [2] bug fix [1] to JDK8. The > original fix contains only test modifications, but the jaxws part was > introduced during JAXWS synchronization [3] in JDK9. The schemagen > changes [4] related to the reported failure were backported from JDK9. > This partial (ApNavigator.java changes) backport applies cleanly after > reshuffling. Test fix backport applies cleanly. > JDK build with proposed changes shows no related tests failures with > JPRT (jdk_other test group). > > In case, if it is a subject of review - adding 'core-libs-dev'. > > Thank you, > Aleksej > > JDK9 changeset: > http://hg.openjdk.java.net/jdk9/dev/jdk/rev/2dcdce98a176 > JDK9 review: > http://mail.openjdk.java.net/pipermail/core-libs-dev/2015-April/032931.html > > JAXWS integration changeset: > http://hg.openjdk.java.net/jdk9/dev/jaxws/rev/f31835b59035 > > [1] Webrev: http://cr.openjdk.java.net/~aefimov/8073357/8/00/ > [2] JBS: https://bugs.openjdk.java.net/browse/JDK-8073357 > [3] JAXWS sync bug: https://bugs.openjdk.java.net/browse/JDK-8076549 > [4] Backported changes: > http://cr.openjdk.java.net/~aefimov/8073357/8/00/jaxws/src/share/jaxws_classes/com/sun/tools/internal/jxc/model/nav/ApNavigator.java.patch > From gnu.andrew at redhat.com Wed Apr 22 21:45:58 2015 From: gnu.andrew at redhat.com (Andrew Hughes) Date: Wed, 22 Apr 2015 17:45:58 -0400 (EDT) Subject: RFR(xs): 6991580: IPv6 Nameservers in resolv.conf throws NumberFormatException In-Reply-To: <5537460F.7030201@oracle.com> References: <1429531333.3444.14.camel@redhat.com> <1429532086.3444.15.camel@redhat.com> <692561968.2911058.1429547064809.JavaMail.zimbra@redhat.com> <1429551140.3444.39.camel@redhat.com> <553656FE.9000802@oracle.com> <553666E4.8030908@oracle.com> <5537460F.7030201@oracle.com> Message-ID: <674681858.4662733.1429739158203.JavaMail.zimbra@redhat.com> ----- Original Message ----- > On 21/04/2015 16:04, Michael McMahon wrote: > > : > > > > http://cr.openjdk.java.net/~michaelm/8078276/webrev.1/ > Before you push this, shouldn't the test have copyright Red Hat? There's > an example in the same directory. > > -Alan > Yes, I was thinking the same just now. -- Andrew :) Free Java Software Engineer Red Hat, Inc. (http://www.redhat.com) PGP Key: ed25519/35964222 (hkp://keys.gnupg.net) Fingerprint = 5132 579D D154 0ED2 3E04 C5A0 CFDA 0F9B 3596 4222 PGP Key: rsa4096/248BDC07 (hkp://keys.gnupg.net) Fingerprint = EC5A 1F5E C0AD 1D15 8F1F 8F91 3B96 A578 248B DC07 From joe.darcy at oracle.com Thu Apr 23 01:08:18 2015 From: joe.darcy at oracle.com (joe darcy) Date: Wed, 22 Apr 2015 18:08:18 -0700 Subject: JDK 9 RFR of JDK-8078467: Update core libraries to use diamond with anonymous classes Message-ID: <55384602.9070009@oracle.com> Hello, Earlier in JDK 9, the diamond syntax was expanded to be usable with many cases of anonymous classes. [1] Please review the fix below take advantage of the new syntax (and also take advantage of the original diamond syntax in some cases) in the core libraries: JDK-8078467: Update core libraries to use diamond with anonymous classes http://cr.openjdk.java.net/~darcy/8078467.0/ The main beneficiary of the new syntax are call sites of PrivilegedAction. Follow-up bugs also filed for security libs (JDK-8078468) and java.util.concurrent (JDK-8078469). Thanks, -Joe [1] http://mail.openjdk.java.net/pipermail/jdk9-dev/2015-April/002130.html From mandy.chung at oracle.com Thu Apr 23 01:24:06 2015 From: mandy.chung at oracle.com (Mandy Chung) Date: Wed, 22 Apr 2015 18:24:06 -0700 Subject: JDK 9 RFR of JDK-8078467: Update core libraries to use diamond with anonymous classes In-Reply-To: <55384602.9070009@oracle.com> References: <55384602.9070009@oracle.com> Message-ID: <553849B6.5050209@oracle.com> On 4/22/2015 6:08 PM, joe darcy wrote: > Hello, > > Earlier in JDK 9, the diamond syntax was expanded to be usable with > many cases of anonymous classes. [1] > > Please review the fix below take advantage of the new syntax (and also > take advantage of the original diamond syntax in some cases) in the > core libraries: > > JDK-8078467: Update core libraries to use diamond with anonymous > classes > http://cr.openjdk.java.net/~darcy/8078467.0/ > > The main beneficiary of the new syntax are call sites of > PrivilegedAction. Looks good. Happy to see this change that reduces the code "noises". Not sure if you are planning to touch the serviceability area, if so, better to delay that until the next hotspot integration to jdk9/dev as there is a big refactoring in java.management module that has been integrated to jdk9/hs. Mandy From Alan.Bateman at oracle.com Thu Apr 23 08:31:51 2015 From: Alan.Bateman at oracle.com (Alan Bateman) Date: Thu, 23 Apr 2015 09:31:51 +0100 Subject: JDK 9 RFR of JDK-8078467: Update core libraries to use diamond with anonymous classes In-Reply-To: <55384602.9070009@oracle.com> References: <55384602.9070009@oracle.com> Message-ID: <5538ADF7.6050104@oracle.com> On 23/04/2015 02:08, joe darcy wrote: > Hello, > > Earlier in JDK 9, the diamond syntax was expanded to be usable with > many cases of anonymous classes. [1] > > Please review the fix below take advantage of the new syntax (and also > take advantage of the original diamond syntax in some cases) in the > core libraries: > > JDK-8078467: Update core libraries to use diamond with anonymous > classes > http://cr.openjdk.java.net/~darcy/8078467.0/ > > The main beneficiary of the new syntax are call sites of > PrivilegedAction. > > Follow-up bugs also filed for security libs (JDK-8078468) and > java.util.concurrent (JDK-8078469). This looks okay to me to too. -Alan. From chris.hegarty at oracle.com Thu Apr 23 09:01:38 2015 From: chris.hegarty at oracle.com (Chris Hegarty) Date: Thu, 23 Apr 2015 10:01:38 +0100 Subject: RFR [9] Add blocking bulk read to java.io.InputStream Message-ID: A while back when we added the long overdue java.io.InputStream.transferTo method, there was support for adding a blocking bulk read operation. This has been sitting in a branch in the sandbox since then. I would like to revive it with the intention of bringing it into 9. The motivation for this addition is provide library support for a common pattern found when reading from input streams. /** * Reads some bytes from the input stream into the given byte array. This * method blocks until {@code len} bytes of input data have been read, or * end of stream is detected. The number of bytes actually read, possibly * zero, is returned. This method does not close the input stream. * *

    In the case where end of stream is reached before {@code len} bytes * have been read, then the actual number of bytes read will be returned. * When this stream reaches end of stream, further invocations of this * method will return zero. * *

    If {@code len} is zero, then no bytes are read and {@code 0} is * returned; otherwise, there is an attempt to read up to {@code len} bytes. * *

    The first byte read is stored into element {@code b[off]}, the next * one in to {@code b[off+1]}, and so on. The number of bytes read is, at * most, equal to {@code len}. Let k be the number of bytes actually * read; these bytes will be stored in elements {@code b[off]} through * {@code b[off+}k{@code -1]}, leaving elements {@code b[off+}k * {@code ]} through {@code b[off+len-1]} unaffected. * *

    In every case, elements {@code b[0]} through {@code b[off]} and * elements{@code b[off+len]} through {@code b[b.length-1]} are unaffected. * *

    The behavior for the case where the input stream is asynchronously * closed, or the thread interrupted during the read, is highly input * stream specific, and therefore not specified. * *

    If an I/O error occurs reading from the input stream, then it may do * so after some bytes have been read. Consequently the input stream may be * in an inconsistent state. It is strongly recommended that the stream be * promptly closed if an I/O error occurs. * * @param b the buffer into which the data is read * @param off the start offset in {@code b} at which the data is written * @param len the maximum number of bytes to read * @return the actual number of bytes read into the buffer * @throws IOException if an I/O error occurs * @throws NullPointerException if {@code b} is {@code null} * @throws IndexOutOfBoundsException If {@code off} is negative, {@code len} * is negative, or {@code len} is greater than {@code b.length - off} * * @since 1.9 */ public int readBytes(byte[] b, int off, int len) throws IOException { Objects.requireNonNull(b); if (off < 0 || len < 0 || len > b.length - off) throw new IndexOutOfBoundsException(); int n = 0; while (n < len) { int count = read(b, off + n, len - n); if (count < 0) break; n += count; } return n; } -Chris. From pavel.rappo at oracle.com Thu Apr 23 11:48:58 2015 From: pavel.rappo at oracle.com (Pavel Rappo) Date: Thu, 23 Apr 2015 12:48:58 +0100 Subject: RFR [9] Add blocking bulk read to java.io.InputStream In-Reply-To: References: Message-ID: <8D0A349E-4F53-490A-AE18-40ECEA3B72D3@oracle.com> Hi Chris, The spec looks good. The only single detail I've noticed is that the "an exception is thrown" as a possible cause of unblocking the method is missing: --- dev/jdk/src/java.base/share/classes/java/io/InputStream.java (revision ) +++ dev/jdk/src/java.base/share/classes/java/io/InputStream.java (revision ) @@ -408,8 +408,9 @@ /** * Reads some bytes from the input stream into the given byte array. This * method blocks until {@code len} bytes of input data have been read, or - * end of stream is detected. The number of bytes actually read, possibly - * zero, is returned. This method does not close the input stream. + * end of stream is detected, or an exception is thrown. The number of bytes + * actually read, possibly zero, is returned. This method does not close the + * input stream. * *

    In the case where end of stream is reached before {@code len} bytes * have been read, then the actual number of bytes read will be returned. This fix would be very consistent with other `read` methods of the class. I'd be happy to write a comprehensive test for the whole thing. Thanks. -Pavel > On 23 Apr 2015, at 10:01, Chris Hegarty wrote: > > A while back when we added the long overdue java.io.InputStream.transferTo method, there was support for adding a blocking bulk read operation. This has been sitting in a branch in the sandbox since then. I would like to revive it with the intention of bringing it into 9. The motivation for this addition is provide library support for a common pattern found when reading from input streams. > > /** > * Reads some bytes from the input stream into the given byte array. This > * method blocks until {@code len} bytes of input data have been read, or > * end of stream is detected. The number of bytes actually read, possibly > * zero, is returned. This method does not close the input stream. > * > *

    In the case where end of stream is reached before {@code len} bytes > * have been read, then the actual number of bytes read will be returned. > * When this stream reaches end of stream, further invocations of this > * method will return zero. > * > *

    If {@code len} is zero, then no bytes are read and {@code 0} is > * returned; otherwise, there is an attempt to read up to {@code len} bytes. > * > *

    The first byte read is stored into element {@code b[off]}, the next > * one in to {@code b[off+1]}, and so on. The number of bytes read is, at > * most, equal to {@code len}. Let k be the number of bytes actually > * read; these bytes will be stored in elements {@code b[off]} through > * {@code b[off+}k{@code -1]}, leaving elements {@code b[off+}k > * {@code ]} through {@code b[off+len-1]} unaffected. > * > *

    In every case, elements {@code b[0]} through {@code b[off]} and > * elements{@code b[off+len]} through {@code b[b.length-1]} are unaffected. > * > *

    The behavior for the case where the input stream is asynchronously > * closed, or the thread interrupted during the read, is highly input > * stream specific, and therefore not specified. > * > *

    If an I/O error occurs reading from the input stream, then it may do > * so after some bytes have been read. Consequently the input stream may be > * in an inconsistent state. It is strongly recommended that the stream be > * promptly closed if an I/O error occurs. > * > * @param b the buffer into which the data is read > * @param off the start offset in {@code b} at which the data is written > * @param len the maximum number of bytes to read > * @return the actual number of bytes read into the buffer > * @throws IOException if an I/O error occurs > * @throws NullPointerException if {@code b} is {@code null} > * @throws IndexOutOfBoundsException If {@code off} is negative, {@code len} > * is negative, or {@code len} is greater than {@code b.length - off} > * > * @since 1.9 > */ > public int readBytes(byte[] b, int off, int len) throws IOException { > Objects.requireNonNull(b); > if (off < 0 || len < 0 || len > b.length - off) > throw new IndexOutOfBoundsException(); > int n = 0; > while (n < len) { > int count = read(b, off + n, len - n); > if (count < 0) > break; > n += count; > } > return n; > } > > -Chris. From forax at univ-mlv.fr Thu Apr 23 12:22:18 2015 From: forax at univ-mlv.fr (Remi Forax) Date: Thu, 23 Apr 2015 14:22:18 +0200 Subject: RFR [9] Add blocking bulk read to java.io.InputStream In-Reply-To: References: Message-ID: <5538E3FA.6020003@univ-mlv.fr> I think the name readBytes is not very informative and the name is too close to read + an array of bytes, we can not use readFully (from DataInput/DataInputStream) because instead of returning the number of bytes read, it throws a EOFException if the end of the stream is reached. so what about readAllBytes ? (There is also a readAllBytes in java.nio.file.Files that has an equivalent semantics). regards, R?mi On 04/23/2015 11:01 AM, Chris Hegarty wrote: > A while back when we added the long overdue java.io.InputStream.transferTo method, there was support for adding a blocking bulk read operation. This has been sitting in a branch in the sandbox since then. I would like to revive it with the intention of bringing it into 9. The motivation for this addition is provide library support for a common pattern found when reading from input streams. > > /** > * Reads some bytes from the input stream into the given byte array. This > * method blocks until {@code len} bytes of input data have been read, or > * end of stream is detected. The number of bytes actually read, possibly > * zero, is returned. This method does not close the input stream. > * > *

    In the case where end of stream is reached before {@code len} bytes > * have been read, then the actual number of bytes read will be returned. > * When this stream reaches end of stream, further invocations of this > * method will return zero. > * > *

    If {@code len} is zero, then no bytes are read and {@code 0} is > * returned; otherwise, there is an attempt to read up to {@code len} bytes. > * > *

    The first byte read is stored into element {@code b[off]}, the next > * one in to {@code b[off+1]}, and so on. The number of bytes read is, at > * most, equal to {@code len}. Let k be the number of bytes actually > * read; these bytes will be stored in elements {@code b[off]} through > * {@code b[off+}k{@code -1]}, leaving elements {@code b[off+}k > * {@code ]} through {@code b[off+len-1]} unaffected. > * > *

    In every case, elements {@code b[0]} through {@code b[off]} and > * elements{@code b[off+len]} through {@code b[b.length-1]} are unaffected. > * > *

    The behavior for the case where the input stream is asynchronously > * closed, or the thread interrupted during the read, is highly input > * stream specific, and therefore not specified. > * > *

    If an I/O error occurs reading from the input stream, then it may do > * so after some bytes have been read. Consequently the input stream may be > * in an inconsistent state. It is strongly recommended that the stream be > * promptly closed if an I/O error occurs. > * > * @param b the buffer into which the data is read > * @param off the start offset in {@code b} at which the data is written > * @param len the maximum number of bytes to read > * @return the actual number of bytes read into the buffer > * @throws IOException if an I/O error occurs > * @throws NullPointerException if {@code b} is {@code null} > * @throws IndexOutOfBoundsException If {@code off} is negative, {@code len} > * is negative, or {@code len} is greater than {@code b.length - off} > * > * @since 1.9 > */ > public int readBytes(byte[] b, int off, int len) throws IOException { > Objects.requireNonNull(b); > if (off < 0 || len < 0 || len > b.length - off) > throw new IndexOutOfBoundsException(); > int n = 0; > while (n < len) { > int count = read(b, off + n, len - n); > if (count < 0) > break; > n += count; > } > return n; > } > > -Chris. From paul.sandoz at oracle.com Thu Apr 23 13:00:17 2015 From: paul.sandoz at oracle.com (Paul Sandoz) Date: Thu, 23 Apr 2015 15:00:17 +0200 Subject: RFR 8078490: Missed submissions in ForkJoinPool Message-ID: <48CBE8FC-60AF-4D53-B268-FB4BED6B4511@oracle.com> Hi. Please review this patch from Doug that fixes an issue where a submitted task to a f/j pool never gets executed. http://cr.openjdk.java.net/~psandoz/jdk9/JDK-8078490-fj-missed-submissions/webrev/ I already counted myself and Alexey as reviewers. The issue manifests itself under certain conditions where by a task is submitted to a ForkJoinPool of a certain size and that task is not joined. In ForkJoin.externalPush a release write is too weak and needs to be straightened to a volatile write, which stamps in a memory fence before signalling that there is work to be performed. I anticipate Doug will provide a clearer fix at some point in the future. This fix is sufficient for now and for backporting to 8u60. Paul. From chris.hegarty at oracle.com Thu Apr 23 13:23:52 2015 From: chris.hegarty at oracle.com (Chris Hegarty) Date: Thu, 23 Apr 2015 14:23:52 +0100 Subject: RFR 8078490: Missed submissions in ForkJoinPool In-Reply-To: <48CBE8FC-60AF-4D53-B268-FB4BED6B4511@oracle.com> References: <48CBE8FC-60AF-4D53-B268-FB4BED6B4511@oracle.com> Message-ID: Thanks for bringing this in Paul. The change looks ok to me, and suitable for backport. Trivially, the test does not need the Classpath exception in its license header. -Chris. On 23 Apr 2015, at 14:00, Paul Sandoz wrote: > Hi. > > Please review this patch from Doug that fixes an issue where a submitted task to a f/j pool never gets executed. > > http://cr.openjdk.java.net/~psandoz/jdk9/JDK-8078490-fj-missed-submissions/webrev/ > > I already counted myself and Alexey as reviewers. > > The issue manifests itself under certain conditions where by a task is submitted to a ForkJoinPool of a certain size and that task is not joined. In ForkJoin.externalPush a release write is too weak and needs to be straightened to a volatile write, which stamps in a memory fence before signalling that there is work to be performed. > > I anticipate Doug will provide a clearer fix at some point in the future. This fix is sufficient for now and for backporting to 8u60. > > Paul. From paul.sandoz at oracle.com Thu Apr 23 13:33:26 2015 From: paul.sandoz at oracle.com (Paul Sandoz) Date: Thu, 23 Apr 2015 15:33:26 +0200 Subject: RFR 8078490: Missed submissions in ForkJoinPool In-Reply-To: References: <48CBE8FC-60AF-4D53-B268-FB4BED6B4511@oracle.com> Message-ID: On Apr 23, 2015, at 3:23 PM, Chris Hegarty wrote: > Thanks for bringing this in Paul. The change looks ok to me, and suitable for backport. > > Trivially, the test does not need the Classpath exception in its license header. > Doh, thanks, updated locally. When i create a new class the IDE automatically adds the license header for JDK source files, but i wonder if i can configure it to distinguish between source and test source locations... Paul. From peter.levart at gmail.com Thu Apr 23 14:20:47 2015 From: peter.levart at gmail.com (Peter Levart) Date: Thu, 23 Apr 2015 16:20:47 +0200 Subject: RFR [9] Add blocking bulk read to java.io.InputStream In-Reply-To: References: Message-ID: <5538FFBF.4080305@gmail.com> Hi Chris, Currently InputStream guarantees that either some bytes are read *xor* EOF (-1) is returned *xor* IOException is thrown. Even with default implementation of read(byte[], int, int) which is implemented in terms of int read(). This new method can throw IOException after some bytes have successfully been read from stream and the caller does not get to know how many. Would something like the following make any more sense? public int readBytes(byte[] b, int off, int len) throws IOException { Objects.requireNonNull(b); if (off < 0 || len < 0 || len > b.length - off) throw new IndexOutOfBoundsException(); int n = 0; while (n < len) { int count; try { count = read(b, off + n, len - n); } catch (IOException e) { if (n == 0) { throw e; } else { throw new IncompleteReadBytesException(e, n); } } if (count < 0) break; n += count; } return n; } /** * Thrown from {@link #readBytes(byte[], int, int)} when at least one byte * has successfully been read from stream into the byte buffer when IOException * was thrown. */ public static class IncompleteReadBytesException extends IOException { private final int bytesRead; public IncompleteReadBytesException(IOException cause, int bytesRead) { super(cause); this.bytesRead = bytesRead; } /** * @return number of bytes read successfully from stream into byte array * before exception was thrown. */ public int getBytesRead() { return bytesRead; } } Regards, Peter On 04/23/2015 11:01 AM, Chris Hegarty wrote: > A while back when we added the long overdue java.io.InputStream.transferTo method, there was support for adding a blocking bulk read operation. This has been sitting in a branch in the sandbox since then. I would like to revive it with the intention of bringing it into 9. The motivation for this addition is provide library support for a common pattern found when reading from input streams. > > /** > * Reads some bytes from the input stream into the given byte array. This > * method blocks until {@code len} bytes of input data have been read, or > * end of stream is detected. The number of bytes actually read, possibly > * zero, is returned. This method does not close the input stream. > * > *

    In the case where end of stream is reached before {@code len} bytes > * have been read, then the actual number of bytes read will be returned. > * When this stream reaches end of stream, further invocations of this > * method will return zero. > * > *

    If {@code len} is zero, then no bytes are read and {@code 0} is > * returned; otherwise, there is an attempt to read up to {@code len} bytes. > * > *

    The first byte read is stored into element {@code b[off]}, the next > * one in to {@code b[off+1]}, and so on. The number of bytes read is, at > * most, equal to {@code len}. Let k be the number of bytes actually > * read; these bytes will be stored in elements {@code b[off]} through > * {@code b[off+}k{@code -1]}, leaving elements {@code b[off+}k > * {@code ]} through {@code b[off+len-1]} unaffected. > * > *

    In every case, elements {@code b[0]} through {@code b[off]} and > * elements{@code b[off+len]} through {@code b[b.length-1]} are unaffected. > * > *

    The behavior for the case where the input stream is asynchronously > * closed, or the thread interrupted during the read, is highly input > * stream specific, and therefore not specified. > * > *

    If an I/O error occurs reading from the input stream, then it may do > * so after some bytes have been read. Consequently the input stream may be > * in an inconsistent state. It is strongly recommended that the stream be > * promptly closed if an I/O error occurs. > * > * @param b the buffer into which the data is read > * @param off the start offset in {@code b} at which the data is written > * @param len the maximum number of bytes to read > * @return the actual number of bytes read into the buffer > * @throws IOException if an I/O error occurs > * @throws NullPointerException if {@code b} is {@code null} > * @throws IndexOutOfBoundsException If {@code off} is negative, {@code len} > * is negative, or {@code len} is greater than {@code b.length - off} > * > * @since 1.9 > */ > public int readBytes(byte[] b, int off, int len) throws IOException { > Objects.requireNonNull(b); > if (off < 0 || len < 0 || len > b.length - off) > throw new IndexOutOfBoundsException(); > int n = 0; > while (n < len) { > int count = read(b, off + n, len - n); > if (count < 0) > break; > n += count; > } > return n; > } > > -Chris. From david.lloyd at redhat.com Thu Apr 23 14:30:06 2015 From: david.lloyd at redhat.com (David M. Lloyd) Date: Thu, 23 Apr 2015 09:30:06 -0500 Subject: RFR [9] Add blocking bulk read to java.io.InputStream In-Reply-To: <5538FFBF.4080305@gmail.com> References: <5538FFBF.4080305@gmail.com> Message-ID: <553901EE.1010702@redhat.com> I believe this is similar to how InterruptedIOException works, FWIW. On 04/23/2015 09:20 AM, Peter Levart wrote: > Hi Chris, > > Currently InputStream guarantees that either some bytes are read *xor* > EOF (-1) is returned *xor* IOException is thrown. Even with default > implementation of read(byte[], int, int) which is implemented in terms > of int read(). This new method can throw IOException after some bytes > have successfully been read from stream and the caller does not get to > know how many. Would something like the following make any more sense? > > public int readBytes(byte[] b, int off, int len) throws IOException { > Objects.requireNonNull(b); > if (off < 0 || len < 0 || len > b.length - off) > throw new IndexOutOfBoundsException(); > int n = 0; > while (n < len) { > int count; > try { > count = read(b, off + n, len - n); > } catch (IOException e) { > if (n == 0) { > throw e; > } else { > throw new IncompleteReadBytesException(e, n); > } > } > if (count < 0) > break; > n += count; > } > return n; > } > > /** > * Thrown from {@link #readBytes(byte[], int, int)} when at least > one byte > * has successfully been read from stream into the byte buffer when > IOException > * was thrown. > */ > public static class IncompleteReadBytesException extends IOException { > private final int bytesRead; > > public IncompleteReadBytesException(IOException cause, int > bytesRead) { > super(cause); > this.bytesRead = bytesRead; > } > > /** > * @return number of bytes read successfully from stream into > byte array > * before exception was thrown. > */ > public int getBytesRead() { > return bytesRead; > } > } > > > Regards, Peter > > > On 04/23/2015 11:01 AM, Chris Hegarty wrote: >> A while back when we added the long overdue >> java.io.InputStream.transferTo method, there was support for adding a >> blocking bulk read operation. This has been sitting in a branch in the >> sandbox since then. I would like to revive it with the intention of >> bringing it into 9. The motivation for this addition is provide >> library support for a common pattern found when reading from input >> streams. >> >> /** >> * Reads some bytes from the input stream into the given byte array. >> This >> * method blocks until {@code len} bytes of input data have been >> read, or >> * end of stream is detected. The number of bytes actually read, >> possibly >> * zero, is returned. This method does not close the input stream. >> * >> *

    In the case where end of stream is reached before {@code len} >> bytes >> * have been read, then the actual number of bytes read will be >> returned. >> * When this stream reaches end of stream, further invocations of this >> * method will return zero. >> * >> *

    If {@code len} is zero, then no bytes are read and {@code 0} is >> * returned; otherwise, there is an attempt to read up to {@code len} >> bytes. >> * >> *

    The first byte read is stored into element {@code b[off]}, the >> next >> * one in to {@code b[off+1]}, and so on. The number of bytes read >> is, at >> * most, equal to {@code len}. Let k be the number of bytes >> actually >> * read; these bytes will be stored in elements {@code b[off]} through >> * {@code b[off+}k{@code -1]}, leaving elements {@code >> b[off+}k >> * {@code ]} through {@code b[off+len-1]} unaffected. >> * >> *

    In every case, elements {@code b[0]} through {@code b[off]} and >> * elements{@code b[off+len]} through {@code b[b.length-1]} are >> unaffected. >> * >> *

    The behavior for the case where the input stream is >> asynchronously >> * closed, or the thread interrupted during the read, is highly >> input >> * stream specific, and therefore not specified. >> * >> *

    If an I/O error occurs reading from the input stream, then it >> may do >> * so after some bytes have been read. Consequently the input stream >> may be >> * in an inconsistent state. It is strongly recommended that the >> stream be >> * promptly closed if an I/O error occurs. >> * >> * @param b the buffer into which the data is read >> * @param off the start offset in {@code b} at which the data is >> written >> * @param len the maximum number of bytes to read >> * @return the actual number of bytes read into the buffer >> * @throws IOException if an I/O error occurs >> * @throws NullPointerException if {@code b} is {@code null} >> * @throws IndexOutOfBoundsException If {@code off} is negative, >> {@code len} >> * is negative, or {@code len} is greater than {@code >> b.length - off} >> * >> * @since 1.9 >> */ >> public int readBytes(byte[] b, int off, int len) throws IOException { >> Objects.requireNonNull(b); >> if (off < 0 || len < 0 || len > b.length - off) >> throw new IndexOutOfBoundsException(); >> int n = 0; >> while (n < len) { >> int count = read(b, off + n, len - n); >> if (count < 0) >> break; >> n += count; >> } >> return n; >> } >> >> -Chris. > -- - DML From Alan.Bateman at oracle.com Thu Apr 23 14:41:09 2015 From: Alan.Bateman at oracle.com (Alan Bateman) Date: Thu, 23 Apr 2015 15:41:09 +0100 Subject: RFR [9] Add blocking bulk read to java.io.InputStream In-Reply-To: <5538E3FA.6020003@univ-mlv.fr> References: <5538E3FA.6020003@univ-mlv.fr> Message-ID: <55390485.1030401@oracle.com> On 23/04/2015 13:22, Remi Forax wrote: > I think the name readBytes is not very informative and the name is too > close to read + an array of bytes, > we can not use readFully (from DataInput/DataInputStream) because > instead of returning the number of bytes read, it throws a > EOFException if the end of the stream is reached. > > so what about readAllBytes ? > (There is also a readAllBytes in java.nio.file.Files that has an > equivalent semantics). For pure convenience then a readAllBytes() that returns a byte[] would be useful. It avoids all the issues around short reads too, and of course easy to specify that the input stream would be left in an inconsistent state if there are any exceptions thrown. -Alan From chris.hegarty at oracle.com Thu Apr 23 14:50:51 2015 From: chris.hegarty at oracle.com (Chris Hegarty) Date: Thu, 23 Apr 2015 15:50:51 +0100 Subject: RFR [9] Add blocking bulk read to java.io.InputStream In-Reply-To: <5538FFBF.4080305@gmail.com> References: <5538FFBF.4080305@gmail.com> Message-ID: <738EEB07-875D-48F4-BBFF-6DA8D52F7A99@oracle.com> Peter, Ah, good point. Do we really need a new Exception type for this, is this information really that useful? How can you recover? What if this error condition was better cover in the API. *

    If an I/O error occurs reading from the input stream, then it may do * so after some, but not all, bytes of {@code b} have been updated with * data from the input stream. Consequently the input stream and {@code b} * may be in an inconsistent state. It is strongly recommended that the * stream be promptly closed if an I/O error occurs. -Chris. On 23 Apr 2015, at 15:20, Peter Levart wrote: > Hi Chris, > > Currently InputStream guarantees that either some bytes are read *xor* EOF (-1) is returned *xor* IOException is thrown. Even with default implementation of read(byte[], int, int) which is implemented in terms of int read(). This new method can throw IOException after some bytes have successfully been read from stream and the caller does not get to know how many. Would something like the following make any more sense? > > public int readBytes(byte[] b, int off, int len) throws IOException { > Objects.requireNonNull(b); > if (off < 0 || len < 0 || len > b.length - off) > throw new IndexOutOfBoundsException(); > int n = 0; > while (n < len) { > int count; > try { > count = read(b, off + n, len - n); > } catch (IOException e) { > if (n == 0) { > throw e; > } else { > throw new IncompleteReadBytesException(e, n); > } > } > if (count < 0) > break; > n += count; > } > return n; > } > > /** > * Thrown from {@link #readBytes(byte[], int, int)} when at least one byte > * has successfully been read from stream into the byte buffer when IOException > * was thrown. > */ > public static class IncompleteReadBytesException extends IOException { > private final int bytesRead; > > public IncompleteReadBytesException(IOException cause, int bytesRead) { > super(cause); > this.bytesRead = bytesRead; > } > > /** > * @return number of bytes read successfully from stream into byte array > * before exception was thrown. > */ > public int getBytesRead() { > return bytesRead; > } > } > > > Regards, Peter > > > On 04/23/2015 11:01 AM, Chris Hegarty wrote: >> A while back when we added the long overdue java.io.InputStream.transferTo method, there was support for adding a blocking bulk read operation. This has been sitting in a branch in the sandbox since then. I would like to revive it with the intention of bringing it into 9. The motivation for this addition is provide library support for a common pattern found when reading from input streams. >> >> /** >> * Reads some bytes from the input stream into the given byte array. This >> * method blocks until {@code len} bytes of input data have been read, or >> * end of stream is detected. The number of bytes actually read, possibly >> * zero, is returned. This method does not close the input stream. >> * >> *

    In the case where end of stream is reached before {@code len} bytes >> * have been read, then the actual number of bytes read will be returned. >> * When this stream reaches end of stream, further invocations of this >> * method will return zero. >> * >> *

    If {@code len} is zero, then no bytes are read and {@code 0} is >> * returned; otherwise, there is an attempt to read up to {@code len} bytes. >> * >> *

    The first byte read is stored into element {@code b[off]}, the next >> * one in to {@code b[off+1]}, and so on. The number of bytes read is, at >> * most, equal to {@code len}. Let k be the number of bytes actually >> * read; these bytes will be stored in elements {@code b[off]} through >> * {@code b[off+}k{@code -1]}, leaving elements {@code b[off+}k >> * {@code ]} through {@code b[off+len-1]} unaffected. >> * >> *

    In every case, elements {@code b[0]} through {@code b[off]} and >> * elements{@code b[off+len]} through {@code b[b.length-1]} are unaffected. >> * >> *

    The behavior for the case where the input stream is asynchronously >> * closed, or the thread interrupted during the read, is highly input >> * stream specific, and therefore not specified. >> * >> *

    If an I/O error occurs reading from the input stream, then it may do >> * so after some bytes have been read. Consequently the input stream may be >> * in an inconsistent state. It is strongly recommended that the stream be >> * promptly closed if an I/O error occurs. >> * >> * @param b the buffer into which the data is read >> * @param off the start offset in {@code b} at which the data is written >> * @param len the maximum number of bytes to read >> * @return the actual number of bytes read into the buffer >> * @throws IOException if an I/O error occurs >> * @throws NullPointerException if {@code b} is {@code null} >> * @throws IndexOutOfBoundsException If {@code off} is negative, {@code len} >> * is negative, or {@code len} is greater than {@code b.length - off} >> * >> * @since 1.9 >> */ >> public int readBytes(byte[] b, int off, int len) throws IOException { >> Objects.requireNonNull(b); >> if (off < 0 || len < 0 || len > b.length - off) >> throw new IndexOutOfBoundsException(); >> int n = 0; >> while (n < len) { >> int count = read(b, off + n, len - n); >> if (count < 0) >> break; >> n += count; >> } >> return n; >> } >> >> -Chris. >> > From vladimir.x.ivanov at oracle.com Thu Apr 23 15:12:35 2015 From: vladimir.x.ivanov at oracle.com (Vladimir Ivanov) Date: Thu, 23 Apr 2015 18:12:35 +0300 Subject: [9] RFR (XS): 8059455: LambdaForm.prepare() does unnecessary work for cached LambdaForms Message-ID: <55390BE3.8000901@oracle.com> https://bugs.openjdk.java.net/browse/JDK-8059455 http://cr.openjdk.java.net/~vlivanov/8059455/webrev.00/ LambdaForm.compileToBytecode() does unnecessary work (constructs invokerType & check an assertion) before ensuring that LambdaForm hasn't been already compiled. It happens very often for cached LambdaForms. The fix is to do the check first. Testing: failed VM tests (timeouts) Best regards, Vladimir Ivanov From paul.sandoz at oracle.com Thu Apr 23 15:30:39 2015 From: paul.sandoz at oracle.com (Paul Sandoz) Date: Thu, 23 Apr 2015 17:30:39 +0200 Subject: [9] RFR (XS): 8059455: LambdaForm.prepare() does unnecessary work for cached LambdaForms In-Reply-To: <55390BE3.8000901@oracle.com> References: <55390BE3.8000901@oracle.com> Message-ID: <037C50B5-AA8E-41E6-BEC4-83935A0484F5@oracle.com> On Apr 23, 2015, at 5:12 PM, Vladimir Ivanov wrote: > https://bugs.openjdk.java.net/browse/JDK-8059455 > http://cr.openjdk.java.net/~vlivanov/8059455/webrev.00/ > > LambdaForm.compileToBytecode() does unnecessary work (constructs invokerType & check an assertion) before ensuring that LambdaForm hasn't been already compiled. It happens very often for cached LambdaForms. > > The fix is to do the check first. > +1 Paul. > Testing: failed VM tests (timeouts) > > Best regards, > Vladimir Ivanov From ecki at zusammenkunft.net Thu Apr 23 15:58:03 2015 From: ecki at zusammenkunft.net (Bernd Eckenfels) Date: Thu, 23 Apr 2015 17:58:03 +0200 Subject: RFR [9] Add blocking bulk read to java.io.InputStream In-Reply-To: <8D0A349E-4F53-490A-AE18-40ECEA3B72D3@oracle.com> References: <8D0A349E-4F53-490A-AE18-40ECEA3B72D3@oracle.com> Message-ID: <4BD653BF-AE8F-4ACB-AA4F-E4C753E2720E@zusammenkunft.net> Hello, I would use the already established name readFully(byte[]) and readFully(byte[],int,int) to be consistent with DataInputStream. Gruss Bernd From peter.levart at gmail.com Thu Apr 23 16:06:37 2015 From: peter.levart at gmail.com (Peter Levart) Date: Thu, 23 Apr 2015 18:06:37 +0200 Subject: RFR [9] Add blocking bulk read to java.io.InputStream In-Reply-To: <553901EE.1010702@redhat.com> References: <5538FFBF.4080305@gmail.com> <553901EE.1010702@redhat.com> Message-ID: <5539188D.3090708@gmail.com> Right you are, David. So this exception could be reused albeit the cause of "interruption" can be arbitrary IOException thrown in the midst of two read() calls. But the caller need not care as the outcome is the same. Regards, Peter On 04/23/2015 04:30 PM, David M. Lloyd wrote: > I believe this is similar to how InterruptedIOException works, FWIW. > > On 04/23/2015 09:20 AM, Peter Levart wrote: >> Hi Chris, >> >> Currently InputStream guarantees that either some bytes are read *xor* >> EOF (-1) is returned *xor* IOException is thrown. Even with default >> implementation of read(byte[], int, int) which is implemented in terms >> of int read(). This new method can throw IOException after some bytes >> have successfully been read from stream and the caller does not get to >> know how many. Would something like the following make any more sense? >> >> public int readBytes(byte[] b, int off, int len) throws >> IOException { >> Objects.requireNonNull(b); >> if (off < 0 || len < 0 || len > b.length - off) >> throw new IndexOutOfBoundsException(); >> int n = 0; >> while (n < len) { >> int count; >> try { >> count = read(b, off + n, len - n); >> } catch (IOException e) { >> if (n == 0) { >> throw e; >> } else { >> throw new IncompleteReadBytesException(e, n); >> } >> } >> if (count < 0) >> break; >> n += count; >> } >> return n; >> } >> >> /** >> * Thrown from {@link #readBytes(byte[], int, int)} when at least >> one byte >> * has successfully been read from stream into the byte buffer when >> IOException >> * was thrown. >> */ >> public static class IncompleteReadBytesException extends >> IOException { >> private final int bytesRead; >> >> public IncompleteReadBytesException(IOException cause, int >> bytesRead) { >> super(cause); >> this.bytesRead = bytesRead; >> } >> >> /** >> * @return number of bytes read successfully from stream into >> byte array >> * before exception was thrown. >> */ >> public int getBytesRead() { >> return bytesRead; >> } >> } >> >> >> Regards, Peter >> >> >> On 04/23/2015 11:01 AM, Chris Hegarty wrote: >>> A while back when we added the long overdue >>> java.io.InputStream.transferTo method, there was support for adding a >>> blocking bulk read operation. This has been sitting in a branch in the >>> sandbox since then. I would like to revive it with the intention of >>> bringing it into 9. The motivation for this addition is provide >>> library support for a common pattern found when reading from input >>> streams. >>> >>> /** >>> * Reads some bytes from the input stream into the given byte array. >>> This >>> * method blocks until {@code len} bytes of input data have been >>> read, or >>> * end of stream is detected. The number of bytes actually read, >>> possibly >>> * zero, is returned. This method does not close the input stream. >>> * >>> *

    In the case where end of stream is reached before {@code len} >>> bytes >>> * have been read, then the actual number of bytes read will be >>> returned. >>> * When this stream reaches end of stream, further invocations of this >>> * method will return zero. >>> * >>> *

    If {@code len} is zero, then no bytes are read and {@code 0} is >>> * returned; otherwise, there is an attempt to read up to {@code len} >>> bytes. >>> * >>> *

    The first byte read is stored into element {@code b[off]}, the >>> next >>> * one in to {@code b[off+1]}, and so on. The number of bytes read >>> is, at >>> * most, equal to {@code len}. Let k be the number of bytes >>> actually >>> * read; these bytes will be stored in elements {@code b[off]} through >>> * {@code b[off+}k{@code -1]}, leaving elements {@code >>> b[off+}k >>> * {@code ]} through {@code b[off+len-1]} unaffected. >>> * >>> *

    In every case, elements {@code b[0]} through {@code b[off]} and >>> * elements{@code b[off+len]} through {@code b[b.length-1]} are >>> unaffected. >>> * >>> *

    The behavior for the case where the input stream is >>> asynchronously >>> * closed, or the thread interrupted during the read, is highly >>> input >>> * stream specific, and therefore not specified. >>> * >>> *

    If an I/O error occurs reading from the input stream, then it >>> may do >>> * so after some bytes have been read. Consequently the input stream >>> may be >>> * in an inconsistent state. It is strongly recommended that the >>> stream be >>> * promptly closed if an I/O error occurs. >>> * >>> * @param b the buffer into which the data is read >>> * @param off the start offset in {@code b} at which the data is >>> written >>> * @param len the maximum number of bytes to read >>> * @return the actual number of bytes read into the buffer >>> * @throws IOException if an I/O error occurs >>> * @throws NullPointerException if {@code b} is {@code null} >>> * @throws IndexOutOfBoundsException If {@code off} is negative, >>> {@code len} >>> * is negative, or {@code len} is greater than {@code >>> b.length - off} >>> * >>> * @since 1.9 >>> */ >>> public int readBytes(byte[] b, int off, int len) throws IOException { >>> Objects.requireNonNull(b); >>> if (off < 0 || len < 0 || len > b.length - off) >>> throw new IndexOutOfBoundsException(); >>> int n = 0; >>> while (n < len) { >>> int count = read(b, off + n, len - n); >>> if (count < 0) >>> break; >>> n += count; >>> } >>> return n; >>> } >>> >>> -Chris. >> > From peter.levart at gmail.com Thu Apr 23 16:10:37 2015 From: peter.levart at gmail.com (Peter Levart) Date: Thu, 23 Apr 2015 18:10:37 +0200 Subject: RFR [9] Add blocking bulk read to java.io.InputStream In-Reply-To: <738EEB07-875D-48F4-BBFF-6DA8D52F7A99@oracle.com> References: <5538FFBF.4080305@gmail.com> <738EEB07-875D-48F4-BBFF-6DA8D52F7A99@oracle.com> Message-ID: <5539197D.4000302@gmail.com> On 04/23/2015 04:50 PM, Chris Hegarty wrote: > Peter, > > Ah, good point. Do we really need a new Exception type for this, is this information really that useful? How can you recover? > > What if this error condition was better cover in the API. > > *

    If an I/O error occurs reading from the input stream, then it may do > * so after some, but not all, bytes of {@code b} have been updated with > * data from the input stream. Consequently the input stream and {@code b} > * may be in an inconsistent state. It is strongly recommended that the > * stream be promptly closed if an I/O error occurs. > > -Chris. Right. Either that or special exception. Perhaps this utility method can be meant for those uses where the caller doesn't care and if she does, she must roll her own loop... Peter > > On 23 Apr 2015, at 15:20, Peter Levart wrote: > >> Hi Chris, >> >> Currently InputStream guarantees that either some bytes are read *xor* EOF (-1) is returned *xor* IOException is thrown. Even with default implementation of read(byte[], int, int) which is implemented in terms of int read(). This new method can throw IOException after some bytes have successfully been read from stream and the caller does not get to know how many. Would something like the following make any more sense? >> >> public int readBytes(byte[] b, int off, int len) throws IOException { >> Objects.requireNonNull(b); >> if (off < 0 || len < 0 || len > b.length - off) >> throw new IndexOutOfBoundsException(); >> int n = 0; >> while (n < len) { >> int count; >> try { >> count = read(b, off + n, len - n); >> } catch (IOException e) { >> if (n == 0) { >> throw e; >> } else { >> throw new IncompleteReadBytesException(e, n); >> } >> } >> if (count < 0) >> break; >> n += count; >> } >> return n; >> } >> >> /** >> * Thrown from {@link #readBytes(byte[], int, int)} when at least one byte >> * has successfully been read from stream into the byte buffer when IOException >> * was thrown. >> */ >> public static class IncompleteReadBytesException extends IOException { >> private final int bytesRead; >> >> public IncompleteReadBytesException(IOException cause, int bytesRead) { >> super(cause); >> this.bytesRead = bytesRead; >> } >> >> /** >> * @return number of bytes read successfully from stream into byte array >> * before exception was thrown. >> */ >> public int getBytesRead() { >> return bytesRead; >> } >> } >> >> >> Regards, Peter >> >> >> On 04/23/2015 11:01 AM, Chris Hegarty wrote: >>> A while back when we added the long overdue java.io.InputStream.transferTo method, there was support for adding a blocking bulk read operation. This has been sitting in a branch in the sandbox since then. I would like to revive it with the intention of bringing it into 9. The motivation for this addition is provide library support for a common pattern found when reading from input streams. >>> >>> /** >>> * Reads some bytes from the input stream into the given byte array. This >>> * method blocks until {@code len} bytes of input data have been read, or >>> * end of stream is detected. The number of bytes actually read, possibly >>> * zero, is returned. This method does not close the input stream. >>> * >>> *

    In the case where end of stream is reached before {@code len} bytes >>> * have been read, then the actual number of bytes read will be returned. >>> * When this stream reaches end of stream, further invocations of this >>> * method will return zero. >>> * >>> *

    If {@code len} is zero, then no bytes are read and {@code 0} is >>> * returned; otherwise, there is an attempt to read up to {@code len} bytes. >>> * >>> *

    The first byte read is stored into element {@code b[off]}, the next >>> * one in to {@code b[off+1]}, and so on. The number of bytes read is, at >>> * most, equal to {@code len}. Let k be the number of bytes actually >>> * read; these bytes will be stored in elements {@code b[off]} through >>> * {@code b[off+}k{@code -1]}, leaving elements {@code b[off+}k >>> * {@code ]} through {@code b[off+len-1]} unaffected. >>> * >>> *

    In every case, elements {@code b[0]} through {@code b[off]} and >>> * elements{@code b[off+len]} through {@code b[b.length-1]} are unaffected. >>> * >>> *

    The behavior for the case where the input stream is asynchronously >>> * closed, or the thread interrupted during the read, is highly input >>> * stream specific, and therefore not specified. >>> * >>> *

    If an I/O error occurs reading from the input stream, then it may do >>> * so after some bytes have been read. Consequently the input stream may be >>> * in an inconsistent state. It is strongly recommended that the stream be >>> * promptly closed if an I/O error occurs. >>> * >>> * @param b the buffer into which the data is read >>> * @param off the start offset in {@code b} at which the data is written >>> * @param len the maximum number of bytes to read >>> * @return the actual number of bytes read into the buffer >>> * @throws IOException if an I/O error occurs >>> * @throws NullPointerException if {@code b} is {@code null} >>> * @throws IndexOutOfBoundsException If {@code off} is negative, {@code len} >>> * is negative, or {@code len} is greater than {@code b.length - off} >>> * >>> * @since 1.9 >>> */ >>> public int readBytes(byte[] b, int off, int len) throws IOException { >>> Objects.requireNonNull(b); >>> if (off < 0 || len < 0 || len > b.length - off) >>> throw new IndexOutOfBoundsException(); >>> int n = 0; >>> while (n < len) { >>> int count = read(b, off + n, len - n); >>> if (count < 0) >>> break; >>> n += count; >>> } >>> return n; >>> } >>> >>> -Chris. >>> From chris.hegarty at oracle.com Thu Apr 23 16:16:52 2015 From: chris.hegarty at oracle.com (Chris Hegarty) Date: Thu, 23 Apr 2015 17:16:52 +0100 Subject: RFR [9] Add blocking bulk read to java.io.InputStream In-Reply-To: <5539197D.4000302@gmail.com> References: <5538FFBF.4080305@gmail.com> <738EEB07-875D-48F4-BBFF-6DA8D52F7A99@oracle.com> <5539197D.4000302@gmail.com> Message-ID: On 23 Apr 2015, at 17:10, Peter Levart wrote: > On 04/23/2015 04:50 PM, Chris Hegarty wrote: >> Peter, >> >> Ah, good point. Do we really need a new Exception type for this, is this information really that useful? How can you recover? >> >> What if this error condition was better cover in the API. >> >> *

    If an I/O error occurs reading from the input stream, then it may do >> * so after some, but not all, bytes of {@code b} have been updated with >> * data from the input stream. Consequently the input stream and {@code b} >> * may be in an inconsistent state. It is strongly recommended that the >> * stream be promptly closed if an I/O error occurs. >> >> -Chris. > > Right. Either that or special exception. Perhaps this utility method can be meant for those uses where the caller doesn't care and if she does, she must roll her own loop? Right. I think simple is best here. The pattern in the implementation occurs many times in real world code. This method is attempting to provide that to developers so that they don?t have to roll there own ( and risk getting it wrong ). But if you need something more sophisticated, then you can write it yourself. -Chris. > Peter > >> >> On 23 Apr 2015, at 15:20, Peter Levart wrote: >> >>> Hi Chris, >>> >>> Currently InputStream guarantees that either some bytes are read *xor* EOF (-1) is returned *xor* IOException is thrown. Even with default implementation of read(byte[], int, int) which is implemented in terms of int read(). This new method can throw IOException after some bytes have successfully been read from stream and the caller does not get to know how many. Would something like the following make any more sense? >>> >>> public int readBytes(byte[] b, int off, int len) throws IOException { >>> Objects.requireNonNull(b); >>> if (off < 0 || len < 0 || len > b.length - off) >>> throw new IndexOutOfBoundsException(); >>> int n = 0; >>> while (n < len) { >>> int count; >>> try { >>> count = read(b, off + n, len - n); >>> } catch (IOException e) { >>> if (n == 0) { >>> throw e; >>> } else { >>> throw new IncompleteReadBytesException(e, n); >>> } >>> } >>> if (count < 0) >>> break; >>> n += count; >>> } >>> return n; >>> } >>> >>> /** >>> * Thrown from {@link #readBytes(byte[], int, int)} when at least one byte >>> * has successfully been read from stream into the byte buffer when IOException >>> * was thrown. >>> */ >>> public static class IncompleteReadBytesException extends IOException { >>> private final int bytesRead; >>> public IncompleteReadBytesException(IOException cause, int bytesRead) { >>> super(cause); >>> this.bytesRead = bytesRead; >>> } >>> >>> /** >>> * @return number of bytes read successfully from stream into byte array >>> * before exception was thrown. >>> */ >>> public int getBytesRead() { >>> return bytesRead; >>> } >>> } >>> >>> >>> Regards, Peter >>> >>> >>> On 04/23/2015 11:01 AM, Chris Hegarty wrote: >>>> A while back when we added the long overdue java.io.InputStream.transferTo method, there was support for adding a blocking bulk read operation. This has been sitting in a branch in the sandbox since then. I would like to revive it with the intention of bringing it into 9. The motivation for this addition is provide library support for a common pattern found when reading from input streams. >>>> >>>> /** >>>> * Reads some bytes from the input stream into the given byte array. This >>>> * method blocks until {@code len} bytes of input data have been read, or >>>> * end of stream is detected. The number of bytes actually read, possibly >>>> * zero, is returned. This method does not close the input stream. >>>> * >>>> *

    In the case where end of stream is reached before {@code len} bytes >>>> * have been read, then the actual number of bytes read will be returned. >>>> * When this stream reaches end of stream, further invocations of this >>>> * method will return zero. >>>> * >>>> *

    If {@code len} is zero, then no bytes are read and {@code 0} is >>>> * returned; otherwise, there is an attempt to read up to {@code len} bytes. >>>> * >>>> *

    The first byte read is stored into element {@code b[off]}, the next >>>> * one in to {@code b[off+1]}, and so on. The number of bytes read is, at >>>> * most, equal to {@code len}. Let k be the number of bytes actually >>>> * read; these bytes will be stored in elements {@code b[off]} through >>>> * {@code b[off+}k{@code -1]}, leaving elements {@code b[off+}k >>>> * {@code ]} through {@code b[off+len-1]} unaffected. >>>> * >>>> *

    In every case, elements {@code b[0]} through {@code b[off]} and >>>> * elements{@code b[off+len]} through {@code b[b.length-1]} are unaffected. >>>> * >>>> *

    The behavior for the case where the input stream is asynchronously >>>> * closed, or the thread interrupted during the read, is highly input >>>> * stream specific, and therefore not specified. >>>> * >>>> *

    If an I/O error occurs reading from the input stream, then it may do >>>> * so after some bytes have been read. Consequently the input stream may be >>>> * in an inconsistent state. It is strongly recommended that the stream be >>>> * promptly closed if an I/O error occurs. >>>> * >>>> * @param b the buffer into which the data is read >>>> * @param off the start offset in {@code b} at which the data is written >>>> * @param len the maximum number of bytes to read >>>> * @return the actual number of bytes read into the buffer >>>> * @throws IOException if an I/O error occurs >>>> * @throws NullPointerException if {@code b} is {@code null} >>>> * @throws IndexOutOfBoundsException If {@code off} is negative, {@code len} >>>> * is negative, or {@code len} is greater than {@code b.length - off} >>>> * >>>> * @since 1.9 >>>> */ >>>> public int readBytes(byte[] b, int off, int len) throws IOException { >>>> Objects.requireNonNull(b); >>>> if (off < 0 || len < 0 || len > b.length - off) >>>> throw new IndexOutOfBoundsException(); >>>> int n = 0; >>>> while (n < len) { >>>> int count = read(b, off + n, len - n); >>>> if (count < 0) >>>> break; >>>> n += count; >>>> } >>>> return n; >>>> } >>>> >>>> -Chris. >>>> > From chris.hegarty at oracle.com Thu Apr 23 16:21:46 2015 From: chris.hegarty at oracle.com (Chris Hegarty) Date: Thu, 23 Apr 2015 17:21:46 +0100 Subject: RFR [9] Add blocking bulk read to java.io.InputStream In-Reply-To: <4BD653BF-AE8F-4ACB-AA4F-E4C753E2720E@zusammenkunft.net> References: <8D0A349E-4F53-490A-AE18-40ECEA3B72D3@oracle.com> <4BD653BF-AE8F-4ACB-AA4F-E4C753E2720E@zusammenkunft.net> Message-ID: <9DD30BB8-5573-4325-B934-FD8F575D7031@oracle.com> On 23 Apr 2015, at 16:58, Bernd Eckenfels wrote: > Hello, > > I would use the already established name readFully(byte[]) and readFully(byte[],int,int) to be consistent with DataInputStream. I purposefully stayed away from the name ?readFully' as the spec for DataInputStream.readFully and the proposed InputStream.readBytes differs. The latter does not throw EOFException. So, currently, on the table we have: readBytes readAllBytes readNBytes ( thanks Alan ) -Chris. > Gruss > Bernd From huizhe.wang at oracle.com Thu Apr 23 18:46:05 2015 From: huizhe.wang at oracle.com (huizhe wang) Date: Thu, 23 Apr 2015 11:46:05 -0700 Subject: [8u60] Request for approval: 8073357: schema1.xsd has wrong content. Sequence of the enum values has been changed In-Reply-To: <5537AC5E.5090507@oracle.com> References: <5537AC5E.5090507@oracle.com> Message-ID: <55393DED.2000501@oracle.com> Hi Aleksej, The backport looks fine to me. Best, Joe On 4/22/2015 7:12 AM, Aleksej Efimov wrote: > Hello, > > Can I ask for approval of the JDK-8073357 [2] bug fix [1] to JDK8. The > original fix contains only test modifications, but the jaxws part was > introduced during JAXWS synchronization [3] in JDK9. The schemagen > changes [4] related to the reported failure were backported from JDK9. > This partial (ApNavigator.java changes) backport applies cleanly after > reshuffling. Test fix backport applies cleanly. > JDK build with proposed changes shows no related tests failures with > JPRT (jdk_other test group). > > In case, if it is a subject of review - adding 'core-libs-dev'. > > Thank you, > Aleksej > > JDK9 changeset: > http://hg.openjdk.java.net/jdk9/dev/jdk/rev/2dcdce98a176 > JDK9 review: > http://mail.openjdk.java.net/pipermail/core-libs-dev/2015-April/032931.html > > JAXWS integration changeset: > http://hg.openjdk.java.net/jdk9/dev/jaxws/rev/f31835b59035 > > [1] Webrev: http://cr.openjdk.java.net/~aefimov/8073357/8/00/ > [2] JBS: https://bugs.openjdk.java.net/browse/JDK-8073357 > [3] JAXWS sync bug: https://bugs.openjdk.java.net/browse/JDK-8076549 > [4] Backported changes: > http://cr.openjdk.java.net/~aefimov/8073357/8/00/jaxws/src/share/jaxws_classes/com/sun/tools/internal/jxc/model/nav/ApNavigator.java.patch > From michael.haupt at oracle.com Thu Apr 23 19:08:28 2015 From: michael.haupt at oracle.com (Michael Haupt) Date: Thu, 23 Apr 2015 21:08:28 +0200 Subject: RFR (XS): 8030680: 292 cleanup from default method code assessment Message-ID: <07E55461-9E7A-4405-A751-2C2587767903@oracle.com> Hello, please review and sponsor this change. RFE: https://bugs.openjdk.java.net/browse/JDK-8030680 Webrev: http://cr.openjdk.java.net/~mhaupt/8030680/webrev.00/ This is a set of simple changes to increase robustness. Tested locally with jtreg for java.lang.invoke, and with JPRT using the hotspot test set. Thanks, Michael -- Dr. Michael Haupt | Principal Member of Technical Staff Phone: +49 331 200 7277 | Fax: +49 331 200 7561 Oracle Java Platform Group | HotSpot Compiler Team Oracle Deutschland B.V. & Co. KG, Schiffbauergasse 14 | 14467 Potsdam, Germany Oracle is committed to developing practices and products that help protect the environment From michael.haupt at oracle.com Thu Apr 23 19:15:33 2015 From: michael.haupt at oracle.com (Michael Haupt) Date: Thu, 23 Apr 2015 21:15:33 +0200 Subject: RFR (XS): 8030680: 292 cleanup from default method code assessment In-Reply-To: <07E55461-9E7A-4405-A751-2C2587767903@oracle.com> References: <07E55461-9E7A-4405-A751-2C2587767903@oracle.com> Message-ID: Hello again, forgive me; this is the wrong list. Best, Michael > Am 23.04.2015 um 21:08 schrieb Michael Haupt : > > Hello, > > please review and sponsor this change. > RFE: https://bugs.openjdk.java.net/browse/JDK-8030680 > Webrev: http://cr.openjdk.java.net/~mhaupt/8030680/webrev.00/ > > This is a set of simple changes to increase robustness. Tested locally with jtreg for java.lang.invoke, and with JPRT using the hotspot test set. > > Thanks, > > Michael -- Dr. Michael Haupt | Principal Member of Technical Staff Phone: +49 331 200 7277 | Fax: +49 331 200 7561 Oracle Java Platform Group | HotSpot Compiler Team Oracle Deutschland B.V. & Co. KG, Schiffbauergasse 14 | 14467 Potsdam, Germany Oracle is committed to developing practices and products that help protect the environment From nadeesh.tv at oracle.com Thu Apr 23 19:53:19 2015 From: nadeesh.tv at oracle.com (nadeesh tv) Date: Fri, 24 Apr 2015 01:23:19 +0530 Subject: JDK-8074023: Clock.system(ZoneId) could be optimized to always return the same clock for a given zone Message-ID: <55394DAF.2050700@oracle.com> Hi all, Please review this minor change which optimized Clock.systemDefaultZone() and Clock.system(ZoneId) to avoid creating new instance of Clock.SystemClock every time they are called. Bug ID : https://bugs.openjdk.java.net/browse/JDK-8074023 Webrev : http://cr.openjdk.java.net/~rriggs/nadeesh-tv-8074023/ -- Thanks and Regards, Nadeesh TV Oracle IDC, 6th Floor Divyasree Chambers Mob: 9986800452 From peter.levart at gmail.com Thu Apr 23 20:06:32 2015 From: peter.levart at gmail.com (Peter Levart) Date: Thu, 23 Apr 2015 22:06:32 +0200 Subject: RFR [9] Add blocking bulk read to java.io.InputStream In-Reply-To: <9DD30BB8-5573-4325-B934-FD8F575D7031@oracle.com> References: <8D0A349E-4F53-490A-AE18-40ECEA3B72D3@oracle.com> <4BD653BF-AE8F-4ACB-AA4F-E4C753E2720E@zusammenkunft.net> <9DD30BB8-5573-4325-B934-FD8F575D7031@oracle.com> Message-ID: <553950C8.7030709@gmail.com> On 04/23/2015 06:21 PM, Chris Hegarty wrote: > On 23 Apr 2015, at 16:58, Bernd Eckenfels wrote: > >> Hello, >> >> I would use the already established name readFully(byte[]) and readFully(byte[],int,int) to be consistent with DataInputStream. > I purposefully stayed away from the name ?readFully' as the spec for DataInputStream.readFully and the proposed InputStream.readBytes differs. The latter does not throw EOFException. > > So, currently, on the table we have: > readBytes > readAllBytes > readNBytes ( thanks Alan ) What about readLoop ? ...since it's a loop of read()s Peter > -Chris. > >> Gruss >> Bernd From peter.levart at gmail.com Thu Apr 23 20:11:16 2015 From: peter.levart at gmail.com (Peter Levart) Date: Thu, 23 Apr 2015 22:11:16 +0200 Subject: JDK-8074023: Clock.system(ZoneId) could be optimized to always return the same clock for a given zone In-Reply-To: <55394DAF.2050700@oracle.com> References: <55394DAF.2050700@oracle.com> Message-ID: <553951E4.5000604@gmail.com> On 04/23/2015 09:53 PM, nadeesh tv wrote: > Hi all, > > Please review this minor change which optimized > Clock.systemDefaultZone() and Clock.system(ZoneId) to avoid creating > new instance of Clock.SystemClock every time they are called. > > Bug ID : https://bugs.openjdk.java.net/browse/JDK-8074023 > > Webrev : http://cr.openjdk.java.net/~rriggs/nadeesh-tv-8074023/ > Hi Nadeesh, What happens if ZondeId.systemDefault() changes (TimeZone.setDefault()) *after* Clock class has already been initialized? Regards, Peter From forax at univ-mlv.fr Thu Apr 23 20:19:16 2015 From: forax at univ-mlv.fr (Remi Forax) Date: Thu, 23 Apr 2015 22:19:16 +0200 Subject: RFR [9] Add blocking bulk read to java.io.InputStream In-Reply-To: <9DD30BB8-5573-4325-B934-FD8F575D7031@oracle.com> References: <8D0A349E-4F53-490A-AE18-40ECEA3B72D3@oracle.com> <4BD653BF-AE8F-4ACB-AA4F-E4C753E2720E@zusammenkunft.net> <9DD30BB8-5573-4325-B934-FD8F575D7031@oracle.com> Message-ID: <553953C4.9010506@univ-mlv.fr> On 04/23/2015 06:21 PM, Chris Hegarty wrote: > On 23 Apr 2015, at 16:58, Bernd Eckenfels wrote: > >> Hello, >> >> I would use the already established name readFully(byte[]) and readFully(byte[],int,int) to be consistent with DataInputStream. > I purposefully stayed away from the name ?readFully' as the spec for DataInputStream.readFully and the proposed InputStream.readBytes differs. The latter does not throw EOFException. > > So, currently, on the table we have: > readBytes > readAllBytes > readNBytes ( thanks Alan ) > > -Chris. bikesheding:on readNBytes is Ok for me too. cheers, R?mi From forax at univ-mlv.fr Thu Apr 23 20:22:10 2015 From: forax at univ-mlv.fr (Remi Forax) Date: Thu, 23 Apr 2015 22:22:10 +0200 Subject: RFR [9] Add blocking bulk read to java.io.InputStream In-Reply-To: <55390485.1030401@oracle.com> References: <5538E3FA.6020003@univ-mlv.fr> <55390485.1030401@oracle.com> Message-ID: <55395472.7000006@univ-mlv.fr> On 04/23/2015 04:41 PM, Alan Bateman wrote: > On 23/04/2015 13:22, Remi Forax wrote: >> I think the name readBytes is not very informative and the name is >> too close to read + an array of bytes, >> we can not use readFully (from DataInput/DataInputStream) because >> instead of returning the number of bytes read, it throws a >> EOFException if the end of the stream is reached. >> >> so what about readAllBytes ? >> (There is also a readAllBytes in java.nio.file.Files that has an >> equivalent semantics). > For pure convenience then a readAllBytes() that returns a byte[] would > be useful. It avoids all the issues around short reads too, and of > course easy to specify that the input stream would be left in an > inconsistent state if there are any exceptions thrown. you mean readAllBytes on Files or readAllBytes on InputStream ? > > -Alan R?mi From Roger.Riggs at Oracle.com Thu Apr 23 20:25:53 2015 From: Roger.Riggs at Oracle.com (Roger Riggs) Date: Thu, 23 Apr 2015 16:25:53 -0400 Subject: RFR [9] Add blocking bulk read to java.io.InputStream In-Reply-To: References: Message-ID: <55395551.1070100@Oracle.com> Hi Chris, A minor inconsistency about the unmodified contents of b[off]. *

    The first byte read is stored into element {@code b[off]} vs. *

    In every case, elements {@code b[0]} through {@code b[off *- 1*]} and * elements__{@code b[off+len]} through {@code b[b.length-1]} are unaffected. I think there's a missing -1; and perhaps an awkward sentence when off = 0; Roger On 4/23/2015 5:01 AM, Chris Hegarty wrote: > A while back when we added the long overdue java.io.InputStream.transferTo method, there was support for adding a blocking bulk read operation. This has been sitting in a branch in the sandbox since then. I would like to revive it with the intention of bringing it into 9. The motivation for this addition is provide library support for a common pattern found when reading from input streams. > > /** > * Reads some bytes from the input stream into the given byte array. This > * method blocks until {@code len} bytes of input data have been read, or > * end of stream is detected. The number of bytes actually read, possibly > * zero, is returned. This method does not close the input stream. > * > *

    In the case where end of stream is reached before {@code len} bytes > * have been read, then the actual number of bytes read will be returned. > * When this stream reaches end of stream, further invocations of this > * method will return zero. > * > *

    If {@code len} is zero, then no bytes are read and {@code 0} is > * returned; otherwise, there is an attempt to read up to {@code len} bytes. > * > *

    The first byte read is stored into element {@code b[off]}, the next > * one in to {@code b[off+1]}, and so on. The number of bytes read is, at > * most, equal to {@code len}. Let k be the number of bytes actually > * read; these bytes will be stored in elements {@code b[off]} through > * {@code b[off+}k{@code -1]}, leaving elements {@code b[off+}k > * {@code ]} through {@code b[off+len-1]} unaffected. > * > *

    In every case, elements {@code b[0]} through {@code b[off]} and > * elements{@code b[off+len]} through {@code b[b.length-1]} are unaffected. > * > *

    The behavior for the case where the input stream is asynchronously > * closed, or the thread interrupted during the read, is highly input > * stream specific, and therefore not specified. > * > *

    If an I/O error occurs reading from the input stream, then it may do > * so after some bytes have been read. Consequently the input stream may be > * in an inconsistent state. It is strongly recommended that the stream be > * promptly closed if an I/O error occurs. > * > * @param b the buffer into which the data is read > * @param off the start offset in {@code b} at which the data is written > * @param len the maximum number of bytes to read > * @return the actual number of bytes read into the buffer > * @throws IOException if an I/O error occurs > * @throws NullPointerException if {@code b} is {@code null} > * @throws IndexOutOfBoundsException If {@code off} is negative, {@code len} > * is negative, or {@code len} is greater than {@code b.length - off} > * > * @since 1.9 > */ > public int readBytes(byte[] b, int off, int len) throws IOException { > Objects.requireNonNull(b); > if (off < 0 || len < 0 || len > b.length - off) > throw new IndexOutOfBoundsException(); > int n = 0; > while (n < len) { > int count = read(b, off + n, len - n); > if (count < 0) > break; > n += count; > } > return n; > } > > -Chris. From Roger.Riggs at Oracle.com Thu Apr 23 20:33:54 2015 From: Roger.Riggs at Oracle.com (Roger Riggs) Date: Thu, 23 Apr 2015 16:33:54 -0400 Subject: JDK-8074023: Clock.system(ZoneId) could be optimized to always return the same clock for a given zone In-Reply-To: <553951E4.5000604@gmail.com> References: <55394DAF.2050700@oracle.com> <553951E4.5000604@gmail.com> Message-ID: <55395732.7050901@Oracle.com> Hi Peter, The defaultTimeZone is cached in java.util.TimeZone the first time it is referenced and is not updated after that. See java.util.TimeZone.getDefaultRef(). Regards, Roger On 4/23/2015 4:11 PM, Peter Levart wrote: > > > On 04/23/2015 09:53 PM, nadeesh tv wrote: >> Hi all, >> >> Please review this minor change which optimized >> Clock.systemDefaultZone() and Clock.system(ZoneId) to avoid creating >> new instance of Clock.SystemClock every time they are called. >> >> Bug ID : https://bugs.openjdk.java.net/browse/JDK-8074023 >> >> Webrev : http://cr.openjdk.java.net/~rriggs/nadeesh-tv-8074023/ >> > > Hi Nadeesh, > > What happens if ZondeId.systemDefault() changes > (TimeZone.setDefault()) *after* Clock class has already been initialized? > > Regards, Peter > From pavel.rappo at oracle.com Thu Apr 23 21:12:33 2015 From: pavel.rappo at oracle.com (Pavel Rappo) Date: Thu, 23 Apr 2015 22:12:33 +0100 Subject: RFR [9] Add blocking bulk read to java.io.InputStream In-Reply-To: <55395551.1070100@Oracle.com> References: <55395551.1070100@Oracle.com> Message-ID: Hey Roger, 1. Good catch! This thing also applies to java.io.InputStream.read(byte[], int, int): *

    In every case, elements b[0] through * b[off] and elements b[off+len] through * b[b.length-1] are unaffected. I suppose the javadoc for the method proposed by Chris has started its life as a copy of the javadoc read(byte[], int, int) which was assumed to be perfectly polished. Unfortunately it was a false assumption. 2. About awkward sentences. This paragraph also has to be rephrased for the same reason: *

    The first byte read is stored into element {@code b[off]}, the next * one in to {@code b[off+1]}, and so on. The number of bytes read is, at * most, equal to {@code len}. Let k be the number of bytes actually * read; these bytes will be stored in elements {@code b[off]} through * {@code b[off+}k{@code -1]}, leaving elements {@code b[off+}k * {@code ]} through {@code b[off+len-1]} unaffected. If k == 0 then spec claims to store values in b[off]... b[off - 1]. The former thing (1) is a real bug, the latter is... I don't know, do we need this level of strictness or should we assume it's obvious? -Pavel > On 23 Apr 2015, at 21:25, Roger Riggs wrote: > > A minor inconsistency about the unmodified contents of b[off]. > > *

    The first byte read is stored into element {@code b[off]} > > vs. > > *

    In every case, elements {@code b[0]} through {@code b[off *- 1*]} and > * elements__{@code b[off+len]} through {@code b[b.length-1]} are unaffected. > > I think there's a missing -1; and perhaps an awkward sentence when off = 0; From peter.levart at gmail.com Thu Apr 23 21:20:00 2015 From: peter.levart at gmail.com (Peter Levart) Date: Thu, 23 Apr 2015 23:20:00 +0200 Subject: JDK-8074023: Clock.system(ZoneId) could be optimized to always return the same clock for a given zone In-Reply-To: <55395732.7050901@Oracle.com> References: <55394DAF.2050700@oracle.com> <553951E4.5000604@gmail.com> <55395732.7050901@Oracle.com> Message-ID: <55396200.1020909@gmail.com> On 04/23/2015 10:33 PM, Roger Riggs wrote: > Hi Peter, > > The defaultTimeZone is cached in java.util.TimeZone the first time it > is referenced > and is not updated after that. See java.util.TimeZone.getDefaultRef(). > > Regards, Roger > But any code (with enough privilege) can update it: abstract public class TimeZone .... { public static void setDefault(TimeZone zone) { SecurityManager sm = System.getSecurityManager(); if (sm != null) { sm.checkPermission(new PropertyPermission ("user.timezone", "write")); } defaultTimeZone = zone; } Peter > > On 4/23/2015 4:11 PM, Peter Levart wrote: >> >> >> On 04/23/2015 09:53 PM, nadeesh tv wrote: >>> Hi all, >>> >>> Please review this minor change which optimized >>> Clock.systemDefaultZone() and Clock.system(ZoneId) to avoid >>> creating new instance of Clock.SystemClock every time they are called. >>> >>> Bug ID : https://bugs.openjdk.java.net/browse/JDK-8074023 >>> >>> Webrev : http://cr.openjdk.java.net/~rriggs/nadeesh-tv-8074023/ >>> >> >> Hi Nadeesh, >> >> What happens if ZondeId.systemDefault() changes >> (TimeZone.setDefault()) *after* Clock class has already been >> initialized? >> >> Regards, Peter >> > From Roger.Riggs at Oracle.com Thu Apr 23 21:24:49 2015 From: Roger.Riggs at Oracle.com (Roger Riggs) Date: Thu, 23 Apr 2015 17:24:49 -0400 Subject: RFR [9] Add blocking bulk read to java.io.InputStream In-Reply-To: References: <55395551.1070100@Oracle.com> Message-ID: <55396320.2070307@Oracle.com> Hi Pavel, On 4/23/2015 5:12 PM, Pavel Rappo wrote: > Hey Roger, > > 1. Good catch! This thing also applies to java.io.InputStream.read(byte[], int, int): > > *

    In every case, elements b[0] through > * b[off] and elements b[off+len] through > * b[b.length-1] are unaffected. > > I suppose the javadoc for the method proposed by Chris has started its life as a > copy of the javadoc read(byte[], int, int) which was assumed to be perfectly > polished. Unfortunately it was a false assumption. it happens... many many people have read those descriptions (or didn't because it was too obvious or thought to be redundant). > > 2. About awkward sentences. This paragraph also has to be rephrased for the same reason: > > *

    The first byte read is stored into element {@code b[off]}, the next > * one in to {@code b[off+1]}, and so on. The number of bytes read is, at > * most, equal to {@code len}. Let k be the number of bytes actually > * read; these bytes will be stored in elements {@code b[off]} through > * {@code b[off+}k{@code -1]}, leaving elements {@code b[off+}k > * {@code ]} through {@code b[off+len-1]} unaffected. > > If k == 0 then spec claims to store values in b[off]... b[off - 1]. If one concludes that's an empty interval then its ok; it just reads oddly and can make the reader think its wrong. In some cases it is easier if the upper bound is defined to be exclusive. Then if lower == upper, its empty. If better language were constructed for the new method then perhaps it could be worked back into methods with similar behavior later. If the wording changes in any significant way, the conformance team will have to go back and re-evaluate it in detail to see if it really has changed. So I'd leave it alone. Roger > > The former thing (1) is a real bug, the latter is... I don't know, do we need > this level of strictness or should we assume it's obvious? > > -Pavel > >> On 23 Apr 2015, at 21:25, Roger Riggs wrote: >> >> A minor inconsistency about the unmodified contents of b[off]. >> >> *

    The first byte read is stored into element {@code b[off]} >> >> vs. >> >> *

    In every case, elements {@code b[0]} through {@code b[off *- 1*]} and >> * elements__{@code b[off+len]} through {@code b[b.length-1]} are unaffected. >> >> I think there's a missing -1; and perhaps an awkward sentence when off = 0; From Roger.Riggs at Oracle.com Thu Apr 23 21:28:26 2015 From: Roger.Riggs at Oracle.com (Roger Riggs) Date: Thu, 23 Apr 2015 17:28:26 -0400 Subject: JDK-8074023: Clock.system(ZoneId) could be optimized to always return the same clock for a given zone In-Reply-To: <55396200.1020909@gmail.com> References: <55394DAF.2050700@oracle.com> <553951E4.5000604@gmail.com> <55395732.7050901@Oracle.com> <55396200.1020909@gmail.com> Message-ID: <553963FA.7040200@Oracle.com> Hi Peter, Setting the user.timezone property doesn't reset the value returned from getDefaultRef(). You can see the new value through java.util.TimeZone but not through java.time.ZoneId. Its a bad idea to allow the default timezone change and in java.time it was purposefully handled as an initialize once value. Roger On 4/23/2015 5:20 PM, Peter Levart wrote: > > > On 04/23/2015 10:33 PM, Roger Riggs wrote: >> Hi Peter, >> >> The defaultTimeZone is cached in java.util.TimeZone the first time it >> is referenced >> and is not updated after that. See java.util.TimeZone.getDefaultRef(). >> >> Regards, Roger >> > > But any code (with enough privilege) can update it: > > abstract public class TimeZone .... { > > public static void setDefault(TimeZone zone) > { > SecurityManager sm = System.getSecurityManager(); > if (sm != null) { > sm.checkPermission(new PropertyPermission > ("user.timezone", "write")); > } > defaultTimeZone = zone; > } > > > > Peter > >> >> On 4/23/2015 4:11 PM, Peter Levart wrote: >>> >>> >>> On 04/23/2015 09:53 PM, nadeesh tv wrote: >>>> Hi all, >>>> >>>> Please review this minor change which optimized >>>> Clock.systemDefaultZone() and Clock.system(ZoneId) to avoid >>>> creating new instance of Clock.SystemClock every time they are called. >>>> >>>> Bug ID : https://bugs.openjdk.java.net/browse/JDK-8074023 >>>> >>>> Webrev : http://cr.openjdk.java.net/~rriggs/nadeesh-tv-8074023/ >>>> >>> >>> Hi Nadeesh, >>> >>> What happens if ZondeId.systemDefault() changes >>> (TimeZone.setDefault()) *after* Clock class has already been >>> initialized? >>> >>> Regards, Peter >>> >> > From joe.darcy at oracle.com Fri Apr 24 01:54:17 2015 From: joe.darcy at oracle.com (Joseph D. Darcy) Date: Thu, 23 Apr 2015 18:54:17 -0700 Subject: JDK 9 RFR of JDK-8078334: Mark regression tests using randomness In-Reply-To: <553703BC.1070504@oracle.com> References: <553703BC.1070504@oracle.com> Message-ID: <5539A249.7050105@oracle.com> Hello, Any additional comments on marking with tests in question with a "randomness" keyword? Thanks, -Joe On 4/21/2015 7:13 PM, Joseph D. Darcy wrote: > Hello, > > As the next step of implementing "Proposed new policies for JDK 9 > regression tests: tiered testing, intermittent failures, and > randomness" [1], please review this changeset which adds a > "randomness" jtreg keyword and tags 240 regression tests in the jdk > repository with the keyword: > > JDK-8078334: Mark regression tests using randomness > http://cr.openjdk.java.net/~darcy/8078334.0/ > > The update to test/TEST.ROOT is > > -# The list of keywords supported in the entire test suite > -keys=2d dnd i18n intermittent > +# The list of keywords supported in the entire test suite. The > +# "intermittent" keyword marks tests known to fail intermittently. > +# The "randomness" keyword marks tests using randomness with test > +# cases differing from run to run. (A test using a fixed random seed > +# would not count as "randomness" by this definition.) Extra care > +# should be taken to handle test failures of intermittent or > +# randomness tests. > + > +keys=2d dnd i18n intermittent randomness > > To find the affected files for this fix, I grepped over the regression > tests looking for "random" and verified if a random number generated > was used in a way where its values would differ from run to run. In > particular, as noted above, a java.util.Random random number generator > with a fixed seed did *not* qualify a test for the "randomness" keyword. > > The usual update to the files in this changeset is just > > + * @key randomness > > The updated tests are mostly in the core libs and security libs areas > with a few serviceability tests too. The list in this bug is not quite > exhaustive; I did not include rmi tests or client libraries tests. > > I verified that running > > jtreg ... -l -k:randomness . > > returns the expected number of tests and that the tests continue to > pass (or be ignored) when run. > > One goal of marking the tests using randomness is to help root out > some remaining intermittent test failures. If one of the randomness > tests is observed to fail intermittently, if it has not already been > updated to print out the random seed and be able to accept a > particular seed when run, the test should be so modified so that > future failures can log the seed value in hopes of reproducing the > failure. > > Brian Burkhalter has proactively made these sorts of changes to the > java.math tests earlier in JDK 9. [2] Since most of the randomness > tests don't have a history of instability (and due to the unexpected > large number of them!), I don't think it is necessary to proactively > update all the other tests without evidence of a history of failure. > However, when an otherwise unexplained failure is seen, I recommend > applying the sort of updates Brian has done in java.math to the > failing test(s). > > Thanks, > > -Joe > > [1] > http://mail.openjdk.java.net/pipermail/jdk9-dev/2015-March/001991.html > > [2] JDK-8074460, Always print seeds used in [Splittable]Random > instances in java.math tests, > https://bugs.openjdk.java.net/browse/JDK-8074460 From Alan.Bateman at oracle.com Fri Apr 24 05:58:09 2015 From: Alan.Bateman at oracle.com (Alan Bateman) Date: Fri, 24 Apr 2015 06:58:09 +0100 Subject: JDK 9 RFR of JDK-8078334: Mark regression tests using randomness In-Reply-To: <5539A249.7050105@oracle.com> References: <553703BC.1070504@oracle.com> <5539A249.7050105@oracle.com> Message-ID: <5539DB71.2070605@oracle.com> On 24/04/2015 02:54, Joseph D. Darcy wrote: > Hello, > > Any additional comments on marking with tests in question with a > "randomness" keyword? > > Thanks, > > -Joe > I don't object to this keyword although I should say that most of the (apparent) randomness that I've seen hasn't been because of tests using Random but rather because of non-deterministic sequence of tests running in the same VM. The switch from othervm to agentvm a few years ago took a long time to weed out issues, same thing (even more) with -concurrency. Another source of apparent randomness is just having a large pool of machines and where machines are randomly selected to execute the tests. I agree with your comments that tests using Random should have report the seed and a have a way to re-run with the same value. It could help with some cases. One thing that isn't clear to me is how this keyword will be maintained. If I modify a test and replace the use of Random then I guess I need to remember to also remove this label. When I add a test that uses Random ... Just wondering if there is a tool to do the tests analysis, identify the use of specific APIs ,and help identify where the keyword might be missing or not needed. -Alan. From Alan.Bateman at oracle.com Fri Apr 24 06:03:05 2015 From: Alan.Bateman at oracle.com (Alan Bateman) Date: Fri, 24 Apr 2015 07:03:05 +0100 Subject: RFR [9] Add blocking bulk read to java.io.InputStream In-Reply-To: <55395472.7000006@univ-mlv.fr> References: <5538E3FA.6020003@univ-mlv.fr> <55390485.1030401@oracle.com> <55395472.7000006@univ-mlv.fr> Message-ID: <5539DC99.3070801@oracle.com> On 23/04/2015 21:22, Remi Forax wrote: > > On 04/23/2015 04:41 PM, Alan Bateman wrote: >> On 23/04/2015 13:22, Remi Forax wrote: >>> I think the name readBytes is not very informative and the name is >>> too close to read + an array of bytes, >>> we can not use readFully (from DataInput/DataInputStream) because >>> instead of returning the number of bytes read, it throws a >>> EOFException if the end of the stream is reached. >>> >>> so what about readAllBytes ? >>> (There is also a readAllBytes in java.nio.file.Files that has an >>> equivalent semantics). >> For pure convenience then a readAllBytes() that returns a byte[] >> would be useful. It avoids all the issues around short reads too, and >> of course easy to specify that the input stream would be left in an >> inconsistent state if there are any exceptions thrown. > > you mean readAllBytes on Files or readAllBytes on InputStream ? I mean on InputStream, for the cases where want to read to EOF. There are also cases where you want readNbytes and there are variations of that where you specify the byte[] to copy into or just have it returned. So I suspect we'll end up with more than one method but I hope not more than two. -Alan From daniel.fuchs at oracle.com Fri Apr 24 07:02:58 2015 From: daniel.fuchs at oracle.com (Daniel Fuchs) Date: Fri, 24 Apr 2015 09:02:58 +0200 Subject: JDK-8074023: Clock.system(ZoneId) could be optimized to always return the same clock for a given zone In-Reply-To: <553963FA.7040200@Oracle.com> References: <55394DAF.2050700@oracle.com> <553951E4.5000604@gmail.com> <55395732.7050901@Oracle.com> <55396200.1020909@gmail.com> <553963FA.7040200@Oracle.com> Message-ID: <5539EAA2.9070603@oracle.com> On 4/23/15 11:28 PM, Roger Riggs wrote: > Hi Peter, > > Setting the user.timezone property doesn't reset the value returned > from getDefaultRef(). > You can see the new value through java.util.TimeZone but not through > java.time.ZoneId. > > Its a bad idea to allow the default timezone change and in java.time > it was purposefully > handled as an initialize once value. Hi Nadeesh, Roger, I wonder whether this piece of code: 203 } else if (zone.equals(ZoneId.systemDefault())) { 204 return SystemClock.DEFAULT_ZONE_CLOCK; 205 } should be instead } else if (zone.equals(SystemClock.DEFAULT_ZONE_CLOCK.zone) { return SystemClock.DEFAULT_ZONE_CLOCK; } Note: What would be the recommended way to set the default time zone? I have some tests [1] in logging that set the default time zone to UTC: TimeZone.setDefault(TimeZone.getTimeZone(ZoneId.of("UTC"))); they do that to ensure that the log record formatted date will always be the same - wherever the machine the test runs on is located. If the default time zone is not UTC then the test will become unstable... best regards, -- daniel [1] http://cr.openjdk.java.net/~dfuchs/webrev_8072645/webrev.03/test/java/util/logging/HigherResolutionTimeStamps/SerializeLogRecord.java.html > > Roger > > > On 4/23/2015 5:20 PM, Peter Levart wrote: >> >> >> On 04/23/2015 10:33 PM, Roger Riggs wrote: >>> Hi Peter, >>> >>> The defaultTimeZone is cached in java.util.TimeZone the first time >>> it is referenced >>> and is not updated after that. See java.util.TimeZone.getDefaultRef(). >>> >>> Regards, Roger >>> >> >> But any code (with enough privilege) can update it: >> >> abstract public class TimeZone .... { >> >> public static void setDefault(TimeZone zone) >> { >> SecurityManager sm = System.getSecurityManager(); >> if (sm != null) { >> sm.checkPermission(new PropertyPermission >> ("user.timezone", "write")); >> } >> defaultTimeZone = zone; >> } >> >> >> >> Peter >> >>> >>> On 4/23/2015 4:11 PM, Peter Levart wrote: >>>> >>>> >>>> On 04/23/2015 09:53 PM, nadeesh tv wrote: >>>>> Hi all, >>>>> >>>>> Please review this minor change which optimized >>>>> Clock.systemDefaultZone() and Clock.system(ZoneId) to avoid >>>>> creating new instance of Clock.SystemClock every time they are >>>>> called. >>>>> >>>>> Bug ID : https://bugs.openjdk.java.net/browse/JDK-8074023 >>>>> >>>>> Webrev : http://cr.openjdk.java.net/~rriggs/nadeesh-tv-8074023/ >>>>> >>>> >>>> Hi Nadeesh, >>>> >>>> What happens if ZondeId.systemDefault() changes >>>> (TimeZone.setDefault()) *after* Clock class has already been >>>> initialized? >>>> >>>> Regards, Peter >>>> >>> >> > From Sunny.Chan at gs.com Fri Apr 24 07:17:05 2015 From: Sunny.Chan at gs.com (Chan, Sunny) Date: Fri, 24 Apr 2015 15:17:05 +0800 Subject: Patch to improve primitives Array.sort() Message-ID: <1CF6FDFD0639DF478B44651D79ECE70401104C1917@GSCMHKP12EX.firmwide.corp.gs.com> We are proposing a patch to improve the performance for the DualPivotQuickSort use by Array.sort to sort primitives array. We have identified two area for optimization: Firstly, we have changed the algorithm to determine what a "run" is. A "run" is how long you go through the array with it being in order. For example, an array of 1, 2, 3, 5, 4, 3 would have a run count equal to 2 (two parts that are in order). The JDK implementation stops looking for runs if it comes across two equal numbers at the beginning of a run, eg. 1, 1, 1, 1, 2, 3, 4, 4, 4, 4, 4, 4, 5 And then sorts the whole array, as seen in this part of the algorithm: } else { // equal for (int m = MAX_RUN_LENGTH; ++k <= right && a[k - 1] == a[k]; ) { if (--m == 0) { sort(a, left, right, true); return; } } } Instead, we detect and equal beginning of a run at the top of the for loop, as shown here: while (k < right && a[k] == a[++k]); //equal so the array mentioned above would instead have one run, be determined already sorted, and sort would not be called as it would in the original JDK implementation. Second optimization is in the case of an array that is descending, and then ascending. Since the algorithm does swapping in the case of descending numbers, by the end of all swapping the array is sorted. We detect this through this if statement: if (run[count] > left && a[run[count]] >= a[run[count] - 1]) { count--; } And will stop sorting, unlike the JDK. I have attached a webrev.zip containing the patch and unit test that verifies the sort is correct. We also have a couple of JMH based performance tests which is not included. If the JMH is available we can also make those performance test available as well. The patch is author by Kristen O'Leary (Kristen.o'leary at gs.com) and myself. Please attribute both of us when committing. You can find my OCA entry under Goldman Sachs and as we are not authors yet we can't raise a bug report in the database. Please let us know if you need further clarification or modification to the patch. Sunny Chan, Executive Director, Technology Goldman Sachs (Asia) L.L.C. | 68th Floor | Cheung Kong Center | 2 Queens Road Central | Hong Kong email: sunny.chan at gs.com | Tel: +852 2978 6481 | Fax: +852 2978 0633 This message may contain information that is confidential or privileged. If you are not the intended recipient, please advise the sender immediately and delete this message. See http://www.gs.com/disclaimer/email for further information on confidentiality and the risks inherent in electronic communication. From Sunny.Chan at gs.com Fri Apr 24 07:27:21 2015 From: Sunny.Chan at gs.com (Chan, Sunny) Date: Fri, 24 Apr 2015 15:27:21 +0800 Subject: Patch to improve primitives Array.sort() In-Reply-To: <1CF6FDFD0639DF478B44651D79ECE70401104CCC04@GSCMHKP12EX.firmwide.corp.gs.com> References: <1CF6FDFD0639DF478B44651D79ECE70401104CCC04@GSCMHKP12EX.firmwide.corp.gs.com> Message-ID: <1CF6FDFD0639DF478B44651D79ECE70401104C191C@GSCMHKP12EX.firmwide.corp.gs.com> Sorry the spam filter we use didn't like the webrev.zip so I have attached the text patch file instead. From: Chan, Sunny [Tech] Sent: 24 April 2015 15:17 To: 'core-libs-dev at openjdk.java.net' Cc: O'Leary, Kristen [Tech] Subject: Patch to improve primitives Array.sort() We are proposing a patch to improve the performance for the DualPivotQuickSort use by Array.sort to sort primitives array. We have identified two area for optimization: Firstly, we have changed the algorithm to determine what a "run" is. A "run" is how long you go through the array with it being in order. For example, an array of 1, 2, 3, 5, 4, 3 would have a run count equal to 2 (two parts that are in order). The JDK implementation stops looking for runs if it comes across two equal numbers at the beginning of a run, eg. 1, 1, 1, 1, 2, 3, 4, 4, 4, 4, 4, 4, 5 And then sorts the whole array, as seen in this part of the algorithm: } else { // equal for (int m = MAX_RUN_LENGTH; ++k <= right && a[k - 1] == a[k]; ) { if (--m == 0) { sort(a, left, right, true); return; } } } Instead, we detect and equal beginning of a run at the top of the for loop, as shown here: while (k < right && a[k] == a[++k]); //equal so the array mentioned above would instead have one run, be determined already sorted, and sort would not be called as it would in the original JDK implementation. Second optimization is in the case of an array that is descending, and then ascending. Since the algorithm does swapping in the case of descending numbers, by the end of all swapping the array is sorted. We detect this through this if statement: if (run[count] > left && a[run[count]] >= a[run[count] - 1]) { count--; } And will stop sorting, unlike the JDK. I have attached a webrev.zip containing the patch and unit test that verifies the sort is correct. We also have a couple of JMH based performance tests which is not included. If the JMH is available we can also make those performance test available as well. The patch is author by Kristen O'Leary (Kristen.o'leary at gs.com) and myself. Please attribute both of us when committing. You can find my OCA entry under Goldman Sachs and as we are not authors yet we can't raise a bug report in the database. Please let us know if you need further clarification or modification to the patch. Sunny Chan, Executive Director, Technology Goldman Sachs (Asia) L.L.C. | 68th Floor | Cheung Kong Center | 2 Queens Road Central | Hong Kong email: sunny.chan at gs.com | Tel: +852 2978 6481 | Fax: +852 2978 0633 This message may contain information that is confidential or privileged. If you are not the intended recipient, please advise the sender immediately and delete this message. See http://www.gs.com/disclaimer/email for further information on confidentiality and the risks inherent in electronic communication. From paul.sandoz at oracle.com Fri Apr 24 07:30:45 2015 From: paul.sandoz at oracle.com (Paul Sandoz) Date: Fri, 24 Apr 2015 09:30:45 +0200 Subject: Patch to improve primitives Array.sort() In-Reply-To: <1CF6FDFD0639DF478B44651D79ECE70401104C1917@GSCMHKP12EX.firmwide.corp.gs.com> References: <1CF6FDFD0639DF478B44651D79ECE70401104C1917@GSCMHKP12EX.firmwide.corp.gs.com> Message-ID: HI Chan, Attachments might be getting removed by the OpenJDK email server. If you send me the webrev privately i can upload to cr. If so could you do that please send the JMH tests as i think people might also be interested in those. Paul. On Apr 24, 2015, at 9:17 AM, "Chan, Sunny" wrote: > We are proposing a patch to improve the performance for the DualPivotQuickSort use by Array.sort to sort primitives array. We have identified two area for optimization: > > Firstly, we have changed the algorithm to determine what a "run" is. A "run" is how long you go through the array with it being in order. For example, an array of 1, 2, 3, 5, 4, 3 would have a run count equal to 2 (two parts that are in order). > > The JDK implementation stops looking for runs if it comes across two equal numbers at the beginning of a run, eg. > 1, 1, 1, 1, 2, 3, 4, 4, 4, 4, 4, 4, 5 > And then sorts the whole array, as seen in this part of the algorithm: > } else { // equal > for (int m = MAX_RUN_LENGTH; ++k <= right && a[k - 1] == a[k]; ) { > if (--m == 0) { > sort(a, left, right, true); > return; > } > } > } > > Instead, we detect and equal beginning of a run at the top of the for loop, as shown here: > while (k < right && a[k] == a[++k]); //equal > > so the array mentioned above would instead have one run, be determined already sorted, and sort would not be called as it would in the original JDK implementation. > > Second optimization is in the case of an array that is descending, and then ascending. > > Since the algorithm does swapping in the case of descending numbers, by the end of all swapping the array is sorted. We detect this through this if statement: > if (run[count] > left && a[run[count]] >= a[run[count] - 1]) { > count--; > } > And will stop sorting, unlike the JDK. > > I have attached a webrev.zip containing the patch and unit test that verifies the sort is correct. We also have a couple of JMH based performance tests which is not included. If the JMH is available we can also make those performance test available as well. > > The patch is author by Kristen O'Leary (Kristen.o'leary at gs.com) and myself. Please attribute both of us when committing. You can find my OCA entry under Goldman Sachs and as we are not authors yet we can't raise a bug report in the database. > > Please let us know if you need further clarification or modification to the patch. > > Sunny Chan, Executive Director, Technology > Goldman Sachs (Asia) L.L.C. | 68th Floor | Cheung Kong Center | 2 Queens Road Central | Hong Kong > email: sunny.chan at gs.com | Tel: +852 2978 6481 | Fax: +852 2978 0633 > > This message may contain information that is confidential or privileged. If you are not the intended recipient, please advise the sender immediately and delete this message. See http://www.gs.com/disclaimer/email for further information on confidentiality and the risks inherent in electronic communication. > From Sunny.Chan at gs.com Fri Apr 24 07:40:07 2015 From: Sunny.Chan at gs.com (Chan, Sunny) Date: Fri, 24 Apr 2015 15:40:07 +0800 Subject: Patch to improve primitives Array.sort() In-Reply-To: References: <1CF6FDFD0639DF478B44651D79ECE70401104C1917@GSCMHKP12EX.firmwide.corp.gs.com> Message-ID: <1CF6FDFD0639DF478B44651D79ECE70401104C1924@GSCMHKP12EX.firmwide.corp.gs.com> I have privately sent the webrev to Paul. I will make the JMH tests available once I have clear up with the compliance. Sunny -----Original Message----- From: Paul Sandoz [mailto:paul.sandoz at oracle.com] Sent: 24 April 2015 15:31 To: Chan, Sunny [Tech] Cc: 'core-libs-dev at openjdk.java.net'; O'Leary, Kristen [Tech] Subject: Re: Patch to improve primitives Array.sort() HI Chan, Attachments might be getting removed by the OpenJDK email server. If you send me the webrev privately i can upload to cr. If so could you do that please send the JMH tests as i think people might also be interested in those. Paul. On Apr 24, 2015, at 9:17 AM, "Chan, Sunny" wrote: > We are proposing a patch to improve the performance for the DualPivotQuickSort use by Array.sort to sort primitives array. We have identified two area for optimization: > > Firstly, we have changed the algorithm to determine what a "run" is. A "run" is how long you go through the array with it being in order. For example, an array of 1, 2, 3, 5, 4, 3 would have a run count equal to 2 (two parts that are in order). > > The JDK implementation stops looking for runs if it comes across two equal numbers at the beginning of a run, eg. > 1, 1, 1, 1, 2, 3, 4, 4, 4, 4, 4, 4, 5 > And then sorts the whole array, as seen in this part of the algorithm: > } else { // equal > for (int m = MAX_RUN_LENGTH; ++k <= right && a[k - 1] == a[k]; ) { > if (--m == 0) { > sort(a, left, right, true); > return; > } > } > } > > Instead, we detect and equal beginning of a run at the top of the for loop, as shown here: > while (k < right && a[k] == a[++k]); //equal > > so the array mentioned above would instead have one run, be determined already sorted, and sort would not be called as it would in the original JDK implementation. > > Second optimization is in the case of an array that is descending, and then ascending. > > Since the algorithm does swapping in the case of descending numbers, by the end of all swapping the array is sorted. We detect this through this if statement: > if (run[count] > left && a[run[count]] >= a[run[count] - 1]) { > count--; > } > And will stop sorting, unlike the JDK. > > I have attached a webrev.zip containing the patch and unit test that verifies the sort is correct. We also have a couple of JMH based performance tests which is not included. If the JMH is available we can also make those performance test available as well. > > The patch is author by Kristen O'Leary (Kristen.o'leary at gs.com) and myself. Please attribute both of us when committing. You can find my OCA entry under Goldman Sachs and as we are not authors yet we can't raise a bug report in the database. > > Please let us know if you need further clarification or modification to the patch. > > Sunny Chan, Executive Director, Technology Goldman Sachs (Asia) L.L.C. > | 68th Floor | Cheung Kong Center | 2 Queens Road Central | Hong Kong > email: sunny.chan at gs.com | Tel: +852 2978 6481 | Fax: +852 2978 0633 > > This message may contain information that is confidential or privileged. If you are not the intended recipient, please advise the sender immediately and delete this message. See http://www.gs.com/disclaimer/email for further information on confidentiality and the risks inherent in electronic communication. > From chris.hegarty at oracle.com Fri Apr 24 08:44:25 2015 From: chris.hegarty at oracle.com (Chris Hegarty) Date: Fri, 24 Apr 2015 09:44:25 +0100 Subject: RFR [9] Add blocking bulk read to java.io.InputStream In-Reply-To: <55396320.2070307@Oracle.com> References: <55395551.1070100@Oracle.com> <55396320.2070307@Oracle.com> Message-ID: <31EC1590-B334-4154-8981-125542ACA37B@oracle.com> On 23 Apr 2015, at 22:24, Roger Riggs wrote: > Hi Pavel, > > On 4/23/2015 5:12 PM, Pavel Rappo wrote: >> Hey Roger, >> >> 1. Good catch! This thing also applies to java.io.InputStream.read(byte[], int, int): Yes, good catch indeed. >> *

    In every case, elements b[0] through >> * b[off] and elements b[off+len] through >> * b[b.length-1] are unaffected. >> >> I suppose the javadoc for the method proposed by Chris has started its life as a >> copy of the javadoc read(byte[], int, int) which was assumed to be perfectly >> polished. Unfortunately it was a false assumption. > it happens... many many people have read those descriptions (or didn't because > it was too obvious or thought to be redundant). I propose this small amendment. *

    In the case where {@code off > 0}, elements {@code b[0]} through * {@code b[off-1]} are unaffected. In every case, elements * {@code b[off+len]} through {@code b[b.length-1]} are unaffected. >> >> 2. About awkward sentences. This paragraph also has to be rephrased for the same reason: >> >> *

    The first byte read is stored into element {@code b[off]}, the next >> * one in to {@code b[off+1]}, and so on. The number of bytes read is, at >> * most, equal to {@code len}. Let k be the number of bytes actually >> * read; these bytes will be stored in elements {@code b[off]} through >> * {@code b[off+}k{@code -1]}, leaving elements {@code b[off+}k >> * {@code ]} through {@code b[off+len-1]} unaffected. >> >> If k == 0 then spec claims to store values in b[off]... b[off - 1]. Reading the whole method description leads to be believe that 'k' cannot equal 0 at this point. The previous paragraph handles the case where len is 0. The previous paragraph to that handles the EOF case. This paragraph implicitly implies that k is greater than 0, ?The first byte read?, and ?the number of actual bytes read?, neither of which can be 0 at this point. I included below [*] the latest version of this method, including all comments so far. > If one concludes that's an empty interval then its ok; it just reads oddly and can > make the reader think its wrong. > In some cases it is easier if the upper bound is defined to be exclusive. > Then if lower == upper, its empty. > > If better language were constructed for the new method then perhaps it could > be worked back into methods with similar behavior later. If the wording changes > in any significant way, the conformance team will have to go back and re-evaluate > it in detail to see if it really has changed. So I'd leave it alone. > > Roger -Chris. [*] /** * Reads some bytes from the input stream into the given byte array. This * method blocks until {@code len} bytes of input data have been read, end * of stream is detected, or an exception is thrown. The number of bytes * actually read, possibly zero, is returned. This method does not close * the input stream. * *

    In the case where end of stream is reached before {@code len} bytes * have been read, then the actual number of bytes read will be returned. * When this stream reaches end of stream, further invocations of this * method will return zero. * *

    If {@code len} is zero, then no bytes are read and {@code 0} is * returned; otherwise, there is an attempt to read up to {@code len} bytes. * *

    The first byte read is stored into element {@code b[off]}, the next * one in to {@code b[off+1]}, and so on. The number of bytes read is, at * most, equal to {@code len}. Let k be the number of bytes actually * read; these bytes will be stored in elements {@code b[off]} through * {@code b[off+}k{@code -1]}, leaving elements {@code b[off+}k * {@code ]} through {@code b[off+len-1]} unaffected. * *

    In the case where {@code off > 0}, elements {@code b[0]} through * {@code b[off-1]} are unaffected. In every case, elements * {@code b[off+len]} through {@code b[b.length-1]} are unaffected. * *

    In every case, elements {@code b[0]} through {@code b[off-1]} and * elements {@code b[off+len]} through {@code b[b.length-1]} are unaffected. * *

    The behavior for the case where the input stream is asynchronously * closed, or the thread interrupted during the read, is highly input * stream specific, and therefore not specified. * *

    If an I/O error occurs reading from the input stream, then it may do * so after some, but not all, bytes of {@code b} have been updated with * data from the input stream. Consequently the input stream and {@code b} * may be in an inconsistent state. It is strongly recommended that the * stream be promptly closed if an I/O error occurs. * * @param b the buffer into which the data is read * @param off the start offset in {@code b} at which the data is written * @param len the maximum number of bytes to read * @return the actual number of bytes read into the buffer * @throws IOException if an I/O error occurs * @throws NullPointerException if {@code b} is {@code null} * @throws IndexOutOfBoundsException If {@code off} is negative, {@code len} * is negative, or {@code len} is greater than {@code b.length - off} * * @since 1.9 */ public int readNBytes(byte[] b, int off, int len) throws IOException { Objects.requireNonNull(b); if (off < 0 || len < 0 || len > b.length - off) throw new IndexOutOfBoundsException(); int n = 0; while (n < len) { int count = read(b, off + n, len - n); if (count < 0) break; n += count; } return n; } From paul.sandoz at oracle.com Fri Apr 24 08:57:01 2015 From: paul.sandoz at oracle.com (Paul Sandoz) Date: Fri, 24 Apr 2015 10:57:01 +0200 Subject: Patch to improve primitives Array.sort() In-Reply-To: <1CF6FDFD0639DF478B44651D79ECE70401104C1917@GSCMHKP12EX.firmwide.corp.gs.com> References: <1CF6FDFD0639DF478B44651D79ECE70401104C1917@GSCMHKP12EX.firmwide.corp.gs.com> Message-ID: <4911D592-3065-4416-A683-6B80275B4173@oracle.com> See here: http://cr.openjdk.java.net/~psandoz/tmp/gs/sort/webrev/ Some very quick comments as i have not yet had time to review more closely: - IANAL so i dunno about the GS copyright in the files. - The constant MAX_RUN_LENGTH is no longer used so could be removed. But i would like to understand why it's no longer required. - There is quite a bit of duplication in the tests. AFAICT data sources are all derived from ints that are then converted. The sources could be data providers, so only one test method per data type is required, each data can come with a descriptive string so it shows up in the test reports. The goal here being if another source of data is added (which is derivable) it could be added just once. Paul. On Apr 24, 2015, at 9:17 AM, "Chan, Sunny" wrote: > We are proposing a patch to improve the performance for the DualPivotQuickSort use by Array.sort to sort primitives array. We have identified two area for optimization: > > Firstly, we have changed the algorithm to determine what a "run" is. A "run" is how long you go through the array with it being in order. For example, an array of 1, 2, 3, 5, 4, 3 would have a run count equal to 2 (two parts that are in order). > > The JDK implementation stops looking for runs if it comes across two equal numbers at the beginning of a run, eg. > 1, 1, 1, 1, 2, 3, 4, 4, 4, 4, 4, 4, 5 > And then sorts the whole array, as seen in this part of the algorithm: > } else { // equal > for (int m = MAX_RUN_LENGTH; ++k <= right && a[k - 1] == a[k]; ) { > if (--m == 0) { > sort(a, left, right, true); > return; > } > } > } > > Instead, we detect and equal beginning of a run at the top of the for loop, as shown here: > while (k < right && a[k] == a[++k]); //equal > > so the array mentioned above would instead have one run, be determined already sorted, and sort would not be called as it would in the original JDK implementation. > > Second optimization is in the case of an array that is descending, and then ascending. > > Since the algorithm does swapping in the case of descending numbers, by the end of all swapping the array is sorted. We detect this through this if statement: > if (run[count] > left && a[run[count]] >= a[run[count] - 1]) { > count--; > } > And will stop sorting, unlike the JDK. > > I have attached a webrev.zip containing the patch and unit test that verifies the sort is correct. We also have a couple of JMH based performance tests which is not included. If the JMH is available we can also make those performance test available as well. > > The patch is author by Kristen O'Leary (Kristen.o'leary at gs.com) and myself. Please attribute both of us when committing. You can find my OCA entry under Goldman Sachs and as we are not authors yet we can't raise a bug report in the database. > > Please let us know if you need further clarification or modification to the patch. > > Sunny Chan, Executive Director, Technology > Goldman Sachs (Asia) L.L.C. | 68th Floor | Cheung Kong Center | 2 Queens Road Central | Hong Kong > email: sunny.chan at gs.com | Tel: +852 2978 6481 | Fax: +852 2978 0633 > > This message may contain information that is confidential or privileged. If you are not the intended recipient, please advise the sender immediately and delete this message. See http://www.gs.com/disclaimer/email for further information on confidentiality and the risks inherent in electronic communication. > From Alan.Bateman at oracle.com Fri Apr 24 09:09:06 2015 From: Alan.Bateman at oracle.com (Alan Bateman) Date: Fri, 24 Apr 2015 10:09:06 +0100 Subject: Patch to improve primitives Array.sort() In-Reply-To: <4911D592-3065-4416-A683-6B80275B4173@oracle.com> References: <1CF6FDFD0639DF478B44651D79ECE70401104C1917@GSCMHKP12EX.firmwide.corp.gs.com> <4911D592-3065-4416-A683-6B80275B4173@oracle.com> Message-ID: <553A0832.7070702@oracle.com> On 24/04/2015 09:57, Paul Sandoz wrote: > See here: > > http://cr.openjdk.java.net/~psandoz/tmp/gs/sort/webrev/ > > Some very quick comments as i have not yet had time to review more closely: > > - IANAL so i dunno about the GS copyright in the files. > > - The constant MAX_RUN_LENGTH is no longer used so could be removed. But i would like to understand why it's no longer required. > > - There is quite a bit of duplication in the tests. AFAICT data sources are all derived from ints that are then converted. The sources could be data providers, so only one test method per data type is required, each data can come with a descriptive string so it shows up in the test reports. The goal here being if another source of data is added (which is derivable) it could be added just once. > Also overall with the existing Sorting test should be examined as it tests a lot of cases with varying data sizes (and consequentially runs for a long time). We should also go back through the archives for all the other benchmarks that were created in the move to the dual pivot implementation. -Alan From scolebourne at joda.org Fri Apr 24 09:32:30 2015 From: scolebourne at joda.org (Stephen Colebourne) Date: Fri, 24 Apr 2015 10:32:30 +0100 Subject: JDK-8074023: Clock.system(ZoneId) could be optimized to always return the same clock for a given zone In-Reply-To: <553963FA.7040200@Oracle.com> References: <55394DAF.2050700@oracle.com> <553951E4.5000604@gmail.com> <55395732.7050901@Oracle.com> <55396200.1020909@gmail.com> <553963FA.7040200@Oracle.com> Message-ID: The code in the webrev changes the behaviour of java.time, so cannot go in. Run this code: TimeZone zone = TimeZone.getDefault(); System.out.println(zone); ZoneId zoneId = ZoneId.systemDefault(); System.out.println(zoneId); TimeZone.setDefault(TimeZone.getTimeZone("Europe/Paris")); TimeZone zone2 = TimeZone.getDefault(); System.out.println(zone2); ZoneId zoneId2 = ZoneId.systemDefault(); System.out.println(zoneId2); before and after this change, a difference will be seen. Specifically, ZoneId.systemDefault() responds to a change to TimeZone.setDefault(). The correct fix to this issue was outlined in the bug report. 1) add caching for those ZoneRegion instances that have a non-offset based underlying ZoneRules. This would be done in ZoneRegion.ofId(). Those instances of ZoneRegion created by ZoneId.ofOffset() would not be cached. 2) Add a Clock instance variable to ZoneId that is only non-null if the object is cached 3) Change Clock.system(ZoneId) to check to see if the clock in the ZoneId is non-null before creating a new instance. Stephen On 23 April 2015 at 22:28, Roger Riggs wrote: > Hi Peter, > > Setting the user.timezone property doesn't reset the value returned from > getDefaultRef(). > You can see the new value through java.util.TimeZone but not through > java.time.ZoneId. > > Its a bad idea to allow the default timezone change and in java.time it was > purposefully > handled as an initialize once value. > > Roger > > > > On 4/23/2015 5:20 PM, Peter Levart wrote: >> >> >> >> On 04/23/2015 10:33 PM, Roger Riggs wrote: >>> >>> Hi Peter, >>> >>> The defaultTimeZone is cached in java.util.TimeZone the first time it is >>> referenced >>> and is not updated after that. See java.util.TimeZone.getDefaultRef(). >>> >>> Regards, Roger >>> >> >> But any code (with enough privilege) can update it: >> >> abstract public class TimeZone .... { >> >> public static void setDefault(TimeZone zone) >> { >> SecurityManager sm = System.getSecurityManager(); >> if (sm != null) { >> sm.checkPermission(new PropertyPermission >> ("user.timezone", "write")); >> } >> defaultTimeZone = zone; >> } >> >> >> >> Peter >> >>> >>> On 4/23/2015 4:11 PM, Peter Levart wrote: >>>> >>>> >>>> >>>> On 04/23/2015 09:53 PM, nadeesh tv wrote: >>>>> >>>>> Hi all, >>>>> >>>>> Please review this minor change which optimized >>>>> Clock.systemDefaultZone() and Clock.system(ZoneId) to avoid creating new >>>>> instance of Clock.SystemClock every time they are called. >>>>> >>>>> Bug ID : https://bugs.openjdk.java.net/browse/JDK-8074023 >>>>> >>>>> Webrev : http://cr.openjdk.java.net/~rriggs/nadeesh-tv-8074023/ >>>>> >>>> >>>> Hi Nadeesh, >>>> >>>> What happens if ZondeId.systemDefault() changes (TimeZone.setDefault()) >>>> *after* Clock class has already been initialized? >>>> >>>> Regards, Peter >>>> >>> >> > From vladimir.x.ivanov at oracle.com Fri Apr 24 09:55:18 2015 From: vladimir.x.ivanov at oracle.com (Vladimir Ivanov) Date: Fri, 24 Apr 2015 12:55:18 +0300 Subject: [9] RFR (XS): 8059455: LambdaForm.prepare() does unnecessary work for cached LambdaForms In-Reply-To: <037C50B5-AA8E-41E6-BEC4-83935A0484F5@oracle.com> References: <55390BE3.8000901@oracle.com> <037C50B5-AA8E-41E6-BEC4-83935A0484F5@oracle.com> Message-ID: <553A1306.5010909@oracle.com> Thanks, Paul. Best regards, Vladimir Ivanov On 4/23/15 6:30 PM, Paul Sandoz wrote: > > On Apr 23, 2015, at 5:12 PM, Vladimir Ivanov wrote: > >> https://bugs.openjdk.java.net/browse/JDK-8059455 >> http://cr.openjdk.java.net/~vlivanov/8059455/webrev.00/ >> >> LambdaForm.compileToBytecode() does unnecessary work (constructs invokerType & check an assertion) before ensuring that LambdaForm hasn't been already compiled. It happens very often for cached LambdaForms. >> >> The fix is to do the check first. >> > > +1 > > Paul. > >> Testing: failed VM tests (timeouts) >> >> Best regards, >> Vladimir Ivanov > From peter.levart at gmail.com Fri Apr 24 10:08:00 2015 From: peter.levart at gmail.com (Peter Levart) Date: Fri, 24 Apr 2015 12:08:00 +0200 Subject: JDK-8074023: Clock.system(ZoneId) could be optimized to always return the same clock for a given zone In-Reply-To: References: <55394DAF.2050700@oracle.com> <553951E4.5000604@gmail.com> <55395732.7050901@Oracle.com> <55396200.1020909@gmail.com> <553963FA.7040200@Oracle.com> Message-ID: <553A1600.7040402@gmail.com> On 04/24/2015 11:32 AM, Stephen Colebourne wrote: > The code in the webrev changes the behaviour of java.time, so cannot go in. > > Run this code: > TimeZone zone = TimeZone.getDefault(); > System.out.println(zone); > ZoneId zoneId = ZoneId.systemDefault(); > System.out.println(zoneId); > TimeZone.setDefault(TimeZone.getTimeZone("Europe/Paris")); > TimeZone zone2 = TimeZone.getDefault(); > System.out.println(zone2); > ZoneId zoneId2 = ZoneId.systemDefault(); > System.out.println(zoneId2); > > before and after this change, a difference will be seen. Specifically, > ZoneId.systemDefault() responds to a change to TimeZone.setDefault(). > > The correct fix to this issue was outlined in the bug report. > > 1) add caching for those ZoneRegion instances that have a non-offset > based underlying ZoneRules. This would be done in ZoneRegion.ofId(). > Those instances of ZoneRegion created by ZoneId.ofOffset() would not > be cached. > 2) Add a Clock instance variable to ZoneId that is only non-null if > the object is cached > 3) Change Clock.system(ZoneId) to check to see if the clock in the > ZoneId is non-null before creating a new instance. > > Stephen I think the above strategy will be even better for default Clock when combined with the following: https://bugs.openjdk.java.net/browse/JDK-8074002 (java.time.ZoneId.systemDefault() should be faster) I'm going to send out official RFR shortly. Regards, Peter > > > > On 23 April 2015 at 22:28, Roger Riggs wrote: >> Hi Peter, >> >> Setting the user.timezone property doesn't reset the value returned from >> getDefaultRef(). >> You can see the new value through java.util.TimeZone but not through >> java.time.ZoneId. >> >> Its a bad idea to allow the default timezone change and in java.time it was >> purposefully >> handled as an initialize once value. >> >> Roger >> >> >> >> On 4/23/2015 5:20 PM, Peter Levart wrote: >>> >>> >>> On 04/23/2015 10:33 PM, Roger Riggs wrote: >>>> Hi Peter, >>>> >>>> The defaultTimeZone is cached in java.util.TimeZone the first time it is >>>> referenced >>>> and is not updated after that. See java.util.TimeZone.getDefaultRef(). >>>> >>>> Regards, Roger >>>> >>> But any code (with enough privilege) can update it: >>> >>> abstract public class TimeZone .... { >>> >>> public static void setDefault(TimeZone zone) >>> { >>> SecurityManager sm = System.getSecurityManager(); >>> if (sm != null) { >>> sm.checkPermission(new PropertyPermission >>> ("user.timezone", "write")); >>> } >>> defaultTimeZone = zone; >>> } >>> >>> >>> >>> Peter >>> >>>> On 4/23/2015 4:11 PM, Peter Levart wrote: >>>>> >>>>> >>>>> On 04/23/2015 09:53 PM, nadeesh tv wrote: >>>>>> Hi all, >>>>>> >>>>>> Please review this minor change which optimized >>>>>> Clock.systemDefaultZone() and Clock.system(ZoneId) to avoid creating new >>>>>> instance of Clock.SystemClock every time they are called. >>>>>> >>>>>> Bug ID : https://bugs.openjdk.java.net/browse/JDK-8074023 >>>>>> >>>>>> Webrev : http://cr.openjdk.java.net/~rriggs/nadeesh-tv-8074023/ >>>>>> >>>>> Hi Nadeesh, >>>>> >>>>> What happens if ZondeId.systemDefault() changes (TimeZone.setDefault()) >>>>> *after* Clock class has already been initialized? >>>>> >>>>> Regards, Peter >>>>> From Alan.Bateman at oracle.com Fri Apr 24 12:06:41 2015 From: Alan.Bateman at oracle.com (Alan Bateman) Date: Fri, 24 Apr 2015 13:06:41 +0100 Subject: RFR 9: 8077350 Process API Updates Implementation Review (Due 4/23) In-Reply-To: <55315B2C.8060606@Oracle.com> References: <5526DA4A.6030808@Oracle.com> <55296E19.3040204@Oracle.com> <5530BECF.60903@gmail.com> <55313A6F.4070208@Oracle.com> <55315476.60908@redhat.com> <553157A4.4030005@Oracle.com> <55315B2C.8060606@Oracle.com> Message-ID: <553A31D1.3060902@oracle.com> On 17/04/2015 20:12, Roger Riggs wrote: > The webrev for ProcessAPI updates has been updated to reflect recent > comments. > Please review and comment by April 23rd. > > The updates include: > - Renaming Process/ProcessHandle supportsDestroyForcibly to > supportsNormalTermination > and updating related descriptions > - ProcessHandle.destroy/destroyForcible descriptions have more > consistent descriptions > - ProcessHandle.destroy now returns ProcessHandle to enable fluent use. > - Corrected description of default implementation ProcessHandle.onExit > > The API doc: http://cr.openjdk.java.net/~rriggs/ph-apidraft/ > > The webrev: http://cr.openjdk.java.net/~rriggs/webrev-ph I'm finally getting to this. One comment on terminology is that ProcessBuilder uses phrases like "Starts a new process" whereas the changes to Process (and the new ProcessHandle) have switched to "spawn". It's not a big deal but would be good to have consistency. A typo at around L77 of Process, "iecr" has crept in the class description. I'm not sure about the @implSpec in Process::supportsNormalTermination. Shouldn't that just specify that the default implementation throws UOE. An @implNote could comment on how ProcessBuilder works. Same comment on Process::toHandle. In Process::destroy then the wording is adjusted to use the term "normally terminated". The word "normally" doesn't seem right to me, "gracefully" might work better. I'm tempted to suggest supportsNormalTermination be renamed to supportsGracefulTermination if you haven't discounted it already. The parent is optional and maybe it would make sense for parent() to return Optional. The javadoc for this method, isAlive too, mention "zombie state". I think that needs a bit of description to generally explain what it means. This may have been discussed previously but totalCpuDuration might be clearer if renamed to totalCpuTimeAsDuration. Also startInstant would be clearer (to me anyway) as startTimeAsInstant. A passing comment on the webrev (still working through it) is that it would be good to keep the line length on the javadoc somewhat consistent in the file. -Alan From Roger.Riggs at Oracle.com Fri Apr 24 13:58:26 2015 From: Roger.Riggs at Oracle.com (Roger Riggs) Date: Fri, 24 Apr 2015 09:58:26 -0400 Subject: JDK-8074023: Clock.system(ZoneId) could be optimized to always return the same clock for a given zone In-Reply-To: References: <55394DAF.2050700@oracle.com> <553951E4.5000604@gmail.com> <55395732.7050901@Oracle.com> <55396200.1020909@gmail.com> <553963FA.7040200@Oracle.com> Message-ID: <553A4C02.6070203@Oracle.com> Hi Stephen, Just to clarify, by non-offset based ZoneRules do you mean it has a fixed offset meaning no transitions; aka ZoneRules.isFixedOffset() = true? Thanks, Roger On 4/24/2015 5:32 AM, Stephen Colebourne wrote: > The code in the webrev changes the behaviour of java.time, so cannot go in. > > Run this code: > TimeZone zone = TimeZone.getDefault(); > System.out.println(zone); > ZoneId zoneId = ZoneId.systemDefault(); > System.out.println(zoneId); > TimeZone.setDefault(TimeZone.getTimeZone("Europe/Paris")); > TimeZone zone2 = TimeZone.getDefault(); > System.out.println(zone2); > ZoneId zoneId2 = ZoneId.systemDefault(); > System.out.println(zoneId2); > > before and after this change, a difference will be seen. Specifically, > ZoneId.systemDefault() responds to a change to TimeZone.setDefault(). > > The correct fix to this issue was outlined in the bug report. > > 1) add caching for those ZoneRegion instances that have a non-offset > based underlying ZoneRules. This would be done in ZoneRegion.ofId(). > Those instances of ZoneRegion created by ZoneId.ofOffset() would not > be cached. > 2) Add a Clock instance variable to ZoneId that is only non-null if > the object is cached > 3) Change Clock.system(ZoneId) to check to see if the clock in the > ZoneId is non-null before creating a new instance. > > Stephen > > > > On 23 April 2015 at 22:28, Roger Riggs wrote: >> Hi Peter, >> >> Setting the user.timezone property doesn't reset the value returned from >> getDefaultRef(). >> You can see the new value through java.util.TimeZone but not through >> java.time.ZoneId. >> >> Its a bad idea to allow the default timezone change and in java.time it was >> purposefully >> handled as an initialize once value. >> >> Roger >> >> >> >> On 4/23/2015 5:20 PM, Peter Levart wrote: >>> >>> >>> On 04/23/2015 10:33 PM, Roger Riggs wrote: >>>> Hi Peter, >>>> >>>> The defaultTimeZone is cached in java.util.TimeZone the first time it is >>>> referenced >>>> and is not updated after that. See java.util.TimeZone.getDefaultRef(). >>>> >>>> Regards, Roger >>>> >>> But any code (with enough privilege) can update it: >>> >>> abstract public class TimeZone .... { >>> >>> public static void setDefault(TimeZone zone) >>> { >>> SecurityManager sm = System.getSecurityManager(); >>> if (sm != null) { >>> sm.checkPermission(new PropertyPermission >>> ("user.timezone", "write")); >>> } >>> defaultTimeZone = zone; >>> } >>> >>> >>> >>> Peter >>> >>>> On 4/23/2015 4:11 PM, Peter Levart wrote: >>>>> >>>>> >>>>> On 04/23/2015 09:53 PM, nadeesh tv wrote: >>>>>> Hi all, >>>>>> >>>>>> Please review this minor change which optimized >>>>>> Clock.systemDefaultZone() and Clock.system(ZoneId) to avoid creating new >>>>>> instance of Clock.SystemClock every time they are called. >>>>>> >>>>>> Bug ID : https://bugs.openjdk.java.net/browse/JDK-8074023 >>>>>> >>>>>> Webrev : http://cr.openjdk.java.net/~rriggs/nadeesh-tv-8074023/ >>>>>> >>>>> Hi Nadeesh, >>>>> >>>>> What happens if ZondeId.systemDefault() changes (TimeZone.setDefault()) >>>>> *after* Clock class has already been initialized? >>>>> >>>>> Regards, Peter >>>>> From scolebourne at joda.org Fri Apr 24 14:22:02 2015 From: scolebourne at joda.org (Stephen Colebourne) Date: Fri, 24 Apr 2015 15:22:02 +0100 Subject: JDK-8074023: Clock.system(ZoneId) could be optimized to always return the same clock for a given zone In-Reply-To: <553A4C02.6070203@Oracle.com> References: <55394DAF.2050700@oracle.com> <553951E4.5000604@gmail.com> <55395732.7050901@Oracle.com> <55396200.1020909@gmail.com> <553963FA.7040200@Oracle.com> <553A4C02.6070203@Oracle.com> Message-ID: No, the opposite. Those rules that do NOT have a fixed offset. ZoneId.of("Europe/London") should be cached, but not ZoneId.of("UTC+10:00"). Note that the latter is an offset-based ZoneRegion, not a ZoneOffset. Stephen On 24 April 2015 at 14:58, Roger Riggs wrote: > Hi Stephen, > > Just to clarify, by non-offset based ZoneRules do you mean it has a fixed > offset > meaning no transitions; aka ZoneRules.isFixedOffset() = true? > > Thanks, Roger > > > > On 4/24/2015 5:32 AM, Stephen Colebourne wrote: >> >> The code in the webrev changes the behaviour of java.time, so cannot go >> in. >> >> Run this code: >> TimeZone zone = TimeZone.getDefault(); >> System.out.println(zone); >> ZoneId zoneId = ZoneId.systemDefault(); >> System.out.println(zoneId); >> TimeZone.setDefault(TimeZone.getTimeZone("Europe/Paris")); >> TimeZone zone2 = TimeZone.getDefault(); >> System.out.println(zone2); >> ZoneId zoneId2 = ZoneId.systemDefault(); >> System.out.println(zoneId2); >> >> before and after this change, a difference will be seen. Specifically, >> ZoneId.systemDefault() responds to a change to TimeZone.setDefault(). >> >> The correct fix to this issue was outlined in the bug report. >> >> 1) add caching for those ZoneRegion instances that have a non-offset >> based underlying ZoneRules. This would be done in ZoneRegion.ofId(). >> Those instances of ZoneRegion created by ZoneId.ofOffset() would not >> be cached. >> 2) Add a Clock instance variable to ZoneId that is only non-null if >> the object is cached >> 3) Change Clock.system(ZoneId) to check to see if the clock in the >> ZoneId is non-null before creating a new instance. >> >> Stephen >> >> >> >> On 23 April 2015 at 22:28, Roger Riggs wrote: >>> >>> Hi Peter, >>> >>> Setting the user.timezone property doesn't reset the value returned from >>> getDefaultRef(). >>> You can see the new value through java.util.TimeZone but not through >>> java.time.ZoneId. >>> >>> Its a bad idea to allow the default timezone change and in java.time it >>> was >>> purposefully >>> handled as an initialize once value. >>> >>> Roger >>> >>> >>> >>> On 4/23/2015 5:20 PM, Peter Levart wrote: >>>> >>>> >>>> >>>> On 04/23/2015 10:33 PM, Roger Riggs wrote: >>>>> >>>>> Hi Peter, >>>>> >>>>> The defaultTimeZone is cached in java.util.TimeZone the first time it >>>>> is >>>>> referenced >>>>> and is not updated after that. See java.util.TimeZone.getDefaultRef(). >>>>> >>>>> Regards, Roger >>>>> >>>> But any code (with enough privilege) can update it: >>>> >>>> abstract public class TimeZone .... { >>>> >>>> public static void setDefault(TimeZone zone) >>>> { >>>> SecurityManager sm = System.getSecurityManager(); >>>> if (sm != null) { >>>> sm.checkPermission(new PropertyPermission >>>> ("user.timezone", "write")); >>>> } >>>> defaultTimeZone = zone; >>>> } >>>> >>>> >>>> >>>> Peter >>>> >>>>> On 4/23/2015 4:11 PM, Peter Levart wrote: >>>>>> >>>>>> >>>>>> >>>>>> On 04/23/2015 09:53 PM, nadeesh tv wrote: >>>>>>> >>>>>>> Hi all, >>>>>>> >>>>>>> Please review this minor change which optimized >>>>>>> Clock.systemDefaultZone() and Clock.system(ZoneId) to avoid creating >>>>>>> new >>>>>>> instance of Clock.SystemClock every time they are called. >>>>>>> >>>>>>> Bug ID : https://bugs.openjdk.java.net/browse/JDK-8074023 >>>>>>> >>>>>>> Webrev : http://cr.openjdk.java.net/~rriggs/nadeesh-tv-8074023/ >>>>>>> >>>>>> Hi Nadeesh, >>>>>> >>>>>> What happens if ZondeId.systemDefault() changes >>>>>> (TimeZone.setDefault()) >>>>>> *after* Clock class has already been initialized? >>>>>> >>>>>> Regards, Peter >>>>>> > From alexander.v.stepanov at oracle.com Fri Apr 24 15:39:48 2015 From: alexander.v.stepanov at oracle.com (alexander stepanov) Date: Fri, 24 Apr 2015 18:39:48 +0300 Subject: RFR [9] 8078622: remove tidy warnings from JPDA docs Message-ID: <553A63C4.9090602@oracle.com> Hello, Could you please review the following fix http://cr.openjdk.java.net/~avstepan/8078622/webrev.00/ for https://bugs.openjdk.java.net/browse/JDK-8078622 Just some HTML cleanup for docs. Thanks, Alexander From Roger.Riggs at Oracle.com Fri Apr 24 15:49:55 2015 From: Roger.Riggs at Oracle.com (Roger Riggs) Date: Fri, 24 Apr 2015 11:49:55 -0400 Subject: RFR 9: 8077350 Process API Updates Implementation Review (Due 4/23) In-Reply-To: <553A31D1.3060902@oracle.com> References: <5526DA4A.6030808@Oracle.com> <55296E19.3040204@Oracle.com> <5530BECF.60903@gmail.com> <55313A6F.4070208@Oracle.com> <55315476.60908@redhat.com> <553157A4.4030005@Oracle.com> <55315B2C.8060606@Oracle.com> <553A31D1.3060902@oracle.com> Message-ID: <553A6623.2070605@Oracle.com> Hi Alan, On 4/24/2015 8:06 AM, Alan Bateman wrote: > On 17/04/2015 20:12, Roger Riggs wrote: >> The webrev for ProcessAPI updates has been updated to reflect recent >> comments. >> Please review and comment by April 23rd. >> >> The updates include: >> - Renaming Process/ProcessHandle supportsDestroyForcibly to >> supportsNormalTermination >> and updating related descriptions >> - ProcessHandle.destroy/destroyForcible descriptions have more >> consistent descriptions >> - ProcessHandle.destroy now returns ProcessHandle to enable fluent use. >> - Corrected description of default implementation ProcessHandle.onExit >> >> The API doc: http://cr.openjdk.java.net/~rriggs/ph-apidraft/ >> >> The webrev: http://cr.openjdk.java.net/~rriggs/webrev-ph > I'm finally getting to this. > > One comment on terminology is that ProcessBuilder uses phrases like > "Starts a new process" whereas the changes to Process (and the new > ProcessHandle) have switched to "spawn". It's not a big deal but would > be good to have consistency. Spawn seemed more consistent with underlying OS; but I can use starts a process. > > A typo at around L77 of Process, "iecr" has crept in the class > description. will fix. > > I'm not sure about the @implSpec in > Process::supportsNormalTermination. Shouldn't that just specify that > the default implementation throws UOE. An @implNote could comment on > how ProcessBuilder works. Same comment on Process::toHandle. > There needs to be a specification for what ProcessBuilder does; @implNote cannot provide testable assertions. If @implSpec is scoped to exactly the behavior of the specific method, then the behavior of ProcessBuilder will need to be in the main method description as it is done for the existing methods. For example, "Processes returned from ProcessBuilder override the default implementation ..." > In Process::destroy then the wording is adjusted to use the term > "normally terminated". The word "normally" doesn't seem right to me, > "gracefully" might work better. I'm tempted to suggest > supportsNormalTermination be renamed to supportsGracefulTermination if > you haven't discounted it already. There have been a variety of comments on the name and function and suggestions. I arrived at 'normal' because it had a clearer mapping to the underlying OS behavior. The descriptions of SIGTERM vary, but usually include a description of it as the normal way to terminate a process. > > The parent is optional and maybe it would make sense for parent() to > return Optional. The javadoc for this method, isAlive > too, mention "zombie state". I think that needs a bit of description > to generally explain what it means. Will providing Optional make it easier to use? Perhaps the mention of zombie should be removed; it is os specific; though the description of the state may be useful. > > This may have been discussed previously but totalCpuDuration might be > clearer if renamed to totalCpuTimeAsDuration. Also startInstant would > be clearer (to me anyway) as startTimeAsInstant. I would have preferred not include the return type at all instead of making the method name longer. > > A passing comment on the webrev (still working through it) is that it > would be good to keep the line length on the javadoc somewhat > consistent in the file. I can work on that. Thanks, Roger > > -Alan > From lance.andersen at oracle.com Fri Apr 24 15:55:42 2015 From: lance.andersen at oracle.com (Lance Andersen) Date: Fri, 24 Apr 2015 11:55:42 -0400 Subject: RFR [9] 8078622: remove tidy warnings from JPDA docs In-Reply-To: <553A63C4.9090602@oracle.com> References: <553A63C4.9090602@oracle.com> Message-ID: <533CC275-47D4-4DCD-A405-FBF4E2ECAA09@oracle.com> Hi Alexander The changes seem fine Best Lance On Apr 24, 2015, at 11:39 AM, alexander stepanov wrote: > Hello, > > Could you please review the following fix > http://cr.openjdk.java.net/~avstepan/8078622/webrev.00/ > > for > https://bugs.openjdk.java.net/browse/JDK-8078622 > > Just some HTML cleanup for docs. > > Thanks, > Alexander Lance Andersen| Principal Member of Technical Staff | +1.781.442.2037 Oracle Java Engineering 1 Network Drive Burlington, MA 01803 Lance.Andersen at oracle.com From alexander.v.stepanov at oracle.com Fri Apr 24 16:07:37 2015 From: alexander.v.stepanov at oracle.com (alexander stepanov) Date: Fri, 24 Apr 2015 19:07:37 +0300 Subject: RFR [9] 8078622: remove tidy warnings from JPDA docs In-Reply-To: <533CC275-47D4-4DCD-A405-FBF4E2ECAA09@oracle.com> References: <553A63C4.9090602@oracle.com> <533CC275-47D4-4DCD-A405-FBF4E2ECAA09@oracle.com> Message-ID: <553A6A49.3070605@oracle.com> Hello Lance, Thanks! Regards, Alexander On 24.04.2015 18:55, Lance Andersen wrote: > Hi Alexander > > The changes seem fine > > Best > Lance > On Apr 24, 2015, at 11:39 AM, alexander stepanov > > wrote: > >> Hello, >> >> Could you please review the following fix >> http://cr.openjdk.java.net/~avstepan/8078622/webrev.00/ >> >> >> for >> https://bugs.openjdk.java.net/browse/JDK-8078622 >> >> Just some HTML cleanup for docs. >> >> Thanks, >> Alexander > > > > Lance > Andersen| Principal Member of Technical Staff | +1.781.442.2037 > Oracle Java Engineering > 1 Network Drive > Burlington, MA 01803 > Lance.Andersen at oracle.com > > > From Alan.Bateman at oracle.com Fri Apr 24 16:21:06 2015 From: Alan.Bateman at oracle.com (Alan Bateman) Date: Fri, 24 Apr 2015 17:21:06 +0100 Subject: RFR 9: 8077350 Process API Updates Implementation Review (Due 4/23) In-Reply-To: <553A6623.2070605@Oracle.com> References: <5526DA4A.6030808@Oracle.com> <55296E19.3040204@Oracle.com> <5530BECF.60903@gmail.com> <55313A6F.4070208@Oracle.com> <55315476.60908@redhat.com> <553157A4.4030005@Oracle.com> <55315B2C.8060606@Oracle.com> <553A31D1.3060902@oracle.com> <553A6623.2070605@Oracle.com> Message-ID: <553A6D72.6010508@oracle.com> On 24/04/2015 16:49, Roger Riggs wrote: > : >> >> I'm not sure about the @implSpec in >> Process::supportsNormalTermination. Shouldn't that just specify that >> the default implementation throws UOE. An @implNote could comment on >> how ProcessBuilder works. Same comment on Process::toHandle. >> > There needs to be a specification for what ProcessBuilder does; > @implNote cannot provide testable assertions. Right, I'm not suggesting that, just pointing out @implSpec in the webrev doesn't specify how the default implementation works. It instead specifies what ProcessBuilder#start returns. Is the javadoc and webrev in sync, that might be part of the confusion on my part. > >> In Process::destroy then the wording is adjusted to use the term >> "normally terminated". The word "normally" doesn't seem right to me, >> "gracefully" might work better. I'm tempted to suggest >> supportsNormalTermination be renamed to supportsGracefulTermination >> if you haven't discounted it already. > There have been a variety of comments on the name and function and > suggestions. > I arrived at 'normal' because it had a clearer mapping to the > underlying OS behavior. > The descriptions of SIGTERM vary, but usually include a description of > it as the normal way to terminate a process. Okay, if you've settled on this. > >> >> The parent is optional and maybe it would make sense for parent() to >> return Optional. The javadoc for this method, isAlive >> too, mention "zombie state". I think that needs a bit of description >> to generally explain what it means. > Will providing Optional make it easier to use? > > Perhaps the mention of zombie should be removed; it is os specific; > though the description of the state may be useful. If you keep it then some commentary would be helpful as the reader might not understand the term. The parent is optional so something to consider. >> >> This may have been discussed previously but totalCpuDuration might be >> clearer if renamed to totalCpuTimeAsDuration. Also startInstant would >> be clearer (to me anyway) as startTimeAsInstant. > I would have preferred not include the return type at all instead of > making the method name longer. Okay although not having "CpuTime" and "StartTime" in the method names means the names will be less clear. -Alan From Roger.Riggs at Oracle.com Fri Apr 24 17:00:51 2015 From: Roger.Riggs at Oracle.com (Roger Riggs) Date: Fri, 24 Apr 2015 13:00:51 -0400 Subject: RFR 9: 8077350 Process API Updates Implementation Review (Due 4/23) In-Reply-To: <553A6D72.6010508@oracle.com> References: <5526DA4A.6030808@Oracle.com> <55296E19.3040204@Oracle.com> <5530BECF.60903@gmail.com> <55313A6F.4070208@Oracle.com> <55315476.60908@redhat.com> <553157A4.4030005@Oracle.com> <55315B2C.8060606@Oracle.com> <553A31D1.3060902@oracle.com> <553A6623.2070605@Oracle.com> <553A6D72.6010508@oracle.com> Message-ID: <553A76C3.4060106@Oracle.com> Hi Alan, On 4/24/2015 12:21 PM, Alan Bateman wrote: > On 24/04/2015 16:49, Roger Riggs wrote: >> : >>> >>> I'm not sure about the @implSpec in >>> Process::supportsNormalTermination. Shouldn't that just specify that >>> the default implementation throws UOE. An @implNote could comment on >>> how ProcessBuilder works. Same comment on Process::toHandle. >>> >> There needs to be a specification for what ProcessBuilder does; >> @implNote cannot provide testable assertions. > Right, I'm not suggesting that, just pointing out @implSpec in the > webrev doesn't specify how the default implementation works. It > instead specifies what ProcessBuilder#start returns. Is the javadoc > and webrev in sync, that might be part of the confusion on my part. Right, Paul pointed out this as well and I got the javadoc out of sync with the webrev. The javadoc was generated more recently. I should have updated them at the same time or not at all. > > ... > >> >>> >>> The parent is optional and maybe it would make sense for parent() to >>> return Optional. The javadoc for this method, isAlive >>> too, mention "zombie state". I think that needs a bit of description >>> to generally explain what it means. >> Will providing Optional make it easier to use? >> >> Perhaps the mention of zombie should be removed; it is os specific; >> though the description of the state may be useful. > If you keep it then some commentary would be helpful as the reader > might not understand the term. will do. > > The parent is optional so something to consider. I'm open to well reasoned recommendations. > > > >>> >>> This may have been discussed previously but totalCpuDuration might >>> be clearer if renamed to totalCpuTimeAsDuration. Also startInstant >>> would be clearer (to me anyway) as startTimeAsInstant. >> I would have preferred not include the return type at all instead of >> making the method name longer. > Okay although not having "CpuTime" and "StartTime" in the method names > means the names will be less clear. These started out as totalCputime() and startTime(). Those seemed clear enough to me. When you suggest 'AsDuration' is the qualification to indicate the return type or the general nature of a time interval. Thanks, Roger > > -Alan From daniel.fuchs at oracle.com Fri Apr 24 17:07:01 2015 From: daniel.fuchs at oracle.com (Daniel Fuchs) Date: Fri, 24 Apr 2015 19:07:01 +0200 Subject: RFR: 8077846: improve locking strategy for readConfiguration(), reset(), and initializeGlobalHandlers() Message-ID: <553A7835.80209@oracle.com> Hi, Please find below a patch that tries to improve the locking strategy in LogManager. The patch proposes to use a Reantrant lock to deal with configurations changes in reset() and readConfiguration(), and avoids lock contention in initializeGlobalHandlers() http://cr.openjdk.java.net/~dfuchs/webrev_8077846/webrev.00/ comments welcome, best regards, -- daniel From joe.darcy at oracle.com Fri Apr 24 18:04:24 2015 From: joe.darcy at oracle.com (joe darcy) Date: Fri, 24 Apr 2015 11:04:24 -0700 Subject: JDK 9 RFR of JDK-8078334: Mark regression tests using randomness In-Reply-To: <5539DB71.2070605@oracle.com> References: <553703BC.1070504@oracle.com> <5539A249.7050105@oracle.com> <5539DB71.2070605@oracle.com> Message-ID: <553A85A8.7080207@oracle.com> On 4/23/2015 10:58 PM, Alan Bateman wrote: > On 24/04/2015 02:54, Joseph D. Darcy wrote: >> Hello, >> >> Any additional comments on marking with tests in question with a >> "randomness" keyword? >> >> Thanks, >> >> -Joe >> > I don't object to this keyword although I should say that most of the > (apparent) randomness that I've seen hasn't been because of tests > using Random but rather because of non-deterministic sequence of tests > running in the same VM. The switch from othervm to agentvm a few years > ago took a long time to weed out issues, same thing (even more) with > -concurrency. Another source of apparent randomness is just having a > large pool of machines and where machines are randomly selected to > execute the tests. > > I agree with your comments that tests using Random should have report > the seed and a have a way to re-run with the same value. It could help > with some cases. > > One thing that isn't clear to me is how this keyword will be > maintained. If I modify a test and replace the use of Random then I > guess I need to remember to also remove this label. When I add a test > that uses Random ... Just wondering if there is a tool to do the > tests analysis, identify the use of specific APIs ,and help identify > where the keyword might be missing or not needed. > The goal of the keyword is to enable better analysis of bug failures. We (still) have some intermittent test failures in the platform, some probably remaining from -concurrency issues and some due to inconsistent machine config issues on the test farms. However, there is reason to believe some of the tests also fail because of the use of randomness in the generation of test cases. For example, the test java/lang/invoke/MethodHandles/CatchExceptionTest.java fails about once every three hundred runs when the random cases it generates trigger an error condition. Setting the seed to known-bad value causes the test to fail consistently (JDK-8055269). I have suspicions some of our other intermittently failing tests are in a similar but undiagnosed situation. If a test uses randomness, I think the default assumed cause for a test failure should switch from environmental causes (bad machine config, etc.) to the random behavior. Therefore, when a random-using test fails, I think the failure analysis needs to include recording of the bad seed to see if the failure is reproducible / deterministic with a fixed seed value. I was very surprised by the large number of random-using tests in the JDK regression tests. Nearly all of these have been stably passing for many years. After the one-time cost of this large update to add the keywords, there would be a small amount of incremental test maintenance as new random-using tests were added or the randomness value of a test changed. However, I would expect whether or not a test used randomness to be a property of a test that very rarely changed. Thanks, -Joe From aleksey.shipilev at oracle.com Fri Apr 24 18:05:30 2015 From: aleksey.shipilev at oracle.com (Aleksey Shipilev) Date: Fri, 24 Apr 2015 21:05:30 +0300 Subject: RFR (XS) 8076759: AbstractStringBuilder.append(...) should ensure enough capacity for the upcoming "trivial" append calls Message-ID: <553A85EA.5090603@oracle.com> Hi, This seems to be a simple one-liner fix, but the background is more complicated. See the bug: https://bugs.openjdk.java.net/browse/JDK-8076759 The bottom line is that our current resizing policy in ASB is hostile for long appends. There is a heuristics that extends the capacity to match the *exact* length of append if doubling the array would not help. This heuristics has a nasty corner case: if there is an upcoming append after a large one, then we are guaranteed to re-size again. If an upcoming append is large in itself, the resizing is inevitable even under the doubling-the-storage strategy; but if we only do a small append, then we can be smarter. After trying a few options to fix this (see below), I have settled on just adding a simple static "pad", to absorb the trivial appends after a large append: http://cr.openjdk.java.net/~shade/8076759/webrev.00/ The choice of "32" as magic number is deliberate: arraycopy likes large power-of-two strides (and it does not like to make catch up loops for small residuals). "16" is too small to fit the decimal representation of Long.MIN_VALUE, therefore, we pick "32". There are other approaches, briefly mentioned here: http://cr.openjdk.java.net/~shade/8076759/patches.txt There is a direct correlation between the allocation pressure, and test performance: http://cr.openjdk.java.net/~shade/8076759/data-perf.png http://cr.openjdk.java.net/~shade/8076759/data-foot.png Naively, one could expect doubling the storage ("mult2") until we reach $minimalCapacity solves the problem, but it wastes too much memory, and only reaches the "plus32" on power-of-two sizes. That is also the Achilles' Heel of the heuristics, because appending the power-of-two-plus-one-sized string will set us up for the original problem. This effect can be alleviated by doing the padding as well ("mult2-plus32"). Exactly the same trouble manifests on smaller strings that go through the usual double-the-storage route, and this is why a proposed patch makes the pad on common path. I do believe the current heuristics is smart about large appends, and mult2* strategies undo it. Therefore, I would think keeping the minimumCapacity cap is a good thing, and just adding the pad is a good solution. Thus, it is in the webrev. Thanks, -Aleksey. From brian.burkhalter at oracle.com Fri Apr 24 22:01:20 2015 From: brian.burkhalter at oracle.com (Brian Burkhalter) Date: Fri, 24 Apr 2015 15:01:20 -0700 Subject: [9] RFR of 8078586: java/lang/Double/ParseHexFloatingPoint.java fails intermittently Message-ID: <65991789-82EF-4A71-8EE7-1A35C0DE1768@oracle.com> Please review at your convenience. Issue: https://bugs.openjdk.java.net/browse/JDK-8078586 Patch: http://cr.openjdk.java.net/~bpb/8078586/webrev.00/ Summary: Add setting of Random seed via system property with fallback to a random seed from a separate Random instance and printing the seed actually used in the test. The question is whether this change should be made under JDK-8078586 which is better resolved as ?Cannot Reproduce? given its 0.07% failure rate, or whether a separate issue should be filed for these test changes. Thanks, Brian From david.holmes at oracle.com Mon Apr 27 01:21:15 2015 From: david.holmes at oracle.com (David Holmes) Date: Mon, 27 Apr 2015 11:21:15 +1000 Subject: RFR: 8077846: improve locking strategy for readConfiguration(), reset(), and initializeGlobalHandlers() In-Reply-To: <553A7835.80209@oracle.com> References: <553A7835.80209@oracle.com> Message-ID: <553D8F0B.4070102@oracle.com> Hi Daniel, On 25/04/2015 3:07 AM, Daniel Fuchs wrote: > Hi, > > Please find below a patch that tries to improve the locking > strategy in LogManager. > > The patch proposes to use a Reantrant lock to deal with > configurations changes in reset() and readConfiguration(), > and avoids lock contention in initializeGlobalHandlers() > > http://cr.openjdk.java.net/~dfuchs/webrev_8077846/webrev.00/ How early in VM startup can logging be initialized and used? I just wonder whether the use of ReentrantLock changes that at all? Took me a while to understand the use of initializeGlobalHandlersDone. I think this comment: 1622 // If we are in the process of initializing global handlers we 1623 // also need to lock & wait (this case is indicated by 1624 // initializeGlobalHandlersDone == false). would be a little clearer as: 1622 // If we are in the process of initializing global handlers we 1623 // also need to acquire the lock to wait until it is complete 1624 // (this case is indicated by initializeGlobalHandlersDone == false). But why are these initialized to true and not false ?? 184 private volatile boolean initializeGlobalHandlersCalled = true; 185 private volatile boolean initializeGlobalHandlersDone = true; I think this code/comment: 1629 if (initializeGlobalHandlersCalled) return; // recursive call would also be clearer as: 1629 if (initializeGlobalHandlersCalled) return; // recursive call or another thread did it already Thanks, David > comments welcome, > > best regards, > > -- daniel From Alan.Bateman at oracle.com Mon Apr 27 06:45:51 2015 From: Alan.Bateman at oracle.com (Alan Bateman) Date: Mon, 27 Apr 2015 07:45:51 +0100 Subject: RFR: 8077846: improve locking strategy for readConfiguration(), reset(), and initializeGlobalHandlers() In-Reply-To: <553D8F0B.4070102@oracle.com> References: <553A7835.80209@oracle.com> <553D8F0B.4070102@oracle.com> Message-ID: <553DDB1F.3020306@oracle.com> On 27/04/2015 02:21, David Holmes wrote: > > How early in VM startup can logging be initialized and used? I just > wonder whether the use of ReentrantLock changes that at all? > It can't be used early in the startup. So assume VM.isBooted and potentially several threads trying to initialize it around the same time. I wouldn't expect the configuration to change too often but there may be scenarios where this happens. -Alan From daniel.fuchs at oracle.com Mon Apr 27 07:28:03 2015 From: daniel.fuchs at oracle.com (Daniel Fuchs) Date: Mon, 27 Apr 2015 09:28:03 +0200 Subject: RFR: 8077846: improve locking strategy for readConfiguration(), reset(), and initializeGlobalHandlers() In-Reply-To: <553D8F0B.4070102@oracle.com> References: <553A7835.80209@oracle.com> <553D8F0B.4070102@oracle.com> Message-ID: <553DE503.2060608@oracle.com> Hi David, On 4/27/15 3:21 AM, David Holmes wrote: > Hi Daniel, > > On 25/04/2015 3:07 AM, Daniel Fuchs wrote: >> Hi, >> >> Please find below a patch that tries to improve the locking >> strategy in LogManager. >> >> The patch proposes to use a Reantrant lock to deal with >> configurations changes in reset() and readConfiguration(), >> and avoids lock contention in initializeGlobalHandlers() >> >> http://cr.openjdk.java.net/~dfuchs/webrev_8077846/webrev.00/ > > How early in VM startup can logging be initialized and used? I just > wonder whether the use of ReentrantLock changes that at all? The initialization will not happen before the first class calls Logger.getLogger() or LogManager.getLogManager(). In particular, it does not happen when the LogManager.class is loaded (that is: it no longer happens as part of the class static initialization). I see Alan replied to that question as well... > Took me a while to understand the use of initializeGlobalHandlersDone. > I think this comment: > > 1622 // If we are in the process of initializing global > handlers we > 1623 // also need to lock & wait (this case is indicated by > 1624 // initializeGlobalHandlersDone == false). > > would be a little clearer as: > > 1622 // If we are in the process of initializing global > handlers we > 1623 // also need to acquire the lock to wait until it is > complete > 1624 // (this case is indicated by > initializeGlobalHandlersDone == false). Exactly. Thanks! > But why are these initialized to true and not false ?? > 184 private volatile boolean initializeGlobalHandlersCalled = true; > 185 private volatile boolean initializeGlobalHandlersDone = true; It doesn't make sense to try & create global handlers before the configuration is read for the first time. In addition the first thing that readConfiguration does is to call reset() which switches initializeGlobalHandlersCalled to true to avoid that it gets initialized before the Properties is later loaded. I agree that this initialization to 'true' is not intuitive. My fingers had been itching several times to change it to false ;-) but the 'true' value makes more sense once you look at the initialization code path. I should probably add a comment: // These variables are initialized to true, to avoid trying // to initialize global handlers before the configuration is read // for the first time. > > I think this code/comment: > > 1629 if (initializeGlobalHandlersCalled) return; // > recursive call > > would also be clearer as: > > 1629 if (initializeGlobalHandlersCalled) > return; // recursive call or another thread did > it already Thanks David! best regards, -- daniel > > Thanks, > David > >> comments welcome, >> >> best regards, >> >> -- daniel From david.holmes at oracle.com Mon Apr 27 12:21:27 2015 From: david.holmes at oracle.com (David Holmes) Date: Mon, 27 Apr 2015 22:21:27 +1000 Subject: RFR: 8077846: improve locking strategy for readConfiguration(), reset(), and initializeGlobalHandlers() In-Reply-To: <553DE503.2060608@oracle.com> References: <553A7835.80209@oracle.com> <553D8F0B.4070102@oracle.com> <553DE503.2060608@oracle.com> Message-ID: <553E29C7.8030800@oracle.com> On 27/04/2015 5:28 PM, Daniel Fuchs wrote: > Hi David, > > On 4/27/15 3:21 AM, David Holmes wrote: >> Hi Daniel, >> >> On 25/04/2015 3:07 AM, Daniel Fuchs wrote: >>> Hi, >>> >>> Please find below a patch that tries to improve the locking >>> strategy in LogManager. >>> >>> The patch proposes to use a Reantrant lock to deal with >>> configurations changes in reset() and readConfiguration(), >>> and avoids lock contention in initializeGlobalHandlers() >>> >>> http://cr.openjdk.java.net/~dfuchs/webrev_8077846/webrev.00/ >> >> How early in VM startup can logging be initialized and used? I just >> wonder whether the use of ReentrantLock changes that at all? > > The initialization will not happen before the first class calls > Logger.getLogger() or LogManager.getLogManager(). > In particular, it does not happen when the LogManager.class is loaded > (that is: it no longer happens as part of the class static > initialization). > > I see Alan replied to that question as well... I'm just wondering what anyone might be running with a customized core class that uses logging, and which may now fail due to the different requirements. >> Took me a while to understand the use of initializeGlobalHandlersDone. >> I think this comment: >> >> 1622 // If we are in the process of initializing global >> handlers we >> 1623 // also need to lock & wait (this case is indicated by >> 1624 // initializeGlobalHandlersDone == false). >> >> would be a little clearer as: >> >> 1622 // If we are in the process of initializing global >> handlers we >> 1623 // also need to acquire the lock to wait until it is >> complete >> 1624 // (this case is indicated by >> initializeGlobalHandlersDone == false). > > Exactly. Thanks! > >> But why are these initialized to true and not false ?? >> 184 private volatile boolean initializeGlobalHandlersCalled = true; >> 185 private volatile boolean initializeGlobalHandlersDone = true; > > It doesn't make sense to try & create global handlers before the > configuration is read for the first time. In addition the first thing > that readConfiguration does is to call reset() which switches > initializeGlobalHandlersCalled to true to avoid that it gets initialized > before the Properties is later loaded. > > I agree that this initialization to 'true' is not intuitive. > My fingers had been itching several times to change it to false ;-) > but the 'true' value makes more sense once you look at the > initialization code path. > > I should probably add a comment: > > // These variables are initialized to true, to avoid trying > // to initialize global handlers before the configuration is read > // for the first time. Sounds good to me. Thanks, David > >> >> I think this code/comment: >> >> 1629 if (initializeGlobalHandlersCalled) return; // >> recursive call >> >> would also be clearer as: >> >> 1629 if (initializeGlobalHandlersCalled) >> return; // recursive call or another thread did >> it already > > Thanks David! > > best regards, > > -- daniel >> >> Thanks, >> David >> >>> comments welcome, >>> >>> best regards, >>> >>> -- daniel > From scolebourne at joda.org Mon Apr 27 13:22:49 2015 From: scolebourne at joda.org (Stephen Colebourne) Date: Mon, 27 Apr 2015 14:22:49 +0100 Subject: Additional method on Stream Message-ID: This is a request for an additional method on java.util.stream.Stream. Having written quite a bit of code in Java 8 now, one annoyance keeps on coming up, filtering and casting the stream. Currently, it is necessary to do this: return input.stream() .filter(Foo.class::isInstance) .map(Foo.class::cast) .someTerminalOperation(); or return input.stream() .filter(t -> t instanceof Foo) .map(t -> (Foo) t) .someTerminalOperation(); Really, what is needed is this: return input.stream() .filter(Foo.class) .someTerminalOperation(); For info, Guava's FluentIterable has such a method. The new method signature would be something like: public Stream filter(Class cls); As far as I can see, there is no problem in implementing this in both serial and parallel modes, as it is essentially just a convenience. Thoughts? Stephen From paul.sandoz at oracle.com Mon Apr 27 13:41:37 2015 From: paul.sandoz at oracle.com (Paul Sandoz) Date: Mon, 27 Apr 2015 15:41:37 +0200 Subject: Additional method on Stream In-Reply-To: References: Message-ID: Hi Stephen, You can do this: static Function> casting(Class c) { // bike shed for clearer name return o -> Stream.ofNullable(c.isInstance(o) ? c.cast(o) : null); } Object[] s = Stream.of(1, 2, "3", 4).toArray(); Stream.of(s).flatMap(casting(Integer.class)). forEach(System.out::println); I am a bit reluctant to add such a specific kind of filter method to Stream when one can do the above. In general my preference is to keep the stream operation methods as general as possible. Paul. On Apr 27, 2015, at 3:22 PM, Stephen Colebourne wrote: > This is a request for an additional method on java.util.stream.Stream. > > Having written quite a bit of code in Java 8 now, one annoyance keeps > on coming up, filtering and casting the stream. > > Currently, it is necessary to do this: > > return input.stream() > .filter(Foo.class::isInstance) > .map(Foo.class::cast) > .someTerminalOperation(); > > or > > return input.stream() > .filter(t -> t instanceof Foo) > .map(t -> (Foo) t) > .someTerminalOperation(); > > Really, what is needed is this: > > return input.stream() > .filter(Foo.class) > .someTerminalOperation(); > > For info, Guava's FluentIterable has such a method. > > The new method signature would be something like: > > public Stream filter(Class cls); > > As far as I can see, there is no problem in implementing this in both > serial and parallel modes, as it is essentially just a convenience. > > Thoughts? > Stephen From scolebourne at joda.org Mon Apr 27 14:56:28 2015 From: scolebourne at joda.org (Stephen Colebourne) Date: Mon, 27 Apr 2015 15:56:28 +0100 Subject: Additional method on Stream In-Reply-To: References: Message-ID: Obviously, this is yet another possible workaround. But it is a workaround. There really aren't that many rough edges with the set of methods added with lambdas, but this is definitely one. That Guava handled it specially is another good indication. BTW, I wait months before making this request to see if it really was common enough a pattern, but I'm confident that it is now. Stephen On 27 April 2015 at 14:41, Paul Sandoz wrote: > Hi Stephen, > > You can do this: > > static Function> casting(Class c) { // bike shed for clearer name > return o -> Stream.ofNullable(c.isInstance(o) ? c.cast(o) : null); > } > > > Object[] s = Stream.of(1, 2, "3", 4).toArray(); > Stream.of(s).flatMap(casting(Integer.class)). > forEach(System.out::println); > > > I am a bit reluctant to add such a specific kind of filter method to Stream when one can do the above. > > In general my preference is to keep the stream operation methods as general as possible. > > Paul. > > On Apr 27, 2015, at 3:22 PM, Stephen Colebourne wrote: > >> This is a request for an additional method on java.util.stream.Stream. >> >> Having written quite a bit of code in Java 8 now, one annoyance keeps >> on coming up, filtering and casting the stream. >> >> Currently, it is necessary to do this: >> >> return input.stream() >> .filter(Foo.class::isInstance) >> .map(Foo.class::cast) >> .someTerminalOperation(); >> >> or >> >> return input.stream() >> .filter(t -> t instanceof Foo) >> .map(t -> (Foo) t) >> .someTerminalOperation(); >> >> Really, what is needed is this: >> >> return input.stream() >> .filter(Foo.class) >> .someTerminalOperation(); >> >> For info, Guava's FluentIterable has such a method. >> >> The new method signature would be something like: >> >> public Stream filter(Class cls); >> >> As far as I can see, there is no problem in implementing this in both >> serial and parallel modes, as it is essentially just a convenience. >> >> Thoughts? >> Stephen > From paul.sandoz at oracle.com Mon Apr 27 15:23:57 2015 From: paul.sandoz at oracle.com (Paul Sandoz) Date: Mon, 27 Apr 2015 17:23:57 +0200 Subject: Additional method on Stream In-Reply-To: References: Message-ID: <10F26F8C-3F79-45B9-9D06-C2F0CDCF59D7@oracle.com> On Apr 27, 2015, at 4:56 PM, Stephen Colebourne wrote: > Obviously, this is yet another possible workaround. But it is a > workaround. I don't consider it "just a workaround" :-) > There really aren't that many rough edges with the set of > methods added with lambdas, but this is definitely one. That Guava > handled it specially is another good indication. > Tis conjecture, but perhaps it might have been different in post-lambda world? One issue is there are zillions of possible more specific convenience operations we could add. Everyone has their own favourite. Some static methods were recently added to Stream and Optional in preference to such operations. There has to be a really good reason to add new operations. I realize this use-case might be more common than others but i am still yet to be convinced that it has sufficient weight given flatMap + lambda + static method. > BTW, I wait months before making this request to see if it really was > common enough a pattern, but I'm confident that it is now. > Were you aware of the pattern using flatMap during those months? Paul. From peter.levart at gmail.com Mon Apr 27 15:26:11 2015 From: peter.levart at gmail.com (Peter Levart) Date: Mon, 27 Apr 2015 17:26:11 +0200 Subject: RFR: JDK-8074002 java.time.ZoneId.systemDefault() should be faster Message-ID: <553E5513.7010209@gmail.com> Hi, Please review the following improvement that caches default ZoneId object and makes the frequently executed ZoneId.systemDefault() method faster: http://cr.openjdk.java.net/~plevart/jdk9-dev/ZoneId.systemDefault/webrev.04/ The patch is just a rebased version of webrev.03 + some comments added about the importance of defensive cloning in TimeZone.setDefault(). There was already a discussion about this patch a while ago and Stephen basically approved it in this form: http://mail.openjdk.java.net/pipermail/core-libs-dev/2015-February/031714.html Thanks, Peter Levart From peter.levart at gmail.com Mon Apr 27 16:24:54 2015 From: peter.levart at gmail.com (Peter Levart) Date: Mon, 27 Apr 2015 18:24:54 +0200 Subject: RFR: JDK-8074003 java.time.zone.ZoneRules.getOffset(java.time.Instant) can be optimized Message-ID: <553E62D6.9030102@gmail.com> Hi again, Here's another optimization to be reviewed that has been discussed a while ago (just rebased from webrev.01) and approved by Stephen: http://cr.openjdk.java.net/~plevart/jdk9-dev/ZoneOffsetTransition.epochSecond/webrev.02/ The discussion about it is intermingled with the ZoneId.systemDefault() discussion and starts about here: http://mail.openjdk.java.net/pipermail/core-libs-dev/2015-February/031873.html The rationale for the optimization is speeding-up the conversion from epoch time to LocalDateTime. This conversion uses ZoneRules.getOffset(Instant) where there is a loop over ZoneOffsetTransition[] array that searches for 1st transition that has its toEpochSecond value less than the Instant's epochSecond. This calls ZoneOffsetTransition.toEpochSecond repeatedly, converting ZoneOffsetTransition.transition which is a LocalDateTime to epochSecond. This repeated conversion is unnecessary, as ZoneOffsetTransition[] array is part of ZoneRules which is cached. Optimizing the ZoneOffsetTransition implementation (keeping both LocalDateTime variant and eposhSecond variant of transition time as the object's state) speeds up this conversion. Regards, Peter From pavel.rappo at oracle.com Mon Apr 27 16:48:31 2015 From: pavel.rappo at oracle.com (Pavel Rappo) Date: Mon, 27 Apr 2015 17:48:31 +0100 Subject: RFR JDK-8029804: (spec) BufferedWriter.write(String, int, int) IndexOutOfBoundsException Message-ID: Hi everyone, Could you please review my change for JDK-8029804 http://cr.openjdk.java.net/~prappo/8029804/webrev.00/ ------------------------------------------------------------------------------- There is an issue where java.io.BufferedWriter.write(String s, int off, int len) doesn't check required preconditions for `off` and `len` and goes straight to the algorithm procedures. As a result an acceptable region for (off, len) is wider than the one declared by parent. For example, following calls should throw IndexOutOfBoundsException, but they don't: bw.write("abc", 10, 0) bw.write("abc", 5, -1) bw.write("abc", -7, 0) bw.write("abc", -2, -3) bw.write("abc", 3, Integer.MAX_VALUE) The problem though is not in the bug itself (it's been there for a long time), but rather than the amendment to the javadoc which supposed to describe this divergence is not comprehensive: *

    If the value of the len parameter is negative then no * characters are written. This is contrary to the specification of this * method in the {@linkplain java.io.Writer#write(java.lang.String,int,int) * superclass}, which requires that an {@link IndexOutOfBoundsException} be * thrown. Suggested solution is to update the javadoc and provide a test that gives a certain amount of confidence that the javadoc captures the actual contract. -Pavel From scolebourne at joda.org Mon Apr 27 16:51:07 2015 From: scolebourne at joda.org (Stephen Colebourne) Date: Mon, 27 Apr 2015 17:51:07 +0100 Subject: RFR: JDK-8074003 java.time.zone.ZoneRules.getOffset(java.time.Instant) can be optimized In-Reply-To: <553E62D6.9030102@gmail.com> References: <553E62D6.9030102@gmail.com> Message-ID: One additional change is needed. The compareTo() method can rely on the new epochSecond field as well. Otherwise good! Stephen On 27 April 2015 at 17:24, Peter Levart wrote: > Hi again, > > Here's another optimization to be reviewed that has been discussed a while > ago (just rebased from webrev.01) and approved by Stephen: > > http://cr.openjdk.java.net/~plevart/jdk9-dev/ZoneOffsetTransition.epochSecond/webrev.02/ > > > The discussion about it is intermingled with the ZoneId.systemDefault() > discussion and starts about here: > > http://mail.openjdk.java.net/pipermail/core-libs-dev/2015-February/031873.html > > > The rationale for the optimization is speeding-up the conversion from epoch > time to LocalDateTime. This conversion uses ZoneRules.getOffset(Instant) > where there is a loop over ZoneOffsetTransition[] array that searches for > 1st transition that has its toEpochSecond value less than the Instant's > epochSecond. This calls ZoneOffsetTransition.toEpochSecond repeatedly, > converting ZoneOffsetTransition.transition which is a LocalDateTime to > epochSecond. This repeated conversion is unnecessary, as > ZoneOffsetTransition[] array is part of ZoneRules which is cached. > Optimizing the ZoneOffsetTransition implementation (keeping both > LocalDateTime variant and eposhSecond variant of transition time as the > object's state) speeds up this conversion. > > > Regards, Peter > From scolebourne at joda.org Mon Apr 27 18:24:09 2015 From: scolebourne at joda.org (Stephen Colebourne) Date: Mon, 27 Apr 2015 19:24:09 +0100 Subject: RFR: JDK-8074002 java.time.ZoneId.systemDefault() should be faster In-Reply-To: <553E5513.7010209@gmail.com> References: <553E5513.7010209@gmail.com> Message-ID: This seems like a good enhancement. Stephen On 27 April 2015 at 16:26, Peter Levart wrote: > Hi, > > Please review the following improvement that caches default ZoneId object > and makes the frequently executed ZoneId.systemDefault() method faster: > > http://cr.openjdk.java.net/~plevart/jdk9-dev/ZoneId.systemDefault/webrev.04/ > > The patch is just a rebased version of webrev.03 + some comments added about > the importance of defensive cloning in TimeZone.setDefault(). There was > already a discussion about this patch a while ago and Stephen basically > approved it in this form: > > http://mail.openjdk.java.net/pipermail/core-libs-dev/2015-February/031714.html > > > Thanks, > > Peter Levart From Roger.Riggs at Oracle.com Mon Apr 27 18:50:05 2015 From: Roger.Riggs at Oracle.com (Roger Riggs) Date: Mon, 27 Apr 2015 14:50:05 -0400 Subject: RFR 9: 8078369: [testbug] java/time/tck/java/time/TCKOffsetTime[now] fails on slow devices Message-ID: <553E84DD.1030009@Oracle.com> Please review a timing relaxation so tests do not fail on very slow hardware with more expensive runtime options. (-Xcomp) The change will also be backported to jdk 8. Issue: 8078369: [testbug] java/time/tck/java/time/TCKOffsetTime[now] fails on slow devices Webrev: http://cr.openjdk.java.net/~rriggs/webrev-timeout-8078369/ Thanks, Roger From scolebourne at joda.org Mon Apr 27 18:52:35 2015 From: scolebourne at joda.org (Stephen Colebourne) Date: Mon, 27 Apr 2015 19:52:35 +0100 Subject: RFR 9: 8078369: [testbug] java/time/tck/java/time/TCKOffsetTime[now] fails on slow devices In-Reply-To: <553E84DD.1030009@Oracle.com> References: <553E84DD.1030009@Oracle.com> Message-ID: Fine by me. Stephen On 27 April 2015 at 19:50, Roger Riggs wrote: > Please review a timing relaxation so tests do not fail on very slow hardware > with more expensive runtime options. (-Xcomp) > > The change will also be backported to jdk 8. > > Issue: > 8078369: [testbug] java/time/tck/java/time/TCKOffsetTime[now] fails on > slow devices > > Webrev: > http://cr.openjdk.java.net/~rriggs/webrev-timeout-8078369/ > > Thanks, Roger > From peter.levart at gmail.com Mon Apr 27 19:04:38 2015 From: peter.levart at gmail.com (Peter Levart) Date: Mon, 27 Apr 2015 21:04:38 +0200 Subject: Additional method on Stream In-Reply-To: <10F26F8C-3F79-45B9-9D06-C2F0CDCF59D7@oracle.com> References: <10F26F8C-3F79-45B9-9D06-C2F0CDCF59D7@oracle.com> Message-ID: <553E8846.90202@gmail.com> On 04/27/2015 05:23 PM, Paul Sandoz wrote: > On Apr 27, 2015, at 4:56 PM, Stephen Colebourne wrote: >> Obviously, this is yet another possible workaround. But it is a >> workaround. > I don't consider it "just a workaround" :-) > > >> There really aren't that many rough edges with the set of >> methods added with lambdas, but this is definitely one. That Guava >> handled it specially is another good indication. >> > Tis conjecture, but perhaps it might have been different in post-lambda world? > > One issue is there are zillions of possible more specific convenience operations we could add. Everyone has their own favourite. Some static methods were recently added to Stream and Optional in preference to such operations. > > There has to be a really good reason to add new operations. I realize this use-case might be more common than others but i am still yet to be convinced that it has sufficient weight given flatMap + lambda + static method. One reason might be that the workaround creates at least two new objects per included element of the stream and the overhead involved for executing the flat-map logic. A more general operation might be something like the following: /** * Returns a stream consisting of the non-null results of applying the given * function to the elements of this stream. */ Stream filterMap(Function mapper); Stephen's example would then read: return input.stream() .filterMap(t -> t instanceof Foo ? (Foo) t : null) .someTerminalOperation(); Combining filtering and mapping in one operation might often be desirable to avoid duplicate work (for example when filtering and mapping needs to compute some common but costly intermediate result for each element). flatMap is admittedly suitable for that too, but has it's overhead. At what per-operation cost this overhead pays-off can be seen at the end... I know that null values were a controversial topic when this API was being designed and that the decision was made to basically "ignore" their presence in stream elements. So making null part of the API contract might be out of the question right? So what about Optional? Could it be used to make flatMap a little more efficient for the combined filter/map case? For example, could the following composition be written in a more concise way? input.stream() .map(t -> t instanceof Foo ? Optional.of((Foo) t) : Optional.empty()) .filter(Optional::isPresent) .map(Optional::get) Maybe with operation like: /** * Returns a stream consisting of the "present" unwrapped results of applying the given * function to the elements of this stream. */ Stream mapOptionally(Function> mapper); But that's not what Stephen would like to see, and I personally don't mind being a little more verbose if it makes code execute faster. I would be pretty confident writing the following: input.stream() .map(t -> t instanceof Foo ? (Foo)t : null) .filter(f -> f != null) To quantify the overheads involved with various approaches, I created a little benchmark that shows the following results: Benchmark (opCost) Mode Samples Score Score error Units j.t.StreamBench.filterThenMap 0 avgt 10 1.186 0.010 ms/op j.t.StreamBench.filterThenMap 10 avgt 10 2.642 0.205 ms/op j.t.StreamBench.filterThenMap 20 avgt 10 5.254 0.011 ms/op j.t.StreamBench.filterThenMap 30 avgt 10 8.187 0.165 ms/op j.t.StreamBench.filterThenMap 40 avgt 10 11.525 0.295 ms/op j.t.StreamBench.flatMap 0 avgt 10 2.015 0.188 ms/op j.t.StreamBench.flatMap 10 avgt 10 3.287 0.224 ms/op j.t.StreamBench.flatMap 20 avgt 10 5.275 0.638 ms/op j.t.StreamBench.flatMap 30 avgt 10 7.033 0.209 ms/op j.t.StreamBench.flatMap 40 avgt 10 9.146 0.281 ms/op j.t.StreamBench.mapToNullable 0 avgt 10 1.185 0.006 ms/op j.t.StreamBench.mapToNullable 10 avgt 10 2.120 0.392 ms/op j.t.StreamBench.mapToNullable 20 avgt 10 3.677 0.210 ms/op j.t.StreamBench.mapToNullable 30 avgt 10 5.526 0.126 ms/op j.t.StreamBench.mapToNullable 40 avgt 10 7.884 0.202 ms/op j.t.StreamBench.mapToOptional 0 avgt 10 1.144 0.121 ms/op j.t.StreamBench.mapToOptional 10 avgt 10 2.322 0.146 ms/op j.t.StreamBench.mapToOptional 20 avgt 10 4.371 0.270 ms/op j.t.StreamBench.mapToOptional 30 avgt 10 6.215 0.536 ms/op j.t.StreamBench.mapToOptional 40 avgt 10 8.471 0.554 ms/op Comparing .filter(op).map(op) with .flatMap(op) where each operation has it's cost, we see there is a tripping point at opCost=20 where flatMap() starts to pay off if we can merge the two ops into one with equal cost. But we can also see that flatMap has it's cost too, compared to other two approaches (mapToNullable/mapToOptional) which is most obvious when the operation cost is low. So the conclusion? No, I don't think we need a new Stream method. I just wanted to show that flatMap() is maybe the most universal but not always the best (fastest) answer for each problem. Regards, Peter P.S. The benchmark source: package jdk.test; import org.openjdk.jmh.annotations.*; import org.openjdk.jmh.infra.Blackhole; import java.util.ArrayList; import java.util.List; import java.util.Optional; import java.util.concurrent.ThreadLocalRandom; import java.util.concurrent.TimeUnit; import java.util.function.Function; import java.util.function.Predicate; import java.util.stream.Stream; /** * Created by peter on 4/27/15. */ @BenchmarkMode(Mode.AverageTime) @Fork(value = 1, warmups = 0) @Warmup(iterations = 5) @Measurement(iterations = 10) @OutputTimeUnit(TimeUnit.MILLISECONDS) @State(Scope.Benchmark) public class StreamBench { @Param({"0", "10", "20", "30", "40"}) public long opCost; List objects; @Setup public void setup() { objects = new ArrayList<>(100000); ThreadLocalRandom tlr = ThreadLocalRandom.current(); for (int i = 0; i < 100000; i++) { objects.add(tlr.nextBoolean() ? "123" : 123); } } Function withCost(Function function) { return f -> { Blackhole.consumeCPU(opCost); return function.apply(f); }; } Predicate withCost(Predicate predicate) { return t -> { Blackhole.consumeCPU(opCost); return predicate.test(t); }; } @Benchmark public long filterThenMap() { return objects.stream() .filter(withCost((Object o) -> o instanceof String)) .map(withCost((Object o) -> (String) o)) .count(); } @Benchmark public long flatMap() { return objects.stream() .flatMap(withCost((Object o) -> o instanceof String ? Stream.of((String) o) : Stream.empty())) .count(); } @Benchmark public long mapToOptional() { return objects.stream() .map(withCost((Object o) -> o instanceof String ? Optional.of((String) o) : Optional.empty())) .filter(Optional::isPresent) .map(Optional::get) .count(); } @Benchmark public long mapToNullable() { return objects.stream() .map(withCost((Object o) -> o instanceof String ? (String) o : null)) .filter(s -> s != null) .count(); } } > >> BTW, I wait months before making this request to see if it really was >> common enough a pattern, but I'm confident that it is now. >> > Were you aware of the pattern using flatMap during those months? > > Paul. > From daniel.fuchs at oracle.com Mon Apr 27 19:37:07 2015 From: daniel.fuchs at oracle.com (Daniel Fuchs) Date: Mon, 27 Apr 2015 21:37:07 +0200 Subject: RFR 9: 8078369: [testbug] java/time/tck/java/time/TCKOffsetTime[now] fails on slow devices In-Reply-To: <553E84DD.1030009@Oracle.com> References: <553E84DD.1030009@Oracle.com> Message-ID: <553E8FE3.9030909@oracle.com> Hi Roger, Looks good to me. I'm surprised that only these tests are failing. IIRC I also had to round up some time comparisons in tests when I increased the resolution of the SystemClock - and I believe I rounded them to only 1 second... Anyway - if they fail we know what to do :-) best regards, -- daniel ] On 4/27/15 8:50 PM, Roger Riggs wrote: > Please review a timing relaxation so tests do not fail on very slow > hardware > with more expensive runtime options. (-Xcomp) > > The change will also be backported to jdk 8. > > Issue: > 8078369: [testbug] java/time/tck/java/time/TCKOffsetTime[now] fails > on slow devices > > Webrev: > http://cr.openjdk.java.net/~rriggs/webrev-timeout-8078369/ > > Thanks, Roger > From david.holmes at oracle.com Mon Apr 27 20:05:25 2015 From: david.holmes at oracle.com (David Holmes) Date: Tue, 28 Apr 2015 06:05:25 +1000 Subject: RFR: 8077846: improve locking strategy for readConfiguration(), reset(), and initializeGlobalHandlers() In-Reply-To: <553E29C7.8030800@oracle.com> References: <553A7835.80209@oracle.com> <553D8F0B.4070102@oracle.com> <553DE503.2060608@oracle.com> <553E29C7.8030800@oracle.com> Message-ID: <553E9685.1030809@oracle.com> On 27/04/2015 10:21 PM, David Holmes wrote: > On 27/04/2015 5:28 PM, Daniel Fuchs wrote: >> Hi David, >> >> On 4/27/15 3:21 AM, David Holmes wrote: >>> Hi Daniel, >>> >>> On 25/04/2015 3:07 AM, Daniel Fuchs wrote: >>>> Hi, >>>> >>>> Please find below a patch that tries to improve the locking >>>> strategy in LogManager. >>>> >>>> The patch proposes to use a Reantrant lock to deal with >>>> configurations changes in reset() and readConfiguration(), >>>> and avoids lock contention in initializeGlobalHandlers() >>>> >>>> http://cr.openjdk.java.net/~dfuchs/webrev_8077846/webrev.00/ >>> >>> How early in VM startup can logging be initialized and used? I just >>> wonder whether the use of ReentrantLock changes that at all? >> >> The initialization will not happen before the first class calls >> Logger.getLogger() or LogManager.getLogManager(). >> In particular, it does not happen when the LogManager.class is loaded >> (that is: it no longer happens as part of the class static >> initialization). >> >> I see Alan replied to that question as well... > > I'm just wondering what anyone might be running with a customized core > class that uses logging, and which may now fail due to the different > requirements. But then I just recalled that we used to use ReentrantLock via ConcurrentHashMap in Class, so introducing it early is not likely to cause any issue. Cheers, David >>> Took me a while to understand the use of initializeGlobalHandlersDone. >>> I think this comment: >>> >>> 1622 // If we are in the process of initializing global >>> handlers we >>> 1623 // also need to lock & wait (this case is indicated by >>> 1624 // initializeGlobalHandlersDone == false). >>> >>> would be a little clearer as: >>> >>> 1622 // If we are in the process of initializing global >>> handlers we >>> 1623 // also need to acquire the lock to wait until it is >>> complete >>> 1624 // (this case is indicated by >>> initializeGlobalHandlersDone == false). >> >> Exactly. Thanks! >> >>> But why are these initialized to true and not false ?? >>> 184 private volatile boolean initializeGlobalHandlersCalled = true; >>> 185 private volatile boolean initializeGlobalHandlersDone = true; >> >> It doesn't make sense to try & create global handlers before the >> configuration is read for the first time. In addition the first thing >> that readConfiguration does is to call reset() which switches >> initializeGlobalHandlersCalled to true to avoid that it gets initialized >> before the Properties is later loaded. >> >> I agree that this initialization to 'true' is not intuitive. >> My fingers had been itching several times to change it to false ;-) >> but the 'true' value makes more sense once you look at the >> initialization code path. >> >> I should probably add a comment: >> >> // These variables are initialized to true, to avoid trying >> // to initialize global handlers before the configuration is read >> // for the first time. > > Sounds good to me. > > Thanks, > David > >> >>> >>> I think this code/comment: >>> >>> 1629 if (initializeGlobalHandlersCalled) return; // >>> recursive call >>> >>> would also be clearer as: >>> >>> 1629 if (initializeGlobalHandlersCalled) >>> return; // recursive call or another thread did >>> it already >> >> Thanks David! >> >> best regards, >> >> -- daniel >>> >>> Thanks, >>> David >>> >>>> comments welcome, >>>> >>>> best regards, >>>> >>>> -- daniel >> From Roger.Riggs at Oracle.com Mon Apr 27 20:14:26 2015 From: Roger.Riggs at Oracle.com (Roger Riggs) Date: Mon, 27 Apr 2015 16:14:26 -0400 Subject: RFR 9: 8078369: [testbug] java/time/tck/java/time/TCKOffsetTime[now] fails on slow devices In-Reply-To: <553E8FE3.9030909@oracle.com> References: <553E84DD.1030009@Oracle.com> <553E8FE3.9030909@oracle.com> Message-ID: <553E98A2.5020207@Oracle.com> Hi Daniel, The set of affected tests is somewhat limited in that the real cause of the timeout is reading the timezone information and the extra code that it throws into the mix due to -Xcomp. Also, the current sequence of tests may be hiding some failures since the one-time initialization has already been performed by some other test. Thanks, Roger On 4/27/2015 3:37 PM, Daniel Fuchs wrote: > Hi Roger, > > Looks good to me. I'm surprised that only these tests are failing. > IIRC I also had to round up some time comparisons in tests when I > increased the resolution of the SystemClock - and I believe I rounded > them to only 1 second... > > Anyway - if they fail we know what to do :-) > > best regards, > > -- daniel > ] > On 4/27/15 8:50 PM, Roger Riggs wrote: >> Please review a timing relaxation so tests do not fail on very slow >> hardware >> with more expensive runtime options. (-Xcomp) >> >> The change will also be backported to jdk 8. >> >> Issue: >> 8078369: [testbug] java/time/tck/java/time/TCKOffsetTime[now] >> fails on slow devices >> >> Webrev: >> http://cr.openjdk.java.net/~rriggs/webrev-timeout-8078369/ >> >> Thanks, Roger >> > From kasperni at gmail.com Mon Apr 27 20:34:41 2015 From: kasperni at gmail.com (Kasper Nielsen) Date: Mon, 27 Apr 2015 22:34:41 +0200 Subject: Additional method on Stream In-Reply-To: References: Message-ID: On Mon, Apr 27, 2015 at 3:22 PM, Stephen Colebourne wrote: > This is a request for an additional method on java.util.stream.Stream. > > Having written quite a bit of code in Java 8 now, one annoyance keeps > on coming up, filtering and casting the stream. > > Currently, it is necessary to do this: > > return input.stream() > .filter(Foo.class::isInstance) > .map(Foo.class::cast) > .someTerminalOperation(); > > or > > return input.stream() > .filter(t -> t instanceof Foo) > .map(t -> (Foo) t) > .someTerminalOperation(); > > Really, what is needed is this: > > return input.stream() > .filter(Foo.class) > .someTerminalOperation(); > > For info, Guava's FluentIterable has such a method. > > The new method signature would be something like: > > public Stream filter(Class cls); > I second this suggestion. I have thought about suggesting this for a long time as well. As it really bothers me missing that method. I have been using a pre 8.0 stream-like library and in many situations this method has really saved some ugly boiler plating code. The other default function I would like to see is stream.toList() (I can live with collectToList) which is short for s.collect(Collectors.toList()). 50 % of my terminal functions are s.collect(Collectors.toList()). And I took a look at libraries that uses the Stream interface GitHub and it is roughly the same usage. - Kasper From brian.burkhalter at oracle.com Mon Apr 27 20:41:47 2015 From: brian.burkhalter at oracle.com (Brian Burkhalter) Date: Mon, 27 Apr 2015 13:41:47 -0700 Subject: [9] RFR of 8078672: Print and allow setting by Java property seeds used to initialize Random instances in java.lang numerics tests Message-ID: <3BF44A04-8B17-4C5B-8EC6-70BA948C0841@oracle.com> Note: This is a relabeling and extension of a patch originally addressed towards https://bugs.openjdk.java.net/browse/JDK-8078586 in this discussion thread http://mail.openjdk.java.net/pipermail/core-libs-dev/2015-April/033037.html. With that preamble, please review the revised code at your convenience: Issue: https://bugs.openjdk.java.net/browse/JDK-8078672 Patch: http://cr.openjdk.java.net/~bpb/8078672/webrev.00/ Summary: Add setting of Random seed via system property with fallback to a random seed from a separate Random instance and printing the seed actually used in the test. Thanks, Brian From brian.burkhalter at oracle.com Mon Apr 27 20:44:51 2015 From: brian.burkhalter at oracle.com (Brian Burkhalter) Date: Mon, 27 Apr 2015 13:44:51 -0700 Subject: [9] RFR of 8078586: java/lang/Double/ParseHexFloatingPoint.java fails intermittently In-Reply-To: <65991789-82EF-4A71-8EE7-1A35C0DE1768@oracle.com> References: <65991789-82EF-4A71-8EE7-1A35C0DE1768@oracle.com> Message-ID: <58D37DA3-0E79-402E-B9F0-3BAC9F838824@oracle.com> This discussion has been moved here: http://mail.openjdk.java.net/pipermail/core-libs-dev/2015-April/033058.html Please reply to the forgoing thread regarding this topic. The request for review of a fix for https://bugs.openjdk.java.net/browse/JDK-8078586 is withdrawn for the time being. Thanks, Brian On Apr 24, 2015, at 3:01 PM, Brian Burkhalter wrote: > Please review at your convenience. > > Issue: https://bugs.openjdk.java.net/browse/JDK-8078586 > Patch: http://cr.openjdk.java.net/~bpb/8078586/webrev.00/ > > Summary: Add setting of Random seed via system property with fallback to a random seed from a separate Random instance and printing the seed actually used in the test. > > The question is whether this change should be made under JDK-8078586 which is better resolved as ?Cannot Reproduce? given its 0.07% failure rate, or whether a separate issue should be filed for these test changes. > > Thanks, > > Brian From Roger.Riggs at Oracle.com Mon Apr 27 20:54:42 2015 From: Roger.Riggs at Oracle.com (Roger Riggs) Date: Mon, 27 Apr 2015 16:54:42 -0400 Subject: RFR 9: 8078582: java/lang/Runtime/exec/LotsOfOutput.java fails intermittently with Process consumes memory Message-ID: <553EA212.3030403@Oracle.com> Please review adding diagnostic output to identify an intermittent failure. Webrev: http://cr.openjdk.java.net/~rriggs/webrev-lots-8078582/ Issue: https://bugs.openjdk.java.net/browse/JDK-8078582 Thanks, Roger From Roger.Riggs at Oracle.com Mon Apr 27 21:58:53 2015 From: Roger.Riggs at Oracle.com (Roger Riggs) Date: Mon, 27 Apr 2015 17:58:53 -0400 Subject: RFR: JDK-8074003 java.time.zone.ZoneRules.getOffset(java.time.Instant) can be optimized In-Reply-To: <553E62D6.9030102@gmail.com> References: <553E62D6.9030102@gmail.com> Message-ID: <553EB11D.8040709@Oracle.com> Hi Peter, Caching the epochSecond moves the computation from a relatively lazy version to creation when it would be performed eagerly for every transition. Is there a quick way to see if it will have an impact on the startup time? Roger On 4/27/2015 12:24 PM, Peter Levart wrote: > Hi again, > > Here's another optimization to be reviewed that has been discussed a > while ago (just rebased from webrev.01) and approved by Stephen: > > http://cr.openjdk.java.net/~plevart/jdk9-dev/ZoneOffsetTransition.epochSecond/webrev.02/ > > > > The discussion about it is intermingled with the > ZoneId.systemDefault() discussion and starts about here: > > http://mail.openjdk.java.net/pipermail/core-libs-dev/2015-February/031873.html > > > > The rationale for the optimization is speeding-up the conversion from > epoch time to LocalDateTime. This conversion uses > ZoneRules.getOffset(Instant) where there is a loop over > ZoneOffsetTransition[] array that searches for 1st transition that has > its toEpochSecond value less than the Instant's epochSecond. This > calls ZoneOffsetTransition.toEpochSecond repeatedly, converting > ZoneOffsetTransition.transition which is a LocalDateTime to > epochSecond. This repeated conversion is unnecessary, as > ZoneOffsetTransition[] array is part of ZoneRules which is cached. > Optimizing the ZoneOffsetTransition implementation (keeping both > LocalDateTime variant and eposhSecond variant of transition time as > the object's state) speeds up this conversion. > > > Regards, Peter > From joe.darcy at oracle.com Tue Apr 28 00:32:33 2015 From: joe.darcy at oracle.com (joe darcy) Date: Mon, 27 Apr 2015 17:32:33 -0700 Subject: [9] RFR of 8078672: Print and allow setting by Java property seeds used to initialize Random instances in java.lang numerics tests In-Reply-To: <3BF44A04-8B17-4C5B-8EC6-70BA948C0841@oracle.com> References: <3BF44A04-8B17-4C5B-8EC6-70BA948C0841@oracle.com> Message-ID: <553ED521.3020208@oracle.com> Hi Brian, The patch looks pretty good. A few questions / comments: The test ParseHexFloatingPoint.java didn't get the "(use -Dseed=X to set PRNG seed)" addition; was that intentional? To save some space on the @summary line Numerical tests for hexadecimal inputs to parseDouble, parseFloat could be replaced with Numerical tests for hexadecimal inputs to parse{Double, Float} Could the java/math/RandomSeed class you added for java.math be used for this changeset instead of another another class with a large subset of the functionality? Perhaps the random number handling should be moved up to somewhere under jdk/test/lib? That would more easily let other type who want to handling random numbers in a uniform way use the library (at the cost of slightly more complicated jtreg tagging). Thanks, -Joe On 4/27/2015 1:41 PM, Brian Burkhalter wrote: > Note: This is a relabeling and extension of a patch originally addressed towards https://bugs.openjdk.java.net/browse/JDK-8078586 in this discussion thread http://mail.openjdk.java.net/pipermail/core-libs-dev/2015-April/033037.html. > > With that preamble, please review the revised code at your convenience: > > Issue: https://bugs.openjdk.java.net/browse/JDK-8078672 > Patch: http://cr.openjdk.java.net/~bpb/8078672/webrev.00/ > > Summary: Add setting of Random seed via system property with fallback to a random seed from a separate Random instance and printing the seed actually used in the test. > > Thanks, > > Brian From brian.burkhalter at oracle.com Tue Apr 28 00:44:19 2015 From: brian.burkhalter at oracle.com (Brian Burkhalter) Date: Mon, 27 Apr 2015 17:44:19 -0700 Subject: [9] RFR of 8078672: Print and allow setting by Java property seeds used to initialize Random instances in java.lang numerics tests In-Reply-To: <553ED521.3020208@oracle.com> References: <3BF44A04-8B17-4C5B-8EC6-70BA948C0841@oracle.com> <553ED521.3020208@oracle.com> Message-ID: <9711F5D5-20DD-49AC-A237-FB054D7E342D@oracle.com> Hi Joe, On Apr 27, 2015, at 5:32 PM, joe darcy wrote: > The patch looks pretty good. A few questions / comments: > > The test ParseHexFloatingPoint.java didn't get the "(use -Dseed=X to set PRNG seed)" addition; was that intentional? No, it was an oversight. Thanks for catching it. I thought it had been there. Possibly something happened in moving the path to a different issue. > To save some space on the @summary line > > Numerical tests for hexadecimal inputs to parseDouble, parseFloat > > could be replaced with > > Numerical tests for hexadecimal inputs to parse{Double, Float} Will change. > Could the java/math/RandomSeed class you added for java.math be used for this changeset instead of another another class with a large subset of the functionality? > > Perhaps the random number handling should be moved up to somewhere under jdk/test/lib? That would more easily let other type who want to handling random numbers in a uniform way use the library (at the cost of slightly more complicated jtreg tagging). I?ll investigate tomorrow whether perhaps this functionality can be moved to a higher level with removal of duplication of code. The java/math/RandomSeed class changeset was the first in which I used @library so I should look over the jtreg tag list again. Thanks, Brian From huizhe.wang at oracle.com Tue Apr 28 04:39:16 2015 From: huizhe.wang at oracle.com (huizhe wang) Date: Mon, 27 Apr 2015 21:39:16 -0700 Subject: RFR 9: 8078582: java/lang/Runtime/exec/LotsOfOutput.java fails intermittently with Process consumes memory In-Reply-To: <553EA212.3030403@Oracle.com> References: <553EA212.3030403@Oracle.com> Message-ID: <553F0EF4.8020704@oracle.com> Hi Roger, I think you meant to print out initMemory before totalMemory :-) + System.out.printf("consuming memory: i: %d, initial: %d, total: %d, delta: %d%n", + i, totalMemory, initMemory, totalMemory - initMemory); ** i, initMemory,totalMemory,totalMemory - initMemory); -Joe On 4/27/2015 1:54 PM, Roger Riggs wrote: > Please review adding diagnostic output to identify an intermittent > failure. > > Webrev: > http://cr.openjdk.java.net/~rriggs/webrev-lots-8078582/ > > Issue: > https://bugs.openjdk.java.net/browse/JDK-8078582 > > Thanks, Roger > From scolebourne at joda.org Tue Apr 28 05:28:40 2015 From: scolebourne at joda.org (Stephen Colebourne) Date: Tue, 28 Apr 2015 06:28:40 +0100 Subject: RFR: JDK-8074003 java.time.zone.ZoneRules.getOffset(java.time.Instant) can be optimized In-Reply-To: <553EB11D.8040709@Oracle.com> References: <553E62D6.9030102@gmail.com> <553EB11D.8040709@Oracle.com> Message-ID: TzdbZoneRulesProvider parses the byte[] of TZ data on demand when a ZoneId is first requested. So, the ZoneOffsetTransition will not be created unless a ZoneId is during startup. Stephen On 27 April 2015 at 22:58, Roger Riggs wrote: > Hi Peter, > > Caching the epochSecond moves the computation from a relatively lazy version > to creation when it would be performed eagerly for every transition. > Is there a quick way to see if it will have an impact on the startup time? > > Roger > > > > On 4/27/2015 12:24 PM, Peter Levart wrote: >> >> Hi again, >> >> Here's another optimization to be reviewed that has been discussed a while >> ago (just rebased from webrev.01) and approved by Stephen: >> >> >> http://cr.openjdk.java.net/~plevart/jdk9-dev/ZoneOffsetTransition.epochSecond/webrev.02/ >> >> >> The discussion about it is intermingled with the ZoneId.systemDefault() >> discussion and starts about here: >> >> >> http://mail.openjdk.java.net/pipermail/core-libs-dev/2015-February/031873.html >> >> >> The rationale for the optimization is speeding-up the conversion from >> epoch time to LocalDateTime. This conversion uses >> ZoneRules.getOffset(Instant) where there is a loop over >> ZoneOffsetTransition[] array that searches for 1st transition that has its >> toEpochSecond value less than the Instant's epochSecond. This calls >> ZoneOffsetTransition.toEpochSecond repeatedly, converting >> ZoneOffsetTransition.transition which is a LocalDateTime to epochSecond. >> This repeated conversion is unnecessary, as ZoneOffsetTransition[] array is >> part of ZoneRules which is cached. Optimizing the ZoneOffsetTransition >> implementation (keeping both LocalDateTime variant and eposhSecond variant >> of transition time as the object's state) speeds up this conversion. >> >> >> Regards, Peter >> > From paul.sandoz at oracle.com Tue Apr 28 07:16:29 2015 From: paul.sandoz at oracle.com (Paul Sandoz) Date: Tue, 28 Apr 2015 09:16:29 +0200 Subject: Additional method on Stream In-Reply-To: References: Message-ID: <091FFB6B-3B7A-498C-8202-748F293C6200@oracle.com> On Apr 27, 2015, at 10:34 PM, Kasper Nielsen wrote: > The other default function I would like to see is stream.toList() (I can > live with collectToList) which is short for s.collect(Collectors.toList()). > 50 % of my terminal functions are s.collect(Collectors.toList()). Can you live with a static import and: s.collect(toList()) ? which is rather close to "collectToList". When designing j.u,s.Stream we made a conscious decision to not bind it to j.u collection types. A Stream could be integrated with other forms of collections (e.g. GS Collections). Paul. > And I took a look at libraries that uses the Stream interface GitHub and it > is roughly the same usage. > > - Kasper From chris.hegarty at oracle.com Tue Apr 28 07:56:30 2015 From: chris.hegarty at oracle.com (Chris Hegarty) Date: Tue, 28 Apr 2015 08:56:30 +0100 Subject: RFR 9: 8078582: java/lang/Runtime/exec/LotsOfOutput.java fails intermittently with Process consumes memory In-Reply-To: <553EA212.3030403@Oracle.com> References: <553EA212.3030403@Oracle.com> Message-ID: <8C853804-52E3-46C7-BB8C-E9B958DFE11D@oracle.com> On 27 Apr 2015, at 21:54, Roger Riggs wrote: > Please review adding diagnostic output to identify an intermittent failure. I agree with the adding additional diagnostic output. Maybe the bug description should be updated to indicate that? > Webrev: > http://cr.openjdk.java.net/~rriggs/webrev-lots-8078582/ I typically do not add the bug number to the @bug tag for non-product changes. I think this is right, since the test is not testing the product for that bug. -Chris. > Issue: > https://bugs.openjdk.java.net/browse/JDK-8078582 > > Thanks, Roger > From chris.hegarty at oracle.com Tue Apr 28 07:57:42 2015 From: chris.hegarty at oracle.com (Chris Hegarty) Date: Tue, 28 Apr 2015 08:57:42 +0100 Subject: [9] RFR of 8078672: Print and allow setting by Java property seeds used to initialize Random instances in java.lang numerics tests In-Reply-To: <9711F5D5-20DD-49AC-A237-FB054D7E342D@oracle.com> References: <3BF44A04-8B17-4C5B-8EC6-70BA948C0841@oracle.com> <553ED521.3020208@oracle.com> <9711F5D5-20DD-49AC-A237-FB054D7E342D@oracle.com> Message-ID: <2EDA6421-2B3C-406C-83C9-B9FBFC75FDC5@oracle.com> On 28 Apr 2015, at 01:44, Brian Burkhalter wrote: > Hi Joe, > > On Apr 27, 2015, at 5:32 PM, joe darcy wrote: > >> The patch looks pretty good. A few questions / comments: >> >> The test ParseHexFloatingPoint.java didn't get the "(use -Dseed=X to set PRNG seed)" addition; was that intentional? > > No, it was an oversight. Thanks for catching it. I thought it had been there. Possibly something happened in moving the path to a different issue. > >> To save some space on the @summary line >> >> Numerical tests for hexadecimal inputs to parseDouble, parseFloat >> >> could be replaced with >> >> Numerical tests for hexadecimal inputs to parse{Double, Float} > > Will change. > >> Could the java/math/RandomSeed class you added for java.math be used for this changeset instead of another another class with a large subset of the functionality? >> >> Perhaps the random number handling should be moved up to somewhere under jdk/test/lib? That would more easily let other type who want to handling random numbers in a uniform way use the library (at the cost of slightly more complicated jtreg tagging). I think having support for this in the jdk/test/lib/testlibrary/jdk/testlibrary would be good. I was going to suggest that too when the first changeset was pushed. -Chris. > I?ll investigate tomorrow whether perhaps this functionality can be moved to a higher level with removal of duplication of code. The java/math/RandomSeed class changeset was the first in which I used @library so I should look over the jtreg tag list again. > > Thanks, > > Brian From peter.levart at gmail.com Tue Apr 28 07:59:00 2015 From: peter.levart at gmail.com (Peter Levart) Date: Tue, 28 Apr 2015 09:59:00 +0200 Subject: RFR: 8077846: improve locking strategy for readConfiguration(), reset(), and initializeGlobalHandlers() In-Reply-To: <553E9685.1030809@oracle.com> References: <553A7835.80209@oracle.com> <553D8F0B.4070102@oracle.com> <553DE503.2060608@oracle.com> <553E29C7.8030800@oracle.com> <553E9685.1030809@oracle.com> Message-ID: <553F3DC4.4010104@gmail.com> On 04/27/2015 10:05 PM, David Holmes wrote: >>>>> The patch proposes to use a Reantrant lock to deal with >>>>> configurations changes in reset() and readConfiguration(), >>>>> and avoids lock contention in initializeGlobalHandlers() >>>>> >>>>> http://cr.openjdk.java.net/~dfuchs/webrev_8077846/webrev.00/ >>>> >>>> How early in VM startup can logging be initialized and used? I just >>>> wonder whether the use of ReentrantLock changes that at all? >>> >>> The initialization will not happen before the first class calls >>> Logger.getLogger() or LogManager.getLogManager(). >>> In particular, it does not happen when the LogManager.class is loaded >>> (that is: it no longer happens as part of the class static >>> initialization). >>> >>> I see Alan replied to that question as well... >> >> I'm just wondering what anyone might be running with a customized core >> class that uses logging, and which may now fail due to the different >> requirements. > > But then I just recalled that we used to use ReentrantLock via > ConcurrentHashMap in Class, so introducing it early is not likely to > cause any issue. > > Cheers, > David Hi David, Daniel, CHM in JDK8 is not using ReentrantLock. But in JDK7, it is used, yes. But anyway, is there a special reason to use ReentrantLock here in LogManager instead of Java built-in monitor lock? It is reentrant too. Regards, Peter From daniel.fuchs at oracle.com Tue Apr 28 08:13:42 2015 From: daniel.fuchs at oracle.com (Daniel Fuchs) Date: Tue, 28 Apr 2015 10:13:42 +0200 Subject: RFR: 8077846: improve locking strategy for readConfiguration(), reset(), and initializeGlobalHandlers() In-Reply-To: <553F3DC4.4010104@gmail.com> References: <553A7835.80209@oracle.com> <553D8F0B.4070102@oracle.com> <553DE503.2060608@oracle.com> <553E29C7.8030800@oracle.com> <553E9685.1030809@oracle.com> <553F3DC4.4010104@gmail.com> Message-ID: <553F4136.5010500@oracle.com> On 28/04/15 09:59, Peter Levart wrote: > On 04/27/2015 10:05 PM, David Holmes wrote: >>>>>> The patch proposes to use a Reantrant lock to deal with >>>>>> configurations changes in reset() and readConfiguration(), >>>>>> and avoids lock contention in initializeGlobalHandlers() >>>>>> >>>>>> http://cr.openjdk.java.net/~dfuchs/webrev_8077846/webrev.00/ >>>>> >>>>> How early in VM startup can logging be initialized and used? I just >>>>> wonder whether the use of ReentrantLock changes that at all? >>>> >>>> The initialization will not happen before the first class calls >>>> Logger.getLogger() or LogManager.getLogManager(). >>>> In particular, it does not happen when the LogManager.class is loaded >>>> (that is: it no longer happens as part of the class static >>>> initialization). >>>> >>>> I see Alan replied to that question as well... >>> >>> I'm just wondering what anyone might be running with a customized core >>> class that uses logging, and which may now fail due to the different >>> requirements. >> >> But then I just recalled that we used to use ReentrantLock via >> ConcurrentHashMap in Class, so introducing it early is not likely to >> cause any issue. >> >> Cheers, >> David > > Hi David, Daniel, > > CHM in JDK8 is not using ReentrantLock. But in JDK7, it is used, yes. > > But anyway, is there a special reason to use ReentrantLock here in > LogManager instead of Java built-in monitor lock? It is reentrant too. Hi Peter, That's one of the possibility I was envisaging - but I didn't feel very comfortable with synchronizing the whole method bodies. Using a reentrant lock also offers more possibility for evolutions like try locking or timeout locking - which you can't do with a monitor (unless you reinvent ReentrantLock)... best regards, -- daniel > > Regards, Peter > From kasperni at gmail.com Tue Apr 28 08:22:45 2015 From: kasperni at gmail.com (Kasper Nielsen) Date: Tue, 28 Apr 2015 10:22:45 +0200 Subject: Additional method on Stream In-Reply-To: <091FFB6B-3B7A-498C-8202-748F293C6200@oracle.com> References: <091FFB6B-3B7A-498C-8202-748F293C6200@oracle.com> Message-ID: On Tue, Apr 28, 2015 at 9:16 AM, Paul Sandoz wrote: > On Apr 27, 2015, at 10:34 PM, Kasper Nielsen wrote: > > The other default function I would like to see is stream.toList() (I can > > live with collectToList) which is short for > s.collect(Collectors.toList()). > > 50 % of my terminal functions are s.collect(Collectors.toList()). > > Can you live with a static import and: > > s.collect(toList()) > > ? which is rather close to "collectToList". > > When designing j.u,s.Stream we made a conscious decision to not bind it to > j.u collection types. A Stream could be integrated with other forms of > collections (e.g. GS Collections). > First, if you are using any kind of modern IDE you have some kind of intelligent completion which will suggest collectToList the moment you press the 'c' in stream.c... The other one you have to create an additional import, and invoke a static method (Yes I know most IDEs makes this easy as well) But we are still talking about something like 1 second vs 5 seconds. Second, s.collect(toList()) is just not naturally for most users. Sure readers on this list understands how the collect method works. But I don't think many novice/intermediate users will. Third, Yes there are a lot of different collections that a stream can be integrated with. But we are talking about roughly 50 % of the usage. Fourth, this hasn't actually anything to do with ease of use but performance. But I have a very fast stream implementation where I would like to provide a fast (and easy) way to return the stream elements as a list. This is mainly in situations where I know the number of elements in the result (which is quite often if you don't use filters). By having a toList() method I can implement, I can avoid the array list resizings in s.collect(toList()). This is actually also why I would prefer if it was called toList() and not collectToList() as I think it is implementation detail how the list generation is done. - Kasper From kasperni at gmail.com Tue Apr 28 08:43:53 2015 From: kasperni at gmail.com (Kasper Nielsen) Date: Tue, 28 Apr 2015 10:43:53 +0200 Subject: Additional method on Stream In-Reply-To: References: <091FFB6B-3B7A-498C-8202-748F293C6200@oracle.com> Message-ID: A couple of blog posts with the same issue. http://winterbe.com/posts/2015/03/05/fixing-java-8-stream-gotchas-with-intellij-idea/ http://benjiweber.co.uk/blog/2015/03/06/adding-tolist-to-java-streams/ http://javarevisited.blogspot.dk/2015/03/5-ways-to-convert-java-8-stream-to-list.html It is also on the top 10 questions on stackoverflow on Java 8 http://stackoverflow.com/questions/tagged/java-8 - Kasper On Tue, Apr 28, 2015 at 10:22 AM, Kasper Nielsen wrote: > On Tue, Apr 28, 2015 at 9:16 AM, Paul Sandoz > wrote: > >> On Apr 27, 2015, at 10:34 PM, Kasper Nielsen wrote: >> > The other default function I would like to see is stream.toList() (I can >> > live with collectToList) which is short for >> s.collect(Collectors.toList()). >> > 50 % of my terminal functions are s.collect(Collectors.toList()). >> >> Can you live with a static import and: >> >> s.collect(toList()) >> >> ? which is rather close to "collectToList". >> >> When designing j.u,s.Stream we made a conscious decision to not bind it >> to j.u collection types. A Stream could be integrated with other forms of >> collections (e.g. GS Collections). >> > > First, if you are using any kind of modern IDE you have some kind of > intelligent completion which will suggest collectToList the moment you > press the 'c' in stream.c... > The other one you have to create an additional import, and invoke a static > method (Yes I know most IDEs makes this easy as well) > But we are still talking about something like 1 second vs 5 seconds. > > Second, s.collect(toList()) is just not naturally for most users. Sure > readers on this list understands how the collect method works. But I don't > think many novice/intermediate users will. > > Third, Yes there are a lot of different collections that a stream can be > integrated with. But we are talking about roughly 50 % of the usage. > > Fourth, this hasn't actually anything to do with ease of use but > performance. But I have a very fast stream implementation where I would > like to provide a fast (and easy) way to return the stream elements as a > list. This is mainly in situations where I know the number of elements in > the result (which is quite often if you don't use filters). By having a > toList() method I can implement, I can avoid the array list resizings in > s.collect(toList()). > This is actually also why I would prefer if it was called toList() and not > collectToList() as I think it is implementation detail how the list > generation is done. > > - Kasper > From paul.sandoz at oracle.com Tue Apr 28 09:06:36 2015 From: paul.sandoz at oracle.com (Paul Sandoz) Date: Tue, 28 Apr 2015 11:06:36 +0200 Subject: Additional method on Stream In-Reply-To: References: <091FFB6B-3B7A-498C-8202-748F293C6200@oracle.com> Message-ID: <5C346193-7258-410B-898A-004D5E6495F1@oracle.com> On Apr 28, 2015, at 10:22 AM, Kasper Nielsen wrote: > On Tue, Apr 28, 2015 at 9:16 AM, Paul Sandoz wrote: > On Apr 27, 2015, at 10:34 PM, Kasper Nielsen wrote: > > The other default function I would like to see is stream.toList() (I can > > live with collectToList) which is short for s.collect(Collectors.toList()). > > 50 % of my terminal functions are s.collect(Collectors.toList()). > > Can you live with a static import and: > > s.collect(toList()) > > ? which is rather close to "collectToList". > > When designing j.u,s.Stream we made a conscious decision to not bind it to j.u collection types. A Stream could be integrated with other forms of collections (e.g. GS Collections). > > First, if you are using any kind of modern IDE you have some kind of intelligent completion which will suggest collectToList the moment you press the 'c' in stream.c... > The other one you have to create an additional import, and invoke a static method (Yes I know most IDEs makes this easy as well) > But we are still talking about something like 1 second vs 5 seconds. > Not much in it then :-) perhaps IDEs might even be enhanced able to suggest collect(toList()) upfront? (After writing the above i saw your email with a link to IntelliJ Collector templates, neat!) > Second, s.collect(toList()) is just not naturally for most users. Sure readers on this list understands how the collect method works. But I don't think many novice/intermediate users will. > It's a trick that only has to be learnt once. > Third, Yes there are a lot of different collections that a stream can be integrated with. But we are talking about roughly 50 % of the usage. > And then someone wants Set, then Map etc. etc. We are also designing Stream for the future where perhaps we might have alternative collection types (not committing to that... :-)) and then someone wants that list type etc. etc. > Fourth, this hasn't actually anything to do with ease of use but performance. Ah, so this is your actual motivation! masquerading in an ease-of-use disguise :-) You raise a good point about the current limitations of Collectors not being able to leverage more information of the pipeline, such as known size. > But I have a very fast stream implementation where I would like to provide a fast (and easy) way to return the stream elements as a list. This is mainly in situations where I know the number of elements in the result (which is quite often if you don't use filters). By having a toList() method I can implement, I can avoid the array list resizings in s.collect(toList()). > This is actually also why I would prefer if it was called toList() and not collectToList() as I think it is implementation detail how the list generation is done. > This does not mean we need to expose a Stream.toList. How about we improve Collectors instead? [*]. For parallel execution we need to work out how better to merge lists and maps. Propagating size information at the root and for each leaf is important for pre-sizing. We can use growable arrays to avoid resizing. -- Separately, the best way to expose a mechanism where you want to do your own stuff is to provide an operation SPI. We are just not ready to do that for 9 given what post 9 will bring. Paul. [*] We could of course take advantage of internal details, that might be a reasonable short-cut for 9, but it would be nice to solve this via a public API. From scolebourne at joda.org Tue Apr 28 09:18:06 2015 From: scolebourne at joda.org (Stephen Colebourne) Date: Tue, 28 Apr 2015 10:18:06 +0100 Subject: Additional method on Stream In-Reply-To: <10F26F8C-3F79-45B9-9D06-C2F0CDCF59D7@oracle.com> References: <10F26F8C-3F79-45B9-9D06-C2F0CDCF59D7@oracle.com> Message-ID: On 27 April 2015 at 16:23, Paul Sandoz wrote: > One issue is there are zillions of possible more specific convenience operations we could add. Everyone has their own favourite. Some static methods were recently added to Stream and Optional in preference to such operations. > > There has to be a really good reason to add new operations. I realize this use-case might be more common than others but i am still yet to be convinced that it has sufficient weight given flatMap + lambda + static method. > >> BTW, I wait months before making this request to see if it really was >> common enough a pattern, but I'm confident that it is now. > > Were you aware of the pattern using flatMap during those months? No, but if I had, I would not have used it. Its a rubbish workaround. It creates extra objects for no value. It involves statically importing another random utility. and it is less expressive - the desire is to filter by type, so I want the filter method. I do understand the desire to control methods, but API design isn't just about minimalism, it is also about meeting common use cases in a natural way. The parallel is of course a standard if (obj instanceof Foo) statement in Java, where developers often curse that they have to additionally cast obj after the check. Why can't the compiler just do it? (Kotlin does for example). While changing the Java language to do this is hard, changing the Stream API would be easy, and good value given a year's coding with streams. Stephen From david.holmes at oracle.com Tue Apr 28 10:52:42 2015 From: david.holmes at oracle.com (David Holmes) Date: Tue, 28 Apr 2015 20:52:42 +1000 Subject: RFR: 8077846: improve locking strategy for readConfiguration(), reset(), and initializeGlobalHandlers() In-Reply-To: <553F4136.5010500@oracle.com> References: <553A7835.80209@oracle.com> <553D8F0B.4070102@oracle.com> <553DE503.2060608@oracle.com> <553E29C7.8030800@oracle.com> <553E9685.1030809@oracle.com> <553F3DC4.4010104@gmail.com> <553F4136.5010500@oracle.com> Message-ID: <553F667A.6070806@oracle.com> On 28/04/2015 6:13 PM, Daniel Fuchs wrote: > On 28/04/15 09:59, Peter Levart wrote: >> On 04/27/2015 10:05 PM, David Holmes wrote: >>>>>>> The patch proposes to use a Reantrant lock to deal with >>>>>>> configurations changes in reset() and readConfiguration(), >>>>>>> and avoids lock contention in initializeGlobalHandlers() >>>>>>> >>>>>>> http://cr.openjdk.java.net/~dfuchs/webrev_8077846/webrev.00/ >>>>>> >>>>>> How early in VM startup can logging be initialized and used? I just >>>>>> wonder whether the use of ReentrantLock changes that at all? >>>>> >>>>> The initialization will not happen before the first class calls >>>>> Logger.getLogger() or LogManager.getLogManager(). >>>>> In particular, it does not happen when the LogManager.class is loaded >>>>> (that is: it no longer happens as part of the class static >>>>> initialization). >>>>> >>>>> I see Alan replied to that question as well... >>>> >>>> I'm just wondering what anyone might be running with a customized core >>>> class that uses logging, and which may now fail due to the different >>>> requirements. >>> >>> But then I just recalled that we used to use ReentrantLock via >>> ConcurrentHashMap in Class, so introducing it early is not likely to >>> cause any issue. >>> >>> Cheers, >>> David >> >> Hi David, Daniel, >> >> CHM in JDK8 is not using ReentrantLock. But in JDK7, it is used, yes. >> >> But anyway, is there a special reason to use ReentrantLock here in >> LogManager instead of Java built-in monitor lock? It is reentrant too. > > Hi Peter, > > That's one of the possibility I was envisaging - but I didn't feel very > comfortable with synchronizing the whole method bodies. You don't need to. The scoping of a sync block can be the same as that of a ReentrantLock, and you can use an internal private lock object. But I don't have any concerns with using ReentrantLock. David ----- > Using a reentrant lock also offers more possibility for evolutions > like try locking or timeout locking - which you can't do with a > monitor (unless you reinvent ReentrantLock)... > > best regards, > > -- daniel >> >> Regards, Peter >> > From paul.sandoz at oracle.com Tue Apr 28 10:57:08 2015 From: paul.sandoz at oracle.com (Paul Sandoz) Date: Tue, 28 Apr 2015 12:57:08 +0200 Subject: Additional method on Stream In-Reply-To: <553E8846.90202@gmail.com> References: <10F26F8C-3F79-45B9-9D06-C2F0CDCF59D7@oracle.com> <553E8846.90202@gmail.com> Message-ID: <532350DE-510A-439C-B3A3-292151C5D1AE@oracle.com> Hi Peter, You are correct in stating that flatMap has some overhead. There are optimizations in place for operating on one element and on the head of the stream that reduce the overhead. Escape analysis sometimes works, it would be nice if that were more reliable, and of course similar things apply to creation of Optional instances. I hope that will improve post 9. There are also much more important performance issues, especially related to profile pollution, that we may need to solve via loop specialization. Ideally i really want to avoid explicit fusing of operations in the API for performance reasons. It should be up to the implementation/compiler to work that out. It's helpful to quantify as you have done for the performance sensitive of us. We did ponder those methods you suggested. Note that the primitive variants also need to be considered too. The first, filterMap, is not value type friendly. Rather than adding the second, mapOptionally, we added Optional.stream to be used with flatMap :-) Paul. From alexander.v.stepanov at oracle.com Tue Apr 28 12:22:40 2015 From: alexander.v.stepanov at oracle.com (alexander stepanov) Date: Tue, 28 Apr 2015 15:22:40 +0300 Subject: RFR [9] 8076224: some tidy warning from core libs Message-ID: <553F7B90.5020601@oracle.com> Hello, Could you please review the following fix http://cr.openjdk.java.net/~avstepan/8076224/webrev.00/ for https://bugs.openjdk.java.net/browse/JDK-8076224 Just some HTML cleanup for docs (remove tidy warnings; remove some unnecessary tags as they are not supported in HTML5). Thanks, Alexander From paul.sandoz at oracle.com Tue Apr 28 12:30:04 2015 From: paul.sandoz at oracle.com (Paul Sandoz) Date: Tue, 28 Apr 2015 14:30:04 +0200 Subject: flatMap performance Re: Additional method on Stream In-Reply-To: <532350DE-510A-439C-B3A3-292151C5D1AE@oracle.com> References: <10F26F8C-3F79-45B9-9D06-C2F0CDCF59D7@oracle.com> <553E8846.90202@gmail.com> <532350DE-510A-439C-B3A3-292151C5D1AE@oracle.com> Message-ID: <8333D181-1735-4A15-A505-549F3DB093C6@oracle.com> On Apr 28, 2015, at 12:57 PM, Paul Sandoz wrote: > Hi Peter, > > You are correct in stating that flatMap has some overhead. > > There are optimizations in place for operating on one element and on the head of the stream that reduce the overhead. I believe at least in the micro-benchmark cases i can reduce the flatMap time by about 60% with special stream impls for none and one element, rather than levering the stream builder directly. They are not that difficult if one uses a pattern like the following: static final class StreamOfOne implements Stream { boolean consumed; final T t; public StreamOfOne(T t) { this.t = t; } void consumed() { if (consumed) throw new IllegalStateException(); consumed = true; } Stream fork() { consumed(); return StreamSupport.stream(new Streams.StreamBuilderImpl<>(t), false); } ... @Override public Stream filter(Predicate predicate) { return fork().filter(predicate); } ... @Override public void forEach(Consumer action) { consumed(); action.accept(t); } ... } There is a cost if intermediate operations and certain terminal operations (like collect) are invoked (that cost can be reduced by merging in a Spliterator implementation). For the common cases of simpler terminal operations, with flatMap, it's a win. So I am pondering adding such implementations. Also, FWIW, returning null rather than Stream.empty() is slightly faster. The latter results in more profiling effects. Looking at generated code there is still a lot of "ceremony" that one would think hotspot would just able to do away with given the temporary Stream objects (me of course not understanding the intricate details of the C2 compiler). Paul. From paul.sandoz at oracle.com Tue Apr 28 13:05:44 2015 From: paul.sandoz at oracle.com (Paul Sandoz) Date: Tue, 28 Apr 2015 15:05:44 +0200 Subject: Additional method on Stream In-Reply-To: References: <10F26F8C-3F79-45B9-9D06-C2F0CDCF59D7@oracle.com> Message-ID: <019DEEBC-592A-4571-9B1B-DC8278E21A19@oracle.com> On Apr 28, 2015, at 11:18 AM, Stephen Colebourne wrote: > On 27 April 2015 at 16:23, Paul Sandoz wrote: >> One issue is there are zillions of possible more specific convenience operations we could add. Everyone has their own favourite. Some static methods were recently added to Stream and Optional in preference to such operations. >> >> There has to be a really good reason to add new operations. I realize this use-case might be more common than others but i am still yet to be convinced that it has sufficient weight given flatMap + lambda + static method. >> >>> BTW, I wait months before making this request to see if it really was >>> common enough a pattern, but I'm confident that it is now. >> >> Were you aware of the pattern using flatMap during those months? > > No, but if I had, I would not have used it. Its a rubbish workaround. > It creates extra objects for no value. It involves statically > importing another random utility. and it is less expressive - the > desire is to filter by type, so I want the filter method. > It's not just a filter method it's a specific, fused filter and map method. > I do understand the desire to control methods, but API design isn't > just about minimalism, it is also about meeting common use cases in a > natural way. The parallel is of course a standard if (obj instanceof > Foo) statement in Java, where developers often curse that they have to > additionally cast obj after the check. I believe Ceylon might also do contextual type narrowing. I dunno how easy it would to modify the Java language and javac to do similar things. A separate discussion to be had... A library analogue could be: Optional Class.castIf(Object obj). At the risk of increasing your wrath about flatMap, you could then do: s.flatMap(e -> Foo.castIf(e).stream()) Paul. > Why can't the compiler just do > it? (Kotlin does for example). While changing the Java language to do > this is hard, changing the Stream API would be easy, and good value > given a year's coding with streams. > > Stephen From paul.sandoz at oracle.com Tue Apr 28 13:09:00 2015 From: paul.sandoz at oracle.com (Paul Sandoz) Date: Tue, 28 Apr 2015 15:09:00 +0200 Subject: Optional.orElseChain ? In-Reply-To: <55350CD9.6040002@univ-mlv.fr> References: <55317D2D.2040900@univ-mlv.fr> <19ADDB4E-2F30-4926-ACF3-2A775CE525CA@oracle.com> <55350CD9.6040002@univ-mlv.fr> Message-ID: Hi Remi, Chasing this up. I have not joined the dark-side just yet... but can you log an issue for this? Thanks, Paul. On Apr 20, 2015, at 4:27 PM, Remi Forax wrote: > > On 04/20/2015 01:39 PM, Paul Sandoz wrote: >> Hi Remi, >> >> I was gonna propose the same trick you mentioned in your last email :-) > > yes, it's the same as > optional.map(Stream::of).orElseGet(() -> Stream.empty()) > (I use orElseGet() because Stream.empty() is not a constant !). > >> >> Similar tricks are possible for other cases like an equivalent of the recently added ifPresentOrElse, but that was considered a little obtuse. >> >> >> On Apr 17, 2015, at 11:37 PM, Remi Forax wrote: >>> Hi guys, >>> I was trying to write a code that uses Optional and I think one method is missing. >>> >> There is always one more (or four more including the primitive variants) :-) > > Yes, yet another one. > > Note that technically, the only thing you need is to be able to do pattern matching on the two states, > so if you have a way to do a flatMap() for the case with a value and a flatMap() for the case with no value, > you're done. > > Doing a flatMap for the case with no value is exactly what you have called 'or'. > So it's yet another method to add but it's the last one :) > >> >> We avoided supporting both the present and absent axes in the intermediate operations (e.g. additional methods with a supplier on absence). >> >> This seems like a special intermediate operation, injecting an alternative optional on absence, rather than associated with the orElse terminal operations that return T: >> >> public Optional or(Supplier> mapper) { >> Objects.requireNonNull(mapper); >> if (isPresent()) { >> return this; >> } else { >> return Objects.requireNonNull(mapper.get()); >> } >> } > > yes, > >> >> But it has some terminal like qualities to it. It really only makes sense once, or once after each flatMap. I am concerned that a bunch of these sprinkled within a sequence of fluent calls might make it hard to reason about. >> >> As such a static method might be more appropriate, but then it's easy for someone to add one in their own code: >> >> static Optional or(Optional a, Supplier> b) { >> Objects.requireNonNull(a); >> Objects.requireNonNull(b); >> return a.isPresent() ? a : Objects.requireNonNull(b.get()); >> } >> >> static Optional or(Optional a, Optional b) { >> Objects.requireNonNull(a); >> Objects.requireNonNull(b); >> return a.isPresent() ? a : b; >> } >> >> Perhaps the non-obvious thing about these is a null return should not be allowed. > > But mixing static methods and instance methods is not readable too, > instance methods goes left to right and static methods goes right to left. > >> >> I am somewhat on the fence here... > > If you only knew the power of the Dark Side :) > >> >> Paul. > > R?mi > From Roger.Riggs at Oracle.com Tue Apr 28 13:32:42 2015 From: Roger.Riggs at Oracle.com (Roger Riggs) Date: Tue, 28 Apr 2015 09:32:42 -0400 Subject: RFR 9: 8078826: Add diagnostic info for java/lang/Runtime/exec/LotsOfOutput.java fails intermittently In-Reply-To: <8C853804-52E3-46C7-BB8C-E9B958DFE11D@oracle.com> References: <553EA212.3030403@Oracle.com> <8C853804-52E3-46C7-BB8C-E9B958DFE11D@oracle.com> Message-ID: <553F8BFA.2080306@Oracle.com> Hi Joe, Chris, Thanks for the review and suggestions. I created a new issue for the diagnostic additions, so the original bugid [1] can be used to accumulate additional information. Issue: 8078826 : Add diagnostic info for java/lang/Runtime/exec/LotsOfOutput.java fails intermittently Webrev: http://cr.openjdk.java.net/~rriggs/webrev-lots-8078826/ Roger [1] JDK-8078582 java/lang/Runtime/exec/LotsOfOutput.java fails intermittently with Process consumes memory On 4/28/2015 3:56 AM, Chris Hegarty wrote: > On 27 Apr 2015, at 21:54, Roger Riggs wrote: > >> Please review adding diagnostic output to identify an intermittent failure. > I agree with the adding additional diagnostic output. Maybe the bug description should be updated to indicate that? > >> Webrev: >> http://cr.openjdk.java.net/~rriggs/webrev-lots-8078582/ > I typically do not add the bug number to the @bug tag for non-product changes. I think this is right, since the test is not testing the product for that bug. > > -Chris. > >> Issue: >> https://bugs.openjdk.java.net/browse/JDK-8078582 >> >> Thanks, Roger >> From chris.hegarty at oracle.com Tue Apr 28 13:34:13 2015 From: chris.hegarty at oracle.com (Chris Hegarty) Date: Tue, 28 Apr 2015 14:34:13 +0100 Subject: RFR 9: 8078826: Add diagnostic info for java/lang/Runtime/exec/LotsOfOutput.java fails intermittently In-Reply-To: <553F8BFA.2080306@Oracle.com> References: <553EA212.3030403@Oracle.com> <8C853804-52E3-46C7-BB8C-E9B958DFE11D@oracle.com> <553F8BFA.2080306@Oracle.com> Message-ID: Looks fine to me Roger. -Chris. On 28 Apr 2015, at 14:32, Roger Riggs wrote: > Hi Joe, Chris, > > Thanks for the review and suggestions. > > I created a new issue for the diagnostic additions, > so the original bugid [1] can be used to accumulate additional information. > > Issue: > 8078826 : Add diagnostic info for java/lang/Runtime/exec/LotsOfOutput.java fails intermittently > > Webrev: > http://cr.openjdk.java.net/~rriggs/webrev-lots-8078826/ > > Roger > [1] JDK-8078582 java/lang/Runtime/exec/LotsOfOutput.java fails intermittently with Process consumes memory > > On 4/28/2015 3:56 AM, Chris Hegarty wrote: >> On 27 Apr 2015, at 21:54, Roger Riggs wrote: >> >>> Please review adding diagnostic output to identify an intermittent failure. >> I agree with the adding additional diagnostic output. Maybe the bug description should be updated to indicate that? >> >>> Webrev: >>> http://cr.openjdk.java.net/~rriggs/webrev-lots-8078582/ >> I typically do not add the bug number to the @bug tag for non-product changes. I think this is right, since the test is not testing the product for that bug. >> >> -Chris. >> >>> Issue: >>> https://bugs.openjdk.java.net/browse/JDK-8078582 >>> >>> Thanks, Roger >>> > From Roger.Riggs at Oracle.com Tue Apr 28 14:06:38 2015 From: Roger.Riggs at Oracle.com (Roger Riggs) Date: Tue, 28 Apr 2015 10:06:38 -0400 Subject: RFR [9] 8076224: some tidy warning from core libs In-Reply-To: <553F7B90.5020601@oracle.com> References: <553F7B90.5020601@oracle.com> Message-ID: <553F93EE.60507@Oracle.com> Hi Alexander, Thanks for doing this cleanup. Generally, avoiding line breaks of {@link xxxxx} across lines makes the source easier to read. Its is ok to re-wrap lines to make the source more readable. Otherwise, it looks fine to me. Thanks, Roger On 4/28/2015 8:22 AM, alexander stepanov wrote: > Hello, > > Could you please review the following fix > http://cr.openjdk.java.net/~avstepan/8076224/webrev.00/ > > for > https://bugs.openjdk.java.net/browse/JDK-8076224 > > Just some HTML cleanup for docs (remove tidy warnings; remove some > unnecessary tags as they are not supported in HTML5). > > Thanks, > Alexander From peter.levart at gmail.com Tue Apr 28 14:07:08 2015 From: peter.levart at gmail.com (Peter Levart) Date: Tue, 28 Apr 2015 16:07:08 +0200 Subject: RFR: 8077846: improve locking strategy for readConfiguration(), reset(), and initializeGlobalHandlers() In-Reply-To: <553F4136.5010500@oracle.com> References: <553A7835.80209@oracle.com> <553D8F0B.4070102@oracle.com> <553DE503.2060608@oracle.com> <553E29C7.8030800@oracle.com> <553E9685.1030809@oracle.com> <553F3DC4.4010104@gmail.com> <553F4136.5010500@oracle.com> Message-ID: <553F940C.4050105@gmail.com> On 04/28/2015 10:13 AM, Daniel Fuchs wrote: > On 28/04/15 09:59, Peter Levart wrote: >> On 04/27/2015 10:05 PM, David Holmes wrote: >>>>>>> The patch proposes to use a Reantrant lock to deal with >>>>>>> configurations changes in reset() and readConfiguration(), >>>>>>> and avoids lock contention in initializeGlobalHandlers() >>>>>>> >>>>>>> http://cr.openjdk.java.net/~dfuchs/webrev_8077846/webrev.00/ >>>>>> >>>>>> How early in VM startup can logging be initialized and used? I just >>>>>> wonder whether the use of ReentrantLock changes that at all? >>>>> >>>>> The initialization will not happen before the first class calls >>>>> Logger.getLogger() or LogManager.getLogManager(). >>>>> In particular, it does not happen when the LogManager.class is loaded >>>>> (that is: it no longer happens as part of the class static >>>>> initialization). >>>>> >>>>> I see Alan replied to that question as well... >>>> >>>> I'm just wondering what anyone might be running with a customized core >>>> class that uses logging, and which may now fail due to the different >>>> requirements. >>> >>> But then I just recalled that we used to use ReentrantLock via >>> ConcurrentHashMap in Class, so introducing it early is not likely to >>> cause any issue. >>> >>> Cheers, >>> David >> >> Hi David, Daniel, >> >> CHM in JDK8 is not using ReentrantLock. But in JDK7, it is used, yes. >> >> But anyway, is there a special reason to use ReentrantLock here in >> LogManager instead of Java built-in monitor lock? It is reentrant too. > > Hi Peter, > > That's one of the possibility I was envisaging - but I didn't feel very > comfortable with synchronizing the whole method bodies. Hi Daniel, There is a synchronized (lock) { ... } syntax too. > > Using a reentrant lock also offers more possibility for evolutions > like try locking or timeout locking - which you can't do with a > monitor (unless you reinvent ReentrantLock)... Ok, fair enough. Now that I studied the synchronization in more detail, I must say, huh, it's very tricky. The state is composed of 3 boolean flags (that's theoretically 8 states) that are sometimes modified in pairs under lock and sometimes individually under lock and sometimes (shutdown hook) not under lock. So one has to pay attention to all possible interleavings. Anyway, I think I found a bug (not synchronization related, but re-entrancy related). In initializeGlobalHandlers() In line 1629 you check if initializeGlobalHandlersCalled is true and return (a recursive call), but you do this inside the try block and therefore finally block is executed which sets initializeGlobalHandlersDone to true. This is prematurely, as loadLoggerHandlers might not be finished yet. I think all possible states can be compressed into just 4 and this can be an int so that it is always updated atomically (easier to reason about). This way you can also get initial state to be default value (0). Here's my attempt at simplifying this: http://cr.openjdk.java.net/~plevart/misc/LogManager.synchronization/webrev.01/ So what do you think? Regards, Peter > > best regards, > > -- daniel >> >> Regards, Peter >> > From daniel.fuchs at oracle.com Tue Apr 28 14:57:11 2015 From: daniel.fuchs at oracle.com (Daniel Fuchs) Date: Tue, 28 Apr 2015 16:57:11 +0200 Subject: RFR: 8077846: improve locking strategy for readConfiguration(), reset(), and initializeGlobalHandlers() In-Reply-To: <553F940C.4050105@gmail.com> References: <553A7835.80209@oracle.com> <553D8F0B.4070102@oracle.com> <553DE503.2060608@oracle.com> <553E29C7.8030800@oracle.com> <553E9685.1030809@oracle.com> <553F3DC4.4010104@gmail.com> <553F4136.5010500@oracle.com> <553F940C.4050105@gmail.com> Message-ID: <553F9FC7.4020806@oracle.com> Hi Peter, On 28/04/15 16:07, Peter Levart wrote: > Hi Daniel, > > There is a synchronized (lock) { ... } syntax too. > >> >> Using a reentrant lock also offers more possibility for evolutions >> like try locking or timeout locking - which you can't do with a >> monitor (unless you reinvent ReentrantLock)... > > Ok, fair enough. > > Now that I studied the synchronization in more detail, I must say, huh, > it's very tricky. The state is composed of 3 boolean flags (that's > theoretically 8 states) that are sometimes modified in pairs under lock > and sometimes individually under lock and sometimes (shutdown hook) not > under lock. So one has to pay attention to all possible interleavings. And I believed I did pay attention ;-) > Anyway, I think I found a bug (not synchronization related, but > re-entrancy related). In initializeGlobalHandlers() In line 1629 you > check if initializeGlobalHandlersCalled is true and return (a recursive > call), but you do this inside the try block and therefore finally block > is executed which sets initializeGlobalHandlersDone to true. This is > prematurely, as loadLoggerHandlers might not be finished yet. Hey - very good catch! Argh. I believe you're right. I should have used two nested try finally block. > I think all possible states can be compressed into just 4 and this can > be an int so that it is always updated atomically (easier to reason > about). This way you can also get initial state to be default value (0). hmmm... I'm not sure it really simplifies things. Though I have to admit that an initial state value 0 is appealing. I was hopping to avoid a multi state int value - I still have a preference for the 2 booleans... > > Here's my attempt at simplifying this: > > http://cr.openjdk.java.net/~plevart/misc/LogManager.synchronization/webrev.01/ LogManager can be subclassed, and subclasses may override reset() for different purposes. So I'm afraid the Cleaner thread still needs to call te public reset() method. The same unfortunately applies to readConfiguration(). best regards, -- daniel > So what do you think? > > Regards, Peter > > > >> >> best regards, >> >> -- daniel >>> >>> Regards, Peter >>> >> > From brian.burkhalter at oracle.com Tue Apr 28 15:04:01 2015 From: brian.burkhalter at oracle.com (Brian Burkhalter) Date: Tue, 28 Apr 2015 08:04:01 -0700 Subject: [9] RFR of 8078672: Print and allow setting by Java property seeds used to initialize Random instances in java.lang numerics tests In-Reply-To: <2EDA6421-2B3C-406C-83C9-B9FBFC75FDC5@oracle.com> References: <3BF44A04-8B17-4C5B-8EC6-70BA948C0841@oracle.com> <553ED521.3020208@oracle.com> <9711F5D5-20DD-49AC-A237-FB054D7E342D@oracle.com> <2EDA6421-2B3C-406C-83C9-B9FBFC75FDC5@oracle.com> Message-ID: <85512CBD-11DA-4EDB-96A1-7D222E941E5F@oracle.com> On Apr 28, 2015, at 12:57 AM, Chris Hegarty wrote: >>> Perhaps the random number handling should be moved up to somewhere under jdk/test/lib? That would more easily let other type who want to handling random numbers in a uniform way use the library (at the cost of slightly more complicated jtreg tagging). >> >> I?ll investigate tomorrow whether perhaps this functionality can be moved to a higher level with removal of duplication of code. The java/math/RandomSeed class changeset was the first in which I used @library so I should look over the jtreg tag list again. > > I think having support for this in the jdk/test/lib/testlibrary/jdk/testlibrary would be good. I was going to suggest that too when the first changeset was pushed. > > -Chris. Hi Chris, Yes I concur and will look into consolidating this code in a centralized location. Thanks, Brian From peter.levart at gmail.com Tue Apr 28 15:46:35 2015 From: peter.levart at gmail.com (Peter Levart) Date: Tue, 28 Apr 2015 17:46:35 +0200 Subject: RFR: 8077846: improve locking strategy for readConfiguration(), reset(), and initializeGlobalHandlers() In-Reply-To: <553F9FC7.4020806@oracle.com> References: <553A7835.80209@oracle.com> <553D8F0B.4070102@oracle.com> <553DE503.2060608@oracle.com> <553E29C7.8030800@oracle.com> <553E9685.1030809@oracle.com> <553F3DC4.4010104@gmail.com> <553F4136.5010500@oracle.com> <553F940C.4050105@gmail.com> <553F9FC7.4020806@oracle.com> Message-ID: <553FAB5B.3060605@gmail.com> On 04/28/2015 04:57 PM, Daniel Fuchs wrote: >> Here's my attempt at simplifying this: >> >> http://cr.openjdk.java.net/~plevart/misc/LogManager.synchronization/webrev.01/ >> > > LogManager can be subclassed, and subclasses may override reset() for > different purposes. > So I'm afraid the Cleaner thread still needs to call te public > reset() method. The same unfortunately applies to > readConfiguration(). > > best regards, > > -- daniel Um, yes of course. This can be fixed: http://cr.openjdk.java.net/~plevart/misc/LogManager.synchronization/webrev.02/ Regards, Peter From alexander.v.stepanov at oracle.com Tue Apr 28 16:09:28 2015 From: alexander.v.stepanov at oracle.com (alexander stepanov) Date: Tue, 28 Apr 2015 19:09:28 +0300 Subject: RFR [9] 8076224: some tidy warning from core libs In-Reply-To: <553F93EE.60507@Oracle.com> References: <553F7B90.5020601@oracle.com> <553F93EE.60507@Oracle.com> Message-ID: <553FB0B8.3050307@oracle.com> Hello Roger, Thanks! > Generally, avoiding line breaks of {@link xxxxx} across lines makes the source easier to read. Please see the updated version (no line breaks inside of {@link} tags): http://cr.openjdk.java.net/~avstepan/8076224/webrev.01/ (is that what expected?) Regards, Alexander On 28.04.2015 17:06, Roger Riggs wrote: > Hi Alexander, > > Thanks for doing this cleanup. > > Generally, avoiding line breaks of {@link xxxxx} across lines makes > the source easier to read. > Its is ok to re-wrap lines to make the source more readable. > > Otherwise, it looks fine to me. > > Thanks, Roger > > > On 4/28/2015 8:22 AM, alexander stepanov wrote: >> Hello, >> >> Could you please review the following fix >> http://cr.openjdk.java.net/~avstepan/8076224/webrev.00/ >> >> for >> https://bugs.openjdk.java.net/browse/JDK-8076224 >> >> Just some HTML cleanup for docs (remove tidy warnings; remove some >> unnecessary tags as they are not supported in HTML5). >> >> Thanks, >> Alexander > From huizhe.wang at oracle.com Tue Apr 28 16:10:58 2015 From: huizhe.wang at oracle.com (huizhe wang) Date: Tue, 28 Apr 2015 09:10:58 -0700 Subject: RFR 9: 8078826: Add diagnostic info for java/lang/Runtime/exec/LotsOfOutput.java fails intermittently In-Reply-To: References: <553EA212.3030403@Oracle.com> <8C853804-52E3-46C7-BB8C-E9B958DFE11D@oracle.com> <553F8BFA.2080306@Oracle.com> Message-ID: <553FB112.2010900@oracle.com> +1. -Joe On 4/28/2015 6:34 AM, Chris Hegarty wrote: > Looks fine to me Roger. > > -Chris. > > On 28 Apr 2015, at 14:32, Roger Riggs wrote: > >> Hi Joe, Chris, >> >> Thanks for the review and suggestions. >> >> I created a new issue for the diagnostic additions, >> so the original bugid [1] can be used to accumulate additional information. >> >> Issue: >> 8078826 : Add diagnostic info for java/lang/Runtime/exec/LotsOfOutput.java fails intermittently >> >> Webrev: >> http://cr.openjdk.java.net/~rriggs/webrev-lots-8078826/ >> >> Roger >> [1] JDK-8078582 java/lang/Runtime/exec/LotsOfOutput.java fails intermittently with Process consumes memory >> >> On 4/28/2015 3:56 AM, Chris Hegarty wrote: >>> On 27 Apr 2015, at 21:54, Roger Riggs wrote: >>> >>>> Please review adding diagnostic output to identify an intermittent failure. >>> I agree with the adding additional diagnostic output. Maybe the bug description should be updated to indicate that? >>> >>>> Webrev: >>>> http://cr.openjdk.java.net/~rriggs/webrev-lots-8078582/ >>> I typically do not add the bug number to the @bug tag for non-product changes. I think this is right, since the test is not testing the product for that bug. >>> >>> -Chris. >>> >>>> Issue: >>>> https://bugs.openjdk.java.net/browse/JDK-8078582 >>>> >>>> Thanks, Roger >>>> From lance.andersen at oracle.com Tue Apr 28 16:25:14 2015 From: lance.andersen at oracle.com (Lance Andersen) Date: Tue, 28 Apr 2015 12:25:14 -0400 Subject: RFR [9] 8076224: some tidy warning from core libs In-Reply-To: <553FB0B8.3050307@oracle.com> References: <553F7B90.5020601@oracle.com> <553F93EE.60507@Oracle.com> <553FB0B8.3050307@oracle.com> Message-ID: <70E99AB8-E9CF-4892-A324-529EAF4E6AE1@oracle.com> This seems better now :-) On Apr 28, 2015, at 12:09 PM, alexander stepanov wrote: > Hello Roger, > > Thanks! > > > Generally, avoiding line breaks of {@link xxxxx} across lines makes the source easier to read. > > Please see the updated version (no line breaks inside of {@link} tags): > http://cr.openjdk.java.net/~avstepan/8076224/webrev.01/ > (is that what expected?) > > Regards, > Alexander > > On 28.04.2015 17:06, Roger Riggs wrote: >> Hi Alexander, >> >> Thanks for doing this cleanup. >> >> Generally, avoiding line breaks of {@link xxxxx} across lines makes the source easier to read. >> Its is ok to re-wrap lines to make the source more readable. >> >> Otherwise, it looks fine to me. >> >> Thanks, Roger >> >> >> On 4/28/2015 8:22 AM, alexander stepanov wrote: >>> Hello, >>> >>> Could you please review the following fix >>> http://cr.openjdk.java.net/~avstepan/8076224/webrev.00/ >>> >>> for >>> https://bugs.openjdk.java.net/browse/JDK-8076224 >>> >>> Just some HTML cleanup for docs (remove tidy warnings; remove some unnecessary tags as they are not supported in HTML5). >>> >>> Thanks, >>> Alexander >> > Lance Andersen| Principal Member of Technical Staff | +1.781.442.2037 Oracle Java Engineering 1 Network Drive Burlington, MA 01803 Lance.Andersen at oracle.com From Roger.Riggs at Oracle.com Tue Apr 28 16:46:01 2015 From: Roger.Riggs at Oracle.com (Roger Riggs) Date: Tue, 28 Apr 2015 12:46:01 -0400 Subject: [9] RFR of 8078672: Print and allow setting by Java property seeds used to initialize Random instances in java.lang numerics tests In-Reply-To: <2EDA6421-2B3C-406C-83C9-B9FBFC75FDC5@oracle.com> References: <3BF44A04-8B17-4C5B-8EC6-70BA948C0841@oracle.com> <553ED521.3020208@oracle.com> <9711F5D5-20DD-49AC-A237-FB054D7E342D@oracle.com> <2EDA6421-2B3C-406C-83C9-B9FBFC75FDC5@oracle.com> Message-ID: <553FB949.3040605@Oracle.com> Hi, Note that there is some existing support for Random (and predetermined) seeds in the Hotspot test library. See hotspot/test/testlibrary/.../Utils.java Soon(ish) to be coming to a testlibrary near you. Roger On 4/28/2015 3:57 AM, Chris Hegarty wrote: > On 28 Apr 2015, at 01:44, Brian Burkhalter wrote: > >> Hi Joe, >> >> On Apr 27, 2015, at 5:32 PM, joe darcy wrote: >> >>> The patch looks pretty good. A few questions / comments: >>> >>> The test ParseHexFloatingPoint.java didn't get the "(use -Dseed=X to set PRNG seed)" addition; was that intentional? >> No, it was an oversight. Thanks for catching it. I thought it had been there. Possibly something happened in moving the path to a different issue. >> >>> To save some space on the @summary line >>> >>> Numerical tests for hexadecimal inputs to parseDouble, parseFloat >>> >>> could be replaced with >>> >>> Numerical tests for hexadecimal inputs to parse{Double, Float} >> Will change. >> >>> Could the java/math/RandomSeed class you added for java.math be used for this changeset instead of another another class with a large subset of the functionality? >>> >>> Perhaps the random number handling should be moved up to somewhere under jdk/test/lib? That would more easily let other type who want to handling random numbers in a uniform way use the library (at the cost of slightly more complicated jtreg tagging). > I think having support for this in the jdk/test/lib/testlibrary/jdk/testlibrary would be good. I was going to suggest that too when the first changeset was pushed. > > -Chris. > >> I?ll investigate tomorrow whether perhaps this functionality can be moved to a higher level with removal of duplication of code. The java/math/RandomSeed class changeset was the first in which I used @library so I should look over the jtreg tag list again. >> >> Thanks, >> >> Brian From Roger.Riggs at Oracle.com Tue Apr 28 16:55:31 2015 From: Roger.Riggs at Oracle.com (Roger Riggs) Date: Tue, 28 Apr 2015 12:55:31 -0400 Subject: RFR [9] 8076224: some tidy warning from core libs In-Reply-To: <553FB0B8.3050307@oracle.com> References: <553F7B90.5020601@oracle.com> <553F93EE.60507@Oracle.com> <553FB0B8.3050307@oracle.com> Message-ID: <553FBB83.2090302@Oracle.com> Yes, looks good to me, Thanks, Roger On 4/28/2015 12:09 PM, alexander stepanov wrote: > Hello Roger, > > Thanks! > > > Generally, avoiding line breaks of {@link xxxxx} across lines makes > the source easier to read. > > Please see the updated version (no line breaks inside of {@link} tags): > http://cr.openjdk.java.net/~avstepan/8076224/webrev.01/ > (is that what expected?) > > Regards, > Alexander > > On 28.04.2015 17:06, Roger Riggs wrote: >> Hi Alexander, >> >> Thanks for doing this cleanup. >> >> Generally, avoiding line breaks of {@link xxxxx} across lines makes >> the source easier to read. >> Its is ok to re-wrap lines to make the source more readable. >> >> Otherwise, it looks fine to me. >> >> Thanks, Roger >> >> >> On 4/28/2015 8:22 AM, alexander stepanov wrote: >>> Hello, >>> >>> Could you please review the following fix >>> http://cr.openjdk.java.net/~avstepan/8076224/webrev.00/ >>> >>> for >>> https://bugs.openjdk.java.net/browse/JDK-8076224 >>> >>> Just some HTML cleanup for docs (remove tidy warnings; remove some >>> unnecessary tags as they are not supported in HTML5). >>> >>> Thanks, >>> Alexander >> > From brian.burkhalter at oracle.com Tue Apr 28 16:57:41 2015 From: brian.burkhalter at oracle.com (Brian Burkhalter) Date: Tue, 28 Apr 2015 09:57:41 -0700 Subject: [9] RFR of 8078672: Print and allow setting by Java property seeds used to initialize Random instances in java.lang numerics tests In-Reply-To: <553FB949.3040605@Oracle.com> References: <3BF44A04-8B17-4C5B-8EC6-70BA948C0841@oracle.com> <553ED521.3020208@oracle.com> <9711F5D5-20DD-49AC-A237-FB054D7E342D@oracle.com> <2EDA6421-2B3C-406C-83C9-B9FBFC75FDC5@oracle.com> <553FB949.3040605@Oracle.com> Message-ID: Thanks, Roger, I?ll take a look. Perhaps it might be better to defer this present effort until this happens. Brian On Apr 28, 2015, at 9:46 AM, Roger Riggs wrote: > Note that there is some existing support for Random (and predetermined) > seeds in the Hotspot test library. > See hotspot/test/testlibrary/.../Utils.java > > Soon(ish) to be coming to a testlibrary near you. From alexander.v.stepanov at oracle.com Tue Apr 28 17:18:32 2015 From: alexander.v.stepanov at oracle.com (alexander stepanov) Date: Tue, 28 Apr 2015 20:18:32 +0300 Subject: RFR [9] 8076224: some tidy warning from core libs In-Reply-To: <70E99AB8-E9CF-4892-A324-529EAF4E6AE1@oracle.com> References: <553F7B90.5020601@oracle.com> <553F93EE.60507@Oracle.com> <553FB0B8.3050307@oracle.com> <70E99AB8-E9CF-4892-A324-529EAF4E6AE1@oracle.com> Message-ID: <553FC0E8.4060607@oracle.com> thanks! On 28.04.2015 19:25, Lance Andersen wrote: > This seems better now :-) > > On Apr 28, 2015, at 12:09 PM, alexander stepanov > > wrote: > >> Hello Roger, >> >> Thanks! >> >> > Generally, avoiding line breaks of {@link xxxxx} across lines makes >> the source easier to read. >> >> Please see the updated version (no line breaks inside of {@link} tags): >> http://cr.openjdk.java.net/~avstepan/8076224/webrev.01/ >> >> (is that what expected?) >> >> Regards, >> Alexander >> >> On 28.04.2015 17:06, Roger Riggs wrote: >>> Hi Alexander, >>> >>> Thanks for doing this cleanup. >>> >>> Generally, avoiding line breaks of {@link xxxxx} across lines makes >>> the source easier to read. >>> Its is ok to re-wrap lines to make the source more readable. >>> >>> Otherwise, it looks fine to me. >>> >>> Thanks, Roger >>> >>> >>> On 4/28/2015 8:22 AM, alexander stepanov wrote: >>>> Hello, >>>> >>>> Could you please review the following fix >>>> http://cr.openjdk.java.net/~avstepan/8076224/webrev.00/ >>>> >>>> for >>>> https://bugs.openjdk.java.net/browse/JDK-8076224 >>>> >>>> Just some HTML cleanup for docs (remove tidy warnings; remove some >>>> unnecessary tags as they are not supported in HTML5). >>>> >>>> Thanks, >>>> Alexander >>> >> > > > > Lance > Andersen| Principal Member of Technical Staff | +1.781.442.2037 > Oracle Java Engineering > 1 Network Drive > Burlington, MA 01803 > Lance.Andersen at oracle.com > > > From mikhail.cherkasov at oracle.com Tue Apr 28 19:35:24 2015 From: mikhail.cherkasov at oracle.com (mikhail cherkasov) Date: Tue, 28 Apr 2015 22:35:24 +0300 Subject: sync in share native code Message-ID: <553FE0FC.6050101@oracle.com> Hi there, I need to add synchronization in shared native code, it can't be moved to java side. But for now it's not clear how to make it cross platform. Maybe someone already has similar experience? Furthermore maybe jdk already has a cross platform implementation of mutex in native code? Thanks, Mikhail. From Roger.Riggs at Oracle.com Tue Apr 28 21:22:20 2015 From: Roger.Riggs at Oracle.com (Roger Riggs) Date: Tue, 28 Apr 2015 17:22:20 -0400 Subject: RFR JDK-8029804: (spec) BufferedWriter.write(String, int, int) IndexOutOfBoundsException In-Reply-To: References: Message-ID: <553FFA0C.4060204@Oracle.com> Hi Pavel, That looks ok. It would be a bit more comfortable to read and compare with the parent contract if it could use the len < 0 phrase. But as written it clearly matches the implementation and is logically equivalent. Roger On 4/27/2015 12:48 PM, Pavel Rappo wrote: > Hi everyone, > > Could you please review my change for JDK-8029804 > > http://cr.openjdk.java.net/~prappo/8029804/webrev.00/ > > ------------------------------------------------------------------------------- > There is an issue where java.io.BufferedWriter.write(String s, int off, int len) > doesn't check required preconditions for `off` and `len` and goes straight to > the algorithm procedures. As a result an acceptable region for (off, len) is > wider than the one declared by parent. For example, following calls should throw > IndexOutOfBoundsException, but they don't: > > bw.write("abc", 10, 0) > bw.write("abc", 5, -1) > bw.write("abc", -7, 0) > bw.write("abc", -2, -3) > bw.write("abc", 3, Integer.MAX_VALUE) > > The problem though is not in the bug itself (it's been there for a long time), > but rather than the amendment to the javadoc which supposed to describe this > divergence is not comprehensive: > > *

    If the value of the len parameter is negative then no > * characters are written. This is contrary to the specification of this > * method in the {@linkplain java.io.Writer#write(java.lang.String,int,int) > * superclass}, which requires that an {@link IndexOutOfBoundsException} be > * thrown. > > Suggested solution is to update the javadoc and provide a test that gives a > certain amount of confidence that the javadoc captures the actual contract. > > -Pavel > From joe.darcy at oracle.com Tue Apr 28 23:53:41 2015 From: joe.darcy at oracle.com (Joseph D. Darcy) Date: Tue, 28 Apr 2015 16:53:41 -0700 Subject: JDK 9 RFR of JDK-8078334: Mark regression tests using randomness In-Reply-To: <553A85A8.7080207@oracle.com> References: <553703BC.1070504@oracle.com> <5539A249.7050105@oracle.com> <5539DB71.2070605@oracle.com> <553A85A8.7080207@oracle.com> Message-ID: <55401D85.1090306@oracle.com> Hello, I'd like to get this changeset, or something close to it, pushed soon so we can start taking advantage of better failure triaging. Any further concerns? Thanks, -Joe On 4/24/2015 11:04 AM, joe darcy wrote: > On 4/23/2015 10:58 PM, Alan Bateman wrote: >> On 24/04/2015 02:54, Joseph D. Darcy wrote: >>> Hello, >>> >>> Any additional comments on marking with tests in question with a >>> "randomness" keyword? >>> >>> Thanks, >>> >>> -Joe >>> >> I don't object to this keyword although I should say that most of the >> (apparent) randomness that I've seen hasn't been because of tests >> using Random but rather because of non-deterministic sequence of >> tests running in the same VM. The switch from othervm to agentvm a >> few years ago took a long time to weed out issues, same thing (even >> more) with -concurrency. Another source of apparent randomness is >> just having a large pool of machines and where machines are randomly >> selected to execute the tests. >> >> I agree with your comments that tests using Random should have report >> the seed and a have a way to re-run with the same value. It could >> help with some cases. >> >> One thing that isn't clear to me is how this keyword will be >> maintained. If I modify a test and replace the use of Random then I >> guess I need to remember to also remove this label. When I add a test >> that uses Random ... Just wondering if there is a tool to do the >> tests analysis, identify the use of specific APIs ,and help identify >> where the keyword might be missing or not needed. >> > > The goal of the keyword is to enable better analysis of bug failures. > We (still) have some intermittent test failures in the platform, some > probably remaining from -concurrency issues and some due to > inconsistent machine config issues on the test farms. However, there > is reason to believe some of the tests also fail because of the use of > randomness in the generation of test cases. For example, the test > > java/lang/invoke/MethodHandles/CatchExceptionTest.java > > fails about once every three hundred runs when the random cases it > generates trigger an error condition. Setting the seed to known-bad > value causes the test to fail consistently (JDK-8055269). I have > suspicions some of our other intermittently failing tests are in a > similar but undiagnosed situation. > > If a test uses randomness, I think the default assumed cause for a > test failure should switch from environmental causes (bad machine > config, etc.) to the random behavior. Therefore, when a random-using > test fails, I think the failure analysis needs to include recording of > the bad seed to see if the failure is reproducible / deterministic > with a fixed seed value. > > I was very surprised by the large number of random-using tests in the > JDK regression tests. Nearly all of these have been stably passing for > many years. After the one-time cost of this large update to add the > keywords, there would be a small amount of incremental test > maintenance as new random-using tests were added or the randomness > value of a test changed. However, I would expect whether or not a test > used randomness to be a property of a test that very rarely changed. > > Thanks, > > -Joe From Alan.Bateman at oracle.com Wed Apr 29 06:51:18 2015 From: Alan.Bateman at oracle.com (Alan Bateman) Date: Wed, 29 Apr 2015 07:51:18 +0100 Subject: JDK 9 RFR of JDK-8078334: Mark regression tests using randomness In-Reply-To: <55401D85.1090306@oracle.com> References: <553703BC.1070504@oracle.com> <5539A249.7050105@oracle.com> <5539DB71.2070605@oracle.com> <553A85A8.7080207@oracle.com> <55401D85.1090306@oracle.com> Message-ID: <55407F66.1030905@oracle.com> On 29/04/2015 00:53, Joseph D. Darcy wrote: > Hello, > > I'd like to get this changeset, or something close to it, pushed soon > so we can start taking advantage of better failure triaging. > > Any further concerns? I should have been clearer, I don't have any issues with the proposed patch. I was mostly probing to see how the keyword would be used as it looks to be more for triage rather than test selection. -Alan From peter.levart at gmail.com Wed Apr 29 09:33:38 2015 From: peter.levart at gmail.com (Peter Levart) Date: Wed, 29 Apr 2015 11:33:38 +0200 Subject: RFR: JDK-8074003 java.time.zone.ZoneRules.getOffset(java.time.Instant) can be optimized In-Reply-To: References: <553E62D6.9030102@gmail.com> Message-ID: <5540A572.5@gmail.com> On 04/27/2015 06:51 PM, Stephen Colebourne wrote: > One additional change is needed. The compareTo() method can rely on > the new epochSecond field as well. > Otherwise good! > Stephen Hi Stephen, LocalDateTime (transition) has nanosecond precision. It may be that transitions loaded from file in ZoneRules only have second precisions, but ZoneOffsetTransition is a public class with public factory method that takes a LocalDateTime transition parameter, so I think compareTo() can't rely on epochSecond alone. But epochSecond can be used as optimization in compareTo() as well as equals(): http://cr.openjdk.java.net/~plevart/jdk9-dev/ZoneOffsetTransition.epochSecond/webrev.03/ An alternative to keeping epochSecond field in ZoneOffsetTransition would be to keep a reference to Instant instead. Instant contains an epochSecond field (as well as nanos) and could be used for both toEpochSecond() and getInstant() methods. What do you think? It also occurred to me that serialization format of ZoneOffsetTransition is not adequate currently as it looses nanosecond precision. Regards, Peter > > On 27 April 2015 at 17:24, Peter Levart wrote: >> Hi again, >> >> Here's another optimization to be reviewed that has been discussed a while >> ago (just rebased from webrev.01) and approved by Stephen: >> >> http://cr.openjdk.java.net/~plevart/jdk9-dev/ZoneOffsetTransition.epochSecond/webrev.02/ >> >> >> The discussion about it is intermingled with the ZoneId.systemDefault() >> discussion and starts about here: >> >> http://mail.openjdk.java.net/pipermail/core-libs-dev/2015-February/031873.html >> >> >> The rationale for the optimization is speeding-up the conversion from epoch >> time to LocalDateTime. This conversion uses ZoneRules.getOffset(Instant) >> where there is a loop over ZoneOffsetTransition[] array that searches for >> 1st transition that has its toEpochSecond value less than the Instant's >> epochSecond. This calls ZoneOffsetTransition.toEpochSecond repeatedly, >> converting ZoneOffsetTransition.transition which is a LocalDateTime to >> epochSecond. This repeated conversion is unnecessary, as >> ZoneOffsetTransition[] array is part of ZoneRules which is cached. >> Optimizing the ZoneOffsetTransition implementation (keeping both >> LocalDateTime variant and eposhSecond variant of transition time as the >> object's state) speeds up this conversion. >> >> >> Regards, Peter >> From scolebourne at joda.org Wed Apr 29 09:43:00 2015 From: scolebourne at joda.org (Stephen Colebourne) Date: Wed, 29 Apr 2015 10:43:00 +0100 Subject: RFR: JDK-8074003 java.time.zone.ZoneRules.getOffset(java.time.Instant) can be optimized In-Reply-To: <5540A572.5@gmail.com> References: <553E62D6.9030102@gmail.com> <5540A572.5@gmail.com> Message-ID: On the LocalDateTime being passed in with nanoseconds, that was an unconsidered use case. The whole offset system relies on second based offsets, so it should really be validated/truncated to remove nanos. That way the equals/compareTo could be simplified again. Seems like a separate issue, but perhaps could be tackled here. You need an Oracle sponsor to tell you ;-) Stephen On 29 April 2015 at 10:33, Peter Levart wrote: > > On 04/27/2015 06:51 PM, Stephen Colebourne wrote: >> >> One additional change is needed. The compareTo() method can rely on >> the new epochSecond field as well. >> Otherwise good! >> Stephen > > > Hi Stephen, > > LocalDateTime (transition) has nanosecond precision. It may be that > transitions loaded from file in ZoneRules only have second precisions, but > ZoneOffsetTransition is a public class with public factory method that takes > a LocalDateTime transition parameter, so I think compareTo() can't rely on > epochSecond alone. But epochSecond can be used as optimization in > compareTo() as well as equals(): > > http://cr.openjdk.java.net/~plevart/jdk9-dev/ZoneOffsetTransition.epochSecond/webrev.03/ > > An alternative to keeping epochSecond field in ZoneOffsetTransition would be > to keep a reference to Instant instead. Instant contains an epochSecond > field (as well as nanos) and could be used for both toEpochSecond() and > getInstant() methods. > > What do you think? > > It also occurred to me that serialization format of ZoneOffsetTransition is > not adequate currently as it looses nanosecond precision. > > Regards, Peter > > >> >> On 27 April 2015 at 17:24, Peter Levart wrote: >>> >>> Hi again, >>> >>> Here's another optimization to be reviewed that has been discussed a >>> while >>> ago (just rebased from webrev.01) and approved by Stephen: >>> >>> >>> http://cr.openjdk.java.net/~plevart/jdk9-dev/ZoneOffsetTransition.epochSecond/webrev.02/ >>> >>> >>> The discussion about it is intermingled with the ZoneId.systemDefault() >>> discussion and starts about here: >>> >>> >>> http://mail.openjdk.java.net/pipermail/core-libs-dev/2015-February/031873.html >>> >>> >>> The rationale for the optimization is speeding-up the conversion from >>> epoch >>> time to LocalDateTime. This conversion uses ZoneRules.getOffset(Instant) >>> where there is a loop over ZoneOffsetTransition[] array that searches for >>> 1st transition that has its toEpochSecond value less than the Instant's >>> epochSecond. This calls ZoneOffsetTransition.toEpochSecond repeatedly, >>> converting ZoneOffsetTransition.transition which is a LocalDateTime to >>> epochSecond. This repeated conversion is unnecessary, as >>> ZoneOffsetTransition[] array is part of ZoneRules which is cached. >>> Optimizing the ZoneOffsetTransition implementation (keeping both >>> LocalDateTime variant and eposhSecond variant of transition time as the >>> object's state) speeds up this conversion. >>> >>> >>> Regards, Peter >>> > From Roger.Riggs at Oracle.com Wed Apr 29 13:23:54 2015 From: Roger.Riggs at Oracle.com (Roger Riggs) Date: Wed, 29 Apr 2015 09:23:54 -0400 Subject: RFR: JDK-8074003 java.time.zone.ZoneRules.getOffset(java.time.Instant) can be optimized In-Reply-To: References: <553E62D6.9030102@gmail.com> <5540A572.5@gmail.com> Message-ID: <5540DB6A.1020005@Oracle.com> Hi Stephen, Peter, I think we should clarify the constructor to indicate that nanoseconds are truncated/ignored. That should be done as a separate request since it is a spec change and needs additional review. Roger On 4/29/2015 5:43 AM, Stephen Colebourne wrote: > On the LocalDateTime being passed in with nanoseconds, that was an > unconsidered use case. The whole offset system relies on second based > offsets, so it should really be validated/truncated to remove nanos. > That way the equals/compareTo could be simplified again. Seems like a > separate issue, but perhaps could be tackled here. You need an Oracle > sponsor to tell you ;-) > > Stephen > > > On 29 April 2015 at 10:33, Peter Levart wrote: >> On 04/27/2015 06:51 PM, Stephen Colebourne wrote: >>> One additional change is needed. The compareTo() method can rely on >>> the new epochSecond field as well. >>> Otherwise good! >>> Stephen >> >> Hi Stephen, >> >> LocalDateTime (transition) has nanosecond precision. It may be that >> transitions loaded from file in ZoneRules only have second precisions, but >> ZoneOffsetTransition is a public class with public factory method that takes >> a LocalDateTime transition parameter, so I think compareTo() can't rely on >> epochSecond alone. But epochSecond can be used as optimization in >> compareTo() as well as equals(): >> >> http://cr.openjdk.java.net/~plevart/jdk9-dev/ZoneOffsetTransition.epochSecond/webrev.03/ >> >> An alternative to keeping epochSecond field in ZoneOffsetTransition would be >> to keep a reference to Instant instead. Instant contains an epochSecond >> field (as well as nanos) and could be used for both toEpochSecond() and >> getInstant() methods. >> >> What do you think? >> >> It also occurred to me that serialization format of ZoneOffsetTransition is >> not adequate currently as it looses nanosecond precision. >> >> Regards, Peter >> >> >>> On 27 April 2015 at 17:24, Peter Levart wrote: >>>> Hi again, >>>> >>>> Here's another optimization to be reviewed that has been discussed a >>>> while >>>> ago (just rebased from webrev.01) and approved by Stephen: >>>> >>>> >>>> http://cr.openjdk.java.net/~plevart/jdk9-dev/ZoneOffsetTransition.epochSecond/webrev.02/ >>>> >>>> >>>> The discussion about it is intermingled with the ZoneId.systemDefault() >>>> discussion and starts about here: >>>> >>>> >>>> http://mail.openjdk.java.net/pipermail/core-libs-dev/2015-February/031873.html >>>> >>>> >>>> The rationale for the optimization is speeding-up the conversion from >>>> epoch >>>> time to LocalDateTime. This conversion uses ZoneRules.getOffset(Instant) >>>> where there is a loop over ZoneOffsetTransition[] array that searches for >>>> 1st transition that has its toEpochSecond value less than the Instant's >>>> epochSecond. This calls ZoneOffsetTransition.toEpochSecond repeatedly, >>>> converting ZoneOffsetTransition.transition which is a LocalDateTime to >>>> epochSecond. This repeated conversion is unnecessary, as >>>> ZoneOffsetTransition[] array is part of ZoneRules which is cached. >>>> Optimizing the ZoneOffsetTransition implementation (keeping both >>>> LocalDateTime variant and eposhSecond variant of transition time as the >>>> object's state) speeds up this conversion. >>>> >>>> >>>> Regards, Peter >>>> From Roger.Riggs at Oracle.com Wed Apr 29 13:31:14 2015 From: Roger.Riggs at Oracle.com (Roger Riggs) Date: Wed, 29 Apr 2015 09:31:14 -0400 Subject: RFR: JDK-8074003 java.time.zone.ZoneRules.getOffset(java.time.Instant) can be optimized In-Reply-To: <5540A572.5@gmail.com> References: <553E62D6.9030102@gmail.com> <5540A572.5@gmail.com> Message-ID: <5540DD22.1000503@Oracle.com> Hi Peter, Point taken about the constructor and that should have a spec clarification to ignore the nanoseconds. The issue is tracked with: JDK-8079063 ZoneOffsetTransition constructor should ignore nanoseconds With that, the compareTo method can be simpler. The rest looks fine. Roger On 4/29/2015 5:33 AM, Peter Levart wrote: > > On 04/27/2015 06:51 PM, Stephen Colebourne wrote: >> One additional change is needed. The compareTo() method can rely on >> the new epochSecond field as well. >> Otherwise good! >> Stephen > > Hi Stephen, > > LocalDateTime (transition) has nanosecond precision. It may be that > transitions loaded from file in ZoneRules only have second precisions, > but ZoneOffsetTransition is a public class with public factory method > that takes a LocalDateTime transition parameter, so I think > compareTo() can't rely on epochSecond alone. But epochSecond can be > used as optimization in compareTo() as well as equals(): > > http://cr.openjdk.java.net/~plevart/jdk9-dev/ZoneOffsetTransition.epochSecond/webrev.03/ > > > An alternative to keeping epochSecond field in ZoneOffsetTransition > would be to keep a reference to Instant instead. Instant contains an > epochSecond field (as well as nanos) and could be used for both > toEpochSecond() and getInstant() methods. > > What do you think? > > It also occurred to me that serialization format of > ZoneOffsetTransition is not adequate currently as it looses nanosecond > precision. > > Regards, Peter > >> >> On 27 April 2015 at 17:24, Peter Levart wrote: >>> Hi again, >>> >>> Here's another optimization to be reviewed that has been discussed a >>> while >>> ago (just rebased from webrev.01) and approved by Stephen: >>> >>> http://cr.openjdk.java.net/~plevart/jdk9-dev/ZoneOffsetTransition.epochSecond/webrev.02/ >>> >>> >>> >>> The discussion about it is intermingled with the ZoneId.systemDefault() >>> discussion and starts about here: >>> >>> http://mail.openjdk.java.net/pipermail/core-libs-dev/2015-February/031873.html >>> >>> >>> >>> The rationale for the optimization is speeding-up the conversion >>> from epoch >>> time to LocalDateTime. This conversion uses >>> ZoneRules.getOffset(Instant) >>> where there is a loop over ZoneOffsetTransition[] array that >>> searches for >>> 1st transition that has its toEpochSecond value less than the Instant's >>> epochSecond. This calls ZoneOffsetTransition.toEpochSecond repeatedly, >>> converting ZoneOffsetTransition.transition which is a LocalDateTime to >>> epochSecond. This repeated conversion is unnecessary, as >>> ZoneOffsetTransition[] array is part of ZoneRules which is cached. >>> Optimizing the ZoneOffsetTransition implementation (keeping both >>> LocalDateTime variant and eposhSecond variant of transition time as the >>> object's state) speeds up this conversion. >>> >>> >>> Regards, Peter >>> > From aleksej.efimov at oracle.com Wed Apr 29 14:37:29 2015 From: aleksej.efimov at oracle.com (Aleksej Efimov) Date: Wed, 29 Apr 2015 17:37:29 +0300 Subject: RFR: 8077685: (tz) Support tzdata2015d Message-ID: <5540ECA9.5040504@oracle.com> Hi, Please, review the fix for adding the latest tzdata2015d to JDK9. The JTREG and JPRT tests were executed. No failures were observed. Thank you, Aleksej [1] JBS: https://bugs.openjdk.java.net/browse/JDK-8077685 [2] Webrev: http://cr.openjdk.java.net/~aefimov/tzdata/2015d/9/00 From peter.levart at gmail.com Wed Apr 29 15:26:52 2015 From: peter.levart at gmail.com (Peter Levart) Date: Wed, 29 Apr 2015 17:26:52 +0200 Subject: RFR: JDK-8074003 java.time.zone.ZoneRules.getOffset(java.time.Instant) can be optimized In-Reply-To: <5540DD22.1000503@Oracle.com> References: <553E62D6.9030102@gmail.com> <5540A572.5@gmail.com> <5540DD22.1000503@Oracle.com> Message-ID: <5540F83C.2080100@gmail.com> On 04/29/2015 03:31 PM, Roger Riggs wrote: > Hi Peter, > > Point taken about the constructor and that should have a spec > clarification to ignore the nanoseconds. > The issue is tracked with: > JDK-8079063 > ZoneOffsetTransition constructor should ignore nanoseconds > > With that, the compareTo method can be simpler. The rest looks fine. > > Roger Hi Roger, Should I prepare a patch for both issues in one changeset as the correct compareTo/equals depends on the truncation or should I just pretend that truncation has been performed and make this change accordingly or should I 1st do the JDK-8079063 and then this one on top? Also, getInstant() can be much simpler if the truncation is performed: return Instant.of(epochSecond); Regards, Peter > > > On 4/29/2015 5:33 AM, Peter Levart wrote: >> >> On 04/27/2015 06:51 PM, Stephen Colebourne wrote: >>> One additional change is needed. The compareTo() method can rely on >>> the new epochSecond field as well. >>> Otherwise good! >>> Stephen >> >> Hi Stephen, >> >> LocalDateTime (transition) has nanosecond precision. It may be that >> transitions loaded from file in ZoneRules only have second >> precisions, but ZoneOffsetTransition is a public class with public >> factory method that takes a LocalDateTime transition parameter, so I >> think compareTo() can't rely on epochSecond alone. But epochSecond >> can be used as optimization in compareTo() as well as equals(): >> >> http://cr.openjdk.java.net/~plevart/jdk9-dev/ZoneOffsetTransition.epochSecond/webrev.03/ >> >> >> An alternative to keeping epochSecond field in ZoneOffsetTransition >> would be to keep a reference to Instant instead. Instant contains an >> epochSecond field (as well as nanos) and could be used for both >> toEpochSecond() and getInstant() methods. >> >> What do you think? >> >> It also occurred to me that serialization format of >> ZoneOffsetTransition is not adequate currently as it looses >> nanosecond precision. >> >> Regards, Peter >> >>> >>> On 27 April 2015 at 17:24, Peter Levart wrote: >>>> Hi again, >>>> >>>> Here's another optimization to be reviewed that has been discussed >>>> a while >>>> ago (just rebased from webrev.01) and approved by Stephen: >>>> >>>> http://cr.openjdk.java.net/~plevart/jdk9-dev/ZoneOffsetTransition.epochSecond/webrev.02/ >>>> >>>> >>>> >>>> The discussion about it is intermingled with the >>>> ZoneId.systemDefault() >>>> discussion and starts about here: >>>> >>>> http://mail.openjdk.java.net/pipermail/core-libs-dev/2015-February/031873.html >>>> >>>> >>>> >>>> The rationale for the optimization is speeding-up the conversion >>>> from epoch >>>> time to LocalDateTime. This conversion uses >>>> ZoneRules.getOffset(Instant) >>>> where there is a loop over ZoneOffsetTransition[] array that >>>> searches for >>>> 1st transition that has its toEpochSecond value less than the >>>> Instant's >>>> epochSecond. This calls ZoneOffsetTransition.toEpochSecond repeatedly, >>>> converting ZoneOffsetTransition.transition which is a LocalDateTime to >>>> epochSecond. This repeated conversion is unnecessary, as >>>> ZoneOffsetTransition[] array is part of ZoneRules which is cached. >>>> Optimizing the ZoneOffsetTransition implementation (keeping both >>>> LocalDateTime variant and eposhSecond variant of transition time as >>>> the >>>> object's state) speeds up this conversion. >>>> >>>> >>>> Regards, Peter >>>> >> > From Roger.Riggs at Oracle.com Wed Apr 29 15:35:15 2015 From: Roger.Riggs at Oracle.com (Roger Riggs) Date: Wed, 29 Apr 2015 11:35:15 -0400 Subject: RFR: JDK-8074003 java.time.zone.ZoneRules.getOffset(java.time.Instant) can be optimized In-Reply-To: <5540F83C.2080100@gmail.com> References: <553E62D6.9030102@gmail.com> <5540A572.5@gmail.com> <5540DD22.1000503@Oracle.com> <5540F83C.2080100@gmail.com> Message-ID: <5540FA33.60009@Oracle.com> Hi Peter, There should be two changesets; so pretend the truncation has been performed for this change. It maybe useful to backport the performance improvement to jdk 8 but the spec change will have to be in 9 (or wait for a maintenance release). The simplification of toInstant can happen with the changeset for 8079063. Thanks, Roger On 4/29/2015 11:26 AM, Peter Levart wrote: > > > On 04/29/2015 03:31 PM, Roger Riggs wrote: >> Hi Peter, >> >> Point taken about the constructor and that should have a spec >> clarification to ignore the nanoseconds. >> The issue is tracked with: >> JDK-8079063 >> ZoneOffsetTransition constructor should ignore nanoseconds >> >> With that, the compareTo method can be simpler. The rest looks fine. >> >> Roger > > Hi Roger, > > Should I prepare a patch for both issues in one changeset as the > correct compareTo/equals depends on the truncation or should I just > pretend that truncation has been performed and make this change > accordingly or should I 1st do the JDK-8079063 and then this one on top? > > Also, getInstant() can be much simpler if the truncation is performed: > return Instant.of(epochSecond); > > Regards, Peter > >> >> >> On 4/29/2015 5:33 AM, Peter Levart wrote: >>> >>> On 04/27/2015 06:51 PM, Stephen Colebourne wrote: >>>> One additional change is needed. The compareTo() method can rely on >>>> the new epochSecond field as well. >>>> Otherwise good! >>>> Stephen >>> >>> Hi Stephen, >>> >>> LocalDateTime (transition) has nanosecond precision. It may be that >>> transitions loaded from file in ZoneRules only have second >>> precisions, but ZoneOffsetTransition is a public class with public >>> factory method that takes a LocalDateTime transition parameter, so I >>> think compareTo() can't rely on epochSecond alone. But epochSecond >>> can be used as optimization in compareTo() as well as equals(): >>> >>> http://cr.openjdk.java.net/~plevart/jdk9-dev/ZoneOffsetTransition.epochSecond/webrev.03/ >>> >>> >>> An alternative to keeping epochSecond field in ZoneOffsetTransition >>> would be to keep a reference to Instant instead. Instant contains an >>> epochSecond field (as well as nanos) and could be used for both >>> toEpochSecond() and getInstant() methods. >>> >>> What do you think? >>> >>> It also occurred to me that serialization format of >>> ZoneOffsetTransition is not adequate currently as it looses >>> nanosecond precision. >>> >>> Regards, Peter >>> >>>> >>>> On 27 April 2015 at 17:24, Peter Levart >>>> wrote: >>>>> Hi again, >>>>> >>>>> Here's another optimization to be reviewed that has been discussed >>>>> a while >>>>> ago (just rebased from webrev.01) and approved by Stephen: >>>>> >>>>> http://cr.openjdk.java.net/~plevart/jdk9-dev/ZoneOffsetTransition.epochSecond/webrev.02/ >>>>> >>>>> >>>>> >>>>> The discussion about it is intermingled with the >>>>> ZoneId.systemDefault() >>>>> discussion and starts about here: >>>>> >>>>> http://mail.openjdk.java.net/pipermail/core-libs-dev/2015-February/031873.html >>>>> >>>>> >>>>> >>>>> The rationale for the optimization is speeding-up the conversion >>>>> from epoch >>>>> time to LocalDateTime. This conversion uses >>>>> ZoneRules.getOffset(Instant) >>>>> where there is a loop over ZoneOffsetTransition[] array that >>>>> searches for >>>>> 1st transition that has its toEpochSecond value less than the >>>>> Instant's >>>>> epochSecond. This calls ZoneOffsetTransition.toEpochSecond >>>>> repeatedly, >>>>> converting ZoneOffsetTransition.transition which is a >>>>> LocalDateTime to >>>>> epochSecond. This repeated conversion is unnecessary, as >>>>> ZoneOffsetTransition[] array is part of ZoneRules which is cached. >>>>> Optimizing the ZoneOffsetTransition implementation (keeping both >>>>> LocalDateTime variant and eposhSecond variant of transition time >>>>> as the >>>>> object's state) speeds up this conversion. >>>>> >>>>> >>>>> Regards, Peter >>>>> >>> >> > From brian.burkhalter at oracle.com Wed Apr 29 22:55:57 2015 From: brian.burkhalter at oracle.com (Brian Burkhalter) Date: Wed, 29 Apr 2015 15:55:57 -0700 Subject: [9] RFR of 8078672: Print and allow setting by Java property seeds used to initialize Random instances in java.lang numerics tests In-Reply-To: <85512CBD-11DA-4EDB-96A1-7D222E941E5F@oracle.com> References: <3BF44A04-8B17-4C5B-8EC6-70BA948C0841@oracle.com> <553ED521.3020208@oracle.com> <9711F5D5-20DD-49AC-A237-FB054D7E342D@oracle.com> <2EDA6421-2B3C-406C-83C9-B9FBFC75FDC5@oracle.com> <85512CBD-11DA-4EDB-96A1-7D222E941E5F@oracle.com> Message-ID: <3BC685C9-5D43-4F29-8D1D-A73087EA9E7D@oracle.com> Continuing the conversation about: https://bugs.openjdk.java.net/browse/JDK-8078672 with an updated patch: http://cr.openjdk.java.net/~bpb/8078672/webrev.01/. Please review at your convenience. Summary: 1) test/java/lang/RandomFactory.java is moved to test/lib/testlibrary/jdk/testlibrary/ (with respect to the previous patch but not visible in the webrev) and getSplittableRandom() is added. 2) the java/lang/{Double,Integer,Long,Math} tests modified in the previous patch are updated to use RandomFactory in its new, generic location. 3) the java/math/Big{Decimal,Integer} tests which used test/java/math/RandomSeed are modified to use RandomFactory. 4) test/java/math/RandomSeed.java is removed. All tests pass locally on OS X and a job testing jdk_lang and jdk_math has been submitted to the usual set of platforms. Thanks, Brian On Apr 28, 2015, at 8:04 AM, Brian Burkhalter wrote: > On Apr 28, 2015, at 12:57 AM, Chris Hegarty wrote: > >>>> Perhaps the random number handling should be moved up to somewhere under jdk/test/lib? That would more easily let other type who want to handling random numbers in a uniform way use the library (at the cost of slightly more complicated jtreg tagging). >>> >>> I?ll investigate tomorrow whether perhaps this functionality can be moved to a higher level with removal of duplication of code. The java/math/RandomSeed class changeset was the first in which I used @library so I should look over the jtreg tag list again. >> >> I think having support for this in the jdk/test/lib/testlibrary/jdk/testlibrary would be good. I was going to suggest that too when the first changeset was pushed. >> >> -Chris. > > Hi Chris, > > Yes I concur and will look into consolidating this code in a centralized location. > > Thanks, > > Brian From joe.darcy at oracle.com Wed Apr 29 23:03:47 2015 From: joe.darcy at oracle.com (joe darcy) Date: Wed, 29 Apr 2015 16:03:47 -0700 Subject: [9] RFR of 8078672: Print and allow setting by Java property seeds used to initialize Random instances in java.lang numerics tests In-Reply-To: <3BC685C9-5D43-4F29-8D1D-A73087EA9E7D@oracle.com> References: <3BF44A04-8B17-4C5B-8EC6-70BA948C0841@oracle.com> <553ED521.3020208@oracle.com> <9711F5D5-20DD-49AC-A237-FB054D7E342D@oracle.com> <2EDA6421-2B3C-406C-83C9-B9FBFC75FDC5@oracle.com> <85512CBD-11DA-4EDB-96A1-7D222E941E5F@oracle.com> <3BC685C9-5D43-4F29-8D1D-A73087EA9E7D@oracle.com> Message-ID: <55416353.7050602@oracle.com> Hi Brian, Looks good. If the new RandomFactory.java came from the old RandomSeed, it would be preferable if the old file was hg mv'ed to the new one. Thanks, -Joe On 4/29/2015 3:55 PM, Brian Burkhalter wrote: > Continuing the conversation about: > > https://bugs.openjdk.java.net/browse/JDK-8078672 > > with an updated patch: > > http://cr.openjdk.java.net/~bpb/8078672/webrev.01/. > > Please review at your convenience. > > Summary: > > 1) test/java/lang/RandomFactory.java is moved to test/lib/testlibrary/jdk/testlibrary/ (with respect to the previous patch but not visible in the webrev) and getSplittableRandom() is added. > > 2) the java/lang/{Double,Integer,Long,Math} tests modified in the previous patch are updated to use RandomFactory in its new, generic location. > > 3) the java/math/Big{Decimal,Integer} tests which used test/java/math/RandomSeed are modified to use RandomFactory. > > 4) test/java/math/RandomSeed.java is removed. > > All tests pass locally on OS X and a job testing jdk_lang and jdk_math has been submitted to the usual set of platforms. > > Thanks, > > Brian > > On Apr 28, 2015, at 8:04 AM, Brian Burkhalter wrote: > >> On Apr 28, 2015, at 12:57 AM, Chris Hegarty wrote: >> >>>>> Perhaps the random number handling should be moved up to somewhere under jdk/test/lib? That would more easily let other type who want to handling random numbers in a uniform way use the library (at the cost of slightly more complicated jtreg tagging). >>>> I?ll investigate tomorrow whether perhaps this functionality can be moved to a higher level with removal of duplication of code. The java/math/RandomSeed class changeset was the first in which I used @library so I should look over the jtreg tag list again. >>> I think having support for this in the jdk/test/lib/testlibrary/jdk/testlibrary would be good. I was going to suggest that too when the first changeset was pushed. >>> >>> -Chris. >> Hi Chris, >> >> Yes I concur and will look into consolidating this code in a centralized location. >> >> Thanks, >> >> Brian From brian.burkhalter at oracle.com Wed Apr 29 23:25:17 2015 From: brian.burkhalter at oracle.com (Brian Burkhalter) Date: Wed, 29 Apr 2015 16:25:17 -0700 Subject: [9] RFR of 8078672: Print and allow setting by Java property seeds used to initialize Random instances in java.lang numerics tests In-Reply-To: <55416353.7050602@oracle.com> References: <3BF44A04-8B17-4C5B-8EC6-70BA948C0841@oracle.com> <553ED521.3020208@oracle.com> <9711F5D5-20DD-49AC-A237-FB054D7E342D@oracle.com> <2EDA6421-2B3C-406C-83C9-B9FBFC75FDC5@oracle.com> <85512CBD-11DA-4EDB-96A1-7D222E941E5F@oracle.com> <3BC685C9-5D43-4F29-8D1D-A73087EA9E7D@oracle.com> <55416353.7050602@oracle.com> Message-ID: <4D3543AB-058D-4CDE-8231-B2DB5322A29D@oracle.com> Hi Joe, No, RandomFactory would have been added by the previous webrev.00 version of the patch, i.e., RandomFactory did not come from RandomSeed. Is this reasonable? Thanks, Brian On Apr 29, 2015, at 4:03 PM, joe darcy wrote: > Looks good. If the new RandomFactory.java came from the old RandomSeed, it would be preferable if the old file was hg mv'ed to the new one. From joe.darcy at oracle.com Wed Apr 29 23:26:42 2015 From: joe.darcy at oracle.com (Joseph D. Darcy) Date: Wed, 29 Apr 2015 16:26:42 -0700 Subject: [9] RFR of 8078672: Print and allow setting by Java property seeds used to initialize Random instances in java.lang numerics tests In-Reply-To: <4D3543AB-058D-4CDE-8231-B2DB5322A29D@oracle.com> References: <3BF44A04-8B17-4C5B-8EC6-70BA948C0841@oracle.com> <553ED521.3020208@oracle.com> <9711F5D5-20DD-49AC-A237-FB054D7E342D@oracle.com> <2EDA6421-2B3C-406C-83C9-B9FBFC75FDC5@oracle.com> <85512CBD-11DA-4EDB-96A1-7D222E941E5F@oracle.com> <3BC685C9-5D43-4F29-8D1D-A73087EA9E7D@oracle.com> <55416353.7050602@oracle.com> <4D3543AB-058D-4CDE-8231-B2DB5322A29D@oracle.com> Message-ID: <554168B2.7020604@oracle.com> Hi Brian, On 4/29/2015 4:25 PM, Brian Burkhalter wrote: > Hi Joe, > > No, RandomFactory would have been added by the previous webrev.00 > version of the patch, i.e., RandomFactory did not come from RandomSeed. > > Is this reasonable? > > Thanks, > Sounds reasonable (they two files didn't necessarily look related, but I thought it was worth checking). Thanks, -Joe From brian.burkhalter at oracle.com Wed Apr 29 23:27:38 2015 From: brian.burkhalter at oracle.com (Brian Burkhalter) Date: Wed, 29 Apr 2015 16:27:38 -0700 Subject: [9] RFR of 8078672: Print and allow setting by Java property seeds used to initialize Random instances in java.lang numerics tests In-Reply-To: <554168B2.7020604@oracle.com> References: <3BF44A04-8B17-4C5B-8EC6-70BA948C0841@oracle.com> <553ED521.3020208@oracle.com> <9711F5D5-20DD-49AC-A237-FB054D7E342D@oracle.com> <2EDA6421-2B3C-406C-83C9-B9FBFC75FDC5@oracle.com> <85512CBD-11DA-4EDB-96A1-7D222E941E5F@oracle.com> <3BC685C9-5D43-4F29-8D1D-A73087EA9E7D@oracle.com> <55416353.7050602@oracle.com> <4D3543AB-058D-4CDE-8231-B2DB5322A29D@oracle.com> <554168B2.7020604@oracle.com> Message-ID: <8001A431-F7FD-426F-A79D-91FBB97960DF@oracle.com> Hi Joe, On Apr 29, 2015, at 4:26 PM, Joseph D. Darcy wrote: > Sounds reasonable (they two files didn't necessarily look related, but I thought it was worth checking). I understand: that?s just being thorough! Thanks, Brian From masayoshi.okutsu at oracle.com Thu Apr 30 06:50:06 2015 From: masayoshi.okutsu at oracle.com (Masayoshi Okutsu) Date: Thu, 30 Apr 2015 15:50:06 +0900 Subject: RFR: 8077685: (tz) Support tzdata2015d In-Reply-To: <5540ECA9.5040504@oracle.com> References: <5540ECA9.5040504@oracle.com> Message-ID: <5541D09E.4050904@oracle.com> Looks good to me. Masayoshi On 4/29/2015 11:37 PM, Aleksej Efimov wrote: > Hi, > > Please, review the fix for adding the latest tzdata2015d to JDK9. > The JTREG and JPRT tests were executed. > No failures were observed. > > Thank you, > Aleksej > > [1] JBS: https://bugs.openjdk.java.net/browse/JDK-8077685 > [2] Webrev: http://cr.openjdk.java.net/~aefimov/tzdata/2015d/9/00 From peter.levart at gmail.com Thu Apr 30 10:24:23 2015 From: peter.levart at gmail.com (Peter Levart) Date: Thu, 30 Apr 2015 12:24:23 +0200 Subject: RFR: JDK-8074003 java.time.zone.ZoneRules.getOffset(java.time.Instant) can be optimized In-Reply-To: <5540FA33.60009@Oracle.com> References: <553E62D6.9030102@gmail.com> <5540A572.5@gmail.com> <5540DD22.1000503@Oracle.com> <5540F83C.2080100@gmail.com> <5540FA33.60009@Oracle.com> Message-ID: <554202D7.5030407@gmail.com> On 04/29/2015 05:35 PM, Roger Riggs wrote: > Hi Peter, > > There should be two changesets; so pretend the truncation has been > performed for this change. > It maybe useful to backport the performance improvement to jdk 8 but > the spec change > will have to be in 9 (or wait for a maintenance release). > Hi Roger, So perhaps it would be best to push what we have in webrev.03 now, so that it can be backported to 8u directly without modifications and simplify equals/compareTo/getInstant as part of the changeset for 8079063. I think this is more consistent. And I can prepare the change for 8079063 right away so the spec change process can be started. Do I have a go for webrev.03 for jdk9 ? http://cr.openjdk.java.net/~plevart/jdk9-dev/ZoneOffsetTransition.epochSecond/webrev.03/ Regards, Peter > The simplification of toInstant can happen with the changeset for > 8079063. > > Thanks, Roger > > > On 4/29/2015 11:26 AM, Peter Levart wrote: >> >> >> On 04/29/2015 03:31 PM, Roger Riggs wrote: >>> Hi Peter, >>> >>> Point taken about the constructor and that should have a spec >>> clarification to ignore the nanoseconds. >>> The issue is tracked with: >>> JDK-8079063 >>> ZoneOffsetTransition constructor should ignore nanoseconds >>> >>> With that, the compareTo method can be simpler. The rest looks fine. >>> >>> Roger >> >> Hi Roger, >> >> Should I prepare a patch for both issues in one changeset as the >> correct compareTo/equals depends on the truncation or should I just >> pretend that truncation has been performed and make this change >> accordingly or should I 1st do the JDK-8079063 and then this one on top? >> >> Also, getInstant() can be much simpler if the truncation is >> performed: return Instant.of(epochSecond); >> >> Regards, Peter >> >>> >>> >>> On 4/29/2015 5:33 AM, Peter Levart wrote: >>>> >>>> On 04/27/2015 06:51 PM, Stephen Colebourne wrote: >>>>> One additional change is needed. The compareTo() method can rely on >>>>> the new epochSecond field as well. >>>>> Otherwise good! >>>>> Stephen >>>> >>>> Hi Stephen, >>>> >>>> LocalDateTime (transition) has nanosecond precision. It may be that >>>> transitions loaded from file in ZoneRules only have second >>>> precisions, but ZoneOffsetTransition is a public class with public >>>> factory method that takes a LocalDateTime transition parameter, so >>>> I think compareTo() can't rely on epochSecond alone. But >>>> epochSecond can be used as optimization in compareTo() as well as >>>> equals(): >>>> >>>> http://cr.openjdk.java.net/~plevart/jdk9-dev/ZoneOffsetTransition.epochSecond/webrev.03/ >>>> >>>> >>>> An alternative to keeping epochSecond field in ZoneOffsetTransition >>>> would be to keep a reference to Instant instead. Instant contains >>>> an epochSecond field (as well as nanos) and could be used for both >>>> toEpochSecond() and getInstant() methods. >>>> >>>> What do you think? >>>> >>>> It also occurred to me that serialization format of >>>> ZoneOffsetTransition is not adequate currently as it looses >>>> nanosecond precision. >>>> >>>> Regards, Peter >>>> >>>>> >>>>> On 27 April 2015 at 17:24, Peter Levart >>>>> wrote: >>>>>> Hi again, >>>>>> >>>>>> Here's another optimization to be reviewed that has been >>>>>> discussed a while >>>>>> ago (just rebased from webrev.01) and approved by Stephen: >>>>>> >>>>>> http://cr.openjdk.java.net/~plevart/jdk9-dev/ZoneOffsetTransition.epochSecond/webrev.02/ >>>>>> >>>>>> >>>>>> >>>>>> The discussion about it is intermingled with the >>>>>> ZoneId.systemDefault() >>>>>> discussion and starts about here: >>>>>> >>>>>> http://mail.openjdk.java.net/pipermail/core-libs-dev/2015-February/031873.html >>>>>> >>>>>> >>>>>> >>>>>> The rationale for the optimization is speeding-up the conversion >>>>>> from epoch >>>>>> time to LocalDateTime. This conversion uses >>>>>> ZoneRules.getOffset(Instant) >>>>>> where there is a loop over ZoneOffsetTransition[] array that >>>>>> searches for >>>>>> 1st transition that has its toEpochSecond value less than the >>>>>> Instant's >>>>>> epochSecond. This calls ZoneOffsetTransition.toEpochSecond >>>>>> repeatedly, >>>>>> converting ZoneOffsetTransition.transition which is a >>>>>> LocalDateTime to >>>>>> epochSecond. This repeated conversion is unnecessary, as >>>>>> ZoneOffsetTransition[] array is part of ZoneRules which is cached. >>>>>> Optimizing the ZoneOffsetTransition implementation (keeping both >>>>>> LocalDateTime variant and eposhSecond variant of transition time >>>>>> as the >>>>>> object's state) speeds up this conversion. >>>>>> >>>>>> >>>>>> Regards, Peter >>>>>> >>>> >>> >> > From peter.levart at gmail.com Thu Apr 30 11:08:00 2015 From: peter.levart at gmail.com (Peter Levart) Date: Thu, 30 Apr 2015 13:08:00 +0200 Subject: RFR: 8077846: improve locking strategy for readConfiguration(), reset(), and initializeGlobalHandlers() In-Reply-To: <553FAB5B.3060605@gmail.com> References: <553A7835.80209@oracle.com> <553D8F0B.4070102@oracle.com> <553DE503.2060608@oracle.com> <553E29C7.8030800@oracle.com> <553E9685.1030809@oracle.com> <553F3DC4.4010104@gmail.com> <553F4136.5010500@oracle.com> <553F940C.4050105@gmail.com> <553F9FC7.4020806@oracle.com> <553FAB5B.3060605@gmail.com> Message-ID: <55420D10.2060001@gmail.com> On 04/28/2015 05:46 PM, Peter Levart wrote: > > > On 04/28/2015 04:57 PM, Daniel Fuchs wrote: >>> Here's my attempt at simplifying this: >>> >>> http://cr.openjdk.java.net/~plevart/misc/LogManager.synchronization/webrev.01/ >>> >> >> LogManager can be subclassed, and subclasses may override reset() for >> different purposes. >> So I'm afraid the Cleaner thread still needs to call te public >> reset() method. The same unfortunately applies to >> readConfiguration(). >> >> best regards, >> >> -- daniel > > Um, yes of course. This can be fixed: > > http://cr.openjdk.java.net/~plevart/misc/LogManager.synchronization/webrev.02/ > > > Regards, Peter > Hi Daniel, Just some observations... I noticed you changed LogManager.Cleaner superclass from ManagedLocalsThread -> Thread. Is that intentional? The Cleaner is an unstarted Thread that gets registered as a shutdown hook in LogManager constructor. So at LogManager construction time it gets hold on inheritable thread locals and keeps them for the entire JVM lifetime. Do we have control on what thread performs LogManager construction and that no inheritable thread-local leaks are possible? The other thing to note is that Cleaner class is not static, so it has an implicit reference to LogManager instance. So each LogManager instance constructed during lifetime of JVM is actually retained for the entire JVM lifetime. The use of shutdown hook to call reset() directly is questionable. Why? Because other shutdown hooks might want to log their shutdown processing and they will race with LogManager shutdown hook executing reset(), shutting down all log handlers and effectively preventing shutdown process form being logged. Why is it so important to reset() LogManager(s) before exiting VM? Regards, Peter From scolebourne at joda.org Thu Apr 30 11:28:14 2015 From: scolebourne at joda.org (Stephen Colebourne) Date: Thu, 30 Apr 2015 12:28:14 +0100 Subject: RFR: JDK-8074003 java.time.zone.ZoneRules.getOffset(java.time.Instant) can be optimized In-Reply-To: <554202D7.5030407@gmail.com> References: <553E62D6.9030102@gmail.com> <5540A572.5@gmail.com> <5540DD22.1000503@Oracle.com> <5540F83C.2080100@gmail.com> <5540FA33.60009@Oracle.com> <554202D7.5030407@gmail.com> Message-ID: The approach works for me, and the patch is valid as is. Stephen On 30 April 2015 at 11:24, Peter Levart wrote: > > On 04/29/2015 05:35 PM, Roger Riggs wrote: >> >> Hi Peter, >> >> There should be two changesets; so pretend the truncation has been >> performed for this change. >> It maybe useful to backport the performance improvement to jdk 8 but the >> spec change >> will have to be in 9 (or wait for a maintenance release). >> > > Hi Roger, > > So perhaps it would be best to push what we have in webrev.03 now, so that > it can be backported to 8u directly without modifications and simplify > equals/compareTo/getInstant as part of the changeset for 8079063. I think > this is more consistent. And I can prepare the change for 8079063 right away > so the spec change process can be started. > > Do I have a go for webrev.03 for jdk9 ? > > http://cr.openjdk.java.net/~plevart/jdk9-dev/ZoneOffsetTransition.epochSecond/webrev.03/ > > Regards, Peter > > >> The simplification of toInstant can happen with the changeset for 8079063. >> >> Thanks, Roger >> >> >> On 4/29/2015 11:26 AM, Peter Levart wrote: >>> >>> >>> >>> On 04/29/2015 03:31 PM, Roger Riggs wrote: >>>> >>>> Hi Peter, >>>> >>>> Point taken about the constructor and that should have a spec >>>> clarification to ignore the nanoseconds. >>>> The issue is tracked with: >>>> JDK-8079063 >>>> ZoneOffsetTransition constructor should ignore nanoseconds >>>> >>>> With that, the compareTo method can be simpler. The rest looks fine. >>>> >>>> Roger >>> >>> >>> Hi Roger, >>> >>> Should I prepare a patch for both issues in one changeset as the correct >>> compareTo/equals depends on the truncation or should I just pretend that >>> truncation has been performed and make this change accordingly or should I >>> 1st do the JDK-8079063 and then this one on top? >>> >>> Also, getInstant() can be much simpler if the truncation is performed: >>> return Instant.of(epochSecond); >>> >>> Regards, Peter >>> >>>> >>>> >>>> On 4/29/2015 5:33 AM, Peter Levart wrote: >>>>> >>>>> >>>>> On 04/27/2015 06:51 PM, Stephen Colebourne wrote: >>>>>> >>>>>> One additional change is needed. The compareTo() method can rely on >>>>>> the new epochSecond field as well. >>>>>> Otherwise good! >>>>>> Stephen >>>>> >>>>> >>>>> Hi Stephen, >>>>> >>>>> LocalDateTime (transition) has nanosecond precision. It may be that >>>>> transitions loaded from file in ZoneRules only have second precisions, but >>>>> ZoneOffsetTransition is a public class with public factory method that takes >>>>> a LocalDateTime transition parameter, so I think compareTo() can't rely on >>>>> epochSecond alone. But epochSecond can be used as optimization in >>>>> compareTo() as well as equals(): >>>>> >>>>> >>>>> http://cr.openjdk.java.net/~plevart/jdk9-dev/ZoneOffsetTransition.epochSecond/webrev.03/ >>>>> >>>>> An alternative to keeping epochSecond field in ZoneOffsetTransition >>>>> would be to keep a reference to Instant instead. Instant contains an >>>>> epochSecond field (as well as nanos) and could be used for both >>>>> toEpochSecond() and getInstant() methods. >>>>> >>>>> What do you think? >>>>> >>>>> It also occurred to me that serialization format of >>>>> ZoneOffsetTransition is not adequate currently as it looses nanosecond >>>>> precision. >>>>> >>>>> Regards, Peter >>>>> >>>>>> >>>>>> On 27 April 2015 at 17:24, Peter Levart >>>>>> wrote: >>>>>>> >>>>>>> Hi again, >>>>>>> >>>>>>> Here's another optimization to be reviewed that has been discussed a >>>>>>> while >>>>>>> ago (just rebased from webrev.01) and approved by Stephen: >>>>>>> >>>>>>> >>>>>>> http://cr.openjdk.java.net/~plevart/jdk9-dev/ZoneOffsetTransition.epochSecond/webrev.02/ >>>>>>> >>>>>>> >>>>>>> The discussion about it is intermingled with the >>>>>>> ZoneId.systemDefault() >>>>>>> discussion and starts about here: >>>>>>> >>>>>>> >>>>>>> http://mail.openjdk.java.net/pipermail/core-libs-dev/2015-February/031873.html >>>>>>> >>>>>>> >>>>>>> The rationale for the optimization is speeding-up the conversion from >>>>>>> epoch >>>>>>> time to LocalDateTime. This conversion uses >>>>>>> ZoneRules.getOffset(Instant) >>>>>>> where there is a loop over ZoneOffsetTransition[] array that searches >>>>>>> for >>>>>>> 1st transition that has its toEpochSecond value less than the >>>>>>> Instant's >>>>>>> epochSecond. This calls ZoneOffsetTransition.toEpochSecond >>>>>>> repeatedly, >>>>>>> converting ZoneOffsetTransition.transition which is a LocalDateTime >>>>>>> to >>>>>>> epochSecond. This repeated conversion is unnecessary, as >>>>>>> ZoneOffsetTransition[] array is part of ZoneRules which is cached. >>>>>>> Optimizing the ZoneOffsetTransition implementation (keeping both >>>>>>> LocalDateTime variant and eposhSecond variant of transition time as >>>>>>> the >>>>>>> object's state) speeds up this conversion. >>>>>>> >>>>>>> >>>>>>> Regards, Peter >>>>>>> >>>>> >>>> >>> >> > From alexander.v.stepanov at oracle.com Thu Apr 30 11:31:43 2015 From: alexander.v.stepanov at oracle.com (alexander stepanov) Date: Thu, 30 Apr 2015 14:31:43 +0300 Subject: RFR [9] 8079075: some docs cleanup for CORBA - part 1 Message-ID: <5542129F.2060704@oracle.com> Hello, Could you please review the following fix http://cr.openjdk.java.net/~avstepan/8079075/webrev.00/ for https://bugs.openjdk.java.net/browse/JDK-8079075 Just some HTML markup fix for CORBA. Thanks, Alexander From daniel.fuchs at oracle.com Thu Apr 30 11:47:08 2015 From: daniel.fuchs at oracle.com (Daniel Fuchs) Date: Thu, 30 Apr 2015 13:47:08 +0200 Subject: RFR: 8077846: improve locking strategy for readConfiguration(), reset(), and initializeGlobalHandlers() In-Reply-To: <55420D10.2060001@gmail.com> References: <553A7835.80209@oracle.com> <553D8F0B.4070102@oracle.com> <553DE503.2060608@oracle.com> <553E29C7.8030800@oracle.com> <553E9685.1030809@oracle.com> <553F3DC4.4010104@gmail.com> <553F4136.5010500@oracle.com> <553F940C.4050105@gmail.com> <553F9FC7.4020806@oracle.com> <553FAB5B.3060605@gmail.com> <55420D10.2060001@gmail.com> Message-ID: <5542163C.7090608@oracle.com> Hi Peter, Sorry I didn't reply to your last mail. I still intend to. more on the current mail below... On 30/04/15 13:08, Peter Levart wrote: > > > On 04/28/2015 05:46 PM, Peter Levart wrote: >> >> >> On 04/28/2015 04:57 PM, Daniel Fuchs wrote: >>>> Here's my attempt at simplifying this: >>>> >>>> http://cr.openjdk.java.net/~plevart/misc/LogManager.synchronization/webrev.01/ >>>> >>> >>> LogManager can be subclassed, and subclasses may override reset() for >>> different purposes. >>> So I'm afraid the Cleaner thread still needs to call te public >>> reset() method. The same unfortunately applies to >>> readConfiguration(). >>> >>> best regards, >>> >>> -- daniel >> >> Um, yes of course. This can be fixed: >> >> http://cr.openjdk.java.net/~plevart/misc/LogManager.synchronization/webrev.02/ >> >> >> Regards, Peter >> > > Hi Daniel, > > Just some observations... > > I noticed you changed LogManager.Cleaner superclass from > ManagedLocalsThread -> Thread. Is that intentional? I didn't - http://cr.openjdk.java.net/~dfuchs/webrev_8077846/webrev.00/ but you did :-) http://cr.openjdk.java.net/~plevart/misc/LogManager.synchronization/webrev.02 The repo on which I prepared the patch didn't have this change yet. It's probably the result of a bad merge when you upgraded/applied my patch. > The Cleaner is an > unstarted Thread that gets registered as a shutdown hook in LogManager > constructor. So at LogManager construction time it gets hold on > inheritable thread locals and keeps them for the entire JVM lifetime. Do > we have control on what thread performs LogManager construction and that > no inheritable thread-local leaks are possible? > > The other thing to note is that Cleaner class is not static, so it has > an implicit reference to LogManager instance. So each LogManager > instance constructed during lifetime of JVM is actually retained for the > entire JVM lifetime. Yes. I would say that's not an issue because the LogManager is supposed to be a singleton class. There should be only one instance. This is sadly not enforced and there are applications out there that have taken that opportunity to create several LogManagers - but that is not actually supported (we just try to not cause regressions). > The use of shutdown hook to call reset() directly is questionable. Why? > Because other shutdown hooks might want to log their shutdown processing > and they will race with LogManager shutdown hook executing reset(), > shutting down all log handlers and effectively preventing shutdown > process form being logged. Why is it so important to reset() > LogManager(s) before exiting VM? It is questionable, agreed. And there are applications which subclass LogManager just for the purpose of preventing reset() from doing anything - so that they can use loggers in other shutdown hook. There's even an issue in JBS. The problem here is to cleanly close the handlers when the VM exits (there are locks to be released and XML tails to be written). Using a mechanism similar to sun.misc.Cleaner in order to close handlers when they are no longer referenced is unfortunately not trivial, because you precisely need a reference to the Handler in order to call close() on it. And because of compatibility issues we're more or less stuck with the current Cleaner thread anyway. best regards -- daniel > > Regards, Peter > From alexander.v.stepanov at oracle.com Thu Apr 30 11:56:43 2015 From: alexander.v.stepanov at oracle.com (alexander stepanov) Date: Thu, 30 Apr 2015 14:56:43 +0300 Subject: RFR [9] 8079075: some docs cleanup for CORBA - part 1 In-Reply-To: <5542129F.2060704@oracle.com> References: <5542129F.2060704@oracle.com> Message-ID: <5542187B.90003@oracle.com> P.S. Sorry, not sure if changes like "" -> "{@literal }" (see, e.g., ValueBoxGen24.java) are what expected; please correct me if I'm wrong. But something should be done; otherwise "" is interpreted as an unknown HTML tag causing the errors. Thanks, Alexander On 30.04.2015 14:31, alexander stepanov wrote: > Hello, > > Could you please review the following fix > http://cr.openjdk.java.net/~avstepan/8079075/webrev.00/ > for > https://bugs.openjdk.java.net/browse/JDK-8079075 > > Just some HTML markup fix for CORBA. > > Thanks, > Alexander From Roger.Riggs at Oracle.com Thu Apr 30 12:47:20 2015 From: Roger.Riggs at Oracle.com (Roger Riggs) Date: Thu, 30 Apr 2015 08:47:20 -0400 Subject: RFR: JDK-8074003 java.time.zone.ZoneRules.getOffset(java.time.Instant) can be optimized In-Reply-To: <554202D7.5030407@gmail.com> References: <553E62D6.9030102@gmail.com> <5540A572.5@gmail.com> <5540DD22.1000503@Oracle.com> <5540F83C.2080100@gmail.com> <5540FA33.60009@Oracle.com> <554202D7.5030407@gmail.com> Message-ID: <55422458.1040202@Oracle.com> Hi Peter, Yes, go ahead with the patch as is. Thanks, Roger On 4/30/2015 6:24 AM, Peter Levart wrote: > > On 04/29/2015 05:35 PM, Roger Riggs wrote: >> Hi Peter, >> >> There should be two changesets; so pretend the truncation has been >> performed for this change. >> It maybe useful to backport the performance improvement to jdk 8 but >> the spec change >> will have to be in 9 (or wait for a maintenance release). >> > > Hi Roger, > > So perhaps it would be best to push what we have in webrev.03 now, so > that it can be backported to 8u directly without modifications and > simplify equals/compareTo/getInstant as part of the changeset for > 8079063. I think this is more consistent. And I can prepare the change > for 8079063 right away so the spec change process can be started. > > Do I have a go for webrev.03 for jdk9 ? > > http://cr.openjdk.java.net/~plevart/jdk9-dev/ZoneOffsetTransition.epochSecond/webrev.03/ > > > Regards, Peter > >> The simplification of toInstant can happen with the changeset for >> 8079063. >> >> Thanks, Roger >> >> >> On 4/29/2015 11:26 AM, Peter Levart wrote: >>> >>> >>> On 04/29/2015 03:31 PM, Roger Riggs wrote: >>>> Hi Peter, >>>> >>>> Point taken about the constructor and that should have a spec >>>> clarification to ignore the nanoseconds. >>>> The issue is tracked with: >>>> JDK-8079063 >>>> ZoneOffsetTransition constructor should ignore nanoseconds >>>> >>>> With that, the compareTo method can be simpler. The rest looks fine. >>>> >>>> Roger >>> >>> Hi Roger, >>> >>> Should I prepare a patch for both issues in one changeset as the >>> correct compareTo/equals depends on the truncation or should I just >>> pretend that truncation has been performed and make this change >>> accordingly or should I 1st do the JDK-8079063 and then this one on >>> top? >>> >>> Also, getInstant() can be much simpler if the truncation is >>> performed: return Instant.of(epochSecond); >>> >>> Regards, Peter >>> >>>> >>>> >>>> On 4/29/2015 5:33 AM, Peter Levart wrote: >>>>> >>>>> On 04/27/2015 06:51 PM, Stephen Colebourne wrote: >>>>>> One additional change is needed. The compareTo() method can rely on >>>>>> the new epochSecond field as well. >>>>>> Otherwise good! >>>>>> Stephen >>>>> >>>>> Hi Stephen, >>>>> >>>>> LocalDateTime (transition) has nanosecond precision. It may be >>>>> that transitions loaded from file in ZoneRules only have second >>>>> precisions, but ZoneOffsetTransition is a public class with public >>>>> factory method that takes a LocalDateTime transition parameter, so >>>>> I think compareTo() can't rely on epochSecond alone. But >>>>> epochSecond can be used as optimization in compareTo() as well as >>>>> equals(): >>>>> >>>>> http://cr.openjdk.java.net/~plevart/jdk9-dev/ZoneOffsetTransition.epochSecond/webrev.03/ >>>>> >>>>> >>>>> An alternative to keeping epochSecond field in >>>>> ZoneOffsetTransition would be to keep a reference to Instant >>>>> instead. Instant contains an epochSecond field (as well as nanos) >>>>> and could be used for both toEpochSecond() and getInstant() methods. >>>>> >>>>> What do you think? >>>>> >>>>> It also occurred to me that serialization format of >>>>> ZoneOffsetTransition is not adequate currently as it looses >>>>> nanosecond precision. >>>>> >>>>> Regards, Peter >>>>> >>>>>> >>>>>> On 27 April 2015 at 17:24, Peter Levart >>>>>> wrote: >>>>>>> Hi again, >>>>>>> >>>>>>> Here's another optimization to be reviewed that has been >>>>>>> discussed a while >>>>>>> ago (just rebased from webrev.01) and approved by Stephen: >>>>>>> >>>>>>> http://cr.openjdk.java.net/~plevart/jdk9-dev/ZoneOffsetTransition.epochSecond/webrev.02/ >>>>>>> >>>>>>> >>>>>>> >>>>>>> The discussion about it is intermingled with the >>>>>>> ZoneId.systemDefault() >>>>>>> discussion and starts about here: >>>>>>> >>>>>>> http://mail.openjdk.java.net/pipermail/core-libs-dev/2015-February/031873.html >>>>>>> >>>>>>> >>>>>>> >>>>>>> The rationale for the optimization is speeding-up the conversion >>>>>>> from epoch >>>>>>> time to LocalDateTime. This conversion uses >>>>>>> ZoneRules.getOffset(Instant) >>>>>>> where there is a loop over ZoneOffsetTransition[] array that >>>>>>> searches for >>>>>>> 1st transition that has its toEpochSecond value less than the >>>>>>> Instant's >>>>>>> epochSecond. This calls ZoneOffsetTransition.toEpochSecond >>>>>>> repeatedly, >>>>>>> converting ZoneOffsetTransition.transition which is a >>>>>>> LocalDateTime to >>>>>>> epochSecond. This repeated conversion is unnecessary, as >>>>>>> ZoneOffsetTransition[] array is part of ZoneRules which is cached. >>>>>>> Optimizing the ZoneOffsetTransition implementation (keeping both >>>>>>> LocalDateTime variant and eposhSecond variant of transition time >>>>>>> as the >>>>>>> object's state) speeds up this conversion. >>>>>>> >>>>>>> >>>>>>> Regards, Peter >>>>>>> >>>>> >>>> >>> >> > From Roger.Riggs at Oracle.com Thu Apr 30 13:47:42 2015 From: Roger.Riggs at Oracle.com (Roger Riggs) Date: Thu, 30 Apr 2015 09:47:42 -0400 Subject: RFR [9] 8079075: some docs cleanup for CORBA - part 1 In-Reply-To: <5542187B.90003@oracle.com> References: <5542129F.2060704@oracle.com> <5542187B.90003@oracle.com> Message-ID: <5542327E.6060403@Oracle.com> Hi Alexander, Thanks for working through all these changes. 0) Is there an upstream version of any of this code? Making even cosmetic changes would make future versions harder to merge. 1) For files that we don't typically generate javadoc for, it is simpler to avoid adding unnecessary markup. For example: old/src/java.corba/share/classes/com/sun/corba/se/impl/corba/AnyImpl.java:222+ + * @return the {@code TypeCode} for the element in the Any There is not much value in the addition of {@code }. For these kind of files, the javadoc should be well formed and any warnings/errors should be fixed. 2) a number of changes do not maintain the indentation, for example, - * @result the InputStream to marshal value of Any out of. + * @return the {@code InputStream} to marshal value of Any out of. Unless all of the indentation is going to be fixed in a file; it is better to remain consistent with the per file style. 3) Removing degenerate @author tags is great. But adding an extra blank line is not desirable. For example, old/src/java.corba/share/classes/com/sun/corba/se/impl/ior/GenericTaggedProfile.java:39 -/** - * @author - */ + 4) For snippets of code, use {@code} instead of a plain or {@literal ...} These files don't that pattern extensively and its not important to fix it everywhere since it is in the impl code. But for example, it would make sense here: old/src/java.corba/share/classes/com/sun/corba/se/impl/ior/ObjectAdapterIdNumber.java:31+ - * internally as arrays of the form { "OldRootPOA", "" }, + * internally as arrays of the form { "OldRootPOA", "{@literal }" }, Might be better as: + * internally as arrays of the form {@code { "OldRootPOA", "" }}, 5) The continuation of @param should be indented. src/java.corba/share/classes/com/sun/corba/se/impl/naming/pcosnaming/NamingContextImpl.java @@ -1204,14 +1202,13 @@ * This operation creates a URL based "iiopname://" format name * from the Stringified Name of the object. * @param addr internet based address of the host machine where - * Name Service is running

    - * @param sn Stringified Name of the object

    *+ * Name Service is running* + * @param sn Stringified Name of the object 6) correct the punctuation since the line is being modified. src/java.corba/share/classes/com/sun/corba/se/pept/transport/Acceptor.java - * @return trueAcceptor has been + * @return true. if the Acceptor has been Would read better as: + * @return true if the Acceptor has been 7) I don't recognize the strings of the format dNNNNN but they seem to be referring to past bug reports and the authors who fixed them. I doubt they have any value in the code anymore. It would probably be fine to just drop the extra '<>' symbols. And around the author initials. --> klr Regards, Roger On 4/30/2015 7:56 AM, alexander stepanov wrote: > P.S. Sorry, not sure if changes like "" -> "{@literal > }" (see, e.g., ValueBoxGen24.java) are what expected; please > correct me if I'm wrong. > > But something should be done; otherwise "" is interpreted as > an unknown HTML tag causing the errors. > > Thanks, > Alexander > > On 30.04.2015 14:31, alexander stepanov wrote: >> Hello, >> >> Could you please review the following fix >> http://cr.openjdk.java.net/~avstepan/8079075/webrev.00/ >> for >> https://bugs.openjdk.java.net/browse/JDK-8079075 >> >> Just some HTML markup fix for CORBA. >> >> Thanks, >> Alexander > From Alan.Bateman at oracle.com Thu Apr 30 13:51:14 2015 From: Alan.Bateman at oracle.com (Alan Bateman) Date: Thu, 30 Apr 2015 14:51:14 +0100 Subject: RFR [9] 8079075: some docs cleanup for CORBA - part 1 In-Reply-To: <5542327E.6060403@Oracle.com> References: <5542129F.2060704@oracle.com> <5542187B.90003@oracle.com> <5542327E.6060403@Oracle.com> Message-ID: <55423352.5080003@oracle.com> On 30/04/2015 14:47, Roger Riggs wrote: > Hi Alexander, > > Thanks for working through all these changes. > > 0) Is there an upstream version of any of this code? Making even > cosmetic changes > would make future versions harder to merge. > No. This was the case a long time ago but for many releases then the master is in the JDK corba repo. -Alan. From daniel.fuchs at oracle.com Thu Apr 30 14:42:01 2015 From: daniel.fuchs at oracle.com (Daniel Fuchs) Date: Thu, 30 Apr 2015 16:42:01 +0200 Subject: RFR: 8077846: improve locking strategy for readConfiguration(), reset(), and initializeGlobalHandlers() In-Reply-To: <553FAB5B.3060605@gmail.com> References: <553A7835.80209@oracle.com> <553D8F0B.4070102@oracle.com> <553DE503.2060608@oracle.com> <553E29C7.8030800@oracle.com> <553E9685.1030809@oracle.com> <553F3DC4.4010104@gmail.com> <553F4136.5010500@oracle.com> <553F940C.4050105@gmail.com> <553F9FC7.4020806@oracle.com> <553FAB5B.3060605@gmail.com> Message-ID: <55423F39.6060304@oracle.com> On 28/04/15 17:46, Peter Levart wrote: > > > On 04/28/2015 04:57 PM, Daniel Fuchs wrote: >>> Here's my attempt at simplifying this: >>> >>> http://cr.openjdk.java.net/~plevart/misc/LogManager.synchronization/webrev.01/ >>> >> >> LogManager can be subclassed, and subclasses may override reset() for >> different purposes. >> So I'm afraid the Cleaner thread still needs to call te public >> reset() method. The same unfortunately applies to >> readConfiguration(). >> >> best regards, >> >> -- daniel > > Um, yes of course. This can be fixed: > > http://cr.openjdk.java.net/~plevart/misc/LogManager.synchronization/webrev.02/ Hi Peter, Sorry for the late reply. My gut feeling is that I dislike multi-state ints. But I guess that's a matter of taste - so I could probably overcome it ;-) What makes me less happy is that I had managed to remove the explicit synchronized() { } block in the Cleaner thread - and I now see it's back. Could we maybe keep the imminentDeath boolean and remove the explicit locking in the Cleaner thread? I mean... imminentDeath should be checked from within the lock - before doing anything. But it does not need to be set from within a locked section. best regards, -- daniel > > > Regards, Peter > From alexander.v.stepanov at oracle.com Thu Apr 30 16:35:18 2015 From: alexander.v.stepanov at oracle.com (alexander stepanov) Date: Thu, 30 Apr 2015 19:35:18 +0300 Subject: RFR [9] 8079075: some docs cleanup for CORBA - part 1 In-Reply-To: <5542327E.6060403@Oracle.com> References: <5542129F.2060704@oracle.com> <5542187B.90003@oracle.com> <5542327E.6060403@Oracle.com> Message-ID: <554259C6.9090303@oracle.com> Hello Roger, Thank you for the notes; please see the updated webrev: http://cr.openjdk.java.net/~avstepan/8079075/webrev.01/ Regards, Alexander On 30.04.2015 16:47, Roger Riggs wrote: > Hi Alexander, > > Thanks for working through all these changes. > > 0) Is there an upstream version of any of this code? Making even > cosmetic changes > would make future versions harder to merge. > > 1) For files that we don't typically generate javadoc for, it is > simpler to avoid adding unnecessary markup. > For example: > > old/src/java.corba/share/classes/com/sun/corba/se/impl/corba/AnyImpl.java:222+ > > + * @return the {@code TypeCode} for the element in the Any > > There is not much value in the addition of {@code }. > > For these kind of files, the javadoc should be well formed and any > warnings/errors should be fixed. > > 2) a number of changes do not maintain the indentation, for example, > - * @result the InputStream to marshal value of Any out of. > + * @return the {@code InputStream} to marshal value of Any out of. > > Unless all of the indentation is going to be fixed in a file; it is > better to remain consistent with the per file style. > > 3) Removing degenerate @author tags is great. But adding an extra > blank line is not desirable. > For example, > old/src/java.corba/share/classes/com/sun/corba/se/impl/ior/GenericTaggedProfile.java:39 > > -/** > - * @author > - */ > + > > 4) For snippets of code, use {@code} instead of a plain or {@literal ...} > These files don't that pattern extensively and its not important to > fix it everywhere since it is in the impl code. > But for example, it would make sense here: > old/src/java.corba/share/classes/com/sun/corba/se/impl/ior/ObjectAdapterIdNumber.java:31+ > > > - * internally as arrays of the form { "OldRootPOA", "" }, > + * internally as arrays of the form { "OldRootPOA", "{@literal > }" }, > > Might be better as: > + * internally as arrays of the form {@code { "OldRootPOA", "" > }}, > > 5) The continuation of @param should be indented. > > src/java.corba/share/classes/com/sun/corba/se/impl/naming/pcosnaming/NamingContextImpl.java > > @@ -1204,14 +1202,13 @@ > * This operation creates a URL based "iiopname://" format name > * from the Stringified Name of the object. > * @param addr internet based address of the host machine where > - * Name Service is running

    > - * @param sn Stringified Name of the object

    > *+ * Name Service is running* > + * @param sn Stringified Name of the object > > > 6) correct the punctuation since the line is being modified. > src/java.corba/share/classes/com/sun/corba/se/pept/transport/Acceptor.java > > > - * @return trueAcceptor has been > + * @return true. if the Acceptor has been > > Would read better as: > + * @return true if the Acceptor has been > > > 7) I don't recognize the strings of the format dNNNNN but they seem > to be referring > to past bug reports and the authors who fixed them. I doubt they > have any value in > the code anymore. It would probably be fine to just drop the extra > '<>' symbols. > And around the author initials. --> klr > > Regards, Roger > > > > On 4/30/2015 7:56 AM, alexander stepanov wrote: >> P.S. Sorry, not sure if changes like "" -> "{@literal >> }" (see, e.g., ValueBoxGen24.java) are what expected; please >> correct me if I'm wrong. >> >> But something should be done; otherwise "" is interpreted as >> an unknown HTML tag causing the errors. >> >> Thanks, >> Alexander >> >> On 30.04.2015 14:31, alexander stepanov wrote: >>> Hello, >>> >>> Could you please review the following fix >>> http://cr.openjdk.java.net/~avstepan/8079075/webrev.00/ >>> for >>> https://bugs.openjdk.java.net/browse/JDK-8079075 >>> >>> Just some HTML markup fix for CORBA. >>> >>> Thanks, >>> Alexander >> > From alexander.v.stepanov at oracle.com Thu Apr 30 17:21:41 2015 From: alexander.v.stepanov at oracle.com (alexander stepanov) Date: Thu, 30 Apr 2015 20:21:41 +0300 Subject: RFR [9] 8040147: tidy warnings cleanup for javax.transaction Message-ID: <554264A5.1010700@oracle.com> Hello, Could you please review the fix http://cr.openjdk.java.net/~avstepan/8040147/webrev.01/ for https://bugs.openjdk.java.net/browse/JDK-8040147 Just a very minor fix of docs markup. Thanks, Alexander From Roger.Riggs at Oracle.com Thu Apr 30 17:40:57 2015 From: Roger.Riggs at Oracle.com (Roger Riggs) Date: Thu, 30 Apr 2015 13:40:57 -0400 Subject: RFR [9] 8079075: some docs cleanup for CORBA - part 1 In-Reply-To: <554259C6.9090303@oracle.com> References: <5542129F.2060704@oracle.com> <5542187B.90003@oracle.com> <5542327E.6060403@Oracle.com> <554259C6.9090303@oracle.com> Message-ID: <55426929.4090309@Oracle.com> Hi Alexander, The improvements look good to me. Thank you, Roger On 4/30/2015 12:35 PM, alexander stepanov wrote: > Hello Roger, > > Thank you for the notes; please see the updated webrev: > http://cr.openjdk.java.net/~avstepan/8079075/webrev.01/ > > Regards, > Alexander > > On 30.04.2015 16:47, Roger Riggs wrote: >> Hi Alexander, >> >> Thanks for working through all these changes. >> >> 0) Is there an upstream version of any of this code? Making even >> cosmetic changes >> would make future versions harder to merge. >> >> 1) For files that we don't typically generate javadoc for, it is >> simpler to avoid adding unnecessary markup. >> For example: >> >> old/src/java.corba/share/classes/com/sun/corba/se/impl/corba/AnyImpl.java:222+ >> >> + * @return the {@code TypeCode} for the element in the Any >> >> There is not much value in the addition of {@code }. >> >> For these kind of files, the javadoc should be well formed and any >> warnings/errors should be fixed. >> >> 2) a number of changes do not maintain the indentation, for example, >> - * @result the InputStream to marshal value of Any out of. >> + * @return the {@code InputStream} to marshal value of Any out of. >> >> Unless all of the indentation is going to be fixed in a file; it is >> better to remain consistent with the per file style. >> >> 3) Removing degenerate @author tags is great. But adding an extra >> blank line is not desirable. >> For example, >> old/src/java.corba/share/classes/com/sun/corba/se/impl/ior/GenericTaggedProfile.java:39 >> >> -/** >> - * @author >> - */ >> + >> >> 4) For snippets of code, use {@code} instead of a plain or {@literal >> ...} >> These files don't that pattern extensively and its not important to >> fix it everywhere since it is in the impl code. >> But for example, it would make sense here: >> old/src/java.corba/share/classes/com/sun/corba/se/impl/ior/ObjectAdapterIdNumber.java:31+ >> >> >> - * internally as arrays of the form { "OldRootPOA", "" }, >> + * internally as arrays of the form { "OldRootPOA", "{@literal >> }" }, >> >> Might be better as: >> + * internally as arrays of the form {@code { "OldRootPOA", >> "" }}, >> >> 5) The continuation of @param should be indented. >> >> src/java.corba/share/classes/com/sun/corba/se/impl/naming/pcosnaming/NamingContextImpl.java >> >> @@ -1204,14 +1202,13 @@ >> * This operation creates a URL based "iiopname://" format name >> * from the Stringified Name of the object. >> * @param addr internet based address of the host machine where >> - * Name Service is running

    >> - * @param sn Stringified Name of the object

    >> *+ * Name Service is running* >> + * @param sn Stringified Name of the object >> >> >> 6) correct the punctuation since the line is being modified. >> src/java.corba/share/classes/com/sun/corba/se/pept/transport/Acceptor.java >> >> >> - * @return trueAcceptor has been >> + * @return true. if the Acceptor has been >> >> Would read better as: >> + * @return true if the Acceptor has been >> >> >> 7) I don't recognize the strings of the format dNNNNN but they seem >> to be referring >> to past bug reports and the authors who fixed them. I doubt they >> have any value in >> the code anymore. It would probably be fine to just drop the >> extra '<>' symbols. >> And around the author initials. --> klr >> >> Regards, Roger >> >> >> >> On 4/30/2015 7:56 AM, alexander stepanov wrote: >>> P.S. Sorry, not sure if changes like "" -> "{@literal >>> }" (see, e.g., ValueBoxGen24.java) are what expected; please >>> correct me if I'm wrong. >>> >>> But something should be done; otherwise "" is interpreted as >>> an unknown HTML tag causing the errors. >>> >>> Thanks, >>> Alexander >>> >>> On 30.04.2015 14:31, alexander stepanov wrote: >>>> Hello, >>>> >>>> Could you please review the following fix >>>> http://cr.openjdk.java.net/~avstepan/8079075/webrev.00/ >>>> for >>>> https://bugs.openjdk.java.net/browse/JDK-8079075 >>>> >>>> Just some HTML markup fix for CORBA. >>>> >>>> Thanks, >>>> Alexander >>> >> > From alexander.v.stepanov at oracle.com Thu Apr 30 19:41:01 2015 From: alexander.v.stepanov at oracle.com (Alexander Stepanov) Date: Thu, 30 Apr 2015 12:41:01 -0700 (PDT) Subject: RFR [9] 8079075: some docs cleanup for CORBA - part 1 Message-ID: <515b5dec-80ea-4840-9fd7-3841d0d9e10d@default> Thanks! ----- ???????? ????????? ----- ??: Roger.Riggs at Oracle.com ????: alexander.v.stepanov at oracle.com ?????: core-libs-dev at openjdk.java.net ????????????: ???????, 30 ?????? 2015 ? 21:41:05 GMT +03:00 ??????, ?????-?????????, ????????? ????: Re: RFR [9] 8079075: some docs cleanup for CORBA - part 1 Hi Alexander, The improvements look good to me. Thank you, Roger On 4/30/2015 12:35 PM, alexander stepanov wrote: > Hello Roger, > > Thank you for the notes; please see the updated webrev: > http://cr.openjdk.java.net/~avstepan/8079075/webrev.01/ > > Regards, > Alexander > > On 30.04.2015 16:47, Roger Riggs wrote: >> Hi Alexander, >> >> Thanks for working through all these changes. >> >> 0) Is there an upstream version of any of this code? Making even >> cosmetic changes >> would make future versions harder to merge. >> >> 1) For files that we don't typically generate javadoc for, it is >> simpler to avoid adding unnecessary markup. >> For example: >> >> old/src/java.corba/share/classes/com/sun/corba/se/impl/corba/AnyImpl.java:222+ >> >> + * @return the {@code TypeCode} for the element in the Any >> >> There is not much value in the addition of {@code }. >> >> For these kind of files, the javadoc should be well formed and any >> warnings/errors should be fixed. >> >> 2) a number of changes do not maintain the indentation, for example, >> - * @result the InputStream to marshal value of Any out of. >> + * @return the {@code InputStream} to marshal value of Any out of. >> >> Unless all of the indentation is going to be fixed in a file; it is >> better to remain consistent with the per file style. >> >> 3) Removing degenerate @author tags is great. But adding an extra >> blank line is not desirable. >> For example, >> old/src/java.corba/share/classes/com/sun/corba/se/impl/ior/GenericTaggedProfile.java:39 >> >> -/** >> - * @author >> - */ >> + >> >> 4) For snippets of code, use {@code} instead of a plain or {@literal >> ...} >> These files don't that pattern extensively and its not important to >> fix it everywhere since it is in the impl code. >> But for example, it would make sense here: >> old/src/java.corba/share/classes/com/sun/corba/se/impl/ior/ObjectAdapterIdNumber.java:31+ >> >> >> - * internally as arrays of the form { "OldRootPOA", "" }, >> + * internally as arrays of the form { "OldRootPOA", "{@literal >> }" }, >> >> Might be better as: >> + * internally as arrays of the form {@code { "OldRootPOA", >> "" }}, >> >> 5) The continuation of @param should be indented. >> >> src/java.corba/share/classes/com/sun/corba/se/impl/naming/pcosnaming/NamingContextImpl.java >> >> @@ -1204,14 +1202,13 @@ >> * This operation creates a URL based "iiopname://" format name >> * from the Stringified Name of the object. >> * @param addr internet based address of the host machine where >> - * Name Service is running

    >> - * @param sn Stringified Name of the object

    >> *+ * Name Service is running* >> + * @param sn Stringified Name of the object >> >> >> 6) correct the punctuation since the line is being modified. >> src/java.corba/share/classes/com/sun/corba/se/pept/transport/Acceptor.java >> >> >> - * @return trueAcceptor has been >> + * @return true. if the Acceptor has been >> >> Would read better as: >> + * @return true if the Acceptor has been >> >> >> 7) I don't recognize the strings of the format dNNNNN but they seem >> to be referring >> to past bug reports and the authors who fixed them. I doubt they >> have any value in >> the code anymore. It would probably be fine to just drop the >> extra '<>' symbols. >> And around the author initials. --> klr >> >> Regards, Roger >> >> >> >> On 4/30/2015 7:56 AM, alexander stepanov wrote: >>> P.S. Sorry, not sure if changes like "" -> "{@literal >>> }" (see, e.g., ValueBoxGen24.java) are what expected; please >>> correct me if I'm wrong. >>> >>> But something should be done; otherwise "" is interpreted as >>> an unknown HTML tag causing the errors. >>> >>> Thanks, >>> Alexander >>> >>> On 30.04.2015 14:31, alexander stepanov wrote: >>>> Hello, >>>> >>>> Could you please review the following fix >>>> http://cr.openjdk.java.net/~avstepan/8079075/webrev.00/ >>>> for >>>> https://bugs.openjdk.java.net/browse/JDK-8079075 >>>> >>>> Just some HTML markup fix for CORBA. >>>> >>>> Thanks, >>>> Alexander >>> >> > From mandy.chung at oracle.com Thu Apr 30 22:31:25 2015 From: mandy.chung at oracle.com (Mandy Chung) Date: Thu, 30 Apr 2015 15:31:25 -0700 Subject: RFR: 8077846: improve locking strategy for readConfiguration(), reset(), and initializeGlobalHandlers() In-Reply-To: <55423F39.6060304@oracle.com> References: <553A7835.80209@oracle.com> <553D8F0B.4070102@oracle.com> <553DE503.2060608@oracle.com> <553E29C7.8030800@oracle.com> <553E9685.1030809@oracle.com> <553F3DC4.4010104@gmail.com> <553F4136.5010500@oracle.com> <553F940C.4050105@gmail.com> <553F9FC7.4020806@oracle.com> <553FAB5B.3060605@gmail.com> <55423F39.6060304@oracle.com> Message-ID: <5542AD3D.5070004@oracle.com> On 04/30/2015 07:42 AM, Daniel Fuchs wrote: > > http://cr.openjdk.java.net/~dfuchs/webrev_8077846/webrev.00/ >> http://cr.openjdk.java.net/~plevart/misc/LogManager.synchronization/webrev.02/ >> I reviewed both of the above webrevs. TestConfigurationLock.java Copyright year should be 2015 TestConfigurationLock.properties It would be good to delete all commented lines except the lines relevant to the setting to make it obvious what the configuration is. LogManager.java I actually like having one state variable to describe the global handler (re-)initialization that to me is a simplification. I couldn't immediately match the constant names in following the code right away. I read these states as: STATE_UNINITIALIZED - request reinitialization or invalidate the RootLogger (called from readConfiguration and after reset) STATE_INITIALIZED - reinitialization complete or error during readConfiguration STATE_INITIALIZING - global handlers are being initialized Perhaps renaming the constant names to GLOBAL_HANDLERS_INVALIDATED etc might help. I'm less sure about shutdown and the global handlers can skip reinitialization during shutdown and keeping it as separate variable makes it more explicit. It may eliminate the configurationLock.lock() in the Cleaner.run() method. A minor point - I wonder if a private reset method taking a boolean argument to indicate if the state change to STATE_INITIALIZED is required would make it little easier to follow. Mandy