From weijun.wang at oracle.com Fri Jul 1 03:05:43 2016 From: weijun.wang at oracle.com (Wang Weijun) Date: Fri, 1 Jul 2016 11:05:43 +0800 Subject: os.name will be "macOS"? (was Re: RFR 9 : 8160370 : System.getProperty("os.version") returns "Unknown" on Mac) In-Reply-To: References: <735e1337-7e48-912a-7698-688bc5206cd3@oracle.com> <4bfcc3a7-59a2-fb87-f06f-e3da5c433b48@oracle.com> Message-ID: <80416C7F-120C-4200-AB61-49DEDA63CCA5@oracle.com> I have an off-topic question: Will os.name be macOS for 10.12? I have several places checking "if (!osname.contains("OS X"))", is there a helper method I can check for this in the future no matter if it's running on pre- or post-10.12? Thanks Max > On Jul 1, 2016, at 2:23 AM, Brent Christian wrote: > > On 6/30/16 9:53 AM, Brent Christian wrote: >> >> When the minimum Mac build platform is SDK 10.10, we'll be able to call >> operatingSystemVersion directly without using msgSend. We can also >> consider removing this then. > > FYI: > https://bugs.openjdk.java.net/browse/JDK-8160676 > > -Brent From mandy.chung at oracle.com Fri Jul 1 05:10:23 2016 From: mandy.chung at oracle.com (Mandy Chung) Date: Thu, 30 Jun 2016 22:10:23 -0700 Subject: Review Request: JDK-8160698 java --dry-run should not cause main class be initialized Message-ID: <4D0CC248-E338-4DED-9706-2BCF669DD6A0@oracle.com> Kumar, I move the call to CreateApplicationArgs before PostJVMInit and dryRun stops before PostJVMInit which shows the splash screen. Webrev: http://cr.openjdk.java.net/~mchung/jdk9/webrevs/8160698/webrev.00/index.html This also cleans up the LauncherHelper to use Class::forName instead of loadClass. Mandy From shilpi.rastogi at oracle.com Fri Jul 1 08:15:02 2016 From: shilpi.rastogi at oracle.com (shilpi.rastogi at oracle.com) Date: Fri, 1 Jul 2016 13:45:02 +0530 Subject: RFR[9]: 8158510: Add test cases to validate Annotation Message-ID: <57762686.4030508@oracle.com> Hi All, Please review https://bugs.openjdk.java.net/browse/JDK-8158510 *Problem:* How to validate annotation, as javac does not allow us to write wrong annotation so how should we test valid annotation at runtime? http://cr.openjdk.java.net/~srastogi/8158510/webrev.00/ *Solution:* To test this i used ASM tool and modified the classfile with wrong annotation (not allowed at javac level) and wrote test cases. Thanks, Shilpi From paul.sandoz at oracle.com Fri Jul 1 08:36:06 2016 From: paul.sandoz at oracle.com (Paul Sandoz) Date: Fri, 1 Jul 2016 10:36:06 +0200 Subject: RFR: jsr166 jdk9 integration wave 7 In-Reply-To: <5775A2E0.6090802@cs.oswego.edu> References: <1b9bd87d-5835-fb00-9db0-0de627f1952d@gmail.com> <76e3eb70-adc4-8d5d-74ee-d664e314b266@gmail.com> <577463C0.2070806@cs.oswego.edu> <7303825d-5a55-e955-7535-b427fb790d2a@gmail.com> <5775A2E0.6090802@cs.oswego.edu> Message-ID: <6F99AEDA-4A12-41DB-AC31-744693004128@oracle.com> > On 1 Jul 2016, at 00:53, Doug Lea
wrote: > > On 06/30/2016 10:08 AM, Paul Sandoz wrote: >> Hi Peter, >> >> Thanks, that?s interesting. I am uncertain if our 166 fellows will be >> reluctant or not to pull in a dependency on jdk.internal.misc.SharedSecrets. > > > Background: we are reluctant to rely on anything that makes sources impossible > to use in (usually, upcoming versions of) Android. Which probably > doesn't directly apply here. > > But my main concern in this case is that we need better assurance > that there are no possible start-up circularities, since we've already > had some near-miss experiences with ThreadLocalRandom. Is there a > solid argument? > I suggest we spin this off from the main issue and investigate afterwards, i have logged an issue: https://bugs.openjdk.java.net/browse/JDK-8160710 Paul. From bhanu.prakash.gopularam at oracle.com Fri Jul 1 09:01:38 2016 From: bhanu.prakash.gopularam at oracle.com (Bhanu Gopularam) Date: Fri, 1 Jul 2016 02:01:38 -0700 (PDT) Subject: RFR 8159616: java.time.Instant falls through switch statement Message-ID: Hi all, May I request you to review below simple fix for following issue: Bug id: https://bugs.openjdk.java.net/browse/JDK-8159616 Solution: Removed the unneeded case statement INSTANT_SECONDS from get(TemporalField field) of java.time.Instant class Webrev: http://cr.openjdk.java.net/~bgopularam/8159616/webrev.00/ Thanks, Bhanu From paul.sandoz at oracle.com Fri Jul 1 09:42:33 2016 From: paul.sandoz at oracle.com (Paul Sandoz) Date: Fri, 1 Jul 2016 11:42:33 +0200 Subject: RFR[9]: 8158510: Add test cases to validate Annotation In-Reply-To: <57762686.4030508@oracle.com> References: <57762686.4030508@oracle.com> Message-ID: <8A1E8CAE-9019-40AD-AA79-2285172631AB@oracle.com> Hi Shilpi, There is more going on here than just the test since you have modified the annotation processing to throw an ISE for an annotation type that contains one or more methods that do not define elements. That behaviour might be too restrictive. This is a grey area and implementation specific but i would tend to be cautious and avoid changing the current behaviour. Note that the original issue was due to javac adding a synthetic de-sugared method for a lambda. We don?t know if other byte code generators might do something different. So my recommendation is to limit the testing to the current set of possible failures. Paul. > On 1 Jul 2016, at 10:15, shilpi.rastogi at oracle.com wrote: > > Hi All, > > Please review https://bugs.openjdk.java.net/browse/JDK-8158510 > Problem: How to validate annotation, as javac does not allow us to write wrong annotation so how should we test valid annotation at runtime? > > http://cr.openjdk.java.net/~srastogi/8158510/webrev.00/ > Solution: To test this i used ASM tool and modified the classfile with wrong annotation (not allowed at javac level) and wrote test cases. > > Thanks, > Shilpi From bhanu.prakash.gopularam at oracle.com Fri Jul 1 10:15:33 2016 From: bhanu.prakash.gopularam at oracle.com (Bhanu Gopularam) Date: Fri, 1 Jul 2016 03:15:33 -0700 (PDT) Subject: RFR 8159616: java.time.Instant falls through switch statement In-Reply-To: References: Message-ID: <5bca56ff-2929-472b-a955-83342ef82409@default> Hi all, May I request you to review below simple fix for following issue: Bug id: https://bugs.openjdk.java.net/browse/JDK-8159616 Solution: Removed the unneeded case statement INSTANT_SECONDS from get(TemporalField field) of java.time.Instant class Webrev: http://cr.openjdk.java.net/~bgopularam/8159616/webrev.00/ Thanks, Bhanu From scolebourne at joda.org Fri Jul 1 10:39:11 2016 From: scolebourne at joda.org (Stephen Colebourne) Date: Fri, 1 Jul 2016 11:39:11 +0100 Subject: RFR 8159616: java.time.Instant falls through switch statement In-Reply-To: References: Message-ID: Fine by me Stephen On 1 July 2016 at 10:01, Bhanu Gopularam wrote: > Hi all, > > May I request you to review below simple fix for following issue: > > Bug id: https://bugs.openjdk.java.net/browse/JDK-8159616 > > Solution: Removed the unneeded case statement INSTANT_SECONDS from get(TemporalField field) of java.time.Instant class > > Webrev: http://cr.openjdk.java.net/~bgopularam/8159616/webrev.00/ > > Thanks, > Bhanu From michael.haupt at oracle.com Fri Jul 1 11:33:43 2016 From: michael.haupt at oracle.com (Michael Haupt) Date: Fri, 1 Jul 2016 13:33:43 +0200 Subject: RFR(L): 8143211: provide bytecode intrinsics for loop and try/finally executors In-Reply-To: <72b5055a-7a12-b2c6-5576-424d7d5df69a@oracle.com> References: <5FEECAA3-6A01-44A1-96D1-69D3336B7832@oracle.com> <72b5055a-7a12-b2c6-5576-424d7d5df69a@oracle.com> Message-ID: <498DA19D-E6FD-4F40-9F85-E6A137DC9050@oracle.com> Hi Vladimir, thank you once more - your comments led to more improvements. The results are at http://cr.openjdk.java.net/~mhaupt/8143211/webrev.02/, and some details are inlined below. > Am 29.06.2016 um 17:57 schrieb Vladimir Ivanov : > I'd prefer to see loopStateTypes attached to the intrinsic itself. Right now, it's unrelated and you look it up by offset. You can pass it as an additional parameter into MHI.loop instead and access it directly from the Name marked as the loop intrinsic. > > LFE.noteLoopLocalTypesForm() looks fragile. It assumes the LF being edited contains only loop intrinsic and adds type info as the first non-argument Name. What if you explicitly pass loop intrinsic position into it, check that the Name represents a loop, and substitute loop types argument. > > Such representation will support multiple loops inside a single LF and allow per-loop editing. The loop invoker (MHImpl.loop()) now accepts an initial BasicType[] that captures the loop clause types. The loop LF for a method type is initialised to pass null in this place. For each combination of loop clause types, the LambdaFormEditor will now replace this null with the appropriate BasicType[]. This argument is altogether ignored in LambdaForm interpretation mode, but read and used in bytecode generation in InvokerBytecodeGenerator.emitLoop(). Thereby, the loop clause types, which are crucial for boxing-free bytecode generation, are now associated with (rather: stored in) the LambdaForm representing a particular loop state distribution, but they do not consume extra space in the names array comprising the LambdaForm. > Regarding loopStarts, loopStateStarts, and currentLoop fields in IBG. > > Since IBG iterates over the LF sequentially, you should be able to get rid of arrays and convert the position where loop state should be stored into a local variable in IBG.generateCustomizedCodeBytes(). > > The only problem is localsMapSize (which is eagerly allocated). > Current eager initialization logic looks over-complicated and I think it doesn't work as expected (mapLoopLocalState() overwrites locals which are used by Names following the loop). > > I'd prefer suggest to see it simplified. > > You can just do a single pass over the LF being compiled and sum up slots needed to represent loops state. After that, you can initialize them incrementally during compilation when you encounter a loop intrinsic. > > If you put loop state after locals used for other LF Names, you don't need to adjust local slot indexes for non-loop Names. InvokerBytecodeGenerator now adopts a solution where localsMap and localClasses are dynamically resized as loops are encountered in the LambdaForm. Thereby, no additional state about local slot allocation for loops needs to be maintained any more. > Another thought: what if loop state is so large it overflows 65k locals limit? I don't see any checks of clauses array size in MHs.loop(). This is filed as a bug: https://bugs.openjdk.java.net/browse/JDK-8160717. Best, Michael -- Dr. Michael Haupt | Principal Member of Technical Staff Phone: +49 331 200 7277 | Fax: +49 331 200 7561 Oracle Java Platform Group | LangTools Team | Nashorn Oracle Deutschland B.V. & Co. KG | Schiffbauergasse 14 | 14467 Potsdam, Germany ORACLE Deutschland B.V. & Co. KG | Hauptverwaltung: Riesstra?e 25, D-80992 M?nchen Registergericht: Amtsgericht M?nchen, HRA 95603 Komplement?rin: ORACLE Deutschland Verwaltung B.V. | Hertogswetering 163/167, 3543 AS Utrecht, Niederlande Handelsregister der Handelskammer Midden-Nederland, Nr. 30143697 Gesch?ftsf?hrer: Alexander van der Ven, Jan Schultheiss, Val Maher Oracle is committed to developing practices and products that help protect the environment From nadeesh.tv at oracle.com Fri Jul 1 11:38:36 2016 From: nadeesh.tv at oracle.com (nadeesh tv) Date: Fri, 01 Jul 2016 17:08:36 +0530 Subject: RFR:JDK-8160681:LocalDate.ofEpochDay input validation Message-ID: <5776563C.2050402@oracle.com> Hi all, Bug Id : https://bugs.openjdk.java.net/browse/JDK-8160681 Issue: Epoch day parameter to LocalDate.ofEpochDay() was not validating Webrev: http://cr.openjdk.java.net/~bgopularam/ntv/8160681/webrev.00/ Tests are already covered under *f**actory_ofEpochDay_aboveMax()* , *factory_ofEpochDay_belowMin()* . Error was obscured. It was throwing *DateTimeException *because of internally calculated YEAR was going out of range. Now it will throw exception due to expected issue 'epoch day is out of range'. -- Thanks and Regards, Nadeesh TV From shilpi.rastogi at oracle.com Fri Jul 1 11:41:31 2016 From: shilpi.rastogi at oracle.com (shilpi.rastogi at oracle.com) Date: Fri, 1 Jul 2016 17:11:31 +0530 Subject: RFR[9]: 8158510: Add test cases to validate Annotation In-Reply-To: <8A1E8CAE-9019-40AD-AA79-2285172631AB@oracle.com> References: <57762686.4030508@oracle.com> <8A1E8CAE-9019-40AD-AA79-2285172631AB@oracle.com> Message-ID: <577656EB.8000802@oracle.com> Thanks Paul !! Please see http://cr.openjdk.java.net/~srastogi/8158510/webrev.01/ Regards, Shilpi On 7/1/2016 3:12 PM, Paul Sandoz wrote: > Hi Shilpi, > > There is more going on here than just the test since you have modified > the annotation processing to throw an ISE for an annotation type that > contains one or more methods that do not define elements. That > behaviour might be too restrictive. > > This is a grey area and implementation specific but i would tend to be > cautious and avoid changing the current behaviour. Note that the > original issue was due to javac adding a synthetic de-sugared method > for a lambda. We don?t know if other byte code generators might do > something different. > > So my recommendation is to limit the testing to the current set of > possible failures. > > Paul. > >> On 1 Jul 2016, at 10:15, shilpi.rastogi at oracle.com >> wrote: >> >> Hi All, >> >> Please review https://bugs.openjdk.java.net/browse/JDK-8158510 >> *Problem:* How to validate annotation, as javac does not allow us to >> write wrong annotation so how should we test valid annotation at runtime? >> >> http://cr.openjdk.java.net/~srastogi/8158510/webrev.00/ >> *Solution:* To test this i used ASM tool and modified the classfile >> with wrong annotation (not allowed at javac level) and wrote test cases. >> >> Thanks, >> Shilpi > From vladimir.x.ivanov at oracle.com Fri Jul 1 12:00:54 2016 From: vladimir.x.ivanov at oracle.com (Vladimir Ivanov) Date: Fri, 1 Jul 2016 15:00:54 +0300 Subject: RFR(L): 8143211: provide bytecode intrinsics for loop and try/finally executors In-Reply-To: <498DA19D-E6FD-4F40-9F85-E6A137DC9050@oracle.com> References: <5FEECAA3-6A01-44A1-96D1-69D3336B7832@oracle.com> <72b5055a-7a12-b2c6-5576-424d7d5df69a@oracle.com> <498DA19D-E6FD-4F40-9F85-E6A137DC9050@oracle.com> Message-ID: src/java.base/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java: + * Emit bytecode for the loop idiom. ... + * loop=Lambda(a0:L,a1:L,a2:L,a3:L,a4:L,a5:L,a6:L,a7:L)=>{ + * t8:L=MethodHandles.constant(String.class, ""); + * t9:L=MethodHandle.invokeBasic(a5:L,a7:L); // box the arguments into an Object[] + * t10:L=MethodHandleImpl.loop(a1:L,a2:L,a3:L,a4:L,t9:L); // call the loop executor + * t11:L=MethodHandle.invokeBasic(a6:L,t10:L);t11:L} // unbox the result; return the result Stale LF shape in the comment. === - if (assertStaticType(cls, n)) - return; // this cast was already performed + assertStaticType(cls, n); This change completely defeats localClasses purpose. I'd like to understand more why the verifier complains about missing checkcast. Otherwise, looks really good! Thanks for your patience when addressing my comments :-) Best regards, Vladimir Ivanov On 7/1/16 2:33 PM, Michael Haupt wrote: > Hi Vladimir, > > thank you once more - your comments led to more improvements. The results are at http://cr.openjdk.java.net/~mhaupt/8143211/webrev.02/, and some details are inlined below. > >> Am 29.06.2016 um 17:57 schrieb Vladimir Ivanov : >> I'd prefer to see loopStateTypes attached to the intrinsic itself. Right now, it's unrelated and you look it up by offset. You can pass it as an additional parameter into MHI.loop instead and access it directly from the Name marked as the loop intrinsic. >> >> LFE.noteLoopLocalTypesForm() looks fragile. It assumes the LF being edited contains only loop intrinsic and adds type info as the first non-argument Name. What if you explicitly pass loop intrinsic position into it, check that the Name represents a loop, and substitute loop types argument. >> >> Such representation will support multiple loops inside a single LF and allow per-loop editing. > > The loop invoker (MHImpl.loop()) now accepts an initial BasicType[] that captures the loop clause types. The loop LF for a method type is initialised to pass null in this place. For each combination of loop clause types, the LambdaFormEditor will now replace this null with the appropriate BasicType[]. This argument is altogether ignored in LambdaForm interpretation mode, but read and used in bytecode generation in InvokerBytecodeGenerator.emitLoop(). > > Thereby, the loop clause types, which are crucial for boxing-free bytecode generation, are now associated with (rather: stored in) the LambdaForm representing a particular loop state distribution, but they do not consume extra space in the names array comprising the LambdaForm. > >> Regarding loopStarts, loopStateStarts, and currentLoop fields in IBG. >> >> Since IBG iterates over the LF sequentially, you should be able to get rid of arrays and convert the position where loop state should be stored into a local variable in IBG.generateCustomizedCodeBytes(). >> >> The only problem is localsMapSize (which is eagerly allocated). >> Current eager initialization logic looks over-complicated and I think it doesn't work as expected (mapLoopLocalState() overwrites locals which are used by Names following the loop). >> >> I'd prefer suggest to see it simplified. >> >> You can just do a single pass over the LF being compiled and sum up slots needed to represent loops state. After that, you can initialize them incrementally during compilation when you encounter a loop intrinsic. >> >> If you put loop state after locals used for other LF Names, you don't need to adjust local slot indexes for non-loop Names. > > InvokerBytecodeGenerator now adopts a solution where localsMap and localClasses are dynamically resized as loops are encountered in the LambdaForm. Thereby, no additional state about local slot allocation for loops needs to be maintained any more. > >> Another thought: what if loop state is so large it overflows 65k locals limit? I don't see any checks of clauses array size in MHs.loop(). > > This is filed as a bug: https://bugs.openjdk.java.net/browse/JDK-8160717. > > Best, > > Michael > From scolebourne at joda.org Fri Jul 1 12:23:02 2016 From: scolebourne at joda.org (Stephen Colebourne) Date: Fri, 1 Jul 2016 13:23:02 +0100 Subject: RFR:JDK-8160681:LocalDate.ofEpochDay input validation In-Reply-To: <5776563C.2050402@oracle.com> References: <5776563C.2050402@oracle.com> Message-ID: Fine by me, thanks Stephen On 1 July 2016 at 12:38, nadeesh tv wrote: > Hi all, > > Bug Id : https://bugs.openjdk.java.net/browse/JDK-8160681 > > Issue: Epoch day parameter to LocalDate.ofEpochDay() was not validating > > Webrev: http://cr.openjdk.java.net/~bgopularam/ntv/8160681/webrev.00/ > > Tests are already covered under factory_ofEpochDay_aboveMax() , > factory_ofEpochDay_belowMin() . > > Error was obscured. It was throwing DateTimeException because of > internally calculated YEAR was going out of range. Now it will throw > exception due to expected issue 'epoch day is out of range'. > > -- > Thanks and Regards, > Nadeesh TV > From paul.sandoz at oracle.com Fri Jul 1 12:55:08 2016 From: paul.sandoz at oracle.com (Paul Sandoz) Date: Fri, 1 Jul 2016 14:55:08 +0200 Subject: RFR: jsr166 jdk9 integration wave 7 In-Reply-To: References: <1b9bd87d-5835-fb00-9db0-0de627f1952d@gmail.com> <76e3eb70-adc4-8d5d-74ee-d664e314b266@gmail.com> <577463C0.2070806@cs.oswego.edu> Message-ID: <0FB1239F-336B-475C-814A-86743FB198AF@oracle.com> > On 30 Jun 2016, at 13:20, Martin Buchholz wrote: > > Webrev regenerated with updates. > Lots of rework for the atomic VarHandle specs. > http://cr.openjdk.java.net/~martin/webrevs/openjdk9/jsr166-jdk9-integration/ > Look good, focusing on the atomics section. I noted that some text has been removed from the package-info.java that should but is not currently on VarHandle. After things have settled down a bit i will do a pass over the non-normative bits. Paul. > In the unlikely case you want the old webrev, it's at > http://cr.openjdk.java.net/~martin/webrevs/openjdk9/jsr166-jdk9-integration.2016-06-29/ From Roger.Riggs at Oracle.com Fri Jul 1 13:38:22 2016 From: Roger.Riggs at Oracle.com (Roger Riggs) Date: Fri, 1 Jul 2016 09:38:22 -0400 Subject: RFR:JDK-8160681:LocalDate.ofEpochDay input validation In-Reply-To: References: <5776563C.2050402@oracle.com> Message-ID: <15fe1e5c-41a8-f0e1-29bb-9f9a40d82a58@Oracle.com> Hi Stephen, I'm a bit puzzled by the values recommended for the EpochDay Range. The code should be commented with the computation relative to the range of year MIN/MAX so there is a more complete understanding. I would expect the MIN to be the negative of the MAX or pretty close. Are the new values defined to avoid overflow in some computation? Changing the valid range of values has a (nearly insignificant) compatibility risk. Thanks, Roger On 7/1/2016 8:23 AM, Stephen Colebourne wrote: > Fine by me, thanks > Stephen > > On 1 July 2016 at 12:38, nadeesh tv wrote: >> Hi all, >> >> Bug Id : https://bugs.openjdk.java.net/browse/JDK-8160681 >> >> Issue: Epoch day parameter to LocalDate.ofEpochDay() was not validating >> >> Webrev: http://cr.openjdk.java.net/~bgopularam/ntv/8160681/webrev.00/ >> >> Tests are already covered under factory_ofEpochDay_aboveMax() , >> factory_ofEpochDay_belowMin() . >> >> Error was obscured. It was throwing DateTimeException because of >> internally calculated YEAR was going out of range. Now it will throw >> exception due to expected issue 'epoch day is out of range'. >> >> -- >> Thanks and Regards, >> Nadeesh TV >> From Roger.Riggs at Oracle.com Fri Jul 1 13:41:59 2016 From: Roger.Riggs at Oracle.com (Roger Riggs) Date: Fri, 1 Jul 2016 09:41:59 -0400 Subject: RFR:JDK-8160681:LocalDate.ofEpochDay input validation In-Reply-To: <15fe1e5c-41a8-f0e1-29bb-9f9a40d82a58@Oracle.com> References: <5776563C.2050402@oracle.com> <15fe1e5c-41a8-f0e1-29bb-9f9a40d82a58@Oracle.com> Message-ID: Never mind, I just saw the comment in the bug. "Just for a reference, EpochDay range = (LocalDate.MIN.toEpochDay() , LocalDate.MAX.toEpochDay()) " That comment is worth adding to the comments for EpochDay. Roger On 7/1/2016 9:38 AM, Roger Riggs wrote: > Hi Stephen, > > I'm a bit puzzled by the values recommended for the EpochDay Range. > The code should be commented with the computation relative to the > range of year MIN/MAX > so there is a more complete understanding. > I would expect the MIN to be the negative of the MAX or pretty close. > Are the new values defined to avoid overflow in some computation? > > Changing the valid range of values has a (nearly insignificant) > compatibility risk. > > Thanks, Roger > > > > On 7/1/2016 8:23 AM, Stephen Colebourne wrote: >> Fine by me, thanks >> Stephen >> >> On 1 July 2016 at 12:38, nadeesh tv wrote: >>> Hi all, >>> >>> Bug Id : https://bugs.openjdk.java.net/browse/JDK-8160681 >>> >>> Issue: Epoch day parameter to LocalDate.ofEpochDay() was not >>> validating >>> >>> Webrev: http://cr.openjdk.java.net/~bgopularam/ntv/8160681/webrev.00/ >>> >>> Tests are already covered under factory_ofEpochDay_aboveMax() , >>> factory_ofEpochDay_belowMin() . >>> >>> Error was obscured. It was throwing DateTimeException because of >>> internally calculated YEAR was going out of range. Now it will throw >>> exception due to expected issue 'epoch day is out of range'. >>> >>> -- >>> Thanks and Regards, >>> Nadeesh TV >>> > From Roger.Riggs at Oracle.com Fri Jul 1 13:46:39 2016 From: Roger.Riggs at Oracle.com (Roger Riggs) Date: Fri, 1 Jul 2016 09:46:39 -0400 Subject: RFR 8159616: java.time.Instant falls through switch statement In-Reply-To: References: Message-ID: <79ab4891-7676-665b-969e-b8a67209311b@Oracle.com> +1, looks fine. Roger On 7/1/2016 6:39 AM, Stephen Colebourne wrote: > Fine by me > Stephen > > On 1 July 2016 at 10:01, Bhanu Gopularam > wrote: >> Hi all, >> >> May I request you to review below simple fix for following issue: >> >> Bug id: https://bugs.openjdk.java.net/browse/JDK-8159616 >> >> Solution: Removed the unneeded case statement INSTANT_SECONDS from get(TemporalField field) of java.time.Instant class >> >> Webrev: http://cr.openjdk.java.net/~bgopularam/8159616/webrev.00/ >> >> Thanks, >> Bhanu From daniel.fuchs at oracle.com Fri Jul 1 14:09:02 2016 From: daniel.fuchs at oracle.com (Daniel Fuchs) Date: Fri, 1 Jul 2016 15:09:02 +0100 Subject: RFR 8159245: Loggers created by system classes are not initialized correctly when configured programmatically from application code. In-Reply-To: <2D776119-92E9-44F3-8D3E-ADACB5FC3805@oracle.com> References: <173cb32e-77c5-ec85-e22d-7c3e46181d71@oracle.com> <89587611-76e4-e532-f826-726d3e02bcb5@oracle.com> <41915567-e0fd-32e3-c8c3-4fb6f90f6440@oracle.com> <16CCC18D-0CCC-48F8-83DB-832BE3174A06@oracle.com> <2974edad-ac4b-dc80-78ff-6f85f5d62753@oracle.com> <2D776119-92E9-44F3-8D3E-ADACB5FC3805@oracle.com> Message-ID: <26cb16f5-3ab1-5340-6015-6c78386307bd@oracle.com> Hi Mandy, On 30/06/16 19:23, Mandy Chung wrote: > Looks pretty good. What if the application logger is a custom Logger subclass? Would this mechanism support that? Yes - this is taken into account, but there are limitations: by design only data that has been set by calling the super class setter will be taken into account. > One small comment: > > 577 if (logger != sysLogger && !logger.isConfigMerged(sysLogger)) { > 578 // if logger already exists we will merge the two configurations. > : > 587 } > > I suggest to hide the body and isConfigMerged check in Logger in a single method: > if (logger != sysLogger) { > logger.mergeWithSystemLogger(sysLogger); > } OK. I was concerned about the cost of creating a doPrivileged call for nothing - but then reflected that system classes usually call getLogger only once for a specific logger - at which point the doPrivileged will be needed anyway (only for subsequent calls of getLogger with the same name would it be superfluous). Here is the new webrev: http://cr.openjdk.java.net/~dfuchs/webrev_8159245/webrev.06/ cheers, -- daniel > > Mandy From michael.haupt at oracle.com Fri Jul 1 14:11:39 2016 From: michael.haupt at oracle.com (Michael Haupt) Date: Fri, 1 Jul 2016 16:11:39 +0200 Subject: RFR(L): 8143211: provide bytecode intrinsics for loop and try/finally executors In-Reply-To: References: <5FEECAA3-6A01-44A1-96D1-69D3336B7832@oracle.com> <72b5055a-7a12-b2c6-5576-424d7d5df69a@oracle.com> <498DA19D-E6FD-4F40-9F85-E6A137DC9050@oracle.com> Message-ID: <26616501-EC06-4696-A4E5-C46C2D51B706@oracle.com> Hi Vladimir, > Am 01.07.2016 um 14:00 schrieb Vladimir Ivanov : > Stale LF shape in the comment. Fixed. > - if (assertStaticType(cls, n)) > - return; // this cast was already performed > + assertStaticType(cls, n); > > This change completely defeats localClasses purpose. I'd like to understand more why the verifier complains about missing checkcast. After internal discussion, the fix we arrived at is now here: http://cr.openjdk.java.net/~mhaupt/8143211/webrev.03/ Best, Michael -- Dr. Michael Haupt | Principal Member of Technical Staff Phone: +49 331 200 7277 | Fax: +49 331 200 7561 Oracle Java Platform Group | LangTools Team | Nashorn Oracle Deutschland B.V. & Co. KG | Schiffbauergasse 14 | 14467 Potsdam, Germany ORACLE Deutschland B.V. & Co. KG | Hauptverwaltung: Riesstra?e 25, D-80992 M?nchen Registergericht: Amtsgericht M?nchen, HRA 95603 Komplement?rin: ORACLE Deutschland Verwaltung B.V. | Hertogswetering 163/167, 3543 AS Utrecht, Niederlande Handelsregister der Handelskammer Midden-Nederland, Nr. 30143697 Gesch?ftsf?hrer: Alexander van der Ven, Jan Schultheiss, Val Maher Oracle is committed to developing practices and products that help protect the environment From nadeesh.tv at oracle.com Fri Jul 1 14:25:15 2016 From: nadeesh.tv at oracle.com (nadeesh tv) Date: Fri, 01 Jul 2016 19:55:15 +0530 Subject: RFR:JDK-8160681:LocalDate.ofEpochDay input validation In-Reply-To: References: <5776563C.2050402@oracle.com> <15fe1e5c-41a8-f0e1-29bb-9f9a40d82a58@Oracle.com> Message-ID: <57767D4B.2060607@oracle.com> Stephen, Roger, Thanks for the comments. On 7/1/2016 7:11 PM, Roger Riggs wrote: > Never mind, I just saw the comment in the bug. > > "Just for a reference, EpochDay range = (LocalDate.MIN.toEpochDay() , > LocalDate.MAX.toEpochDay()) " > > That comment is worth adding to the comments for EpochDay. Please see the updated webrev http://cr.openjdk.java.net/~bgopularam/ntv/8160681/webrev.01/ Thanks and regards, Nadeesh TV > > Roger > > On 7/1/2016 9:38 AM, Roger Riggs wrote: >> Hi Stephen, >> >> I'm a bit puzzled by the values recommended for the EpochDay Range. >> The code should be commented with the computation relative to the >> range of year MIN/MAX >> so there is a more complete understanding. >> I would expect the MIN to be the negative of the MAX or pretty close. >> Are the new values defined to avoid overflow in some computation? >> >> Changing the valid range of values has a (nearly insignificant) >> compatibility risk. >> >> Thanks, Roger >> >> >> >> On 7/1/2016 8:23 AM, Stephen Colebourne wrote: >>> Fine by me, thanks >>> Stephen >>> >>> On 1 July 2016 at 12:38, nadeesh tv wrote: >>>> Hi all, >>>> >>>> Bug Id : https://bugs.openjdk.java.net/browse/JDK-8160681 >>>> >>>> Issue: Epoch day parameter to LocalDate.ofEpochDay() was not >>>> validating >>>> >>>> Webrev: http://cr.openjdk.java.net/~bgopularam/ntv/8160681/webrev.00/ >>>> >>>> Tests are already covered under factory_ofEpochDay_aboveMax() , >>>> factory_ofEpochDay_belowMin() . >>>> >>>> Error was obscured. It was throwing DateTimeException because of >>>> internally calculated YEAR was going out of range. Now it will throw >>>> exception due to expected issue 'epoch day is out of range'. >>>> >>>> -- >>>> Thanks and Regards, >>>> Nadeesh TV >>>> >> > -- Thanks and Regards, Nadeesh TV From vladimir.x.ivanov at oracle.com Fri Jul 1 14:57:11 2016 From: vladimir.x.ivanov at oracle.com (Vladimir Ivanov) Date: Fri, 1 Jul 2016 17:57:11 +0300 Subject: RFR(L): 8143211: provide bytecode intrinsics for loop and try/finally executors In-Reply-To: <26616501-EC06-4696-A4E5-C46C2D51B706@oracle.com> References: <5FEECAA3-6A01-44A1-96D1-69D3336B7832@oracle.com> <72b5055a-7a12-b2c6-5576-424d7d5df69a@oracle.com> <498DA19D-E6FD-4F40-9F85-E6A137DC9050@oracle.com> <26616501-EC06-4696-A4E5-C46C2D51B706@oracle.com> Message-ID: > After internal discussion, the fix we arrived at is now here: http://cr.openjdk.java.net/~mhaupt/8143211/webrev.03/ Looks good. Best regards, Vladimir Ivanov From mandy.chung at oracle.com Fri Jul 1 15:09:01 2016 From: mandy.chung at oracle.com (Mandy Chung) Date: Fri, 1 Jul 2016 08:09:01 -0700 Subject: RFR 8159245: Loggers created by system classes are not initialized correctly when configured programmatically from application code. In-Reply-To: <26cb16f5-3ab1-5340-6015-6c78386307bd@oracle.com> References: <173cb32e-77c5-ec85-e22d-7c3e46181d71@oracle.com> <89587611-76e4-e532-f826-726d3e02bcb5@oracle.com> <41915567-e0fd-32e3-c8c3-4fb6f90f6440@oracle.com> <16CCC18D-0CCC-48F8-83DB-832BE3174A06@oracle.com> <2974edad-ac4b-dc80-78ff-6f85f5d62753@oracle.com> <2D776119-92E9-44F3-8D3E-ADACB5FC3805@oracle.com> <26cb16f5-3ab1-5340-6015-6c78386307bd@oracle.com> Message-ID: > On Jul 1, 2016, at 7:09 AM, Daniel Fuchs wrote: > > > OK. I was concerned about the cost of creating a doPrivileged call > for nothing - but then reflected that system classes usually call > getLogger only once for a specific logger - at which point the > doPrivileged will be needed anyway (only for subsequent calls > of getLogger with the same name would it be superfluous). > > Here is the new webrev: > > http://cr.openjdk.java.net/~dfuchs/webrev_8159245/webrev.06/ I was thinking to move the entire doPrivileged block to mergeWithSystemLogger that will look like: if (cfg == system.config) { return; } // sanity check if (!system.isSystemLogger ?. throw new InternalError(?); final ConfigurationData cfg = config; AC.doPrivileged(... config = cfg.merge(system); ) 577 checkPermission(); Is this necessary? Is it be covered by the merge method? Mandy From kumar.x.srinivasan at oracle.com Fri Jul 1 15:12:01 2016 From: kumar.x.srinivasan at oracle.com (Kumar Srinivasan) Date: Fri, 01 Jul 2016 08:12:01 -0700 Subject: Review Request: JDK-8160698 java --dry-run should not cause main class be initialized In-Reply-To: <4D0CC248-E338-4DED-9706-2BCF669DD6A0@oracle.com> References: <4D0CC248-E338-4DED-9706-2BCF669DD6A0@oracle.com> Message-ID: <57768841.9030707@oracle.com> Looks ok, btw. doesn't the bug need to be added to the test ? If that is all there is to it. I don't need to see an iteration. Thanks Kumar > Kumar, > > I move the call to CreateApplicationArgs before PostJVMInit and dryRun stops before PostJVMInit which shows the splash screen. > > Webrev: > http://cr.openjdk.java.net/~mchung/jdk9/webrevs/8160698/webrev.00/index.html > > This also cleans up the LauncherHelper to use Class::forName instead of loadClass. > > Mandy From daniel.fuchs at oracle.com Fri Jul 1 15:16:20 2016 From: daniel.fuchs at oracle.com (Daniel Fuchs) Date: Fri, 1 Jul 2016 16:16:20 +0100 Subject: RFR 8159245: Loggers created by system classes are not initialized correctly when configured programmatically from application code. In-Reply-To: References: <173cb32e-77c5-ec85-e22d-7c3e46181d71@oracle.com> <89587611-76e4-e532-f826-726d3e02bcb5@oracle.com> <41915567-e0fd-32e3-c8c3-4fb6f90f6440@oracle.com> <16CCC18D-0CCC-48F8-83DB-832BE3174A06@oracle.com> <2974edad-ac4b-dc80-78ff-6f85f5d62753@oracle.com> <2D776119-92E9-44F3-8D3E-ADACB5FC3805@oracle.com> <26cb16f5-3ab1-5340-6015-6c78386307bd@oracle.com> Message-ID: <96af5686-728f-9671-dbc7-c2be8704ba49@oracle.com> On 01/07/16 16:09, Mandy Chung wrote: > I was thinking to move the entire doPrivileged block to mergeWithSystemLogger that will look like: > > if (cfg == system.config) { > return; > } > > // sanity check > if (!system.isSystemLogger ?. > throw new InternalError(?); > > final ConfigurationData cfg = config; > AC.doPrivileged(... > config = cfg.merge(system); > ) > > > 577 checkPermission(); > > Is this necessary? Is it be covered by the merge method? I'd prefer to keep the doPrivileged in LogManager so that Logger.mergeWithSystemLogger can call checkpermission(). From a conceptual point of view it's only when calling this method from LogManager that we want to be privileged, even though the method is package private and only called from LogManager... best regards, -- daniel From mandy.chung at oracle.com Fri Jul 1 15:19:16 2016 From: mandy.chung at oracle.com (Mandy Chung) Date: Fri, 1 Jul 2016 08:19:16 -0700 Subject: RFR 8159245: Loggers created by system classes are not initialized correctly when configured programmatically from application code. In-Reply-To: <96af5686-728f-9671-dbc7-c2be8704ba49@oracle.com> References: <173cb32e-77c5-ec85-e22d-7c3e46181d71@oracle.com> <89587611-76e4-e532-f826-726d3e02bcb5@oracle.com> <41915567-e0fd-32e3-c8c3-4fb6f90f6440@oracle.com> <16CCC18D-0CCC-48F8-83DB-832BE3174A06@oracle.com> <2974edad-ac4b-dc80-78ff-6f85f5d62753@oracle.com> <2D776119-92E9-44F3-8D3E-ADACB5FC3805@oracle.com> <26cb16f5-3ab1-5340-6015-6c78386307bd@oracle.com> <96af5686-728f-9671-dbc7-c2be8704ba49@oracle.com> Message-ID: > On Jul 1, 2016, at 8:16 AM, Daniel Fuchs wrote: > > On 01/07/16 16:09, Mandy Chung wrote: >> I was thinking to move the entire doPrivileged block to mergeWithSystemLogger that will look like: >> >> if (cfg == system.config) { >> return; >> } >> >> // sanity check >> if (!system.isSystemLogger ?. >> throw new InternalError(?); >> >> final ConfigurationData cfg = config; >> AC.doPrivileged(... >> config = cfg.merge(system); >> ) >> >> >> 577 checkPermission(); >> >> Is this necessary? Is it be covered by the merge method? > > I'd prefer to keep the doPrivileged in LogManager so that > Logger.mergeWithSystemLogger can call checkpermission(). > > From a conceptual point of view it's only when calling > this method from LogManager that we want to be privileged, > even though the method is package private and only called > from LogManager? Why is this extra checkPermission necessary? Mandy From daniel.fuchs at oracle.com Fri Jul 1 15:23:16 2016 From: daniel.fuchs at oracle.com (Daniel Fuchs) Date: Fri, 1 Jul 2016 16:23:16 +0100 Subject: RFR 8159245: Loggers created by system classes are not initialized correctly when configured programmatically from application code. In-Reply-To: References: <173cb32e-77c5-ec85-e22d-7c3e46181d71@oracle.com> <89587611-76e4-e532-f826-726d3e02bcb5@oracle.com> <41915567-e0fd-32e3-c8c3-4fb6f90f6440@oracle.com> <16CCC18D-0CCC-48F8-83DB-832BE3174A06@oracle.com> <2974edad-ac4b-dc80-78ff-6f85f5d62753@oracle.com> <2D776119-92E9-44F3-8D3E-ADACB5FC3805@oracle.com> <26cb16f5-3ab1-5340-6015-6c78386307bd@oracle.com> <96af5686-728f-9671-dbc7-c2be8704ba49@oracle.com> Message-ID: <16f57762-a298-6c23-bcaa-55566d9c0f8f@oracle.com> On 01/07/16 16:19, Mandy Chung wrote: >> I'd prefer to keep the doPrivileged in LogManager so that >> > Logger.mergeWithSystemLogger can call checkpermission(). >> > >> > From a conceptual point of view it's only when calling >> > this method from LogManager that we want to be privileged, >> > even though the method is package private and only called >> > from LogManager? > Why is this extra checkPermission necessary? Because we're importing an application logger configuration inside a system logger. Although the method can't be called from outside the package I'd prefer to keep the permission check in there. Also it's better to do it up front than having it fail midway when we later call addHandler or setLevel. best regards, -- daniel From mandy.chung at oracle.com Fri Jul 1 15:33:35 2016 From: mandy.chung at oracle.com (Mandy Chung) Date: Fri, 1 Jul 2016 08:33:35 -0700 Subject: RFR 8159245: Loggers created by system classes are not initialized correctly when configured programmatically from application code. In-Reply-To: <16f57762-a298-6c23-bcaa-55566d9c0f8f@oracle.com> References: <173cb32e-77c5-ec85-e22d-7c3e46181d71@oracle.com> <89587611-76e4-e532-f826-726d3e02bcb5@oracle.com> <41915567-e0fd-32e3-c8c3-4fb6f90f6440@oracle.com> <16CCC18D-0CCC-48F8-83DB-832BE3174A06@oracle.com> <2974edad-ac4b-dc80-78ff-6f85f5d62753@oracle.com> <2D776119-92E9-44F3-8D3E-ADACB5FC3805@oracle.com> <26cb16f5-3ab1-5340-6015-6c78386307bd@oracle.com> <96af5686-728f-9671-dbc7-c2be8704ba49@oracle.com> <16f57762-a298-6c23-bcaa-55566d9c0f8f@oracle.com> Message-ID: > On Jul 1, 2016, at 8:23 AM, Daniel Fuchs wrote: > > On 01/07/16 16:19, Mandy Chung wrote: >>> I'd prefer to keep the doPrivileged in LogManager so that >>> > Logger.mergeWithSystemLogger can call checkpermission(). >>> > >>> > From a conceptual point of view it's only when calling >>> > this method from LogManager that we want to be privileged, >>> > even though the method is package private and only called >>> > from LogManager? >> Why is this extra checkPermission necessary? > > Because we're importing an application logger configuration > inside a system logger. Although the method can't be called > from outside the package I'd prefer to keep the permission > check in there. Also it's better to do it up front than > having it fail midway when we later call addHandler or > setLevel. I think the additional check is unecessary but it?s harmless if you prefre to keep that. Ship it. Mandy From sean.coffey at oracle.com Fri Jul 1 15:45:31 2016 From: sean.coffey at oracle.com (=?UTF-8?Q?Se=c3=a1n_Coffey?=) Date: Fri, 1 Jul 2016 16:45:31 +0100 Subject: RFR: JDK-8160240 - javax/rmi/PortableRemoteObject/8146975/RmiIiopReturnValueTest.java failed with error "Address already in use: bind" In-Reply-To: <29aa73b8-56d1-2451-6abd-747163a47769@oracle.com> References: <29aa73b8-56d1-2451-6abd-747163a47769@oracle.com> Message-ID: <5776901B.5000801@oracle.com> Mark, fixed port numbers are always going to be problematic in tests. Is there any way the port numbers can be assigned after the test starts up ? Maybe the com.sun.jndi.cosnaming.CNCtxFactory class could be modified/accessed via reflection so that the initUsingIiopUrl can be re-called once you're sure of a free port on test client. That failing, maybe you can use a try/finally block in main method to ensure that stopTestComponents() is always called. Looks like there's potential for the test to exit early without cleaning up if startRmiIiopServer() runs into an exception. Regards, Sean. On 01/07/16 00:38, Mark Sheppard wrote: > Hi, > please oblige and review the following change > http://cr.openjdk.java.net/~msheppar/8160240/webrev/ > > to address the issue raised in > https://bugs.openjdk.java.net/browse/JDK-8160240 > > it has been observed that, during continuous integration regression > tests on some platforms, > there is an intermittent bind failure, when starting the orbd for the > test. Thus, as the test is composed of > two run commands, one without security manager and one with security > manager, it is > assumed that, the second run starts before the sockets in use in the > first run have been fully released. > Therefore, to overcome the bind already in use port conflict, the > test's second run with security manager > has been modified to use different ports, for cos nameservice and > activator, to those of the first run. > > regards > Mark From Roger.Riggs at Oracle.com Fri Jul 1 16:01:25 2016 From: Roger.Riggs at Oracle.com (Roger Riggs) Date: Fri, 1 Jul 2016 12:01:25 -0400 Subject: RFR: JDK-8160240 - javax/rmi/PortableRemoteObject/8146975/RmiIiopReturnValueTest.java failed with error "Address already in use: bind" In-Reply-To: <5776901B.5000801@oracle.com> References: <29aa73b8-56d1-2451-6abd-747163a47769@oracle.com> <5776901B.5000801@oracle.com> Message-ID: Hi Mark, Instead of spreading around the condition and the port numbers, can you pass the pair of port numbers (as int's) to startOrbD and startRmiIiopServer? That would allow the logic for changing the port numbers to be put into startTestComponents. And you could take advantage of the TestLibrary.Utils.freeport() to pick a free port. Roger On 7/1/2016 11:45 AM, Se?n Coffey wrote: > Mark, > > fixed port numbers are always going to be problematic in tests. Is > there any way the port numbers can be assigned after the test starts > up ? Maybe the com.sun.jndi.cosnaming.CNCtxFactory class could be > modified/accessed via reflection so that the initUsingIiopUrl can be > re-called once you're sure of a free port on test client. > > That failing, maybe you can use a try/finally block in main method to > ensure that stopTestComponents() is always called. Looks like there's > potential for the test to exit early without cleaning up if > startRmiIiopServer() runs into an exception. > > Regards, > Sean. > > On 01/07/16 00:38, Mark Sheppard wrote: >> Hi, >> please oblige and review the following change >> http://cr.openjdk.java.net/~msheppar/8160240/webrev/ >> >> to address the issue raised in >> https://bugs.openjdk.java.net/browse/JDK-8160240 >> >> it has been observed that, during continuous integration regression >> tests on some platforms, >> there is an intermittent bind failure, when starting the orbd for the >> test. Thus, as the test is composed of >> two run commands, one without security manager and one with security >> manager, it is >> assumed that, the second run starts before the sockets in use in the >> first run have been fully released. >> Therefore, to overcome the bind already in use port conflict, the >> test's second run with security manager >> has been modified to use different ports, for cos nameservice and >> activator, to those of the first run. >> >> regards >> Mark > From daniel.fuchs at oracle.com Fri Jul 1 16:02:30 2016 From: daniel.fuchs at oracle.com (Daniel Fuchs) Date: Fri, 1 Jul 2016 17:02:30 +0100 Subject: RFR 8159245: Loggers created by system classes are not initialized correctly when configured programmatically from application code. In-Reply-To: References: <173cb32e-77c5-ec85-e22d-7c3e46181d71@oracle.com> <89587611-76e4-e532-f826-726d3e02bcb5@oracle.com> <41915567-e0fd-32e3-c8c3-4fb6f90f6440@oracle.com> <16CCC18D-0CCC-48F8-83DB-832BE3174A06@oracle.com> <2974edad-ac4b-dc80-78ff-6f85f5d62753@oracle.com> <2D776119-92E9-44F3-8D3E-ADACB5FC3805@oracle.com> <26cb16f5-3ab1-5340-6015-6c78386307bd@oracle.com> <96af5686-728f-9671-dbc7-c2be8704ba49@oracle.com> <16f57762-a298-6c23-bcaa-55566d9c0f8f@oracle.com> Message-ID: <8f25d11d-f3d0-9209-a1a1-eb0944e9de52@oracle.com> On 01/07/16 16:33, Mandy Chung wrote: > I think the additional check is unecessary but it?s harmless if you prefre to keep that. Oh - I see - the permission check in ConfigurationData::merge can be removed: ConfigurationData is a private class and config is a private field. I will do that. cheers, -- daniel > Ship it. From mandy.chung at oracle.com Fri Jul 1 16:52:49 2016 From: mandy.chung at oracle.com (Mandy Chung) Date: Fri, 1 Jul 2016 09:52:49 -0700 Subject: RFR: 8056285: java/util/logging/CheckLockLocationTest.java java.lang.RuntimeException: Test failed: should have been able to create FileHandler for %t/writable-dir/log.log in writable directory. In-Reply-To: <9388e67f-0e9d-19e8-db1a-2b205bed80e4@oracle.com> References: <9388e67f-0e9d-19e8-db1a-2b205bed80e4@oracle.com> Message-ID: > On Jun 28, 2016, at 10:44 AM, Daniel Fuchs wrote: > > Hi, > > JDK-8056285 has been sighted again (sigh). > I strongly suspect a configuration issue but I have > no proof. Here is an attempt at gathering some more > data to nail down the root cause of the issue. > > JBS > https://bugs.openjdk.java.net/browse/JDK-8056285 > > webrev: > http://cr.openjdk.java.net/~dfuchs/webrev_8056285/webrev.00 Looks okay. Mandy From mark.sheppard at oracle.com Fri Jul 1 18:15:56 2016 From: mark.sheppard at oracle.com (Mark Sheppard) Date: Fri, 1 Jul 2016 19:15:56 +0100 Subject: RFR: JDK-8160240 - javax/rmi/PortableRemoteObject/8146975/RmiIiopReturnValueTest.java failed with error "Address already in use: bind" In-Reply-To: <5776901B.5000801@oracle.com> References: <29aa73b8-56d1-2451-6abd-747163a47769@oracle.com> <5776901B.5000801@oracle.com> Message-ID: Hi Sean, thanks for the feedback ... we should be ok with fixed ports. The orbd by default uses the fixed ports of 1050 and 1049. The selected ports are not in the ephemeral range on any platform. solaris /usr/sbin/ndd /dev/tcp tcp_smallest_anon_port tcp_largest_anon_port 32768 65535 linux cat /proc/sys/net/ipv4/ip_local_port_range 32768 61000 windows netsh int ipv4 show dynamicport tcp netsh int ipv6 show dynamicport tcp https://www.cymru.com/jtk/misc/ephemeralports.html As such the name service and the activator are expected to start on well known service ports: so the ports chosen are variants of 1050 1049 ... 5050 5049 etc. should be ok. The clash happens when the orbd's TCP resources of the first run are not released immediately by the windows/solaris kernel - as the TCP connections go through their various state changes. It is an intermittent failure. I'll have a look at the exception cases to ensure that all services are terminated in such instances ... I had thought that I did this originally, but will double check various scenarios regards Mark On 01/07/2016 16:45, Se?n Coffey wrote: > Mark, > > fixed port numbers are always going to be problematic in tests. Is > there any way the port numbers can be assigned after the test starts > up ? Maybe the com.sun.jndi.cosnaming.CNCtxFactory class could be > modified/accessed via reflection so that the initUsingIiopUrl can be > re-called once you're sure of a free port on test client. > > That failing, maybe you can use a try/finally block in main method to > ensure that stopTestComponents() is always called. Looks like there's > potential for the test to exit early without cleaning up if > startRmiIiopServer() runs into an exception. > Regards, > Sean. > On 01/07/16 00:38, Mark Sheppard wrote: >> Hi, >> please oblige and review the following change >> http://cr.openjdk.java.net/~msheppar/8160240/webrev/ >> >> to address the issue raised in >> https://bugs.openjdk.java.net/browse/JDK-8160240 >> >> it has been observed that, during continuous integration regression >> tests on some platforms, >> there is an intermittent bind failure, when starting the orbd for the >> test. Thus, as the test is composed of >> two run commands, one without security manager and one with security >> manager, it is >> assumed that, the second run starts before the sockets in use in the >> first run have been fully released. >> Therefore, to overcome the bind already in use port conflict, the >> test's second run with security manager >> has been modified to use different ports, for cos nameservice and >> activator, to those of the first run. >> >> regards >> Mark > From mark.sheppard at oracle.com Fri Jul 1 18:25:03 2016 From: mark.sheppard at oracle.com (Mark Sheppard) Date: Fri, 1 Jul 2016 19:25:03 +0100 Subject: RFR: JDK-8160240 - javax/rmi/PortableRemoteObject/8146975/RmiIiopReturnValueTest.java failed with error "Address already in use: bind" In-Reply-To: References: <29aa73b8-56d1-2451-6abd-747163a47769@oracle.com> <5776901B.5000801@oracle.com> Message-ID: <1d761ced-f169-a798-24c2-57b7a6c127ff@oracle.com> Hi Roger, thanks for the feedback and suggestion. so is the suggestion one of parsing the command line of the test to extract the -port argument and then fabricate the NS port with an increment, and then pass this into the startComponents method and thus, eliminate the security manager check? I'm not too keen on using ephemeral ports for the tests. the port # chosen are not in the ephemeral range on any test platform (or at least shouldn't be, afaik) they are a variation on the default ports of 1050 1049 .... 4050 4049, 5050 5049. The issue stems from the tests executing faster than the kernel releases TCP resources when terminating connections have closed and it is intermittent as I understand it, TestLibrary.Utils.freeport() may have some issues also, in that it grabs a port by creating a Socket and then releases, and then indicates it is available for use, as a free port, based on the assumption that this port wont be a candidate for immediate selection in the ephemeral range ... this may not always be the case. regards Mark On 01/07/2016 17:01, Roger Riggs wrote: > Hi Mark, > > Instead of spreading around the condition and the port numbers, can > you pass the pair of port numbers (as int's) > to startOrbD and startRmiIiopServer? That would allow the logic for > changing the port numbers to be > put into startTestComponents. > > And you could take advantage of the TestLibrary.Utils.freeport() to > pick a free port. > > Roger > > > On 7/1/2016 11:45 AM, Se?n Coffey wrote: >> Mark, >> >> fixed port numbers are always going to be problematic in tests. Is >> there any way the port numbers can be assigned after the test starts >> up ? Maybe the com.sun.jndi.cosnaming.CNCtxFactory class could be >> modified/accessed via reflection so that the initUsingIiopUrl can be >> re-called once you're sure of a free port on test client. >> >> That failing, maybe you can use a try/finally block in main method to >> ensure that stopTestComponents() is always called. Looks like there's >> potential for the test to exit early without cleaning up if >> startRmiIiopServer() runs into an exception. >> >> Regards, >> Sean. >> >> On 01/07/16 00:38, Mark Sheppard wrote: >>> Hi, >>> please oblige and review the following change >>> http://cr.openjdk.java.net/~msheppar/8160240/webrev/ >>> >>> to address the issue raised in >>> https://bugs.openjdk.java.net/browse/JDK-8160240 >>> >>> it has been observed that, during continuous integration regression >>> tests on some platforms, >>> there is an intermittent bind failure, when starting the orbd for >>> the test. Thus, as the test is composed of >>> two run commands, one without security manager and one with security >>> manager, it is >>> assumed that, the second run starts before the sockets in use in the >>> first run have been fully released. >>> Therefore, to overcome the bind already in use port conflict, the >>> test's second run with security manager >>> has been modified to use different ports, for cos nameservice and >>> activator, to those of the first run. >>> >>> regards >>> Mark >> > From Roger.Riggs at Oracle.com Fri Jul 1 18:39:06 2016 From: Roger.Riggs at Oracle.com (Roger Riggs) Date: Fri, 1 Jul 2016 14:39:06 -0400 Subject: RFR: JDK-8160240 - javax/rmi/PortableRemoteObject/8146975/RmiIiopReturnValueTest.java failed with error "Address already in use: bind" In-Reply-To: <1d761ced-f169-a798-24c2-57b7a6c127ff@oracle.com> References: <29aa73b8-56d1-2451-6abd-747163a47769@oracle.com> <5776901B.5000801@oracle.com> <1d761ced-f169-a798-24c2-57b7a6c127ff@oracle.com> Message-ID: <03d3b8aa-60d1-505e-abb1-53b8e1c4330e@Oracle.com> Hi Mark, On 7/1/2016 2:25 PM, Mark Sheppard wrote: > Hi Roger, > thanks for the feedback and suggestion. > > so is the suggestion one of parsing the command line of the test to > extract the -port argument and then fabricate the > NS port with an increment, and then pass this into the startComponents > method and thus, eliminate the > security manager check? That would be equivalent; factoring out the ports all the way to the command line. Still it would be using fixed ports, as per Sean's comments. > > I'm not too keen on using ephemeral ports for the tests. > the port # chosen are not in the ephemeral range on any test platform > (or at least shouldn't be, afaik) > they are a variation on the default ports of 1050 1049 .... 4050 4049, > 5050 5049. > The issue stems from the tests executing faster than the kernel > releases TCP resources when > terminating connections have closed and it is intermittent ok , but the port number values should not be important; only that they are unique. It would be much more work to have the orb and server open their own ephemeral port and then be able to configure the client to use it. But that would have the fewest problems with port usage. Still, it is probably not practical. > > as I understand it, TestLibrary.Utils.freeport() may have some issues > also, in that it grabs a port by creating a Socket and then > releases, and then indicates it is available for use, as a free port, > based on the assumption that this port wont be a candidate for > immediate selection in the ephemeral range ... this may not always be > the case. I'm not sure if this is better or worse than fixed ports; it was proposed as an improvement over fixed ports but not without timing problems. Passing the ports from the command line is likely to be good enough unless multiple test runs are done concurrently on the same system. It would also be possible for startTestComponents to be able to detect that startOrbd failed to start on a particular port and try again with a different one; ditto startRmiIiopServer(). But that's also probably not worth applying for a single test, but more for an enhancement to the suite of tests. Roger > > regards > Mark > > On 01/07/2016 17:01, Roger Riggs wrote: >> Hi Mark, >> >> Instead of spreading around the condition and the port numbers, can >> you pass the pair of port numbers (as int's) >> to startOrbD and startRmiIiopServer? That would allow the logic for >> changing the port numbers to be >> put into startTestComponents. >> >> And you could take advantage of the TestLibrary.Utils.freeport() to >> pick a free port. >> >> Roger >> >> >> On 7/1/2016 11:45 AM, Se?n Coffey wrote: >>> Mark, >>> >>> fixed port numbers are always going to be problematic in tests. Is >>> there any way the port numbers can be assigned after the test starts >>> up ? Maybe the com.sun.jndi.cosnaming.CNCtxFactory class could be >>> modified/accessed via reflection so that the initUsingIiopUrl can be >>> re-called once you're sure of a free port on test client. >>> >>> That failing, maybe you can use a try/finally block in main method >>> to ensure that stopTestComponents() is always called. Looks like >>> there's potential for the test to exit early without cleaning up if >>> startRmiIiopServer() runs into an exception. >>> >>> Regards, >>> Sean. >>> >>> On 01/07/16 00:38, Mark Sheppard wrote: >>>> Hi, >>>> please oblige and review the following change >>>> http://cr.openjdk.java.net/~msheppar/8160240/webrev/ >>>> >>>> to address the issue raised in >>>> https://bugs.openjdk.java.net/browse/JDK-8160240 >>>> >>>> it has been observed that, during continuous integration regression >>>> tests on some platforms, >>>> there is an intermittent bind failure, when starting the orbd for >>>> the test. Thus, as the test is composed of >>>> two run commands, one without security manager and one with >>>> security manager, it is >>>> assumed that, the second run starts before the sockets in use in >>>> the first run have been fully released. >>>> Therefore, to overcome the bind already in use port conflict, the >>>> test's second run with security manager >>>> has been modified to use different ports, for cos nameservice and >>>> activator, to those of the first run. >>>> >>>> regards >>>> Mark >>> >> > From kumar.x.srinivasan at oracle.com Fri Jul 1 20:08:40 2016 From: kumar.x.srinivasan at oracle.com (Kumar Srinivasan) Date: Fri, 01 Jul 2016 13:08:40 -0700 Subject: RFR: 8145418: [macosx] Help message for -Xdock:name has a superfluous trailing quote " Message-ID: <5776CDC8.6040800@oracle.com> Hello, Please review simple fix: https://bugs.openjdk.java.net/browse/JDK-8145418 Thanks Kumar diff --git a/src/java.base/share/classes/sun/launcher/resources/launcher.properties b/src/java.base/share/classes/sun/launcher/resources/launcher.properties --- a/src/java.base/share/classes/sun/launcher/resources/launcher.properties +++ b/src/java.base/share/classes/sun/launcher/resources/launcher.properties @@ -141,7 +141,7 @@ The following options are Mac OS X specific:\n\ \ -XstartOnFirstThread\n\ \ run the main() method on the first (AppKit) thread\n\ -\ -Xdock:name="\n\ +\ -Xdock:name=\n\ \ override default application name displayed in dock\n\ \ -Xdock:icon=\n\ \ override default icon displayed in dock\n\n From naoto.sato at oracle.com Fri Jul 1 20:14:33 2016 From: naoto.sato at oracle.com (Naoto Sato) Date: Fri, 1 Jul 2016 13:14:33 -0700 Subject: RFR: 8145418: [macosx] Help message for -Xdock:name has a superfluous trailing quote " In-Reply-To: <5776CDC8.6040800@oracle.com> References: <5776CDC8.6040800@oracle.com> Message-ID: +1 Naoto On 7/1/16 1:08 PM, Kumar Srinivasan wrote: > Hello, > > Please review simple fix: > https://bugs.openjdk.java.net/browse/JDK-8145418 > > Thanks > Kumar > > diff --git > a/src/java.base/share/classes/sun/launcher/resources/launcher.properties > b/src/java.base/share/classes/sun/launcher/resources/launcher.properties > --- > a/src/java.base/share/classes/sun/launcher/resources/launcher.properties > +++ > b/src/java.base/share/classes/sun/launcher/resources/launcher.properties > @@ -141,7 +141,7 @@ > The following options are Mac OS X specific:\n\ > \ -XstartOnFirstThread\n\ > \ run the main() method on the first (AppKit) > thread\n\ > -\ -Xdock:name="\n\ > +\ -Xdock:name=\n\ > \ override default application name displayed in > dock\n\ > \ -Xdock:icon=\n\ > \ override default icon displayed in dock\n\n > From amy.lu at oracle.com Mon Jul 4 10:14:45 2016 From: amy.lu at oracle.com (Amy Lu) Date: Mon, 4 Jul 2016 18:14:45 +0800 Subject: JDK 9 (JAXP) RFR of JDK-8156598: jaxp: Use more informative format for problem list Message-ID: <577A3715.2080104@oracle.com> Please review this patch to update jaxp/test/ProblemList.txt to the more informative format, which has been used in "langtools" "jdk", but has not yet in "jaxp". bug: https://bugs.openjdk.java.net/browse/JDK-8156598 webrev: http://cr.openjdk.java.net/~amlu/8156598/webrev.00/ Thanks, Amy From lance.andersen at oracle.com Mon Jul 4 13:51:40 2016 From: lance.andersen at oracle.com (Lance Andersen) Date: Mon, 4 Jul 2016 09:51:40 -0400 Subject: JDK 9 (JAXP) RFR of JDK-8156598: jaxp: Use more informative format for problem list In-Reply-To: <577A3715.2080104@oracle.com> References: <577A3715.2080104@oracle.com> Message-ID: looks fine Amy > On Jul 4, 2016, at 6:14 AM, Amy Lu wrote: > > Please review this patch to update jaxp/test/ProblemList.txt to the more informative format, > which has been used in "langtools" "jdk", but has not yet in "jaxp". > > bug: https://bugs.openjdk.java.net/browse/JDK-8156598 > webrev: http://cr.openjdk.java.net/~amlu/8156598/webrev.00/ > > > Thanks, > Amy 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 Mon Jul 4 22:39:33 2016 From: aleksej.efimov at oracle.com (Aleks Efimov) Date: Tue, 5 Jul 2016 01:39:33 +0300 Subject: [9] RFR: 8154553: Incorrect GPL header in package-info.java reported Message-ID: <577AE5A5.8030105@oracle.com> Hello, jdk/src/jdk.accessibility/share/classes/com/sun/java/accessibility/util/package-info.java file contains incorrect GPL header which fails make/scripts/lic_check.sh script check. Failure is caused by missing comma after modification years. Please, help to review its addition: http://cr.openjdk.java.net/~aefimov/8154553/ lic_check.sh passes after this modification: ### Checking copyright notice in the file: jdk/src/jdk.accessibility/share/classes/com/sun/java/accessibility/util/package-info.java ### SUCCESS: The license header for jdk/src/jdk.accessibility/share/classes/com/sun/java/accessibility/util/package-info.java has been verified. ### With Best Regards, Aleksej JBS: https://bugs.openjdk.java.net/browse/JDK-8154553 From ivan.gerasimov at oracle.com Mon Jul 4 23:26:10 2016 From: ivan.gerasimov at oracle.com (Ivan Gerasimov) Date: Tue, 5 Jul 2016 02:26:10 +0300 Subject: [9] RFR: 8154553: Incorrect GPL header in package-info.java reported In-Reply-To: <577AE5A5.8030105@oracle.com> References: <577AE5A5.8030105@oracle.com> Message-ID: Hi Aleks! Is it the only mistake detected by that script? Again, grep finds a few more similar typos in the copyright headers: java.desktop/share/classes/sun/awt/RequestFocusController.java: * Copyright (c) 2006, 2016 Oracle and/or its affiliates. All rights reserved. java.desktop/unix/native/libawt_xawt/xawt/gnome_interface.h: * Copyright (c) 2013, 2016 Oracle and/or its affiliates. All rights reserved. java.management/share/classes/javax/management/ConstructorParameters.java: * Copyright (c) 2006, 2015 Oracle and/or its affiliates. All rights reserved. jdk.accessibility/share/classes/com/sun/java/accessibility/util/package-info.java: * Copyright (c) 2013, 2015 Oracle and/or its affiliates. All rights reserved. java.base/macosx/classes/java/lang/ClassLoaderHelper.java: * Copyright (c) 2012, 2015 Oracle and/or its affiliates. All rights reserved. java.base/share/classes/java/lang/module/package-info.java: * Copyright (c) 2013, 2016 Oracle and/or its affiliates. All rights reserved. java.base/share/classes/sun/security/util/AbstractAlgorithmConstraints.java: * Copyright (c) 2015, 2016 Oracle and/or its affiliates. All rights reserved. java.base/share/native/libjimage/osSupport.hpp: * Copyright (c) 2015, 2016 Oracle and/or its affiliates. All rights reserved. java.base/share/native/libjimage/imageFile.hpp: * Copyright (c) 2015, 2016 Oracle and/or its affiliates. All rights reserved. java.base/share/native/libjimage/NativeImageBuffer.cpp: * Copyright (c) 2015, 2016 Oracle and/or its affiliates. All rights reserved. java.base/share/native/libjimage/inttypes.hpp: * Copyright (c) 2015, 2016 Oracle and/or its affiliates. All rights reserved. java.base/share/native/libjimage/endian.hpp: * Copyright (c) 2015, 2016 Oracle and/or its affiliates. All rights reserved. java.base/share/native/libjimage/jimage.hpp: * Copyright (c) 2015, 2016 Oracle and/or its affiliates. All rights reserved. java.base/share/native/libjimage/imageFile.cpp: * Copyright (c) 2015, 2016 Oracle and/or its affiliates. All rights reserved. java.base/share/native/libjimage/jimage.cpp: * Copyright (c) 2015, 2016 Oracle and/or its affiliates. All rights reserved. java.base/share/native/libjimage/imageDecompressor.hpp: * Copyright (c) 2015, 2016 Oracle and/or its affiliates. All rights reserved. java.base/share/native/libjimage/endian.cpp: * Copyright (c) 2015, 2016 Oracle and/or its affiliates. All rights reserved. java.base/share/native/libjimage/imageDecompressor.cpp: * Copyright (c) 2015, 2016 Oracle and/or its affiliates. All rights reserved. java.base/unix/classes/java/lang/ClassLoaderHelper.java: * Copyright (c) 2012, 2015 Oracle and/or its affiliates. All rights reserved. java.base/unix/classes/java/net/DefaultDatagramSocketImplFactory.java: * Copyright (c) 2007,2011, Oracle and/or its affiliates. All rights reserved. java.base/windows/classes/java/lang/ClassLoaderHelper.java: * Copyright (c) 2012, 2015 Oracle and/or its affiliates. All rights reserved. java.base/windows/native/libjava/jni_util_md.c: * Copyright (c) 2004, 2014 Oracle and/or its affiliates. All rights reserved. java.httpclient/share/classes/java/net/http/Pair.java: * Copyright (c) 2016 Oracle and/or its affiliates. All rights reserved. jdk.charsets/share/classes/sun/nio/cs/ext/Big5_HKSCS.java.template: * Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved. closed/jdk.snmp/share/classes/sun/management/snmp/resources/snmpagent.properties:# Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved. closed/jdk.snmp/share/classes/sun/management/snmp/SNMPConfigurationException.java: * Copyright (c) 2014 Oracle and/or its affiliates. All rights reserved. sample/share/nio/chatserver/Client.java: * Copyright (c) 2011 Oracle and/or its affiliates. All rights reserved. sample/share/nio/chatserver/ChatServer.java: * Copyright (c) 2011 Oracle and/or its affiliates. All rights reserved. sample/share/nio/chatserver/NameReader.java: * Copyright (c) 2011 Oracle and/or its affiliates. All rights reserved. sample/share/nio/chatserver/ClientReader.java: * Copyright (c) 2011 Oracle and/or its affiliates. All rights reserved. sample/share/nio/chatserver/DataReader.java: * Copyright (c) 2011 Oracle and/or its affiliates. All rights reserved. sample/share/nio/chatserver/MessageReader.java: * Copyright (c) 2011 Oracle and/or its affiliates. All rights reserved. I'd prefer to see them fixed all at once, if possible. With kind regards, Ivan On 05.07.2016 1:39, Aleks Efimov wrote: > Hello, > > jdk/src/jdk.accessibility/share/classes/com/sun/java/accessibility/util/package-info.java > file contains incorrect GPL header which fails > make/scripts/lic_check.sh script check. > > Failure is caused by missing comma after modification years. Please, > help to review its addition: > http://cr.openjdk.java.net/~aefimov/8154553/ > > lic_check.sh passes after this modification: > ### Checking copyright notice in the file: > jdk/src/jdk.accessibility/share/classes/com/sun/java/accessibility/util/package-info.java > ### > SUCCESS: The license header for > jdk/src/jdk.accessibility/share/classes/com/sun/java/accessibility/util/package-info.java > has been verified. > ### > > With Best Regards, > Aleksej > > JBS: https://bugs.openjdk.java.net/browse/JDK-8154553 > From aleksej.efimov at oracle.com Tue Jul 5 00:06:00 2016 From: aleksej.efimov at oracle.com (Aleks Efimov) Date: Tue, 5 Jul 2016 03:06:00 +0300 Subject: [9] RFR: 8154553: Incorrect GPL header in package-info.java reported In-Reply-To: References: <577AE5A5.8030105@oracle.com> Message-ID: <577AF9E8.6030708@oracle.com> Hi Ivan, Thank you for looking into this one. > Is it the only mistake detected by that script? Of course not, we have a lot of similar errors across JDK9 (and 8). To track modifications of all incorrect headers across all JDK sub-repositories we already have JDK-8159475 bug logged. The approach on how we should fix all of them is under discussion right now and I would like not to wait for the final decision and to fix this particular one separately (same for JDK8 I sent earlier today). Best Regards, Aleks On 05/07/16 02:26, Ivan Gerasimov wrote: > Hi Aleks! > > Is it the only mistake detected by that script? > Again, grep finds a few more similar typos in the copyright headers: > > java.desktop/share/classes/sun/awt/RequestFocusController.java: * > Copyright (c) 2006, 2016 Oracle and/or its affiliates. All rights > reserved. > java.desktop/unix/native/libawt_xawt/xawt/gnome_interface.h: * > Copyright (c) 2013, 2016 Oracle and/or its affiliates. All rights > reserved. > java.management/share/classes/javax/management/ConstructorParameters.java: > * Copyright (c) 2006, 2015 Oracle and/or its affiliates. All rights > reserved. > jdk.accessibility/share/classes/com/sun/java/accessibility/util/package-info.java: > * Copyright (c) 2013, 2015 Oracle and/or its affiliates. All rights > reserved. > java.base/macosx/classes/java/lang/ClassLoaderHelper.java: * Copyright > (c) 2012, 2015 Oracle and/or its affiliates. All rights reserved. > java.base/share/classes/java/lang/module/package-info.java: * > Copyright (c) 2013, 2016 Oracle and/or its affiliates. All rights > reserved. > java.base/share/classes/sun/security/util/AbstractAlgorithmConstraints.java: > * Copyright (c) 2015, 2016 Oracle and/or its affiliates. All rights > reserved. > java.base/share/native/libjimage/osSupport.hpp: * Copyright (c) 2015, > 2016 Oracle and/or its affiliates. All rights reserved. > java.base/share/native/libjimage/imageFile.hpp: * Copyright (c) 2015, > 2016 Oracle and/or its affiliates. All rights reserved. > java.base/share/native/libjimage/NativeImageBuffer.cpp: * Copyright > (c) 2015, 2016 Oracle and/or its affiliates. All rights reserved. > java.base/share/native/libjimage/inttypes.hpp: * Copyright (c) 2015, > 2016 Oracle and/or its affiliates. All rights reserved. > java.base/share/native/libjimage/endian.hpp: * Copyright (c) 2015, > 2016 Oracle and/or its affiliates. All rights reserved. > java.base/share/native/libjimage/jimage.hpp: * Copyright (c) 2015, > 2016 Oracle and/or its affiliates. All rights reserved. > java.base/share/native/libjimage/imageFile.cpp: * Copyright (c) 2015, > 2016 Oracle and/or its affiliates. All rights reserved. > java.base/share/native/libjimage/jimage.cpp: * Copyright (c) 2015, > 2016 Oracle and/or its affiliates. All rights reserved. > java.base/share/native/libjimage/imageDecompressor.hpp: * Copyright > (c) 2015, 2016 Oracle and/or its affiliates. All rights reserved. > java.base/share/native/libjimage/endian.cpp: * Copyright (c) 2015, > 2016 Oracle and/or its affiliates. All rights reserved. > java.base/share/native/libjimage/imageDecompressor.cpp: * Copyright > (c) 2015, 2016 Oracle and/or its affiliates. All rights reserved. > java.base/unix/classes/java/lang/ClassLoaderHelper.java: * Copyright > (c) 2012, 2015 Oracle and/or its affiliates. All rights reserved. > java.base/unix/classes/java/net/DefaultDatagramSocketImplFactory.java: > * Copyright (c) 2007,2011, Oracle and/or its affiliates. All rights > reserved. > java.base/windows/classes/java/lang/ClassLoaderHelper.java: * > Copyright (c) 2012, 2015 Oracle and/or its affiliates. All rights > reserved. > java.base/windows/native/libjava/jni_util_md.c: * Copyright (c) 2004, > 2014 Oracle and/or its affiliates. All rights reserved. > java.httpclient/share/classes/java/net/http/Pair.java: * Copyright (c) > 2016 Oracle and/or its affiliates. All rights reserved. > jdk.charsets/share/classes/sun/nio/cs/ext/Big5_HKSCS.java.template: * > Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved. > closed/jdk.snmp/share/classes/sun/management/snmp/resources/snmpagent.properties:# > Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved. > closed/jdk.snmp/share/classes/sun/management/snmp/SNMPConfigurationException.java: > * Copyright (c) 2014 Oracle and/or its affiliates. All rights reserved. > sample/share/nio/chatserver/Client.java: * Copyright (c) 2011 Oracle > and/or its affiliates. All rights reserved. > sample/share/nio/chatserver/ChatServer.java: * Copyright (c) 2011 > Oracle and/or its affiliates. All rights reserved. > sample/share/nio/chatserver/NameReader.java: * Copyright (c) 2011 > Oracle and/or its affiliates. All rights reserved. > sample/share/nio/chatserver/ClientReader.java: * Copyright (c) 2011 > Oracle and/or its affiliates. All rights reserved. > sample/share/nio/chatserver/DataReader.java: * Copyright (c) 2011 > Oracle and/or its affiliates. All rights reserved. > sample/share/nio/chatserver/MessageReader.java: * Copyright (c) 2011 > Oracle and/or its affiliates. All rights reserved. > > I'd prefer to see them fixed all at once, if possible. > > With kind regards, > Ivan > > > On 05.07.2016 1:39, Aleks Efimov wrote: >> Hello, >> >> jdk/src/jdk.accessibility/share/classes/com/sun/java/accessibility/util/package-info.java >> file contains incorrect GPL header which fails >> make/scripts/lic_check.sh script check. >> >> Failure is caused by missing comma after modification years. Please, >> help to review its addition: >> http://cr.openjdk.java.net/~aefimov/8154553/ >> >> lic_check.sh passes after this modification: >> ### Checking copyright notice in the file: >> jdk/src/jdk.accessibility/share/classes/com/sun/java/accessibility/util/package-info.java >> ### >> SUCCESS: The license header for >> jdk/src/jdk.accessibility/share/classes/com/sun/java/accessibility/util/package-info.java >> has been verified. >> ### >> >> With Best Regards, >> Aleksej >> >> JBS: https://bugs.openjdk.java.net/browse/JDK-8154553 >> > From ivan.gerasimov at oracle.com Tue Jul 5 00:11:29 2016 From: ivan.gerasimov at oracle.com (Ivan Gerasimov) Date: Tue, 5 Jul 2016 03:11:29 +0300 Subject: [9] RFR: 8154553: Incorrect GPL header in package-info.java reported In-Reply-To: <577AF9E8.6030708@oracle.com> References: <577AE5A5.8030105@oracle.com> <577AF9E8.6030708@oracle.com> Message-ID: On 05.07.2016 3:06, Aleks Efimov wrote: > Hi Ivan, > Thank you for looking into this one. > >> Is it the only mistake detected by that script? > Of course not, we have a lot of similar errors across JDK9 (and 8). To > track modifications of all incorrect headers across all JDK > sub-repositories we already have JDK-8159475 bug logged. The approach > on how we should fix all of them is under discussion right now and I > would like not to wait for the final decision and to fix this > particular one separately (same for JDK8 I sent earlier today). > Okay, looks fine then. With kind regards, Ivan > Best Regards, > Aleks > > > On 05/07/16 02:26, Ivan Gerasimov wrote: >> Hi Aleks! >> >> Is it the only mistake detected by that script? >> Again, grep finds a few more similar typos in the copyright headers: >> >> java.desktop/share/classes/sun/awt/RequestFocusController.java: * >> Copyright (c) 2006, 2016 Oracle and/or its affiliates. All rights >> reserved. >> java.desktop/unix/native/libawt_xawt/xawt/gnome_interface.h: * >> Copyright (c) 2013, 2016 Oracle and/or its affiliates. All rights >> reserved. >> java.management/share/classes/javax/management/ConstructorParameters.java: >> * Copyright (c) 2006, 2015 Oracle and/or its affiliates. All rights >> reserved. >> jdk.accessibility/share/classes/com/sun/java/accessibility/util/package-info.java: >> * Copyright (c) 2013, 2015 Oracle and/or its affiliates. All rights >> reserved. >> java.base/macosx/classes/java/lang/ClassLoaderHelper.java: * >> Copyright (c) 2012, 2015 Oracle and/or its affiliates. All rights >> reserved. >> java.base/share/classes/java/lang/module/package-info.java: * >> Copyright (c) 2013, 2016 Oracle and/or its affiliates. All rights >> reserved. >> java.base/share/classes/sun/security/util/AbstractAlgorithmConstraints.java: >> * Copyright (c) 2015, 2016 Oracle and/or its affiliates. All rights >> reserved. >> java.base/share/native/libjimage/osSupport.hpp: * Copyright (c) 2015, >> 2016 Oracle and/or its affiliates. All rights reserved. >> java.base/share/native/libjimage/imageFile.hpp: * Copyright (c) 2015, >> 2016 Oracle and/or its affiliates. All rights reserved. >> java.base/share/native/libjimage/NativeImageBuffer.cpp: * Copyright >> (c) 2015, 2016 Oracle and/or its affiliates. All rights reserved. >> java.base/share/native/libjimage/inttypes.hpp: * Copyright (c) 2015, >> 2016 Oracle and/or its affiliates. All rights reserved. >> java.base/share/native/libjimage/endian.hpp: * Copyright (c) 2015, >> 2016 Oracle and/or its affiliates. All rights reserved. >> java.base/share/native/libjimage/jimage.hpp: * Copyright (c) 2015, >> 2016 Oracle and/or its affiliates. All rights reserved. >> java.base/share/native/libjimage/imageFile.cpp: * Copyright (c) 2015, >> 2016 Oracle and/or its affiliates. All rights reserved. >> java.base/share/native/libjimage/jimage.cpp: * Copyright (c) 2015, >> 2016 Oracle and/or its affiliates. All rights reserved. >> java.base/share/native/libjimage/imageDecompressor.hpp: * Copyright >> (c) 2015, 2016 Oracle and/or its affiliates. All rights reserved. >> java.base/share/native/libjimage/endian.cpp: * Copyright (c) 2015, >> 2016 Oracle and/or its affiliates. All rights reserved. >> java.base/share/native/libjimage/imageDecompressor.cpp: * Copyright >> (c) 2015, 2016 Oracle and/or its affiliates. All rights reserved. >> java.base/unix/classes/java/lang/ClassLoaderHelper.java: * Copyright >> (c) 2012, 2015 Oracle and/or its affiliates. All rights reserved. >> java.base/unix/classes/java/net/DefaultDatagramSocketImplFactory.java: >> * Copyright (c) 2007,2011, Oracle and/or its affiliates. All rights >> reserved. >> java.base/windows/classes/java/lang/ClassLoaderHelper.java: * >> Copyright (c) 2012, 2015 Oracle and/or its affiliates. All rights >> reserved. >> java.base/windows/native/libjava/jni_util_md.c: * Copyright (c) 2004, >> 2014 Oracle and/or its affiliates. All rights reserved. >> java.httpclient/share/classes/java/net/http/Pair.java: * Copyright >> (c) 2016 Oracle and/or its affiliates. All rights reserved. >> jdk.charsets/share/classes/sun/nio/cs/ext/Big5_HKSCS.java.template: * >> Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved. >> closed/jdk.snmp/share/classes/sun/management/snmp/resources/snmpagent.properties:# >> Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved. >> closed/jdk.snmp/share/classes/sun/management/snmp/SNMPConfigurationException.java: >> * Copyright (c) 2014 Oracle and/or its affiliates. All rights reserved. >> sample/share/nio/chatserver/Client.java: * Copyright (c) 2011 Oracle >> and/or its affiliates. All rights reserved. >> sample/share/nio/chatserver/ChatServer.java: * Copyright (c) 2011 >> Oracle and/or its affiliates. All rights reserved. >> sample/share/nio/chatserver/NameReader.java: * Copyright (c) 2011 >> Oracle and/or its affiliates. All rights reserved. >> sample/share/nio/chatserver/ClientReader.java: * Copyright (c) 2011 >> Oracle and/or its affiliates. All rights reserved. >> sample/share/nio/chatserver/DataReader.java: * Copyright (c) 2011 >> Oracle and/or its affiliates. All rights reserved. >> sample/share/nio/chatserver/MessageReader.java: * Copyright (c) 2011 >> Oracle and/or its affiliates. All rights reserved. >> >> I'd prefer to see them fixed all at once, if possible. >> >> With kind regards, >> Ivan >> >> >> On 05.07.2016 1:39, Aleks Efimov wrote: >>> Hello, >>> >>> jdk/src/jdk.accessibility/share/classes/com/sun/java/accessibility/util/package-info.java >>> file contains incorrect GPL header which fails >>> make/scripts/lic_check.sh script check. >>> >>> Failure is caused by missing comma after modification years. Please, >>> help to review its addition: >>> http://cr.openjdk.java.net/~aefimov/8154553/ >>> >>> lic_check.sh passes after this modification: >>> ### Checking copyright notice in the file: >>> jdk/src/jdk.accessibility/share/classes/com/sun/java/accessibility/util/package-info.java >>> ### >>> SUCCESS: The license header for >>> jdk/src/jdk.accessibility/share/classes/com/sun/java/accessibility/util/package-info.java >>> has been verified. >>> ### >>> >>> With Best Regards, >>> Aleksej >>> >>> JBS: https://bugs.openjdk.java.net/browse/JDK-8154553 >>> >> > From shilpi.rastogi at oracle.com Tue Jul 5 06:18:12 2016 From: shilpi.rastogi at oracle.com (shilpi.rastogi at oracle.com) Date: Tue, 5 Jul 2016 11:48:12 +0530 Subject: RFR[9]: 8158510: Add test cases to validate Annotation In-Reply-To: <577656EB.8000802@oracle.com> References: <57762686.4030508@oracle.com> <8A1E8CAE-9019-40AD-AA79-2285172631AB@oracle.com> <577656EB.8000802@oracle.com> Message-ID: <577B5124.2010009@oracle.com> Hi All, Please review updated webrev http://cr.openjdk.java.net/~srastogi/8158510/webrev.03/ Regards, Shilpi On 7/1/2016 5:11 PM, shilpi.rastogi at oracle.com wrote: > Thanks Paul !! > > Please see http://cr.openjdk.java.net/~srastogi/8158510/webrev.01/ > > Regards, > Shilpi > > On 7/1/2016 3:12 PM, Paul Sandoz wrote: >> Hi Shilpi, >> >> There is more going on here than just the test since you have >> modified the annotation processing to throw an ISE for an annotation >> type that contains one or more methods that do not define elements. >> That behaviour might be too restrictive. >> >> This is a grey area and implementation specific but i would tend to >> be cautious and avoid changing the current behaviour. Note that the >> original issue was due to javac adding a synthetic de-sugared method >> for a lambda. We don?t know if other byte code generators might do >> something different. >> >> So my recommendation is to limit the testing to the current set of >> possible failures. >> >> Paul. >> >>> On 1 Jul 2016, at 10:15, shilpi.rastogi at oracle.com >>> wrote: >>> >>> Hi All, >>> >>> Please review https://bugs.openjdk.java.net/browse/JDK-8158510 >>> *Problem:* How to validate annotation, as javac does not allow us to >>> write wrong annotation so how should we test valid annotation at >>> runtime? >>> >>> http://cr.openjdk.java.net/~srastogi/8158510/webrev.00/ >>> *Solution:* To test this i used ASM tool and modified the classfile >>> with wrong annotation (not allowed at javac level) and wrote test >>> cases. >>> >>> Thanks, >>> Shilpi >> > From paul.sandoz at oracle.com Tue Jul 5 08:44:00 2016 From: paul.sandoz at oracle.com (Paul Sandoz) Date: Tue, 5 Jul 2016 10:44:00 +0200 Subject: RFR[9]: 8158510: Add test cases to validate Annotation In-Reply-To: <577B5124.2010009@oracle.com> References: <57762686.4030508@oracle.com> <8A1E8CAE-9019-40AD-AA79-2285172631AB@oracle.com> <577656EB.8000802@oracle.com> <577B5124.2010009@oracle.com> Message-ID: <0C17B629-3388-48B4-83C7-FC04C8E25A69@oracle.com> > On 5 Jul 2016, at 08:18, shilpi.rastogi at oracle.com wrote: > > Hi All, > > Please review updated webrev http://cr.openjdk.java.net/~srastogi/8158510/webrev.03/ > +1 Paul. From Alan.Bateman at oracle.com Tue Jul 5 08:48:07 2016 From: Alan.Bateman at oracle.com (Alan Bateman) Date: Tue, 5 Jul 2016 09:48:07 +0100 Subject: RFR[9]: 8158510: Add test cases to validate Annotation In-Reply-To: <0C17B629-3388-48B4-83C7-FC04C8E25A69@oracle.com> References: <57762686.4030508@oracle.com> <8A1E8CAE-9019-40AD-AA79-2285172631AB@oracle.com> <577656EB.8000802@oracle.com> <577B5124.2010009@oracle.com> <0C17B629-3388-48B4-83C7-FC04C8E25A69@oracle.com> Message-ID: On 05/07/2016 09:44, Paul Sandoz wrote: >> On 5 Jul 2016, at 08:18, shilpi.rastogi at oracle.com wrote: >> >> Hi All, >> >> Please review updated webrev http://cr.openjdk.java.net/~srastogi/8158510/webrev.03/ >> > +1 > > Paul. I think the copyright headers will need to be fixed up (to use the GPL headers) before this is pushed. -Alan From shilpi.rastogi at oracle.com Tue Jul 5 09:07:59 2016 From: shilpi.rastogi at oracle.com (shilpi.rastogi at oracle.com) Date: Tue, 5 Jul 2016 14:37:59 +0530 Subject: RFR[9]: 8158510: Add test cases to validate Annotation In-Reply-To: References: <57762686.4030508@oracle.com> <8A1E8CAE-9019-40AD-AA79-2285172631AB@oracle.com> <577656EB.8000802@oracle.com> <577B5124.2010009@oracle.com> <0C17B629-3388-48B4-83C7-FC04C8E25A69@oracle.com> Message-ID: <577B78EF.7020802@oracle.com> Thanks Alan and Paul !! Added the header http://cr.openjdk.java.net/~srastogi/8158510/webrev.04/ Regards, Shilpi On 7/5/2016 2:18 PM, Alan Bateman wrote: > > > On 05/07/2016 09:44, Paul Sandoz wrote: >>> On 5 Jul 2016, at 08:18, shilpi.rastogi at oracle.com wrote: >>> >>> Hi All, >>> >>> Please review updated webrev >>> http://cr.openjdk.java.net/~srastogi/8158510/webrev.03/ >>> >> +1 >> >> Paul. > I think the copyright headers will need to be fixed up (to use the GPL > headers) before this is pushed. > > -Alan From svetlana.nikandrova at oracle.com Tue Jul 5 14:03:26 2016 From: svetlana.nikandrova at oracle.com (Svetlana Nikandrova) Date: Tue, 5 Jul 2016 14:03:26 +0000 (UTC) Subject: RFR 8054213: Class name repeated in output of Type.toString() Message-ID: Joe, I'll be glad to know your opinion. Thank you, Svetlana ----- ???????? ????????? ----- ??: svetlana.nikandrova at oracle.com ????: joe.darcy at oracle.com ?????: core-libs-dev at openjdk.java.net ????????????: ???????, 30 ???? 2016 ? 19:45:24 GMT +03:00 ???? ????: Re: RFR 8054213: Class name repeated in output of Type.toString() Hello Joe, thank you for your advice! GenericStringTest looks really good with annotations. I refactored my test, please see updated webrev: http://cr.openjdk.java.net/~snikandrova/8054213/webrev.01/ As for "." vs "$" let me provide an example: E.g. we have class public classTest { publicNested1.Nested2 foo() { return null; } public classNested1 { public classNested2{} } } The output of the System.out.println(Test.class.getMethod("foo",null).getReturnType()); Output: class Test$Nested1$Nested2 (nested classes divided by "$") while System.out.println(Test.class.getMethod("foo",null).getGenericReturnType()); Output: Test$Nested1.Nested2(nested classes divided by "." if enclosed by parametrized type and "$" in other cases). I think it's a little bit strange to have different separators for inner classes depended on is it nested by parametrized or raw type. Thank you, Svetlana On 28.06.2016 22:02, joe darcy wrote: > Hello Svetlana, > > I'm not convinced '$' should be replaced with '.' in this context as > '.' is what the separator used in source code. > > In any case, the test should be restructured. I recommend declaring an > annotation type to hold the expected to string output. You can them > loop over the methods from the class object and for the methods with > the annotation verifying the toString output is as expected. For a > guide see > > test/java/lang/reflect/Constructor/GenericStringTest.java > > Thanks, > > -Joe > > > On 6/28/2016 11:25 AM, Svetlana Nikandrova wrote: >> May be someone can find a minute? >> >> On 27.06.2016 21:25, Svetlana Nikandrova wrote: >>> Kindly reminder >>> >>> On 24.06.2016 14:58, Svetlana Nikandrova wrote: >>>> Hello, >>>> >>>> let me try again with updated version of webrev: >>>> Webrev: >>>> http://cr.openjdk.java.net/~snikandrova/8054213/webrev.01/ >>>> >>>> Issue: >>>> https://bugs.openjdk.java.net/browse/JDK-8054213 >>>> >>>> Many thanks goes to Sergey Ustimenko for his valuable advises. I >>>> believe fix looks nicer now. >>>> JPRT tested. >>>> >>>> Thank you, >>>> Svetlana >>>> >>>> On 17.06.2016 21:45, Svetlana Nikandrova wrote: >>>>> Hello, >>>>> >>>>> could you please review this fix for toString() method of >>>>> ParameterizedTypeImpl. >>>>> The problem is that when we obtain simple name of nested type >>>>> shared prefix is only removed for ParameterizedType owner. We need >>>>> to remove it for other cases too. >>>>> >>>>> Please note that I also changed delimiter between outer and inner >>>>> class from "." to "$". I believe as "$" is usually used to >>>>> separate nested class name "." looks inconsistent and confusing. >>>>> Let me know if you have any objections. >>>>> >>>>> Webrev: >>>>> http://cr.openjdk.java.net/~msolovie/8054213/webrev.00/ >>>>> >>>>> Issue: >>>>> https://bugs.openjdk.java.net/browse/JDK-8054213 >>>>> >>>>> Thank you, >>>>> Svetlana >>>> >>> >> > From james.laskey at oracle.com Tue Jul 5 14:18:53 2016 From: james.laskey at oracle.com (Jim Laskey (Oracle)) Date: Tue, 5 Jul 2016 11:18:53 -0300 Subject: RFR: JDK-8160829 - Remove ASMPool support from jlink Message-ID: <11A2AA9E-00EB-46B6-A750-D08AC8A7E8DF@oracle.com> Much of the removed code seems unnecessary since the same functionality can be accomplished with much simpler code. An example is provided with ClassForNamePlugin.java (temporary.) A shipping byte code optimizer plugin will be supplied later. Additional changes to the plugin API will supply a cross resource resolver that will make byte code optimizing code even simpler. http://cr.openjdk.java.net/~jlaskey/8160829/webrev/index.html https://bugs.openjdk.java.net/browse/JDK-8160829 From forax at univ-mlv.fr Tue Jul 5 14:26:58 2016 From: forax at univ-mlv.fr (Remi Forax) Date: Tue, 5 Jul 2016 16:26:58 +0200 (CEST) Subject: RFR: JDK-8160829 - Remove ASMPool support from jlink In-Reply-To: <11A2AA9E-00EB-46B6-A750-D08AC8A7E8DF@oracle.com> References: <11A2AA9E-00EB-46B6-A750-D08AC8A7E8DF@oracle.com> Message-ID: <555129353.999602.1467728818956.JavaMail.zimbra@u-pem.fr> Hi jim, This code had a dependency of the private copy of ASM, so +1 to remove it. R?mi ----- Mail original ----- > De: "Jim Laskey (Oracle)" > ?: "jigsaw-dev" , "core-libs-dev" > Envoy?: Mardi 5 Juillet 2016 16:18:53 > Objet: RFR: JDK-8160829 - Remove ASMPool support from jlink > > Much of the removed code seems unnecessary since the same functionality can > be accomplished with much simpler code. An example is provided with > ClassForNamePlugin.java (temporary.) A shipping byte code optimizer plugin > will be supplied later. Additional changes to the plugin API will supply a > cross resource resolver that will make byte code optimizing code even > simpler. > > http://cr.openjdk.java.net/~jlaskey/8160829/webrev/index.html > https://bugs.openjdk.java.net/browse/JDK-8160829 > > > From paul.sandoz at oracle.com Tue Jul 5 14:56:45 2016 From: paul.sandoz at oracle.com (Paul Sandoz) Date: Tue, 5 Jul 2016 16:56:45 +0200 Subject: RFR: JDK-8160829 - Remove ASMPool support from jlink In-Reply-To: <11A2AA9E-00EB-46B6-A750-D08AC8A7E8DF@oracle.com> References: <11A2AA9E-00EB-46B6-A750-D08AC8A7E8DF@oracle.com> Message-ID: <2DB4C7E3-13E0-486D-8AB9-BD128173C801@oracle.com> > On 5 Jul 2016, at 16:18, Jim Laskey (Oracle) wrote: > > Much of the removed code seems unnecessary since the same functionality can be accomplished with much simpler code. An example is provided with ClassForNamePlugin.java (temporary.) A shipping byte code optimizer plugin will be supplied later. Additional changes to the plugin API will supply a cross resource resolver that will make byte code optimizing code even simpler. > > http://cr.openjdk.java.net/~jlaskey/8160829/webrev/index.html > https://bugs.openjdk.java.net/browse/JDK-8160829 > > +1 on removing the more general meta-kind of plugin. Since ClassForNamePlugin.java is temporary i will resist commenting on the implementation approach, which as you might guess focuses on the generation of the Map :-) Paul. From Roger.Riggs at Oracle.com Tue Jul 5 19:29:19 2016 From: Roger.Riggs at Oracle.com (Roger Riggs) Date: Tue, 5 Jul 2016 15:29:19 -0400 Subject: RFR 9: 8160848 : Add diagnostics to java/lang/ProcessBuilder/Zombies Message-ID: <2baa4d20-9070-607f-1d47-68c26bc63b7e@Oracle.com> Please review adding diagnostics to an intermittently failing test; java/lang/ProcessBuilder/Zombies.java. Recently, the Zombies test has started intermittently reporting 1 Zombies errors on Solaris. Webrev: http://cr.openjdk.java.net/~rriggs/webrev-zombies-8160848/ The original issue is open pending more information: https://bugs.openjdk.java.net/browse/JDK-8160151 Thanks, Roger From martinrb at google.com Tue Jul 5 19:38:43 2016 From: martinrb at google.com (Martin Buchholz) Date: Tue, 5 Jul 2016 12:38:43 -0700 Subject: RFR 9: 8160848 : Add diagnostics to java/lang/ProcessBuilder/Zombies In-Reply-To: <2baa4d20-9070-607f-1d47-68c26bc63b7e@Oracle.com> References: <2baa4d20-9070-607f-1d47-68c26bc63b7e@Oracle.com> Message-ID: Instead of unconditionally printing, why not print only when a zombie is discovered? All the information should still be available, I think... here's some misleading indentation... + p2.waitFor(); + throw new Error(zombies + " zombies!"); On Tue, Jul 5, 2016 at 12:29 PM, Roger Riggs wrote: > Please review adding diagnostics to an intermittently failing test; > java/lang/ProcessBuilder/Zombies.java. > > Recently, the Zombies test has started intermittently reporting 1 Zombies > errors on Solaris. > > Webrev: > http://cr.openjdk.java.net/~rriggs/webrev-zombies-8160848/ > > The original issue is open pending more information: > https://bugs.openjdk.java.net/browse/JDK-8160151 > > Thanks, Roger > > From Roger.Riggs at Oracle.com Tue Jul 5 20:19:27 2016 From: Roger.Riggs at Oracle.com (Roger Riggs) Date: Tue, 5 Jul 2016 16:19:27 -0400 Subject: RFR 9: 8160848 : Add diagnostics to java/lang/ProcessBuilder/Zombies In-Reply-To: References: <2baa4d20-9070-607f-1d47-68c26bc63b7e@Oracle.com> Message-ID: Hi Martin, On 7/5/2016 3:38 PM, Martin Buchholz wrote: > Instead of unconditionally printing, why not print only when a zombie > is discovered? All the information should still be available, I think... I'm not sure what to trust since this has not been an issue until recently. In some local tests, the parent came back empty; that's probably normal in the case where the process is/has already terminated. One recent change on Solaris just before the first appearance was: 8155808 Process.getInputStream().skip() method is faulty Which should only get involved when there is standard output. The Zombies test does not consume standard out. But I'll need to look into that to see how the exit value from the perl script could be affected by the change. > > here's some misleading indentation... > > + p2.waitFor(); > + throw new Error(zombies + " zombies!"); fixed, I did some of the editing on solaris with an emacs using hard tabs. Thanks, Roger > > > On Tue, Jul 5, 2016 at 12:29 PM, Roger Riggs > wrote: > > Please review adding diagnostics to an intermittently failing > test; java/lang/ProcessBuilder/Zombies.java. > > Recently, the Zombies test has started intermittently reporting 1 > Zombies errors on Solaris. > > Webrev: > http://cr.openjdk.java.net/~rriggs/webrev-zombies-8160848/ > > > The original issue is open pending more information: > https://bugs.openjdk.java.net/browse/JDK-8160151 > > Thanks, Roger > > From martinrb at google.com Tue Jul 5 20:30:54 2016 From: martinrb at google.com (Martin Buchholz) Date: Tue, 5 Jul 2016 13:30:54 -0700 Subject: RFR 9: 8160848 : Add diagnostics to java/lang/ProcessBuilder/Zombies In-Reply-To: References: <2baa4d20-9070-607f-1d47-68c26bc63b7e@Oracle.com> Message-ID: OK, looks good. Good luck debugging! On Tue, Jul 5, 2016 at 1:19 PM, Roger Riggs wrote: > Hi Martin, > > On 7/5/2016 3:38 PM, Martin Buchholz wrote: > > Instead of unconditionally printing, why not print only when a zombie is > discovered? All the information should still be available, I think... > > I'm not sure what to trust since this has not been an issue until recently. > In some local tests, the parent came back empty; that's probably normal in > the case where the process is/has already terminated. > > One recent change on Solaris just before the first appearance was: > 8155808 Process.getInputStream().skip() method is faulty > > > Which should only get involved when there is standard output. The Zombies > test does not consume standard out. > But I'll need to look into that to see how the exit value from the perl > script could be affected by the change. > > > here's some misleading indentation... > > + p2.waitFor(); > + throw new Error(zombies + " zombies!"); > > fixed, I did some of the editing on solaris with an emacs using hard tabs. > > Thanks, Roger > > > > On Tue, Jul 5, 2016 at 12:29 PM, Roger Riggs > wrote: > >> Please review adding diagnostics to an intermittently failing test; >> java/lang/ProcessBuilder/Zombies.java. >> >> Recently, the Zombies test has started intermittently reporting 1 Zombies >> errors on Solaris. >> >> Webrev: >> http://cr.openjdk.java.net/~rriggs/webrev-zombies-8160848/ >> >> The original issue is open pending more information: >> https://bugs.openjdk.java.net/browse/JDK-8160151 >> >> Thanks, Roger >> >> > > From martinrb at google.com Wed Jul 6 03:12:58 2016 From: martinrb at google.com (Martin Buchholz) Date: Tue, 5 Jul 2016 20:12:58 -0700 Subject: Semantics of VarHandle CAS methods In-Reply-To: References: <5774CC2D.4020902@redhat.com> <10463D1D-8922-41E3-B138-529E396E77B6@oracle.com> <57750029.9080400@cs.oswego.edu> Message-ID: On Thu, Jun 30, 2016 at 10:54 AM, Hans Boehm wrote: > > On Thu, Jun 30, 2016 at 7:59 AM, Martin Buchholz > wrote: > > One concrete proposal that removes a method: > > > > Replace > > weakCompareAndSetAcquire and weakCompareAndSetRelease with > > weakCompareAndSetAcquireRelease > > Using standard implementation recipes, the AcquireRelease version is > significantly > more expensive on Power and ARM, and there are many cases (e.g. > implementing > lock acquisition or lock release) where you only need one. I'd be > hesitant to do that. > You've mostly convinced me. The C++ standard is not entirely clear on this, but a cas with m_o_release does a relaxed read, and similarly cas with m_o_acquire does a relaxed write, corresponding to our weakCompareAndSetRelease and weakCompareAndSetAcquire. Let's see if I can argue against my own suggestion weakCompareAndSetAcquireRelease: you usually read the old value before the cas, and if you want the acquire, you generally want it then! So the natural sequence would be: r1 = x.getAcquire(); r2 = f(r1); // reads through r1 x.weakCompareAndSetRelease(r1, r2); From martinrb at google.com Wed Jul 6 04:18:21 2016 From: martinrb at google.com (Martin Buchholz) Date: Tue, 5 Jul 2016 21:18:21 -0700 Subject: Semantics of VarHandle CAS methods In-Reply-To: References: <5774CC2D.4020902@redhat.com> <10463D1D-8922-41E3-B138-529E396E77B6@oracle.com> <57750029.9080400@cs.oswego.edu> Message-ID: On Thu, Jun 30, 2016 at 10:54 AM, Hans Boehm wrote: > > > In C++ we have sequential consistency of the single memory location > holding > > an atomic (cache coherence). Should we say something about locations > > updated via a VarHandle? If you call weakCompareAndSetAcquire, then the > > spec says the write is a "plain write", but some kind of cache coherence > > seems inherent in the idea of a compareAndSet, so the write itself has to > > be complete and visible. > > I completely agree that we need to be clear about cache coherence, and not > just for CAS. > I think a lot of code cares whether these operations are cache coherent or > not. > > One could argue that the relaxed operations refer to ordinary Java memory > semantics > and are thus clearly not cache coherent, unlike memory_order_relaxed in > C++. > > But I think this also shows up with acquire release as well. Using > acquire/release get/set > everywhere, can I get > > Thread 1: > x = 1; > r1 = x (sees 2) > > Thread 2: > x = 2; > r1 = x (sees 1) ? > > I think this is entirely consistent with happens-before constraints. But > it is rather mind-bending, > in that, no matter what the final value turns out to be after the threads > join, it will look to one > thread like the value of x changed twice. This behavior is disallowed in > C++, even for > memory_order_relaxed. > I agree acquire-release allows this. My intuition is that a release protects preceding actions and makes them visible ("publishes") to the reader. Similarly an acquire protects subsequent actions and makes the writer's actions visible. But in the example there are no such actions! So we're reduced to m_o_relaxed. Whenever it's not too expensive, we should offer sequential consistency. C++ provides sequential consistency for atomic operations on a single location. Java probably can and should do the same for corresponding operations. But what are these corresponding operations? Any access via a VarHandle (including plain?) or via a volatile variable? From huaming.li at oracle.com Wed Jul 6 04:55:35 2016 From: huaming.li at oracle.com (Hamlin Li) Date: Wed, 6 Jul 2016 12:55:35 +0800 Subject: RFR of JDK-8160866: IntPrimitiveOpsTests.java still in ProblemList.txt while related bug has been closed Message-ID: Would you please review the following patch which remove IntPrimitiveOpsTests.java from ProblemList.txt? bug: https://bugs.openjdk.java.net/browse/JDK-8160866 webrev: http://cr.openjdk.java.net/~mli/8160866/webrev.00/ Thank you -Hamlin From michael.haupt at oracle.com Wed Jul 6 06:57:17 2016 From: michael.haupt at oracle.com (Michael Haupt) Date: Wed, 6 Jul 2016 08:57:17 +0200 Subject: RFR of JDK-8160866: IntPrimitiveOpsTests.java still in ProblemList.txt while related bug has been closed In-Reply-To: References: Message-ID: <023793BD-9EFE-49A6-92A9-86DA35F67B0E@oracle.com> Hi Hamlin, thumbs up. Best, Michael > Am 06.07.2016 um 06:55 schrieb Hamlin Li : > > Would you please review the following patch which remove IntPrimitiveOpsTests.java from ProblemList.txt? > > bug: https://bugs.openjdk.java.net/browse/JDK-8160866 > webrev: http://cr.openjdk.java.net/~mli/8160866/webrev.00/ > > Thank you > -Hamlin -- Dr. Michael Haupt | Principal Member of Technical Staff Phone: +49 331 200 7277 | Fax: +49 331 200 7561 Oracle Java Platform Group | LangTools Team | Nashorn Oracle Deutschland B.V. & Co. KG | Schiffbauergasse 14 | 14467 Potsdam, Germany ORACLE Deutschland B.V. & Co. KG | Hauptverwaltung: Riesstra?e 25, D-80992 M?nchen Registergericht: Amtsgericht M?nchen, HRA 95603 Komplement?rin: ORACLE Deutschland Verwaltung B.V. | Hertogswetering 163/167, 3543 AS Utrecht, Niederlande Handelsregister der Handelskammer Midden-Nederland, Nr. 30143697 Gesch?ftsf?hrer: Alexander van der Ven, Jan Schultheiss, Val Maher Oracle is committed to developing practices and products that help protect the environment From michael.haupt at oracle.com Wed Jul 6 07:50:33 2016 From: michael.haupt at oracle.com (Michael Haupt) Date: Wed, 6 Jul 2016 09:50:33 +0200 Subject: RFR(S): 8160717: MethodHandles.loop() does not check for excessive signature Message-ID: Dear all, please review this fix. Bug: https://bugs.openjdk.java.net/browse/JDK-8160717 Webrev: http://cr.openjdk.java.net/~mhaupt/8160717/webrev.00/ The fix captures failures during bytecode generation and marks the respective LambdaForms as permanently executable in LF interpretation mode only. The fix also introduces two debugging aids: -Djava.lang.invoke.MethodHandle.LOG_LF_COMPILATION_FAILURE: if set to true (default is false), LF compilation failures will be logged to the console. The PerfCounter java.lang.invoke.failedLambdaFormCompilations tracks failing LF compilations. It can be printed with jstat -J-Djstat.showUnsupported=true -snap -a file://.... Best, Michael -- Dr. Michael Haupt | Principal Member of Technical Staff Phone: +49 331 200 7277 | Fax: +49 331 200 7561 Oracle Java Platform Group | LangTools Team | Nashorn Oracle Deutschland B.V. & Co. KG | Schiffbauergasse 14 | 14467 Potsdam, Germany ORACLE Deutschland B.V. & Co. KG | Hauptverwaltung: Riesstra?e 25, D-80992 M?nchen Registergericht: Amtsgericht M?nchen, HRA 95603 Komplement?rin: ORACLE Deutschland Verwaltung B.V. | Hertogswetering 163/167, 3543 AS Utrecht, Niederlande Handelsregister der Handelskammer Midden-Nederland, Nr. 30143697 Gesch?ftsf?hrer: Alexander van der Ven, Jan Schultheiss, Val Maher Oracle is committed to developing practices and products that help protect the environment From andrej.golovnin at gmail.com Wed Jul 6 08:25:29 2016 From: andrej.golovnin at gmail.com (Andrej Golovnin) Date: Wed, 6 Jul 2016 10:25:29 +0200 Subject: RFR(S): 8160717: MethodHandles.loop() does not check for excessive signature In-Reply-To: References: Message-ID: Hi Michael, src/java.base/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java The class BytecodeGenerationException should be final. 767 static final long serialVersionUID = -1L; // no serialisation Just because you set serialVersionUID to -1L, it does not mean that it is not serializable. Either remove the comment "// no serialisation" or remove the serialVersionUID at all because you never serialize this exception. And btw. serialVersionUID should be private if you decide to keep it. You use the BytecodeGenerationException only as a wrapper. Therefore I would override the fillInStackTrace()-method and make it empty. And later in the class LambdaForm I would just print the cause of BytecodeGenerationException. src/java.base/share/classes/java/lang/invoke/LambdaForm.java In the line 739 the field LF_FAILED should be final. Best regards, Andrej Golovnin From michael.haupt at oracle.com Wed Jul 6 08:43:27 2016 From: michael.haupt at oracle.com (Michael Haupt) Date: Wed, 6 Jul 2016 10:43:27 +0200 Subject: RFR(S): 8160717: MethodHandles.loop() does not check for excessive signature In-Reply-To: References: Message-ID: <3DA0031E-342A-462A-8863-2891A531E264@oracle.com> Hi Andrej, thanks for your remarks; see below for a comment. In addition, I need an upper-case Review, please. > Am 06.07.2016 um 10:25 schrieb Andrej Golovnin : > 767 static final long serialVersionUID = -1L; // no serialisation > > Just because you set serialVersionUID to -1L, it does not mean that it > is not serializable. Either remove the comment "// no serialisation" > or remove the serialVersionUID at all because you never serialize this > exception. And btw. serialVersionUID should be private if you decide > to keep it. I know that setting the field to -1 does not hinder serialisation. The comment was intended to make clear that no serialisation of instances of this class will ever happen. I'll make that more clear. Omitting the field is not possible; the compiler will complain. Having serialVersionUID is enforced in the build. Best, Michael -- Dr. Michael Haupt | Principal Member of Technical Staff Phone: +49 331 200 7277 | Fax: +49 331 200 7561 Oracle Java Platform Group | LangTools Team | Nashorn Oracle Deutschland B.V. & Co. KG | Schiffbauergasse 14 | 14467 Potsdam, Germany ORACLE Deutschland B.V. & Co. KG | Hauptverwaltung: Riesstra?e 25, D-80992 M?nchen Registergericht: Amtsgericht M?nchen, HRA 95603 Komplement?rin: ORACLE Deutschland Verwaltung B.V. | Hertogswetering 163/167, 3543 AS Utrecht, Niederlande Handelsregister der Handelskammer Midden-Nederland, Nr. 30143697 Gesch?ftsf?hrer: Alexander van der Ven, Jan Schultheiss, Val Maher Oracle is committed to developing practices and products that help protect the environment From paul.sandoz at oracle.com Wed Jul 6 09:30:32 2016 From: paul.sandoz at oracle.com (Paul Sandoz) Date: Wed, 6 Jul 2016 11:30:32 +0200 Subject: RFR(S): 8160717: MethodHandles.loop() does not check for excessive signature In-Reply-To: <3DA0031E-342A-462A-8863-2891A531E264@oracle.com> References: <3DA0031E-342A-462A-8863-2891A531E264@oracle.com> Message-ID: <2E767884-0883-4311-852E-2428BF3109DF@oracle.com> > On 6 Jul 2016, at 10:43, Michael Haupt wrote: > > Hi Andrej, > > thanks for your remarks; see below for a comment. > > In addition, I need an upper-case Review, please. I am concerned that PerfCounter will introduce more dependencies and overhead to startup. Notice for other usages PerfCounter instances are lazily created. This seems a nice to have, but i think is not strictly necessary given this is not something that occurs all the time and is triggered more so by edge case limits producing incorrect byte code, or perhaps actual errors in code generation. i.e. it?s association with performance counters seems a little fuzzy compared to the other usages. Is it correct to say we can differentiate between the two cases. If so the danger is that we add another intrinsic and don?t realize it contains an actual error and we notice too late when we observe performance falling off a cliff. > >> Am 06.07.2016 um 10:25 schrieb Andrej Golovnin : >> 767 static final long serialVersionUID = -1L; // no serialisation >> >> Just because you set serialVersionUID to -1L, it does not mean that it >> is not serializable. Either remove the comment "// no serialisation" >> or remove the serialVersionUID at all because you never serialize this >> exception. And btw. serialVersionUID should be private if you decide >> to keep it. > > I know that setting the field to -1 does not hinder serialisation. The comment was intended to make clear that no serialisation of instances of this class will ever happen. I'll make that more clear. Omitting the field is not possible; the compiler will complain. Having serialVersionUID is enforced in the build. > You should be able to use the following on the exception class: @SuppressWarnings("serial?) Paul. From michael.haupt at oracle.com Wed Jul 6 10:04:49 2016 From: michael.haupt at oracle.com (Michael Haupt) Date: Wed, 6 Jul 2016 12:04:49 +0200 Subject: RFR(S): 8160717: MethodHandles.loop() does not check for excessive signature In-Reply-To: <2E767884-0883-4311-852E-2428BF3109DF@oracle.com> References: <3DA0031E-342A-462A-8863-2891A531E264@oracle.com> <2E767884-0883-4311-852E-2428BF3109DF@oracle.com> Message-ID: <75B795B7-9D0A-4A3A-B9BF-3ED0B005C7C0@oracle.com> Hi Paul, thanks for your comments. Lazy initialisation of the PerfCounter is good, as is the warning suppression. I'll let Claes comment on the broader PerfCounter question, as he suggested using them. I think PerfCounter is a convenient abstraction for what we want to achieve, but the way it's used here may smell a bit abusive. What do you mean with "differentiate between the two cases"? Assuming it's Error/Exception vs. BytecodeGenerationException, here's the current rationale. There are cases when it makes sense to fall back to LFI, e.g., when, as here, methods grow too large. In many other cases it is justified to bail altogether with an InternalError. Wrapping cw.toClassBytes() is a first approximation. Best, Michael > Am 06.07.2016 um 11:30 schrieb Paul Sandoz : > > >> On 6 Jul 2016, at 10:43, Michael Haupt wrote: >> >> Hi Andrej, >> >> thanks for your remarks; see below for a comment. >> >> In addition, I need an upper-case Review, please. > > I am concerned that PerfCounter will introduce more dependencies and overhead to startup. > > Notice for other usages PerfCounter instances are lazily created. > > This seems a nice to have, but i think is not strictly necessary given this is not something that occurs all the time and is triggered more so by edge case limits producing incorrect byte code, or perhaps actual errors in code generation. i.e. it?s association with performance counters seems a little fuzzy compared to the other usages. > > Is it correct to say we can differentiate between the two cases. If so the danger is that we add another intrinsic and don?t realize it contains an actual error and we notice too late when we observe performance falling off a cliff. > > >> >>> Am 06.07.2016 um 10:25 schrieb Andrej Golovnin : >>> 767 static final long serialVersionUID = -1L; // no serialisation >>> >>> Just because you set serialVersionUID to -1L, it does not mean that it >>> is not serializable. Either remove the comment "// no serialisation" >>> or remove the serialVersionUID at all because you never serialize this >>> exception. And btw. serialVersionUID should be private if you decide >>> to keep it. >> >> I know that setting the field to -1 does not hinder serialisation. The comment was intended to make clear that no serialisation of instances of this class will ever happen. I'll make that more clear. Omitting the field is not possible; the compiler will complain. Having serialVersionUID is enforced in the build. >> > > You should be able to use the following on the exception class: > > @SuppressWarnings("serial?) > > Paul. -- Dr. Michael Haupt | Principal Member of Technical Staff Phone: +49 331 200 7277 | Fax: +49 331 200 7561 Oracle Java Platform Group | LangTools Team | Nashorn Oracle Deutschland B.V. & Co. KG | Schiffbauergasse 14 | 14467 Potsdam, Germany ORACLE Deutschland B.V. & Co. KG | Hauptverwaltung: Riesstra?e 25, D-80992 M?nchen Registergericht: Amtsgericht M?nchen, HRA 95603 Komplement?rin: ORACLE Deutschland Verwaltung B.V. | Hertogswetering 163/167, 3543 AS Utrecht, Niederlande Handelsregister der Handelskammer Midden-Nederland, Nr. 30143697 Gesch?ftsf?hrer: Alexander van der Ven, Jan Schultheiss, Val Maher Oracle is committed to developing practices and products that help protect the environment From paul.sandoz at oracle.com Wed Jul 6 10:45:42 2016 From: paul.sandoz at oracle.com (Paul Sandoz) Date: Wed, 6 Jul 2016 12:45:42 +0200 Subject: RFR(S): 8160717: MethodHandles.loop() does not check for excessive signature In-Reply-To: <75B795B7-9D0A-4A3A-B9BF-3ED0B005C7C0@oracle.com> References: <3DA0031E-342A-462A-8863-2891A531E264@oracle.com> <2E767884-0883-4311-852E-2428BF3109DF@oracle.com> <75B795B7-9D0A-4A3A-B9BF-3ED0B005C7C0@oracle.com> Message-ID: > On 6 Jul 2016, at 12:04, Michael Haupt wrote: > > Hi Paul, > > thanks for your comments. > > Lazy initialisation of the PerfCounter is good, as is the warning suppression. > > I'll let Claes comment on the broader PerfCounter question, as he suggested using them. I think PerfCounter is a convenient abstraction for what we want to achieve, but the way it's used here may smell a bit abusive. > Ok. > What do you mean with "differentiate between the two cases"? Assuming it's Error/Exception vs. BytecodeGenerationException, here's the current rationale. There are cases when it makes sense to fall back to LFI, e.g., when, as here, methods grow too large. In many other cases it is justified to bail altogether with an InternalError. Wrapping cw.toClassBytes() is a first approximation. > I meant to say: >> Is it correct to say we *cannot* differentiate between the two cases. If so the danger is that we add another intrinsic and don?t realize it contains an actual error and we notice too late when we observe performance falling off a cliff. > I don?t know if we can differentiate between a valid error (reaching the certain byte code limits) and an unexpected error where say we add a new intrinsic and its code generation is faulty causing ASM to throw RuntimeException. A wild thought: is there anyway to add some context/data to the ASM processing indicating what intrinsic is being processed, so when you get the exception you can at least differentiate. Paul. From claes.redestad at oracle.com Wed Jul 6 11:31:50 2016 From: claes.redestad at oracle.com (Claes Redestad) Date: Wed, 6 Jul 2016 13:31:50 +0200 Subject: RFR(S): 8160717: MethodHandles.loop() does not check for excessive signature In-Reply-To: References: <3DA0031E-342A-462A-8863-2891A531E264@oracle.com> <2E767884-0883-4311-852E-2428BF3109DF@oracle.com> <75B795B7-9D0A-4A3A-B9BF-3ED0B005C7C0@oracle.com> Message-ID: <577CEC26.7040407@oracle.com> On 2016-07-06 12:45, Paul Sandoz wrote: > >> On 6 Jul 2016, at 12:04, Michael Haupt wrote: >> >> Hi Paul, >> >> thanks for your comments. >> >> Lazy initialisation of the PerfCounter is good, as is the warning suppression. >> >> I'll let Claes comment on the broader PerfCounter question, as he suggested using them. I think PerfCounter is a convenient abstraction for what we want to achieve, but the way it's used here may smell a bit abusive. >> > > Ok. I know of a number of Java-side PerfCounters created early (and they're rather lean on dependencies in the first place, a select number of j.u.c.atomic classes IIRC), so I wouldn't worry about much of a startup penalty here. Lazy initialization might not save us much, and would hide the counter from showing up. I guess what I'm saying is I'm good with webrev.00. :-) > > >> What do you mean with "differentiate between the two cases"? Assuming it's Error/Exception vs. BytecodeGenerationException, here's the current rationale. There are cases when it makes sense to fall back to LFI, e.g., when, as here, methods grow too large. In many other cases it is justified to bail altogether with an InternalError. Wrapping cw.toClassBytes() is a first approximation. >> > > I meant to say: > >>> Is it correct to say we *cannot* differentiate between the two cases. If so the danger is that we add another intrinsic and don?t realize it contains an actual error and we notice too late when we observe performance falling off a cliff. >> > > > I don?t know if we can differentiate between a valid error (reaching the certain byte code limits) and an unexpected error where say we add a new intrinsic and its code generation is faulty causing ASM to throw RuntimeException. > > A wild thought: is there anyway to add some context/data to the ASM processing indicating what intrinsic is being processed, so when you get the exception you can at least differentiate. While out of scope for this change, maybe we should seek to improve robustness by asking the ASM project to add more distinctive exceptions, say, create a MethodTooLargeException or similar, in which case we could change the catch to be more specific. /Claes > > Paul. > From michael.haupt at oracle.com Wed Jul 6 12:32:36 2016 From: michael.haupt at oracle.com (Michael Haupt) Date: Wed, 6 Jul 2016 14:32:36 +0200 Subject: RFR(S): 8160717: MethodHandles.loop() does not check for excessive signature In-Reply-To: References: <3DA0031E-342A-462A-8863-2891A531E264@oracle.com> <2E767884-0883-4311-852E-2428BF3109DF@oracle.com> <75B795B7-9D0A-4A3A-B9BF-3ED0B005C7C0@oracle.com> Message-ID: <8B86A97A-D8B0-476A-A34C-60D4ACD2E626@oracle.com> Hi Paul, > Am 06.07.2016 um 12:45 schrieb Paul Sandoz : >> What do you mean with "differentiate between the two cases"? Assuming it's Error/Exception vs. BytecodeGenerationException, here's the current rationale. There are cases when it makes sense to fall back to LFI, e.g., when, as here, methods grow too large. In many other cases it is justified to bail altogether with an InternalError. Wrapping cw.toClassBytes() is a first approximation. >> > > I meant to say: > >>> Is it correct to say we *cannot* differentiate between the two cases. If so the danger is that we add another intrinsic and don?t realize it contains an actual error and we notice too late when we observe performance falling off a cliff. > > > I don?t know if we can differentiate between a valid error (reaching the certain byte code limits) and an unexpected error where say we add a new intrinsic and its code generation is faulty causing ASM to throw RuntimeException. > > A wild thought: is there anyway to add some context/data to the ASM processing indicating what intrinsic is being processed, so when you get the exception you can at least differentiate. thanks for clarifying that. The way it's implemented now treats anything that occurs during bytecode assembly as a Real Problem and consequently raises an InternalError. Any RuntimeException raised from ASM during class file generation (cw.toByteArray()) is treated as a problem that should imply falling back to LFI mode. Given ASM only throws RuntimeExceptions, their messages could be used to distinguish between problem types, but that is brittle. It is definitely possible to attach additional information, such as the current LambdaForm or Intrinsic, to the wrapping exception, but the approach does not scale very well. There is, in principle, nothing that prevents a LambdaForm from containing multiple intrinsifiable idioms in a row. When a problem arises only during class file generation, it will not be easy to trace that back to the problematic intrinsic. Also, inlining at LF level is conceivable, complicating the matter further. Best, Michael -- Dr. Michael Haupt | Principal Member of Technical Staff Phone: +49 331 200 7277 | Fax: +49 331 200 7561 Oracle Java Platform Group | LangTools Team | Nashorn Oracle Deutschland B.V. & Co. KG | Schiffbauergasse 14 | 14467 Potsdam, Germany ORACLE Deutschland B.V. & Co. KG | Hauptverwaltung: Riesstra?e 25, D-80992 M?nchen Registergericht: Amtsgericht M?nchen, HRA 95603 Komplement?rin: ORACLE Deutschland Verwaltung B.V. | Hertogswetering 163/167, 3543 AS Utrecht, Niederlande Handelsregister der Handelskammer Midden-Nederland, Nr. 30143697 Gesch?ftsf?hrer: Alexander van der Ven, Jan Schultheiss, Val Maher Oracle is committed to developing practices and products that help protect the environment From michael.haupt at oracle.com Wed Jul 6 12:55:16 2016 From: michael.haupt at oracle.com (Michael Haupt) Date: Wed, 6 Jul 2016 14:55:16 +0200 Subject: RFR(S): 8160717: MethodHandles.loop() does not check for excessive signature In-Reply-To: <577CEC26.7040407@oracle.com> References: <3DA0031E-342A-462A-8863-2891A531E264@oracle.com> <2E767884-0883-4311-852E-2428BF3109DF@oracle.com> <75B795B7-9D0A-4A3A-B9BF-3ED0B005C7C0@oracle.com> <577CEC26.7040407@oracle.com> Message-ID: <9C7EF295-A5F8-42EF-B77E-7D55F20ECAE7@oracle.com> Hi Claes, > Am 06.07.2016 um 13:31 schrieb Claes Redestad : >>> I'll let Claes comment on the broader PerfCounter question, as he suggested using them. I think PerfCounter is a convenient abstraction for what we want to achieve, but the way it's used here may smell a bit abusive. >>> >> >> Ok. > > I know of a number of Java-side PerfCounters created early (and they're rather lean on dependencies in the first place, a select number of j.u.c.atomic classes IIRC), so I wouldn't worry about much of a startup penalty here. > > Lazy initialization might not save us much, and would hide the counter from showing up. > > I guess what I'm saying is I'm good with webrev.00. :-) thank you - some sensible improvements notwithstanding; see http://cr.openjdk.java.net/~mhaupt/8160717/webrev.01/. >> A wild thought: is there anyway to add some context/data to the ASM processing indicating what intrinsic is being processed, so when you get the exception you can at least differentiate. > > While out of scope for this change, maybe we should seek to improve robustness by asking the ASM project to add more distinctive exceptions, say, create a MethodTooLargeException or similar, in which case we could change the catch to be more specific. Four thumbs up: domain-specific meaningful exceptions are A Good Thing. Best, Michael -- Dr. Michael Haupt | Principal Member of Technical Staff Phone: +49 331 200 7277 | Fax: +49 331 200 7561 Oracle Java Platform Group | LangTools Team | Nashorn Oracle Deutschland B.V. & Co. KG | Schiffbauergasse 14 | 14467 Potsdam, Germany ORACLE Deutschland B.V. & Co. KG | Hauptverwaltung: Riesstra?e 25, D-80992 M?nchen Registergericht: Amtsgericht M?nchen, HRA 95603 Komplement?rin: ORACLE Deutschland Verwaltung B.V. | Hertogswetering 163/167, 3543 AS Utrecht, Niederlande Handelsregister der Handelskammer Midden-Nederland, Nr. 30143697 Gesch?ftsf?hrer: Alexander van der Ven, Jan Schultheiss, Val Maher Oracle is committed to developing practices and products that help protect the environment From paul.sandoz at oracle.com Wed Jul 6 13:20:56 2016 From: paul.sandoz at oracle.com (Paul Sandoz) Date: Wed, 6 Jul 2016 15:20:56 +0200 Subject: RFR(S): 8160717: MethodHandles.loop() does not check for excessive signature In-Reply-To: <8B86A97A-D8B0-476A-A34C-60D4ACD2E626@oracle.com> References: <3DA0031E-342A-462A-8863-2891A531E264@oracle.com> <2E767884-0883-4311-852E-2428BF3109DF@oracle.com> <75B795B7-9D0A-4A3A-B9BF-3ED0B005C7C0@oracle.com> <8B86A97A-D8B0-476A-A34C-60D4ACD2E626@oracle.com> Message-ID: <71F066AA-D02A-4010-A2FF-6F737B29A56A@oracle.com> > On 6 Jul 2016, at 14:32, Michael Haupt wrote: > > Hi Paul, > >> Am 06.07.2016 um 12:45 schrieb Paul Sandoz >: >>> What do you mean with "differentiate between the two cases"? Assuming it's Error/Exception vs. BytecodeGenerationException, here's the current rationale. There are cases when it makes sense to fall back to LFI, e.g., when, as here, methods grow too large. In many other cases it is justified to bail altogether with an InternalError. Wrapping cw.toClassBytes() is a first approximation. >>> >> >> I meant to say: >> >>>> Is it correct to say we *cannot* differentiate between the two cases. If so the danger is that we add another intrinsic and don?t realize it contains an actual error and we notice too late when we observe performance falling off a cliff. >> >> >> I don?t know if we can differentiate between a valid error (reaching the certain byte code limits) and an unexpected error where say we add a new intrinsic and its code generation is faulty causing ASM to throw RuntimeException. >> >> A wild thought: is there anyway to add some context/data to the ASM processing indicating what intrinsic is being processed, so when you get the exception you can at least differentiate. > > thanks for clarifying that. > > The way it's implemented now treats anything that occurs during bytecode assembly as a Real Problem and consequently raises an InternalError. Any RuntimeException raised from ASM during class file generation (cw.toByteArray()) is treated as a problem that should imply falling back to LFI mode. Given ASM only throws RuntimeExceptions, their messages could be used to distinguish between problem types, but that is brittle. > > It is definitely possible to attach additional information, such as the current LambdaForm or Intrinsic, to the wrapping exception, but the approach does not scale very well. There is, in principle, nothing that prevents a LambdaForm from containing multiple intrinsifiable idioms in a row. When a problem arises only during class file generation, it will not be easy to trace that back to the problematic intrinsic. Also, inlining at LF level is conceivable, complicating the matter further. > Ok, so on a best-effort basis this is probably the best we have at the moment :-) I am still skeptical of the value of the perf counter, but i will place my objections to the side to unblock the review. Paul. From paul.sandoz at oracle.com Wed Jul 6 14:05:16 2016 From: paul.sandoz at oracle.com (Paul Sandoz) Date: Wed, 6 Jul 2016 16:05:16 +0200 Subject: RFR(S): 8160717: MethodHandles.loop() does not check for excessive signature In-Reply-To: <577CEC26.7040407@oracle.com> References: <3DA0031E-342A-462A-8863-2891A531E264@oracle.com> <2E767884-0883-4311-852E-2428BF3109DF@oracle.com> <75B795B7-9D0A-4A3A-B9BF-3ED0B005C7C0@oracle.com> <577CEC26.7040407@oracle.com> Message-ID: <30EFE22A-0E59-46FF-8B5B-86C77E91C24C@oracle.com> > On 6 Jul 2016, at 13:31, Claes Redestad wrote: > > > > On 2016-07-06 12:45, Paul Sandoz wrote: >> >>> On 6 Jul 2016, at 12:04, Michael Haupt wrote: >>> >>> Hi Paul, >>> >>> thanks for your comments. >>> >>> Lazy initialisation of the PerfCounter is good, as is the warning suppression. >>> >>> I'll let Claes comment on the broader PerfCounter question, as he suggested using them. I think PerfCounter is a convenient abstraction for what we want to achieve, but the way it's used here may smell a bit abusive. >>> >> >> Ok. > > I know of a number of Java-side PerfCounters created early (and they're rather lean on dependencies in the first place, a select number of j.u.c.atomic classes IIRC), so I wouldn't worry about much of a startup penalty here. > > Lazy initialization might not save us much, and would hide the counter from showing up. > > I guess what I'm saying is I'm good with webrev.00. :-) > LambdaForm is initiated very early in the startup, and that is gonna change the order in which other classes are loaded, namely Buffers etc. I am concerned it might induce a circular dependency with VarHandles and the 166 patches that will arrive soon, e.g. see use of static AtomicInteger fields in Bits. If you want to retain the PerfCounter usages i think you may need to make it lazy. Paul. From claes.redestad at oracle.com Wed Jul 6 14:31:18 2016 From: claes.redestad at oracle.com (Claes Redestad) Date: Wed, 6 Jul 2016 16:31:18 +0200 Subject: RFR(S): 8160717: MethodHandles.loop() does not check for excessive signature In-Reply-To: <30EFE22A-0E59-46FF-8B5B-86C77E91C24C@oracle.com> References: <3DA0031E-342A-462A-8863-2891A531E264@oracle.com> <2E767884-0883-4311-852E-2428BF3109DF@oracle.com> <75B795B7-9D0A-4A3A-B9BF-3ED0B005C7C0@oracle.com> <577CEC26.7040407@oracle.com> <30EFE22A-0E59-46FF-8B5B-86C77E91C24C@oracle.com> Message-ID: <577D1636.8050804@oracle.com> On 2016-07-06 16:05, Paul Sandoz wrote: > >> On 6 Jul 2016, at 13:31, Claes Redestad wrote: >> >> >> >> On 2016-07-06 12:45, Paul Sandoz wrote: >>> >>>> On 6 Jul 2016, at 12:04, Michael Haupt wrote: >>>> >>>> Hi Paul, >>>> >>>> thanks for your comments. >>>> >>>> Lazy initialisation of the PerfCounter is good, as is the warning suppression. >>>> >>>> I'll let Claes comment on the broader PerfCounter question, as he suggested using them. I think PerfCounter is a convenient abstraction for what we want to achieve, but the way it's used here may smell a bit abusive. >>>> >>> >>> Ok. >> >> I know of a number of Java-side PerfCounters created early (and they're rather lean on dependencies in the first place, a select number of j.u.c.atomic classes IIRC), so I wouldn't worry about much of a startup penalty here. >> >> Lazy initialization might not save us much, and would hide the counter from showing up. >> >> I guess what I'm saying is I'm good with webrev.00. :-) >> > > LambdaForm is initiated very early in the startup, and that is gonna change the order in which other classes are loaded, namely Buffers etc. I am concerned it might induce a circular dependency with VarHandles and the 166 patches that will arrive soon, e.g. see use of static AtomicInteger fields in Bits. > > If you want to retain the PerfCounter usages i think you may need to make it lazy. Ah, right, it's one of the classes the VM preloads, so it'll be loaded long before anyone actually uses java.lang.invoke. Yes, that might cause bootstrap issues, and needs to be lazy. For the record: I perceived a need to have some discoverable event in case this fallback ever takes effect. A PerfCounter is certainly not be the best fit for that, but it's readily available and would allow for a quick and dirty diagnostic. Perhaps it's best to move it to a follow-up improvement, but I'd prefer to have something in that can be improved/replaced than nothing at all. /Claes From michael.haupt at oracle.com Wed Jul 6 15:10:08 2016 From: michael.haupt at oracle.com (Michael Haupt) Date: Wed, 6 Jul 2016 17:10:08 +0200 Subject: RFR(S): 8160717: MethodHandles.loop() does not check for excessive signature In-Reply-To: <577D1636.8050804@oracle.com> References: <3DA0031E-342A-462A-8863-2891A531E264@oracle.com> <2E767884-0883-4311-852E-2428BF3109DF@oracle.com> <75B795B7-9D0A-4A3A-B9BF-3ED0B005C7C0@oracle.com> <577CEC26.7040407@oracle.com> <30EFE22A-0E59-46FF-8B5B-86C77E91C24C@oracle.com> <577D1636.8050804@oracle.com> Message-ID: Hi Claes, Paul, Andrej, thank you very much for your reviews. I've added lazy initialisation. This is the change I'm going to push: http://cr.openjdk.java.net/~mhaupt/8160717/webrev.02/ Best, Michael > Am 06.07.2016 um 16:31 schrieb Claes Redestad : > > > > On 2016-07-06 16:05, Paul Sandoz wrote: >> >>> On 6 Jul 2016, at 13:31, Claes Redestad wrote: >>> >>> >>> >>> On 2016-07-06 12:45, Paul Sandoz wrote: >>>> >>>>> On 6 Jul 2016, at 12:04, Michael Haupt wrote: >>>>> >>>>> Hi Paul, >>>>> >>>>> thanks for your comments. >>>>> >>>>> Lazy initialisation of the PerfCounter is good, as is the warning suppression. >>>>> >>>>> I'll let Claes comment on the broader PerfCounter question, as he suggested using them. I think PerfCounter is a convenient abstraction for what we want to achieve, but the way it's used here may smell a bit abusive. >>>>> >>>> >>>> Ok. >>> >>> I know of a number of Java-side PerfCounters created early (and they're rather lean on dependencies in the first place, a select number of j.u.c.atomic classes IIRC), so I wouldn't worry about much of a startup penalty here. >>> >>> Lazy initialization might not save us much, and would hide the counter from showing up. >>> >>> I guess what I'm saying is I'm good with webrev.00. :-) >>> >> >> LambdaForm is initiated very early in the startup, and that is gonna change the order in which other classes are loaded, namely Buffers etc. I am concerned it might induce a circular dependency with VarHandles and the 166 patches that will arrive soon, e.g. see use of static AtomicInteger fields in Bits. >> >> If you want to retain the PerfCounter usages i think you may need to make it lazy. > > Ah, right, it's one of the classes the VM preloads, so it'll be loaded long before anyone actually uses java.lang.invoke. Yes, that might cause bootstrap issues, and needs to be lazy. > > For the record: I perceived a need to have some discoverable event in case this fallback ever takes effect. A PerfCounter is certainly not be the best fit for that, but it's readily available and would allow for a quick and dirty diagnostic. Perhaps it's best to move it to a follow-up improvement, but I'd prefer to have something in that can be improved/replaced than nothing at all. > > /Claes -- Dr. Michael Haupt | Principal Member of Technical Staff Phone: +49 331 200 7277 | Fax: +49 331 200 7561 Oracle Java Platform Group | LangTools Team | Nashorn Oracle Deutschland B.V. & Co. KG | Schiffbauergasse 14 | 14467 Potsdam, Germany ORACLE Deutschland B.V. & Co. KG | Hauptverwaltung: Riesstra?e 25, D-80992 M?nchen Registergericht: Amtsgericht M?nchen, HRA 95603 Komplement?rin: ORACLE Deutschland Verwaltung B.V. | Hertogswetering 163/167, 3543 AS Utrecht, Niederlande Handelsregister der Handelskammer Midden-Nederland, Nr. 30143697 Gesch?ftsf?hrer: Alexander van der Ven, Jan Schultheiss, Val Maher Oracle is committed to developing practices and products that help protect the environment From joe.darcy at oracle.com Wed Jul 6 16:52:43 2016 From: joe.darcy at oracle.com (joe darcy) Date: Wed, 6 Jul 2016 09:52:43 -0700 Subject: JDK 9 RFR Demote java/lang/ProcessBuilder/Zombies.java to tier 2 Message-ID: Hello, Until its recently increased intermittent failures are resolved, I'd like to demote from tier 1 to tier 2 the test java/lang/ProcessBuilder/Zombies.java. Patch below. Thanks, -Joe diff -r c3fbc7c75b01 test/TEST.groups --- a/test/TEST.groups Wed Jul 06 17:10:36 2016 +0200 +++ b/test/TEST.groups Wed Jul 06 09:44:23 2016 -0700 @@ -27,6 +27,7 @@ tier1 = \ :jdk_lang \ + -java/lang/ProcessBuilder/Zombies.java \ :jdk_util \ -java/util/concurrent/ThreadPoolExecutor/ConfigChanges.java \ -java/util/concurrent/forkjoin/FJExceptionTableLeak.java \ @@ -37,6 +38,7 @@ tools/pack200 tier2 = \ + java/lang/ProcessBuilder/Zombies.java \ java/util/concurrent/ThreadPoolExecutor/ConfigChanges.java \ java/util/concurrent/forkjoin/FJExceptionTableLeak.java \ :jdk_io \ From Roger.Riggs at Oracle.com Wed Jul 6 16:55:28 2016 From: Roger.Riggs at Oracle.com (Roger Riggs) Date: Wed, 6 Jul 2016 12:55:28 -0400 Subject: JDK 9 RFR Demote java/lang/ProcessBuilder/Zombies.java to tier 2 In-Reply-To: References: Message-ID: <2e730f4d-e4c4-9046-df7b-b35faf3b516e@Oracle.com> +1, Thanks, Joe On 7/6/2016 12:52 PM, joe darcy wrote: > Hello, > > Until its recently increased intermittent failures are resolved, I'd > like to demote from tier 1 to tier 2 the test > java/lang/ProcessBuilder/Zombies.java. Patch below. > > Thanks, > > -Joe > > diff -r c3fbc7c75b01 test/TEST.groups > --- a/test/TEST.groups Wed Jul 06 17:10:36 2016 +0200 > +++ b/test/TEST.groups Wed Jul 06 09:44:23 2016 -0700 > @@ -27,6 +27,7 @@ > > tier1 = \ > :jdk_lang \ > + -java/lang/ProcessBuilder/Zombies.java \ > :jdk_util \ > -java/util/concurrent/ThreadPoolExecutor/ConfigChanges.java \ > -java/util/concurrent/forkjoin/FJExceptionTableLeak.java \ > @@ -37,6 +38,7 @@ > tools/pack200 > > tier2 = \ > + java/lang/ProcessBuilder/Zombies.java \ > java/util/concurrent/ThreadPoolExecutor/ConfigChanges.java \ > java/util/concurrent/forkjoin/FJExceptionTableLeak.java \ > :jdk_io \ > From joe.darcy at oracle.com Thu Jul 7 05:49:21 2016 From: joe.darcy at oracle.com (joe darcy) Date: Wed, 6 Jul 2016 22:49:21 -0700 Subject: JDK 9 RFR of JDK-8152174: Type annotations with a missing type throw NullPointerException Message-ID: <2468f8b5-f537-b55c-75bf-b9af4a2ebf2f@oracle.com> Hello, Please review the changes to address JDK-8152174: Type annotations with a missing type throw NullPointerException http://cr.openjdk.java.net/~darcy/8152174.0/ In brief, the method TypeAnnotationParser.mapTypeAnnotations is analogous to sun.reflect.annotation.AnnotationParser.parseAnnotations2(). The latter method has a null-check to attempt to add a map entry if the annotation null for some reason. The fix is to add a corresponding null-check in TypeAnnotationParser.mapTypeAnnotations. All previous runtime annotations tests pass with the new code; the new tests passes with the new patch and fails without it. Thanks, -Joe From joel.borggren.franck at gmail.com Thu Jul 7 06:23:19 2016 From: joel.borggren.franck at gmail.com (=?UTF-8?Q?Joel_Borggr=C3=A9n=2DFranck?=) Date: Thu, 7 Jul 2016 08:23:19 +0200 Subject: JDK 9 RFR of JDK-8152174: Type annotations with a missing type throw NullPointerException In-Reply-To: <2468f8b5-f537-b55c-75bf-b9af4a2ebf2f@oracle.com> References: <2468f8b5-f537-b55c-75bf-b9af4a2ebf2f@oracle.com> Message-ID: Looks good Joe. Cheers /Joel On Jul 7, 2016 07:49, "joe darcy" wrote: > Hello, > > Please review the changes to address > > JDK-8152174: Type annotations with a missing type throw > NullPointerException > http://cr.openjdk.java.net/~darcy/8152174.0/ > > In brief, the method TypeAnnotationParser.mapTypeAnnotations is analogous > to sun.reflect.annotation.AnnotationParser.parseAnnotations2(). The latter > method has a null-check to attempt to add a map entry if the annotation > null for some reason. > > The fix is to add a corresponding null-check in > TypeAnnotationParser.mapTypeAnnotations. > > All previous runtime annotations tests pass with the new code; the new > tests passes with the new patch and fails without it. > > Thanks, > > -Joe > > > From paul.sandoz at oracle.com Thu Jul 7 10:06:53 2016 From: paul.sandoz at oracle.com (Paul Sandoz) Date: Thu, 7 Jul 2016 12:06:53 +0200 Subject: RFR 8160885 Unsafe.compareAndExchangeDouble/FloatAcquire should defer to compareAndExchangeLong/IntAcquire Message-ID: Hi, Please review the simple patch below. As spotted by Andrew Haley the Unsafe.compareAndExchangeDouble/FloatAcquire methods were incorrectly deferring to compareAndExchangeLong/IntVolatile rather than compareAndExchangeLong/IntAcquire. Other, related, double/float Unsafe methods defer correctly to the long/int variants. Thanks, Paul. diff -r 7ca81adc8bad src/java.base/share/classes/jdk/internal/misc/Unsafe.java --- a/src/java.base/share/classes/jdk/internal/misc/Unsafe.java Wed Jul 06 17:38:29 2016 +0200 +++ b/src/java.base/share/classes/jdk/internal/misc/Unsafe.java Wed Jul 06 19:08:55 2016 +0200 @@ -1709,9 +1709,9 @@ public final float compareAndExchangeFloatAcquire(Object o, long offset, float expected, float x) { - int w = compareAndExchangeIntVolatile(o, offset, - Float.floatToRawIntBits(expected), - Float.floatToRawIntBits(x)); + int w = compareAndExchangeIntAcquire(o, offset, + Float.floatToRawIntBits(expected), + Float.floatToRawIntBits(x)); return Float.intBitsToFloat(w); } @@ -1793,9 +1793,9 @@ public final double compareAndExchangeDoubleAcquire(Object o, long offset, double expected, double x) { - long w = compareAndExchangeLongVolatile(o, offset, - Double.doubleToRawLongBits(expected), - Double.doubleToRawLongBits(x)); + long w = compareAndExchangeLongAcquire(o, offset, + Double.doubleToRawLongBits(expected), + Double.doubleToRawLongBits(x)); return Double.longBitsToDouble(w); } From paul.sandoz at oracle.com Thu Jul 7 10:39:56 2016 From: paul.sandoz at oracle.com (Paul Sandoz) Date: Thu, 7 Jul 2016 12:39:56 +0200 Subject: RFR: jsr166 jdk9 integration wave 7 In-Reply-To: References: <1b9bd87d-5835-fb00-9db0-0de627f1952d@gmail.com> <76e3eb70-adc4-8d5d-74ee-d664e314b266@gmail.com> <577463C0.2070806@cs.oswego.edu> Message-ID: <71257D58-05D0-40CA-AA01-D47C2FB706EF@oracle.com> > On 30 Jun 2016, at 13:20, Martin Buchholz wrote: > > Webrev regenerated with updates. > Lots of rework for the atomic VarHandle specs. > http://cr.openjdk.java.net/~martin/webrevs/openjdk9/jsr166-jdk9-integration/ > Here is a spec diff for the atomics: http://cr.openjdk.java.net/~psandoz/jdk9/JDK-8080603-concurrent-unsafe-vhs/specdiff/java/util/concurrent/atomic/package-summary.html Paul. > In the unlikely case you want the old webrev, it's at > http://cr.openjdk.java.net/~martin/webrevs/openjdk9/jsr166-jdk9-integration.2016-06-29/ From michael.haupt at oracle.com Thu Jul 7 10:44:49 2016 From: michael.haupt at oracle.com (Michael Haupt) Date: Thu, 7 Jul 2016 12:44:49 +0200 Subject: RFR 8160885 Unsafe.compareAndExchangeDouble/FloatAcquire should defer to compareAndExchangeLong/IntAcquire In-Reply-To: References: Message-ID: Hi Paul, thumbs up. Best, Michael > Am 07.07.2016 um 12:06 schrieb Paul Sandoz : > > Hi, > > Please review the simple patch below. > > As spotted by Andrew Haley the Unsafe.compareAndExchangeDouble/FloatAcquire methods were incorrectly deferring to compareAndExchangeLong/IntVolatile rather than compareAndExchangeLong/IntAcquire. Other, related, double/float Unsafe methods defer correctly to the long/int variants. > > Thanks, > Paul. > > diff -r 7ca81adc8bad src/java.base/share/classes/jdk/internal/misc/Unsafe.java > --- a/src/java.base/share/classes/jdk/internal/misc/Unsafe.java Wed Jul 06 17:38:29 2016 +0200 > +++ b/src/java.base/share/classes/jdk/internal/misc/Unsafe.java Wed Jul 06 19:08:55 2016 +0200 > @@ -1709,9 +1709,9 @@ > public final float compareAndExchangeFloatAcquire(Object o, long offset, > float expected, > float x) { > - int w = compareAndExchangeIntVolatile(o, offset, > - Float.floatToRawIntBits(expected), > - Float.floatToRawIntBits(x)); > + int w = compareAndExchangeIntAcquire(o, offset, > + Float.floatToRawIntBits(expected), > + Float.floatToRawIntBits(x)); > return Float.intBitsToFloat(w); > } > > @@ -1793,9 +1793,9 @@ > public final double compareAndExchangeDoubleAcquire(Object o, long offset, > double expected, > double x) { > - long w = compareAndExchangeLongVolatile(o, offset, > - Double.doubleToRawLongBits(expected), > - Double.doubleToRawLongBits(x)); > + long w = compareAndExchangeLongAcquire(o, offset, > + Double.doubleToRawLongBits(expected), > + Double.doubleToRawLongBits(x)); > return Double.longBitsToDouble(w); > } > -- Dr. Michael Haupt | Principal Member of Technical Staff Phone: +49 331 200 7277 | Fax: +49 331 200 7561 Oracle Java Platform Group | LangTools Team | Nashorn Oracle Deutschland B.V. & Co. KG | Schiffbauergasse 14 | 14467 Potsdam, Germany ORACLE Deutschland B.V. & Co. KG | Hauptverwaltung: Riesstra?e 25, D-80992 M?nchen Registergericht: Amtsgericht M?nchen, HRA 95603 Komplement?rin: ORACLE Deutschland Verwaltung B.V. | Hertogswetering 163/167, 3543 AS Utrecht, Niederlande Handelsregister der Handelskammer Midden-Nederland, Nr. 30143697 Gesch?ftsf?hrer: Alexander van der Ven, Jan Schultheiss, Val Maher Oracle is committed to developing practices and products that help protect the environment From sundararajan.athijegannathan at oracle.com Thu Jul 7 11:40:21 2016 From: sundararajan.athijegannathan at oracle.com (Sundararajan Athijegannathan) Date: Thu, 7 Jul 2016 17:10:21 +0530 Subject: RFR: JDK-8160829 - Remove ASMPool support from jlink In-Reply-To: <11A2AA9E-00EB-46B6-A750-D08AC8A7E8DF@oracle.com> References: <11A2AA9E-00EB-46B6-A750-D08AC8A7E8DF@oracle.com> Message-ID: +1 On 7/5/2016 7:48 PM, Jim Laskey (Oracle) wrote: > Much of the removed code seems unnecessary since the same functionality can be accomplished with much simpler code. An example is provided with ClassForNamePlugin.java (temporary.) A shipping byte code optimizer plugin will be supplied later. Additional changes to the plugin API will supply a cross resource resolver that will make byte code optimizing code even simpler. > > http://cr.openjdk.java.net/~jlaskey/8160829/webrev/index.html > https://bugs.openjdk.java.net/browse/JDK-8160829 > > From volker.simonis at gmail.com Thu Jul 7 13:59:13 2016 From: volker.simonis at gmail.com (Volker Simonis) Date: Thu, 7 Jul 2016 15:59:13 +0200 Subject: RFR(S): 8160564: TEST: Add a test to check the implementation of VersionProps.versionNumbers() Message-ID: Hi, can I please have a review for the following change which makes VersionProps.versionNumbers() testable and the corresponding regression test: http://cr.openjdk.java.net/~simonis/webrevs/2016/8160564/ https://bugs.openjdk.java.net/browse/JDK-8160564 During the review for "8160457: VersionProps.versionNumbers() is broken" it was suggested to refactor VersionProps.versionNumbers() in order to make it testable by a regression test. This change does exactly that. It extracts the implementation of VersionProps.versionNumbers() into a new method parseVersionNumbers(String versionNumber) which can be tested from the associated regression test. There are still two points to notice: - VersionProps.versionNumbers() deliberately doesn't check for badly formatted version strings because it is assumed it will only get valid input (see discussion for "JDK-8160000: Runtime.version() cause startup regressions" at [2]). So we can currently only check that VersionProps.versionNumbers() accepts all kind of valid version strings. - I was a little bit surprised that I could reflectively access and execute java.lang.VersionProps.parseVersionNumbers() where both the class and the method are package private. Maybe this is related to Jigsaw issue #ReflectiveAccessToNonExportedTypes [3]? As I'm not a Jigsaw expert, I'd be graceful to anybody explaining me why this is still so easily possible with Jigsaw? Thank you and best regards, Volker [1] http://mail.openjdk.java.net/pipermail/core-libs-dev/2016-June/042058.html [2] https://bugs.openjdk.java.net/browse/JDK-8160000 [3] http://openjdk.java.net/projects/jigsaw/spec/issues/#ReflectiveAccessToNonExportedTypes From peter.levart at gmail.com Thu Jul 7 14:06:33 2016 From: peter.levart at gmail.com (Peter Levart) Date: Thu, 7 Jul 2016 16:06:33 +0200 Subject: RFR: jsr166 jdk9 integration wave 7 In-Reply-To: <71257D58-05D0-40CA-AA01-D47C2FB706EF@oracle.com> References: <1b9bd87d-5835-fb00-9db0-0de627f1952d@gmail.com> <76e3eb70-adc4-8d5d-74ee-d664e314b266@gmail.com> <577463C0.2070806@cs.oswego.edu> <71257D58-05D0-40CA-AA01-D47C2FB706EF@oracle.com> Message-ID: <596f35d2-2fa9-fff3-c165-e6316bdb7c35@gmail.com> Hi Paul, On 07/07/2016 12:39 PM, Paul Sandoz wrote: >> On 30 Jun 2016, at 13:20, Martin Buchholz wrote: >> >> Webrev regenerated with updates. >> Lots of rework for the atomic VarHandle specs. >> http://cr.openjdk.java.net/~martin/webrevs/openjdk9/jsr166-jdk9-integration/ >> > Here is a spec diff for the atomics: > > http://cr.openjdk.java.net/~psandoz/jdk9/JDK-8080603-concurrent-unsafe-vhs/specdiff/java/util/concurrent/atomic/package-summary.html > > Paul. Why don't javadocs of AtomicXXX.getPlain|setPlain methods refer to VarHandle.get|set like other methods do? Also, I can't seem to understand why the naming of methods on VarHandle vs. the naming of methods on AtomicXXX classes is sometimes so confusingly different and/or the same. For example, the following pairs present equivalent memory effects: VarHandle.getVolatile ~ AtomicInteger.get VarHandle.get ~ AtomicInteger.getPlain I understand that AtomicXXX classes have legacy and we can't change their method names. But why was a method in new class (VarHandle) given the same name as an existing AtomicXXX class method with different memory effects? IMHO, this is just asking for confusion among developers. Why the naming wasn't more like the following: VarHandle.getVolatile ~ @Deprecated AtomicInteger.get ~ /* new method */ AtomicInteger.getVolatile VarHandle.getPlain ~ /* new method */ AtomicInteger.getPlain Why was it chosen that plain VarHandle.get() method is without Plain suffix? Do you expect it will be used more often than other methods? Regards, Peter > >> In the unlikely case you want the old webrev, it's at >> http://cr.openjdk.java.net/~martin/webrevs/openjdk9/jsr166-jdk9-integration.2016-06-29/ From Alan.Bateman at oracle.com Thu Jul 7 14:26:06 2016 From: Alan.Bateman at oracle.com (Alan Bateman) Date: Thu, 7 Jul 2016 15:26:06 +0100 Subject: RFR(S): 8160564: TEST: Add a test to check the implementation of VersionProps.versionNumbers() In-Reply-To: References: Message-ID: <1157915d-caa7-ece3-2566-09b756d4d87b@oracle.com> On 07/07/2016 14:59, Volker Simonis wrote: > : > > - I was a little bit surprised that I could reflectively access and > execute java.lang.VersionProps.parseVersionNumbers() where both the > class and the method are package private. Maybe this is related to > Jigsaw issue #ReflectiveAccessToNonExportedTypes [3]? As I'm not a > Jigsaw expert, I'd be graceful to anybody explaining me why this is > still so easily possible with Jigsaw? > > java.lang is an exported package and I assume you are using setAccessible(true) too. -Alan From volker.simonis at gmail.com Thu Jul 7 14:51:21 2016 From: volker.simonis at gmail.com (Volker Simonis) Date: Thu, 7 Jul 2016 16:51:21 +0200 Subject: RFR(S): 8160564: TEST: Add a test to check the implementation of VersionProps.versionNumbers() In-Reply-To: <1157915d-caa7-ece3-2566-09b756d4d87b@oracle.com> References: <1157915d-caa7-ece3-2566-09b756d4d87b@oracle.com> Message-ID: On Thu, Jul 7, 2016 at 4:26 PM, Alan Bateman wrote: > On 07/07/2016 14:59, Volker Simonis wrote: > >> : >> >> - I was a little bit surprised that I could reflectively access and >> execute java.lang.VersionProps.parseVersionNumbers() where both the >> class and the method are package private. Maybe this is related to >> Jigsaw issue #ReflectiveAccessToNonExportedTypes [3]? As I'm not a >> Jigsaw expert, I'd be graceful to anybody explaining me why this is >> still so easily possible with Jigsaw? >> >> > java.lang is an exported package and I assume you are using > setAccessible(true) too. > Yes, I do use setAccessible(true) but I naively expected it to fail. So does it mean the module system does not prevent me from reflectively using package private classes/methods from exported packages? Thanks, Volker > -Alan From sean.coffey at oracle.com Thu Jul 7 14:53:20 2016 From: sean.coffey at oracle.com (=?UTF-8?Q?Se=c3=a1n_Coffey?=) Date: Thu, 7 Jul 2016 15:53:20 +0100 Subject: RFR: 8153044: Allow a property to control location of tzdb.dat file Message-ID: Looking to add a new implementation specific system property which would allow the user to specify the location of the tzdb.dat file. https://bugs.openjdk.java.net/browse/JDK-8153044 http://cr.openjdk.java.net/~coffeys/webrev.8153044/webrev/ -- Regards, Sean. From adinn at redhat.com Thu Jul 7 14:54:47 2016 From: adinn at redhat.com (Andrew Dinn) Date: Thu, 7 Jul 2016 15:54:47 +0100 Subject: RFR(S): 8160564: TEST: Add a test to check the implementation of VersionProps.versionNumbers() In-Reply-To: References: Message-ID: <577E6D37.5080807@redhat.com> On 07/07/16 14:59, Volker Simonis wrote: > - I was a little bit surprised that I could reflectively access and > execute java.lang.VersionProps.parseVersionNumbers() where both the > class and the method are package private. Maybe this is related to > Jigsaw issue #ReflectiveAccessToNonExportedTypes [3]? As I'm not a > Jigsaw expert, I'd be graceful to anybody explaining me why this is > still so easily possible with Jigsaw? Reflective access to non-public classes/members of exported packages is unchanged with Jigsaw -- it is subject to the security checks in place in previous JDKs but not to a module access check. So, in this case java.lang is an exported package which means you can obtain a handle on java.lang.VersionProps.parseVersionNumbers(), call setEnabled(true) and then invoke it. It is only when you try to reflectively access non-public classes/members of packages that are not exported by their owning module that the check comes into play. So, if your (non-module) code obtains a reflective Member for jdk.internal.misc.Unsafe.theUnsafe and calls setEnabled(true) you will find that the latter call will not succeed in rendering it an accessible handle and an access via that handle will fail. That is because java.base does not export package jdk.internal.misc so the module check under setEnabled detects that the caller is in a different module and refuses to make it accessible. regards, Andrew Dinn ----------- Senior Principal Software Engineer Red Hat UK Ltd Registered in England and Wales under Company Registration No. 03798903 Directors: Michael Cunningham, Michael ("Mike") O'Neill, Eric Shander From scolebourne at joda.org Thu Jul 7 15:02:21 2016 From: scolebourne at joda.org (Stephen Colebourne) Date: Thu, 7 Jul 2016 16:02:21 +0100 Subject: RFR: 8153044: Allow a property to control location of tzdb.dat file In-Reply-To: References: Message-ID: I won't block this change, but I remain unenthused. There are other ways to control the time-zone data, and since tzdb.dat is currently a private format file that is part of the internals of the JDK, it seems odd to be exposing it. Having the tzdb.dat as a versioned module that could be replaced, or linked in would, by contrast, be potentially very useful. Stephen On 7 July 2016 at 15:53, Se?n Coffey wrote: > Looking to add a new implementation specific system property which would > allow the user to specify the location of the tzdb.dat file. > > https://bugs.openjdk.java.net/browse/JDK-8153044 > http://cr.openjdk.java.net/~coffeys/webrev.8153044/webrev/ > > -- > Regards, > Sean. > From john_platts at hotmail.com Thu Jul 7 15:11:27 2016 From: john_platts at hotmail.com (John Platts) Date: Thu, 7 Jul 2016 15:11:27 +0000 Subject: Better implementation of Long.divideUnsigned and Long.remainderUnsigned Message-ID: In the implementations of Long.divideUnsigned and Long.remainderUnsigned, there is a better way to handle the case where dividend > Long.MAX_VALUE and divisor <= Long.MAX_VALUE than doing it through a BigInteger. Here is the current implementation of Long.divideUnsigned and Long.remainderUnsigned from OpenJDK 9: /** * Returns the unsigned quotient of dividing the first argument by * the second where each argument and the result is interpreted as * an unsigned value. * *

Note that in two's complement arithmetic, the three other * basic arithmetic operations of add, subtract, and multiply are * bit-wise identical if the two operands are regarded as both * being signed or both being unsigned. Therefore separate {@code * addUnsigned}, etc. methods are not provided. * * @param dividend the value to be divided * @param divisor the value doing the dividing * @return the unsigned quotient of the first argument divided by * the second argument * @see #remainderUnsigned * @since 1.8 */ public static long divideUnsigned(long dividend, long divisor) { if (divisor < 0L) { // signed comparison // Answer must be 0 or 1 depending on relative magnitude // of dividend and divisor. return (compareUnsigned(dividend, divisor)) < 0 ? 0L :1L; } if (dividend > 0) // Both inputs non-negative return dividend/divisor; else { /* * For simple code, leveraging BigInteger. Longer and faster * code written directly in terms of operations on longs is * possible; see "Hacker's Delight" for divide and remainder * algorithms. */ return toUnsignedBigInteger(dividend). divide(toUnsignedBigInteger(divisor)).longValue(); } } /** * Returns the unsigned remainder from dividing the first argument * by the second where each argument and the result is interpreted * as an unsigned value. * * @param dividend the value to be divided * @param divisor the value doing the dividing * @return the unsigned remainder of the first argument divided by * the second argument * @see #divideUnsigned * @since 1.8 */ public static long remainderUnsigned(long dividend, long divisor) { if (dividend > 0 && divisor > 0) { // signed comparisons return dividend % divisor; } else { if (compareUnsigned(dividend, divisor) < 0) // Avoid explicit check for 0 divisor return dividend; else return toUnsignedBigInteger(dividend). remainder(toUnsignedBigInteger(divisor)).longValue(); } } Here is an better implementation that does not require conversion to BigInteger: /** * Returns the unsigned quotient of dividing the first argument by * the second where each argument and the result is interpreted as * an unsigned value. * *

Note that in two's complement arithmetic, the three other * basic arithmetic operations of add, subtract, and multiply are * bit-wise identical if the two operands are regarded as both * being signed or both being unsigned. Therefore separate {@code * addUnsigned}, etc. methods are not provided. * * @param dividend the value to be divided * @param divisor the value doing the dividing * @return the unsigned quotient of the first argument divided by * the second argument * @see #remainderUnsigned * @since 1.8 */ public static long divideUnsigned(long dividend, long divisor) { if (divisor < 0L) { // signed comparison // Answer must be 0 or 1 depending on relative magnitude // of dividend and divisor. return (compareUnsigned(dividend, divisor)) < 0 ? 0L :1L; } if (dividend > 0 || divisor <= 1) { // One of the following is true: // 1. Both inputs are positive, in which the result is equal to dividing // dividend by divisor. // 2. The divisor is equal to zero, which will result in a DivideByZeroException // being thrown. // 3. The divisor is equal to one, in which the result is equal to dividend. return dividend/divisor; } else { long rMax = divisor - 1; if(divisor != 0 && (divisor & rMax) == 0) { // divisor is power of 2 return dividend >>> Long.numberOfTrailingZeros(divisor); } // First, divide Long.MAX_VALUE + 1 by divisor. // Division of Long.MAX_VALUE + 1 by divisor is done by the following: // 1. Dividing Long.MAX_VALUE by divisor // 2. Computing the remainder of Long.MAX_VALUE by divisor // 3. Adding 1 to the remainder computed in step #2. // 4. If the remainder is equal to divisor, add 1 to the quotient and set // the remainder to zero. long q = Long.MAX_VALUE / divisor; long r = (Long.MAX_VALUE % divisor) + 1; if(r == divisor) { q++; r = 0; } // Let x2 be equal to dividend - (Long.MAX_VALUE + 1). // Compute the actual quotient and remainder of dividing dividend by divisor // by doing the following: // 1. Increment q by the quotient of dividing x2 by divisor. // 2. Increment r by the remainder of dividing x2 by divisor. // 3. If r >= divisor is true, then increment q by 1 and decrement r by divisor. long x2 = dividend & Long.MAX_VALUE; q += x2 / divisor; r += x2 % divisor; if(r >= divisor) { q++; r -= divisor; } // Return q, which is now the actual remainder of dividing dividend by divisor. return q; } } /** * Returns the unsigned remainder from dividing the first argument * by the second where each argument and the result is interpreted * as an unsigned value. * * @param dividend the value to be divided * @param divisor the value doing the dividing * @return the unsigned remainder of the first argument divided by * the second argument * @see #divideUnsigned * @since 1.8 */ public static long remainderUnsigned(long dividend, long divisor) { if (dividend > 0 && divisor > 0) { // signed comparisons return dividend % divisor; } else { if (compareUnsigned(dividend, divisor) < 0) { // Avoid explicit check for 0 divisor return dividend; } else { long rMax = divisor - 1; if(divisor != 0 && (divisor & rMax) == 0) { // divisor is power of 2 return dividend & rMax; } // First, compute the remainder of dividing Long.MAX_VALUE + 1 // This is done by doing the following: // 1. Computing the remainder of dividing Long.MAX_VALUE by divisor. // 2. Adding 1 to the remainder computed in step #1. // 3. If the remainder is equal to divisor, set the remainder to 0. long r = (Long.MAX_VALUE % divisor) + 1; if(r == divisor) { r = 0; } // Let x2 be equal to dividend - (Long.MAX_VALUE + 1). // Compute the actual remainder of dividing dividend by divisor // by doing the following: // 1. Increment r by the remainder of dividing x2 by divisor. // 2. If r >= divisor is true, then decrement r by divisor. long x2 = dividend & Long.MAX_VALUE; r += x2 % divisor; if(r >= divisor) { r -= divisor; } // Return r, which is now the actual remainder of dividing dividend by divisor. return r; } } } The updated implementations of divideUnsigned and remainderUnsigned avoid the memory allocations that are involved in doing division through BigInteger. In addition, the algorithm used to do division without going through a BigInteger is simpler than the actual implementation in the BigInteger class. From peter.levart at gmail.com Thu Jul 7 15:22:56 2016 From: peter.levart at gmail.com (Peter Levart) Date: Thu, 7 Jul 2016 17:22:56 +0200 Subject: Discussion: JDK-8160710 Enable Thread to grant VarHandle field access to ThreadLocalRandom/Striped64 In-Reply-To: <6F99AEDA-4A12-41DB-AC31-744693004128@oracle.com> References: <1b9bd87d-5835-fb00-9db0-0de627f1952d@gmail.com> <76e3eb70-adc4-8d5d-74ee-d664e314b266@gmail.com> <577463C0.2070806@cs.oswego.edu> <7303825d-5a55-e955-7535-b427fb790d2a@gmail.com> <5775A2E0.6090802@cs.oswego.edu> <6F99AEDA-4A12-41DB-AC31-744693004128@oracle.com> Message-ID: <199f1b20-0983-bc44-e884-66e5fbb24e77@gmail.com> Hi, On 07/01/2016 10:36 AM, Paul Sandoz wrote: >> On 1 Jul 2016, at 00:53, Doug Lea

wrote: >> >> On 06/30/2016 10:08 AM, Paul Sandoz wrote: >>> Hi Peter, >>> >>> Thanks, that?s interesting. I am uncertain if our 166 fellows will be >>> reluctant or not to pull in a dependency on jdk.internal.misc.SharedSecrets. >> >> Background: we are reluctant to rely on anything that makes sources impossible >> to use in (usually, upcoming versions of) Android. Which probably >> doesn't directly apply here. >> >> But my main concern in this case is that we need better assurance >> that there are no possible start-up circularities, since we've already >> had some near-miss experiences with ThreadLocalRandom. Is there a >> solid argument? ThreadLocalRandom was tricky, yes! But I think this one is pretty safe: http://cr.openjdk.java.net/~plevart/misc/JavaLangThreadAccess/webrev.Striped64/ What it does in Thread. is instantiate an anonymous class implementing JavaLangThreadAccess interface and injecting the instance into the SharedSecrets class' static field. This triggers initializing just 3 classes: - JavaLangThreadAccess interface - Thread$NN anonymous class implementing JavaLangThreadAccess - SharedSecrets class That's all. The patch modifies SharedSecrets so that it doesn't initialize anything else (originally it initialized the Unsafe class which was premature and the JVM bootstrap failed because of that). This is the diff between the traces of loading classes on unpatched JDK 9 (jsr166 jdk9 integration wave 7 not applied yet) and with above patch applied when running an empty program: [peter at peterl tmp]$ diff -c cltrace0.txt cltrace1.txt *** cltrace0.txt 2016-07-07 17:04:21.872277904 +0200 --- cltrace1.txt 2016-07-07 17:04:26.368307983 +0200 *************** *** 1,4 **** ! [info][class,load] opened: /home/peter/Apps64/jdk1.9.0.default/lib/modules [info][class,load] java.lang.Object source: jrt:/java.base [info][class,load] java.io.Serializable source: jrt:/java.base [info][class,load] java.lang.Comparable source: jrt:/java.base --- 1,4 ---- ! [info][class,load] opened: /home/peter/work/hg/jdk9-dev/build/linux-x86_64-normal-server-release/images/jdk/lib/modules [info][class,load] java.lang.Object source: jrt:/java.base [info][class,load] java.io.Serializable source: jrt:/java.base [info][class,load] java.lang.Comparable source: jrt:/java.base *************** *** 123,128 **** --- 123,131 ---- [info][class,load] java.security.BasicPermission source: jrt:/java.base [info][class,load] java.lang.RuntimePermission source: jrt:/java.base [info][class,load] java.lang.StringLatin1 source: jrt:/java.base + [info][class,load] jdk.internal.misc.JavaLangThreadAccess source: jrt:/java.base + [info][class,load] java.lang.Thread$2 source: jrt:/java.base + [info][class,load] jdk.internal.misc.SharedSecrets source: jrt:/java.base [info][class,load] java.security.AccessController source: jrt:/java.base [info][class,load] java.util.Collections source: jrt:/java.base [info][class,load] java.lang.Iterable source: jrt:/java.base *************** *** 167,173 **** [info][class,load] java.lang.ref.ReferenceQueue$Lock source: jrt:/java.base [info][class,load] jdk.internal.misc.JavaLangRefAccess source: jrt:/java.base [info][class,load] java.lang.ref.Reference$1 source: jrt:/java.base - [info][class,load] jdk.internal.misc.SharedSecrets source: jrt:/java.base [info][class,load] java.lang.Class$Atomic source: jrt:/java.base [info][class,load] java.lang.reflect.ReflectPermission source: jrt:/java.base [info][class,load] jdk.internal.reflect.ReflectionFactory$GetReflectionFactoryAction source: jrt:/java.base --- 170,175 ---- *************** *** 389,413 **** [info][class,load] jdk.internal.module.SystemModules source: jrt:/java.base [info][class,load] java.lang.module.ModuleDescriptor source: jrt:/java.base [info][class,load] jdk.internal.module.Builder source: jrt:/java.base [info][class,load] jdk.internal.misc.JavaLangModuleAccess source: jrt:/java.base [info][class,load] java.lang.module.ModuleDescriptor$1 source: jrt:/java.base [info][class,load] java.lang.module.ModuleDescriptor$Requires$Modifier source: jrt:/java.base [info][class,load] java.lang.module.ModuleDescriptor$Requires source: jrt:/java.base - [info][class,load] java.util.Collections$EmptyIterator source: jrt:/java.base [info][class,load] java.util.Collections$1 source: jrt:/java.base [info][class,load] java.lang.module.ModuleDescriptor$Exports source: jrt:/java.base [info][class,load] java.util.HashMap$TreeNode source: jrt:/java.base [info][class,load] java.lang.module.ModuleDescriptor$Version source: jrt:/java.base [info][class,load] java.util.ArrayList source: jrt:/java.base - [info][class,load] java.util.Collections$UnmodifiableCollection source: jrt:/java.base - [info][class,load] java.util.Collections$UnmodifiableSet source: jrt:/java.base [info][class,load] java.util.Collections$UnmodifiableMap source: jrt:/java.base - [info][class,load] java.lang.module.ModuleDescriptor$Provides source: jrt:/java.base [info][class,load] java.util.HashMap$KeySet source: jrt:/java.base [info][class,load] java.util.HashMap$HashIterator source: jrt:/java.base [info][class,load] java.util.HashMap$KeyIterator source: jrt:/java.base - [info][class,load] jdk.internal.module.ModuleHashes source: jrt:/java.base [info][class,load] java.util.LinkedHashSet source: jrt:/java.base [info][class,load] jdk.internal.module.ModuleHashes$HashSupplier source: jrt:/java.base [info][class,load] java.lang.module.SystemModuleFinder$2 source: jrt:/java.base [info][class,load] java.util.function.Supplier source: jrt:/java.base --- 391,416 ---- [info][class,load] jdk.internal.module.SystemModules source: jrt:/java.base [info][class,load] java.lang.module.ModuleDescriptor source: jrt:/java.base [info][class,load] jdk.internal.module.Builder source: jrt:/java.base + [info][class,load] jdk.internal.misc.SharedSecrets$U source: jrt:/java.base [info][class,load] jdk.internal.misc.JavaLangModuleAccess source: jrt:/java.base [info][class,load] java.lang.module.ModuleDescriptor$1 source: jrt:/java.base [info][class,load] java.lang.module.ModuleDescriptor$Requires$Modifier source: jrt:/java.base [info][class,load] java.lang.module.ModuleDescriptor$Requires source: jrt:/java.base [info][class,load] java.util.Collections$1 source: jrt:/java.base + [info][class,load] java.util.Collections$EmptyIterator source: jrt:/java.base [info][class,load] java.lang.module.ModuleDescriptor$Exports source: jrt:/java.base + [info][class,load] java.util.Collections$UnmodifiableCollection source: jrt:/java.base + [info][class,load] java.util.Collections$UnmodifiableSet source: jrt:/java.base [info][class,load] java.util.HashMap$TreeNode source: jrt:/java.base + [info][class,load] java.lang.module.ModuleDescriptor$Provides source: jrt:/java.base [info][class,load] java.lang.module.ModuleDescriptor$Version source: jrt:/java.base [info][class,load] java.util.ArrayList source: jrt:/java.base [info][class,load] java.util.Collections$UnmodifiableMap source: jrt:/java.base [info][class,load] java.util.HashMap$KeySet source: jrt:/java.base [info][class,load] java.util.HashMap$HashIterator source: jrt:/java.base [info][class,load] java.util.HashMap$KeyIterator source: jrt:/java.base [info][class,load] java.util.LinkedHashSet source: jrt:/java.base + [info][class,load] jdk.internal.module.ModuleHashes source: jrt:/java.base [info][class,load] jdk.internal.module.ModuleHashes$HashSupplier source: jrt:/java.base [info][class,load] java.lang.module.SystemModuleFinder$2 source: jrt:/java.base [info][class,load] java.util.function.Supplier source: jrt:/java.base ...what we see is that the patch actually delays loading of some classes (except the 3 classes mentioned). Regards, Peter >> > I suggest we spin this off from the main issue and investigate afterwards, i have logged an issue: > > https://bugs.openjdk.java.net/browse/JDK-8160710 > > Paul. From volker.simonis at gmail.com Thu Jul 7 15:29:47 2016 From: volker.simonis at gmail.com (Volker Simonis) Date: Thu, 7 Jul 2016 17:29:47 +0200 Subject: RFR(S): 8160564: TEST: Add a test to check the implementation of VersionProps.versionNumbers() In-Reply-To: <577E6D37.5080807@redhat.com> References: <577E6D37.5080807@redhat.com> Message-ID: Hi Andrew, thanks a lot for the detailed explanation! Regards, Volker On Thu, Jul 7, 2016 at 4:54 PM, Andrew Dinn wrote: > On 07/07/16 14:59, Volker Simonis wrote: >> - I was a little bit surprised that I could reflectively access and >> execute java.lang.VersionProps.parseVersionNumbers() where both the >> class and the method are package private. Maybe this is related to >> Jigsaw issue #ReflectiveAccessToNonExportedTypes [3]? As I'm not a >> Jigsaw expert, I'd be graceful to anybody explaining me why this is >> still so easily possible with Jigsaw? > > Reflective access to non-public classes/members of exported packages is > unchanged with Jigsaw -- it is subject to the security checks in place > in previous JDKs but not to a module access check. So, in this case > java.lang is an exported package which means you can obtain a handle on > java.lang.VersionProps.parseVersionNumbers(), call setEnabled(true) and > then invoke it. > > It is only when you try to reflectively access non-public > classes/members of packages that are not exported by their owning module > that the check comes into play. So, if your (non-module) code obtains a > reflective Member for jdk.internal.misc.Unsafe.theUnsafe and calls > setEnabled(true) you will find that the latter call will not succeed in > rendering it an accessible handle and an access via that handle will > fail. That is because java.base does not export package > jdk.internal.misc so the module check under setEnabled detects that the > caller is in a different module and refuses to make it accessible. > > regards, > > > Andrew Dinn > ----------- > Senior Principal Software Engineer > Red Hat UK Ltd > Registered in England and Wales under Company Registration No. 03798903 > Directors: Michael Cunningham, Michael ("Mike") O'Neill, Eric Shander From Roger.Riggs at Oracle.com Thu Jul 7 15:32:32 2016 From: Roger.Riggs at Oracle.com (Roger Riggs) Date: Thu, 7 Jul 2016 11:32:32 -0400 Subject: RFR: 8153044: Allow a property to control location of tzdb.dat file In-Reply-To: References: Message-ID: <16006405-ce8a-339c-4260-7e7d1a516b81@Oracle.com> Hi Sean, I think I would rename the property to "jdk.time.zone.tzdbfile" to reinforce it is captive to the zone implementation. Though the original code builds the path with string concatenation, I think it would be better to use java.nio.Paths.get() to build it. i.e. Paths.get(getProperty("java.home"), "lib", "tzdb.dat"). Also, for the property access in the case of a security manager, use sun.security.actions.GetPropertyAction.privilegedGetProperty. Perhaps rename 'pathToRules' to 'pathToTzdb' Thanks, Roger On 7/7/2016 10:53 AM, Se?n Coffey wrote: > Looking to add a new implementation specific system property which > would allow the user to specify the location of the tzdb.dat file. > > https://bugs.openjdk.java.net/browse/JDK-8153044 > http://cr.openjdk.java.net/~coffeys/webrev.8153044/webrev/ > From claes.redestad at oracle.com Thu Jul 7 15:33:29 2016 From: claes.redestad at oracle.com (Claes Redestad) Date: Thu, 7 Jul 2016 17:33:29 +0200 Subject: RFR(S): 8160564: TEST: Add a test to check the implementation of VersionProps.versionNumbers() In-Reply-To: References: Message-ID: <577E7649.6000705@oracle.com> Hi Volker, On 2016-07-07 15:59, Volker Simonis wrote: > Hi, > > can I please have a review for the following change which makes > VersionProps.versionNumbers() testable and the corresponding > regression test: > > http://cr.openjdk.java.net/~simonis/webrevs/2016/8160564/ thanks for doing this! Changes to VersionProps looks good. Adding tests to the root of jdk/test/java/lang might be frowned upon. While VersionProps is a class of it's own, it is also tightly coupled with Runtime.java; perhaps the test could find a home under java/lang/Runtime/Version? For readability List.of might be preferred over Arrays.asList > https://bugs.openjdk.java.net/browse/JDK-8160564 > > During the review for "8160457: VersionProps.versionNumbers() is > broken" it was suggested to refactor VersionProps.versionNumbers() in > order to make it testable by a regression test. This change does > exactly that. It extracts the implementation of > VersionProps.versionNumbers() into a new method > parseVersionNumbers(String versionNumber) which can be tested from the > associated regression test. > > There are still two points to notice: > > - VersionProps.versionNumbers() deliberately doesn't check for badly > formatted version strings because it is assumed it will only get valid > input (see discussion for "JDK-8160000: Runtime.version() cause > startup regressions" at [2]). So we can currently only check that > VersionProps.versionNumbers() accepts all kind of valid version > strings. Not sure how error checking could or should be improved: VersionProps.parseVersionNumbers(String) will throw a NFE on most malformed data, technically an IllegalArgumentException. Same thing would happen if you ran an invalid string through Runtime.Version.parse(String) (having NumberFormatException specified to be thrown there is perhaps redundant). So, wouldn't pre-8160000 behavior be more or less the same if someone specified an un-parseable version string during setup? Perhaps the test could verify that both parseVersionNumber(String) and Runtime.Version.parse(String) throws exceptions on the same input. Thanks! /Claes > > - I was a little bit surprised that I could reflectively access and > execute java.lang.VersionProps.parseVersionNumbers() where both the > class and the method are package private. Maybe this is related to > Jigsaw issue #ReflectiveAccessToNonExportedTypes [3]? As I'm not a > Jigsaw expert, I'd be graceful to anybody explaining me why this is > still so easily possible with Jigsaw? > > Thank you and best regards, > Volker > > > [1] http://mail.openjdk.java.net/pipermail/core-libs-dev/2016-June/042058.html > [2] https://bugs.openjdk.java.net/browse/JDK-8160000 > [3] http://openjdk.java.net/projects/jigsaw/spec/issues/#ReflectiveAccessToNonExportedTypes > From mark.reinhold at oracle.com Thu Jul 7 15:37:44 2016 From: mark.reinhold at oracle.com (mark.reinhold at oracle.com) Date: Thu, 07 Jul 2016 08:37:44 -0700 Subject: RFR: 8153044: Allow a property to control location of tzdb.dat file In-Reply-To: References: Message-ID: <20160707083744.177672438eggemoggin.niobe.net> 2016/7/7 8:02:21 -0700, scolebourne at joda.org: > I won't block this change, but I remain unenthused. There are other > ways to control the time-zone data, and since tzdb.dat is currently a > private format file that is part of the internals of the JDK, it seems > odd to be exposing it. I agree. This is an internal implementation detail. If we define this system property then it becomes something we'll have to document and support, likely for a very long time. I suggest WNF. > Having the tzdb.dat as a versioned module that could be replaced, or > linked in would, by contrast, be potentially very useful. Hrm, now if we only had a module system ... - Mark From svetlana.nikandrova at oracle.com Thu Jul 7 15:49:54 2016 From: svetlana.nikandrova at oracle.com (Svetlana Nikandrova) Date: Thu, 07 Jul 2016 18:49:54 +0300 Subject: RFR 8054213: Class name repeated in output of Type.toString() In-Reply-To: <57754C8A.7040503@oracle.com> References: <57644535.3060709@oracle.com> <576D2072.4050701@oracle.com> <57716F7C.9080003@oracle.com> <5772C121.4000507@oracle.com> <968e8fd5-285c-1f65-3e5f-f4cedf5ddfe5@oracle.com> <57754C8A.7040503@oracle.com> Message-ID: <577E7A22.2010202@oracle.com> Hello all, seems like Joe is busy right now, so meanwhile I'll be happy to hear other opinions on this topic. Thank you, Svetlana On 30.06.2016 19:44, Svetlana Nikandrova wrote: > Hello Joe, > > thank you for your advice! GenericStringTest looks really good with > annotations. I refactored my test, please see updated webrev: > http://cr.openjdk.java.net/~snikandrova/8054213/webrev.01/ > > > As for "." vs "$" let me provide an example: > E.g. we have class > public classTest { > > publicNested1.Nested2 foo() > { > return null; > } > > public classNested1 > { > public classNested2{} > } > } > The output of the > System.out.println(Test.class.getMethod("foo",null).getReturnType()); > Output: > class Test$Nested1$Nested2 (nested classes divided by "$") > while > System.out.println(Test.class.getMethod("foo",null).getGenericReturnType()); > Output: > Test$Nested1.Nested2(nested classes divided by "." if enclosed by parametrized type and "$" in other cases). > I think it's a little bit strange to have different separators for > inner classes depended on is it nested by parametrized or raw type. > > Thank you, > Svetlana > > On 28.06.2016 22:02, joe darcy wrote: >> Hello Svetlana, >> >> I'm not convinced '$' should be replaced with '.' in this context as >> '.' is what the separator used in source code. >> >> In any case, the test should be restructured. I recommend declaring >> an annotation type to hold the expected to string output. You can >> them loop over the methods from the class object and for the methods >> with the annotation verifying the toString output is as expected. For >> a guide see >> >> test/java/lang/reflect/Constructor/GenericStringTest.java >> >> Thanks, >> >> -Joe >> >> >> On 6/28/2016 11:25 AM, Svetlana Nikandrova wrote: >>> May be someone can find a minute? >>> >>> On 27.06.2016 21:25, Svetlana Nikandrova wrote: >>>> Kindly reminder >>>> >>>> On 24.06.2016 14:58, Svetlana Nikandrova wrote: >>>>> Hello, >>>>> >>>>> let me try again with updated version of webrev: >>>>> Webrev: >>>>> http://cr.openjdk.java.net/~snikandrova/8054213/webrev.01/ >>>>> >>>>> Issue: >>>>> https://bugs.openjdk.java.net/browse/JDK-8054213 >>>>> >>>>> Many thanks goes to Sergey Ustimenko for his valuable advises. I >>>>> believe fix looks nicer now. >>>>> JPRT tested. >>>>> >>>>> Thank you, >>>>> Svetlana >>>>> >>>>> On 17.06.2016 21:45, Svetlana Nikandrova wrote: >>>>>> Hello, >>>>>> >>>>>> could you please review this fix for toString() method of >>>>>> ParameterizedTypeImpl. >>>>>> The problem is that when we obtain simple name of nested type >>>>>> shared prefix is only removed for ParameterizedType owner. We >>>>>> need to remove it for other cases too. >>>>>> >>>>>> Please note that I also changed delimiter between outer and inner >>>>>> class from "." to "$". I believe as "$" is usually used to >>>>>> separate nested class name "." looks inconsistent and confusing. >>>>>> Let me know if you have any objections. >>>>>> >>>>>> Webrev: >>>>>> http://cr.openjdk.java.net/~msolovie/8054213/webrev.00/ >>>>>> >>>>>> Issue: >>>>>> https://bugs.openjdk.java.net/browse/JDK-8054213 >>>>>> >>>>>> Thank you, >>>>>> Svetlana >>>>> >>>> >>> >> > From volker.simonis at gmail.com Thu Jul 7 16:08:06 2016 From: volker.simonis at gmail.com (Volker Simonis) Date: Thu, 7 Jul 2016 18:08:06 +0200 Subject: RFR(S): 8160564: TEST: Add a test to check the implementation of VersionProps.versionNumbers() In-Reply-To: <577E7649.6000705@oracle.com> References: <577E7649.6000705@oracle.com> Message-ID: On Thu, Jul 7, 2016 at 5:33 PM, Claes Redestad wrote: > Hi Volker, > > On 2016-07-07 15:59, Volker Simonis wrote: >> >> Hi, >> >> can I please have a review for the following change which makes >> VersionProps.versionNumbers() testable and the corresponding >> regression test: >> >> http://cr.openjdk.java.net/~simonis/webrevs/2016/8160564/ > > > thanks for doing this! > > Changes to VersionProps looks good. > > Adding tests to the root of jdk/test/java/lang might be frowned upon. While > VersionProps is a class of it's own, it is also tightly coupled with > Runtime.java; perhaps the test could find a home under > java/lang/Runtime/Version? > > For readability List.of might be preferred over Arrays.asList > >> https://bugs.openjdk.java.net/browse/JDK-8160564 >> >> During the review for "8160457: VersionProps.versionNumbers() is >> broken" it was suggested to refactor VersionProps.versionNumbers() in >> order to make it testable by a regression test. This change does >> exactly that. It extracts the implementation of >> VersionProps.versionNumbers() into a new method >> parseVersionNumbers(String versionNumber) which can be tested from the >> associated regression test. >> >> There are still two points to notice: >> >> - VersionProps.versionNumbers() deliberately doesn't check for badly >> formatted version strings because it is assumed it will only get valid >> input (see discussion for "JDK-8160000: Runtime.version() cause >> startup regressions" at [2]). So we can currently only check that >> VersionProps.versionNumbers() accepts all kind of valid version >> strings. > > > Not sure how error checking could or should be improved: > VersionProps.parseVersionNumbers(String) will throw a NFE on most malformed > data, technically an IllegalArgumentException. Same thing would happen if > you ran an invalid string through Runtime.Version.parse(String) (having > NumberFormatException specified to be thrown there is perhaps redundant). > So, wouldn't pre-8160000 behavior be more or less the same if someone > specified an un-parseable version string during setup? > > Perhaps the test could verify that both parseVersionNumber(String) and > Runtime.Version.parse(String) throws exceptions on the same input. > The problem is that they actually don't do that. parseVersionNumber(String) happily accepts leading zeros or negative numbers (actually everything that's parsed by Integer.parseInt()). Handling all these cases in parseVersionNumber(String) would either make the implementation quite complicated or bring us back to using a regexp. > Thanks! > > /Claes > > >> >> - I was a little bit surprised that I could reflectively access and >> execute java.lang.VersionProps.parseVersionNumbers() where both the >> class and the method are package private. Maybe this is related to >> Jigsaw issue #ReflectiveAccessToNonExportedTypes [3]? As I'm not a >> Jigsaw expert, I'd be graceful to anybody explaining me why this is >> still so easily possible with Jigsaw? >> >> Thank you and best regards, >> Volker >> >> >> [1] >> http://mail.openjdk.java.net/pipermail/core-libs-dev/2016-June/042058.html >> [2] https://bugs.openjdk.java.net/browse/JDK-8160000 >> [3] >> http://openjdk.java.net/projects/jigsaw/spec/issues/#ReflectiveAccessToNonExportedTypes >> > From john_platts at hotmail.com Thu Jul 7 16:18:59 2016 From: john_platts at hotmail.com (John Platts) Date: Thu, 7 Jul 2016 16:18:59 +0000 Subject: Improvements to BigDecimal(double, MathContext) constructor Message-ID: Here is the current significand?normalization?loop below?in the?BigDecimal(double, MathContext) constructor: ? ? ? ??// Normalize ? ? ? ? while ((significand & 1) == 0) { // i.e., significand is even ? ? ? ? ? ? significand >>= 1; ? ? ? ? ? ? exponent++; ? ? ? ? } Here is a better way to normalize the significand?in the?BigDecimal(double, MathContext) constructor: ? ? ? ? int significandTz = Long.numberOfTrailingZeros(significand); ? ? ? ? significand?>>=?significandTz; ? ? ? ? exponent += significandTz; From claes.redestad at oracle.com Thu Jul 7 16:30:38 2016 From: claes.redestad at oracle.com (Claes Redestad) Date: Thu, 7 Jul 2016 18:30:38 +0200 Subject: RFR(S): 8160564: TEST: Add a test to check the implementation of VersionProps.versionNumbers() In-Reply-To: References: <577E7649.6000705@oracle.com> Message-ID: <577E83AE.30908@oracle.com> On 2016-07-07 18:08, Volker Simonis wrote: >> Not sure how error checking could or should be improved: >> >VersionProps.parseVersionNumbers(String) will throw a NFE on most malformed >> >data, technically an IllegalArgumentException. Same thing would happen if >> >you ran an invalid string through Runtime.Version.parse(String) (having >> >NumberFormatException specified to be thrown there is perhaps redundant). >> >So, wouldn't pre-8160000 behavior be more or less the same if someone >> >specified an un-parseable version string during setup? >> > >> >Perhaps the test could verify that both parseVersionNumber(String) and >> >Runtime.Version.parse(String) throws exceptions on the same input. >> > > The problem is that they actually don't do that. > parseVersionNumber(String) happily accepts leading zeros or negative > numbers (actually everything that's parsed by Integer.parseInt()). > Handling all these cases in parseVersionNumber(String) would either > make the implementation quite complicated or bring us back to using a > regexp. > You're right, those specific corner-cases would slip through the 8160000 implementation but not Version.parse, but is handled OK by the build system by virtue of leading zeroes being stripped from and negative numbers being refused by --with-version-[major|minor|...] --with-version-string is checking for negative numbers, but doesn't strip leading zeroes: ---with-version-string=00032.0024 gives exactly that, which I guess is an issue. I guess a follow-up RFE to plug that hole in the build and perhaps to write a regression test verifying that configure doesn't accept badly formed version strings is in order. /Claes From claes.redestad at oracle.com Thu Jul 7 16:52:51 2016 From: claes.redestad at oracle.com (Claes Redestad) Date: Thu, 7 Jul 2016 18:52:51 +0200 Subject: Improvements to BigDecimal(double, MathContext) constructor In-Reply-To: References: Message-ID: <577E88E3.1020505@oracle.com> On 2016-07-07 18:18, John Platts wrote: > Here is the current significand normalization loop below in the BigDecimal(double, MathContext) constructor: > // Normalize > while ((significand & 1) == 0) { // i.e., significand is even > significand >>= 1; > exponent++; > } > > Here is a better way to normalize the significand in the BigDecimal(double, MathContext) constructor: > int significandTz = Long.numberOfTrailingZeros(significand); > significand >>= significandTz; > exponent += significandTz; Seems correct. Do you have any benchmark showing an improvement from this change? /Claes From martinrb at google.com Thu Jul 7 18:05:20 2016 From: martinrb at google.com (Martin Buchholz) Date: Thu, 7 Jul 2016 11:05:20 -0700 Subject: RFR(S): 8160564: TEST: Add a test to check the implementation of VersionProps.versionNumbers() In-Reply-To: <577E6D37.5080807@redhat.com> References: <577E6D37.5080807@redhat.com> Message-ID: When jdk9 is released, an army of white, black, grey, and red hats will try to keep their old Unsafe hacks alive and maybe get their hands on a jdk.internal.misc.Unsafe. Here's some code that tries to do that. The call to setAccessible succeeds! And the code succeeds in getting hold of jdk.internal.misc.Unsafe.class and of its instance before finally failing with IllegalAccessError. So this may actually be safe, in that user code may not be able to actually invoke methods on their ill-gotten Unsafe object, but the intent is probably that they shouldn't be able to get this far: /** * javac -Xmodule:java.base GetUnsafe9.java && java GetUnsafe9 */ public class GetUnsafe9 { public static void main(String[] args) throws Throwable { Class klazz = java.util.concurrent.ConcurrentHashMap.class; for (java.lang.reflect.Field field : klazz.getDeclaredFields()) { if (field.getName().equals("U")) { field.setAccessible(true); System.out.println(field); Object theUnsafe = field.get(null); System.out.println(theUnsafe); Class unsafeClass = (Class) theUnsafe.getClass(); System.out.println(unsafeClass); jdk.internal.misc.Unsafe U = unsafeClass.cast(theUnsafe); } } } } private static final jdk.internal.misc.Unsafe java.util.concurrent.ConcurrentHashMap.U jdk.internal.misc.Unsafe at 35851384 class jdk.internal.misc.Unsafe Exception in thread "main" java.lang.IllegalAccessError: class GetUnsafe9 (in unnamed module @0x649d209a) cannot access class jdk.internal.misc.Unsafe (in module java.base) because module java.base does not export jdk.internal.misc to unnamed module @0x649d209a at GetUnsafe9.main(GetUnsafe9.java:16) On Thu, Jul 7, 2016 at 7:54 AM, Andrew Dinn wrote: > On 07/07/16 14:59, Volker Simonis wrote: > > - I was a little bit surprised that I could reflectively access and > > execute java.lang.VersionProps.parseVersionNumbers() where both the > > class and the method are package private. Maybe this is related to > > Jigsaw issue #ReflectiveAccessToNonExportedTypes [3]? As I'm not a > > Jigsaw expert, I'd be graceful to anybody explaining me why this is > > still so easily possible with Jigsaw? > > Reflective access to non-public classes/members of exported packages is > unchanged with Jigsaw -- it is subject to the security checks in place > in previous JDKs but not to a module access check. So, in this case > java.lang is an exported package which means you can obtain a handle on > java.lang.VersionProps.parseVersionNumbers(), call setEnabled(true) and > then invoke it. > > It is only when you try to reflectively access non-public > classes/members of packages that are not exported by their owning module > that the check comes into play. So, if your (non-module) code obtains a > reflective Member for jdk.internal.misc.Unsafe.theUnsafe and calls > setEnabled(true) you will find that the latter call will not succeed in > rendering it an accessible handle and an access via that handle will > fail. That is because java.base does not export package > jdk.internal.misc so the module check under setEnabled detects that the > caller is in a different module and refuses to make it accessible. > > regards, > > > Andrew Dinn > ----------- > Senior Principal Software Engineer > Red Hat UK Ltd > Registered in England and Wales under Company Registration No. 03798903 > Directors: Michael Cunningham, Michael ("Mike") O'Neill, Eric Shander > From Alan.Bateman at oracle.com Thu Jul 7 18:28:07 2016 From: Alan.Bateman at oracle.com (Alan Bateman) Date: Thu, 7 Jul 2016 19:28:07 +0100 Subject: RFR(S): 8160564: TEST: Add a test to check the implementation of VersionProps.versionNumbers() In-Reply-To: References: <577E6D37.5080807@redhat.com> Message-ID: <8724f40a-0c7f-b0af-f32c-870b4294ae5f@oracle.com> On 07/07/2016 19:05, Martin Buchholz wrote: > When jdk9 is released, an army of white, black, grey, and red hats will try > to keep their old Unsafe hacks alive and maybe get their hands on a > jdk.internal.misc.Unsafe. I assume these Unsafe usages are sun.misc.Unsafe so they should continue to work. More details in JEP 260 [1]. > Here's some code that tries to do that. The call > to setAccessible succeeds! And the code succeeds in getting hold > of jdk.internal.misc.Unsafe.class and of its instance before finally > failing with IllegalAccessError. So this may actually be safe, in that > user code may not be able to actually invoke methods on their ill-gotten > Unsafe object, but the intent is probably that they shouldn't be able to > get this far: The behavior you see is expected. Many us would like setAccessible(true) to go away but there are many use-cases that would need alternatives first. -Alan [1] http://openjdk.java.net/jeps/260 From sean.coffey at oracle.com Thu Jul 7 18:44:08 2016 From: sean.coffey at oracle.com (=?UTF-8?Q?Se=c3=a1n_Coffey?=) Date: Thu, 7 Jul 2016 19:44:08 +0100 Subject: RFR: 8153044: Allow a property to control location of tzdb.dat file In-Reply-To: <20160707083744.177672438eggemoggin.niobe.net> References: <20160707083744.177672438eggemoggin.niobe.net> Message-ID: I'll (reluctantly) close this out then. I do think it was a convenient and low-maintenance feature that would allow end users the ability to bounce applications in an ordered fashion in order to pick up new tzdata rules. I'll investigate the upgradeable module approach. Regards, Sean. On 07/07/2016 16:37, mark.reinhold at oracle.com wrote: > 2016/7/7 8:02:21 -0700, scolebourne at joda.org: >> I won't block this change, but I remain unenthused. There are other >> ways to control the time-zone data, and since tzdb.dat is currently a >> private format file that is part of the internals of the JDK, it seems >> odd to be exposing it. > I agree. This is an internal implementation detail. If we define this > system property then it becomes something we'll have to document and > support, likely for a very long time. I suggest WNF. > >> Having the tzdb.dat as a versioned module that could be replaced, or >> linked in would, by contrast, be potentially very useful. > Hrm, now if we only had a module system ... > > - Mark From sean.coffey at oracle.com Thu Jul 7 18:49:06 2016 From: sean.coffey at oracle.com (=?UTF-8?Q?Se=c3=a1n_Coffey?=) Date: Thu, 7 Jul 2016 19:49:06 +0100 Subject: RFR: 8153044: Allow a property to control location of tzdb.dat file In-Reply-To: <16006405-ce8a-339c-4260-7e7d1a516b81@Oracle.com> References: <16006405-ce8a-339c-4260-7e7d1a516b81@Oracle.com> Message-ID: <60d702a0-2764-4f7e-04aa-9f9952911083@oracle.com> Thanks for the review Roger. As per other thread, I'm going to drop this feature for now. The TzdbZoneRulesProvider Object is already constructed in a doPrivileged block, so I believe it was covered on the security manager scenario. Regards, Sean. On 07/07/2016 16:32, Roger Riggs wrote: > Hi Sean, > > I think I would rename the property to "jdk.time.zone.tzdbfile" to > reinforce it is captive to the zone implementation. > > Though the original code builds the path with string concatenation, I > think it would be better > to use java.nio.Paths.get() to build it. > i.e. Paths.get(getProperty("java.home"), "lib", "tzdb.dat"). > > Also, for the property access in the case of a security manager, > use sun.security.actions.GetPropertyAction.privilegedGetProperty. > > Perhaps rename 'pathToRules' to 'pathToTzdb' > > Thanks, Roger > > > > On 7/7/2016 10:53 AM, Se?n Coffey wrote: >> Looking to add a new implementation specific system property which >> would allow the user to specify the location of the tzdb.dat file. >> >> https://bugs.openjdk.java.net/browse/JDK-8153044 >> http://cr.openjdk.java.net/~coffeys/webrev.8153044/webrev/ >> > From mark.reinhold at oracle.com Thu Jul 7 19:16:09 2016 From: mark.reinhold at oracle.com (mark.reinhold at oracle.com) Date: Thu, 7 Jul 2016 12:16:09 -0700 (PDT) Subject: JEP 293: Guidelines for JDK Command-Line Tool Options Message-ID: <20160707191609.E17CCB706A@eggemoggin.niobe.net> New JEP Candidate: http://openjdk.java.net/jeps/293 - Mark From xueming.shen at oracle.com Thu Jul 7 19:13:09 2016 From: xueming.shen at oracle.com (Xueming Shen) Date: Thu, 07 Jul 2016 12:13:09 -0700 Subject: RFR JDK-8133170 : Deflater.deflate with small output buffers fails Message-ID: <577EA9C5.1060608@oracle.com> Hi, Please help review the doc only change for this issue. issue: https://bugs.openjdk.java.net/browse/JDK-8133170 webrev: http://cr.openjdk.java.net/~sherman/8133170/webrev As explained in the zlib.h (quoted below), there are 5 bytes of flush marker being output to the output buffer repeatedly every time this method is invoked, a > 6 bytes buffer length is requested to make FULL_FLUSH and SYNC_FLUSH work. The proposed change here is to add this ">6 bytes" request into the java doc as suggested by the submitter. ----------------------------------------- If flush is set to Z_FULL_FLUSH, all output is flushed as with Z_SYNC_FLUSH, and the compression state is reset so that decompression can restart from this point if previous compressed data has been damaged or if random access is desired. Using Z_FULL_FLUSH too often can seriously degrade compression. If deflate returns with avail_out == 0, this function must be called again with the same value of the flush parameter and more output space (updated avail_out), until the flush is complete (deflate returns with non-zero avail_out). In the case of a Z_FULL_FLUSH or Z_SYNC_FLUSH, make sure that avail_out is greater than six to avoid repeated flush markers due to avail_out == 0 on return. ----------------------------------------- Thanks, Sherman From brian.burkhalter at oracle.com Thu Jul 7 19:40:01 2016 From: brian.burkhalter at oracle.com (Brian Burkhalter) Date: Thu, 7 Jul 2016 12:40:01 -0700 Subject: RFR JDK-8133170 : Deflater.deflate with small output buffers fails In-Reply-To: <577EA9C5.1060608@oracle.com> References: <577EA9C5.1060608@oracle.com> Message-ID: <1A88A336-340D-4183-BD4C-262F455D9226@oracle.com> This looks reasonable. +1. Brian On Jul 7, 2016, at 12:13 PM, Xueming Shen wrote: > Please help review the doc only change for this issue. > > issue: https://bugs.openjdk.java.net/browse/JDK-8133170 > webrev: http://cr.openjdk.java.net/~sherman/8133170/webrev > > As explained in the zlib.h (quoted below), there are 5 bytes of flush marker > being output to the output buffer repeatedly every time this method is invoked, > a > 6 bytes buffer length is requested to make FULL_FLUSH and SYNC_FLUSH > work. > > The proposed change here is to add this ">6 bytes" request into the java doc > as suggested by the submitter. From mandy.chung at oracle.com Thu Jul 7 19:54:41 2016 From: mandy.chung at oracle.com (Mandy Chung) Date: Thu, 7 Jul 2016 12:54:41 -0700 Subject: RFR(S): 8160564: TEST: Add a test to check the implementation of VersionProps.versionNumbers() In-Reply-To: References: Message-ID: Hi Volker, Thanks for adding a new test for it. Nit: can you wrap the long lines. As for the bad version, one possible change is to add assert Runtime.Version.parse(versionNumber) in parseVersionNumbers method and add -esa in @run tag. It?d be good to convert this to testng test where the dataprovider can show the input version and expected returned list. Mandy > On Jul 7, 2016, at 6:59 AM, Volker Simonis wrote: > > Hi, > > can I please have a review for the following change which makes > VersionProps.versionNumbers() testable and the corresponding > regression test: > > http://cr.openjdk.java.net/~simonis/webrevs/2016/8160564/ > https://bugs.openjdk.java.net/browse/JDK-8160564 > > During the review for "8160457: VersionProps.versionNumbers() is > broken" it was suggested to refactor VersionProps.versionNumbers() in > order to make it testable by a regression test. This change does > exactly that. It extracts the implementation of > VersionProps.versionNumbers() into a new method > parseVersionNumbers(String versionNumber) which can be tested from the > associated regression test. > > There are still two points to notice: > > - VersionProps.versionNumbers() deliberately doesn't check for badly > formatted version strings because it is assumed it will only get valid > input (see discussion for "JDK-8160000: Runtime.version() cause > startup regressions" at [2]). So we can currently only check that > VersionProps.versionNumbers() accepts all kind of valid version > strings. > > - I was a little bit surprised that I could reflectively access and > execute java.lang.VersionProps.parseVersionNumbers() where both the > class and the method are package private. Maybe this is related to > Jigsaw issue #ReflectiveAccessToNonExportedTypes [3]? As I'm not a > Jigsaw expert, I'd be graceful to anybody explaining me why this is > still so easily possible with Jigsaw? > > Thank you and best regards, > Volker > > > [1] http://mail.openjdk.java.net/pipermail/core-libs-dev/2016-June/042058.html > [2] https://bugs.openjdk.java.net/browse/JDK-8160000 > [3] http://openjdk.java.net/projects/jigsaw/spec/issues/#ReflectiveAccessToNonExportedTypes From coleen.phillimore at oracle.com Thu Jul 7 20:10:27 2016 From: coleen.phillimore at oracle.com (Coleen Phillimore) Date: Thu, 7 Jul 2016 16:10:27 -0400 Subject: Advice on cross-repo change: JDK-8160997 In-Reply-To: <577EADEA.6060109@oracle.com> References: <577EADEA.6060109@oracle.com> Message-ID: <48b58a9d-72ac-8f74-6ef2-e6b88f3f5d22@oracle.com> Hi, You can send this to core-libs-dev at openjdk.java.net and hotspot-dev at openjdk.java.net The sponsor should be from the runtime group. I don't know this well enough, so I'm going to point you to Dan (and Jerry, except Jerry's not a committer). To run JPRT don't forget to use -testset hotspot and you'll get zero failures. Coleen On 7/7/16 3:30 PM, Alan Burlison wrote: > Hi, > > I've peeled another one off my wad of patches, this one gits rid of > the use of deprecated and APIs and switches to the > POSIX ones. This works on both S11 and S12 - without it the JDK > doesn't build on S12. > > The change crosses repos so I'm looking for some advice on where best > to submit it for review? > > Files modified: > hotspot/src/os/solaris/vm/os_solaris.cpp > hotspot/src/os/solaris/vm/perfMemory_solaris.cpp > hotspot/src/os_cpu/solaris_sparc/vm/os_solaris_sparc.cpp > hotspot/src/os_cpu/solaris_x86/vm/os_solaris_x86.cpp > jdk/src/java.base/unix/native/libjava/ProcessHandleImpl_unix.c > jdk/src/java.base/unix/native/libnio/fs/UnixNativeDispatcher.c > jdk/src/jdk.security.auth/solaris/native/libjaas/Solaris.c > jdk/src/jdk.security.auth/unix/native/libjaas/Unix.c > > Bug: > https://bugs.openjdk.java.net/browse/JDK-8160997 > > Webrev: > http://jurassic.us.oracle.com/~alanbur/jdk/JDK-8160997/ > > Webrev zip: > http://jurassic.us.oracle.com/~alanbur/jdk/JDK-8160997.zip > > Patch (also attached to bug): > http://jurassic.us.oracle.com/~alanbur/jdk/JDK-8160997.patch > > JPRT results - 1 failure, looks unrelated > http://sthjprt.uk.oracle.com/archives/2016/07/2016-07-07-172040.alanbur.getpw/ > > > Thanks, > From steve.drach at oracle.com Thu Jul 7 20:32:13 2016 From: steve.drach at oracle.com (Steve Drach) Date: Thu, 7 Jul 2016 13:32:13 -0700 Subject: RFR: 8158295 Add a multi-release jar validation mechanism to jar tool Message-ID: Hi, Please review the following: webrev: http://cr.openjdk.java.net/~sdrach/8158295/webrev.01/ issue: https://bugs.openjdk.java.net/browse/JDK-8158295 This changeset adds a multi-release jar validator to jar tool. After the jar tool builds a multi-release jar, the potential resultant jar file is passed to the validator to assure that the jar file meets the minimal standards of a multi-release jar, in particular that versioned classes have the same api as base classes they override. There are other checks, for example warning if two classes are identical. If the jar file is invalid, it is not kept, so ?create will not produce a jar file and ?update will keep the input jar file. Thanks Steve From john.r.rose at oracle.com Thu Jul 7 20:53:59 2016 From: john.r.rose at oracle.com (John Rose) Date: Thu, 7 Jul 2016 13:53:59 -0700 Subject: RFR(S): 8160564: TEST: Add a test to check the implementation of VersionProps.versionNumbers() In-Reply-To: References: <577E6D37.5080807@redhat.com> Message-ID: <257984F1-ADCE-4AA4-A19A-1E4B50FEA827@oracle.com> On Jul 7, 2016, at 11:05 AM, Martin Buchholz wrote: > private static final jdk.internal.misc.Unsafe java.util.concurrent.ConcurrentHashMap.U Unless the security manager is turned on, you can do setAcc to pick up all sorts of private fields. As Alan points out, it would be good to tighten this up, but that will require new logic which somehow avoids breaking existing legitimate uses. (The new logic can't be some hack like "check for Unsafe". Point-fixes like that just complicate the security model, creating dark corners for black hats to work in.) The JVM and language are loose about mentioning inaccessible (or even non-existent) classes in field and method descriptors. In particular, the JVM does not resolve or access-check names which occur as types of fields, parameters, or return values. So accessing a field of type "Unsafe" (or even "NoSuchType") gets a pass, as long as the privacy of the field is somehow taken into account (via setAcc, here). > jdk.internal.misc.Unsafe at 35851384 Here we get an object of a non-exported type. That happens all the time; an anonymous inner class or lambda expression does this. Again, the language and JVM are loose about letting objects of internal type "escape" via public APIs. Arguably this is fundamental to OOP. > class jdk.internal.misc.Unsafe Here we inspect the class of the mysterious escaped object. You can do this to AICs and lambdas too. Our legacy reflection system says that Object.getClass returns the actual class of the object, without access check. Again, that's loose, and difficult to tighten compatibly with existing applications. In particular, adding an access check to getClass (which is the obvious move here) will perturb the performance model. Currently, getClass requires one or two memory references. An access check is likely to more than double that, with noticeable effects on dynamic languages. Nothing here is impossible to fix, but everything is tricky, because of backward compatibility. > Exception in thread "main" java.lang.IllegalAccessError: class GetUnsafe9 > (in unnamed module @0x649d209a) cannot access class > jdk.internal.misc.Unsafe (in module java.base) because module java.base > does not export jdk.internal.misc to unnamed module @0x649d209a > at GetUnsafe9.main(GetUnsafe9.java:16) Finally we get an error. The specific error comes from an invisible cast which follows a successful call to the Class.cast method: //jdk.internal.misc.Unsafe U = unsafeClass.cast(theUnsafe); // ==> Object $tem = unsafeClass.cast(theUnsafe); // descriptor is (Object)Object jdk.internal.misc.Unsafe U = (jdk.internal.misc.Unsafe) $tem; // javac inserts this cast The "checkcast" instruction in the second statement fails because it must resolve the type Unsafe. Even if there were other ways to get your hands on a well-typed Unsafe instance, as soon as you attempted to resolve an "invokevirtual" against it, you'd hit the same class resolution error as "checkcast" did. The reflection API performs similar checks to the source compiler and JVM bytecode executor (verifier & link resolver). However, since it works on "live" class pointers there is no resolution step to catch "bad" class references. So Class.cast and Method.invoke either have to let the "bad" class operate (which Class.cast does) or perform an additional ad hoc access check (which Method.invoke does). The additional access check is useful, but setAccessible nullifies it. Paradoxically, Class.cast (which doesn't have the ad hoc check) is more restrictive than Method.invoke, since javac puts in the invisible cast (forcing resolution on Class.cast) while Method.invoke can be neutered by setAccessible. Again, we are back to finding ways to rein in setAccessible. HTH ? John From rajan.halade at oracle.com Thu Jul 7 22:59:56 2016 From: rajan.halade at oracle.com (Rajan Halade) Date: Thu, 7 Jul 2016 15:59:56 -0700 Subject: RFR: 9: 8161011: Mark test/java/rmi/activation/ActivationGroup/downloadActivationGroup/DownloadActivationGroup.java as itnermittent Message-ID: This test is seen to fail intermittently due to JDK-8085192. Please review following patch which marks it as intermittent. diff -r 848c94ca6394 test/java/rmi/activation/ActivationGroup/downloadActivationGroup/DownloadActivationGroup.java --- a/test/java/rmi/activation/ActivationGroup/downloadActivationGroup/DownloadActivationGroup.java Thu Jul 07 14:16:58 2016 -0700 +++ b/test/java/rmi/activation/ActivationGroup/downloadActivationGroup/DownloadActivationGroup.java Thu Jul 07 15:55:14 2016 -0700 @@ -24,6 +24,7 @@ /* * @test * @bug 4510355 + * @key intermittent * @summary ActivationGroup implementations cannot be downloaded by default; * Creates a custom activation group without setting a security manager * in activation group's descriptor. The custom activation group Thanks, Rajan From dl at cs.oswego.edu Thu Jul 7 23:18:12 2016 From: dl at cs.oswego.edu (Doug Lea) Date: Thu, 7 Jul 2016 19:18:12 -0400 Subject: RFR: jsr166 jdk9 integration wave 7 In-Reply-To: <596f35d2-2fa9-fff3-c165-e6316bdb7c35@gmail.com> References: <1b9bd87d-5835-fb00-9db0-0de627f1952d@gmail.com> <76e3eb70-adc4-8d5d-74ee-d664e314b266@gmail.com> <577463C0.2070806@cs.oswego.edu> <71257D58-05D0-40CA-AA01-D47C2FB706EF@oracle.com> <596f35d2-2fa9-fff3-c165-e6316bdb7c35@gmail.com> Message-ID: <577EE334.2080601@cs.oswego.edu> On 07/07/2016 10:06 AM, Peter Levart wrote: > Why the naming wasn't more like the following: No matter which conventions you choose here, some people will be unhappy or confused. The current scheme seems to make the current users of both Unsafe and AtomicX least unhappy or confused. > VarHandle.getPlain ~ /* new method */ AtomicInteger.getPlain This is pretty close to original proposal. But ... > Why was it chosen that plain VarHandle.get() method is without Plain suffix? ... a few people complained about the "Plain" (or in one previous guise "Relaxed") suffix being unnecessary and inconsistently applied. For example, should weak-CAS be renamed weakCompareAndSetPlain? -Doug From amy.lu at oracle.com Fri Jul 8 02:01:28 2016 From: amy.lu at oracle.com (Amy Lu) Date: Fri, 8 Jul 2016 10:01:28 +0800 Subject: JDK 9 RFR of JDK-8132548: java/lang/ThreadGroup/Stop.java fails with "RuntimeException: Failure" Message-ID: <577F0978.4020902@oracle.com> Please review this trivial fix for test:java/lang/ThreadGroup/Stop.java Though this is a test for a deprecated API, failed with very very low frequency and hard to reproduce (I got no luck to reproduce it), I?d like to patch it as suggested: extend the sleep in the main thread from one second to five seconds. Also added 'volatile' to the boolean variable 'groupStopped'. bug: https://bugs.openjdk.java.net/browse/JDK-8132548 webrev: http://cr.openjdk.java.net/~amlu/8132548/webrev.00/ Thanks, Amy --- old/test/java/lang/ThreadGroup/Stop.java 2016-07-04 14:53:59.000000000 +0800 +++ new/test/java/lang/ThreadGroup/Stop.java 2016-07-04 14:53:58.000000000 +0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2016, 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 @@ -29,7 +29,7 @@ */ public class Stop implements Runnable { - private static boolean groupStopped = false ; + private static volatile boolean groupStopped = false ; private static final Object lock = new Object(); private static final ThreadGroup group = new ThreadGroup(""); @@ -70,7 +70,7 @@ while (!groupStopped) { lock.wait(); // Give the other thread a chance to stop - Thread.sleep(1000); + Thread.sleep(5000); } } From joe.darcy at oracle.com Fri Jul 8 04:15:36 2016 From: joe.darcy at oracle.com (joe darcy) Date: Thu, 7 Jul 2016 21:15:36 -0700 Subject: JDK 9 RFR of JDK-8132548: java/lang/ThreadGroup/Stop.java fails with "RuntimeException: Failure" In-Reply-To: <577F0978.4020902@oracle.com> References: <577F0978.4020902@oracle.com> Message-ID: Hi Amy, I'm a bit uncomfortable with the fix as-is. Rather than hard-coding sleep values, if sleep values are needed I think it is a better practice to use ones that are scaled with the jtreg timeout factors, etc. used to run the tests. Please instead use something like the adjustTimeout method of $JDK_FOREST_ROOT/test/lib/share/classes/jdk/test/lib/Utils As a general comment, I'd prefer we don't just up timeout values for tests. That can cause the whole test suite run to slow down, which is undesirable especially if the condition in question may actually be satisfied in many cases much faster than the timeout value. Thanks, -Joe On 7/7/2016 7:01 PM, Amy Lu wrote: > Please review this trivial fix for test:java/lang/ThreadGroup/Stop.java > > Though this is a test for a deprecated API, failed with very very low > frequency and hard to reproduce (I got no luck to reproduce it), I?d > like to patch it as suggested: extend the sleep in the main thread > from one second to five seconds. Also added 'volatile' to the boolean > variable 'groupStopped'. > > bug: https://bugs.openjdk.java.net/browse/JDK-8132548 > webrev: http://cr.openjdk.java.net/~amlu/8132548/webrev.00/ > > Thanks, > Amy > > > --- old/test/java/lang/ThreadGroup/Stop.java 2016-07-04 > 14:53:59.000000000 +0800 > +++ new/test/java/lang/ThreadGroup/Stop.java 2016-07-04 > 14:53:58.000000000 +0800 > @@ -1,5 +1,5 @@ > /* > - * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights > reserved. > + * Copyright (c) 1999, 2016, 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 > @@ -29,7 +29,7 @@ > */ > > public class Stop implements Runnable { > - private static boolean groupStopped = false ; > + private static volatile boolean groupStopped = false ; > private static final Object lock = new Object(); > > private static final ThreadGroup group = new ThreadGroup(""); > @@ -70,7 +70,7 @@ > while (!groupStopped) { > lock.wait(); > // Give the other thread a chance to stop > - Thread.sleep(1000); > + Thread.sleep(5000); > } > } > > > From henry.jen at oracle.com Fri Jul 8 04:43:44 2016 From: henry.jen at oracle.com (Henry Jen) Date: Thu, 7 Jul 2016 21:43:44 -0700 Subject: RFR: 8132379: -J options can cause crash or "Warning: app args parsing error passing arguments as-is" Message-ID: Hi, Please review a fix for JDK-8132379, the fix is to build matching index to the original arguments for the application arguments, used later for the sanity check and wildcard expansion. The fix is specific to Windows platform. -J prefix used by launcher-based tools such as javac need to be filtered out, but not for java itself, where -J prefix could be used by the main class. Use index table avoid copy of arguments and use less memory. The fix is tested on Windows 10. Bug:?https://bugs.openjdk.java.net/browse/JDK-8132379 Webrev:?http://cr.openjdk.java.net/~henryjen/jdk9/8132379.0/webrev/ Cheers, Henry From amy.lu at oracle.com Fri Jul 8 06:01:52 2016 From: amy.lu at oracle.com (Amy Lu) Date: Fri, 8 Jul 2016 14:01:52 +0800 Subject: JDK 9 RFR of JDK-8132548: java/lang/ThreadGroup/Stop.java fails with "RuntimeException: Failure" In-Reply-To: References: <577F0978.4020902@oracle.com> Message-ID: <577F41D0.6070904@oracle.com> Thank you Joe for your review. The intent is to give it more chance "for the thread group stop to be issued", not to extend the whole test execution timeout. I updated the webrev to make this in a retry, limit to 5 times of retry: http://cr.openjdk.java.net/~amlu/8132548/webrev.01/ Thanks, Amy On 7/8/16 12:15 PM, joe darcy wrote: > Hi Amy, > > I'm a bit uncomfortable with the fix as-is. > > Rather than hard-coding sleep values, if sleep values are needed I > think it is a better practice to use ones that are scaled with the > jtreg timeout factors, etc. used to run the tests. Please instead use > something like the adjustTimeout method of > > $JDK_FOREST_ROOT/test/lib/share/classes/jdk/test/lib/Utils > > As a general comment, I'd prefer we don't just up timeout values for > tests. That can cause the whole test suite run to slow down, which is > undesirable especially if the condition in question may actually be > satisfied in many cases much faster than the timeout value. > > Thanks, > > -Joe > > > On 7/7/2016 7:01 PM, Amy Lu wrote: >> Please review this trivial fix for test:java/lang/ThreadGroup/Stop.java >> >> Though this is a test for a deprecated API, failed with very very low >> frequency and hard to reproduce (I got no luck to reproduce it), I?d >> like to patch it as suggested: extend the sleep in the main thread >> from one second to five seconds. Also added 'volatile' to the boolean >> variable 'groupStopped'. >> >> bug: https://bugs.openjdk.java.net/browse/JDK-8132548 >> webrev: http://cr.openjdk.java.net/~amlu/8132548/webrev.00/ >> >> Thanks, >> Amy >> >> >> --- old/test/java/lang/ThreadGroup/Stop.java 2016-07-04 >> 14:53:59.000000000 +0800 >> +++ new/test/java/lang/ThreadGroup/Stop.java 2016-07-04 >> 14:53:58.000000000 +0800 >> @@ -1,5 +1,5 @@ >> /* >> - * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All >> rights reserved. >> + * Copyright (c) 1999, 2016, 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 >> @@ -29,7 +29,7 @@ >> */ >> >> public class Stop implements Runnable { >> - private static boolean groupStopped = false ; >> + private static volatile boolean groupStopped = false ; >> private static final Object lock = new Object(); >> >> private static final ThreadGroup group = new ThreadGroup(""); >> @@ -70,7 +70,7 @@ >> while (!groupStopped) { >> lock.wait(); >> // Give the other thread a chance to stop >> - Thread.sleep(1000); >> + Thread.sleep(5000); >> } >> } >> >> >> > From daniel.smith at oracle.com Fri Jul 8 06:07:26 2016 From: daniel.smith at oracle.com (Dan Smith) Date: Fri, 8 Jul 2016 00:07:26 -0600 Subject: JEP 293: Guidelines for JDK Command-Line Tool Options In-Reply-To: <20160707191609.E17CCB706A@eggemoggin.niobe.net> References: <20160707191609.E17CCB706A@eggemoggin.niobe.net> Message-ID: <97352012-5ED6-45C9-BC4B-4B5DDAE063BA@oracle.com> A suggestion for clarifying the text: I was confused about whether "may" refers to choices that the tool developer is allowed to make, or choices that the end user is allowed to make. For example: "Options can require an argument to be provided. For a long-form options, the argument may be separated from the option name by either white space or '='." Is the idea that the tool should support '=' as an alias for white space, or that the tool choose which form it wants to support? I'm guessing the latter, but I'm not totally confident in that guess. ?Dan From martinrb at google.com Fri Jul 8 06:36:53 2016 From: martinrb at google.com (Martin Buchholz) Date: Thu, 7 Jul 2016 23:36:53 -0700 Subject: JDK 9 RFR of JDK-8132548: java/lang/ThreadGroup/Stop.java fails with "RuntimeException: Failure" In-Reply-To: <577F41D0.6070904@oracle.com> References: <577F0978.4020902@oracle.com> <577F41D0.6070904@oracle.com> Message-ID: CountDownLatch is a better way of waiting for events, like for the two threads to be started and for Thread.stop to have been called. The test should ensure that ThreadDeath is indeed thrown. If the threads in the group notify the main thread via a latch when they catch ThreadDeath, then all the sleeps in this test can be removed. On Thu, Jul 7, 2016 at 11:01 PM, Amy Lu wrote: > Thank you Joe for your review. > > The intent is to give it more chance "for the thread group stop to be > issued", not to extend the whole test execution timeout. > > I updated the webrev to make this in a retry, limit to 5 times of retry: > http://cr.openjdk.java.net/~amlu/8132548/webrev.01/ > > Thanks, > Amy > > > On 7/8/16 12:15 PM, joe darcy wrote: > >> Hi Amy, >> >> I'm a bit uncomfortable with the fix as-is. >> >> Rather than hard-coding sleep values, if sleep values are needed I think >> it is a better practice to use ones that are scaled with the jtreg timeout >> factors, etc. used to run the tests. Please instead use something like the >> adjustTimeout method of >> >> $JDK_FOREST_ROOT/test/lib/share/classes/jdk/test/lib/Utils >> >> As a general comment, I'd prefer we don't just up timeout values for >> tests. That can cause the whole test suite run to slow down, which is >> undesirable especially if the condition in question may actually be >> satisfied in many cases much faster than the timeout value. >> >> Thanks, >> >> -Joe >> >> >> On 7/7/2016 7:01 PM, Amy Lu wrote: >> >>> Please review this trivial fix for test:java/lang/ThreadGroup/Stop.java >>> >>> Though this is a test for a deprecated API, failed with very very low >>> frequency and hard to reproduce (I got no luck to reproduce it), I?d like >>> to patch it as suggested: extend the sleep in the main thread from one >>> second to five seconds. Also added 'volatile' to the boolean variable >>> 'groupStopped'. >>> >>> bug: https://bugs.openjdk.java.net/browse/JDK-8132548 >>> webrev: http://cr.openjdk.java.net/~amlu/8132548/webrev.00/ >>> >>> Thanks, >>> Amy >>> >>> >>> --- old/test/java/lang/ThreadGroup/Stop.java 2016-07-04 >>> 14:53:59.000000000 +0800 >>> +++ new/test/java/lang/ThreadGroup/Stop.java 2016-07-04 >>> 14:53:58.000000000 +0800 >>> @@ -1,5 +1,5 @@ >>> /* >>> - * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights >>> reserved. >>> + * Copyright (c) 1999, 2016, 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 >>> @@ -29,7 +29,7 @@ >>> */ >>> >>> public class Stop implements Runnable { >>> - private static boolean groupStopped = false ; >>> + private static volatile boolean groupStopped = false ; >>> private static final Object lock = new Object(); >>> >>> private static final ThreadGroup group = new ThreadGroup(""); >>> @@ -70,7 +70,7 @@ >>> while (!groupStopped) { >>> lock.wait(); >>> // Give the other thread a chance to stop >>> - Thread.sleep(1000); >>> + Thread.sleep(5000); >>> } >>> } >>> >>> >>> >>> >> > From amy.lu at oracle.com Fri Jul 8 06:46:37 2016 From: amy.lu at oracle.com (Amy Lu) Date: Fri, 8 Jul 2016 14:46:37 +0800 Subject: JDK 9 RFR of JDK-8132548: java/lang/ThreadGroup/Stop.java fails with "RuntimeException: Failure" In-Reply-To: References: <577F0978.4020902@oracle.com> <577F41D0.6070904@oracle.com> Message-ID: <577F4C4D.9040504@oracle.com> Yes, but I just thought that for a test that testing a deprecated (since 1.2) API, and failed with very very low frequency (actually, only one time during the years), we might not want to spend much effort on a big change, like rewrite with CountDownLatch :-) Thanks, Amy On 7/8/16 2:36 PM, Martin Buchholz wrote: > CountDownLatch is a better way of waiting for events, like for the two > threads to be started and for Thread.stop to have been called. > > The test should ensure that ThreadDeath is indeed thrown. If the > threads in the group notify the main thread via a latch when they > catch ThreadDeath, then all the sleeps in this test can be removed. > > On Thu, Jul 7, 2016 at 11:01 PM, Amy Lu > wrote: > > Thank you Joe for your review. > > The intent is to give it more chance "for the thread group stop to > be issued", not to extend the whole test execution timeout. > > I updated the webrev to make this in a retry, limit to 5 times of > retry: > http://cr.openjdk.java.net/~amlu/8132548/webrev.01/ > > > Thanks, > Amy > > > On 7/8/16 12:15 PM, joe darcy wrote: > > Hi Amy, > > I'm a bit uncomfortable with the fix as-is. > > Rather than hard-coding sleep values, if sleep values are > needed I think it is a better practice to use ones that are > scaled with the jtreg timeout factors, etc. used to run the > tests. Please instead use something like the adjustTimeout > method of > > $JDK_FOREST_ROOT/test/lib/share/classes/jdk/test/lib/Utils > > As a general comment, I'd prefer we don't just up timeout > values for tests. That can cause the whole test suite run to > slow down, which is undesirable especially if the condition in > question may actually be satisfied in many cases much faster > than the timeout value. > > Thanks, > > -Joe > > > On 7/7/2016 7:01 PM, Amy Lu wrote: > > Please review this trivial fix for > test:java/lang/ThreadGroup/Stop.java > > Though this is a test for a deprecated API, failed with > very very low frequency and hard to reproduce (I got no > luck to reproduce it), I?d like to patch it as suggested: > extend the sleep in the main thread from one second to > five seconds. Also added 'volatile' to the boolean > variable 'groupStopped'. > > bug: https://bugs.openjdk.java.net/browse/JDK-8132548 > webrev: > http://cr.openjdk.java.net/~amlu/8132548/webrev.00/ > > > Thanks, > Amy > > > --- old/test/java/lang/ThreadGroup/Stop.java 2016-07-04 > 14:53:59.000000000 +0800 > +++ new/test/java/lang/ThreadGroup/Stop.java 2016-07-04 > 14:53:58.000000000 +0800 > @@ -1,5 +1,5 @@ > /* > - * Copyright (c) 1999, 2011, Oracle and/or its > affiliates. All rights reserved. > + * Copyright (c) 1999, 2016, 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 > @@ -29,7 +29,7 @@ > */ > > public class Stop implements Runnable { > - private static boolean groupStopped = false ; > + private static volatile boolean groupStopped = false ; > private static final Object lock = new Object(); > > private static final ThreadGroup group = new > ThreadGroup(""); > @@ -70,7 +70,7 @@ > while (!groupStopped) { > lock.wait(); > // Give the other thread a chance to stop > - Thread.sleep(1000); > + Thread.sleep(5000); > } > } > > > > > > From Alan.Burlison at oracle.com Fri Jul 8 08:13:53 2016 From: Alan.Burlison at oracle.com (Alan Burlison) Date: Fri, 8 Jul 2016 09:13:53 +0100 Subject: Advice on cross-repo change: JDK-8160997 In-Reply-To: <48b58a9d-72ac-8f74-6ef2-e6b88f3f5d22@oracle.com> References: <577EADEA.6060109@oracle.com> <48b58a9d-72ac-8f74-6ef2-e6b88f3f5d22@oracle.com> Message-ID: <577F60C1.7000406@oracle.com> On 07/07/2016 21:10, Coleen Phillimore wrote: > Hi, You can send this to core-libs-dev at openjdk.java.net and > hotspot-dev at openjdk.java.net I don't have author rights on cr.openjdk.java.net yet so I'm looking for someone to upload the webrev for me. > The sponsor should be from the runtime group. I don't know this well > enough, so I'm going to point you to Dan (and Jerry, except Jerry's not > a committer). OK, thanks. > To run JPRT don't forget to use -testset hotspot and you'll get zero > failures. It also touches files under jdk/src, will the hotspot testset suffice? -- Alan Burlison -- From sundararajan.athijegannathan at oracle.com Fri Jul 8 11:19:07 2016 From: sundararajan.athijegannathan at oracle.com (Sundararajan Athijegannathan) Date: Fri, 8 Jul 2016 16:49:07 +0530 Subject: RFR 8161055: Remove plugin ordering by isAfter, isBefore. Message-ID: <3217c62a-ddd6-f655-7b1c-a44e8c1407ca@oracle.com> Please review http://cr.openjdk.java.net/~sundar/8161055/webrev.00/ for https://bugs.openjdk.java.net/browse/JDK-8161055 Thanks -Sundar From mandy.chung at oracle.com Fri Jul 8 11:37:14 2016 From: mandy.chung at oracle.com (Mandy Chung) Date: Fri, 8 Jul 2016 04:37:14 -0700 Subject: RFR 8161055: Remove plugin ordering by isAfter, isBefore. In-Reply-To: <3217c62a-ddd6-f655-7b1c-a44e8c1407ca@oracle.com> References: <3217c62a-ddd6-f655-7b1c-a44e8c1407ca@oracle.com> Message-ID: <9DBBF38F-89D9-4BEF-9A50-577B892BCACB@oracle.com> > On Jul 8, 2016, at 4:19 AM, Sundararajan Athijegannathan wrote: > > Please review http://cr.openjdk.java.net/~sundar/8161055/webrev.00/ for > https://bugs.openjdk.java.net/browse/JDK-8161055 +1 It?s good to see the plugin API being cleaned up. Mandy From james.laskey at oracle.com Fri Jul 8 11:38:30 2016 From: james.laskey at oracle.com (Jim Laskey (Oracle)) Date: Fri, 8 Jul 2016 08:38:30 -0300 Subject: RFR 8161055: Remove plugin ordering by isAfter, isBefore. In-Reply-To: <3217c62a-ddd6-f655-7b1c-a44e8c1407ca@oracle.com> References: <3217c62a-ddd6-f655-7b1c-a44e8c1407ca@oracle.com> Message-ID: <6392CF85-60FE-40AC-B4EC-313189A1B112@oracle.com> +1 > On Jul 8, 2016, at 8:19 AM, Sundararajan Athijegannathan wrote: > > Please review http://cr.openjdk.java.net/~sundar/8161055/webrev.00/ for > https://bugs.openjdk.java.net/browse/JDK-8161055 > > Thanks > > -Sundar > From jonathan.gibbons at oracle.com Fri Jul 8 14:01:27 2016 From: jonathan.gibbons at oracle.com (Jonathan Gibbons) Date: Fri, 08 Jul 2016 07:01:27 -0700 Subject: JEP 293: Guidelines for JDK Command-Line Tool Options In-Reply-To: <97352012-5ED6-45C9-BC4B-4B5DDAE063BA@oracle.com> References: <20160707191609.E17CCB706A@eggemoggin.niobe.net> <97352012-5ED6-45C9-BC4B-4B5DDAE063BA@oracle.com> Message-ID: <577FB237.5060301@oracle.com> On 07/07/2016 11:07 PM, Dan Smith wrote: > A suggestion for clarifying the text: I was confused about whether "may" refers to choices that the tool developer is allowed to make, or choices that the end user is allowed to make. > > For example: "Options can require an argument to be provided. For a long-form options, the argument may be separated from the option name by either white space or '='." > > Is the idea that the tool should support '=' as an alias for white space, or that the tool choose which form it wants to support? I'm guessing the latter, but I'm not totally confident in that guess. > > ?Dan It means that, as you put it, "=" is an alias for white-space, so that you can use either of the following forms: --module-path my:module:path --module-path=my:module:path Although it is typically easier to use and read the whitespace form, the '=' form is often more convenient when using the option in context where whitespace has conflicting significance. For example, contrast the following two ways of setting the module path of javac's runtime environment (OK, it's a contrived example, but you get the point) javac ... -J--module-path -Jmy:module:path ... javac ... -J--module-path=my:module:path ... Other, more realistic, examples that would require more setup to illustrate, would be in situations like shell scripts where you might need to take the shell's rules for white space expansion into account. -- Jon From daniel.smith at oracle.com Fri Jul 8 15:34:57 2016 From: daniel.smith at oracle.com (Dan Smith) Date: Fri, 8 Jul 2016 09:34:57 -0600 Subject: JEP 293: Guidelines for JDK Command-Line Tool Options In-Reply-To: <577FB237.5060301@oracle.com> References: <20160707191609.E17CCB706A@eggemoggin.niobe.net> <97352012-5ED6-45C9-BC4B-4B5DDAE063BA@oracle.com> <577FB237.5060301@oracle.com> Message-ID: <9BBB9352-3AF8-459C-8781-74BD28FB44E9@oracle.com> > On Jul 8, 2016, at 8:01 AM, Jonathan Gibbons wrote: > > On 07/07/2016 11:07 PM, Dan Smith wrote: >> A suggestion for clarifying the text: I was confused about whether "may" refers to choices that the tool developer is allowed to make, or choices that the end user is allowed to make. >> >> For example: "Options can require an argument to be provided. For a long-form options, the argument may be separated from the option name by either white space or '='." >> >> Is the idea that the tool should support '=' as an alias for white space, or that the tool choose which form it wants to support? I'm guessing the latter, but I'm not totally confident in that guess. >> >> ?Dan > > It means that, as you put it, "=" is an alias for white-space, so that you can use either of the following forms: > > --module-path my:module:path > --module-path=my:module:path Okay, good to know. So I suggest updating the text to make clear that "may" means a choice the end user makes, and the tool is meant to support both. (Other uses of "may" or similar words are also potentially ambiguous and could use some extra scrutiny.) ?Dan From james.laskey at oracle.com Fri Jul 8 15:53:19 2016 From: james.laskey at oracle.com (Jim Laskey (Oracle)) Date: Fri, 8 Jul 2016 12:53:19 -0300 Subject: RFR: JDK-8161067 - jlink: Enable plugins to use the module pool for class lookup Message-ID: http://cr.openjdk.java.net/~jlaskey/8161067/webrev/index.html https://bugs.openjdk.java.net/browse/JDK-8161067 From joe.darcy at oracle.com Fri Jul 8 17:17:06 2016 From: joe.darcy at oracle.com (joe darcy) Date: Fri, 8 Jul 2016 10:17:06 -0700 Subject: JDK 9 RFR of JDK-8132548: java/lang/ThreadGroup/Stop.java fails with "RuntimeException: Failure" In-Reply-To: <577F4C4D.9040504@oracle.com> References: <577F0978.4020902@oracle.com> <577F41D0.6070904@oracle.com> <577F4C4D.9040504@oracle.com> Message-ID: <94165a28-2cdf-508d-87f1-203f453c12f1@oracle.com> The most surefire way to make sure the test doesn't fail anymore is to hg rm the test; if and unless the code is actually removed, that would not be the most appropriate approach though ;-) While it might be overkill for this particular test, I think it would be preferable to start replacing our various sleep calls in tests with count down latches or other structures as appropriate. Converting this test could help provide a good example of the process. (As alluded to earlier, the test suite as a whole could be made to run somewhat faster. Tests which wait for seconds when the entire test could commonly run in milliseconds in many cases are proportionately a good candidate to speed up. The absolute wait time are also problematic on the other extreme, running under -Xint on a heavily loaded test system, "should never take this long" numbers often aren't enough.) Thanks, -Joe On 7/7/2016 11:46 PM, Amy Lu wrote: > Yes, but I just thought that for a test that testing a deprecated > (since 1.2) API, and failed with very very low frequency (actually, > only one time during the years), we might not want to spend much > effort on a big change, like rewrite with CountDownLatch :-) > > > Thanks, > Amy > > On 7/8/16 2:36 PM, Martin Buchholz wrote: >> CountDownLatch is a better way of waiting for events, like for the >> two threads to be started and for Thread.stop to have been called. >> >> The test should ensure that ThreadDeath is indeed thrown. If the >> threads in the group notify the main thread via a latch when they >> catch ThreadDeath, then all the sleeps in this test can be removed. >> >> On Thu, Jul 7, 2016 at 11:01 PM, Amy Lu > > wrote: >> >> Thank you Joe for your review. >> >> The intent is to give it more chance "for the thread group stop >> to be issued", not to extend the whole test execution timeout. >> >> I updated the webrev to make this in a retry, limit to 5 times of >> retry: >> http://cr.openjdk.java.net/~amlu/8132548/webrev.01/ >> >> >> Thanks, >> Amy >> >> >> On 7/8/16 12:15 PM, joe darcy wrote: >> >> Hi Amy, >> >> I'm a bit uncomfortable with the fix as-is. >> >> Rather than hard-coding sleep values, if sleep values are >> needed I think it is a better practice to use ones that are >> scaled with the jtreg timeout factors, etc. used to run the >> tests. Please instead use something like the adjustTimeout >> method of >> >> $JDK_FOREST_ROOT/test/lib/share/classes/jdk/test/lib/Utils >> >> As a general comment, I'd prefer we don't just up timeout >> values for tests. That can cause the whole test suite run to >> slow down, which is undesirable especially if the condition >> in question may actually be satisfied in many cases much >> faster than the timeout value. >> >> Thanks, >> >> -Joe >> >> >> On 7/7/2016 7:01 PM, Amy Lu wrote: >> >> Please review this trivial fix for >> test:java/lang/ThreadGroup/Stop.java >> >> Though this is a test for a deprecated API, failed with >> very very low frequency and hard to reproduce (I got no >> luck to reproduce it), I?d like to patch it as suggested: >> extend the sleep in the main thread from one second to >> five seconds. Also added 'volatile' to the boolean >> variable 'groupStopped'. >> >> bug: https://bugs.openjdk.java.net/browse/JDK-8132548 >> webrev: >> http://cr.openjdk.java.net/~amlu/8132548/webrev.00/ >> >> >> Thanks, >> Amy >> >> >> --- old/test/java/lang/ThreadGroup/Stop.java 2016-07-04 >> 14:53:59.000000000 +0800 >> +++ new/test/java/lang/ThreadGroup/Stop.java 2016-07-04 >> 14:53:58.000000000 +0800 >> @@ -1,5 +1,5 @@ >> /* >> - * Copyright (c) 1999, 2011, Oracle and/or its >> affiliates. All rights reserved. >> + * Copyright (c) 1999, 2016, 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 >> @@ -29,7 +29,7 @@ >> */ >> >> public class Stop implements Runnable { >> - private static boolean groupStopped = false ; >> + private static volatile boolean groupStopped = false ; >> private static final Object lock = new Object(); >> >> private static final ThreadGroup group = new >> ThreadGroup(""); >> @@ -70,7 +70,7 @@ >> while (!groupStopped) { >> lock.wait(); >> // Give the other thread a chance to stop >> - Thread.sleep(1000); >> + Thread.sleep(5000); >> } >> } >> >> >> >> >> >> > From martinrb at google.com Fri Jul 8 17:34:29 2016 From: martinrb at google.com (Martin Buchholz) Date: Fri, 8 Jul 2016 10:34:29 -0700 Subject: JDK 9 RFR of JDK-8132548: java/lang/ThreadGroup/Stop.java fails with "RuntimeException: Failure" In-Reply-To: <94165a28-2cdf-508d-87f1-203f453c12f1@oracle.com> References: <577F0978.4020902@oracle.com> <577F41D0.6070904@oracle.com> <577F4C4D.9040504@oracle.com> <94165a28-2cdf-508d-87f1-203f453c12f1@oracle.com> Message-ID: jdk/test/java/util/concurrent/tck has thousands of test methods. It used to take minutes to run them all, but now only takes 10 seconds, mostly due to replacements of sleeps with faster and more robust alternatives, often CountDownLatch. On Fri, Jul 8, 2016 at 10:17 AM, joe darcy wrote: > The most surefire way to make sure the test doesn't fail anymore is to hg > rm the test; if and unless the code is actually removed, that would not be > the most appropriate approach though ;-) > > While it might be overkill for this particular test, I think it would be > preferable to start replacing our various sleep calls in tests with count > down latches or other structures as appropriate. Converting this test could > help provide a good example of the process. > > (As alluded to earlier, the test suite as a whole could be made to run > somewhat faster. Tests which wait for seconds when the entire test could > commonly run in milliseconds in many cases are proportionately a good > candidate to speed up. The absolute wait time are also problematic on the > other extreme, running under -Xint on a heavily loaded test system, "should > never take this long" numbers often aren't enough.) > > Thanks, > > -Joe > > On 7/7/2016 11:46 PM, Amy Lu wrote: > > Yes, but I just thought that for a test that testing a deprecated (since > 1.2) API, and failed with very very low frequency (actually, only one time > during the years), we might not want to spend much effort on a big change, > like rewrite with CountDownLatch :-) > > > Thanks, > Amy > > On 7/8/16 2:36 PM, Martin Buchholz wrote: > > CountDownLatch is a better way of waiting for events, like for the two > threads to be started and for Thread.stop to have been called. > > The test should ensure that ThreadDeath is indeed thrown. If the threads > in the group notify the main thread via a latch when they catch > ThreadDeath, then all the sleeps in this test can be removed. > > On Thu, Jul 7, 2016 at 11:01 PM, Amy Lu wrote: > >> Thank you Joe for your review. >> >> The intent is to give it more chance "for the thread group stop to be >> issued", not to extend the whole test execution timeout. >> >> I updated the webrev to make this in a retry, limit to 5 times of retry: >> http://cr.openjdk.java.net/~amlu/8132548/webrev.01/ >> >> Thanks, >> Amy >> >> >> On 7/8/16 12:15 PM, joe darcy wrote: >> >>> Hi Amy, >>> >>> I'm a bit uncomfortable with the fix as-is. >>> >>> Rather than hard-coding sleep values, if sleep values are needed I think >>> it is a better practice to use ones that are scaled with the jtreg timeout >>> factors, etc. used to run the tests. Please instead use something like the >>> adjustTimeout method of >>> >>> $JDK_FOREST_ROOT/test/lib/share/classes/jdk/test/lib/Utils >>> >>> As a general comment, I'd prefer we don't just up timeout values for >>> tests. That can cause the whole test suite run to slow down, which is >>> undesirable especially if the condition in question may actually be >>> satisfied in many cases much faster than the timeout value. >>> >>> Thanks, >>> >>> -Joe >>> >>> >>> On 7/7/2016 7:01 PM, Amy Lu wrote: >>> >>>> Please review this trivial fix for test:java/lang/ThreadGroup/Stop.java >>>> >>>> Though this is a test for a deprecated API, failed with very very low >>>> frequency and hard to reproduce (I got no luck to reproduce it), I?d like >>>> to patch it as suggested: extend the sleep in the main thread from one >>>> second to five seconds. Also added 'volatile' to the boolean variable >>>> 'groupStopped'. >>>> >>>> bug: https://bugs.openjdk.java.net/browse/JDK-8132548 >>>> webrev: http://cr.openjdk.java.net/~amlu/8132548/webrev.00/ >>>> >>>> Thanks, >>>> Amy >>>> >>>> >>>> --- old/test/java/lang/ThreadGroup/Stop.java 2016-07-04 >>>> 14:53:59.000000000 +0800 >>>> +++ new/test/java/lang/ThreadGroup/Stop.java 2016-07-04 >>>> 14:53:58.000000000 +0800 >>>> @@ -1,5 +1,5 @@ >>>> /* >>>> - * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights >>>> reserved. >>>> + * Copyright (c) 1999, 2016, 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 >>>> @@ -29,7 +29,7 @@ >>>> */ >>>> >>>> public class Stop implements Runnable { >>>> - private static boolean groupStopped = false ; >>>> + private static volatile boolean groupStopped = false ; >>>> private static final Object lock = new Object(); >>>> >>>> private static final ThreadGroup group = new ThreadGroup(""); >>>> @@ -70,7 +70,7 @@ >>>> while (!groupStopped) { >>>> lock.wait(); >>>> // Give the other thread a chance to stop >>>> - Thread.sleep(1000); >>>> + Thread.sleep(5000); >>>> } >>>> } >>>> >>>> >>>> >>>> >>> >> > > > From martinrb at google.com Fri Jul 8 20:10:46 2016 From: martinrb at google.com (Martin Buchholz) Date: Fri, 8 Jul 2016 13:10:46 -0700 Subject: RFR: jsr166 jdk9 integration wave 7 In-Reply-To: <71257D58-05D0-40CA-AA01-D47C2FB706EF@oracle.com> References: <1b9bd87d-5835-fb00-9db0-0de627f1952d@gmail.com> <76e3eb70-adc4-8d5d-74ee-d664e314b266@gmail.com> <577463C0.2070806@cs.oswego.edu> <71257D58-05D0-40CA-AA01-D47C2FB706EF@oracle.com> Message-ID: On Thu, Jul 7, 2016 at 3:39 AM, Paul Sandoz wrote: > > Here is a spec diff for the atomics: > > > http://cr.openjdk.java.net/~psandoz/jdk9/JDK-8080603-concurrent-unsafe-vhs/specdiff/java/util/concurrent/atomic/package-summary.html > < > http://cr.openjdk.java.net/~psandoz/jdk9/JDK-8080603-concurrent-unsafe-vhs/specdiff/java/util/concurrent/atomic/package-summary.html > > > I looked at the specdiff - easier to review than the raw text diff. The new spec delegates heavily to the VarHandle spec. Let's make that spec good. Some of the old content, like the guidance on how to store floats/doubles in ints/longs in package-info .java, should probably be migrated to VarHandles, and not just discarded. From brian.burkhalter at oracle.com Sat Jul 9 00:17:51 2016 From: brian.burkhalter at oracle.com (Brian Burkhalter) Date: Fri, 8 Jul 2016 17:17:51 -0700 Subject: JDK 9 RFR of 8160215: jdk/test/java/io/Reader/ReaderBulkReadContract.java should clean up better Message-ID: <26BA0376-958E-4D68-BCC4-78023B16E321@oracle.com> Please review at your convenience. Issue: https://bugs.openjdk.java.net/browse/JDK-8160215 Diff: --- a/test/java/io/Reader/ReaderBulkReadContract.java +++ b/test/java/io/Reader/ReaderBulkReadContract.java @@ -148,7 +148,8 @@ private static File createTempFileWithContents(String contents) { try { - File file = File.createTempFile("ReaderContract", ""); + File testDir = new File(System.getProperty("test.dir", ".")); + File file = File.createTempFile("ReaderContract", "", testDir); try (FileWriter w = new FileWriter(file)) { w.write(contents); Summary: Create temporary files in the test scratch directory instead of in the default temporary file directory. Thanks, Brian From lance.andersen at oracle.com Sun Jul 10 14:50:04 2016 From: lance.andersen at oracle.com (Lance Andersen) Date: Sun, 10 Jul 2016 10:50:04 -0400 Subject: JDK 9 RFR of 8160215: jdk/test/java/io/Reader/ReaderBulkReadContract.java should clean up better In-Reply-To: <26BA0376-958E-4D68-BCC4-78023B16E321@oracle.com> References: <26BA0376-958E-4D68-BCC4-78023B16E321@oracle.com> Message-ID: <2EC38248-0E24-4479-BFBD-62616F33872F@oracle.com> Hi Brian, > On Jul 8, 2016, at 8:17 PM, Brian Burkhalter wrote: > > Please review at your convenience. > > Issue: https://bugs.openjdk.java.net/browse/JDK-8160215 > Diff: > > --- a/test/java/io/Reader/ReaderBulkReadContract.java > +++ b/test/java/io/Reader/ReaderBulkReadContract.java > @@ -148,7 +148,8 @@ > > private static File createTempFileWithContents(String contents) { > try { > - File file = File.createTempFile("ReaderContract", ""); > + File testDir = new File(System.getProperty("test.dir", ".")); > + File file = File.createTempFile("ReaderContract", "", testDir); > try (FileWriter w = new FileWriter(file)) { > w.write(contents); > > Summary: Create temporary files in the test scratch directory instead of in the default temporary file directory. I had issues in the past where SQE was using read only directories so writing to test.dir would fail for me. So I used the current directory instead which is the work directory which will get cleaned up after. HTH Best Lance > > Thanks, > > Brian 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 amy.lu at oracle.com Mon Jul 11 01:20:36 2016 From: amy.lu at oracle.com (Amy Lu) Date: Mon, 11 Jul 2016 09:20:36 +0800 Subject: JDK 9 RFR of JDK-8132548: java/lang/ThreadGroup/Stop.java fails with "RuntimeException: Failure" In-Reply-To: References: <577F0978.4020902@oracle.com> <577F41D0.6070904@oracle.com> <577F4C4D.9040504@oracle.com> <94165a28-2cdf-508d-87f1-203f453c12f1@oracle.com> Message-ID: <5782F464.3010206@oracle.com> Thank you for all the valuable comments. I'm updating the webrev... Thanks, Amy On 7/9/16 1:34 AM, Martin Buchholz wrote: > jdk/test/java/util/concurrent/tck has thousands of test methods. It > used to take minutes to run them all, but now only takes 10 seconds, > mostly due to replacements of sleeps with faster and more robust > alternatives, often CountDownLatch. > > On Fri, Jul 8, 2016 at 10:17 AM, joe darcy > wrote: > > The most surefire way to make sure the test doesn't fail anymore > is to hg rm the test; if and unless the code is actually removed, > that would not be the most appropriate approach though ;-) > > While it might be overkill for this particular test, I think it > would be preferable to start replacing our various sleep calls in > tests with count down latches or other structures as appropriate. > Converting this test could help provide a good example of the process. > > (As alluded to earlier, the test suite as a whole could be made to > run somewhat faster. Tests which wait for seconds when the entire > test could commonly run in milliseconds in many cases are > proportionately a good candidate to speed up. The absolute wait > time are also problematic on the other extreme, running under > -Xint on a heavily loaded test system, "should never take this > long" numbers often aren't enough.) > > Thanks, > > -Joe > > > On 7/7/2016 11:46 PM, Amy Lu wrote: >> Yes, but I just thought that for a test that testing a deprecated >> (since 1.2) API, and failed with very very low frequency >> (actually, only one time during the years), we might not want to >> spend much effort on a big change, like rewrite with >> CountDownLatch :-) >> >> >> Thanks, >> Amy >> >> On 7/8/16 2:36 PM, Martin Buchholz wrote: >>> CountDownLatch is a better way of waiting for events, like for >>> the two threads to be started and for Thread.stop to have been >>> called. >>> >>> The test should ensure that ThreadDeath is indeed thrown. If >>> the threads in the group notify the main thread via a latch when >>> they catch ThreadDeath, then all the sleeps in this test can be >>> removed. >>> >>> On Thu, Jul 7, 2016 at 11:01 PM, Amy Lu >> > wrote: >>> >>> Thank you Joe for your review. >>> >>> The intent is to give it more chance "for the thread group >>> stop to be issued", not to extend the whole test execution >>> timeout. >>> >>> I updated the webrev to make this in a retry, limit to 5 >>> times of retry: >>> http://cr.openjdk.java.net/~amlu/8132548/webrev.01/ >>> >>> >>> Thanks, >>> Amy >>> >>> >>> On 7/8/16 12:15 PM, joe darcy wrote: >>> >>> Hi Amy, >>> >>> I'm a bit uncomfortable with the fix as-is. >>> >>> Rather than hard-coding sleep values, if sleep values >>> are needed I think it is a better practice to use ones >>> that are scaled with the jtreg timeout factors, etc. >>> used to run the tests. Please instead use something like >>> the adjustTimeout method of >>> >>> $JDK_FOREST_ROOT/test/lib/share/classes/jdk/test/lib/Utils >>> >>> As a general comment, I'd prefer we don't just up >>> timeout values for tests. That can cause the whole test >>> suite run to slow down, which is undesirable especially >>> if the condition in question may actually be satisfied >>> in many cases much faster than the timeout value. >>> >>> Thanks, >>> >>> -Joe >>> >>> >>> On 7/7/2016 7:01 PM, Amy Lu wrote: >>> >>> Please review this trivial fix for >>> test:java/lang/ThreadGroup/Stop.java >>> >>> Though this is a test for a deprecated API, failed >>> with very very low frequency and hard to reproduce >>> (I got no luck to reproduce it), I?d like to patch >>> it as suggested: extend the sleep in the main thread >>> from one second to five seconds. Also added >>> 'volatile' to the boolean variable 'groupStopped'. >>> >>> bug: https://bugs.openjdk.java.net/browse/JDK-8132548 >>> webrev: >>> http://cr.openjdk.java.net/~amlu/8132548/webrev.00/ >>> >>> >>> Thanks, >>> Amy >>> >>> >>> --- old/test/java/lang/ThreadGroup/Stop.java >>> 2016-07-04 14:53:59.000000000 +0800 >>> +++ new/test/java/lang/ThreadGroup/Stop.java >>> 2016-07-04 14:53:58.000000000 +0800 >>> @@ -1,5 +1,5 @@ >>> /* >>> - * Copyright (c) 1999, 2011, Oracle and/or its >>> affiliates. All rights reserved. >>> + * Copyright (c) 1999, 2016, 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 >>> @@ -29,7 +29,7 @@ >>> */ >>> >>> public class Stop implements Runnable { >>> - private static boolean groupStopped = false ; >>> + private static volatile boolean groupStopped = >>> false ; >>> private static final Object lock = new Object(); >>> >>> private static final ThreadGroup group = new >>> ThreadGroup(""); >>> @@ -70,7 +70,7 @@ >>> while (!groupStopped) { >>> lock.wait(); >>> // Give the other thread a chance >>> to stop >>> - Thread.sleep(1000); >>> + Thread.sleep(5000); >>> } >>> } >>> >>> >>> >>> >>> >>> >> > > From david.holmes at oracle.com Mon Jul 11 07:12:13 2016 From: david.holmes at oracle.com (David Holmes) Date: Mon, 11 Jul 2016 17:12:13 +1000 Subject: JDK 9 RFR of JDK-8132548: java/lang/ThreadGroup/Stop.java fails with "RuntimeException: Failure" In-Reply-To: <577F41D0.6070904@oracle.com> References: <577F0978.4020902@oracle.com> <577F41D0.6070904@oracle.com> Message-ID: Hi Amy, Thanks for tackling this. On 8/07/2016 4:01 PM, Amy Lu wrote: > Thank you Joe for your review. > > The intent is to give it more chance "for the thread group stop to be > issued", not to extend the whole test execution timeout. > > I updated the webrev to make this in a retry, limit to 5 times of retry: > http://cr.openjdk.java.net/~amlu/8132548/webrev.01/ The retry serves no purpose here. groupStopped is being set to true and the waiting thread has been notified, so the loop will terminate after the first sleep. The failure happens when the main thread checks the isAlive() status of the second thread before the ThreadGroup.stop has actually had a chance to stop and terminate it - such that isAlive is now false. That is why I suggested waiting a bit longer by extending the sleep. I agree that making the test last at least 5 seconds is not ideal, but I didn't think it would be an issue in the big picture of testing. Ideally explicit "synchronization" is better than sleeps but that would again be missing the point with this test. We expect the thread to terminate, if it hasn't terminated in a "reasonable" time we consider the stop() to have failed and the test to fail. To that end we could remove the sleep altogether and change: boolean failed = second.isAlive(); to try { second.join(1000); } catch (InterruptedException shouldNotHappen) {} boolean failed = second.isAlive(); Now we use explicit event synchronization - great! But the test has the same failure issue now as it did with the sleep. Putting in a CountDownLatch would have exactly the same problem: we expect the second thread to signal the latch as it terminates, but if that doesn't happen within a "reasonable" amount of time, then we deem the stop() to have failed and the test to have failed. Also note that the more code we add the more likely the second call to second.stop() triggers an async exception in code that can't handle it and results in an even worse failure mode! The only thing I can suggest is to get rid of the explicit sleep (or join, or latch.await() etc) and simply recode as an infinite loop and rely on the test harness to tear things down when the overall test timeout kicks in. That way the test either passes or is timed-out, there is no explicit failure - but a busy loop is also bad so you would want a small sleep in there anyway: while (second.isAlive()) { Thread.sleep(10); } // Test passed - if we never get here the test times out and // we implicitly fail. Thanks, David > Thanks, > Amy > > On 7/8/16 12:15 PM, joe darcy wrote: >> Hi Amy, >> >> I'm a bit uncomfortable with the fix as-is. >> >> Rather than hard-coding sleep values, if sleep values are needed I >> think it is a better practice to use ones that are scaled with the >> jtreg timeout factors, etc. used to run the tests. Please instead use >> something like the adjustTimeout method of >> >> $JDK_FOREST_ROOT/test/lib/share/classes/jdk/test/lib/Utils >> >> As a general comment, I'd prefer we don't just up timeout values for >> tests. That can cause the whole test suite run to slow down, which is >> undesirable especially if the condition in question may actually be >> satisfied in many cases much faster than the timeout value. >> >> Thanks, >> >> -Joe >> >> >> On 7/7/2016 7:01 PM, Amy Lu wrote: >>> Please review this trivial fix for test:java/lang/ThreadGroup/Stop.java >>> >>> Though this is a test for a deprecated API, failed with very very low >>> frequency and hard to reproduce (I got no luck to reproduce it), I?d >>> like to patch it as suggested: extend the sleep in the main thread >>> from one second to five seconds. Also added 'volatile' to the boolean >>> variable 'groupStopped'. >>> >>> bug: https://bugs.openjdk.java.net/browse/JDK-8132548 >>> webrev: http://cr.openjdk.java.net/~amlu/8132548/webrev.00/ >>> >>> Thanks, >>> Amy >>> >>> >>> --- old/test/java/lang/ThreadGroup/Stop.java 2016-07-04 >>> 14:53:59.000000000 +0800 >>> +++ new/test/java/lang/ThreadGroup/Stop.java 2016-07-04 >>> 14:53:58.000000000 +0800 >>> @@ -1,5 +1,5 @@ >>> /* >>> - * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All >>> rights reserved. >>> + * Copyright (c) 1999, 2016, 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 >>> @@ -29,7 +29,7 @@ >>> */ >>> >>> public class Stop implements Runnable { >>> - private static boolean groupStopped = false ; >>> + private static volatile boolean groupStopped = false ; >>> private static final Object lock = new Object(); >>> >>> private static final ThreadGroup group = new ThreadGroup(""); >>> @@ -70,7 +70,7 @@ >>> while (!groupStopped) { >>> lock.wait(); >>> // Give the other thread a chance to stop >>> - Thread.sleep(1000); >>> + Thread.sleep(5000); >>> } >>> } >>> >>> >>> >> > From amy.lu at oracle.com Mon Jul 11 07:20:13 2016 From: amy.lu at oracle.com (Amy Lu) Date: Mon, 11 Jul 2016 15:20:13 +0800 Subject: JDK 9 RFR of JDK-8132548: java/lang/ThreadGroup/Stop.java fails with "RuntimeException: Failure" In-Reply-To: <5782F464.3010206@oracle.com> References: <577F0978.4020902@oracle.com> <577F41D0.6070904@oracle.com> <577F4C4D.9040504@oracle.com> <94165a28-2cdf-508d-87f1-203f453c12f1@oracle.com> <5782F464.3010206@oracle.com> Message-ID: <578348AD.8060705@oracle.com> Please review the updated webrev: http://cr.openjdk.java.net/~amlu/8132548/webrev.02/ Thanks, Amy On 7/11/16 9:20 AM, Amy Lu wrote: > Thank you for all the valuable comments. > > I'm updating the webrev... > > Thanks, > Amy > > On 7/9/16 1:34 AM, Martin Buchholz wrote: >> jdk/test/java/util/concurrent/tck has thousands of test methods. It >> used to take minutes to run them all, but now only takes 10 seconds, >> mostly due to replacements of sleeps with faster and more robust >> alternatives, often CountDownLatch. >> >> On Fri, Jul 8, 2016 at 10:17 AM, joe darcy > > wrote: >> >> The most surefire way to make sure the test doesn't fail anymore >> is to hg rm the test; if and unless the code is actually removed, >> that would not be the most appropriate approach though ;-) >> >> While it might be overkill for this particular test, I think it >> would be preferable to start replacing our various sleep calls in >> tests with count down latches or other structures as appropriate. >> Converting this test could help provide a good example of the >> process. >> >> (As alluded to earlier, the test suite as a whole could be made >> to run somewhat faster. Tests which wait for seconds when the >> entire test could commonly run in milliseconds in many cases are >> proportionately a good candidate to speed up. The absolute wait >> time are also problematic on the other extreme, running under >> -Xint on a heavily loaded test system, "should never take this >> long" numbers often aren't enough.) >> >> Thanks, >> >> -Joe >> >> >> On 7/7/2016 11:46 PM, Amy Lu wrote: >>> Yes, but I just thought that for a test that testing a >>> deprecated (since 1.2) API, and failed with very very low >>> frequency (actually, only one time during the years), we might >>> not want to spend much effort on a big change, like rewrite with >>> CountDownLatch :-) >>> >>> >>> Thanks, >>> Amy >>> >>> On 7/8/16 2:36 PM, Martin Buchholz wrote: >>>> CountDownLatch is a better way of waiting for events, like for >>>> the two threads to be started and for Thread.stop to have been >>>> called. >>>> >>>> The test should ensure that ThreadDeath is indeed thrown. If >>>> the threads in the group notify the main thread via a latch >>>> when they catch ThreadDeath, then all the sleeps in this test >>>> can be removed. >>>> >>>> On Thu, Jul 7, 2016 at 11:01 PM, Amy Lu wrote: >>>> >>>> Thank you Joe for your review. >>>> >>>> The intent is to give it more chance "for the thread group >>>> stop to be issued", not to extend the whole test execution >>>> timeout. >>>> >>>> I updated the webrev to make this in a retry, limit to 5 >>>> times of retry: >>>> http://cr.openjdk.java.net/~amlu/8132548/webrev.01/ >>>> >>>> >>>> Thanks, >>>> Amy >>>> >>>> >>>> On 7/8/16 12:15 PM, joe darcy wrote: >>>> >>>> Hi Amy, >>>> >>>> I'm a bit uncomfortable with the fix as-is. >>>> >>>> Rather than hard-coding sleep values, if sleep values >>>> are needed I think it is a better practice to use ones >>>> that are scaled with the jtreg timeout factors, etc. >>>> used to run the tests. Please instead use something >>>> like the adjustTimeout method of >>>> >>>> $JDK_FOREST_ROOT/test/lib/share/classes/jdk/test/lib/Utils >>>> >>>> As a general comment, I'd prefer we don't just up >>>> timeout values for tests. That can cause the whole test >>>> suite run to slow down, which is undesirable especially >>>> if the condition in question may actually be satisfied >>>> in many cases much faster than the timeout value. >>>> >>>> Thanks, >>>> >>>> -Joe >>>> >>>> >>>> On 7/7/2016 7:01 PM, Amy Lu wrote: >>>> >>>> Please review this trivial fix for >>>> test:java/lang/ThreadGroup/Stop.java >>>> >>>> Though this is a test for a deprecated API, failed >>>> with very very low frequency and hard to reproduce >>>> (I got no luck to reproduce it), I?d like to patch >>>> it as suggested: extend the sleep in the main >>>> thread from one second to five seconds. Also added >>>> 'volatile' to the boolean variable 'groupStopped'. >>>> >>>> bug: https://bugs.openjdk.java.net/browse/JDK-8132548 >>>> webrev: >>>> http://cr.openjdk.java.net/~amlu/8132548/webrev.00/ >>>> >>>> >>>> Thanks, >>>> Amy >>>> >>>> >>>> --- old/test/java/lang/ThreadGroup/Stop.java >>>> 2016-07-04 14:53:59.000000000 +0800 >>>> +++ new/test/java/lang/ThreadGroup/Stop.java >>>> 2016-07-04 14:53:58.000000000 +0800 >>>> @@ -1,5 +1,5 @@ >>>> /* >>>> - * Copyright (c) 1999, 2011, Oracle and/or its >>>> affiliates. All rights reserved. >>>> + * Copyright (c) 1999, 2016, 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 >>>> @@ -29,7 +29,7 @@ >>>> */ >>>> >>>> public class Stop implements Runnable { >>>> - private static boolean groupStopped = false ; >>>> + private static volatile boolean groupStopped = >>>> false ; >>>> private static final Object lock = new Object(); >>>> >>>> private static final ThreadGroup group = new >>>> ThreadGroup(""); >>>> @@ -70,7 +70,7 @@ >>>> while (!groupStopped) { >>>> lock.wait(); >>>> // Give the other thread a chance >>>> to stop >>>> - Thread.sleep(1000); >>>> + Thread.sleep(5000); >>>> } >>>> } >>>> >>>> >>>> >>>> >>>> >>>> >>> >> >> > From david.holmes at oracle.com Mon Jul 11 07:24:50 2016 From: david.holmes at oracle.com (David Holmes) Date: Mon, 11 Jul 2016 17:24:50 +1000 Subject: JDK 9 RFR of JDK-8132548: java/lang/ThreadGroup/Stop.java fails with "RuntimeException: Failure" In-Reply-To: <578348AD.8060705@oracle.com> References: <577F0978.4020902@oracle.com> <577F41D0.6070904@oracle.com> <577F4C4D.9040504@oracle.com> <94165a28-2cdf-508d-87f1-203f453c12f1@oracle.com> <5782F464.3010206@oracle.com> <578348AD.8060705@oracle.com> Message-ID: My last email crossed with yours. Please see it. David On 11/07/2016 5:20 PM, Amy Lu wrote: > Please review the updated webrev: > http://cr.openjdk.java.net/~amlu/8132548/webrev.02/ > > Thanks, > Amy > > On 7/11/16 9:20 AM, Amy Lu wrote: >> Thank you for all the valuable comments. >> >> I'm updating the webrev... >> >> Thanks, >> Amy >> >> On 7/9/16 1:34 AM, Martin Buchholz wrote: >>> jdk/test/java/util/concurrent/tck has thousands of test methods. It >>> used to take minutes to run them all, but now only takes 10 seconds, >>> mostly due to replacements of sleeps with faster and more robust >>> alternatives, often CountDownLatch. >>> >>> On Fri, Jul 8, 2016 at 10:17 AM, joe darcy >> > wrote: >>> >>> The most surefire way to make sure the test doesn't fail anymore >>> is to hg rm the test; if and unless the code is actually removed, >>> that would not be the most appropriate approach though ;-) >>> >>> While it might be overkill for this particular test, I think it >>> would be preferable to start replacing our various sleep calls in >>> tests with count down latches or other structures as appropriate. >>> Converting this test could help provide a good example of the >>> process. >>> >>> (As alluded to earlier, the test suite as a whole could be made >>> to run somewhat faster. Tests which wait for seconds when the >>> entire test could commonly run in milliseconds in many cases are >>> proportionately a good candidate to speed up. The absolute wait >>> time are also problematic on the other extreme, running under >>> -Xint on a heavily loaded test system, "should never take this >>> long" numbers often aren't enough.) >>> >>> Thanks, >>> >>> -Joe >>> >>> >>> On 7/7/2016 11:46 PM, Amy Lu wrote: >>>> Yes, but I just thought that for a test that testing a >>>> deprecated (since 1.2) API, and failed with very very low >>>> frequency (actually, only one time during the years), we might >>>> not want to spend much effort on a big change, like rewrite with >>>> CountDownLatch :-) >>>> >>>> >>>> Thanks, >>>> Amy >>>> >>>> On 7/8/16 2:36 PM, Martin Buchholz wrote: >>>>> CountDownLatch is a better way of waiting for events, like for >>>>> the two threads to be started and for Thread.stop to have been >>>>> called. >>>>> >>>>> The test should ensure that ThreadDeath is indeed thrown. If >>>>> the threads in the group notify the main thread via a latch >>>>> when they catch ThreadDeath, then all the sleeps in this test >>>>> can be removed. >>>>> >>>>> On Thu, Jul 7, 2016 at 11:01 PM, Amy Lu wrote: >>>>> >>>>> Thank you Joe for your review. >>>>> >>>>> The intent is to give it more chance "for the thread group >>>>> stop to be issued", not to extend the whole test execution >>>>> timeout. >>>>> >>>>> I updated the webrev to make this in a retry, limit to 5 >>>>> times of retry: >>>>> http://cr.openjdk.java.net/~amlu/8132548/webrev.01/ >>>>> >>>>> >>>>> Thanks, >>>>> Amy >>>>> >>>>> >>>>> On 7/8/16 12:15 PM, joe darcy wrote: >>>>> >>>>> Hi Amy, >>>>> >>>>> I'm a bit uncomfortable with the fix as-is. >>>>> >>>>> Rather than hard-coding sleep values, if sleep values >>>>> are needed I think it is a better practice to use ones >>>>> that are scaled with the jtreg timeout factors, etc. >>>>> used to run the tests. Please instead use something >>>>> like the adjustTimeout method of >>>>> >>>>> >>>>> $JDK_FOREST_ROOT/test/lib/share/classes/jdk/test/lib/Utils >>>>> >>>>> As a general comment, I'd prefer we don't just up >>>>> timeout values for tests. That can cause the whole test >>>>> suite run to slow down, which is undesirable especially >>>>> if the condition in question may actually be satisfied >>>>> in many cases much faster than the timeout value. >>>>> >>>>> Thanks, >>>>> >>>>> -Joe >>>>> >>>>> >>>>> On 7/7/2016 7:01 PM, Amy Lu wrote: >>>>> >>>>> Please review this trivial fix for >>>>> test:java/lang/ThreadGroup/Stop.java >>>>> >>>>> Though this is a test for a deprecated API, failed >>>>> with very very low frequency and hard to reproduce >>>>> (I got no luck to reproduce it), I?d like to patch >>>>> it as suggested: extend the sleep in the main >>>>> thread from one second to five seconds. Also added >>>>> 'volatile' to the boolean variable 'groupStopped'. >>>>> >>>>> bug: https://bugs.openjdk.java.net/browse/JDK-8132548 >>>>> webrev: >>>>> http://cr.openjdk.java.net/~amlu/8132548/webrev.00/ >>>>> >>>>> >>>>> Thanks, >>>>> Amy >>>>> >>>>> >>>>> --- old/test/java/lang/ThreadGroup/Stop.java >>>>> 2016-07-04 14:53:59.000000000 +0800 >>>>> +++ new/test/java/lang/ThreadGroup/Stop.java >>>>> 2016-07-04 14:53:58.000000000 +0800 >>>>> @@ -1,5 +1,5 @@ >>>>> /* >>>>> - * Copyright (c) 1999, 2011, Oracle and/or its >>>>> affiliates. All rights reserved. >>>>> + * Copyright (c) 1999, 2016, 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 >>>>> @@ -29,7 +29,7 @@ >>>>> */ >>>>> >>>>> public class Stop implements Runnable { >>>>> - private static boolean groupStopped = false ; >>>>> + private static volatile boolean groupStopped = >>>>> false ; >>>>> private static final Object lock = new Object(); >>>>> >>>>> private static final ThreadGroup group = new >>>>> ThreadGroup(""); >>>>> @@ -70,7 +70,7 @@ >>>>> while (!groupStopped) { >>>>> lock.wait(); >>>>> // Give the other thread a chance >>>>> to stop >>>>> - Thread.sleep(1000); >>>>> + Thread.sleep(5000); >>>>> } >>>>> } >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>> >>> >>> >> > From david.holmes at oracle.com Mon Jul 11 07:25:58 2016 From: david.holmes at oracle.com (David Holmes) Date: Mon, 11 Jul 2016 17:25:58 +1000 Subject: JDK 9 RFR of JDK-8132548: java/lang/ThreadGroup/Stop.java fails with "RuntimeException: Failure" In-Reply-To: References: <577F0978.4020902@oracle.com> <577F41D0.6070904@oracle.com> Message-ID: Simplification ... On 11/07/2016 5:12 PM, David Holmes wrote: > Hi Amy, > > Thanks for tackling this. > > On 8/07/2016 4:01 PM, Amy Lu wrote: >> Thank you Joe for your review. >> >> The intent is to give it more chance "for the thread group stop to be >> issued", not to extend the whole test execution timeout. >> >> I updated the webrev to make this in a retry, limit to 5 times of retry: >> http://cr.openjdk.java.net/~amlu/8132548/webrev.01/ > > The retry serves no purpose here. groupStopped is being set to true and > the waiting thread has been notified, so the loop will terminate after > the first sleep. The failure happens when the main thread checks the > isAlive() status of the second thread before the ThreadGroup.stop has > actually had a chance to stop and terminate it - such that isAlive is > now false. That is why I suggested waiting a bit longer by extending the > sleep. > > I agree that making the test last at least 5 seconds is not ideal, but I > didn't think it would be an issue in the big picture of testing. > > Ideally explicit "synchronization" is better than sleeps but that would > again be missing the point with this test. We expect the thread to > terminate, if it hasn't terminated in a "reasonable" time we consider > the stop() to have failed and the test to fail. To that end we could > remove the sleep altogether and change: > > boolean failed = second.isAlive(); > > to > > try { > second.join(1000); > } catch (InterruptedException shouldNotHappen) {} > boolean failed = second.isAlive(); > > Now we use explicit event synchronization - great! But the test has the > same failure issue now as it did with the sleep. Putting in a > CountDownLatch would have exactly the same problem: we expect the second > thread to signal the latch as it terminates, but if that doesn't happen > within a "reasonable" amount of time, then we deem the stop() to have > failed and the test to have failed. > > Also note that the more code we add the more likely the second call to > second.stop() triggers an async exception in code that can't handle it > and results in an even worse failure mode! > > The only thing I can suggest is to get rid of the explicit sleep (or > join, or latch.await() etc) and simply recode as an infinite loop and > rely on the test harness to tear things down when the overall test > timeout kicks in. That way the test either passes or is timed-out, there > is no explicit failure - but a busy loop is also bad so you would want a > small sleep in there anyway: > > while (second.isAlive()) { > Thread.sleep(10); > } > // Test passed - if we never get here the test times out and > // we implicitly fail. Of course that was silly all you need is: second.join(); // Test passed - if we never get here the test times out and // we implicitly fail. David > Thanks, > David > >> Thanks, >> Amy >> >> On 7/8/16 12:15 PM, joe darcy wrote: >>> Hi Amy, >>> >>> I'm a bit uncomfortable with the fix as-is. >>> >>> Rather than hard-coding sleep values, if sleep values are needed I >>> think it is a better practice to use ones that are scaled with the >>> jtreg timeout factors, etc. used to run the tests. Please instead use >>> something like the adjustTimeout method of >>> >>> $JDK_FOREST_ROOT/test/lib/share/classes/jdk/test/lib/Utils >>> >>> As a general comment, I'd prefer we don't just up timeout values for >>> tests. That can cause the whole test suite run to slow down, which is >>> undesirable especially if the condition in question may actually be >>> satisfied in many cases much faster than the timeout value. >>> >>> Thanks, >>> >>> -Joe >>> >>> >>> On 7/7/2016 7:01 PM, Amy Lu wrote: >>>> Please review this trivial fix for test:java/lang/ThreadGroup/Stop.java >>>> >>>> Though this is a test for a deprecated API, failed with very very low >>>> frequency and hard to reproduce (I got no luck to reproduce it), I?d >>>> like to patch it as suggested: extend the sleep in the main thread >>>> from one second to five seconds. Also added 'volatile' to the boolean >>>> variable 'groupStopped'. >>>> >>>> bug: https://bugs.openjdk.java.net/browse/JDK-8132548 >>>> webrev: http://cr.openjdk.java.net/~amlu/8132548/webrev.00/ >>>> >>>> Thanks, >>>> Amy >>>> >>>> >>>> --- old/test/java/lang/ThreadGroup/Stop.java 2016-07-04 >>>> 14:53:59.000000000 +0800 >>>> +++ new/test/java/lang/ThreadGroup/Stop.java 2016-07-04 >>>> 14:53:58.000000000 +0800 >>>> @@ -1,5 +1,5 @@ >>>> /* >>>> - * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All >>>> rights reserved. >>>> + * Copyright (c) 1999, 2016, 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 >>>> @@ -29,7 +29,7 @@ >>>> */ >>>> >>>> public class Stop implements Runnable { >>>> - private static boolean groupStopped = false ; >>>> + private static volatile boolean groupStopped = false ; >>>> private static final Object lock = new Object(); >>>> >>>> private static final ThreadGroup group = new ThreadGroup(""); >>>> @@ -70,7 +70,7 @@ >>>> while (!groupStopped) { >>>> lock.wait(); >>>> // Give the other thread a chance to stop >>>> - Thread.sleep(1000); >>>> + Thread.sleep(5000); >>>> } >>>> } >>>> >>>> >>>> >>> >> From Alan.Bateman at oracle.com Mon Jul 11 07:56:31 2016 From: Alan.Bateman at oracle.com (Alan Bateman) Date: Mon, 11 Jul 2016 08:56:31 +0100 Subject: JDK 9 RFR of 8160215: jdk/test/java/io/Reader/ReaderBulkReadContract.java should clean up better In-Reply-To: <2EC38248-0E24-4479-BFBD-62616F33872F@oracle.com> References: <26BA0376-958E-4D68-BCC4-78023B16E321@oracle.com> <2EC38248-0E24-4479-BFBD-62616F33872F@oracle.com> Message-ID: On 10/07/2016 15:50, Lance Andersen wrote: > : > I had issues in the past where SQE was using read only directories so writing to test.dir would fail for me. So I used the current directory instead which is the work directory which will get cleaned up after. > > You might be thinking `test.src` which is the path to the test source. These properties are always easy to get mixed up but there is a good table in the jtreg tag language spec [1]. In any case, I don't think jtreg sets test.dir (at least I can't see it) but it's useful to set on the command-line when running the tests outside of the test harness, I think that is what Brian is doing here. -Alan [1] http://openjdk.java.net/jtreg/tag-spec.html#testvars From amy.lu at oracle.com Mon Jul 11 08:14:38 2016 From: amy.lu at oracle.com (Amy Lu) Date: Mon, 11 Jul 2016 16:14:38 +0800 Subject: JDK 9 RFR of JDK-8132548: java/lang/ThreadGroup/Stop.java fails with "RuntimeException: Failure" In-Reply-To: References: <577F0978.4020902@oracle.com> <577F41D0.6070904@oracle.com> Message-ID: <5783556E.4090708@oracle.com> Thank you David, though the email crossed-by, I hope all the concerns have been resolved in the updated webrev: http://cr.openjdk.java.net/~amlu/8132548/webrev.02/ I had rewrote the test with CountDownLatch and join(long millis). Also unlike the old version, test thread 'first' and 'second' do different things, and 'second' thread will keep alive for waiting to be killed by group.stop() from 'frist' thread in the same thread group. I think this could avoid the second call to second.stop() (group.stop()) issue. The time LONG_DELAY_MS used in join(long millis) is an adjusted timeout: private static final long LONG_DELAY_MS = Utils.adjustTimeout(1000L); ... second.join(LONG_DELAY_MS); boolean failed = second.isAlive(); This gives second thread a more "reasonable" time to die, with taking account of the test harness timeout. This almost same as second.join()// test pass or timeout, but with additional chance of killing all threads in a bad case. Thanks, Amy On 7/11/16 3:25 PM, David Holmes wrote: > Simplification ... > > On 11/07/2016 5:12 PM, David Holmes wrote: >> Hi Amy, >> >> Thanks for tackling this. >> >> On 8/07/2016 4:01 PM, Amy Lu wrote: >>> Thank you Joe for your review. >>> >>> The intent is to give it more chance "for the thread group stop to be >>> issued", not to extend the whole test execution timeout. >>> >>> I updated the webrev to make this in a retry, limit to 5 times of >>> retry: >>> http://cr.openjdk.java.net/~amlu/8132548/webrev.01/ >> >> The retry serves no purpose here. groupStopped is being set to true and >> the waiting thread has been notified, so the loop will terminate after >> the first sleep. The failure happens when the main thread checks the >> isAlive() status of the second thread before the ThreadGroup.stop has >> actually had a chance to stop and terminate it - such that isAlive is >> now false. That is why I suggested waiting a bit longer by extending the >> sleep. >> >> I agree that making the test last at least 5 seconds is not ideal, but I >> didn't think it would be an issue in the big picture of testing. >> >> Ideally explicit "synchronization" is better than sleeps but that would >> again be missing the point with this test. We expect the thread to >> terminate, if it hasn't terminated in a "reasonable" time we consider >> the stop() to have failed and the test to fail. To that end we could >> remove the sleep altogether and change: >> >> boolean failed = second.isAlive(); >> >> to >> >> try { >> second.join(1000); >> } catch (InterruptedException shouldNotHappen) {} >> boolean failed = second.isAlive(); >> >> Now we use explicit event synchronization - great! But the test has the >> same failure issue now as it did with the sleep. Putting in a >> CountDownLatch would have exactly the same problem: we expect the second >> thread to signal the latch as it terminates, but if that doesn't happen >> within a "reasonable" amount of time, then we deem the stop() to have >> failed and the test to have failed. >> >> Also note that the more code we add the more likely the second call to >> second.stop() triggers an async exception in code that can't handle it >> and results in an even worse failure mode! >> >> The only thing I can suggest is to get rid of the explicit sleep (or >> join, or latch.await() etc) and simply recode as an infinite loop and >> rely on the test harness to tear things down when the overall test >> timeout kicks in. That way the test either passes or is timed-out, there >> is no explicit failure - but a busy loop is also bad so you would want a >> small sleep in there anyway: >> >> while (second.isAlive()) { >> Thread.sleep(10); >> } >> // Test passed - if we never get here the test times out and >> // we implicitly fail. > > Of course that was silly all you need is: > > second.join(); > // Test passed - if we never get here the test times out and > // we implicitly fail. > > David > > >> Thanks, >> David >> >>> Thanks, >>> Amy >>> >>> On 7/8/16 12:15 PM, joe darcy wrote: >>>> Hi Amy, >>>> >>>> I'm a bit uncomfortable with the fix as-is. >>>> >>>> Rather than hard-coding sleep values, if sleep values are needed I >>>> think it is a better practice to use ones that are scaled with the >>>> jtreg timeout factors, etc. used to run the tests. Please instead use >>>> something like the adjustTimeout method of >>>> >>>> $JDK_FOREST_ROOT/test/lib/share/classes/jdk/test/lib/Utils >>>> >>>> As a general comment, I'd prefer we don't just up timeout values for >>>> tests. That can cause the whole test suite run to slow down, which is >>>> undesirable especially if the condition in question may actually be >>>> satisfied in many cases much faster than the timeout value. >>>> >>>> Thanks, >>>> >>>> -Joe >>>> >>>> >>>> On 7/7/2016 7:01 PM, Amy Lu wrote: >>>>> Please review this trivial fix for >>>>> test:java/lang/ThreadGroup/Stop.java >>>>> >>>>> Though this is a test for a deprecated API, failed with very very low >>>>> frequency and hard to reproduce (I got no luck to reproduce it), I?d >>>>> like to patch it as suggested: extend the sleep in the main thread >>>>> from one second to five seconds. Also added 'volatile' to the boolean >>>>> variable 'groupStopped'. >>>>> >>>>> bug: https://bugs.openjdk.java.net/browse/JDK-8132548 >>>>> webrev: http://cr.openjdk.java.net/~amlu/8132548/webrev.00/ >>>>> >>>>> Thanks, >>>>> Amy >>>>> >>>>> >>>>> --- old/test/java/lang/ThreadGroup/Stop.java 2016-07-04 >>>>> 14:53:59.000000000 +0800 >>>>> +++ new/test/java/lang/ThreadGroup/Stop.java 2016-07-04 >>>>> 14:53:58.000000000 +0800 >>>>> @@ -1,5 +1,5 @@ >>>>> /* >>>>> - * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All >>>>> rights reserved. >>>>> + * Copyright (c) 1999, 2016, 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 >>>>> @@ -29,7 +29,7 @@ >>>>> */ >>>>> >>>>> public class Stop implements Runnable { >>>>> - private static boolean groupStopped = false ; >>>>> + private static volatile boolean groupStopped = false ; >>>>> private static final Object lock = new Object(); >>>>> >>>>> private static final ThreadGroup group = new ThreadGroup(""); >>>>> @@ -70,7 +70,7 @@ >>>>> while (!groupStopped) { >>>>> lock.wait(); >>>>> // Give the other thread a chance to stop >>>>> - Thread.sleep(1000); >>>>> + Thread.sleep(5000); >>>>> } >>>>> } >>>>> >>>>> >>>>> >>>> >>> From amy.lu at oracle.com Mon Jul 11 08:26:17 2016 From: amy.lu at oracle.com (Amy Lu) Date: Mon, 11 Jul 2016 16:26:17 +0800 Subject: JDK 9 RFR of JDK-8132548: java/lang/ThreadGroup/Stop.java fails with "RuntimeException: Failure" In-Reply-To: <5783556E.4090708@oracle.com> References: <577F0978.4020902@oracle.com> <577F41D0.6070904@oracle.com> <5783556E.4090708@oracle.com> Message-ID: <57835829.4080708@oracle.com> On 7/11/16 4:14 PM, Amy Lu wrote: > Thank you David, though the email crossed-by, I hope all the concerns > have been resolved in the updated webrev: > http://cr.openjdk.java.net/~amlu/8132548/webrev.02/ > > I had rewrote the test with CountDownLatch and join(long millis). Also > unlike the old version, test thread 'first' and 'second' do different > things, and 'second' thread will keep alive for waiting to be killed > by group.stop() from 'frist' thread in the same thread group. I think > this could avoid the second call to second.stop() (group.stop()) issue. > > The time LONG_DELAY_MS used in join(long millis) is an adjusted timeout: > > private static final long LONG_DELAY_MS = Utils.adjustTimeout(1000L); Typo. private static final long LONG_DELAY_MS = Utils.adjustTimeout(5000L); Thanks, Amy > ... > > second.join(LONG_DELAY_MS); > boolean failed = second.isAlive(); > > This gives second thread a more "reasonable" time to die, with taking > account of the test harness timeout. > This almost same as second.join()// test pass or timeout, but with > additional chance of killing all threads in a bad case. > > Thanks, > Amy > > On 7/11/16 3:25 PM, David Holmes wrote: >> Simplification ... >> >> On 11/07/2016 5:12 PM, David Holmes wrote: >>> Hi Amy, >>> >>> Thanks for tackling this. >>> >>> On 8/07/2016 4:01 PM, Amy Lu wrote: >>>> Thank you Joe for your review. >>>> >>>> The intent is to give it more chance "for the thread group stop to be >>>> issued", not to extend the whole test execution timeout. >>>> >>>> I updated the webrev to make this in a retry, limit to 5 times of >>>> retry: >>>> http://cr.openjdk.java.net/~amlu/8132548/webrev.01/ >>> >>> The retry serves no purpose here. groupStopped is being set to true and >>> the waiting thread has been notified, so the loop will terminate after >>> the first sleep. The failure happens when the main thread checks the >>> isAlive() status of the second thread before the ThreadGroup.stop has >>> actually had a chance to stop and terminate it - such that isAlive is >>> now false. That is why I suggested waiting a bit longer by extending >>> the >>> sleep. >>> >>> I agree that making the test last at least 5 seconds is not ideal, >>> but I >>> didn't think it would be an issue in the big picture of testing. >>> >>> Ideally explicit "synchronization" is better than sleeps but that would >>> again be missing the point with this test. We expect the thread to >>> terminate, if it hasn't terminated in a "reasonable" time we consider >>> the stop() to have failed and the test to fail. To that end we could >>> remove the sleep altogether and change: >>> >>> boolean failed = second.isAlive(); >>> >>> to >>> >>> try { >>> second.join(1000); >>> } catch (InterruptedException shouldNotHappen) {} >>> boolean failed = second.isAlive(); >>> >>> Now we use explicit event synchronization - great! But the test has the >>> same failure issue now as it did with the sleep. Putting in a >>> CountDownLatch would have exactly the same problem: we expect the >>> second >>> thread to signal the latch as it terminates, but if that doesn't happen >>> within a "reasonable" amount of time, then we deem the stop() to have >>> failed and the test to have failed. >>> >>> Also note that the more code we add the more likely the second call to >>> second.stop() triggers an async exception in code that can't handle it >>> and results in an even worse failure mode! >>> >>> The only thing I can suggest is to get rid of the explicit sleep (or >>> join, or latch.await() etc) and simply recode as an infinite loop and >>> rely on the test harness to tear things down when the overall test >>> timeout kicks in. That way the test either passes or is timed-out, >>> there >>> is no explicit failure - but a busy loop is also bad so you would >>> want a >>> small sleep in there anyway: >>> >>> while (second.isAlive()) { >>> Thread.sleep(10); >>> } >>> // Test passed - if we never get here the test times out and >>> // we implicitly fail. >> >> Of course that was silly all you need is: >> >> second.join(); >> // Test passed - if we never get here the test times out and >> // we implicitly fail. >> >> David >> >> >>> Thanks, >>> David >>> >>>> Thanks, >>>> Amy >>>> >>>> On 7/8/16 12:15 PM, joe darcy wrote: >>>>> Hi Amy, >>>>> >>>>> I'm a bit uncomfortable with the fix as-is. >>>>> >>>>> Rather than hard-coding sleep values, if sleep values are needed I >>>>> think it is a better practice to use ones that are scaled with the >>>>> jtreg timeout factors, etc. used to run the tests. Please instead use >>>>> something like the adjustTimeout method of >>>>> >>>>> $JDK_FOREST_ROOT/test/lib/share/classes/jdk/test/lib/Utils >>>>> >>>>> As a general comment, I'd prefer we don't just up timeout values for >>>>> tests. That can cause the whole test suite run to slow down, which is >>>>> undesirable especially if the condition in question may actually be >>>>> satisfied in many cases much faster than the timeout value. >>>>> >>>>> Thanks, >>>>> >>>>> -Joe >>>>> >>>>> >>>>> On 7/7/2016 7:01 PM, Amy Lu wrote: >>>>>> Please review this trivial fix for >>>>>> test:java/lang/ThreadGroup/Stop.java >>>>>> >>>>>> Though this is a test for a deprecated API, failed with very very >>>>>> low >>>>>> frequency and hard to reproduce (I got no luck to reproduce it), I?d >>>>>> like to patch it as suggested: extend the sleep in the main thread >>>>>> from one second to five seconds. Also added 'volatile' to the >>>>>> boolean >>>>>> variable 'groupStopped'. >>>>>> >>>>>> bug: https://bugs.openjdk.java.net/browse/JDK-8132548 >>>>>> webrev: http://cr.openjdk.java.net/~amlu/8132548/webrev.00/ >>>>>> >>>>>> Thanks, >>>>>> Amy >>>>>> >>>>>> >>>>>> --- old/test/java/lang/ThreadGroup/Stop.java 2016-07-04 >>>>>> 14:53:59.000000000 +0800 >>>>>> +++ new/test/java/lang/ThreadGroup/Stop.java 2016-07-04 >>>>>> 14:53:58.000000000 +0800 >>>>>> @@ -1,5 +1,5 @@ >>>>>> /* >>>>>> - * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All >>>>>> rights reserved. >>>>>> + * Copyright (c) 1999, 2016, 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 >>>>>> @@ -29,7 +29,7 @@ >>>>>> */ >>>>>> >>>>>> public class Stop implements Runnable { >>>>>> - private static boolean groupStopped = false ; >>>>>> + private static volatile boolean groupStopped = false ; >>>>>> private static final Object lock = new Object(); >>>>>> >>>>>> private static final ThreadGroup group = new ThreadGroup(""); >>>>>> @@ -70,7 +70,7 @@ >>>>>> while (!groupStopped) { >>>>>> lock.wait(); >>>>>> // Give the other thread a chance to stop >>>>>> - Thread.sleep(1000); >>>>>> + Thread.sleep(5000); >>>>>> } >>>>>> } >>>>>> >>>>>> >>>>>> >>>>> >>>> > From paul.sandoz at oracle.com Mon Jul 11 10:10:27 2016 From: paul.sandoz at oracle.com (Paul Sandoz) Date: Mon, 11 Jul 2016 12:10:27 +0200 Subject: RFR: JDK-8161067 - jlink: Enable plugins to use the module pool for class lookup In-Reply-To: References: Message-ID: Hi Jim. Do you anticipate support across module boundaries given your comment? 282 // Navigating other modules via requires and exports is problematic 283 // since we cannot construct the runtime model of loaders and layers. it might be possible to emulate runtime resolution at link time for the set of idk.modules but not possible by default for non-idk modules because as you say we don?t know the runtime properties (such as layering), that would require some input from the developer (if it is indeed possible to express). I ask because there is a simpler way to express the current functionality, provide a method on ModuleEntry to obtain the LinkModule, rather than, or in addition to, the module name. Such functionality is much clearer regarding the scope of resolution. Paul. > On 8 Jul 2016, at 17:53, Jim Laskey (Oracle) wrote: > > http://cr.openjdk.java.net/~jlaskey/8161067/webrev/index.html > https://bugs.openjdk.java.net/browse/JDK-8161067 > From paul.sandoz at oracle.com Mon Jul 11 10:17:09 2016 From: paul.sandoz at oracle.com (Paul Sandoz) Date: Mon, 11 Jul 2016 12:17:09 +0200 Subject: RFR: jsr166 jdk9 integration wave 7 In-Reply-To: References: <1b9bd87d-5835-fb00-9db0-0de627f1952d@gmail.com> <76e3eb70-adc4-8d5d-74ee-d664e314b266@gmail.com> <577463C0.2070806@cs.oswego.edu> <71257D58-05D0-40CA-AA01-D47C2FB706EF@oracle.com> Message-ID: <481311FC-14F6-44B7-A9C6-688BAA49A6C4@oracle.com> > On 8 Jul 2016, at 22:10, Martin Buchholz wrote: > > > > On Thu, Jul 7, 2016 at 3:39 AM, Paul Sandoz > wrote: > > Here is a spec diff for the atomics: > > http://cr.openjdk.java.net/~psandoz/jdk9/JDK-8080603-concurrent-unsafe-vhs/specdiff/java/util/concurrent/atomic/package-summary.html > > > I looked at the specdiff - easier to review than the raw text diff. > The new spec delegates heavily to the VarHandle spec. Let's make that spec good. > Some of the old content, like the guidance on how to store floats/doubles in ints/longs in package-info .java, should probably be migrated to VarHandles, and not just discarded. Yes, another pass over the VH documentation is needed. Which hopefully can start soon, given code changes are now settling down. I am thinking about placing the signature-polymorphic stuff on MH and VH into a separate html document, that will then give more room to talk about relevant details on the VH class. Paul. From lance.andersen at oracle.com Mon Jul 11 10:32:20 2016 From: lance.andersen at oracle.com (Lance Andersen) Date: Mon, 11 Jul 2016 06:32:20 -0400 Subject: JDK 9 RFR of 8160215: jdk/test/java/io/Reader/ReaderBulkReadContract.java should clean up better In-Reply-To: References: <26BA0376-958E-4D68-BCC4-78023B16E321@oracle.com> <2EC38248-0E24-4479-BFBD-62616F33872F@oracle.com> Message-ID: <7FE0A324-9584-4174-B824-4C941C87EB45@oracle.com> > On Jul 11, 2016, at 3:56 AM, Alan Bateman wrote: > > On 10/07/2016 15:50, Lance Andersen wrote: > >> : >> I had issues in the past where SQE was using read only directories so writing to test.dir would fail for me. So I used the current directory instead which is the work directory which will get cleaned up after. >> >> > You might be thinking `test.src` which is the path to the test source. These properties are always easy to get mixed up but there is a good table in the jtreg tag language spec [1]. In any case, I don't think jtreg sets test.dir (at least I can't see it) but it's useful to set on the command-line when running the tests outside of the test harness, I think that is what Brian is doing here. Yes you are right, I was thinking of test.src. Thanks for pointing out the updated tag info. Nice and easy to read. Best Lance > -Alan > > [1] http://openjdk.java.net/jtreg/tag-spec.html#testvars 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 dawid.weiss at gmail.com Mon Jul 11 10:38:37 2016 From: dawid.weiss at gmail.com (Dawid Weiss) Date: Mon, 11 Jul 2016 12:38:37 +0200 Subject: Typo in internal Javadoc of Pattern.Bound Message-ID: Probably not worth a pull request -- somebody can piggyback on another change. diff -r ff7d1c47fef8 src/java.base/share/classes/java/util/regex/Pattern.java --- a/src/java.base/share/classes/java/util/regex/Pattern.java Thu Jul 07 19:00:10 2016 +0000 +++ b/src/java.base/share/classes/java/util/regex/Pattern.java Mon Jul 11 12:37:38 2016 +0200 @@ -5368,7 +5368,7 @@ * Handles word boundaries. Includes a field to allow this one class to * deal with the different types of word boundaries we can match. The word * characters include underscores, letters, and digits. Non spacing marks - * can are also part of a word if they have a base character, otherwise + * are also part of a word if they have a base character, otherwise * they are ignored for purposes of finding word boundaries. */ static final class Bound extends Node { Dawid From david.holmes at oracle.com Mon Jul 11 10:55:44 2016 From: david.holmes at oracle.com (David Holmes) Date: Mon, 11 Jul 2016 20:55:44 +1000 Subject: JDK 9 RFR of JDK-8132548: java/lang/ThreadGroup/Stop.java fails with "RuntimeException: Failure" In-Reply-To: <5783556E.4090708@oracle.com> References: <577F0978.4020902@oracle.com> <577F41D0.6070904@oracle.com> <5783556E.4090708@oracle.com> Message-ID: <9659dd71-7e11-2d6a-2e7e-479949cc57dd@oracle.com> On 11/07/2016 6:14 PM, Amy Lu wrote: > Thank you David, though the email crossed-by, I hope all the concerns > have been resolved in the updated webrev: > http://cr.openjdk.java.net/~amlu/8132548/webrev.02/ Sorry but no, the changes are neither necessary nor sufficient. With the new code the ThreadDeath can hit anytime after countDown(), so it can hit before you enter the try block. > I had rewrote the test with CountDownLatch and join(long millis). Also > unlike the old version, test thread 'first' and 'second' do different > things, and 'second' thread will keep alive for waiting to be killed by > group.stop() from 'frist' thread in the same thread group. I think this > could avoid the second call to second.stop() (group.stop()) issue. Simply using join() with no timeout and relying on the test framework to kill the test allows you to do away with the second stop(). David ----- > The time LONG_DELAY_MS used in join(long millis) is an adjusted timeout: > > private static final long LONG_DELAY_MS = Utils.adjustTimeout(1000L); > ... > > second.join(LONG_DELAY_MS); > boolean failed = second.isAlive(); > > This gives second thread a more "reasonable" time to die, with taking > account of the test harness timeout. > This almost same as second.join()// test pass or timeout, but with > additional chance of killing all threads in a bad case. > > Thanks, > Amy > > On 7/11/16 3:25 PM, David Holmes wrote: >> Simplification ... >> >> On 11/07/2016 5:12 PM, David Holmes wrote: >>> Hi Amy, >>> >>> Thanks for tackling this. >>> >>> On 8/07/2016 4:01 PM, Amy Lu wrote: >>>> Thank you Joe for your review. >>>> >>>> The intent is to give it more chance "for the thread group stop to be >>>> issued", not to extend the whole test execution timeout. >>>> >>>> I updated the webrev to make this in a retry, limit to 5 times of >>>> retry: >>>> http://cr.openjdk.java.net/~amlu/8132548/webrev.01/ >>> >>> The retry serves no purpose here. groupStopped is being set to true and >>> the waiting thread has been notified, so the loop will terminate after >>> the first sleep. The failure happens when the main thread checks the >>> isAlive() status of the second thread before the ThreadGroup.stop has >>> actually had a chance to stop and terminate it - such that isAlive is >>> now false. That is why I suggested waiting a bit longer by extending the >>> sleep. >>> >>> I agree that making the test last at least 5 seconds is not ideal, but I >>> didn't think it would be an issue in the big picture of testing. >>> >>> Ideally explicit "synchronization" is better than sleeps but that would >>> again be missing the point with this test. We expect the thread to >>> terminate, if it hasn't terminated in a "reasonable" time we consider >>> the stop() to have failed and the test to fail. To that end we could >>> remove the sleep altogether and change: >>> >>> boolean failed = second.isAlive(); >>> >>> to >>> >>> try { >>> second.join(1000); >>> } catch (InterruptedException shouldNotHappen) {} >>> boolean failed = second.isAlive(); >>> >>> Now we use explicit event synchronization - great! But the test has the >>> same failure issue now as it did with the sleep. Putting in a >>> CountDownLatch would have exactly the same problem: we expect the second >>> thread to signal the latch as it terminates, but if that doesn't happen >>> within a "reasonable" amount of time, then we deem the stop() to have >>> failed and the test to have failed. >>> >>> Also note that the more code we add the more likely the second call to >>> second.stop() triggers an async exception in code that can't handle it >>> and results in an even worse failure mode! >>> >>> The only thing I can suggest is to get rid of the explicit sleep (or >>> join, or latch.await() etc) and simply recode as an infinite loop and >>> rely on the test harness to tear things down when the overall test >>> timeout kicks in. That way the test either passes or is timed-out, there >>> is no explicit failure - but a busy loop is also bad so you would want a >>> small sleep in there anyway: >>> >>> while (second.isAlive()) { >>> Thread.sleep(10); >>> } >>> // Test passed - if we never get here the test times out and >>> // we implicitly fail. >> >> Of course that was silly all you need is: >> >> second.join(); >> // Test passed - if we never get here the test times out and >> // we implicitly fail. >> >> David >> >> >>> Thanks, >>> David >>> >>>> Thanks, >>>> Amy >>>> >>>> On 7/8/16 12:15 PM, joe darcy wrote: >>>>> Hi Amy, >>>>> >>>>> I'm a bit uncomfortable with the fix as-is. >>>>> >>>>> Rather than hard-coding sleep values, if sleep values are needed I >>>>> think it is a better practice to use ones that are scaled with the >>>>> jtreg timeout factors, etc. used to run the tests. Please instead use >>>>> something like the adjustTimeout method of >>>>> >>>>> $JDK_FOREST_ROOT/test/lib/share/classes/jdk/test/lib/Utils >>>>> >>>>> As a general comment, I'd prefer we don't just up timeout values for >>>>> tests. That can cause the whole test suite run to slow down, which is >>>>> undesirable especially if the condition in question may actually be >>>>> satisfied in many cases much faster than the timeout value. >>>>> >>>>> Thanks, >>>>> >>>>> -Joe >>>>> >>>>> >>>>> On 7/7/2016 7:01 PM, Amy Lu wrote: >>>>>> Please review this trivial fix for >>>>>> test:java/lang/ThreadGroup/Stop.java >>>>>> >>>>>> Though this is a test for a deprecated API, failed with very very low >>>>>> frequency and hard to reproduce (I got no luck to reproduce it), I?d >>>>>> like to patch it as suggested: extend the sleep in the main thread >>>>>> from one second to five seconds. Also added 'volatile' to the boolean >>>>>> variable 'groupStopped'. >>>>>> >>>>>> bug: https://bugs.openjdk.java.net/browse/JDK-8132548 >>>>>> webrev: http://cr.openjdk.java.net/~amlu/8132548/webrev.00/ >>>>>> >>>>>> Thanks, >>>>>> Amy >>>>>> >>>>>> >>>>>> --- old/test/java/lang/ThreadGroup/Stop.java 2016-07-04 >>>>>> 14:53:59.000000000 +0800 >>>>>> +++ new/test/java/lang/ThreadGroup/Stop.java 2016-07-04 >>>>>> 14:53:58.000000000 +0800 >>>>>> @@ -1,5 +1,5 @@ >>>>>> /* >>>>>> - * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All >>>>>> rights reserved. >>>>>> + * Copyright (c) 1999, 2016, 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 >>>>>> @@ -29,7 +29,7 @@ >>>>>> */ >>>>>> >>>>>> public class Stop implements Runnable { >>>>>> - private static boolean groupStopped = false ; >>>>>> + private static volatile boolean groupStopped = false ; >>>>>> private static final Object lock = new Object(); >>>>>> >>>>>> private static final ThreadGroup group = new ThreadGroup(""); >>>>>> @@ -70,7 +70,7 @@ >>>>>> while (!groupStopped) { >>>>>> lock.wait(); >>>>>> // Give the other thread a chance to stop >>>>>> - Thread.sleep(1000); >>>>>> + Thread.sleep(5000); >>>>>> } >>>>>> } >>>>>> >>>>>> >>>>>> >>>>> >>>> > From james.laskey at oracle.com Mon Jul 11 12:17:53 2016 From: james.laskey at oracle.com (Jim Laskey (Oracle)) Date: Mon, 11 Jul 2016 09:17:53 -0300 Subject: RFR: JDK-8161067 - jlink: Enable plugins to use the module pool for class lookup In-Reply-To: References: Message-ID: I?m not sure if we can determine supplied classes vs others unless we provide a flag or the set of supplied modules. At any rate, the rules for cross module optimization would still be complex. ModuleEntry.findEntry: I was half thinking the same once I realized the limits of the lookup. The complication is that a ModuleEntry may exist in several pools (direct copy). So, though we have to create new LinkModules each pass, we would also be forced to create new ModuleEntrys for each pass. In practice, I?m not sure findEntry will be used frequently in relation to the #plugins x #classes. ? Jim > On Jul 11, 2016, at 7:10 AM, Paul Sandoz wrote: > > Hi Jim. > > Do you anticipate support across module boundaries given your comment? > > 282 // Navigating other modules via requires and exports is problematic > 283 // since we cannot construct the runtime model of loaders and layers. > > it might be possible to emulate runtime resolution at link time for the set of idk.modules but not possible by default for non-idk modules because as you say we don?t know the runtime properties (such as layering), that would require some input from the developer (if it is indeed possible to express). > > I ask because there is a simpler way to express the current functionality, provide a method on ModuleEntry to obtain the LinkModule, rather than, or in addition to, the module name. Such functionality is much clearer regarding the scope of resolution. > > Paul. > > >> On 8 Jul 2016, at 17:53, Jim Laskey (Oracle) wrote: >> >> http://cr.openjdk.java.net/~jlaskey/8161067/webrev/index.html >> https://bugs.openjdk.java.net/browse/JDK-8161067 >> > From aph at redhat.com Mon Jul 11 12:30:48 2016 From: aph at redhat.com (Andrew Haley) Date: Mon, 11 Jul 2016 13:30:48 +0100 Subject: RFR 8154737: Rename VarHandle.compareAndExchangeVolatile to VarHandle.compareAndExchange In-Reply-To: <2B6EC19F-03D1-492A-A409-9B7C6CABE9F5@oracle.com> References: <2B6EC19F-03D1-492A-A409-9B7C6CABE9F5@oracle.com> Message-ID: <57839178.4070906@redhat.com> On 22/06/16 10:34, Paul Sandoz wrote: > This patch renames VarHandle.compareAndExchangeVolatile to > VarHandle.compareAndExchange so the naming scheme is consistent with > compareAndSet, and is also a little shorter. I guess this means that if we want a relaxed compareAndExchange we'll have to use the weak variant. I suppose that's reasonable enough, if only to try to reduce the number of methods. (Mind you, that also could have been done quite nicely by using a parameter, which is what C++ does. Oh well.) Andrew. From paul.sandoz at oracle.com Mon Jul 11 14:09:12 2016 From: paul.sandoz at oracle.com (Paul Sandoz) Date: Mon, 11 Jul 2016 16:09:12 +0200 Subject: RFR: JDK-8161067 - jlink: Enable plugins to use the module pool for class lookup In-Reply-To: References: Message-ID: > On 11 Jul 2016, at 14:17, Jim Laskey (Oracle) wrote: > > I?m not sure if we can determine supplied classes vs others unless we provide a flag or the set of supplied modules. At any rate, the rules for cross module optimization would still be complex. > Ok. > ModuleEntry.findEntry: I was half thinking the same once I realized the limits of the lookup. The complication is that a ModuleEntry may exist in several pools (direct copy). So, though we have to create new LinkModules each pass, we would also be forced to create new ModuleEntrys for each pass. In practice, I?m not sure findEntry will be used frequently in relation to the #plugins x #classes. > Ah, i see, so the rule being: go back to the pool to query for stuff. How about the following helper method on ModulePool: Optional findModule(ModuleEntry me); then the intent in code might be a littler clearer on the context. ImagePluginStack 407 return res.isPresent()? Optional.of(getUncompressed(res.get())) : Optional.empty(); You could do: return res.map(this::getUncompressed); ClassForNamePLugin 148 .filter(resource -> resource != null) Can a resource ever be null? Paul. From james.laskey at oracle.com Mon Jul 11 14:15:22 2016 From: james.laskey at oracle.com (James Laskey) Date: Mon, 11 Jul 2016 11:15:22 -0300 Subject: RFR: JDK-8161067 - jlink: Enable plugins to use the module pool for class lookup In-Reply-To: References: Message-ID: Sent from my iPhone > On Jul 11, 2016, at 11:09 AM, Paul Sandoz wrote: > > >> On 11 Jul 2016, at 14:17, Jim Laskey (Oracle) wrote: >> >> I?m not sure if we can determine supplied classes vs others unless we provide a flag or the set of supplied modules. At any rate, the rules for cross module optimization would still be complex. > > Ok. > > >> ModuleEntry.findEntry: I was half thinking the same once I realized the limits of the lookup. The complication is that a ModuleEntry may exist in several pools (direct copy). So, though we have to create new LinkModules each pass, we would also be forced to create new ModuleEntrys for each pass. In practice, I?m not sure findEntry will be used frequently in relation to the #plugins x #classes. > > Ah, i see, so the rule being: go back to the pool to query for stuff. > > How about the following helper method on ModulePool: > > Optional findModule(ModuleEntry me); > > then the intent in code might be a littler clearer on the context. > Ok > > ImagePluginStack > > 407 return res.isPresent()? Optional.of(getUncompressed(res.get())) : Optional.empty(); > > You could do: > > return res.map(this::getUncompressed); > Good > > ClassForNamePLugin > > 148 .filter(resource -> resource != null) > > Can a resource ever be null? I don't think it can. Just cloning JFs code. Might have true at some point. Will drop and see what falls out. > > Paul. From aph at redhat.com Mon Jul 11 15:08:15 2016 From: aph at redhat.com (Andrew Haley) Date: Mon, 11 Jul 2016 16:08:15 +0100 Subject: ByteBuffer views, alignment, word tearing Message-ID: <5783B65F.7040007@redhat.com> I saw a few ACCEPTABLE_SPEC results for ByteBuffer views in jcstress. This results from word tearing. I was rather surprised, because I'd worked on the HeapByteBuffer implementation, and I knew that on we would't expect to see any word tearing for HeapByteBuffers or DirectByteBuffers, at least for aligned word fetches and stores. Unfortunately, we're still doing this in e.g. ByteBufferAsIntBufferL: public int get(int i) { return Bits.getIntL(bb, ix(checkIndex(i))); } where Bits.getIntL is defined as: static int getIntL(ByteBuffer bb, int bi) { return makeInt(bb._get(bi + 3), bb._get(bi + 2), bb._get(bi + 1), bb._get(bi )); } instead of what I'd thought we were doing, which was: public int get(int i) { return bb.getInt(ix(i)); } ... so we get slow byte-at-a-time implementations of all the getX and putX methods -- with no HotSpot intrinsic optimizations. And we get word tearing even though the data in a ByteBuffer view is always aligned. It never occurred to me that the ByteBuffer views didn't defer to the ByteBuffer.{get,put} methods. Either that or I forgot, but I should have fixed ByteBuffer views at the same time as HeapByteBuffer. It's not a huge job to fix this, but rather late for JDK 9. Andrew. [P.S. It's a little bit more complicated than this because a ByteBuffer view has the endianness that its parent had when the view was created. But that's not hard to do.] From paul.sandoz at oracle.com Mon Jul 11 16:04:19 2016 From: paul.sandoz at oracle.com (Paul Sandoz) Date: Mon, 11 Jul 2016 18:04:19 +0200 Subject: ByteBuffer views, alignment, word tearing In-Reply-To: <5783B65F.7040007@redhat.com> References: <5783B65F.7040007@redhat.com> Message-ID: Hi Andrew, See also: https://bugs.openjdk.java.net/browse/JDK-8151163 http://cr.openjdk.java.net/~psandoz/jdk9/JDK-8151163-buffer-unsafe-unaligned-access/ http://cr.openjdk.java.net/~psandoz/jdk9/JDK-8151163-buffer-unsafe-unaligned-access/webrev/ http://cr.openjdk.java.net/~psandoz/jdk9/JDK-8151163-buffer-unsafe-unaligned-access-hotspot/webrev/ I opted to directly use Unsafe rather than defer. I am not sure it?s always possible to defer to the underlying buffer since its positional and order state is mutable. I got bogged down investigating some regressions on SPARC for long values that are misaligned such that 8 bytes are read. But i planned to proceed with this and see if we can clean up SPARC later on, but then i forgot until you reminded me :-) Paul. > On 11 Jul 2016, at 17:08, Andrew Haley wrote: > > I saw a few ACCEPTABLE_SPEC results for ByteBuffer views in jcstress. > This results from word tearing. I was rather surprised, because I'd > worked on the HeapByteBuffer implementation, and I knew that on we > would't expect to see any word tearing for HeapByteBuffers or > DirectByteBuffers, at least for aligned word fetches and stores. > > Unfortunately, we're still doing this in e.g. ByteBufferAsIntBufferL: > > public int get(int i) { > return Bits.getIntL(bb, ix(checkIndex(i))); > } > > where Bits.getIntL is defined as: > > static int getIntL(ByteBuffer bb, int bi) { > return makeInt(bb._get(bi + 3), > bb._get(bi + 2), > bb._get(bi + 1), > bb._get(bi )); > } > > instead of what I'd thought we were doing, which was: > > public int get(int i) { > return bb.getInt(ix(i)); > } > > ... so we get slow byte-at-a-time implementations of all the getX and > putX methods -- with no HotSpot intrinsic optimizations. And we get > word tearing even though the data in a ByteBuffer view is always > aligned. > > It never occurred to me that the ByteBuffer views didn't defer to the > ByteBuffer.{get,put} methods. Either that or I forgot, but I should > have fixed ByteBuffer views at the same time as HeapByteBuffer. > > It's not a huge job to fix this, but rather late for JDK 9. > > Andrew. > > > [P.S. It's a little bit more complicated than this because a > ByteBuffer view has the endianness that its parent had when the view > was created. But that's not hard to do.] From volker.simonis at gmail.com Mon Jul 11 16:18:54 2016 From: volker.simonis at gmail.com (Volker Simonis) Date: Mon, 11 Jul 2016 18:18:54 +0200 Subject: RFR(S): 8160564: TEST: Add a test to check the implementation of VersionProps.versionNumbers() In-Reply-To: References: Message-ID: Hi, here comes a new version of this change. I've tried to address most of the concerns/suggestions: http://cr.openjdk.java.net/~simonis/webrevs/2016/8160564.v1/ 1. Added a private 'check()' method to the VersionProps class which ensures that every single part of a version number starts with a digit greater zero (i.e. no leading zeros). If this condition isn't fulfilled, an IllegalArgumentException will be thrown. 2. Check that the final list of version numbers returned by VersionProps.parseVersionNumbers() has no leading or trailing zeros. If not, throw an IllegalArgumentException. 3. With the changes 1. and 2. in place we can now check for bad input in the regression test as well. The test now checks that VersionProps.parseVersionNumbers() accepts and rejects the same version strings as Runtime.Version.parse(). So I think there's no need for runtime assertions or configure checks any more. 4. Put a comment on VersionProps.parseVersionNumbers() to remind others that the method is reflectively tests. - The test copyright is OK. We already have a bunch of tests/files with similar copyright. - Wrapped the long lines. - Moved test from test/java/lang/VersionProps.java to test/java/lang/Runtime/Version/VersionProps.java - I would prefer not to convert this test to TestNG for simplicity. I like to be able to execute a test stand-alone in case of failure, without any test framework. Moreover the test already prints what it's doing anyway (see below) and in the case of failure it prints the initial/expected version strings. [1] [1, 2] [1, 2, 3] [1, 2, 3, 4] [1, 0, 0, 1] [1, 10000, 1] [1, 0, 2, 0, 0, 3, 0, 0, 0, 4, 5, 0, 0, 6] [1000001] [1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 9, 8, 7, 6, 5, 4, 3, 2, 1] OK - caught bad version string 01 OK - caught bad version string 0.1.2 OK - caught bad version string 1.02.3 OK - caught bad version string 1.2.03.4 OK - caught bad version string 1.0.0.1.0 OK - caught bad version string 1.0.1.0.0 OK - caught bad version string 1.00.1 OK - caught bad version string 1.0.1.00 OK - caught bad version string 1.10000. - Finally, I didn't understood the comment about 'List.of might be preferred over Arrays.asList' so I didn't change that. OK to push now (before it gets really over-engineered :) Thank you and best regards, Volker On Thu, Jul 7, 2016 at 9:54 PM, Mandy Chung wrote: > Hi Volker, > > Thanks for adding a new test for it. > > Nit: can you wrap the long lines. > > As for the bad version, one possible change is to add assert Runtime.Version.parse(versionNumber) in parseVersionNumbers method and add -esa in @run tag. > > It?d be good to convert this to testng test where the dataprovider can show the input version and expected returned list. > > Mandy > >> On Jul 7, 2016, at 6:59 AM, Volker Simonis wrote: >> >> Hi, >> >> can I please have a review for the following change which makes >> VersionProps.versionNumbers() testable and the corresponding >> regression test: >> >> http://cr.openjdk.java.net/~simonis/webrevs/2016/8160564/ >> https://bugs.openjdk.java.net/browse/JDK-8160564 >> >> During the review for "8160457: VersionProps.versionNumbers() is >> broken" it was suggested to refactor VersionProps.versionNumbers() in >> order to make it testable by a regression test. This change does >> exactly that. It extracts the implementation of >> VersionProps.versionNumbers() into a new method >> parseVersionNumbers(String versionNumber) which can be tested from the >> associated regression test. >> >> There are still two points to notice: >> >> - VersionProps.versionNumbers() deliberately doesn't check for badly >> formatted version strings because it is assumed it will only get valid >> input (see discussion for "JDK-8160000: Runtime.version() cause >> startup regressions" at [2]). So we can currently only check that >> VersionProps.versionNumbers() accepts all kind of valid version >> strings. >> >> - I was a little bit surprised that I could reflectively access and >> execute java.lang.VersionProps.parseVersionNumbers() where both the >> class and the method are package private. Maybe this is related to >> Jigsaw issue #ReflectiveAccessToNonExportedTypes [3]? As I'm not a >> Jigsaw expert, I'd be graceful to anybody explaining me why this is >> still so easily possible with Jigsaw? >> >> Thank you and best regards, >> Volker >> >> >> [1] http://mail.openjdk.java.net/pipermail/core-libs-dev/2016-June/042058.html >> [2] https://bugs.openjdk.java.net/browse/JDK-8160000 >> [3] http://openjdk.java.net/projects/jigsaw/spec/issues/#ReflectiveAccessToNonExportedTypes > From aph at redhat.com Mon Jul 11 16:34:28 2016 From: aph at redhat.com (Andrew Haley) Date: Mon, 11 Jul 2016 17:34:28 +0100 Subject: ByteBuffer views, alignment, word tearing In-Reply-To: References: <5783B65F.7040007@redhat.com> Message-ID: <5783CA94.7010000@redhat.com> On 11/07/16 17:04, Paul Sandoz wrote: > I opted to directly use Unsafe rather than defer. I am not sure it?s > always possible to defer to the underlying buffer since its > positional and order state is mutable. Eww. The view has its own position, and the byte ordering is fixed when the view is created. The wrapped byte buffer is in a protected field, and the view is a package-private class so it can't be subclassed by the user. So I would have thought that could be made to work, but but never mind, I can see you've gone a long way down this road already. The SPARC regression is very odd: I would have thought that if it's broken here it would also be broken in HeapByteBuffer.getLong(). Andrew. From james.laskey at oracle.com Mon Jul 11 16:58:51 2016 From: james.laskey at oracle.com (Jim Laskey (Oracle)) Date: Mon, 11 Jul 2016 13:58:51 -0300 Subject: RFR: JDK-8161067 - jlink: Enable plugins to use the module pool for class lookup In-Reply-To: References: Message-ID: > How about the following helper method on ModulePool: > > Optional findModule(ModuleEntry me); > > then the intent in code might be a littler clearer on the context. After thinking about this at bit: If we did that and then later worked out a way to optimize across modules, we?d have to hunt down those cases. What if I were to rename the method to findEntryInContext(String path, ModuleEntry context)? ? Jim > On Jul 11, 2016, at 11:15 AM, James Laskey wrote: > > > > Sent from my iPhone > >> On Jul 11, 2016, at 11:09 AM, Paul Sandoz wrote: >> >> >>> On 11 Jul 2016, at 14:17, Jim Laskey (Oracle) wrote: >>> >>> I?m not sure if we can determine supplied classes vs others unless we provide a flag or the set of supplied modules. At any rate, the rules for cross module optimization would still be complex. >> >> Ok. >> >> >>> ModuleEntry.findEntry: I was half thinking the same once I realized the limits of the lookup. The complication is that a ModuleEntry may exist in several pools (direct copy). So, though we have to create new LinkModules each pass, we would also be forced to create new ModuleEntrys for each pass. In practice, I?m not sure findEntry will be used frequently in relation to the #plugins x #classes. >> >> Ah, i see, so the rule being: go back to the pool to query for stuff. >> >> How about the following helper method on ModulePool: >> >> Optional findModule(ModuleEntry me); >> >> then the intent in code might be a littler clearer on the context. >> > > Ok > >> >> ImagePluginStack >> >> 407 return res.isPresent()? Optional.of(getUncompressed(res.get())) : Optional.empty(); >> >> You could do: >> >> return res.map(this::getUncompressed); >> > > Good > > >> >> ClassForNamePLugin >> >> 148 .filter(resource -> resource != null) >> >> Can a resource ever be null? > > I don't think it can. Just cloning JFs code. Might have true at some point. Will drop and see what falls out. > >> >> Paul. > From francois.green at gmail.com Mon Jul 11 17:44:19 2016 From: francois.green at gmail.com (Francois Green) Date: Mon, 11 Jul 2016 13:44:19 -0400 Subject: CompletableFuture eventual race condition Message-ID: I sorry for posting in list, but I need an authoritative answer. I was told by one of the developers of another JVM (Ceylon) language that CompletableFuture.supplyAsync(() -> "Hejjo Worjd from Java") .thenApply(s -> s.replaceAll("j","l")) .thenAccept(System.out::println); would eventual fail to print if run enough times. Is this true? From martinrb at google.com Mon Jul 11 19:04:41 2016 From: martinrb at google.com (Martin Buchholz) Date: Mon, 11 Jul 2016 12:04:41 -0700 Subject: CompletableFuture eventual race condition In-Reply-To: References: Message-ID: Why not try to create a sscce that demonstrates the problem? Your snippet looks like it ought to work. On Mon, Jul 11, 2016 at 10:44 AM, Francois Green wrote: > I sorry for posting in list, but I need an authoritative answer. I was > told by one of the developers of another JVM (Ceylon) language that > > CompletableFuture.supplyAsync(() -> "Hejjo Worjd from Java") > .thenApply(s -> s.replaceAll("j","l")) > .thenAccept(System.out::println); > > would eventual fail to print if run enough times. Is this true? > From pavel.rappo at oracle.com Mon Jul 11 19:29:40 2016 From: pavel.rappo at oracle.com (Pavel Rappo) Date: Mon, 11 Jul 2016 20:29:40 +0100 Subject: CompletableFuture eventual race condition In-Reply-To: References: Message-ID: > On 11 Jul 2016, at 18:44, Francois Green wrote: > > I sorry for posting in list, but I need an authoritative answer. I was > told by one of the developers of another JVM (Ceylon) language that > > CompletableFuture.supplyAsync(() -> "Hejjo Worjd from Java") > .thenApply(s -> s.replaceAll("j","l")) > .thenAccept(System.out::println); > > would eventual fail to print if run enough times. Is this true? Your snippet looks correct to me. You could use jstress [1] to try to catch the alleged bug. And in case you succeed, you could then produce a sscce as Martin suggested. -------------------------------------------------------------------------------- [1] http://openjdk.java.net/projects/code-tools/jcstress/ From martinrb at google.com Mon Jul 11 20:32:19 2016 From: martinrb at google.com (Martin Buchholz) Date: Mon, 11 Jul 2016 13:32:19 -0700 Subject: CompletableFuture eventual race condition In-Reply-To: References: Message-ID: In this program there is a race between the program ending and the computation trying to print from the daemon thread in the forkjoin pool! import java.util.concurrent.*; public class HelloWorld { public static void main(String[] args) { CompletableFuture.supplyAsync(() -> "Hejjo Worjd from Java") .thenApply(s -> s.replaceAll("j","l")) .thenAccept(System.out::println); } } Try adding a join: import java.util.concurrent.*; public class JoinRace { public static void main(String[] args) { CompletableFuture.supplyAsync(() -> "Hejjo Worjd from Java") .thenApply(s -> s.replaceAll("j","l")) .thenAccept(System.out::println).join(); } } On Mon, Jul 11, 2016 at 10:44 AM, Francois Green wrote: > I sorry for posting in list, but I need an authoritative answer. I was > told by one of the developers of another JVM (Ceylon) language that > > CompletableFuture.supplyAsync(() -> "Hejjo Worjd from Java") > .thenApply(s -> s.replaceAll("j","l")) > .thenAccept(System.out::println); > > would eventual fail to print if run enough times. Is this true? > From brian.burkhalter at oracle.com Mon Jul 11 20:38:14 2016 From: brian.burkhalter at oracle.com (Brian Burkhalter) Date: Mon, 11 Jul 2016 13:38:14 -0700 Subject: JDK 9 RFR of 8160215: jdk/test/java/io/Reader/ReaderBulkReadContract.java should clean up better In-Reply-To: <7FE0A324-9584-4174-B824-4C941C87EB45@oracle.com> References: <26BA0376-958E-4D68-BCC4-78023B16E321@oracle.com> <2EC38248-0E24-4479-BFBD-62616F33872F@oracle.com> <7FE0A324-9584-4174-B824-4C941C87EB45@oracle.com> Message-ID: <842007A7-12B7-4409-B95B-94496490D836@oracle.com> On Jul 11, 2016, at 3:32 AM, Lance Andersen wrote: >> On Jul 11, 2016, at 3:56 AM, Alan Bateman wrote: >> >> On 10/07/2016 15:50, Lance Andersen wrote: >> >>> : >>> I had issues in the past where SQE was using read only directories so writing to test.dir would fail for me. So I used the current directory instead which is the work directory which will get cleaned up after. >>> >>> >> You might be thinking `test.src` which is the path to the test source. These properties are always easy to get mixed up but there is a good table in the jtreg tag language spec [1]. In any case, I don't think jtreg sets test.dir (at least I can't see it) but it's useful to set on the command-line when running the tests outside of the test harness, I think that is what Brian is doing here. > > Yes you are right, I was thinking of test.src. Thanks for pointing out the updated tag info. Nice and easy to read. Does this fix look okay then? Thanks, Brian From pbenedict at apache.org Mon Jul 11 21:01:50 2016 From: pbenedict at apache.org (Paul Benedict) Date: Mon, 11 Jul 2016 16:01:50 -0500 Subject: --dry-run description enhancement Message-ID: The current help of --dry-run is this: "create VM but do not execute main method" But I think it's pretty important to note that the class is also not even loaded. Not even static initializers will execute. Does anyone think this would would be a worthwhile tweak? Suggestion: "create VM but do not load mainclass or execute main method" My allusion to "mainclass" comes from the --module option Cheers, Paul From lance.andersen at oracle.com Mon Jul 11 21:25:34 2016 From: lance.andersen at oracle.com (Lance Andersen) Date: Mon, 11 Jul 2016 17:25:34 -0400 Subject: JDK 9 RFR of 8160215: jdk/test/java/io/Reader/ReaderBulkReadContract.java should clean up better In-Reply-To: <842007A7-12B7-4409-B95B-94496490D836@oracle.com> References: <26BA0376-958E-4D68-BCC4-78023B16E321@oracle.com> <2EC38248-0E24-4479-BFBD-62616F33872F@oracle.com> <7FE0A324-9584-4174-B824-4C941C87EB45@oracle.com> <842007A7-12B7-4409-B95B-94496490D836@oracle.com> Message-ID: <90431EBD-71FD-4E41-AE16-C75A6D53B6D6@oracle.com> Hi Brian, Good to go from me :-) > On Jul 11, 2016, at 4:38 PM, Brian Burkhalter wrote: > > On Jul 11, 2016, at 3:32 AM, Lance Andersen > wrote: > >>> On Jul 11, 2016, at 3:56 AM, Alan Bateman > wrote: >>> >>> On 10/07/2016 15:50, Lance Andersen wrote: >>> >>>> : >>>> I had issues in the past where SQE was using read only directories so writing to test.dir would fail for me. So I used the current directory instead which is the work directory which will get cleaned up after. >>>> >>>> >>> You might be thinking `test.src` which is the path to the test source. These properties are always easy to get mixed up but there is a good table in the jtreg tag language spec [1]. In any case, I don't think jtreg sets test.dir (at least I can't see it) but it's useful to set on the command-line when running the tests outside of the test harness, I think that is what Brian is doing here. >> >> Yes you are right, I was thinking of test.src. Thanks for pointing out the updated tag info. Nice and easy to read. > > Does this fix look okay then? > > Thanks, > > Brian 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 Jul 11 21:39:06 2016 From: Alan.Bateman at oracle.com (Alan Bateman) Date: Mon, 11 Jul 2016 22:39:06 +0100 Subject: --dry-run description enhancement In-Reply-To: References: Message-ID: On 11/07/2016 22:01, Paul Benedict wrote: > The current help of --dry-run is this: > "create VM but do not execute main method" > > But I think it's pretty important to note that the class is also not even > loaded. The main class should be loaded. The original intention was that it do everything except invoke the main method. -Alan From pbenedict at apache.org Mon Jul 11 22:09:42 2016 From: pbenedict at apache.org (Paul Benedict) Date: Mon, 11 Jul 2016 17:09:42 -0500 Subject: --dry-run description enhancement In-Reply-To: References: Message-ID: So I just tested "--dry-run" and I see it does load the class. My apologies. I was following the commit trail but somehow the loading of the class escaped me. I swore at one point it wasn't loading, but my error, nevertheless. Was there any debate on this issue? The problem I currently see with loading the class is you're still allowing static initializers to run. I don't see a purpose in loading the class here because you're potentially allowing user code to execute and causing side-effects in the JVM. If the purpose of JDK-8159596 is to test the resolving of the configuration/options, I don't see how the current behavior is therefore desired. To take an analogy, the Maven Release Plugin has a "dry run" feature to test an install. It actually doesn't do an install. But someone can make the argument (and I am) that Java's --dry-run is not actually dry. It's really just a "--no-main" but user code can still run. Cheers, Paul On Mon, Jul 11, 2016 at 4:39 PM, Alan Bateman wrote: > On 11/07/2016 22:01, Paul Benedict wrote: > > The current help of --dry-run is this: >> "create VM but do not execute main method" >> >> But I think it's pretty important to note that the class is also not even >> loaded. >> > The main class should be loaded. The original intention was that it do > everything except invoke the main method. > > -Alan > From pbenedict at apache.org Mon Jul 11 22:13:54 2016 From: pbenedict at apache.org (Paul Benedict) Date: Mon, 11 Jul 2016 17:13:54 -0500 Subject: --dry-run description enhancement In-Reply-To: References: Message-ID: Alan, I wish I found this before I responded to you, but, anyway, here you go: https://bugs.openjdk.java.net/browse/JDK-8160698 "java --dry-run should not cause main class be initialized" Cheers, Paul On Mon, Jul 11, 2016 at 5:09 PM, Paul Benedict wrote: > So I just tested "--dry-run" and I see it does load the class. My > apologies. I was following the commit trail but somehow the loading of the > class escaped me. I swore at one point it wasn't loading, but my error, > nevertheless. > > Was there any debate on this issue? The problem I currently see with > loading the class is you're still allowing static initializers to run. I > don't see a purpose in loading the class here because you're potentially > allowing user code to execute and causing side-effects in the JVM. If the > purpose of JDK-8159596 is to test the resolving of the > configuration/options, I don't see how the current behavior is therefore > desired. To take an analogy, the Maven Release Plugin has a "dry run" > feature to test an install. It actually doesn't do an install. But someone > can make the argument (and I am) that Java's --dry-run is not actually dry. > It's really just a "--no-main" but user code can still run. > > Cheers, > Paul > > On Mon, Jul 11, 2016 at 4:39 PM, Alan Bateman > wrote: > >> On 11/07/2016 22:01, Paul Benedict wrote: >> >> The current help of --dry-run is this: >>> "create VM but do not execute main method" >>> >>> But I think it's pretty important to note that the class is also not even >>> loaded. >>> >> The main class should be loaded. The original intention was that it do >> everything except invoke the main method. >> >> -Alan >> > > From xueming.shen at oracle.com Mon Jul 11 22:53:42 2016 From: xueming.shen at oracle.com (Xueming Shen) Date: Mon, 11 Jul 2016 15:53:42 -0700 Subject: RFR JDK-7031075: GZIPInputStream's available() reports 1, but read() gives -1. Message-ID: <57842376.2000809@oracle.com> Hi, Please help review the change for JDK-7031075. issue: https://bugs.openjdk.java.net/browse/JDK-7031075 webrev: http://cr.openjdk.java.net/~sherman/7031075/webrev This is a corner case in current implementation, in which the "readEOF" flag is only set when/after the read/skip method is invoked and the "eof" is "explicitly" reached. Which means even the inflater has reached the "end of the compressed stream" (inf.finished() == true) during the last read/skip invocation (since there are still data available, so the date gets read/returned successfully), the readEOF is not set, and therefor the available() return > 0 if checked. The proposed change here is to do an extra check of the inf.finished(), if it returns true, means there is no more data inside the inflater the end of compressed stream has been reached, available() returns true in this case. Thanks, Sherman From mandy.chung at oracle.com Tue Jul 12 01:32:07 2016 From: mandy.chung at oracle.com (Mandy Chung) Date: Tue, 12 Jul 2016 09:32:07 +0800 Subject: --dry-run description enhancement In-Reply-To: References: Message-ID: > On Jul 12, 2016, at 6:13 AM, Paul Benedict wrote: > > Alan, I wish I found this before I responded to you, but, anyway, here you > go: > > https://bugs.openjdk.java.net/browse/JDK-8160698 > "java --dry-run should not cause main class be initialized? > Yes this has been fixed. Mandy > Cheers, > Paul > > On Mon, Jul 11, 2016 at 5:09 PM, Paul Benedict wrote: > >> So I just tested "--dry-run" and I see it does load the class. My >> apologies. I was following the commit trail but somehow the loading of the >> class escaped me. I swore at one point it wasn't loading, but my error, >> nevertheless. >> >> Was there any debate on this issue? The problem I currently see with >> loading the class is you're still allowing static initializers to run. I >> don't see a purpose in loading the class here because you're potentially >> allowing user code to execute and causing side-effects in the JVM. If the >> purpose of JDK-8159596 is to test the resolving of the >> configuration/options, I don't see how the current behavior is therefore >> desired. To take an analogy, the Maven Release Plugin has a "dry run" >> feature to test an install. It actually doesn't do an install. But someone >> can make the argument (and I am) that Java's --dry-run is not actually dry. >> It's really just a "--no-main" but user code can still run. >> >> Cheers, >> Paul >> >> On Mon, Jul 11, 2016 at 4:39 PM, Alan Bateman >> wrote: >> >>> On 11/07/2016 22:01, Paul Benedict wrote: >>> >>> The current help of --dry-run is this: >>>> "create VM but do not execute main method" >>>> >>>> But I think it's pretty important to note that the class is also not even >>>> loaded. >>>> >>> The main class should be loaded. The original intention was that it do >>> everything except invoke the main method. >>> >>> -Alan >>> >> >> From mandy.chung at oracle.com Tue Jul 12 02:27:27 2016 From: mandy.chung at oracle.com (Mandy Chung) Date: Tue, 12 Jul 2016 10:27:27 +0800 Subject: RFR(S): 8160564: TEST: Add a test to check the implementation of VersionProps.versionNumbers() In-Reply-To: References: Message-ID: <68CCBF25-963A-41E8-A537-44E340173AB2@oracle.com> > On Jul 12, 2016, at 12:18 AM, Volker Simonis wrote: > > Hi, > > here comes a new version of this change. I've tried to address most of > the concerns/suggestions: > > http://cr.openjdk.java.net/~simonis/webrevs/2016/8160564.v1/ > This version looks okay in general. I suggest to combine the check and Integer.parseInt in a single method (e.g. ?numberAt? or some other better method name). 71 if (index - prevIndex > 1 && may read better as "index > prevIndex? The new comment can simply say ?This method is used by regression tests? that should do it. I would not mention the test name in the source since refactoring may make it outdated. In the new test, 92 if (error) { 93 throw new Exception(invalidVersions[i] + 94 " not recognized as invalid by VersionProps.parseVersionNumbers()"); 95 } An alternative to the above check, it can throw an exception immediate after line 82 when parseVersionNumbers.invoke succeeds. Mandy From pbenedict at apache.org Tue Jul 12 02:35:51 2016 From: pbenedict at apache.org (Paul Benedict) Date: Mon, 11 Jul 2016 21:35:51 -0500 Subject: --dry-run description enhancement In-Reply-To: References: Message-ID: Mandy, can you please give a look to the first email in this thread and see if you believe the enhanced message I suggested is helpful? I think it would be. On Jul 11, 2016 8:32 PM, "Mandy Chung" wrote: > > > On Jul 12, 2016, at 6:13 AM, Paul Benedict wrote: > > > > Alan, I wish I found this before I responded to you, but, anyway, here > you > > go: > > > > https://bugs.openjdk.java.net/browse/JDK-8160698 > > "java --dry-run should not cause main class be initialized? > > > > Yes this has been fixed. > Mandy > > > Cheers, > > Paul > > > > On Mon, Jul 11, 2016 at 5:09 PM, Paul Benedict > wrote: > > > >> So I just tested "--dry-run" and I see it does load the class. My > >> apologies. I was following the commit trail but somehow the loading of > the > >> class escaped me. I swore at one point it wasn't loading, but my error, > >> nevertheless. > >> > >> Was there any debate on this issue? The problem I currently see with > >> loading the class is you're still allowing static initializers to run. I > >> don't see a purpose in loading the class here because you're potentially > >> allowing user code to execute and causing side-effects in the JVM. If > the > >> purpose of JDK-8159596 is to test the resolving of the > >> configuration/options, I don't see how the current behavior is therefore > >> desired. To take an analogy, the Maven Release Plugin has a "dry run" > >> feature to test an install. It actually doesn't do an install. But > someone > >> can make the argument (and I am) that Java's --dry-run is not actually > dry. > >> It's really just a "--no-main" but user code can still run. > >> > >> Cheers, > >> Paul > >> > >> On Mon, Jul 11, 2016 at 4:39 PM, Alan Bateman > >> wrote: > >> > >>> On 11/07/2016 22:01, Paul Benedict wrote: > >>> > >>> The current help of --dry-run is this: > >>>> "create VM but do not execute main method" > >>>> > >>>> But I think it's pretty important to note that the class is also not > even > >>>> loaded. > >>>> > >>> The main class should be loaded. The original intention was that it do > >>> everything except invoke the main method. > >>> > >>> -Alan > >>> > >> > >> > > From mandy.chung at oracle.com Tue Jul 12 02:40:54 2016 From: mandy.chung at oracle.com (Mandy Chung) Date: Tue, 12 Jul 2016 10:40:54 +0800 Subject: --dry-run description enhancement In-Reply-To: References: Message-ID: > On Jul 12, 2016, at 10:35 AM, Paul Benedict wrote: > > Mandy, can you please give a look to the first email in this thread and see if you believe the enhanced message I suggested is helpful? I think it would be. > > Your Suggestion: "create VM but do not load mainclass or execute main method? The main class is loaded and your suggested text does not apply. What enhanced message do you refer to? Mandy From amy.lu at oracle.com Tue Jul 12 05:28:52 2016 From: amy.lu at oracle.com (Amy Lu) Date: Tue, 12 Jul 2016 13:28:52 +0800 Subject: JDK 9 RFR of JDK-8132548: java/lang/ThreadGroup/Stop.java fails with "RuntimeException: Failure" In-Reply-To: <9659dd71-7e11-2d6a-2e7e-479949cc57dd@oracle.com> References: <577F0978.4020902@oracle.com> <577F41D0.6070904@oracle.com> <5783556E.4090708@oracle.com> <9659dd71-7e11-2d6a-2e7e-479949cc57dd@oracle.com> Message-ID: <57848014.3080504@oracle.com> Please help to review the updated webrev, getting rid of ThreadDeath and using join(): http://cr.openjdk.java.net/~amlu/8132548/webrev.03/ Thanks, Amy On 7/11/16 6:55 PM, David Holmes wrote: > > > On 11/07/2016 6:14 PM, Amy Lu wrote: >> Thank you David, though the email crossed-by, I hope all the concerns >> have been resolved in the updated webrev: >> http://cr.openjdk.java.net/~amlu/8132548/webrev.02/ > > Sorry but no, the changes are neither necessary nor sufficient. With > the new code the ThreadDeath can hit anytime after countDown(), so it > can hit before you enter the try block. > >> I had rewrote the test with CountDownLatch and join(long millis). Also >> unlike the old version, test thread 'first' and 'second' do different >> things, and 'second' thread will keep alive for waiting to be killed by >> group.stop() from 'frist' thread in the same thread group. I think this >> could avoid the second call to second.stop() (group.stop()) issue. > > Simply using join() with no timeout and relying on the test framework > to kill the test allows you to do away with the second stop(). > > David > ----- > >> The time LONG_DELAY_MS used in join(long millis) is an adjusted timeout: >> >> private static final long LONG_DELAY_MS = Utils.adjustTimeout(1000L); >> ... >> >> second.join(LONG_DELAY_MS); >> boolean failed = second.isAlive(); >> >> This gives second thread a more "reasonable" time to die, with taking >> account of the test harness timeout. >> This almost same as second.join()// test pass or timeout, but with >> additional chance of killing all threads in a bad case. >> >> Thanks, >> Amy >> >> On 7/11/16 3:25 PM, David Holmes wrote: >>> Simplification ... >>> >>> On 11/07/2016 5:12 PM, David Holmes wrote: >>>> Hi Amy, >>>> >>>> Thanks for tackling this. >>>> >>>> On 8/07/2016 4:01 PM, Amy Lu wrote: >>>>> Thank you Joe for your review. >>>>> >>>>> The intent is to give it more chance "for the thread group stop to be >>>>> issued", not to extend the whole test execution timeout. >>>>> >>>>> I updated the webrev to make this in a retry, limit to 5 times of >>>>> retry: >>>>> http://cr.openjdk.java.net/~amlu/8132548/webrev.01/ >>>> >>>> The retry serves no purpose here. groupStopped is being set to true >>>> and >>>> the waiting thread has been notified, so the loop will terminate after >>>> the first sleep. The failure happens when the main thread checks the >>>> isAlive() status of the second thread before the ThreadGroup.stop has >>>> actually had a chance to stop and terminate it - such that isAlive is >>>> now false. That is why I suggested waiting a bit longer by >>>> extending the >>>> sleep. >>>> >>>> I agree that making the test last at least 5 seconds is not ideal, >>>> but I >>>> didn't think it would be an issue in the big picture of testing. >>>> >>>> Ideally explicit "synchronization" is better than sleeps but that >>>> would >>>> again be missing the point with this test. We expect the thread to >>>> terminate, if it hasn't terminated in a "reasonable" time we consider >>>> the stop() to have failed and the test to fail. To that end we could >>>> remove the sleep altogether and change: >>>> >>>> boolean failed = second.isAlive(); >>>> >>>> to >>>> >>>> try { >>>> second.join(1000); >>>> } catch (InterruptedException shouldNotHappen) {} >>>> boolean failed = second.isAlive(); >>>> >>>> Now we use explicit event synchronization - great! But the test has >>>> the >>>> same failure issue now as it did with the sleep. Putting in a >>>> CountDownLatch would have exactly the same problem: we expect the >>>> second >>>> thread to signal the latch as it terminates, but if that doesn't >>>> happen >>>> within a "reasonable" amount of time, then we deem the stop() to have >>>> failed and the test to have failed. >>>> >>>> Also note that the more code we add the more likely the second call to >>>> second.stop() triggers an async exception in code that can't handle it >>>> and results in an even worse failure mode! >>>> >>>> The only thing I can suggest is to get rid of the explicit sleep (or >>>> join, or latch.await() etc) and simply recode as an infinite loop and >>>> rely on the test harness to tear things down when the overall test >>>> timeout kicks in. That way the test either passes or is timed-out, >>>> there >>>> is no explicit failure - but a busy loop is also bad so you would >>>> want a >>>> small sleep in there anyway: >>>> >>>> while (second.isAlive()) { >>>> Thread.sleep(10); >>>> } >>>> // Test passed - if we never get here the test times out and >>>> // we implicitly fail. >>> >>> Of course that was silly all you need is: >>> >>> second.join(); >>> // Test passed - if we never get here the test times out and >>> // we implicitly fail. >>> >>> David >>> >>> >>>> Thanks, >>>> David >>>> >>>>> Thanks, >>>>> Amy >>>>> >>>>> On 7/8/16 12:15 PM, joe darcy wrote: >>>>>> Hi Amy, >>>>>> >>>>>> I'm a bit uncomfortable with the fix as-is. >>>>>> >>>>>> Rather than hard-coding sleep values, if sleep values are needed I >>>>>> think it is a better practice to use ones that are scaled with the >>>>>> jtreg timeout factors, etc. used to run the tests. Please instead >>>>>> use >>>>>> something like the adjustTimeout method of >>>>>> >>>>>> $JDK_FOREST_ROOT/test/lib/share/classes/jdk/test/lib/Utils >>>>>> >>>>>> As a general comment, I'd prefer we don't just up timeout values for >>>>>> tests. That can cause the whole test suite run to slow down, >>>>>> which is >>>>>> undesirable especially if the condition in question may actually be >>>>>> satisfied in many cases much faster than the timeout value. >>>>>> >>>>>> Thanks, >>>>>> >>>>>> -Joe >>>>>> >>>>>> >>>>>> On 7/7/2016 7:01 PM, Amy Lu wrote: >>>>>>> Please review this trivial fix for >>>>>>> test:java/lang/ThreadGroup/Stop.java >>>>>>> >>>>>>> Though this is a test for a deprecated API, failed with very >>>>>>> very low >>>>>>> frequency and hard to reproduce (I got no luck to reproduce it), >>>>>>> I?d >>>>>>> like to patch it as suggested: extend the sleep in the main thread >>>>>>> from one second to five seconds. Also added 'volatile' to the >>>>>>> boolean >>>>>>> variable 'groupStopped'. >>>>>>> >>>>>>> bug: https://bugs.openjdk.java.net/browse/JDK-8132548 >>>>>>> webrev: http://cr.openjdk.java.net/~amlu/8132548/webrev.00/ >>>>>>> >>>>>>> Thanks, >>>>>>> Amy >>>>>>> >>>>>>> >>>>>>> --- old/test/java/lang/ThreadGroup/Stop.java 2016-07-04 >>>>>>> 14:53:59.000000000 +0800 >>>>>>> +++ new/test/java/lang/ThreadGroup/Stop.java 2016-07-04 >>>>>>> 14:53:58.000000000 +0800 >>>>>>> @@ -1,5 +1,5 @@ >>>>>>> /* >>>>>>> - * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All >>>>>>> rights reserved. >>>>>>> + * Copyright (c) 1999, 2016, 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 >>>>>>> @@ -29,7 +29,7 @@ >>>>>>> */ >>>>>>> >>>>>>> public class Stop implements Runnable { >>>>>>> - private static boolean groupStopped = false ; >>>>>>> + private static volatile boolean groupStopped = false ; >>>>>>> private static final Object lock = new Object(); >>>>>>> >>>>>>> private static final ThreadGroup group = new ThreadGroup(""); >>>>>>> @@ -70,7 +70,7 @@ >>>>>>> while (!groupStopped) { >>>>>>> lock.wait(); >>>>>>> // Give the other thread a chance to stop >>>>>>> - Thread.sleep(1000); >>>>>>> + Thread.sleep(5000); >>>>>>> } >>>>>>> } >>>>>>> >>>>>>> >>>>>>> >>>>>> >>>>> >> From pbenedict at apache.org Tue Jul 12 06:00:17 2016 From: pbenedict at apache.org (Paul Benedict) Date: Tue, 12 Jul 2016 01:00:17 -0500 Subject: --dry-run description enhancement In-Reply-To: References: Message-ID: Mandy, perhaps there is a JVM technicality here I'm unfamiliar with. My understanding of loading a class has always been that it's coupled with running its static initializers. So my inference was that the class does not get loaded into memory because the latter no longer occurs with --dry-run. On Jul 11, 2016 9:41 PM, "Mandy Chung" wrote: > > > On Jul 12, 2016, at 10:35 AM, Paul Benedict > wrote: > > > > Mandy, can you please give a look to the first email in this thread and > see if you believe the enhanced message I suggested is helpful? I think it > would be. > > > > > > Your Suggestion: > "create VM but do not load mainclass or execute main method? > > The main class is loaded and your suggested text does not apply. What > enhanced message do you refer to? > > Mandy > > From martinrb at google.com Tue Jul 12 06:17:48 2016 From: martinrb at google.com (Martin Buchholz) Date: Mon, 11 Jul 2016 23:17:48 -0700 Subject: JDK 9 RFR of JDK-8132548: java/lang/ThreadGroup/Stop.java fails with "RuntimeException: Failure" In-Reply-To: <57848014.3080504@oracle.com> References: <577F0978.4020902@oracle.com> <577F41D0.6070904@oracle.com> <5783556E.4090708@oracle.com> <9659dd71-7e11-2d6a-2e7e-479949cc57dd@oracle.com> <57848014.3080504@oracle.com> Message-ID: Amy, sorry you have so many picky reviewers! Here's how I might write it: import java.util.concurrent.CountDownLatch; import java.util.concurrent.atomic.AtomicReference; public class Stop { private static final CountDownLatch ready = new CountDownLatch(1); private static final ThreadGroup group = new ThreadGroup(""); private static final AtomicReference firstThrowable = new AtomicReference<>(); private static final AtomicReference secondThrowable = new AtomicReference<>(); private static final Thread second = new Thread(group, () -> { ready.countDown(); try { do {} while (true); } catch (Throwable ex) { secondThrowable.set(ex); } }); private static final Thread first = new Thread(group, () -> { // Wait until "second" is started try { ready.await(); group.stop(); } catch (Throwable ex) { firstThrowable.set(ex); } }); public static void main(String[] args) throws Exception { // Launch two threads as part of the same thread group first.start(); second.start(); // Both threads should terminate when the first thread // terminates the thread group. second.join(); first.join(); if (! (firstThrowable.get() instanceof ThreadDeath) || ! (secondThrowable.get() instanceof ThreadDeath)) throw new AssertionError("should have thrown ThreadDeath"); // Test passed - if never get here the test times out and fails. } } On Mon, Jul 11, 2016 at 10:28 PM, Amy Lu wrote: > Please help to review the updated webrev, getting rid of ThreadDeath and > using join(): > > http://cr.openjdk.java.net/~amlu/8132548/webrev.03/ > > Thanks, > Amy > > > On 7/11/16 6:55 PM, David Holmes wrote: > >> >> >> On 11/07/2016 6:14 PM, Amy Lu wrote: >> >>> Thank you David, though the email crossed-by, I hope all the concerns >>> have been resolved in the updated webrev: >>> http://cr.openjdk.java.net/~amlu/8132548/webrev.02/ >>> >> >> Sorry but no, the changes are neither necessary nor sufficient. With the >> new code the ThreadDeath can hit anytime after countDown(), so it can hit >> before you enter the try block. >> >> I had rewrote the test with CountDownLatch and join(long millis). Also >>> unlike the old version, test thread 'first' and 'second' do different >>> things, and 'second' thread will keep alive for waiting to be killed by >>> group.stop() from 'frist' thread in the same thread group. I think this >>> could avoid the second call to second.stop() (group.stop()) issue. >>> >> >> Simply using join() with no timeout and relying on the test framework to >> kill the test allows you to do away with the second stop(). >> >> David >> ----- >> >> The time LONG_DELAY_MS used in join(long millis) is an adjusted timeout: >>> >>> private static final long LONG_DELAY_MS = Utils.adjustTimeout(1000L); >>> ... >>> >>> second.join(LONG_DELAY_MS); >>> boolean failed = second.isAlive(); >>> >>> This gives second thread a more "reasonable" time to die, with taking >>> account of the test harness timeout. >>> This almost same as second.join()// test pass or timeout, but with >>> additional chance of killing all threads in a bad case. >>> >>> Thanks, >>> Amy >>> >>> On 7/11/16 3:25 PM, David Holmes wrote: >>> >>>> Simplification ... >>>> >>>> On 11/07/2016 5:12 PM, David Holmes wrote: >>>> >>>>> Hi Amy, >>>>> >>>>> Thanks for tackling this. >>>>> >>>>> On 8/07/2016 4:01 PM, Amy Lu wrote: >>>>> >>>>>> Thank you Joe for your review. >>>>>> >>>>>> The intent is to give it more chance "for the thread group stop to be >>>>>> issued", not to extend the whole test execution timeout. >>>>>> >>>>>> I updated the webrev to make this in a retry, limit to 5 times of >>>>>> retry: >>>>>> http://cr.openjdk.java.net/~amlu/8132548/webrev.01/ >>>>>> >>>>> >>>>> The retry serves no purpose here. groupStopped is being set to true and >>>>> the waiting thread has been notified, so the loop will terminate after >>>>> the first sleep. The failure happens when the main thread checks the >>>>> isAlive() status of the second thread before the ThreadGroup.stop has >>>>> actually had a chance to stop and terminate it - such that isAlive is >>>>> now false. That is why I suggested waiting a bit longer by extending >>>>> the >>>>> sleep. >>>>> >>>>> I agree that making the test last at least 5 seconds is not ideal, but >>>>> I >>>>> didn't think it would be an issue in the big picture of testing. >>>>> >>>>> Ideally explicit "synchronization" is better than sleeps but that would >>>>> again be missing the point with this test. We expect the thread to >>>>> terminate, if it hasn't terminated in a "reasonable" time we consider >>>>> the stop() to have failed and the test to fail. To that end we could >>>>> remove the sleep altogether and change: >>>>> >>>>> boolean failed = second.isAlive(); >>>>> >>>>> to >>>>> >>>>> try { >>>>> second.join(1000); >>>>> } catch (InterruptedException shouldNotHappen) {} >>>>> boolean failed = second.isAlive(); >>>>> >>>>> Now we use explicit event synchronization - great! But the test has the >>>>> same failure issue now as it did with the sleep. Putting in a >>>>> CountDownLatch would have exactly the same problem: we expect the >>>>> second >>>>> thread to signal the latch as it terminates, but if that doesn't happen >>>>> within a "reasonable" amount of time, then we deem the stop() to have >>>>> failed and the test to have failed. >>>>> >>>>> Also note that the more code we add the more likely the second call to >>>>> second.stop() triggers an async exception in code that can't handle it >>>>> and results in an even worse failure mode! >>>>> >>>>> The only thing I can suggest is to get rid of the explicit sleep (or >>>>> join, or latch.await() etc) and simply recode as an infinite loop and >>>>> rely on the test harness to tear things down when the overall test >>>>> timeout kicks in. That way the test either passes or is timed-out, >>>>> there >>>>> is no explicit failure - but a busy loop is also bad so you would want >>>>> a >>>>> small sleep in there anyway: >>>>> >>>>> while (second.isAlive()) { >>>>> Thread.sleep(10); >>>>> } >>>>> // Test passed - if we never get here the test times out and >>>>> // we implicitly fail. >>>>> >>>> >>>> Of course that was silly all you need is: >>>> >>>> second.join(); >>>> // Test passed - if we never get here the test times out and >>>> // we implicitly fail. >>>> >>>> David >>>> >>>> >>>> Thanks, >>>>> David >>>>> >>>>> Thanks, >>>>>> Amy >>>>>> >>>>>> On 7/8/16 12:15 PM, joe darcy wrote: >>>>>> >>>>>>> Hi Amy, >>>>>>> >>>>>>> I'm a bit uncomfortable with the fix as-is. >>>>>>> >>>>>>> Rather than hard-coding sleep values, if sleep values are needed I >>>>>>> think it is a better practice to use ones that are scaled with the >>>>>>> jtreg timeout factors, etc. used to run the tests. Please instead use >>>>>>> something like the adjustTimeout method of >>>>>>> >>>>>>> $JDK_FOREST_ROOT/test/lib/share/classes/jdk/test/lib/Utils >>>>>>> >>>>>>> As a general comment, I'd prefer we don't just up timeout values for >>>>>>> tests. That can cause the whole test suite run to slow down, which is >>>>>>> undesirable especially if the condition in question may actually be >>>>>>> satisfied in many cases much faster than the timeout value. >>>>>>> >>>>>>> Thanks, >>>>>>> >>>>>>> -Joe >>>>>>> >>>>>>> >>>>>>> On 7/7/2016 7:01 PM, Amy Lu wrote: >>>>>>> >>>>>>>> Please review this trivial fix for >>>>>>>> test:java/lang/ThreadGroup/Stop.java >>>>>>>> >>>>>>>> Though this is a test for a deprecated API, failed with very very >>>>>>>> low >>>>>>>> frequency and hard to reproduce (I got no luck to reproduce it), I?d >>>>>>>> like to patch it as suggested: extend the sleep in the main thread >>>>>>>> from one second to five seconds. Also added 'volatile' to the >>>>>>>> boolean >>>>>>>> variable 'groupStopped'. >>>>>>>> >>>>>>>> bug: https://bugs.openjdk.java.net/browse/JDK-8132548 >>>>>>>> webrev: http://cr.openjdk.java.net/~amlu/8132548/webrev.00/ >>>>>>>> >>>>>>>> Thanks, >>>>>>>> Amy >>>>>>>> >>>>>>>> >>>>>>>> --- old/test/java/lang/ThreadGroup/Stop.java 2016-07-04 >>>>>>>> 14:53:59.000000000 +0800 >>>>>>>> +++ new/test/java/lang/ThreadGroup/Stop.java 2016-07-04 >>>>>>>> 14:53:58.000000000 +0800 >>>>>>>> @@ -1,5 +1,5 @@ >>>>>>>> /* >>>>>>>> - * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All >>>>>>>> rights reserved. >>>>>>>> + * Copyright (c) 1999, 2016, 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 >>>>>>>> @@ -29,7 +29,7 @@ >>>>>>>> */ >>>>>>>> >>>>>>>> public class Stop implements Runnable { >>>>>>>> - private static boolean groupStopped = false ; >>>>>>>> + private static volatile boolean groupStopped = false ; >>>>>>>> private static final Object lock = new Object(); >>>>>>>> >>>>>>>> private static final ThreadGroup group = new ThreadGroup(""); >>>>>>>> @@ -70,7 +70,7 @@ >>>>>>>> while (!groupStopped) { >>>>>>>> lock.wait(); >>>>>>>> // Give the other thread a chance to stop >>>>>>>> - Thread.sleep(1000); >>>>>>>> + Thread.sleep(5000); >>>>>>>> } >>>>>>>> } >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>> >>>>>> >>> > From david.holmes at oracle.com Tue Jul 12 06:33:36 2016 From: david.holmes at oracle.com (David Holmes) Date: Tue, 12 Jul 2016 16:33:36 +1000 Subject: JDK 9 RFR of JDK-8132548: java/lang/ThreadGroup/Stop.java fails with "RuntimeException: Failure" In-Reply-To: <57848014.3080504@oracle.com> References: <577F0978.4020902@oracle.com> <577F41D0.6070904@oracle.com> <5783556E.4090708@oracle.com> <9659dd71-7e11-2d6a-2e7e-479949cc57dd@oracle.com> <57848014.3080504@oracle.com> Message-ID: <0411e58e-40d8-6aba-7f39-f7248e16d300@oracle.com> Hi Amy, On 12/07/2016 3:28 PM, Amy Lu wrote: > Please help to review the updated webrev, getting rid of ThreadDeath and > using join(): > > http://cr.openjdk.java.net/~amlu/8132548/webrev.03/ I still think a simple change to the original code suffices, but given you have gone this far ... Busy-loops are "bad" and unnecessary: 40 while (true) { // keep it alive 41 } This can be changed to a long blocking operation eg: while (true) { try { Thread.sleep(60000); } catch (InterruptedException shouldNotHappen) { } } Thanks, David > Thanks, > Amy > > On 7/11/16 6:55 PM, David Holmes wrote: >> >> >> On 11/07/2016 6:14 PM, Amy Lu wrote: >>> Thank you David, though the email crossed-by, I hope all the concerns >>> have been resolved in the updated webrev: >>> http://cr.openjdk.java.net/~amlu/8132548/webrev.02/ >> >> Sorry but no, the changes are neither necessary nor sufficient. With >> the new code the ThreadDeath can hit anytime after countDown(), so it >> can hit before you enter the try block. >> >>> I had rewrote the test with CountDownLatch and join(long millis). Also >>> unlike the old version, test thread 'first' and 'second' do different >>> things, and 'second' thread will keep alive for waiting to be killed by >>> group.stop() from 'frist' thread in the same thread group. I think this >>> could avoid the second call to second.stop() (group.stop()) issue. >> >> Simply using join() with no timeout and relying on the test framework >> to kill the test allows you to do away with the second stop(). >> >> David >> ----- >> >>> The time LONG_DELAY_MS used in join(long millis) is an adjusted timeout: >>> >>> private static final long LONG_DELAY_MS = Utils.adjustTimeout(1000L); >>> ... >>> >>> second.join(LONG_DELAY_MS); >>> boolean failed = second.isAlive(); >>> >>> This gives second thread a more "reasonable" time to die, with taking >>> account of the test harness timeout. >>> This almost same as second.join()// test pass or timeout, but with >>> additional chance of killing all threads in a bad case. >>> >>> Thanks, >>> Amy >>> >>> On 7/11/16 3:25 PM, David Holmes wrote: >>>> Simplification ... >>>> >>>> On 11/07/2016 5:12 PM, David Holmes wrote: >>>>> Hi Amy, >>>>> >>>>> Thanks for tackling this. >>>>> >>>>> On 8/07/2016 4:01 PM, Amy Lu wrote: >>>>>> Thank you Joe for your review. >>>>>> >>>>>> The intent is to give it more chance "for the thread group stop to be >>>>>> issued", not to extend the whole test execution timeout. >>>>>> >>>>>> I updated the webrev to make this in a retry, limit to 5 times of >>>>>> retry: >>>>>> http://cr.openjdk.java.net/~amlu/8132548/webrev.01/ >>>>> >>>>> The retry serves no purpose here. groupStopped is being set to true >>>>> and >>>>> the waiting thread has been notified, so the loop will terminate after >>>>> the first sleep. The failure happens when the main thread checks the >>>>> isAlive() status of the second thread before the ThreadGroup.stop has >>>>> actually had a chance to stop and terminate it - such that isAlive is >>>>> now false. That is why I suggested waiting a bit longer by >>>>> extending the >>>>> sleep. >>>>> >>>>> I agree that making the test last at least 5 seconds is not ideal, >>>>> but I >>>>> didn't think it would be an issue in the big picture of testing. >>>>> >>>>> Ideally explicit "synchronization" is better than sleeps but that >>>>> would >>>>> again be missing the point with this test. We expect the thread to >>>>> terminate, if it hasn't terminated in a "reasonable" time we consider >>>>> the stop() to have failed and the test to fail. To that end we could >>>>> remove the sleep altogether and change: >>>>> >>>>> boolean failed = second.isAlive(); >>>>> >>>>> to >>>>> >>>>> try { >>>>> second.join(1000); >>>>> } catch (InterruptedException shouldNotHappen) {} >>>>> boolean failed = second.isAlive(); >>>>> >>>>> Now we use explicit event synchronization - great! But the test has >>>>> the >>>>> same failure issue now as it did with the sleep. Putting in a >>>>> CountDownLatch would have exactly the same problem: we expect the >>>>> second >>>>> thread to signal the latch as it terminates, but if that doesn't >>>>> happen >>>>> within a "reasonable" amount of time, then we deem the stop() to have >>>>> failed and the test to have failed. >>>>> >>>>> Also note that the more code we add the more likely the second call to >>>>> second.stop() triggers an async exception in code that can't handle it >>>>> and results in an even worse failure mode! >>>>> >>>>> The only thing I can suggest is to get rid of the explicit sleep (or >>>>> join, or latch.await() etc) and simply recode as an infinite loop and >>>>> rely on the test harness to tear things down when the overall test >>>>> timeout kicks in. That way the test either passes or is timed-out, >>>>> there >>>>> is no explicit failure - but a busy loop is also bad so you would >>>>> want a >>>>> small sleep in there anyway: >>>>> >>>>> while (second.isAlive()) { >>>>> Thread.sleep(10); >>>>> } >>>>> // Test passed - if we never get here the test times out and >>>>> // we implicitly fail. >>>> >>>> Of course that was silly all you need is: >>>> >>>> second.join(); >>>> // Test passed - if we never get here the test times out and >>>> // we implicitly fail. >>>> >>>> David >>>> >>>> >>>>> Thanks, >>>>> David >>>>> >>>>>> Thanks, >>>>>> Amy >>>>>> >>>>>> On 7/8/16 12:15 PM, joe darcy wrote: >>>>>>> Hi Amy, >>>>>>> >>>>>>> I'm a bit uncomfortable with the fix as-is. >>>>>>> >>>>>>> Rather than hard-coding sleep values, if sleep values are needed I >>>>>>> think it is a better practice to use ones that are scaled with the >>>>>>> jtreg timeout factors, etc. used to run the tests. Please instead >>>>>>> use >>>>>>> something like the adjustTimeout method of >>>>>>> >>>>>>> $JDK_FOREST_ROOT/test/lib/share/classes/jdk/test/lib/Utils >>>>>>> >>>>>>> As a general comment, I'd prefer we don't just up timeout values for >>>>>>> tests. That can cause the whole test suite run to slow down, >>>>>>> which is >>>>>>> undesirable especially if the condition in question may actually be >>>>>>> satisfied in many cases much faster than the timeout value. >>>>>>> >>>>>>> Thanks, >>>>>>> >>>>>>> -Joe >>>>>>> >>>>>>> >>>>>>> On 7/7/2016 7:01 PM, Amy Lu wrote: >>>>>>>> Please review this trivial fix for >>>>>>>> test:java/lang/ThreadGroup/Stop.java >>>>>>>> >>>>>>>> Though this is a test for a deprecated API, failed with very >>>>>>>> very low >>>>>>>> frequency and hard to reproduce (I got no luck to reproduce it), >>>>>>>> I?d >>>>>>>> like to patch it as suggested: extend the sleep in the main thread >>>>>>>> from one second to five seconds. Also added 'volatile' to the >>>>>>>> boolean >>>>>>>> variable 'groupStopped'. >>>>>>>> >>>>>>>> bug: https://bugs.openjdk.java.net/browse/JDK-8132548 >>>>>>>> webrev: http://cr.openjdk.java.net/~amlu/8132548/webrev.00/ >>>>>>>> >>>>>>>> Thanks, >>>>>>>> Amy >>>>>>>> >>>>>>>> >>>>>>>> --- old/test/java/lang/ThreadGroup/Stop.java 2016-07-04 >>>>>>>> 14:53:59.000000000 +0800 >>>>>>>> +++ new/test/java/lang/ThreadGroup/Stop.java 2016-07-04 >>>>>>>> 14:53:58.000000000 +0800 >>>>>>>> @@ -1,5 +1,5 @@ >>>>>>>> /* >>>>>>>> - * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All >>>>>>>> rights reserved. >>>>>>>> + * Copyright (c) 1999, 2016, 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 >>>>>>>> @@ -29,7 +29,7 @@ >>>>>>>> */ >>>>>>>> >>>>>>>> public class Stop implements Runnable { >>>>>>>> - private static boolean groupStopped = false ; >>>>>>>> + private static volatile boolean groupStopped = false ; >>>>>>>> private static final Object lock = new Object(); >>>>>>>> >>>>>>>> private static final ThreadGroup group = new ThreadGroup(""); >>>>>>>> @@ -70,7 +70,7 @@ >>>>>>>> while (!groupStopped) { >>>>>>>> lock.wait(); >>>>>>>> // Give the other thread a chance to stop >>>>>>>> - Thread.sleep(1000); >>>>>>>> + Thread.sleep(5000); >>>>>>>> } >>>>>>>> } >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>> >>>>>> >>> > From martinrb at google.com Tue Jul 12 06:33:42 2016 From: martinrb at google.com (Martin Buchholz) Date: Mon, 11 Jul 2016 23:33:42 -0700 Subject: JDK 9 RFR of JDK-8132548: java/lang/ThreadGroup/Stop.java fails with "RuntimeException: Failure" In-Reply-To: References: <577F0978.4020902@oracle.com> <577F41D0.6070904@oracle.com> <5783556E.4090708@oracle.com> <9659dd71-7e11-2d6a-2e7e-479949cc57dd@oracle.com> <57848014.3080504@oracle.com> Message-ID: And then somehow the unnecessary statics started to bother me: import java.util.concurrent.CountDownLatch; import java.util.concurrent.atomic.AtomicReference; public class Stop { public static void main(String[] args) throws Exception { final CountDownLatch ready = new CountDownLatch(1); final ThreadGroup group = new ThreadGroup(""); final AtomicReference firstThrowable = new AtomicReference<>(); final AtomicReference secondThrowable = new AtomicReference<>(); final Thread second = new Thread(group, () -> { ready.countDown(); try { do {} while (true); } catch (Throwable ex) { secondThrowable.set(ex); }}); final Thread first = new Thread(group, () -> { // Wait until "second" is started try { ready.await(); group.stop(); } catch (Throwable ex) { firstThrowable.set(ex); }}); // Launch two threads as part of the same thread group first.start(); second.start(); // Both threads should terminate when the first thread // terminates the thread group. second.join(); first.join(); if (! (firstThrowable.get() instanceof ThreadDeath) || ! (secondThrowable.get() instanceof ThreadDeath)) throw new AssertionError("should have thrown ThreadDeath"); // Test passed - if never get here the test times out and fails. } } From daniel.fuchs at oracle.com Tue Jul 12 06:41:07 2016 From: daniel.fuchs at oracle.com (Daniel Fuchs) Date: Tue, 12 Jul 2016 08:41:07 +0200 Subject: --dry-run description enhancement In-Reply-To: References: Message-ID: Hi Paul, On 7/12/16 8:00 AM, Paul Benedict wrote: > Mandy, perhaps there is a JVM technicality here I'm unfamiliar with. My > understanding of loading a class has always been that it's coupled with > running its static initializers. So my inference was that the class does > not get loaded into memory because the latter no longer occurs with > --dry-run. --dry-run will load the main class without initializing it (= without running the static initializers) - otherwise it wouldn't quite be a dry run. see: http://hg.openjdk.java.net/jdk9/jdk9/jdk/rev/604fc0a43f5b#l1.22 (the 'false' parameter given to Class.forName()) best regards, -- daniel > > On Jul 11, 2016 9:41 PM, "Mandy Chung" wrote: > >> >>> On Jul 12, 2016, at 10:35 AM, Paul Benedict >> wrote: >>> >>> Mandy, can you please give a look to the first email in this thread and >> see if you believe the enhanced message I suggested is helpful? I think it >> would be. >>> >>> >> >> Your Suggestion: >> "create VM but do not load mainclass or execute main method? >> >> The main class is loaded and your suggested text does not apply. What >> enhanced message do you refer to? >> >> Mandy >> >> From david.holmes at oracle.com Tue Jul 12 06:44:01 2016 From: david.holmes at oracle.com (David Holmes) Date: Tue, 12 Jul 2016 16:44:01 +1000 Subject: JDK 9 RFR of JDK-8132548: java/lang/ThreadGroup/Stop.java fails with "RuntimeException: Failure" In-Reply-To: References: <577F0978.4020902@oracle.com> <577F41D0.6070904@oracle.com> <5783556E.4090708@oracle.com> <9659dd71-7e11-2d6a-2e7e-479949cc57dd@oracle.com> <57848014.3080504@oracle.com> Message-ID: <05dc50cb-e4f5-9778-2777-2d1f797eff30@oracle.com> On 12/07/2016 4:17 PM, Martin Buchholz wrote: > Amy, sorry you have so many picky reviewers! Difference between patching a failing test and completely redesigning it from scratch. The latter was not warranted in my opinion. > Here's how I might write it: > > import java.util.concurrent.CountDownLatch; > import java.util.concurrent.atomic.AtomicReference; > > public class Stop { > private static final CountDownLatch ready = new CountDownLatch(1); > private static final ThreadGroup group = new ThreadGroup(""); > private static final AtomicReference firstThrowable > = new AtomicReference<>(); > private static final AtomicReference secondThrowable > = new AtomicReference<>(); Simple volatile Throwable fields would suffice - AtomicReferences are overkill. > private static final Thread second = new Thread(group, () -> { > ready.countDown(); > try { You have to place the countDown() inside the try block else the ThreadDeath may escape. > do {} while (true); Busy-loops are "bad". > } catch (Throwable ex) { > secondThrowable.set(ex); > } > }); > > private static final Thread first = new Thread(group, () -> { > // Wait until "second" is started > try { > ready.await(); > group.stop(); > } catch (Throwable ex) { > firstThrowable.set(ex); > } > }); > > public static void main(String[] args) throws Exception { > // Launch two threads as part of the same thread group > first.start(); > second.start(); > > // Both threads should terminate when the first thread > // terminates the thread group. > second.join(); > first.join(); > if (! (firstThrowable.get() instanceof ThreadDeath) || > ! (secondThrowable.get() instanceof ThreadDeath)) > throw new AssertionError("should have thrown ThreadDeath"); > // Test passed - if never get here the test times out and fails. > } > } I agree this meets the "spec" of checking "did group.stop() cause all group members to encounter a ThreadDeath exception". But in relation to fixing the original timing problem, well a simple untimed-join() fixed that. David ----- > > On Mon, Jul 11, 2016 at 10:28 PM, Amy Lu > wrote: > > Please help to review the updated webrev, getting rid of ThreadDeath > and using join(): > > http://cr.openjdk.java.net/~amlu/8132548/webrev.03/ > > Thanks, > Amy > > > On 7/11/16 6:55 PM, David Holmes wrote: > > > > On 11/07/2016 6:14 PM, Amy Lu wrote: > > Thank you David, though the email crossed-by, I hope all the > concerns > have been resolved in the updated webrev: > http://cr.openjdk.java.net/~amlu/8132548/webrev.02/ > > > Sorry but no, the changes are neither necessary nor sufficient. > With the new code the ThreadDeath can hit anytime after > countDown(), so it can hit before you enter the try block. > > I had rewrote the test with CountDownLatch and join(long > millis). Also > unlike the old version, test thread 'first' and 'second' do > different > things, and 'second' thread will keep alive for waiting to > be killed by > group.stop() from 'frist' thread in the same thread group. I > think this > could avoid the second call to second.stop() (group.stop()) > issue. > > > Simply using join() with no timeout and relying on the test > framework to kill the test allows you to do away with the second > stop(). > > David > ----- > > The time LONG_DELAY_MS used in join(long millis) is an > adjusted timeout: > > private static final long LONG_DELAY_MS = > Utils.adjustTimeout(1000L); > ... > > second.join(LONG_DELAY_MS); > boolean failed = second.isAlive(); > > This gives second thread a more "reasonable" time to die, > with taking > account of the test harness timeout. > This almost same as second.join()// test pass or timeout, > but with > additional chance of killing all threads in a bad case. > > Thanks, > Amy > > On 7/11/16 3:25 PM, David Holmes wrote: > > Simplification ... > > On 11/07/2016 5:12 PM, David Holmes wrote: > > Hi Amy, > > Thanks for tackling this. > > On 8/07/2016 4:01 PM, Amy Lu wrote: > > Thank you Joe for your review. > > The intent is to give it more chance "for the > thread group stop to be > issued", not to extend the whole test execution > timeout. > > I updated the webrev to make this in a retry, > limit to 5 times of > retry: > http://cr.openjdk.java.net/~amlu/8132548/webrev.01/ > > > The retry serves no purpose here. groupStopped is > being set to true and > the waiting thread has been notified, so the loop > will terminate after > the first sleep. The failure happens when the main > thread checks the > isAlive() status of the second thread before the > ThreadGroup.stop has > actually had a chance to stop and terminate it - > such that isAlive is > now false. That is why I suggested waiting a bit > longer by extending the > sleep. > > I agree that making the test last at least 5 seconds > is not ideal, but I > didn't think it would be an issue in the big picture > of testing. > > Ideally explicit "synchronization" is better than > sleeps but that would > again be missing the point with this test. We expect > the thread to > terminate, if it hasn't terminated in a "reasonable" > time we consider > the stop() to have failed and the test to fail. To > that end we could > remove the sleep altogether and change: > > boolean failed = second.isAlive(); > > to > > try { > second.join(1000); > } catch (InterruptedException shouldNotHappen) {} > boolean failed = second.isAlive(); > > Now we use explicit event synchronization - great! > But the test has the > same failure issue now as it did with the sleep. > Putting in a > CountDownLatch would have exactly the same problem: > we expect the second > thread to signal the latch as it terminates, but if > that doesn't happen > within a "reasonable" amount of time, then we deem > the stop() to have > failed and the test to have failed. > > Also note that the more code we add the more likely > the second call to > second.stop() triggers an async exception in code > that can't handle it > and results in an even worse failure mode! > > The only thing I can suggest is to get rid of the > explicit sleep (or > join, or latch.await() etc) and simply recode as an > infinite loop and > rely on the test harness to tear things down when > the overall test > timeout kicks in. That way the test either passes or > is timed-out, there > is no explicit failure - but a busy loop is also bad > so you would want a > small sleep in there anyway: > > while (second.isAlive()) { > Thread.sleep(10); > } > // Test passed - if we never get here the test times > out and > // we implicitly fail. > > > Of course that was silly all you need is: > > second.join(); > // Test passed - if we never get here the test times out and > // we implicitly fail. > > David > > > Thanks, > David > > Thanks, > Amy > > On 7/8/16 12:15 PM, joe darcy wrote: > > Hi Amy, > > I'm a bit uncomfortable with the fix as-is. > > Rather than hard-coding sleep values, if > sleep values are needed I > think it is a better practice to use ones > that are scaled with the > jtreg timeout factors, etc. used to run the > tests. Please instead use > something like the adjustTimeout method of > > $JDK_FOREST_ROOT/test/lib/share/classes/jdk/test/lib/Utils > > As a general comment, I'd prefer we don't > just up timeout values for > tests. That can cause the whole test suite > run to slow down, which is > undesirable especially if the condition in > question may actually be > satisfied in many cases much faster than the > timeout value. > > Thanks, > > -Joe > > > On 7/7/2016 7:01 PM, Amy Lu wrote: > > Please review this trivial fix for > test:java/lang/ThreadGroup/Stop.java > > Though this is a test for a deprecated > API, failed with very very low > frequency and hard to reproduce (I got > no luck to reproduce it), I?d > like to patch it as suggested: extend > the sleep in the main thread > from one second to five seconds. Also > added 'volatile' to the boolean > variable 'groupStopped'. > > bug: > https://bugs.openjdk.java.net/browse/JDK-8132548 > webrev: > http://cr.openjdk.java.net/~amlu/8132548/webrev.00/ > > Thanks, > Amy > > > --- > old/test/java/lang/ThreadGroup/Stop.java > 2016-07-04 > 14:53:59.000000000 +0800 > +++ > new/test/java/lang/ThreadGroup/Stop.java > 2016-07-04 > 14:53:58.000000000 +0800 > @@ -1,5 +1,5 @@ > /* > - * Copyright (c) 1999, 2011, Oracle > and/or its affiliates. All > rights reserved. > + * Copyright (c) 1999, 2016, 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 > @@ -29,7 +29,7 @@ > */ > > public class Stop implements Runnable { > - private static boolean groupStopped > = false ; > + private static volatile boolean > groupStopped = false ; > private static final Object lock = > new Object(); > > private static final ThreadGroup > group = new ThreadGroup(""); > @@ -70,7 +70,7 @@ > while (!groupStopped) { > lock.wait(); > // Give the other > thread a chance to stop > - Thread.sleep(1000); > + Thread.sleep(5000); > } > } > > > > > > > > From david.holmes at oracle.com Tue Jul 12 06:46:53 2016 From: david.holmes at oracle.com (David Holmes) Date: Tue, 12 Jul 2016 16:46:53 +1000 Subject: --dry-run description enhancement In-Reply-To: References: Message-ID: <8c419fde-054a-2365-0ea6-a5fa79d739d0@oracle.com> On 12/07/2016 4:00 PM, Paul Benedict wrote: > Mandy, perhaps there is a JVM technicality here I'm unfamiliar with. My > understanding of loading a class has always been that it's coupled with > running its static initializers. Loading, linking (resolution) and initialization are all distinct parts of making a Class available for use. Loading and linking can be eager or lazy, at the choice of the VM. initialization must only occur when specific interactions with the class are executed. David ----- So my inference was that the class does > not get loaded into memory because the latter no longer occurs with > --dry-run. > > On Jul 11, 2016 9:41 PM, "Mandy Chung" wrote: > >> >>> On Jul 12, 2016, at 10:35 AM, Paul Benedict >> wrote: >>> >>> Mandy, can you please give a look to the first email in this thread and >> see if you believe the enhanced message I suggested is helpful? I think it >> would be. >>> >>> >> >> Your Suggestion: >> "create VM but do not load mainclass or execute main method? >> >> The main class is loaded and your suggested text does not apply. What >> enhanced message do you refer to? >> >> Mandy >> >> From amy.lu at oracle.com Tue Jul 12 07:11:14 2016 From: amy.lu at oracle.com (Amy Lu) Date: Tue, 12 Jul 2016 15:11:14 +0800 Subject: JDK 9 RFR of JDK-8132548: java/lang/ThreadGroup/Stop.java fails with "RuntimeException: Failure" In-Reply-To: <0411e58e-40d8-6aba-7f39-f7248e16d300@oracle.com> References: <577F0978.4020902@oracle.com> <577F41D0.6070904@oracle.com> <5783556E.4090708@oracle.com> <9659dd71-7e11-2d6a-2e7e-479949cc57dd@oracle.com> <57848014.3080504@oracle.com> <0411e58e-40d8-6aba-7f39-f7248e16d300@oracle.com> Message-ID: <57849812.7060205@oracle.com> Updated on the busy-loops, also removed the unnecessary statics, here comes the updated webrev: http://cr.openjdk.java.net/~amlu/8132548/webrev.04/ Thanks, Amy On 7/12/16 2:33 PM, David Holmes wrote: > Hi Amy, > > On 12/07/2016 3:28 PM, Amy Lu wrote: >> Please help to review the updated webrev, getting rid of ThreadDeath and >> using join(): >> >> http://cr.openjdk.java.net/~amlu/8132548/webrev.03/ > > I still think a simple change to the original code suffices, but given > you have gone this far ... > > Busy-loops are "bad" and unnecessary: > > 40 while (true) { // keep it alive > 41 } > > This can be changed to a long blocking operation eg: > > while (true) { > try { > Thread.sleep(60000); > } > catch (InterruptedException shouldNotHappen) { > } > } > > Thanks, > David > >> Thanks, >> Amy >> >> On 7/11/16 6:55 PM, David Holmes wrote: >>> >>> >>> On 11/07/2016 6:14 PM, Amy Lu wrote: >>>> Thank you David, though the email crossed-by, I hope all the concerns >>>> have been resolved in the updated webrev: >>>> http://cr.openjdk.java.net/~amlu/8132548/webrev.02/ >>> >>> Sorry but no, the changes are neither necessary nor sufficient. With >>> the new code the ThreadDeath can hit anytime after countDown(), so it >>> can hit before you enter the try block. >>> >>>> I had rewrote the test with CountDownLatch and join(long millis). Also >>>> unlike the old version, test thread 'first' and 'second' do different >>>> things, and 'second' thread will keep alive for waiting to be >>>> killed by >>>> group.stop() from 'frist' thread in the same thread group. I think >>>> this >>>> could avoid the second call to second.stop() (group.stop()) issue. >>> >>> Simply using join() with no timeout and relying on the test framework >>> to kill the test allows you to do away with the second stop(). >>> >>> David >>> ----- >>> >>>> The time LONG_DELAY_MS used in join(long millis) is an adjusted >>>> timeout: >>>> >>>> private static final long LONG_DELAY_MS = Utils.adjustTimeout(1000L); >>>> ... >>>> >>>> second.join(LONG_DELAY_MS); >>>> boolean failed = second.isAlive(); >>>> >>>> This gives second thread a more "reasonable" time to die, with taking >>>> account of the test harness timeout. >>>> This almost same as second.join()// test pass or timeout, but with >>>> additional chance of killing all threads in a bad case. >>>> >>>> Thanks, >>>> Amy >>>> >>>> On 7/11/16 3:25 PM, David Holmes wrote: >>>>> Simplification ... >>>>> >>>>> On 11/07/2016 5:12 PM, David Holmes wrote: >>>>>> Hi Amy, >>>>>> >>>>>> Thanks for tackling this. >>>>>> >>>>>> On 8/07/2016 4:01 PM, Amy Lu wrote: >>>>>>> Thank you Joe for your review. >>>>>>> >>>>>>> The intent is to give it more chance "for the thread group stop >>>>>>> to be >>>>>>> issued", not to extend the whole test execution timeout. >>>>>>> >>>>>>> I updated the webrev to make this in a retry, limit to 5 times of >>>>>>> retry: >>>>>>> http://cr.openjdk.java.net/~amlu/8132548/webrev.01/ >>>>>> >>>>>> The retry serves no purpose here. groupStopped is being set to true >>>>>> and >>>>>> the waiting thread has been notified, so the loop will terminate >>>>>> after >>>>>> the first sleep. The failure happens when the main thread checks the >>>>>> isAlive() status of the second thread before the ThreadGroup.stop >>>>>> has >>>>>> actually had a chance to stop and terminate it - such that >>>>>> isAlive is >>>>>> now false. That is why I suggested waiting a bit longer by >>>>>> extending the >>>>>> sleep. >>>>>> >>>>>> I agree that making the test last at least 5 seconds is not ideal, >>>>>> but I >>>>>> didn't think it would be an issue in the big picture of testing. >>>>>> >>>>>> Ideally explicit "synchronization" is better than sleeps but that >>>>>> would >>>>>> again be missing the point with this test. We expect the thread to >>>>>> terminate, if it hasn't terminated in a "reasonable" time we >>>>>> consider >>>>>> the stop() to have failed and the test to fail. To that end we could >>>>>> remove the sleep altogether and change: >>>>>> >>>>>> boolean failed = second.isAlive(); >>>>>> >>>>>> to >>>>>> >>>>>> try { >>>>>> second.join(1000); >>>>>> } catch (InterruptedException shouldNotHappen) {} >>>>>> boolean failed = second.isAlive(); >>>>>> >>>>>> Now we use explicit event synchronization - great! But the test has >>>>>> the >>>>>> same failure issue now as it did with the sleep. Putting in a >>>>>> CountDownLatch would have exactly the same problem: we expect the >>>>>> second >>>>>> thread to signal the latch as it terminates, but if that doesn't >>>>>> happen >>>>>> within a "reasonable" amount of time, then we deem the stop() to >>>>>> have >>>>>> failed and the test to have failed. >>>>>> >>>>>> Also note that the more code we add the more likely the second >>>>>> call to >>>>>> second.stop() triggers an async exception in code that can't >>>>>> handle it >>>>>> and results in an even worse failure mode! >>>>>> >>>>>> The only thing I can suggest is to get rid of the explicit sleep (or >>>>>> join, or latch.await() etc) and simply recode as an infinite loop >>>>>> and >>>>>> rely on the test harness to tear things down when the overall test >>>>>> timeout kicks in. That way the test either passes or is timed-out, >>>>>> there >>>>>> is no explicit failure - but a busy loop is also bad so you would >>>>>> want a >>>>>> small sleep in there anyway: >>>>>> >>>>>> while (second.isAlive()) { >>>>>> Thread.sleep(10); >>>>>> } >>>>>> // Test passed - if we never get here the test times out and >>>>>> // we implicitly fail. >>>>> >>>>> Of course that was silly all you need is: >>>>> >>>>> second.join(); >>>>> // Test passed - if we never get here the test times out and >>>>> // we implicitly fail. >>>>> >>>>> David >>>>> >>>>> >>>>>> Thanks, >>>>>> David >>>>>> >>>>>>> Thanks, >>>>>>> Amy >>>>>>> >>>>>>> On 7/8/16 12:15 PM, joe darcy wrote: >>>>>>>> Hi Amy, >>>>>>>> >>>>>>>> I'm a bit uncomfortable with the fix as-is. >>>>>>>> >>>>>>>> Rather than hard-coding sleep values, if sleep values are needed I >>>>>>>> think it is a better practice to use ones that are scaled with the >>>>>>>> jtreg timeout factors, etc. used to run the tests. Please instead >>>>>>>> use >>>>>>>> something like the adjustTimeout method of >>>>>>>> >>>>>>>> $JDK_FOREST_ROOT/test/lib/share/classes/jdk/test/lib/Utils >>>>>>>> >>>>>>>> As a general comment, I'd prefer we don't just up timeout >>>>>>>> values for >>>>>>>> tests. That can cause the whole test suite run to slow down, >>>>>>>> which is >>>>>>>> undesirable especially if the condition in question may >>>>>>>> actually be >>>>>>>> satisfied in many cases much faster than the timeout value. >>>>>>>> >>>>>>>> Thanks, >>>>>>>> >>>>>>>> -Joe >>>>>>>> >>>>>>>> >>>>>>>> On 7/7/2016 7:01 PM, Amy Lu wrote: >>>>>>>>> Please review this trivial fix for >>>>>>>>> test:java/lang/ThreadGroup/Stop.java >>>>>>>>> >>>>>>>>> Though this is a test for a deprecated API, failed with very >>>>>>>>> very low >>>>>>>>> frequency and hard to reproduce (I got no luck to reproduce it), >>>>>>>>> I?d >>>>>>>>> like to patch it as suggested: extend the sleep in the main >>>>>>>>> thread >>>>>>>>> from one second to five seconds. Also added 'volatile' to the >>>>>>>>> boolean >>>>>>>>> variable 'groupStopped'. >>>>>>>>> >>>>>>>>> bug: https://bugs.openjdk.java.net/browse/JDK-8132548 >>>>>>>>> webrev: http://cr.openjdk.java.net/~amlu/8132548/webrev.00/ >>>>>>>>> >>>>>>>>> Thanks, >>>>>>>>> Amy >>>>>>>>> >>>>>>>>> >>>>>>>>> --- old/test/java/lang/ThreadGroup/Stop.java 2016-07-04 >>>>>>>>> 14:53:59.000000000 +0800 >>>>>>>>> +++ new/test/java/lang/ThreadGroup/Stop.java 2016-07-04 >>>>>>>>> 14:53:58.000000000 +0800 >>>>>>>>> @@ -1,5 +1,5 @@ >>>>>>>>> /* >>>>>>>>> - * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All >>>>>>>>> rights reserved. >>>>>>>>> + * Copyright (c) 1999, 2016, 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 >>>>>>>>> @@ -29,7 +29,7 @@ >>>>>>>>> */ >>>>>>>>> >>>>>>>>> public class Stop implements Runnable { >>>>>>>>> - private static boolean groupStopped = false ; >>>>>>>>> + private static volatile boolean groupStopped = false ; >>>>>>>>> private static final Object lock = new Object(); >>>>>>>>> >>>>>>>>> private static final ThreadGroup group = new >>>>>>>>> ThreadGroup(""); >>>>>>>>> @@ -70,7 +70,7 @@ >>>>>>>>> while (!groupStopped) { >>>>>>>>> lock.wait(); >>>>>>>>> // Give the other thread a chance to stop >>>>>>>>> - Thread.sleep(1000); >>>>>>>>> + Thread.sleep(5000); >>>>>>>>> } >>>>>>>>> } >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>> >>>>>>> >>>> >> From amy.lu at oracle.com Tue Jul 12 07:51:27 2016 From: amy.lu at oracle.com (Amy Lu) Date: Tue, 12 Jul 2016 15:51:27 +0800 Subject: JDK 9 RFR of JDK-8132548: java/lang/ThreadGroup/Stop.java fails with "RuntimeException: Failure" In-Reply-To: References: <577F0978.4020902@oracle.com> <577F41D0.6070904@oracle.com> <5783556E.4090708@oracle.com> <9659dd71-7e11-2d6a-2e7e-479949cc57dd@oracle.com> <57848014.3080504@oracle.com> Message-ID: <5784A17F.6060600@oracle.com> On 7/12/16 2:17 PM, Martin Buchholz wrote: > Amy, sorry you have so many picky reviewers! My lucky ;-) Additional checking for ThreadDeath may good, but with the thinking that both group.stop() and thread.stop() are deprecated (since 1.2), I don't want to introduce new testcase, but focus on "fixing". The the unnecessary statics removed, thanks for point that out. Thanks, Amy > > Here's how I might write it: > > import java.util.concurrent.CountDownLatch; > import java.util.concurrent.atomic.AtomicReference; > > public class Stop { > private static final CountDownLatch ready = new CountDownLatch(1); > private static final ThreadGroup group = new ThreadGroup(""); > private static final AtomicReference firstThrowable > = new AtomicReference<>(); > private static final AtomicReference secondThrowable > = new AtomicReference<>(); > > private static final Thread second = new Thread(group, () -> { > ready.countDown(); > try { > do {} while (true); > } catch (Throwable ex) { > secondThrowable.set(ex); > } > }); > > private static final Thread first = new Thread(group, () -> { > // Wait until "second" is started > try { > ready.await(); > group.stop(); > } catch (Throwable ex) { > firstThrowable.set(ex); > } > }); > > public static void main(String[] args) throws Exception { > // Launch two threads as part of the same thread group > first.start(); > second.start(); > > // Both threads should terminate when the first thread > // terminates the thread group. > second.join(); > first.join(); > if (! (firstThrowable.get() instanceof ThreadDeath) || > ! (secondThrowable.get() instanceof ThreadDeath)) > throw new AssertionError("should have thrown ThreadDeath"); > // Test passed - if never get here the test times out and fails. > } > } > > > On Mon, Jul 11, 2016 at 10:28 PM, Amy Lu > wrote: > > Please help to review the updated webrev, getting rid of > ThreadDeath and using join(): > > http://cr.openjdk.java.net/~amlu/8132548/webrev.03/ > > > Thanks, > Amy > > > On 7/11/16 6:55 PM, David Holmes wrote: > > > > On 11/07/2016 6:14 PM, Amy Lu wrote: > > Thank you David, though the email crossed-by, I hope all > the concerns > have been resolved in the updated webrev: > http://cr.openjdk.java.net/~amlu/8132548/webrev.02/ > > > > Sorry but no, the changes are neither necessary nor > sufficient. With the new code the ThreadDeath can hit anytime > after countDown(), so it can hit before you enter the try block. > > I had rewrote the test with CountDownLatch and join(long > millis). Also > unlike the old version, test thread 'first' and 'second' > do different > things, and 'second' thread will keep alive for waiting to > be killed by > group.stop() from 'frist' thread in the same thread group. > I think this > could avoid the second call to second.stop() > (group.stop()) issue. > > > Simply using join() with no timeout and relying on the test > framework to kill the test allows you to do away with the > second stop(). > > David > ----- > > The time LONG_DELAY_MS used in join(long millis) is an > adjusted timeout: > > private static final long LONG_DELAY_MS = > Utils.adjustTimeout(1000L); > ... > > second.join(LONG_DELAY_MS); > boolean failed = second.isAlive(); > > This gives second thread a more "reasonable" time to die, > with taking > account of the test harness timeout. > This almost same as second.join()// test pass or timeout, > but with > additional chance of killing all threads in a bad case. > > Thanks, > Amy > > On 7/11/16 3:25 PM, David Holmes wrote: > > Simplification ... > > On 11/07/2016 5:12 PM, David Holmes wrote: > > Hi Amy, > > Thanks for tackling this. > > On 8/07/2016 4:01 PM, Amy Lu wrote: > > Thank you Joe for your review. > > The intent is to give it more chance "for the > thread group stop to be > issued", not to extend the whole test > execution timeout. > > I updated the webrev to make this in a retry, > limit to 5 times of > retry: > http://cr.openjdk.java.net/~amlu/8132548/webrev.01/ > > > > The retry serves no purpose here. groupStopped is > being set to true and > the waiting thread has been notified, so the loop > will terminate after > the first sleep. The failure happens when the main > thread checks the > isAlive() status of the second thread before the > ThreadGroup.stop has > actually had a chance to stop and terminate it - > such that isAlive is > now false. That is why I suggested waiting a bit > longer by extending the > sleep. > > I agree that making the test last at least 5 > seconds is not ideal, but I > didn't think it would be an issue in the big > picture of testing. > > Ideally explicit "synchronization" is better than > sleeps but that would > again be missing the point with this test. We > expect the thread to > terminate, if it hasn't terminated in a > "reasonable" time we consider > the stop() to have failed and the test to fail. To > that end we could > remove the sleep altogether and change: > > boolean failed = second.isAlive(); > > to > > try { > second.join(1000); > } catch (InterruptedException shouldNotHappen) {} > boolean failed = second.isAlive(); > > Now we use explicit event synchronization - great! > But the test has the > same failure issue now as it did with the sleep. > Putting in a > CountDownLatch would have exactly the same > problem: we expect the second > thread to signal the latch as it terminates, but > if that doesn't happen > within a "reasonable" amount of time, then we deem > the stop() to have > failed and the test to have failed. > > Also note that the more code we add the more > likely the second call to > second.stop() triggers an async exception in code > that can't handle it > and results in an even worse failure mode! > > The only thing I can suggest is to get rid of the > explicit sleep (or > join, or latch.await() etc) and simply recode as > an infinite loop and > rely on the test harness to tear things down when > the overall test > timeout kicks in. That way the test either passes > or is timed-out, there > is no explicit failure - but a busy loop is also > bad so you would want a > small sleep in there anyway: > > while (second.isAlive()) { > Thread.sleep(10); > } > // Test passed - if we never get here the test > times out and > // we implicitly fail. > > > Of course that was silly all you need is: > > second.join(); > // Test passed - if we never get here the test times > out and > // we implicitly fail. > > David > > > Thanks, > David > > Thanks, > Amy > > On 7/8/16 12:15 PM, joe darcy wrote: > > Hi Amy, > > I'm a bit uncomfortable with the fix as-is. > > Rather than hard-coding sleep values, if > sleep values are needed I > think it is a better practice to use ones > that are scaled with the > jtreg timeout factors, etc. used to run > the tests. Please instead use > something like the adjustTimeout method of > > $JDK_FOREST_ROOT/test/lib/share/classes/jdk/test/lib/Utils > > As a general comment, I'd prefer we don't > just up timeout values for > tests. That can cause the whole test suite > run to slow down, which is > undesirable especially if the condition in > question may actually be > satisfied in many cases much faster than > the timeout value. > > Thanks, > > -Joe > > > On 7/7/2016 7:01 PM, Amy Lu wrote: > > Please review this trivial fix for > test:java/lang/ThreadGroup/Stop.java > > Though this is a test for a deprecated > API, failed with very very low > frequency and hard to reproduce (I got > no luck to reproduce it), I?d > like to patch it as suggested: extend > the sleep in the main thread > from one second to five seconds. Also > added 'volatile' to the boolean > variable 'groupStopped'. > > bug: > https://bugs.openjdk.java.net/browse/JDK-8132548 > webrev: > http://cr.openjdk.java.net/~amlu/8132548/webrev.00/ > > > Thanks, > Amy > > > --- > old/test/java/lang/ThreadGroup/Stop.java > 2016-07-04 > 14:53:59.000000000 +0800 > +++ > new/test/java/lang/ThreadGroup/Stop.java > 2016-07-04 > 14:53:58.000000000 +0800 > @@ -1,5 +1,5 @@ > /* > - * Copyright (c) 1999, 2011, Oracle > and/or its affiliates. All > rights reserved. > + * Copyright (c) 1999, 2016, 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 > @@ -29,7 +29,7 @@ > */ > > public class Stop implements Runnable { > - private static boolean > groupStopped = false ; > + private static volatile boolean > groupStopped = false ; > private static final Object lock > = new Object(); > > private static final ThreadGroup > group = new ThreadGroup(""); > @@ -70,7 +70,7 @@ > while (!groupStopped) { > lock.wait(); > // Give the other > thread a chance to stop > - Thread.sleep(1000); > + Thread.sleep(5000); > } > } > > > > > > > > From mandy.chung at oracle.com Tue Jul 12 08:18:07 2016 From: mandy.chung at oracle.com (Mandy Chung) Date: Tue, 12 Jul 2016 16:18:07 +0800 Subject: --dry-run description enhancement In-Reply-To: References: Message-ID: <0216B41D-BF64-4713-9CA4-A7E4AFA93A33@oracle.com> > On Jul 12, 2016, at 2:00 PM, Paul Benedict wrote: > > Mandy, perhaps there is a JVM technicality here I'm unfamiliar with. My understanding of loading a class has always been that it's coupled with running its static initializers. Loading, linking, and initializing are separate parts specified in JVM spec section 5 [1]. A good reference is that 3-arg Class::forName takes an initialize parameter that specifies if the class initializer should be invoked after a class is loaded. > So my inference was that the class does not get loaded into memory because the latter no longer occurs with --dry-run. > To be clear, -?dry-run initiaizes the VM, loads the main class but the main method is not invoked. The main class?s is not invoked. Mandy [1] https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-5.html From ramanand.patil at oracle.com Tue Jul 12 09:27:42 2016 From: ramanand.patil at oracle.com (Ramanand Patil) Date: Tue, 12 Jul 2016 02:27:42 -0700 (PDT) Subject: RFR: 8159684: (tz) Support tzdata2016f Message-ID: <2c87fb50-c44c-42fc-8189-093c265814d0@default> Hi all, Please review the latest TZDATA integration (tzdata2016f) to JDK9. Bug: https://bugs.openjdk.java.net/browse/JDK-8159684 Webrev: http://cr.openjdk.java.net/~rpatil/8159684/webrev.00/ All the TimeZone related tests are passed after this integration. Regards, Ramanand. From david.holmes at oracle.com Tue Jul 12 10:03:05 2016 From: david.holmes at oracle.com (David Holmes) Date: Tue, 12 Jul 2016 20:03:05 +1000 Subject: JDK 9 RFR of JDK-8132548: java/lang/ThreadGroup/Stop.java fails with "RuntimeException: Failure" In-Reply-To: <57849812.7060205@oracle.com> References: <577F0978.4020902@oracle.com> <577F41D0.6070904@oracle.com> <5783556E.4090708@oracle.com> <9659dd71-7e11-2d6a-2e7e-479949cc57dd@oracle.com> <57848014.3080504@oracle.com> <0411e58e-40d8-6aba-7f39-f7248e16d300@oracle.com> <57849812.7060205@oracle.com> Message-ID: This looks fine to me. Thanks, David On 12/07/2016 5:11 PM, Amy Lu wrote: > Updated on the busy-loops, also removed the unnecessary statics, here > comes the updated webrev: > > http://cr.openjdk.java.net/~amlu/8132548/webrev.04/ > > Thanks, > Amy > > On 7/12/16 2:33 PM, David Holmes wrote: >> Hi Amy, >> >> On 12/07/2016 3:28 PM, Amy Lu wrote: >>> Please help to review the updated webrev, getting rid of ThreadDeath and >>> using join(): >>> >>> http://cr.openjdk.java.net/~amlu/8132548/webrev.03/ >> >> I still think a simple change to the original code suffices, but given >> you have gone this far ... >> >> Busy-loops are "bad" and unnecessary: >> >> 40 while (true) { // keep it alive >> 41 } >> >> This can be changed to a long blocking operation eg: >> >> while (true) { >> try { >> Thread.sleep(60000); >> } >> catch (InterruptedException shouldNotHappen) { >> } >> } >> >> Thanks, >> David >> >>> Thanks, >>> Amy >>> >>> On 7/11/16 6:55 PM, David Holmes wrote: >>>> >>>> >>>> On 11/07/2016 6:14 PM, Amy Lu wrote: >>>>> Thank you David, though the email crossed-by, I hope all the concerns >>>>> have been resolved in the updated webrev: >>>>> http://cr.openjdk.java.net/~amlu/8132548/webrev.02/ >>>> >>>> Sorry but no, the changes are neither necessary nor sufficient. With >>>> the new code the ThreadDeath can hit anytime after countDown(), so it >>>> can hit before you enter the try block. >>>> >>>>> I had rewrote the test with CountDownLatch and join(long millis). Also >>>>> unlike the old version, test thread 'first' and 'second' do different >>>>> things, and 'second' thread will keep alive for waiting to be >>>>> killed by >>>>> group.stop() from 'frist' thread in the same thread group. I think >>>>> this >>>>> could avoid the second call to second.stop() (group.stop()) issue. >>>> >>>> Simply using join() with no timeout and relying on the test framework >>>> to kill the test allows you to do away with the second stop(). >>>> >>>> David >>>> ----- >>>> >>>>> The time LONG_DELAY_MS used in join(long millis) is an adjusted >>>>> timeout: >>>>> >>>>> private static final long LONG_DELAY_MS = Utils.adjustTimeout(1000L); >>>>> ... >>>>> >>>>> second.join(LONG_DELAY_MS); >>>>> boolean failed = second.isAlive(); >>>>> >>>>> This gives second thread a more "reasonable" time to die, with taking >>>>> account of the test harness timeout. >>>>> This almost same as second.join()// test pass or timeout, but with >>>>> additional chance of killing all threads in a bad case. >>>>> >>>>> Thanks, >>>>> Amy >>>>> >>>>> On 7/11/16 3:25 PM, David Holmes wrote: >>>>>> Simplification ... >>>>>> >>>>>> On 11/07/2016 5:12 PM, David Holmes wrote: >>>>>>> Hi Amy, >>>>>>> >>>>>>> Thanks for tackling this. >>>>>>> >>>>>>> On 8/07/2016 4:01 PM, Amy Lu wrote: >>>>>>>> Thank you Joe for your review. >>>>>>>> >>>>>>>> The intent is to give it more chance "for the thread group stop >>>>>>>> to be >>>>>>>> issued", not to extend the whole test execution timeout. >>>>>>>> >>>>>>>> I updated the webrev to make this in a retry, limit to 5 times of >>>>>>>> retry: >>>>>>>> http://cr.openjdk.java.net/~amlu/8132548/webrev.01/ >>>>>>> >>>>>>> The retry serves no purpose here. groupStopped is being set to true >>>>>>> and >>>>>>> the waiting thread has been notified, so the loop will terminate >>>>>>> after >>>>>>> the first sleep. The failure happens when the main thread checks the >>>>>>> isAlive() status of the second thread before the ThreadGroup.stop >>>>>>> has >>>>>>> actually had a chance to stop and terminate it - such that >>>>>>> isAlive is >>>>>>> now false. That is why I suggested waiting a bit longer by >>>>>>> extending the >>>>>>> sleep. >>>>>>> >>>>>>> I agree that making the test last at least 5 seconds is not ideal, >>>>>>> but I >>>>>>> didn't think it would be an issue in the big picture of testing. >>>>>>> >>>>>>> Ideally explicit "synchronization" is better than sleeps but that >>>>>>> would >>>>>>> again be missing the point with this test. We expect the thread to >>>>>>> terminate, if it hasn't terminated in a "reasonable" time we >>>>>>> consider >>>>>>> the stop() to have failed and the test to fail. To that end we could >>>>>>> remove the sleep altogether and change: >>>>>>> >>>>>>> boolean failed = second.isAlive(); >>>>>>> >>>>>>> to >>>>>>> >>>>>>> try { >>>>>>> second.join(1000); >>>>>>> } catch (InterruptedException shouldNotHappen) {} >>>>>>> boolean failed = second.isAlive(); >>>>>>> >>>>>>> Now we use explicit event synchronization - great! But the test has >>>>>>> the >>>>>>> same failure issue now as it did with the sleep. Putting in a >>>>>>> CountDownLatch would have exactly the same problem: we expect the >>>>>>> second >>>>>>> thread to signal the latch as it terminates, but if that doesn't >>>>>>> happen >>>>>>> within a "reasonable" amount of time, then we deem the stop() to >>>>>>> have >>>>>>> failed and the test to have failed. >>>>>>> >>>>>>> Also note that the more code we add the more likely the second >>>>>>> call to >>>>>>> second.stop() triggers an async exception in code that can't >>>>>>> handle it >>>>>>> and results in an even worse failure mode! >>>>>>> >>>>>>> The only thing I can suggest is to get rid of the explicit sleep (or >>>>>>> join, or latch.await() etc) and simply recode as an infinite loop >>>>>>> and >>>>>>> rely on the test harness to tear things down when the overall test >>>>>>> timeout kicks in. That way the test either passes or is timed-out, >>>>>>> there >>>>>>> is no explicit failure - but a busy loop is also bad so you would >>>>>>> want a >>>>>>> small sleep in there anyway: >>>>>>> >>>>>>> while (second.isAlive()) { >>>>>>> Thread.sleep(10); >>>>>>> } >>>>>>> // Test passed - if we never get here the test times out and >>>>>>> // we implicitly fail. >>>>>> >>>>>> Of course that was silly all you need is: >>>>>> >>>>>> second.join(); >>>>>> // Test passed - if we never get here the test times out and >>>>>> // we implicitly fail. >>>>>> >>>>>> David >>>>>> >>>>>> >>>>>>> Thanks, >>>>>>> David >>>>>>> >>>>>>>> Thanks, >>>>>>>> Amy >>>>>>>> >>>>>>>> On 7/8/16 12:15 PM, joe darcy wrote: >>>>>>>>> Hi Amy, >>>>>>>>> >>>>>>>>> I'm a bit uncomfortable with the fix as-is. >>>>>>>>> >>>>>>>>> Rather than hard-coding sleep values, if sleep values are needed I >>>>>>>>> think it is a better practice to use ones that are scaled with the >>>>>>>>> jtreg timeout factors, etc. used to run the tests. Please instead >>>>>>>>> use >>>>>>>>> something like the adjustTimeout method of >>>>>>>>> >>>>>>>>> $JDK_FOREST_ROOT/test/lib/share/classes/jdk/test/lib/Utils >>>>>>>>> >>>>>>>>> As a general comment, I'd prefer we don't just up timeout >>>>>>>>> values for >>>>>>>>> tests. That can cause the whole test suite run to slow down, >>>>>>>>> which is >>>>>>>>> undesirable especially if the condition in question may >>>>>>>>> actually be >>>>>>>>> satisfied in many cases much faster than the timeout value. >>>>>>>>> >>>>>>>>> Thanks, >>>>>>>>> >>>>>>>>> -Joe >>>>>>>>> >>>>>>>>> >>>>>>>>> On 7/7/2016 7:01 PM, Amy Lu wrote: >>>>>>>>>> Please review this trivial fix for >>>>>>>>>> test:java/lang/ThreadGroup/Stop.java >>>>>>>>>> >>>>>>>>>> Though this is a test for a deprecated API, failed with very >>>>>>>>>> very low >>>>>>>>>> frequency and hard to reproduce (I got no luck to reproduce it), >>>>>>>>>> I?d >>>>>>>>>> like to patch it as suggested: extend the sleep in the main >>>>>>>>>> thread >>>>>>>>>> from one second to five seconds. Also added 'volatile' to the >>>>>>>>>> boolean >>>>>>>>>> variable 'groupStopped'. >>>>>>>>>> >>>>>>>>>> bug: https://bugs.openjdk.java.net/browse/JDK-8132548 >>>>>>>>>> webrev: http://cr.openjdk.java.net/~amlu/8132548/webrev.00/ >>>>>>>>>> >>>>>>>>>> Thanks, >>>>>>>>>> Amy >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> --- old/test/java/lang/ThreadGroup/Stop.java 2016-07-04 >>>>>>>>>> 14:53:59.000000000 +0800 >>>>>>>>>> +++ new/test/java/lang/ThreadGroup/Stop.java 2016-07-04 >>>>>>>>>> 14:53:58.000000000 +0800 >>>>>>>>>> @@ -1,5 +1,5 @@ >>>>>>>>>> /* >>>>>>>>>> - * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All >>>>>>>>>> rights reserved. >>>>>>>>>> + * Copyright (c) 1999, 2016, 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 >>>>>>>>>> @@ -29,7 +29,7 @@ >>>>>>>>>> */ >>>>>>>>>> >>>>>>>>>> public class Stop implements Runnable { >>>>>>>>>> - private static boolean groupStopped = false ; >>>>>>>>>> + private static volatile boolean groupStopped = false ; >>>>>>>>>> private static final Object lock = new Object(); >>>>>>>>>> >>>>>>>>>> private static final ThreadGroup group = new >>>>>>>>>> ThreadGroup(""); >>>>>>>>>> @@ -70,7 +70,7 @@ >>>>>>>>>> while (!groupStopped) { >>>>>>>>>> lock.wait(); >>>>>>>>>> // Give the other thread a chance to stop >>>>>>>>>> - Thread.sleep(1000); >>>>>>>>>> + Thread.sleep(5000); >>>>>>>>>> } >>>>>>>>>> } >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>> >>>>>>>> >>>>> >>> > From paul.sandoz at oracle.com Tue Jul 12 12:35:34 2016 From: paul.sandoz at oracle.com (Paul Sandoz) Date: Tue, 12 Jul 2016 14:35:34 +0200 Subject: RFR: JDK-8161067 - jlink: Enable plugins to use the module pool for class lookup In-Reply-To: References: Message-ID: <672ABB13-8DCE-4E40-9988-765A81AA84AE@oracle.com> > On 11 Jul 2016, at 18:58, Jim Laskey (Oracle) wrote: > >> How about the following helper method on ModulePool: >> >> Optional findModule(ModuleEntry me); >> >> then the intent in code might be a littler clearer on the context. > > After thinking about this at bit: If we did that and then later worked out a way to optimize across modules, we?d have to hunt down those cases. What if I were to rename the method to findEntryInContext(String path, ModuleEntry context)? > Although widening the context later on might have unintended effects on some plugins if they depend on that method. Hmm? perhaps the right thing to do, API-wise, at the moment is not do anything? Paul. From claes.redestad at oracle.com Tue Jul 12 12:50:18 2016 From: claes.redestad at oracle.com (Claes Redestad) Date: Tue, 12 Jul 2016 14:50:18 +0200 Subject: RFR(S): 8160564: TEST: Add a test to check the implementation of VersionProps.versionNumbers() In-Reply-To: References: Message-ID: <5784E78A.9050705@oracle.com> On 2016-07-11 18:18, Volker Simonis wrote: > Hi, > > here comes a new version of this change. I've tried to address most of > the concerns/suggestions: > > http://cr.openjdk.java.net/~simonis/webrevs/2016/8160564.v1/ > Looks good. As I'm currently obsessing about startup performance, I did wish we could rely on (and fix, as a separate issue) the validation done in build scripts, but there's no real harm in doing proper validation in runtime as long as we avoid using regex here. > > - Finally, I didn't understood the comment about 'List.of might be > preferred over Arrays.asList' so I didn't change that. Oh, I meant that new List.of(...) can be used as a shorthand for Arrays.asList(...) in the test. No real difference, just one less import and a bit cleaner code in my opinion, so please ignore it at this point. Thanks! /Claes > > OK to push now (before it gets really over-engineered :) > > Thank you and best regards, > Volker > > On Thu, Jul 7, 2016 at 9:54 PM, Mandy Chung wrote: >> Hi Volker, >> >> Thanks for adding a new test for it. >> >> Nit: can you wrap the long lines. >> >> As for the bad version, one possible change is to add assert Runtime.Version.parse(versionNumber) in parseVersionNumbers method and add -esa in @run tag. >> >> It?d be good to convert this to testng test where the dataprovider can show the input version and expected returned list. >> >> Mandy >> >>> On Jul 7, 2016, at 6:59 AM, Volker Simonis wrote: >>> >>> Hi, >>> >>> can I please have a review for the following change which makes >>> VersionProps.versionNumbers() testable and the corresponding >>> regression test: >>> >>> http://cr.openjdk.java.net/~simonis/webrevs/2016/8160564/ >>> https://bugs.openjdk.java.net/browse/JDK-8160564 >>> >>> During the review for "8160457: VersionProps.versionNumbers() is >>> broken" it was suggested to refactor VersionProps.versionNumbers() in >>> order to make it testable by a regression test. This change does >>> exactly that. It extracts the implementation of >>> VersionProps.versionNumbers() into a new method >>> parseVersionNumbers(String versionNumber) which can be tested from the >>> associated regression test. >>> >>> There are still two points to notice: >>> >>> - VersionProps.versionNumbers() deliberately doesn't check for badly >>> formatted version strings because it is assumed it will only get valid >>> input (see discussion for "JDK-8160000: Runtime.version() cause >>> startup regressions" at [2]). So we can currently only check that >>> VersionProps.versionNumbers() accepts all kind of valid version >>> strings. >>> >>> - I was a little bit surprised that I could reflectively access and >>> execute java.lang.VersionProps.parseVersionNumbers() where both the >>> class and the method are package private. Maybe this is related to >>> Jigsaw issue #ReflectiveAccessToNonExportedTypes [3]? As I'm not a >>> Jigsaw expert, I'd be graceful to anybody explaining me why this is >>> still so easily possible with Jigsaw? >>> >>> Thank you and best regards, >>> Volker >>> >>> >>> [1] http://mail.openjdk.java.net/pipermail/core-libs-dev/2016-June/042058.html >>> [2] https://bugs.openjdk.java.net/browse/JDK-8160000 >>> [3] http://openjdk.java.net/projects/jigsaw/spec/issues/#ReflectiveAccessToNonExportedTypes >> From paul.sandoz at oracle.com Tue Jul 12 13:43:07 2016 From: paul.sandoz at oracle.com (Paul Sandoz) Date: Tue, 12 Jul 2016 15:43:07 +0200 Subject: RFR 8151163 All Buffer implementations should leverage Unsafe unaligned accessors Re: ByteBuffer views, alignment, word tearing In-Reply-To: <5783CA94.7010000@redhat.com> References: <5783B65F.7040007@redhat.com> <5783CA94.7010000@redhat.com> Message-ID: <5DB0B7AA-2CFF-4481-9214-0FE633733E6B@oracle.com> Hi Andrew, Would you mind formally reviewing the patches? Including hotspot-dev as i have updated a hotspot test so should probably push to hs. I rebased to hs and fixed a silly bug in generated heap view buffers that were incorrectly calculating the unsafe byte offset: http://cr.openjdk.java.net/~psandoz/jdk9/JDK-8151163-buffer-unsafe-unaligned-access/webrev/ http://cr.openjdk.java.net/~psandoz/jdk9/JDK-8151163-buffer-unsafe-unaligned-access-hotspot/webrev/ JPRT runs for core and hotspot pass. > On 11 Jul 2016, at 18:34, Andrew Haley wrote: > > On 11/07/16 17:04, Paul Sandoz wrote: > >> I opted to directly use Unsafe rather than defer. I am not sure it?s >> always possible to defer to the underlying buffer since its >> positional and order state is mutable. > > Eww. The view has its own position, and the byte ordering is fixed > when the view is created. The wrapped byte buffer is in a protected > field, and the view is a package-private class so it can't be > subclassed by the user. So I would have thought that could be made to > work, but but never mind, I can see you've gone a long way down this > road already. Yes, and i laid some ground work in a previous fix to enable support for Unsafe double addressing mode on heap and direct buffers, with a grander plan to try and unify some of the implementations (careful performance analysis is required for direct buffers that access the base field whose value is null). > > The SPARC regression is very odd: I would have thought that if it's > broken here it would also be broken in HeapByteBuffer.getLong(). > I did not get a chance to look at the generated code, so there could be a number of factors involved. My feeling is the three alignment checks are causing more issues on SPARC (perhaps combined less efficient addressing calculations [*], with loop unrolling), which led to the suggestion of a modifying the unaligned Unsafe methods to take an extra arg that is the constant offset to check alignment, thus could be hoisted out of a loop making constant strides. Paul. [*] some work on x86 was recently done by Roland to improve this area From volker.simonis at gmail.com Tue Jul 12 13:54:34 2016 From: volker.simonis at gmail.com (Volker Simonis) Date: Tue, 12 Jul 2016 15:54:34 +0200 Subject: RFR(S): 8160564: TEST: Add a test to check the implementation of VersionProps.versionNumbers() In-Reply-To: <68CCBF25-963A-41E8-A537-44E340173AB2@oracle.com> References: <68CCBF25-963A-41E8-A537-44E340173AB2@oracle.com> Message-ID: On Tue, Jul 12, 2016 at 4:27 AM, Mandy Chung wrote: > >> On Jul 12, 2016, at 12:18 AM, Volker Simonis wrote: >> >> Hi, >> >> here comes a new version of this change. I've tried to address most of >> the concerns/suggestions: >> >> http://cr.openjdk.java.net/~simonis/webrevs/2016/8160564.v1/ >> > > This version looks okay in general. Please find the new webrev at: http://cr.openjdk.java.net/~simonis/webrevs/2016/8160564.v2/ >I suggest to combine the check and Integer.parseInt in a single method (e.g. ?numberAt? or some other better method name). > Done. > 71 if (index - prevIndex > 1 && > > may read better as "index > prevIndex? > That's actually not the same. I would have to write "index > prevIndex + 1" which I think isn't much better. > The new comment can simply say ?This method is used by regression tests? that should do it. I would not mention the test name in the source since refactoring may make it outdated. > Done. > In the new test, > > 92 if (error) { > 93 throw new Exception(invalidVersions[i] + > 94 " not recognized as invalid by VersionProps.parseVersionNumbers()"); > 95 } > > An alternative to the above check, it can throw an exception immediate after line 82 when parseVersionNumbers.invoke succeeds. > Yes, that's much clearer. Thanks. Any other comments? Regards, Volker From volker.simonis at gmail.com Tue Jul 12 13:56:30 2016 From: volker.simonis at gmail.com (Volker Simonis) Date: Tue, 12 Jul 2016 15:56:30 +0200 Subject: RFR(S): 8160564: TEST: Add a test to check the implementation of VersionProps.versionNumbers() In-Reply-To: <5784E78A.9050705@oracle.com> References: <5784E78A.9050705@oracle.com> Message-ID: On Tue, Jul 12, 2016 at 2:50 PM, Claes Redestad wrote: > > > On 2016-07-11 18:18, Volker Simonis wrote: >> >> Hi, >> >> here comes a new version of this change. I've tried to address most of >> the concerns/suggestions: >> >> http://cr.openjdk.java.net/~simonis/webrevs/2016/8160564.v1/ >> > > Looks good. As I'm currently obsessing about startup performance, I did > wish we could rely on (and fix, as a separate issue) the validation > done in build scripts, but there's no real harm in doing proper > validation in runtime as long as we avoid using regex here. > Yes, I think the new checks should be quite cheap. >> >> - Finally, I didn't understood the comment about 'List.of might be >> preferred over Arrays.asList' so I didn't change that. > > > Oh, I meant that new List.of(...) can be used as a shorthand for > Arrays.asList(...) in the test. No real difference, just one less > import and a bit cleaner code in my opinion, so please ignore it at > this point. > Ah, I wasn't aware of the new method. Thanks, Volker > Thanks! > > /Claes > > >> >> OK to push now (before it gets really over-engineered :) >> >> Thank you and best regards, >> Volker >> >> On Thu, Jul 7, 2016 at 9:54 PM, Mandy Chung >> wrote: >>> >>> Hi Volker, >>> >>> Thanks for adding a new test for it. >>> >>> Nit: can you wrap the long lines. >>> >>> As for the bad version, one possible change is to add assert >>> Runtime.Version.parse(versionNumber) in parseVersionNumbers method and add >>> -esa in @run tag. >>> >>> It?d be good to convert this to testng test where the dataprovider can >>> show the input version and expected returned list. >>> >>> Mandy >>> >>>> On Jul 7, 2016, at 6:59 AM, Volker Simonis >>>> wrote: >>>> >>>> Hi, >>>> >>>> can I please have a review for the following change which makes >>>> VersionProps.versionNumbers() testable and the corresponding >>>> regression test: >>>> >>>> http://cr.openjdk.java.net/~simonis/webrevs/2016/8160564/ >>>> https://bugs.openjdk.java.net/browse/JDK-8160564 >>>> >>>> During the review for "8160457: VersionProps.versionNumbers() is >>>> broken" it was suggested to refactor VersionProps.versionNumbers() in >>>> order to make it testable by a regression test. This change does >>>> exactly that. It extracts the implementation of >>>> VersionProps.versionNumbers() into a new method >>>> parseVersionNumbers(String versionNumber) which can be tested from the >>>> associated regression test. >>>> >>>> There are still two points to notice: >>>> >>>> - VersionProps.versionNumbers() deliberately doesn't check for badly >>>> formatted version strings because it is assumed it will only get valid >>>> input (see discussion for "JDK-8160000: Runtime.version() cause >>>> startup regressions" at [2]). So we can currently only check that >>>> VersionProps.versionNumbers() accepts all kind of valid version >>>> strings. >>>> >>>> - I was a little bit surprised that I could reflectively access and >>>> execute java.lang.VersionProps.parseVersionNumbers() where both the >>>> class and the method are package private. Maybe this is related to >>>> Jigsaw issue #ReflectiveAccessToNonExportedTypes [3]? As I'm not a >>>> Jigsaw expert, I'd be graceful to anybody explaining me why this is >>>> still so easily possible with Jigsaw? >>>> >>>> Thank you and best regards, >>>> Volker >>>> >>>> >>>> [1] >>>> http://mail.openjdk.java.net/pipermail/core-libs-dev/2016-June/042058.html >>>> [2] https://bugs.openjdk.java.net/browse/JDK-8160000 >>>> [3] >>>> http://openjdk.java.net/projects/jigsaw/spec/issues/#ReflectiveAccessToNonExportedTypes >>> >>> > From claes.redestad at oracle.com Tue Jul 12 14:11:08 2016 From: claes.redestad at oracle.com (Claes Redestad) Date: Tue, 12 Jul 2016 16:11:08 +0200 Subject: RFR(S): 8160564: TEST: Add a test to check the implementation of VersionProps.versionNumbers() In-Reply-To: References: <68CCBF25-963A-41E8-A537-44E340173AB2@oracle.com> Message-ID: <5784FA7C.4040208@oracle.com> On 07/12/2016 03:54 PM, Volker Simonis wrote: > Please find the new webrev at: > > http://cr.openjdk.java.net/~simonis/webrevs/2016/8160564.v2/ +1 > Any other comments? Only to note that this adds a validation check that we don't have trailing zeros, which I was recently made aware of is being reconsidered, see https://bugs.openjdk.java.net/browse/JDK-8156907 - if so that implementation will likely have to revert parts of this validation. Thanks! /Claes > > Regards, > Volker From martinrb at google.com Tue Jul 12 17:03:57 2016 From: martinrb at google.com (Martin Buchholz) Date: Tue, 12 Jul 2016 10:03:57 -0700 Subject: JDK 9 RFR of JDK-8132548: java/lang/ThreadGroup/Stop.java fails with "RuntimeException: Failure" In-Reply-To: <05dc50cb-e4f5-9778-2777-2d1f797eff30@oracle.com> References: <577F0978.4020902@oracle.com> <577F41D0.6070904@oracle.com> <5783556E.4090708@oracle.com> <9659dd71-7e11-2d6a-2e7e-479949cc57dd@oracle.com> <57848014.3080504@oracle.com> <05dc50cb-e4f5-9778-2777-2d1f797eff30@oracle.com> Message-ID: This message is only the reviewers having friendly discussion with each other! On Mon, Jul 11, 2016 at 11:44 PM, David Holmes wrote: > private static final AtomicReference firstThrowable >> = new AtomicReference<>(); >> private static final AtomicReference secondThrowable >> = new AtomicReference<>(); >> > > Simple volatile Throwable fields would suffice - AtomicReferences are > overkill. > > But in my later attempt they became locals, which is better style when possible. > private static final Thread second = new Thread(group, () -> { >> ready.countDown(); >> try { >> > > You have to place the countDown() inside the try block else the > ThreadDeath may escape. > > Oh good point - there's a race window! (everybody writes racy code) > do {} while (true); >> > > Busy-loops are "bad". > Occasionally necessary, but yes, should be used only as last resort. But here it's not clear which is more wasteful of cpu time... > I agree this meets the "spec" of checking "did group.stop() cause all > group members to encounter a ThreadDeath exception". But in relation to > fixing the original timing problem, well a simple untimed-join() fixed that. > > I like to throw in extra assertions when I've gone to the trouble of setting up a test scenario. From aleksej.efimov at oracle.com Tue Jul 12 18:04:54 2016 From: aleksej.efimov at oracle.com (Aleks Efimov) Date: Tue, 12 Jul 2016 21:04:54 +0300 Subject: RFR (JAXP): 8148350: Element.setAttributeNS() empty namespace does not throw exception Message-ID: <57853146.70605@oracle.com> Hi, Please, help to review the fix for org.w3c.dom.Element#setAttributeNS method in JDK9: According to w3.org documentation empty string cannot be used as a namespace name [1]. Therefore the setAttributeNS [2] should raise DOMException (NAMESPACE_ERR) when namespaceURI is empty string (similar to null value). Webrev with proposed fix (regtest is included): http://cr.openjdk.java.net/~aefimov/8148350/9/00/ Best Regards, Aleksej [1] https://www.w3.org/TR/xml-names/#iri-use [2] https://docs.oracle.com/javase/8/docs/api/org/w3c/dom/Element.html#setAttributeNS-java.lang.String-java.lang.String-java.lang.String- From iris.clark at oracle.com Tue Jul 12 19:01:54 2016 From: iris.clark at oracle.com (Iris Clark) Date: Tue, 12 Jul 2016 12:01:54 -0700 (PDT) Subject: RFR(S): 8160564: TEST: Add a test to check the implementation of VersionProps.versionNumbers() In-Reply-To: <5784FA7C.4040208@oracle.com> References: <68CCBF25-963A-41E8-A537-44E340173AB2@oracle.com> <5784FA7C.4040208@oracle.com> Message-ID: <48da8e45-6b8d-46a9-9d82-d58c4c810816@default> Hi. >> Please find the new webrev at: >> >> http://cr.openjdk.java.net/~simonis/webrevs/2016/8160564.v2/ > > +1 > >> Any other comments? > Only to note that this adds a validation check that we don't have > trailing zeros, which I was recently made aware of is being > reconsidered, see https://bugs.openjdk.java.net/browse/JDK-8156907 > - if so that implementation will likely have to revert parts of > this validation. I've added a comment to this effect in 8156907. That changeset will need to include updates this code and associated regression test. Regards, iris From patrick at reini.net Tue Jul 12 19:25:05 2016 From: patrick at reini.net (Patrick Reinhart) Date: Tue, 12 Jul 2016 21:25:05 +0200 Subject: Create java.util.stream.Stream from Iterator / Enumeration In-Reply-To: <5ddfd52d9b9b5ac20e52f3ebd85f70b5@reini.net> References: <96449a94df44b8a26d9c1abb800baef5@reini.net> <2239A562-0696-47D3-B63C-CD6ECB06EAF5@oracle.com> <7519b84f-6259-701e-4c36-3bd4e4118bff@reini.net> <5ddfd52d9b9b5ac20e52f3ebd85f70b5@reini.net> Message-ID: <57854411.3030602@reini.net> Hi Paul, I finally got the time to create the enhancement issue JDK-8161230 for the alternative methods returning a Stream instead of an Enumeration. Cheers Patrick > I had marked ClassLoader as an area to use Stream (we went through a >> bunch of areas that return Enumeration and add Stream-based methods >> e.g. NetworkInterface) but we held off because Jigsaw was doing a lot >> of plumbing work. > > I did already some hacking on the Jigsaw stuff and I liked it quit a lot. > The biggest problem I see is the time it takes to have all required > libraries being converted to Jigsaw too. All in all you all did a great > job there and I hope this will be appreciated in the end... > >> It might be possible to revisit, it?s the type of enhancement we could >> get a Feature Complete (FC) extension for. I cannot promise anything >> here, but if you are looking for something to contribute that may be a >> good area of focus on now Jigsaw is settling down. > > From huizhe.wang at oracle.com Tue Jul 12 20:03:34 2016 From: huizhe.wang at oracle.com (huizhe wang) Date: Tue, 12 Jul 2016 13:03:34 -0700 Subject: RFR (JAXP): 8148350: Element.setAttributeNS() empty namespace does not throw exception In-Reply-To: <57853146.70605@oracle.com> References: <57853146.70605@oracle.com> Message-ID: <57854D16.9070605@oracle.com> Hi Aleksej, The change looks good. Ideally though, it would be good to update the relevant Javadoc to reflect the change since this part of Javadoc is quite explicit about when NAMESPACE_ERR is thrown. Also, this is a good opportunity to update the Lic header. Thanks, Joe On 7/12/2016 11:04 AM, Aleks Efimov wrote: > Hi, > Please, help to review the fix for org.w3c.dom.Element#setAttributeNS > method in JDK9: > According to w3.org documentation empty string cannot be used as a > namespace name [1]. Therefore the setAttributeNS [2] should raise > DOMException (NAMESPACE_ERR) when namespaceURI is empty string > (similar to null value). > Webrev with proposed fix (regtest is included): > http://cr.openjdk.java.net/~aefimov/8148350/9/00/ > > Best Regards, > Aleksej > > [1] https://www.w3.org/TR/xml-names/#iri-use > [2] > https://docs.oracle.com/javase/8/docs/api/org/w3c/dom/Element.html#setAttributeNS-java.lang.String-java.lang.String-java.lang.String- > From lance.andersen at oracle.com Tue Jul 12 20:35:25 2016 From: lance.andersen at oracle.com (Lance Andersen) Date: Tue, 12 Jul 2016 16:35:25 -0400 Subject: RFR (JAXP): 8148350: Element.setAttributeNS() empty namespace does not throw exception In-Reply-To: <57854D16.9070605@oracle.com> References: <57853146.70605@oracle.com> <57854D16.9070605@oracle.com> Message-ID: <1BB33F91-BA66-4487-9647-48A4E45B7FDF@oracle.com> Looks OK also. Joe given this is a change in functionality, it might need a CCC fast tracked before it is pushed? > On Jul 12, 2016, at 4:03 PM, huizhe wang wrote: > > Hi Aleksej, > > The change looks good. Ideally though, it would be good to update the relevant Javadoc to reflect the change since this part of Javadoc is quite explicit about when NAMESPACE_ERR is thrown. > > Also, this is a good opportunity to update the Lic header. > > Thanks, > Joe > > On 7/12/2016 11:04 AM, Aleks Efimov wrote: >> Hi, >> Please, help to review the fix for org.w3c.dom.Element#setAttributeNS method in JDK9: >> According to w3.org documentation empty string cannot be used as a namespace name [1]. Therefore the setAttributeNS [2] should raise DOMException (NAMESPACE_ERR) when namespaceURI is empty string (similar to null value). >> Webrev with proposed fix (regtest is included): >> http://cr.openjdk.java.net/~aefimov/8148350/9/00/ >> >> Best Regards, >> Aleksej >> >> [1] https://www.w3.org/TR/xml-names/#iri-use >> [2] https://docs.oracle.com/javase/8/docs/api/org/w3c/dom/Element.html#setAttributeNS-java.lang.String-java.lang.String-java.lang.String- >> > 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 Jul 12 20:53:54 2016 From: huizhe.wang at oracle.com (huizhe wang) Date: Tue, 12 Jul 2016 13:53:54 -0700 Subject: RFR (JAXP): 8148350: Element.setAttributeNS() empty namespace does not throw exception In-Reply-To: <1BB33F91-BA66-4487-9647-48A4E45B7FDF@oracle.com> References: <57853146.70605@oracle.com> <57854D16.9070605@oracle.com> <1BB33F91-BA66-4487-9647-48A4E45B7FDF@oracle.com> Message-ID: <578558E2.2060201@oracle.com> On 7/12/2016 1:35 PM, Lance Andersen wrote: > Looks OK also. Joe given this is a change in functionality, it might > need a CCC fast tracked before it is pushed? Agree. A quick CCC to clarify the spec would be good. -Joe > > >> On Jul 12, 2016, at 4:03 PM, huizhe wang > > wrote: >> >> Hi Aleksej, >> >> The change looks good. Ideally though, it would be good to update the >> relevant Javadoc to reflect the change since this part of Javadoc is >> quite explicit about when NAMESPACE_ERR is thrown. >> >> Also, this is a good opportunity to update the Lic header. >> >> Thanks, >> Joe >> >> On 7/12/2016 11:04 AM, Aleks Efimov wrote: >>> Hi, >>> Please, help to review the fix for >>> org.w3c.dom.Element#setAttributeNS method in JDK9: >>> According to w3.org documentation empty string >>> cannot be used as a namespace name [1]. Therefore the setAttributeNS >>> [2] should raise DOMException (NAMESPACE_ERR) when namespaceURI is >>> empty string (similar to null value). >>> Webrev with proposed fix (regtest is included): >>> http://cr.openjdk.java.net/~aefimov/8148350/9/00/ >>> >>> >>> Best Regards, >>> Aleksej >>> >>> [1] https://www.w3.org/TR/xml-names/#iri-use >>> [2] >>> https://docs.oracle.com/javase/8/docs/api/org/w3c/dom/Element.html#setAttributeNS-java.lang.String-java.lang.String-java.lang.String- >>> >> > > > > 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 rob.mckenna at oracle.com Tue Jul 12 21:13:25 2016 From: rob.mckenna at oracle.com (Rob McKenna) Date: Tue, 12 Jul 2016 22:13:25 +0100 Subject: RFR - 8141148: LDAP "follow" throws ClassCastException with Java 8 Message-ID: <20160712211325.GA5609@vimes> Hi folks, Looking for a review for this change: https://bugs.openjdk.java.net/browse/JDK-8141148 http://cr.openjdk.java.net/~robm/8141148/webrev.01/ A fairly straightforward fix for a class cast problem. From the bug: As a result of https://bugs.openjdk.java.net/browse/JDK-7072353: http://hg.openjdk.java.net/jdk8u/jdk8u-dev/jdk/rev/18329abcdb7c The test attached to the bug fails with the following trace: Exception in thread "main" java.lang.ClassCastException: com.sun.jndi.ldap.LdapSearchEnumeration cannot be cast to com.sun.jndi.ldap.LdapNamingEnumeration at com.sun.jndi.ldap.LdapNamingEnumeration.getReferredResults(LdapNamingEnumeration.java:78) at com.sun.jndi.ldap.LdapNamingEnumeration.getReferredResults(LdapNamingEnumeration.java:36) at com.sun.jndi.ldap.AbstractLdapNamingEnumeration.hasMoreReferrals(AbstractLdapNamingEnumeration.java:330) at com.sun.jndi.ldap.AbstractLdapNamingEnumeration.hasMoreImpl(AbstractLdapNamingEnumeration.java:227) at com.sun.jndi.ldap.AbstractLdapNamingEnumeration.hasMore(AbstractLdapNamingEnumeration.java:189) at com.sun.jndi.ldap.AbstractLdapNamingEnumeration.hasMoreElements(AbstractLdapNamingEnumeration.java:117) at TestLdap.query(TestLdap.java:43) at TestLdap.main(TestLdap.java:19) Post refactor we have a NamingEnumeration interface which is implemented by an abstract class AbstractLdapNamingEnumeration. 3 implementations, LdapBindingEnumeration, LdapNamingEnumeration & LdapSearchEnumeration extend AbstractLdapNamingEnumeration. Each implementation has its own getReferredResults method which returns an object of the individual implementations type. Unfortunately this falls down (as can be seen in the stack) because an LdapNamingEnumeration.getReferredResults can call refCtx.search, which returns an LdapSearchEnumeration. This leads to a situation where LdapNamingEnumeration needs to cast an LdapSearchEnumeration which results in the exception above. -Rob From xueming.shen at oracle.com Tue Jul 12 22:06:00 2016 From: xueming.shen at oracle.com (Xueming Shen) Date: Tue, 12 Jul 2016 15:06:00 -0700 Subject: RFR JDK-7031075: GZIPInputStream's available() reports 1, but read() gives -1. In-Reply-To: <57842376.2000809@oracle.com> References: <57842376.2000809@oracle.com> Message-ID: <578569C8.7010206@oracle.com> ping. simple fix. On 7/11/16, 3:53 PM, Xueming Shen wrote: > Hi, > > Please help review the change for JDK-7031075. > > issue: https://bugs.openjdk.java.net/browse/JDK-7031075 > webrev: http://cr.openjdk.java.net/~sherman/7031075/webrev > > This is a corner case in current implementation, in which the "readEOF" > flag is only set when/after the read/skip method is invoked and the "eof" > is "explicitly" reached. Which means even the inflater has reached the > "end of the compressed stream" (inf.finished() == true) during the last > read/skip invocation (since there are still data available, so the > date gets > read/returned successfully), the readEOF is not set, and therefor the > available() return > 0 if checked. > > The proposed change here is to do an extra check of the inf.finished(), > if it returns true, means there is no more data inside the inflater the > end of compressed stream has been reached, available() returns true > in this case. > > Thanks, > Sherman > > From pavel.rappo at oracle.com Tue Jul 12 22:38:37 2016 From: pavel.rappo at oracle.com (Pavel Rappo) Date: Tue, 12 Jul 2016 23:38:37 +0100 Subject: RFR JDK-7031075: GZIPInputStream's available() reports 1, but read() gives -1. In-Reply-To: <578569C8.7010206@oracle.com> References: <57842376.2000809@oracle.com> <578569C8.7010206@oracle.com> Message-ID: <7F419B46-7306-4D07-8969-177E0EA11C8C@oracle.com> Hi Sherman, A quick question. Is "inf.finished()" the only condition that needs to be checked in order to determine reachEOF? In read(), for instance, they use union: if (inf.finished() || inf.needsDictionary()) reachEOF = true; Otherwise it seems to me it could be the case that read() returns -1 while available() returns 0. Or I am missing something obvious. Thanks. > On 12 Jul 2016, at 23:06, Xueming Shen wrote: > > ping. simple fix. > > On 7/11/16, 3:53 PM, Xueming Shen wrote: >> Hi, >> >> Please help review the change for JDK-7031075. >> >> issue: https://bugs.openjdk.java.net/browse/JDK-7031075 >> webrev: http://cr.openjdk.java.net/~sherman/7031075/webrev >> >> This is a corner case in current implementation, in which the "readEOF" >> flag is only set when/after the read/skip method is invoked and the "eof" >> is "explicitly" reached. Which means even the inflater has reached the >> "end of the compressed stream" (inf.finished() == true) during the last >> read/skip invocation (since there are still data available, so the date gets >> read/returned successfully), the readEOF is not set, and therefor the >> available() return > 0 if checked. >> >> The proposed change here is to do an extra check of the inf.finished(), >> if it returns true, means there is no more data inside the inflater the >> end of compressed stream has been reached, available() returns true >> in this case. >> >> Thanks, >> Sherman >> >> > From pavel.rappo at oracle.com Tue Jul 12 22:40:23 2016 From: pavel.rappo at oracle.com (Pavel Rappo) Date: Tue, 12 Jul 2016 23:40:23 +0100 Subject: RFR JDK-7031075: GZIPInputStream's available() reports 1, but read() gives -1. In-Reply-To: <7F419B46-7306-4D07-8969-177E0EA11C8C@oracle.com> References: <57842376.2000809@oracle.com> <578569C8.7010206@oracle.com> <7F419B46-7306-4D07-8969-177E0EA11C8C@oracle.com> Message-ID: > On 12 Jul 2016, at 23:38, Pavel Rappo wrote: > > Hi Sherman, > > A quick question. Is "inf.finished()" the only condition that needs to be > checked in order to determine reachEOF? In read(), for instance, they use union: > > if (inf.finished() || inf.needsDictionary()) > reachEOF = true; > > Otherwise it seems to me it could be the case that read() returns -1 while > available() returns 0. Sorry, available() returns 1. > Or I am missing something obvious. From xueming.shen at oracle.com Tue Jul 12 23:12:22 2016 From: xueming.shen at oracle.com (Xueming Shen) Date: Tue, 12 Jul 2016 16:12:22 -0700 Subject: RFR JDK-7031075: GZIPInputStream's available() reports 1, but read() gives -1. In-Reply-To: References: <57842376.2000809@oracle.com> <578569C8.7010206@oracle.com> <7F419B46-7306-4D07-8969-177E0EA11C8C@oracle.com> Message-ID: <57857956.9070402@oracle.com> On 7/12/16, 3:40 PM, Pavel Rappo wrote: >> On 12 Jul 2016, at 23:38, Pavel Rappo wrote: >> >> Hi Sherman, >> >> A quick question. Is "inf.finished()" the only condition that needs to be >> checked in order to determine reachEOF? In read(), for instance, they use union: >> >> if (inf.finished() || inf.needsDictionary()) >> reachEOF = true; >> >> Otherwise it seems to me it could be the case that read() returns -1 while >> available() returns 0. > Sorry, available() returns 1. > >> Or I am missing something obvious. Hi Pavel, thanks for looking into it. inf.finished() == true is the situation that the inflater really hits the end of the compressed stream. inf.needsDictionary() actually means you can't read more bytes from the inflater if you don't update/feed a directory, not a real "the eof has been reached". Yes, the InflaterInputStream.read() will still return -1 and available() will returns 1, if it's the situation that inf.needsDictionary() is true. My original thought (as I commented in the bug report) was to include both in the changeset, but then I'm concerned that these might be actually two different things. The spec says "returns 0 after EOF has been reached ...", but arguably inf.needsDictionary() is not a real EOF, class that extends IIS, or the anyone that holds a reference to the inflater CAN explicitly check inflater and in theory can continue the read the stream. I'm not sure if anyone is really doing that though. So I decided to limit the change to the real issue (reach the end of stream, as showed in the test case) in this changeset. I am not sure the best solution for the inf.needsDictionary() case for now, maybe leave it for now until there is a real use case. Sherman From mandy.chung at oracle.com Wed Jul 13 01:25:02 2016 From: mandy.chung at oracle.com (Mandy Chung) Date: Wed, 13 Jul 2016 09:25:02 +0800 Subject: Review request: JDK-8160398 (jdeps) Replace a list of JDK 8 internal API for detecting if it's removed in JDK 9 or later Message-ID: <396F49EB-119D-4B69-A01C-F0EA1DDADE03@oracle.com> This patch includes a generated list of JDK 8 internal packages (a trimmed down list) such that jdeps can determine if any JDK internal API is referenced but removed in JDK 9 or later release. http://cr.openjdk.java.net/~mchung/jdk9/webrevs/8160398/webrev.00/ Mandy From masayoshi.okutsu at oracle.com Wed Jul 13 06:43:34 2016 From: masayoshi.okutsu at oracle.com (Masayoshi Okutsu) Date: Wed, 13 Jul 2016 15:43:34 +0900 Subject: RFR: 8159684: (tz) Support tzdata2016f In-Reply-To: <2c87fb50-c44c-42fc-8189-093c265814d0@default> References: <2c87fb50-c44c-42fc-8189-093c265814d0@default> Message-ID: I don't think it's appropriate to add 8159684 to TimeZoneTest.java which doesn't test the data changes of 2016e/f at all. I think there should be a time zone data test in java.time to confirm the tzdata changes. Otherwise, the changes look good to me. Thanks, Masayoshi On 7/12/2016 6:27 PM, Ramanand Patil wrote: > Hi all, > > Please review the latest TZDATA integration (tzdata2016f) to JDK9. > Bug: https://bugs.openjdk.java.net/browse/JDK-8159684 > Webrev: http://cr.openjdk.java.net/~rpatil/8159684/webrev.00/ > > All the TimeZone related tests are passed after this integration. > > Regards, > Ramanand. From paul.sandoz at oracle.com Wed Jul 13 08:28:50 2016 From: paul.sandoz at oracle.com (Paul Sandoz) Date: Wed, 13 Jul 2016 10:28:50 +0200 Subject: Create java.util.stream.Stream from Iterator / Enumeration In-Reply-To: <57854411.3030602@reini.net> References: <96449a94df44b8a26d9c1abb800baef5@reini.net> <2239A562-0696-47D3-B63C-CD6ECB06EAF5@oracle.com> <7519b84f-6259-701e-4c36-3bd4e4118bff@reini.net> <5ddfd52d9b9b5ac20e52f3ebd85f70b5@reini.net> <57854411.3030602@reini.net> Message-ID: <9A267516-581F-4D2F-BB20-DDECA64BE722@oracle.com> Hi Patrick, > On 12 Jul 2016, at 21:25, Patrick Reinhart wrote: > > Hi Paul, > > I finally got the time to create the enhancement issue JDK-8161230 for > the alternative methods returning a Stream instead of an Enumeration. > Ok. I see some comments already by Stuart and Alan, and concur with Alan about working closely with jigsaw-dev. Focusing on the public methods is good and then it will come down to naming them appropriately. Given that sub-classes can override the existing public Enumeration returning methods we most likely need to specify the implementation behaviour of the Stream returning methods i.e. specify in an @implSpec that they call the Enumeration returning methods. Later on it may be possible to sub-types to implement more optimally (but the Enumeration ?string? is quite long and intertwined with the internal code base) The protected findResources method may be trickier, i suggest leaving that one alone for now. Paul. From daniel.fuchs at oracle.com Wed Jul 13 08:55:08 2016 From: daniel.fuchs at oracle.com (Daniel Fuchs) Date: Wed, 13 Jul 2016 09:55:08 +0100 Subject: Review request: JDK-8160398 (jdeps) Replace a list of JDK 8 internal API for detecting if it's removed in JDK 9 or later In-Reply-To: <396F49EB-119D-4B69-A01C-F0EA1DDADE03@oracle.com> References: <396F49EB-119D-4B69-A01C-F0EA1DDADE03@oracle.com> Message-ID: Hi Mandy, I have not finished reviewing yet - but as early feedback I believe that the following probably has a mistake: jdk.jdeps/share/classes/com/sun/tools/jdeps/Analyzer.java 392 393 if (!jdk8Internals.contains(pn)) { 394 return false; 395 } 396 397 return jdk8Internals.contains(pn); I suspect that one of the 'pn' should be 'cn' ? best regards, -- daniel On 13/07/16 02:25, Mandy Chung wrote: > This patch includes a generated list of JDK 8 internal packages (a trimmed down list) such that jdeps can determine if any JDK internal API is referenced but removed in JDK 9 or later release. > > http://cr.openjdk.java.net/~mchung/jdk9/webrevs/8160398/webrev.00/ > > Mandy > From pavel.rappo at oracle.com Wed Jul 13 09:55:54 2016 From: pavel.rappo at oracle.com (Pavel Rappo) Date: Wed, 13 Jul 2016 10:55:54 +0100 Subject: RFR JDK-7031075: GZIPInputStream's available() reports 1, but read() gives -1. In-Reply-To: <57857956.9070402@oracle.com> References: <57842376.2000809@oracle.com> <578569C8.7010206@oracle.com> <7F419B46-7306-4D07-8969-177E0EA11C8C@oracle.com> <57857956.9070402@oracle.com> Message-ID: <36C226AF-9A43-43CC-A073-BB9AE5A58DFF@oracle.com> > On 13 Jul 2016, at 00:12, Xueming Shen wrote: > > (as I commented in the bug report) Sorry, I didn't see this. I should've been more careful. On other topics. 1. Original bug refers to GZIPInputStream's behaviour, not InflaterInputStream's. That said, I think it's fair to ask the test to exercise GZIPInputStream. However, it's not mentioned in the test at all. And when I looked into java.util.zip.GZIPInputStream#read I found it has its own (and quite complex) logic and its own eos flag. I wonder if available() should be overridden there as well? 2. Nitpicking * @summary Make sure that the available() methods behave as expected. Shouldn't it be like this? * @summary Make sure that available() method behaves as expected. 3. We can always return 0 from available(), which is akin to returning the same number from Object.hashCode(). Not a particularly good implementation, but at least a safe one. Thanks. From pavel.rappo at oracle.com Wed Jul 13 10:36:48 2016 From: pavel.rappo at oracle.com (Pavel Rappo) Date: Wed, 13 Jul 2016 11:36:48 +0100 Subject: RFR - 8141148: LDAP "follow" throws ClassCastException with Java 8 In-Reply-To: <20160712211325.GA5609@vimes> References: <20160712211325.GA5609@vimes> Message-ID: <01F7D3CE-F63C-4734-AB42-8A72400DE58D@oracle.com> It looks like it was a defect in the original generification done in 7072353. Looks okay to me. Thanks. > On 12 Jul 2016, at 22:13, Rob McKenna wrote: > > Hi folks, > > Looking for a review for this change: > > https://bugs.openjdk.java.net/browse/JDK-8141148 > http://cr.openjdk.java.net/~robm/8141148/webrev.01/ > > A fairly straightforward fix for a class cast problem. From the bug: > > As a result of https://bugs.openjdk.java.net/browse/JDK-7072353: > > http://hg.openjdk.java.net/jdk8u/jdk8u-dev/jdk/rev/18329abcdb7c > > The test attached to the bug fails with the following trace: > > Exception in thread "main" java.lang.ClassCastException: com.sun.jndi.ldap.LdapSearchEnumeration cannot be cast to com.sun.jndi.ldap.LdapNamingEnumeration > at com.sun.jndi.ldap.LdapNamingEnumeration.getReferredResults(LdapNamingEnumeration.java:78) > at com.sun.jndi.ldap.LdapNamingEnumeration.getReferredResults(LdapNamingEnumeration.java:36) > at com.sun.jndi.ldap.AbstractLdapNamingEnumeration.hasMoreReferrals(AbstractLdapNamingEnumeration.java:330) > at com.sun.jndi.ldap.AbstractLdapNamingEnumeration.hasMoreImpl(AbstractLdapNamingEnumeration.java:227) > at com.sun.jndi.ldap.AbstractLdapNamingEnumeration.hasMore(AbstractLdapNamingEnumeration.java:189) > at com.sun.jndi.ldap.AbstractLdapNamingEnumeration.hasMoreElements(AbstractLdapNamingEnumeration.java:117) > at TestLdap.query(TestLdap.java:43) > at TestLdap.main(TestLdap.java:19) > > Post refactor we have a NamingEnumeration interface which is implemented by an abstract class AbstractLdapNamingEnumeration. > > 3 implementations, LdapBindingEnumeration, LdapNamingEnumeration & LdapSearchEnumeration extend AbstractLdapNamingEnumeration. > > Each implementation has its own getReferredResults method which returns an object of the individual implementations type. > > Unfortunately this falls down (as can be seen in the stack) because an LdapNamingEnumeration.getReferredResults can call refCtx.search, which returns an LdapSearchEnumeration. This leads to a situation where LdapNamingEnumeration needs to cast an LdapSearchEnumeration which results in the exception above. > > -Rob From paul.sandoz at oracle.com Wed Jul 13 10:46:09 2016 From: paul.sandoz at oracle.com (Paul Sandoz) Date: Wed, 13 Jul 2016 12:46:09 +0200 Subject: RFR: 8158295 Add a multi-release jar validation mechanism to jar tool In-Reply-To: References: Message-ID: <35D52343-AC93-4CC6-8507-869D9750AA8A@oracle.com> > On 7 Jul 2016, at 22:32, Steve Drach wrote: > > Hi, > > Please review the following: > > webrev: http://cr.openjdk.java.net/~sdrach/8158295/webrev.01/ > issue: https://bugs.openjdk.java.net/browse/JDK-8158295 > > This changeset adds a multi-release jar validator to jar tool. After the jar tool builds a multi-release jar, the potential resultant jar file is passed to the validator to assure that the jar file meets the minimal standards of a multi-release jar, in particular that versioned classes have the same api as base classes they override. There are other checks, for example warning if two classes are identical. If the jar file is invalid, it is not kept, so ?create will not produce a jar file and ?update will keep the input jar file. > jar/Main.java 284 // This code would be repeated in the create and update sections. 285 // In order not to do that, it's here as a consumer. 286 Consumer validateAndClose = tmpfile -> { Why does it need to be Consumer rather than just a method? Then i think you don?t need to rethow, but you can still keep the try block and use finally for File.deleteIfExist since it will not complain for the case where you move. 558 int i1 = s1.indexOf('/', n); 559 int i2 = s1.indexOf('/', n); 560 if (i1 == -1) throw new NumberFormatException(s1); 561 if (i2 == -2) throw new NumberFormatException(s2); I think you are trying to reject entries directly under the versioned area so it?s not about numbers (same in the validator, so there is some redundancy?). 588 AtomicBoolean validHolder = new AtomicBoolean(); 589 validHolder.set(valid); Pass valid to the constructor Validator/FingerPrint.java It would be useful to have some comments on what is checked in terms of API compatibility. e.g. describe what FingerPrint collects and how Validator uses it. FingerPrint.java 205 private final Map fields = new HashMap<>(); 206 private final Map methods = new HashMap<>(); Not sure you need to use a Map, why not use a Set? Change Method to be literally a representation of a single method rather than a consolidation that is lossy for the set of exceptions. Paul. From mandy.chung at oracle.com Wed Jul 13 10:48:05 2016 From: mandy.chung at oracle.com (Mandy Chung) Date: Wed, 13 Jul 2016 18:48:05 +0800 Subject: Review request: JDK-8160398 (jdeps) Replace a list of JDK 8 internal API for detecting if it's removed in JDK 9 or later In-Reply-To: References: <396F49EB-119D-4B69-A01C-F0EA1DDADE03@oracle.com> Message-ID: > On Jul 13, 2016, at 4:55 PM, Daniel Fuchs wrote: > > Hi Mandy, > > I have not finished reviewing yet - but as early feedback I believe > that the following probably has a mistake: > > jdk.jdeps/share/classes/com/sun/tools/jdeps/Analyzer.java > > 392 > 393 if (!jdk8Internals.contains(pn)) { > 394 return false; > 395 } > 396 > 397 return jdk8Internals.contains(pn); > > I suspect that one of the 'pn' should be 'cn? ? Good catch. The if-statement should be removed. Mandy From mandy.chung at oracle.com Wed Jul 13 11:01:16 2016 From: mandy.chung at oracle.com (Mandy Chung) Date: Wed, 13 Jul 2016 19:01:16 +0800 Subject: Review Request: JDK-8157464: StackWalker.getCallerClass() should not filter out non-invoker frames Message-ID: Webrev: http://cr.openjdk.java.net/~mchung/jdk9/webrevs/8157464/webrev.00/index.html StackWalker::getCallerClass() is specified to return the invoker of the MethodHandle and java.lang.reflect.Method for the method calling StackWalker::getCallerClass(). StackWalker::getCallerClass() is not used by any @CallerSensitive method. Instead one intended usage of StackWalker::getCallerClass() is to be called by library code acting as an agent that calls @CallerSensitive method on behalf of the true caller and typically it will call an appropriate method with the appropriate parameter (e.g. ResourceBundle.getBundle(String, ClassLoader). MethodHandle for @CS method behaves as if the caller is the lookup class. The actual caller class may not be the lookup class which is left as implementation details. This patch adjusts the stack walker to return the same caller as jdk.internal.reflect.Reflection::getCallerClass. Mandy From michael.haupt at oracle.com Wed Jul 13 13:12:56 2016 From: michael.haupt at oracle.com (Michael Haupt) Date: Wed, 13 Jul 2016 15:12:56 +0200 Subject: RFR(S): 8161212: Test times out: java/lang/invoke/LoopCombinatorLongSignatureTest.java Message-ID: <44D4317A-C0A0-48D8-BA80-032848CC0B18@oracle.com> Dear all, please review this fix. Bug: https://bugs.openjdk.java.net/browse/JDK-8161212 Webrev: http://cr.openjdk.java.net/~mhaupt/8161212/webrev.00/ Running the test in LambdaForm interpretation mode takes a long time. As the test is actually about capturing excessively long loop clause lists, running the constructed loop should be optional. The fix disables running the loop by default and introduces a -run option that can be used if the loop should actually be run. Thanks, Michael -- Dr. Michael Haupt | Principal Member of Technical Staff Phone: +49 331 200 7277 | Fax: +49 331 200 7561 Oracle Java Platform Group | LangTools Team | Nashorn Oracle Deutschland B.V. & Co. KG | Schiffbauergasse 14 | 14467 Potsdam, Germany ORACLE Deutschland B.V. & Co. KG | Hauptverwaltung: Riesstra?e 25, D-80992 M?nchen Registergericht: Amtsgericht M?nchen, HRA 95603 Komplement?rin: ORACLE Deutschland Verwaltung B.V. | Hertogswetering 163/167, 3543 AS Utrecht, Niederlande Handelsregister der Handelskammer Midden-Nederland, Nr. 30143697 Gesch?ftsf?hrer: Alexander van der Ven, Jan Schultheiss, Val Maher Oracle is committed to developing practices and products that help protect the environment From volker.simonis at gmail.com Wed Jul 13 13:15:00 2016 From: volker.simonis at gmail.com (Volker Simonis) Date: Wed, 13 Jul 2016 15:15:00 +0200 Subject: RFR(S): 8160564: TEST: Add a test to check the implementation of VersionProps.versionNumbers() In-Reply-To: <48da8e45-6b8d-46a9-9d82-d58c4c810816@default> References: <68CCBF25-963A-41E8-A537-44E340173AB2@oracle.com> <5784FA7C.4040208@oracle.com> <48da8e45-6b8d-46a9-9d82-d58c4c810816@default> Message-ID: Thanks Iris! On Tue, Jul 12, 2016 at 9:01 PM, Iris Clark wrote: > Hi. > >>> Please find the new webrev at: >>> >>> http://cr.openjdk.java.net/~simonis/webrevs/2016/8160564.v2/ >> >> +1 >> >>> Any other comments? > >> Only to note that this adds a validation check that we don't have >> trailing zeros, which I was recently made aware of is being >> reconsidered, see https://bugs.openjdk.java.net/browse/JDK-8156907 >> - if so that implementation will likely have to revert parts of >> this validation. > > I've added a comment to this effect in 8156907. That changeset will > need to include updates this code and associated regression test. > > Regards, > iris From kumar.x.srinivasan at oracle.com Wed Jul 13 13:40:53 2016 From: kumar.x.srinivasan at oracle.com (Kumar Srinivasan) Date: Wed, 13 Jul 2016 06:40:53 -0700 Subject: RFR: 8132379: -J options can cause crash or "Warning: app args parsing error passing arguments as-is" In-Reply-To: References: Message-ID: <578644E5.5070609@oracle.com> Henry, Thanks for fixing this. Looks good. Kumar > Hi, > > Please review a fix for JDK-8132379, the fix is to build matching index to the original arguments for the application arguments, used later for the sanity check and wildcard expansion. The fix is specific to Windows platform. > > -J prefix used by launcher-based tools such as javac need to be filtered out, but not for java itself, where -J prefix could be used by the main class. > > Use index table avoid copy of arguments and use less memory. The fix is tested on Windows 10. > > Bug: https://bugs.openjdk.java.net/browse/JDK-8132379 > Webrev: http://cr.openjdk.java.net/~henryjen/jdk9/8132379.0/webrev/ > > Cheers, > Henry > From henry.jen at oracle.com Wed Jul 13 14:38:32 2016 From: henry.jen at oracle.com (Henry Jen) Date: Wed, 13 Jul 2016 07:38:32 -0700 Subject: RFR: 8132379: -J options can cause crash or "Warning: app args parsing error passing arguments as-is" In-Reply-To: <578644E5.5070609@oracle.com> References: <578644E5.5070609@oracle.com> Message-ID: Kumar, Thanks for the review. Cheers, Henry On July 13, 2016 at 6:43:09 AM, Kumar Srinivasan (kumar.x.srinivasan at oracle.com) wrote: > > Henry, > > Thanks for fixing this. Looks good. > > Kumar > > > Hi, > > > > Please review a fix for JDK-8132379, the fix is to build matching index to the original > arguments for the application arguments, used later for the sanity check and wildcard > expansion. The fix is specific to Windows platform. > > > > -J prefix used by launcher-based tools such as javac need to be filtered out, but not > for java itself, where -J prefix could be used by the main class. > > > > Use index table avoid copy of arguments and use less memory. The fix is tested on Windows > 10. > > > > Bug: https://bugs.openjdk.java.net/browse/JDK-8132379 > > Webrev: http://cr.openjdk.java.net/~henryjen/jdk9/8132379.0/webrev/ > > > > Cheers, > > Henry > > > > From daniel.fuchs at oracle.com Wed Jul 13 14:55:39 2016 From: daniel.fuchs at oracle.com (Daniel Fuchs) Date: Wed, 13 Jul 2016 15:55:39 +0100 Subject: Review Request: JDK-8157464: StackWalker.getCallerClass() should not filter out non-invoker frames In-Reply-To: References: Message-ID: <205c1417-40c4-58b4-04e2-12bfa3477b16@oracle.com> Hi Mandy, I wonder whether intermediate frames should be skipped always, whether the method is @CS or not. Indeed StackWalker::getCallerClass() is intented to be called from methods that are not @CS. If so the code in stackwalk.cpp could probably be simplified to simply look at method->is_ignored_by_security_stack_walk() when the JVM_STACKWALK_GET_CALLER_CLASS is set, and the @CS flag could be ignored. (I'm comparing with what I see in jvm.cpp:JVM_GetCallerClass) what do you think? best regards, -- daniel On 13/07/16 12:01, Mandy Chung wrote: > Webrev: > http://cr.openjdk.java.net/~mchung/jdk9/webrevs/8157464/webrev.00/index.html > > StackWalker::getCallerClass() is specified to return the invoker of the MethodHandle and java.lang.reflect.Method for the method calling StackWalker::getCallerClass(). > > StackWalker::getCallerClass() is not used by any @CallerSensitive method. Instead one intended usage of StackWalker::getCallerClass() is to be called by library code acting as an agent that calls @CallerSensitive method on behalf of the true caller and typically it will call an appropriate method with the appropriate parameter (e.g. ResourceBundle.getBundle(String, ClassLoader). > > MethodHandle for @CS method behaves as if the caller is the lookup class. The actual caller class may not be the lookup class which is left as implementation details. This patch adjusts the stack walker to return the same caller as jdk.internal.reflect.Reflection::getCallerClass. > > Mandy > > > From svetlana.nikandrova at oracle.com Wed Jul 13 15:35:23 2016 From: svetlana.nikandrova at oracle.com (Svetlana Nikandrova) Date: Wed, 13 Jul 2016 18:35:23 +0300 Subject: RFR 8054213: Class name repeated in output of Type.toString() In-Reply-To: <577E7A22.2010202@oracle.com> References: <57644535.3060709@oracle.com> <576D2072.4050701@oracle.com> <57716F7C.9080003@oracle.com> <5772C121.4000507@oracle.com> <968e8fd5-285c-1f65-3e5f-f4cedf5ddfe5@oracle.com> <57754C8A.7040503@oracle.com> <577E7A22.2010202@oracle.com> Message-ID: <57865FBB.2020909@oracle.com> Kindly reminder. On 07.07.2016 18:49, Svetlana Nikandrova wrote: > Hello all, > > seems like Joe is busy right now, so meanwhile I'll be happy to hear > other opinions on this topic. > > Thank you, > Svetlana > > On 30.06.2016 19:44, Svetlana Nikandrova wrote: >> Hello Joe, >> >> thank you for your advice! GenericStringTest looks really good with >> annotations. I refactored my test, please see updated webrev: >> http://cr.openjdk.java.net/~snikandrova/8054213/webrev.01/ >> >> >> As for "." vs "$" let me provide an example: >> E.g. we have class >> public classTest { >> >> publicNested1.Nested2 foo() >> { >> return null; >> } >> >> public classNested1 >> { >> public classNested2{} >> } >> } >> The output of the >> System.out.println(Test.class.getMethod("foo",null).getReturnType()); >> Output: >> class Test$Nested1$Nested2 (nested classes divided by "$") >> while >> System.out.println(Test.class.getMethod("foo",null).getGenericReturnType()); >> Output: >> Test$Nested1.Nested2(nested classes divided by "." if enclosed by parametrized type and "$" in other cases). >> I think it's a little bit strange to have different separators for >> inner classes depended on is it nested by parametrized or raw type. >> >> Thank you, >> Svetlana >> >> On 28.06.2016 22:02, joe darcy wrote: >>> Hello Svetlana, >>> >>> I'm not convinced '$' should be replaced with '.' in this context as >>> '.' is what the separator used in source code. >>> >>> In any case, the test should be restructured. I recommend declaring >>> an annotation type to hold the expected to string output. You can >>> them loop over the methods from the class object and for the methods >>> with the annotation verifying the toString output is as expected. >>> For a guide see >>> >>> test/java/lang/reflect/Constructor/GenericStringTest.java >>> >>> Thanks, >>> >>> -Joe >>> >>> >>> On 6/28/2016 11:25 AM, Svetlana Nikandrova wrote: >>>> May be someone can find a minute? >>>> >>>> On 27.06.2016 21:25, Svetlana Nikandrova wrote: >>>>> Kindly reminder >>>>> >>>>> On 24.06.2016 14:58, Svetlana Nikandrova wrote: >>>>>> Hello, >>>>>> >>>>>> let me try again with updated version of webrev: >>>>>> Webrev: >>>>>> http://cr.openjdk.java.net/~snikandrova/8054213/webrev.01/ >>>>>> >>>>>> Issue: >>>>>> https://bugs.openjdk.java.net/browse/JDK-8054213 >>>>>> >>>>>> Many thanks goes to Sergey Ustimenko for his valuable advises. I >>>>>> believe fix looks nicer now. >>>>>> JPRT tested. >>>>>> >>>>>> Thank you, >>>>>> Svetlana >>>>>> >>>>>> On 17.06.2016 21:45, Svetlana Nikandrova wrote: >>>>>>> Hello, >>>>>>> >>>>>>> could you please review this fix for toString() method of >>>>>>> ParameterizedTypeImpl. >>>>>>> The problem is that when we obtain simple name of nested type >>>>>>> shared prefix is only removed for ParameterizedType owner. We >>>>>>> need to remove it for other cases too. >>>>>>> >>>>>>> Please note that I also changed delimiter between outer and >>>>>>> inner class from "." to "$". I believe as "$" is usually used to >>>>>>> separate nested class name "." looks inconsistent and confusing. >>>>>>> Let me know if you have any objections. >>>>>>> >>>>>>> Webrev: >>>>>>> http://cr.openjdk.java.net/~msolovie/8054213/webrev.00/ >>>>>>> >>>>>>> Issue: >>>>>>> https://bugs.openjdk.java.net/browse/JDK-8054213 >>>>>>> >>>>>>> Thank you, >>>>>>> Svetlana >>>>>> >>>>> >>>> >>> >> > From daniel.fuchs at oracle.com Wed Jul 13 15:46:02 2016 From: daniel.fuchs at oracle.com (Daniel Fuchs) Date: Wed, 13 Jul 2016 16:46:02 +0100 Subject: Review request: JDK-8160398 (jdeps) Replace a list of JDK 8 internal API for detecting if it's removed in JDK 9 or later In-Reply-To: References: <396F49EB-119D-4B69-A01C-F0EA1DDADE03@oracle.com> Message-ID: <18e2435c-e069-5e59-8095-22da9ae83c24@oracle.com> On 13/07/16 11:48, Mandy Chung wrote: >> On Jul 13, 2016, at 4:55 PM, Daniel Fuchs wrote: >> > >> > Hi Mandy, >> > >> > I have not finished reviewing yet - but as early feedback I believe >> > that the following probably has a mistake: >> > >> > jdk.jdeps/share/classes/com/sun/tools/jdeps/Analyzer.java >> > >> > 392 >> > 393 if (!jdk8Internals.contains(pn)) { >> > 394 return false; >> > 395 } >> > 396 >> > 397 return jdk8Internals.contains(pn); >> > >> > I suspect that one of the 'pn' should be 'cn? ? > Good catch. The if-statement should be removed. Right. Then with that change the fix looks good to me. best regards, -- daniel From francois.green at gmail.com Mon Jul 11 19:58:27 2016 From: francois.green at gmail.com (Francois Green) Date: Mon, 11 Jul 2016 15:58:27 -0400 Subject: Fwd: CompletableFuture eventual race condition In-Reply-To: References: Message-ID: ---------- Forwarded message ---------- From: Francois Green Date: Mon, Jul 11, 2016 at 3:22 PM Subject: Re: CompletableFuture eventual race condition To: Martin Buchholz I'm sorry for not posting the complete example. The claim was, given enough trials, this program will eventually fail to print due to a race condition. import java.util.concurrent.*; public class HelloWorld { public static void main(String[] args) { CompletableFuture.supplyAsync(() -> "Hejjo Worjd from Java") .thenApply(s -> s.replaceAll("j","l")) .thenAccept(System.out::println); } } I doubt this claim, but I'm in no position to counter it. Thanks for help you can provide. From xueming.shen at oracle.com Wed Jul 13 17:57:29 2016 From: xueming.shen at oracle.com (Xueming Shen) Date: Wed, 13 Jul 2016 10:57:29 -0700 Subject: RFR JDK-7031075: GZIPInputStream's available() reports 1, but read() gives -1. In-Reply-To: <36C226AF-9A43-43CC-A073-BB9AE5A58DFF@oracle.com> References: <57842376.2000809@oracle.com> <578569C8.7010206@oracle.com> <7F419B46-7306-4D07-8969-177E0EA11C8C@oracle.com> <57857956.9070402@oracle.com> <36C226AF-9A43-43CC-A073-BB9AE5A58DFF@oracle.com> Message-ID: <57868109.8090407@oracle.com> Hi Pavel, The test case has been updated accordingly (added GIS and updated the "summary" as suggested). http://cr.openjdk.java.net/~sherman/7031075/webrev/ I don't have a strong feeling to against to add inf.needsDirectory() for available() to return zero. Just feel it might be better to keep the existing behavior if the change does not really solve the problem "correctly". Thanks, Sherman On 07/13/2016 02:55 AM, Pavel Rappo wrote: >> On 13 Jul 2016, at 00:12, Xueming Shen wrote: >> >> (as I commented in the bug report) > Sorry, I didn't see this. I should've been more careful. > > On other topics. > > 1. Original bug refers to GZIPInputStream's behaviour, not InflaterInputStream's. > That said, I think it's fair to ask the test to exercise GZIPInputStream. > However, it's not mentioned in the test at all. And when I looked into > java.util.zip.GZIPInputStream#read I found it has its own (and quite complex) > logic and its own eos flag. I wonder if available() should be overridden there > as well? > > 2. Nitpicking > > * @summary Make sure that the available() methods behave as expected. > > Shouldn't it be like this? > > * @summary Make sure that available() method behaves as expected. > > 3. We can always return 0 from available(), which is akin to returning the same > number from Object.hashCode(). Not a particularly good implementation, but at least > a safe one. > > Thanks. > From pavel.rappo at oracle.com Wed Jul 13 18:42:19 2016 From: pavel.rappo at oracle.com (Pavel Rappo) Date: Wed, 13 Jul 2016 19:42:19 +0100 Subject: RFR JDK-7031075: GZIPInputStream's available() reports 1, but read() gives -1. In-Reply-To: <57868109.8090407@oracle.com> References: <57842376.2000809@oracle.com> <578569C8.7010206@oracle.com> <7F419B46-7306-4D07-8969-177E0EA11C8C@oracle.com> <57857956.9070402@oracle.com> <36C226AF-9A43-43CC-A073-BB9AE5A58DFF@oracle.com> <57868109.8090407@oracle.com> Message-ID: Now you have to wait for a _R_eviewer, which I'm not. Thanks. > On 13 Jul 2016, at 18:57, Xueming Shen wrote: > > Hi Pavel, > > The test case has been updated accordingly (added GIS and updated > the "summary" as suggested). > > http://cr.openjdk.java.net/~sherman/7031075/webrev/ > > I don't have a strong feeling to against to add inf.needsDirectory() > for available() to return zero. Just feel it might be better to keep the > existing behavior if the change does not really solve the problem > "correctly". > > Thanks, > Sherman > > On 07/13/2016 02:55 AM, Pavel Rappo wrote: >>> On 13 Jul 2016, at 00:12, Xueming Shen wrote: >>> >>> (as I commented in the bug report) >> Sorry, I didn't see this. I should've been more careful. >> >> On other topics. >> >> 1. Original bug refers to GZIPInputStream's behaviour, not InflaterInputStream's. >> That said, I think it's fair to ask the test to exercise GZIPInputStream. >> However, it's not mentioned in the test at all. And when I looked into >> java.util.zip.GZIPInputStream#read I found it has its own (and quite complex) >> logic and its own eos flag. I wonder if available() should be overridden there >> as well? >> >> 2. Nitpicking >> >> * @summary Make sure that the available() methods behave as expected. >> >> Shouldn't it be like this? >> >> * @summary Make sure that available() method behaves as expected. >> >> 3. We can always return 0 from available(), which is akin to returning the same >> number from Object.hashCode(). Not a particularly good implementation, but at least >> a safe one. >> >> Thanks. >> > From stuart.marks at oracle.com Wed Jul 13 20:12:54 2016 From: stuart.marks at oracle.com (Stuart Marks) Date: Wed, 13 Jul 2016 13:12:54 -0700 Subject: JEP 293: Guidelines for JDK Command-Line Tool Options In-Reply-To: <20160707191609.E17CCB706A@eggemoggin.niobe.net> References: <20160707191609.E17CCB706A@eggemoggin.niobe.net> Message-ID: On 7/7/16 12:16 PM, mark.reinhold at oracle.com wrote: > New JEP Candidate: http://openjdk.java.net/jeps/293 Hi Jon, Good writeup and rundown of the issues. I have a few questions to raise. options can allow an argument to be provided This describes an option with an optional argument. I recommend disallowing or at least strongly discouraging this, as it leads to ambiguities in options parsing. For example, suppose is optional: cmd --example-option Suppose we have a case where the value begins with a minus and it happens to look like a valid option: cmd --example-option -l Is -l the argument to --example-option, or is it the separate -l option? One could define a disambiguation rule, but this doesn't seem like a very good idea. It will be confusing at best. Suppose what follows isn't a valid option: cmd --example-option -x There's no ambiguity here, at least not yet; "-x" would the argument for --example-option. But suppose a -x option were added in a later version of the tool. This could introduce an ambiguity and potential incompatibility with existing scripts. Single character options may be grouped into a single token. For example, if -a and -b are single character options, they may be specified together on the command line as -ab. This might be reasonable for greenfield tools that support only "pure" GNU-style options and not any legacy JDK options. But for tools that support single-minus long options, such as "-cp", "-version", and so forth, this introduces a bunch of weirdness if not outright ambiguity. For example, suppose an existing tool supports the -cp option, and it also supports -c and -p. Then -cp would mean --class-path, but -pc means -p -c. Given some other option like -l, then -cpl would mean -c -p -l. But if one wanted to remove the -l option, one couldn't simply remove the "l", since that would result in "-cp", yielding --class-path instead of -c -p. This is acknowledged a few paragraphs later, Some forms on the command-line may be ambiguous; tools may try and be clever to disambiguate such cases. In general, tools are encouraged not to support combinations which might be ambiguous, and users are encouraged not to use forms which might be ambiguous. For example, tools which support the old short form option -cp for classpath may choose not to support both -c and -p as single-character forms for new options. I think the recommendation should be stronger. I'd advise against tools trying to be clever; this leads directly to inconsistency and confusing behavior. If users are discouraged from using ambiguous forms, maybe we shouldn't allow potentially ambiguous forms in the first place. I observe that -p is the recommended short form for --module-path. Note that this takes an argument. So -pc would set the module path to "c". Hm. An alternative restriction would be to disallow single-letter option grouping in cases where one of the options takes an argument. The use of -X as a prefix to indicate "non-standard" options will be discontinued for new options, although command-line help may continue to draw a distinction between more commonly used options and those for advanced use. Is there a replacement convention? Sometimes it's useful to have "hidden" or diagnostic or debugging options that aren't supported, subject to change, etc. I thought the -X prefix was used for things like that. But if not -X, should there be something else? Given the existing support for -cp as a short form for -classpath, a single character form will not be introduced. Is there a recommendation for new tools? Clearly --class-path should be supported, but what about a short form? One could use "-cp" but this brings in the grouping ambiguity issues into brand-new tools, almost implying that there will never be any tools with pure-GNU option syntax. (But maybe that's OK.) On the other hand, I'm not sure what a reasonable single-letter option would be. Somebody would have to examine the existing tools to see if something like -c or -C is available. --add-reads =(,)* Just to clarify, is the = separator supported here as well, implying that the following would be permitted? --add-reads=modname=targetmod1,targetmod2 I don't think this is ambiguous; it merely looks a bit odd. -- In summary, my two main issues are 1) options with optional arguments; and 2) grouping of single-letter options. I'd like to see these disallowed, or at the very least a stronger recommendation against them. Thanks, s'marks From rajan.halade at oracle.com Wed Jul 13 21:35:05 2016 From: rajan.halade at oracle.com (Rajan Halade) Date: Wed, 13 Jul 2016 14:35:05 -0700 Subject: RFR: 9: 8161011: Mark test/java/rmi/activation/ActivationGroup/downloadActivationGroup/DownloadActivationGroup.java as itnermittent In-Reply-To: References: Message-ID: <51ecff4a-2f2b-6ea0-1ef0-0e308c756abb@oracle.com> Ping.... I extended this to include two more tests to be marked as intermittent. Webrev: http://cr.openjdk.java.net/~rhalade/8161011/webrev.00/ Thanks, Rajan On 7/7/16 3:59 PM, Rajan Halade wrote: > This test is seen to fail intermittently due to JDK-8085192. Please > review following patch which marks it as intermittent. > > diff -r 848c94ca6394 > test/java/rmi/activation/ActivationGroup/downloadActivationGroup/DownloadActivationGroup.java > --- > a/test/java/rmi/activation/ActivationGroup/downloadActivationGroup/DownloadActivationGroup.java > Thu Jul 07 14:16:58 2016 -0700 > +++ > b/test/java/rmi/activation/ActivationGroup/downloadActivationGroup/DownloadActivationGroup.java > Thu Jul 07 15:55:14 2016 -0700 > @@ -24,6 +24,7 @@ > /* > * @test > * @bug 4510355 > + * @key intermittent > * @summary ActivationGroup implementations cannot be downloaded by > default; > * Creates a custom activation group without setting a security manager > * in activation group's descriptor. The custom activation group > > Thanks, > Rajan From xueming.shen at oracle.com Wed Jul 13 21:54:16 2016 From: xueming.shen at oracle.com (Xueming Shen) Date: Wed, 13 Jul 2016 14:54:16 -0700 Subject: RFR JDK-7031075: GZIPInputStream's available() reports 1, but read() gives -1. In-Reply-To: References: <57842376.2000809@oracle.com> <578569C8.7010206@oracle.com> <7F419B46-7306-4D07-8969-177E0EA11C8C@oracle.com> <57857956.9070402@oracle.com> <36C226AF-9A43-43CC-A073-BB9AE5A58DFF@oracle.com> <57868109.8090407@oracle.com> Message-ID: <5786B888.1040806@oracle.com> webrev has been updated to use jdk.testlibrary.RandomFactory to create the Random object for the test case, as Brian suggested. http://cr.openjdk.java.net/~sherman/7031075/webrev Thanks! Sherman On 07/13/2016 11:42 AM, Pavel Rappo wrote: > Now you have to wait for a _R_eviewer, which I'm not. Thanks. > >> On 13 Jul 2016, at 18:57, Xueming Shen wrote: >> >> Hi Pavel, >> >> The test case has been updated accordingly (added GIS and updated >> the "summary" as suggested). >> >> http://cr.openjdk.java.net/~sherman/7031075/webrev/ >> >> I don't have a strong feeling to against to add inf.needsDirectory() >> for available() to return zero. Just feel it might be better to keep the >> existing behavior if the change does not really solve the problem >> "correctly". >> >> Thanks, >> Sherman >> >> On 07/13/2016 02:55 AM, Pavel Rappo wrote: >>>> On 13 Jul 2016, at 00:12, Xueming Shen wrote: >>>> >>>> (as I commented in the bug report) >>> Sorry, I didn't see this. I should've been more careful. >>> >>> On other topics. >>> >>> 1. Original bug refers to GZIPInputStream's behaviour, not InflaterInputStream's. >>> That said, I think it's fair to ask the test to exercise GZIPInputStream. >>> However, it's not mentioned in the test at all. And when I looked into >>> java.util.zip.GZIPInputStream#read I found it has its own (and quite complex) >>> logic and its own eos flag. I wonder if available() should be overridden there >>> as well? >>> >>> 2. Nitpicking >>> >>> * @summary Make sure that the available() methods behave as expected. >>> >>> Shouldn't it be like this? >>> >>> * @summary Make sure that available() method behaves as expected. >>> >>> 3. We can always return 0 from available(), which is akin to returning the same >>> number from Object.hashCode(). Not a particularly good implementation, but at least >>> a safe one. >>> >>> Thanks. >>> From mandy.chung at oracle.com Wed Jul 13 22:35:03 2016 From: mandy.chung at oracle.com (Mandy Chung) Date: Thu, 14 Jul 2016 06:35:03 +0800 Subject: Review Request: JDK-8157464: StackWalker.getCallerClass() should not filter out non-invoker frames In-Reply-To: <205c1417-40c4-58b4-04e2-12bfa3477b16@oracle.com> References: <205c1417-40c4-58b4-04e2-12bfa3477b16@oracle.com> Message-ID: I considered that and it?s possible and that would simplify the VM logic would be a good thing (do the filtering in the library as much as possible). This would need to fill an array of MemberName rather than Class object. MemberName would need to provide a way to determine if it?s a hidden method (that I have a patch). This would need performance measurement and possible further tuning on the batch size to minimize the number of up calls that I think better to separate as a follow up issue. Mandy > On Jul 13, 2016, at 10:55 PM, Daniel Fuchs wrote: > > Hi Mandy, > > I wonder whether intermediate frames should be skipped always, whether > the method is @CS or not. Indeed StackWalker::getCallerClass() is > intented to be called from methods that are not @CS. > > If so the code in stackwalk.cpp could probably be simplified to simply > look at method->is_ignored_by_security_stack_walk() when the > JVM_STACKWALK_GET_CALLER_CLASS is set, and the @CS flag > could be ignored. > > (I'm comparing with what I see in jvm.cpp:JVM_GetCallerClass) > > what do you think? > > best regards, > > -- daniel > > On 13/07/16 12:01, Mandy Chung wrote: >> Webrev: >> http://cr.openjdk.java.net/~mchung/jdk9/webrevs/8157464/webrev.00/index.html >> >> StackWalker::getCallerClass() is specified to return the invoker of the MethodHandle and java.lang.reflect.Method for the method calling StackWalker::getCallerClass(). >> >> StackWalker::getCallerClass() is not used by any @CallerSensitive method. Instead one intended usage of StackWalker::getCallerClass() is to be called by library code acting as an agent that calls @CallerSensitive method on behalf of the true caller and typically it will call an appropriate method with the appropriate parameter (e.g. ResourceBundle.getBundle(String, ClassLoader). >> >> MethodHandle for @CS method behaves as if the caller is the lookup class. The actual caller class may not be the lookup class which is left as implementation details. This patch adjusts the stack walker to return the same caller as jdk.internal.reflect.Reflection::getCallerClass. >> >> Mandy >> >> >> > From brian.burkhalter at oracle.com Wed Jul 13 23:30:18 2016 From: brian.burkhalter at oracle.com (Brian Burkhalter) Date: Wed, 13 Jul 2016 16:30:18 -0700 Subject: RFR JDK-7031075: GZIPInputStream's available() reports 1, but read() gives -1. In-Reply-To: <5786B888.1040806@oracle.com> References: <57842376.2000809@oracle.com> <578569C8.7010206@oracle.com> <7F419B46-7306-4D07-8969-177E0EA11C8C@oracle.com> <57857956.9070402@oracle.com> <36C226AF-9A43-43CC-A073-BB9AE5A58DFF@oracle.com> <57868109.8090407@oracle.com> <5786B888.1040806@oracle.com> Message-ID: Hi Sherman, This looks fine: +1. Brian On Jul 13, 2016, at 2:54 PM, Xueming Shen wrote: > webrev has been updated to use jdk.testlibrary.RandomFactory to > create the Random object for the test case, as Brian suggested. > > http://cr.openjdk.java.net/~sherman/7031075/webrev From brian.burkhalter at oracle.com Wed Jul 13 23:46:42 2016 From: brian.burkhalter at oracle.com (Brian Burkhalter) Date: Wed, 13 Jul 2016 16:46:42 -0700 Subject: RFR: 9: 8161011: Mark test/java/rmi/activation/ActivationGroup/downloadActivationGroup/DownloadActivationGroup.java as itnermittent In-Reply-To: <51ecff4a-2f2b-6ea0-1ef0-0e308c756abb@oracle.com> References: <51ecff4a-2f2b-6ea0-1ef0-0e308c756abb@oracle.com> Message-ID: <0462CCF1-BB9A-4B59-BC9E-F290FF8A18B3@oracle.com> Looks OK. Brian On Jul 13, 2016, at 2:35 PM, Rajan Halade wrote: > Ping.... > > I extended this to include two more tests to be marked as intermittent. > > Webrev: http://cr.openjdk.java.net/~rhalade/8161011/webrev.00/ From david.holmes at oracle.com Thu Jul 14 04:25:57 2016 From: david.holmes at oracle.com (David Holmes) Date: Thu, 14 Jul 2016 14:25:57 +1000 Subject: RFR: 8140723: Remove source code conditionalized on JAVASE_EMBEDDED Message-ID: The bug report for this is confidential but quite simply all of the little tweaks and knobs we added to the open build and source files to support the Java SE Embedded product no longer need to be there for JDK 9. Many of them have already been removed via other changes but this cleans up the rest. webrev: http://cr.openjdk.java.net/~dholmes/8140723/webrev.jdk/ The changes relate to: - Java version information - isEmbedded() check in test code Platform.java - special AWT build settings for Embedded - special Toolkit handling for Embedded In make/lib/Awt2dLibraries.gmk I commented out a setting which was seemingly introduced only to support (old) embedded releases: # decimal constant is unsigned only in ISO C90 (JAVASE_EMBEDDED) BUILD_LIBAWT_XAWT_XToolkit.c_CFLAGS := -w which I think pertained to: #define DEF_AWT_MAX_POLL_TIMEOUT ((uint32_t)4000000000) Unless AWT folk indicate otherwise I will delete those two lines in final push. Thanks, David ----- From amy.lu at oracle.com Thu Jul 14 05:55:26 2016 From: amy.lu at oracle.com (Amy Lu) Date: Thu, 14 Jul 2016 13:55:26 +0800 Subject: JDK 9 RFR of JDK-8161347: Mark java/lang/ProcessBuilder/Zombies.java as intermittently failing Message-ID: <5787294E.2030400@oracle.com> java/lang/ProcessBuilder/Zombies.java This test is known to fail intermittently (JDK-8160151), this patch is to mark the test accordingly with keyword 'intermittent'. (Note that this test has been demoted to tier2.) bug: https://bugs.openjdk.java.net/browse/JDK-8161347 webrev: http://cr.openjdk.java.net/~amlu/8161347/webrev.00/ Thanks, Amy --- old/test/java/lang/ProcessBuilder/Zombies.java 2016-07-14 13:50:10.000000000 +0800 +++ new/test/java/lang/ProcessBuilder/Zombies.java 2016-07-14 13:50:10.000000000 +0800 @@ -24,6 +24,7 @@ /* * @test * @bug 6474073 + * @key intermittent * @summary Make sure zombies don't get created on Unix * @author Martin Buchholz */ From daniel.fuchs at oracle.com Thu Jul 14 07:41:43 2016 From: daniel.fuchs at oracle.com (Daniel Fuchs) Date: Thu, 14 Jul 2016 08:41:43 +0100 Subject: Review Request: JDK-8157464: StackWalker.getCallerClass() should not filter out non-invoker frames In-Reply-To: References: <205c1417-40c4-58b4-04e2-12bfa3477b16@oracle.com> Message-ID: <4b9a4c1d-3d23-bda4-1a8d-a37ed21efc06@oracle.com> On 13/07/16 23:35, Mandy Chung wrote: > I considered that and it?s possible and that would simplify the VM logic would be a good thing (do the filtering in the library as much as possible). > > This would need to fill an array of MemberName rather than Class object. MemberName would need to provide a way to determine if it?s a hidden method (that I have a patch). > > This would need performance measurement and possible further tuning on the batch size to minimize the number of up calls that I think better to separate as a follow up issue. Hi Mandy, I'm not sure we are talking of the same thing. This was what I wanted to suggest: int frames_decoded = 0; for (; !stream.at_end(); stream.next()) { Method* method = stream.method(); int bci = stream.bci(); if (method == NULL) continue; + + if (StackWalk::get_caller_class(mode)) { + // JVM_GetCallerClass may return a hidden method + // StackWalker::getCallerClass should return the same caller as JVM_GetCallerClass + // even the jdk implementation does not use it for performance reason + if (method->is_ignored_by_security_stack_walk()) continue; + } else { + // filter hidden frames if (!ShowHiddenFrames && StackWalk::skip_hidden_frames(mode)) { if (method->is_hidden()) { if (TraceStackWalk) { tty->print(" hidden method: "); method->print_short_name(); tty->print("\n"); } continue; } } + } int index = end_index++; if (TraceStackWalk) { tty->print(" %d: frame method: ", index); method->print_short_name(); tty->print_cr(" bci=%d", bci); @@ -139,10 +150,14 @@ Handle stackFrame(frames_array->obj_at(index)); fill_stackframe(stackFrame, method, bci); } else { assert (use_frames_array(mode) == false, "Bad mode for get caller class"); frames_array->obj_at_put(index, method->method_holder()->java_mirror()); + // nothing special to do here since we already checked + // StackWalk::get_caller_class(mode) above } if (++frames_decoded >= max_nframes) break; } return frames_decoded; } > > Mandy > >> On Jul 13, 2016, at 10:55 PM, Daniel Fuchs wrote: >> >> Hi Mandy, >> >> I wonder whether intermediate frames should be skipped always, whether >> the method is @CS or not. Indeed StackWalker::getCallerClass() is >> intented to be called from methods that are not @CS. >> >> If so the code in stackwalk.cpp could probably be simplified to simply >> look at method->is_ignored_by_security_stack_walk() when the >> JVM_STACKWALK_GET_CALLER_CLASS is set, and the @CS flag >> could be ignored. >> >> (I'm comparing with what I see in jvm.cpp:JVM_GetCallerClass) >> >> what do you think? >> >> best regards, >> >> -- daniel >> >> On 13/07/16 12:01, Mandy Chung wrote: >>> Webrev: >>> http://cr.openjdk.java.net/~mchung/jdk9/webrevs/8157464/webrev.00/index.html >>> >>> StackWalker::getCallerClass() is specified to return the invoker of the MethodHandle and java.lang.reflect.Method for the method calling StackWalker::getCallerClass(). >>> >>> StackWalker::getCallerClass() is not used by any @CallerSensitive method. Instead one intended usage of StackWalker::getCallerClass() is to be called by library code acting as an agent that calls @CallerSensitive method on behalf of the true caller and typically it will call an appropriate method with the appropriate parameter (e.g. ResourceBundle.getBundle(String, ClassLoader). >>> >>> MethodHandle for @CS method behaves as if the caller is the lookup class. The actual caller class may not be the lookup class which is left as implementation details. This patch adjusts the stack walker to return the same caller as jdk.internal.reflect.Reflection::getCallerClass. >>> >>> Mandy >>> >>> >>> >> > From aleksej.efimov at oracle.com Thu Jul 14 09:22:38 2016 From: aleksej.efimov at oracle.com (Aleks Efimov) Date: Thu, 14 Jul 2016 12:22:38 +0300 Subject: RFR (JAXP): 8148350: Element.setAttributeNS() empty namespace does not throw exception In-Reply-To: <578558E2.2060201@oracle.com> References: <57853146.70605@oracle.com> <57854D16.9070605@oracle.com> <1BB33F91-BA66-4487-9647-48A4E45B7FDF@oracle.com> <578558E2.2060201@oracle.com> Message-ID: <578759DE.4090500@oracle.com> Hi Lance, Joe, Thanks for your reviews and comments. I will work on CCC and javadoc/Lic header modifications. Will return back to you when it is done. Best Regards, Aleksej On 12/07/16 23:53, huizhe wang wrote: > > > On 7/12/2016 1:35 PM, Lance Andersen wrote: >> Looks OK also. Joe given this is a change in functionality, it might >> need a CCC fast tracked before it is pushed? > > Agree. A quick CCC to clarify the spec would be good. > > -Joe > >> >> >>> On Jul 12, 2016, at 4:03 PM, huizhe wang wrote: >>> >>> Hi Aleksej, >>> >>> The change looks good. Ideally though, it would be good to update >>> the relevant Javadoc to reflect the change since this part of >>> Javadoc is quite explicit about when NAMESPACE_ERR is thrown. >>> >>> Also, this is a good opportunity to update the Lic header. >>> >>> Thanks, >>> Joe >>> >>> On 7/12/2016 11:04 AM, Aleks Efimov wrote: >>>> Hi, >>>> Please, help to review the fix for >>>> org.w3c.dom.Element#setAttributeNS method in JDK9: >>>> According to w3.org documentation empty string >>>> cannot be used as a namespace name [1]. Therefore the >>>> setAttributeNS [2] should raise DOMException (NAMESPACE_ERR) when >>>> namespaceURI is empty string (similar to null value). >>>> Webrev with proposed fix (regtest is included): >>>> http://cr.openjdk.java.net/~aefimov/8148350/9/00/ >>>> >>>> >>>> Best Regards, >>>> Aleksej >>>> >>>> [1] https://www.w3.org/TR/xml-names/#iri-use >>>> [2] >>>> https://docs.oracle.com/javase/8/docs/api/org/w3c/dom/Element.html#setAttributeNS-java.lang.String-java.lang.String-java.lang.String- >>>> >>> >> >> >> >> 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 mandy.chung at oracle.com Thu Jul 14 10:16:36 2016 From: mandy.chung at oracle.com (Mandy Chung) Date: Thu, 14 Jul 2016 18:16:36 +0800 Subject: Review Request: JDK-8157464: StackWalker.getCallerClass() should not filter out non-invoker frames In-Reply-To: <4b9a4c1d-3d23-bda4-1a8d-a37ed21efc06@oracle.com> References: <205c1417-40c4-58b4-04e2-12bfa3477b16@oracle.com> <4b9a4c1d-3d23-bda4-1a8d-a37ed21efc06@oracle.com> Message-ID: Hi Daniel, Now I see what you mean. Your suggestion would include hidden frames for non @CS frames that should be filtered from StackWalker::getCallerClass. This would require the support I described earlier that it needs to return MemberName[] and also MemberName::isHidden support unfortunately. Mandy From naoto.sato at oracle.com Thu Jul 14 12:42:57 2016 From: naoto.sato at oracle.com (Naoto Sato) Date: Thu, 14 Jul 2016 05:42:57 -0700 Subject: [9] RFR: 8159214: jlink --include-locales problems Message-ID: Hello, Please review the fix to the following issue: https://bugs.openjdk.java.net/browse/JDK-8159214 The fix is located at: http://cr.openjdk.java.net/~naoto/8159214/webrev.04/ Naoto From paul.sandoz at oracle.com Thu Jul 14 13:12:29 2016 From: paul.sandoz at oracle.com (Paul Sandoz) Date: Thu, 14 Jul 2016 15:12:29 +0200 Subject: RFR: 8140723: Remove source code conditionalized on JAVASE_EMBEDDED In-Reply-To: References: Message-ID: <3EBF058B-88CF-4851-B0E7-069884DBA881@oracle.com> > On 14 Jul 2016, at 06:25, David Holmes wrote: > > The bug report for this is confidential but quite simply all of the little tweaks and knobs we added to the open build and source files to support the Java SE Embedded product no longer need to be there for JDK 9. Many of them have already been removed via other changes but this cleans up the rest. > > webrev: http://cr.openjdk.java.net/~dholmes/8140723/webrev.jdk/ > > The changes relate to: > - Java version information > - isEmbedded() check in test code Platform.java > - special AWT build settings for Embedded > - special Toolkit handling for Embedded > > In make/lib/Awt2dLibraries.gmk I commented out a setting which was seemingly introduced only to support (old) embedded releases: > > # decimal constant is unsigned only in ISO C90 (JAVASE_EMBEDDED) > BUILD_LIBAWT_XAWT_XToolkit.c_CFLAGS := -w > > which I think pertained to: > > #define DEF_AWT_MAX_POLL_TIMEOUT ((uint32_t)4000000000) > > Unless AWT folk indicate otherwise I will delete those two lines in final push. > +1 Paul. From mandy.chung at oracle.com Thu Jul 14 14:04:51 2016 From: mandy.chung at oracle.com (Mandy Chung) Date: Thu, 14 Jul 2016 22:04:51 +0800 Subject: RFR(S): 8160564: TEST: Add a test to check the implementation of VersionProps.versionNumbers() In-Reply-To: References: <68CCBF25-963A-41E8-A537-44E340173AB2@oracle.com> Message-ID: <9C6092E0-2DE8-4BD7-8F7E-ED2C1FA88665@oracle.com> > On Jul 12, 2016, at 9:54 PM, Volker Simonis wrote: > > Please find the new webrev at: > > http://cr.openjdk.java.net/~simonis/webrevs/2016/8160564.v2/ > Looks good. Nit: maybe better to rename the parameter to ?version?. 79 static List parseVersionNumbers(String versionNumber) { No need to generate a new webrev. thanks Mandy From volker.simonis at gmail.com Thu Jul 14 14:21:31 2016 From: volker.simonis at gmail.com (Volker Simonis) Date: Thu, 14 Jul 2016 16:21:31 +0200 Subject: RFR(S): 8160564: TEST: Add a test to check the implementation of VersionProps.versionNumbers() In-Reply-To: <9C6092E0-2DE8-4BD7-8F7E-ED2C1FA88665@oracle.com> References: <68CCBF25-963A-41E8-A537-44E340173AB2@oracle.com> <9C6092E0-2DE8-4BD7-8F7E-ED2C1FA88665@oracle.com> Message-ID: On Thu, Jul 14, 2016 at 4:04 PM, Mandy Chung wrote: > >> On Jul 12, 2016, at 9:54 PM, Volker Simonis wrote: >> >> Please find the new webrev at: >> >> http://cr.openjdk.java.net/~simonis/webrevs/2016/8160564.v2/ >> > > Looks good. > > Nit: maybe better to rename the parameter to ?version?. > 79 static List parseVersionNumbers(String versionNumber) { > > No need to generate a new webrev. > Thanks for the review! I'll do so. Regards, Volker > thanks > Mandy > From Roger.Riggs at Oracle.com Thu Jul 14 14:42:41 2016 From: Roger.Riggs at Oracle.com (Roger Riggs) Date: Thu, 14 Jul 2016 10:42:41 -0400 Subject: JDK 9 RFR of JDK-8161347: Mark java/lang/ProcessBuilder/Zombies.java as intermittently failing In-Reply-To: <5787294E.2030400@oracle.com> References: <5787294E.2030400@oracle.com> Message-ID: +1 to mark as intermittent. Thanks, Roger On 7/14/2016 1:55 AM, Amy Lu wrote: > java/lang/ProcessBuilder/Zombies.java > > This test is known to fail intermittently (JDK-8160151), this patch is > to mark the test accordingly with keyword 'intermittent'. > (Note that this test has been demoted to tier2.) > > bug: https://bugs.openjdk.java.net/browse/JDK-8161347 > webrev: http://cr.openjdk.java.net/~amlu/8161347/webrev.00/ > > Thanks, > Amy > > > --- old/test/java/lang/ProcessBuilder/Zombies.java 2016-07-14 > 13:50:10.000000000 +0800 > +++ new/test/java/lang/ProcessBuilder/Zombies.java 2016-07-14 > 13:50:10.000000000 +0800 > @@ -24,6 +24,7 @@ > /* > * @test > * @bug 6474073 > + * @key intermittent > * @summary Make sure zombies don't get created on Unix > * @author Martin Buchholz > */ > From patrick at reini.net Thu Jul 14 15:55:51 2016 From: patrick at reini.net (Patrick Reinhart) Date: Thu, 14 Jul 2016 17:55:51 +0200 Subject: Create java.util.stream.Stream from Iterator / Enumeration In-Reply-To: <9A267516-581F-4D2F-BB20-DDECA64BE722@oracle.com> References: <96449a94df44b8a26d9c1abb800baef5@reini.net> <2239A562-0696-47D3-B63C-CD6ECB06EAF5@oracle.com> <7519b84f-6259-701e-4c36-3bd4e4118bff@reini.net> <5ddfd52d9b9b5ac20e52f3ebd85f70b5@reini.net> <57854411.3030602@reini.net> <9A267516-581F-4D2F-BB20-DDECA64BE722@oracle.com> Message-ID: Hi Paul, On 2016-07-13 10:28, Paul Sandoz wrote: > I see some comments already by Stuart and Alan, and concur with Alan > about working closely with jigsaw-dev. > > Focusing on the public methods is good and then it will come down to > naming them appropriately. Given that sub-classes can override the > existing public Enumeration returning methods we most likely need to > specify the implementation behaviour of the Stream returning methods > i.e. specify in an @implSpec that they call the Enumeration returning > methods. Later on it may be possible to sub-types to implement more > optimally (but the Enumeration ?string? is quite long and intertwined > with the internal code base) When I understand you correctly here we should concentrate on the public methods naming firstly? I initially was not sure, what a proper naming for the steams method was. It seem to me reasonable the way Stuart pointed them out on his first comment to name them something like this: Stream resources(String name) Stream systemResources(String name) Has anyone a better naming suggestion? For me those names would fit so far. If we look into the stream characteristics I would suggest that it has a unknown size and is immutable in both cases. Maybe the entries are also distinct, but there I'm not sure. > The protected findResources method may be trickier, i suggest leaving > that one alone for now. From the point of a consumer of the public API I have no problems with this approach, as I created the enhancement issue on the public methods anyway. Better to deal with that when we know how to do it better. Cheers Patrick From Roger.Riggs at Oracle.com Thu Jul 14 20:15:02 2016 From: Roger.Riggs at Oracle.com (Roger Riggs) Date: Thu, 14 Jul 2016 16:15:02 -0400 Subject: RFR: 9: 8161011: Mark test/java/rmi/activation/ActivationGroup/downloadActivationGroup/DownloadActivationGroup.java as itnermittent In-Reply-To: <51ecff4a-2f2b-6ea0-1ef0-0e308c756abb@oracle.com> References: <51ecff4a-2f2b-6ea0-1ef0-0e308c756abb@oracle.com> Message-ID: <6a3aea6b-2072-8e19-6e4e-a0b8bb9e9319@Oracle.com> +1, fine to mark as intermittent. Roger On 7/13/2016 5:35 PM, Rajan Halade wrote: > Ping.... > > I extended this to include two more tests to be marked as intermittent. > > Webrev: http://cr.openjdk.java.net/~rhalade/8161011/webrev.00/ > > Thanks, > Rajan > > On 7/7/16 3:59 PM, Rajan Halade wrote: >> This test is seen to fail intermittently due to JDK-8085192. Please >> review following patch which marks it as intermittent. >> >> diff -r 848c94ca6394 >> test/java/rmi/activation/ActivationGroup/downloadActivationGroup/DownloadActivationGroup.java >> --- >> a/test/java/rmi/activation/ActivationGroup/downloadActivationGroup/DownloadActivationGroup.java >> Thu Jul 07 14:16:58 2016 -0700 >> +++ >> b/test/java/rmi/activation/ActivationGroup/downloadActivationGroup/DownloadActivationGroup.java >> Thu Jul 07 15:55:14 2016 -0700 >> @@ -24,6 +24,7 @@ >> /* >> * @test >> * @bug 4510355 >> + * @key intermittent >> * @summary ActivationGroup implementations cannot be downloaded by >> default; >> * Creates a custom activation group without setting a security manager >> * in activation group's descriptor. The custom activation group >> >> Thanks, >> Rajan > From Alan.Bateman at oracle.com Thu Jul 14 20:52:53 2016 From: Alan.Bateman at oracle.com (Alan Bateman) Date: Thu, 14 Jul 2016 21:52:53 +0100 Subject: RFR: 8140723: Remove source code conditionalized on JAVASE_EMBEDDED In-Reply-To: References: Message-ID: <5fbe01f5-61aa-75da-ae55-a90bb557afa8@oracle.com> On 14/07/2016 05:25, David Holmes wrote: > The bug report for this is confidential but quite simply all of the > little tweaks and knobs we added to the open build and source files to > support the Java SE Embedded product no longer need to be there for > JDK 9. Many of them have already been removed via other changes but > this cleans up the rest. > > webrev: http://cr.openjdk.java.net/~dholmes/8140723/webrev.jdk/ Looks okay to me, hopefully the line in BUILD_LIBAWT_XAWT_XToolkit.c_CFLAGS can be removed. -Alan From xueming.shen at oracle.com Thu Jul 14 21:45:32 2016 From: xueming.shen at oracle.com (Xueming Shen) Date: Thu, 14 Jul 2016 14:45:32 -0700 Subject: RFR 8161426: Test java/util/zip/InflaterInputStream/TestAvailable.java fails on open-only linux Message-ID: <578807FC.9060709@oracle.com> Brian, Would you please help review the change for JDK-8161426. The test case I pushed back yesterday fails in corner case when the Random.nextInt(n) returns 0, in which we have a 0-length data/src byte[]. issue: https://bugs.openjdk.java.net/browse/JDK-8161426 webrev: http://cr.openjdk.java.net/~sherman/8161426/webrev Thanks, Sherman From brian.burkhalter at oracle.com Thu Jul 14 21:57:27 2016 From: brian.burkhalter at oracle.com (Brian Burkhalter) Date: Thu, 14 Jul 2016 14:57:27 -0700 Subject: Fwd: RFR 8161426: Test java/util/zip/InflaterInputStream/TestAvailable.java fails on open-only linux References: <38101CFB-DDBB-4F53-9FDD-1BCC106ACA26@oracle.com> Message-ID: <88B63A71-8A48-4706-8C53-BBCBF8F8C941@oracle.com> HI Sherman, Approved. I should have caught that myself yesterday: I?ve made that same mistake in the past. Brian On Jul 14, 2016, at 2:45 PM, Xueming Shen wrote: > Would you please help review the change for JDK-8161426. The test case > I pushed back yesterday fails in corner case when the Random.nextInt(n) > returns 0, in which we have a 0-length data/src byte[]. > > issue: https://bugs.openjdk.java.net/browse/JDK-8161426 > webrev: http://cr.openjdk.java.net/~sherman/8161426/webrev From david.holmes at oracle.com Fri Jul 15 05:07:11 2016 From: david.holmes at oracle.com (David Holmes) Date: Fri, 15 Jul 2016 15:07:11 +1000 Subject: RFR: 8140723: Remove source code conditionalized on JAVASE_EMBEDDED In-Reply-To: <3EBF058B-88CF-4851-B0E7-069884DBA881@oracle.com> References: <3EBF058B-88CF-4851-B0E7-069884DBA881@oracle.com> Message-ID: <932cfb78-8079-d0e8-24fc-fc5b34c76033@oracle.com> Thanks for the review Paul! David On 14/07/2016 11:12 PM, Paul Sandoz wrote: > >> On 14 Jul 2016, at 06:25, David Holmes wrote: >> >> The bug report for this is confidential but quite simply all of the little tweaks and knobs we added to the open build and source files to support the Java SE Embedded product no longer need to be there for JDK 9. Many of them have already been removed via other changes but this cleans up the rest. >> >> webrev: http://cr.openjdk.java.net/~dholmes/8140723/webrev.jdk/ >> >> The changes relate to: >> - Java version information >> - isEmbedded() check in test code Platform.java >> - special AWT build settings for Embedded >> - special Toolkit handling for Embedded >> >> In make/lib/Awt2dLibraries.gmk I commented out a setting which was seemingly introduced only to support (old) embedded releases: >> >> # decimal constant is unsigned only in ISO C90 (JAVASE_EMBEDDED) >> BUILD_LIBAWT_XAWT_XToolkit.c_CFLAGS := -w >> >> which I think pertained to: >> >> #define DEF_AWT_MAX_POLL_TIMEOUT ((uint32_t)4000000000) >> >> Unless AWT folk indicate otherwise I will delete those two lines in final push. >> > > +1 > > Paul. > From david.holmes at oracle.com Fri Jul 15 05:07:31 2016 From: david.holmes at oracle.com (David Holmes) Date: Fri, 15 Jul 2016 15:07:31 +1000 Subject: RFR: 8140723: Remove source code conditionalized on JAVASE_EMBEDDED In-Reply-To: <5fbe01f5-61aa-75da-ae55-a90bb557afa8@oracle.com> References: <5fbe01f5-61aa-75da-ae55-a90bb557afa8@oracle.com> Message-ID: <297d8081-a90f-f0e1-a4db-cc0474ca4203@oracle.com> Thanks for the review Alan! David On 15/07/2016 6:52 AM, Alan Bateman wrote: > > > On 14/07/2016 05:25, David Holmes wrote: >> The bug report for this is confidential but quite simply all of the >> little tweaks and knobs we added to the open build and source files to >> support the Java SE Embedded product no longer need to be there for >> JDK 9. Many of them have already been removed via other changes but >> this cleans up the rest. >> >> webrev: http://cr.openjdk.java.net/~dholmes/8140723/webrev.jdk/ > Looks okay to me, hopefully the line in > BUILD_LIBAWT_XAWT_XToolkit.c_CFLAGS can be removed. > > -Alan From joe.darcy at oracle.com Fri Jul 15 05:56:26 2016 From: joe.darcy at oracle.com (joe darcy) Date: Thu, 14 Jul 2016 22:56:26 -0700 Subject: RFR 8054213: Class name repeated in output of Type.toString() In-Reply-To: <57865FBB.2020909@oracle.com> References: <57644535.3060709@oracle.com> <576D2072.4050701@oracle.com> <57716F7C.9080003@oracle.com> <5772C121.4000507@oracle.com> <968e8fd5-285c-1f65-3e5f-f4cedf5ddfe5@oracle.com> <57754C8A.7040503@oracle.com> <577E7A22.2010202@oracle.com> <57865FBB.2020909@oracle.com> Message-ID: Hi Svetlana, Looks okay. I approve pushing the fix with the following change to the test: have the expected output align with the given output. The webrev shows 63 "FirstInnerClassGeneric$SecondInnerClassGeneric") 64 public FirstInnerClassGeneric.SecondInnerClassGeneric foo1() and I think this is clearer as 63 "FirstInnerClassGeneric$SecondInnerClassGeneric") 64 public FirstInnerClassGeneric.SecondInnerClassGeneric foo1() even if the spacing is less conventional. No need to generate another webrev. Cheers, -Joe On 7/13/2016 8:35 AM, Svetlana Nikandrova wrote: > Kindly reminder. > > On 07.07.2016 18:49, Svetlana Nikandrova wrote: >> Hello all, >> >> seems like Joe is busy right now, so meanwhile I'll be happy to hear >> other opinions on this topic. >> >> Thank you, >> Svetlana >> >> On 30.06.2016 19:44, Svetlana Nikandrova wrote: >>> Hello Joe, >>> >>> thank you for your advice! GenericStringTest looks really good with >>> annotations. I refactored my test, please see updated webrev: >>> http://cr.openjdk.java.net/~snikandrova/8054213/webrev.01/ >>> >>> >>> As for "." vs "$" let me provide an example: >>> E.g. we have class >>> public class Test { public Nested1.Nested2 foo() { >>> return null; } public class Nested1 { public class Nested2{} } } >>> The output of the >>> System.out.println(Test.class.getMethod("foo", >>> null).getReturnType()); Output: class Test$Nested1$Nested2 (nested >>> classes divided by "$") >>> while >>> System.out.println(Test.class.getMethod("foo", >>> null).getGenericReturnType()); Output: >>> Test$Nested1.Nested2 (nested classes divided by "." if >>> enclosed by parametrized type and "$" in other cases). >>> I think it's a little bit strange to have different separators for >>> inner classes depended on is it nested by parametrized or raw type. >>> >>> Thank you, >>> Svetlana >>> >>> On 28.06.2016 22:02, joe darcy wrote: >>>> Hello Svetlana, >>>> >>>> I'm not convinced '$' should be replaced with '.' in this context >>>> as '.' is what the separator used in source code. >>>> >>>> In any case, the test should be restructured. I recommend declaring >>>> an annotation type to hold the expected to string output. You can >>>> them loop over the methods from the class object and for the >>>> methods with the annotation verifying the toString output is as >>>> expected. For a guide see >>>> >>>> test/java/lang/reflect/Constructor/GenericStringTest.java >>>> >>>> Thanks, >>>> >>>> -Joe >>>> >>>> >>>> On 6/28/2016 11:25 AM, Svetlana Nikandrova wrote: >>>>> May be someone can find a minute? >>>>> >>>>> On 27.06.2016 21:25, Svetlana Nikandrova wrote: >>>>>> Kindly reminder >>>>>> >>>>>> On 24.06.2016 14:58, Svetlana Nikandrova wrote: >>>>>>> Hello, >>>>>>> >>>>>>> let me try again with updated version of webrev: >>>>>>> Webrev: >>>>>>> http://cr.openjdk.java.net/~snikandrova/8054213/webrev.01/ >>>>>>> >>>>>>> Issue: >>>>>>> https://bugs.openjdk.java.net/browse/JDK-8054213 >>>>>>> >>>>>>> Many thanks goes to Sergey Ustimenko for his valuable advises. I >>>>>>> believe fix looks nicer now. >>>>>>> JPRT tested. >>>>>>> >>>>>>> Thank you, >>>>>>> Svetlana >>>>>>> >>>>>>> On 17.06.2016 21:45, Svetlana Nikandrova wrote: >>>>>>>> Hello, >>>>>>>> >>>>>>>> could you please review this fix for toString() method of >>>>>>>> ParameterizedTypeImpl. >>>>>>>> The problem is that when we obtain simple name of nested type >>>>>>>> shared prefix is only removed for ParameterizedType owner. We >>>>>>>> need to remove it for other cases too. >>>>>>>> >>>>>>>> Please note that I also changed delimiter between outer and >>>>>>>> inner class from "." to "$". I believe as "$" is usually used >>>>>>>> to separate nested class name "." looks inconsistent and >>>>>>>> confusing. >>>>>>>> Let me know if you have any objections. >>>>>>>> >>>>>>>> Webrev: >>>>>>>> http://cr.openjdk.java.net/~msolovie/8054213/webrev.00/ >>>>>>>> >>>>>>>> Issue: >>>>>>>> https://bugs.openjdk.java.net/browse/JDK-8054213 >>>>>>>> >>>>>>>> Thank you, >>>>>>>> Svetlana >>>>>>> >>>>>> >>>>> >>>> >>> >> > From ramanand.patil at oracle.com Fri Jul 15 06:49:00 2016 From: ramanand.patil at oracle.com (Ramanand Patil) Date: Thu, 14 Jul 2016 23:49:00 -0700 (PDT) Subject: RFR: 8159684: (tz) Support tzdata2016f In-Reply-To: References: <2c87fb50-c44c-42fc-8189-093c265814d0@default> Message-ID: Hi Masayoshi, The reason for adding bugId(8159684) to TimeZoneTest.java was, it actually tests the major change in the releases tzdata2016e and tzdata2016f. tzdata2016e: "Africa/Cairo observes DST in 2016 from July 7 to the end of October." tzdata201f: The Egyptian government changed its mind on short notice, and Africa/Cairo will not introduce DST starting 2016-07-07 after all. After integrating, tzdata2016e, TimeZoneTest.java was failing because at line no. 123 DST was false which should be true. (new ZoneDescriptor("ART", 120, false)) And integrating tzdata2016f has again made the DST false in the test case. Since the bug covers both the changes, I kept the bugID in the test case. Please let me know if I still need to remove the bugID from test case. Regards, Ramanand. -----Original Message----- From: Masayoshi Okutsu Sent: Wednesday, July 13, 2016 12:14 PM To: Ramanand Patil; i18n-dev at openjdk.java.net Cc: core-libs-dev at openjdk.java.net Subject: Re: RFR: 8159684: (tz) Support tzdata2016f I don't think it's appropriate to add 8159684 to TimeZoneTest.java which doesn't test the data changes of 2016e/f at all. I think there should be a time zone data test in java.time to confirm the tzdata changes. Otherwise, the changes look good to me. Thanks, Masayoshi On 7/12/2016 6:27 PM, Ramanand Patil wrote: > Hi all, > > Please review the latest TZDATA integration (tzdata2016f) to JDK9. > Bug: https://bugs.openjdk.java.net/browse/JDK-8159684 > Webrev: http://cr.openjdk.java.net/~rpatil/8159684/webrev.00/ > > All the TimeZone related tests are passed after this integration. > > Regards, > Ramanand. From paul.sandoz at oracle.com Fri Jul 15 15:10:15 2016 From: paul.sandoz at oracle.com (Paul Sandoz) Date: Fri, 15 Jul 2016 17:10:15 +0200 Subject: Create java.util.stream.Stream from Iterator / Enumeration In-Reply-To: References: <96449a94df44b8a26d9c1abb800baef5@reini.net> <2239A562-0696-47D3-B63C-CD6ECB06EAF5@oracle.com> <7519b84f-6259-701e-4c36-3bd4e4118bff@reini.net> <5ddfd52d9b9b5ac20e52f3ebd85f70b5@reini.net> <57854411.3030602@reini.net> <9A267516-581F-4D2F-BB20-DDECA64BE722@oracle.com> Message-ID: > On 14 Jul 2016, at 17:55, Patrick Reinhart wrote: > > Hi Paul, > > On 2016-07-13 10:28, Paul Sandoz wrote: > >> I see some comments already by Stuart and Alan, and concur with Alan >> about working closely with jigsaw-dev. >> Focusing on the public methods is good and then it will come down to >> naming them appropriately. Given that sub-classes can override the >> existing public Enumeration returning methods we most likely need to >> specify the implementation behaviour of the Stream returning methods >> i.e. specify in an @implSpec that they call the Enumeration returning >> methods. Later on it may be possible to sub-types to implement more >> optimally (but the Enumeration ?string? is quite long and intertwined >> with the internal code base) > > When I understand you correctly here we should concentrate on the public > methods naming firstly? I initially was not sure, what a proper naming > for the steams method was. It seem to me reasonable the way Stuart pointed > them out on his first comment to name them something like this: > > Stream resources(String name) > Stream systemResources(String name) > Yes. > Has anyone a better naming suggestion? For me those names would fit so > far. If we look into the stream characteristics I would suggest that it > has a unknown size and is immutable in both cases. Maybe the entries are > also distinct, but there I'm not sure. > I would expect the URLs to be distinct, but that might not be consistent with URL.equals i.e. i don?t trust URL handlers :-) therefore i would be wary of including the DISTINCT characteristic. Paul. > >> The protected findResources method may be trickier, i suggest leaving >> that one alone for now. > > From the point of a consumer of the public API I have no problems with > this approach, as I created the enhancement issue on the public methods > anyway. > > Better to deal with that when we know how to do it better. > > Cheers Patrick From svetlana.nikandrova at oracle.com Fri Jul 15 15:28:14 2016 From: svetlana.nikandrova at oracle.com (Svetlana Nikandrova) Date: Fri, 15 Jul 2016 18:28:14 +0300 Subject: RFR 8054213: Class name repeated in output of Type.toString() In-Reply-To: References: <57644535.3060709@oracle.com> <576D2072.4050701@oracle.com> <57716F7C.9080003@oracle.com> <5772C121.4000507@oracle.com> <968e8fd5-285c-1f65-3e5f-f4cedf5ddfe5@oracle.com> <57754C8A.7040503@oracle.com> <577E7A22.2010202@oracle.com> <57865FBB.2020909@oracle.com> Message-ID: <5789010E.3070907@oracle.com> Thank you, Joe! Sure, I'll change alignment in the test. Thanks, Svetlana On 15.07.2016 8:56, joe darcy wrote: > > Hi Svetlana, > > Looks okay. > > I approve pushing the fix with the following change to the test: have > the expected output align with the given output. The webrev shows > > 63 "FirstInnerClassGeneric$SecondInnerClassGeneric") > 64 public FirstInnerClassGeneric.SecondInnerClassGeneric foo1() > > and I think this is clearer as > > 63 "FirstInnerClassGeneric$SecondInnerClassGeneric") > 64 public FirstInnerClassGeneric.SecondInnerClassGeneric foo1() > > even if the spacing is less conventional. > > No need to generate another webrev. > > Cheers, > > -Joe > > > On 7/13/2016 8:35 AM, Svetlana Nikandrova wrote: >> Kindly reminder. >> >> On 07.07.2016 18:49, Svetlana Nikandrova wrote: >>> Hello all, >>> >>> seems like Joe is busy right now, so meanwhile I'll be happy to hear >>> other opinions on this topic. >>> >>> Thank you, >>> Svetlana >>> >>> On 30.06.2016 19:44, Svetlana Nikandrova wrote: >>>> Hello Joe, >>>> >>>> thank you for your advice! GenericStringTest looks really good with >>>> annotations. I refactored my test, please see updated webrev: >>>> http://cr.openjdk.java.net/~snikandrova/8054213/webrev.01/ >>>> >>>> >>>> As for "." vs "$" let me provide an example: >>>> E.g. we have class >>>> public classTest { >>>> >>>> publicNested1.Nested2 foo() >>>> { >>>> return null; >>>> } >>>> >>>> public classNested1 >>>> { >>>> public classNested2{} >>>> } >>>> } >>>> The output of the >>>> System.out.println(Test.class.getMethod("foo",null).getReturnType()); >>>> Output: >>>> class Test$Nested1$Nested2 (nested classes divided by "$") >>>> while >>>> System.out.println(Test.class.getMethod("foo",null).getGenericReturnType()); >>>> Output: >>>> Test$Nested1.Nested2(nested classes divided by "." if enclosed by parametrized type and "$" in other cases). >>>> I think it's a little bit strange to have different separators for >>>> inner classes depended on is it nested by parametrized or raw type. >>>> >>>> Thank you, >>>> Svetlana >>>> >>>> On 28.06.2016 22:02, joe darcy wrote: >>>>> Hello Svetlana, >>>>> >>>>> I'm not convinced '$' should be replaced with '.' in this context >>>>> as '.' is what the separator used in source code. >>>>> >>>>> In any case, the test should be restructured. I recommend >>>>> declaring an annotation type to hold the expected to string >>>>> output. You can them loop over the methods from the class object >>>>> and for the methods with the annotation verifying the toString >>>>> output is as expected. For a guide see >>>>> >>>>> test/java/lang/reflect/Constructor/GenericStringTest.java >>>>> >>>>> Thanks, >>>>> >>>>> -Joe >>>>> >>>>> >>>>> On 6/28/2016 11:25 AM, Svetlana Nikandrova wrote: >>>>>> May be someone can find a minute? >>>>>> >>>>>> On 27.06.2016 21:25, Svetlana Nikandrova wrote: >>>>>>> Kindly reminder >>>>>>> >>>>>>> On 24.06.2016 14:58, Svetlana Nikandrova wrote: >>>>>>>> Hello, >>>>>>>> >>>>>>>> let me try again with updated version of webrev: >>>>>>>> Webrev: >>>>>>>> http://cr.openjdk.java.net/~snikandrova/8054213/webrev.01/ >>>>>>>> >>>>>>>> Issue: >>>>>>>> https://bugs.openjdk.java.net/browse/JDK-8054213 >>>>>>>> >>>>>>>> Many thanks goes to Sergey Ustimenko for his valuable advises. >>>>>>>> I believe fix looks nicer now. >>>>>>>> JPRT tested. >>>>>>>> >>>>>>>> Thank you, >>>>>>>> Svetlana >>>>>>>> >>>>>>>> On 17.06.2016 21:45, Svetlana Nikandrova wrote: >>>>>>>>> Hello, >>>>>>>>> >>>>>>>>> could you please review this fix for toString() method of >>>>>>>>> ParameterizedTypeImpl. >>>>>>>>> The problem is that when we obtain simple name of nested type >>>>>>>>> shared prefix is only removed for ParameterizedType owner. We >>>>>>>>> need to remove it for other cases too. >>>>>>>>> >>>>>>>>> Please note that I also changed delimiter between outer and >>>>>>>>> inner class from "." to "$". I believe as "$" is usually used >>>>>>>>> to separate nested class name "." looks inconsistent and >>>>>>>>> confusing. >>>>>>>>> Let me know if you have any objections. >>>>>>>>> >>>>>>>>> Webrev: >>>>>>>>> http://cr.openjdk.java.net/~msolovie/8054213/webrev.00/ >>>>>>>>> >>>>>>>>> Issue: >>>>>>>>> https://bugs.openjdk.java.net/browse/JDK-8054213 >>>>>>>>> >>>>>>>>> Thank you, >>>>>>>>> Svetlana >>>>>>>> >>>>>>> >>>>>> >>>>> >>>> >>> >> > From brian.burkhalter at oracle.com Fri Jul 15 19:17:11 2016 From: brian.burkhalter at oracle.com (Brian Burkhalter) Date: Fri, 15 Jul 2016 12:17:11 -0700 Subject: JDK 9 RFR of 8161413: Math.fma javadoc doesn't have @since 9 [doc-only] Message-ID: Please review @ your convenience. Issue: https://bugs.openjdk.java.net/browse/JDK-8161413 Patch: [1] Thanks, Brian [1] diff --- a/src/java.base/share/classes/java/lang/Math.java +++ b/src/java.base/share/classes/java/lang/Math.java @@ -1613,6 +1613,8 @@ * @return (a × b + c) * computed, as if with unlimited range and precision, and rounded * once to the nearest {@code double} value + * + * @since 9 */ // @HotSpotIntrinsicCandidate public static double fma(double a, double b, double c) { @@ -1728,6 +1730,8 @@ * @return (a × b + c) * computed, as if with unlimited range and precision, and rounded * once to the nearest {@code float} value + * + * @since 9 */ // @HotSpotIntrinsicCandidate public static float fma(float a, float b, float c) { --- a/src/java.base/share/classes/java/lang/StrictMath.java +++ b/src/java.base/share/classes/java/lang/StrictMath.java @@ -1276,6 +1276,8 @@ * @return (a × b + c) * computed, as if with unlimited range and precision, and rounded * once to the nearest {@code double} value + * + * @since 9 */ public static double fma(double a, double b, double c) { return Math.fma(a, b, c); @@ -1328,6 +1330,8 @@ * @return (a × b + c) * computed, as if with unlimited range and precision, and rounded * once to the nearest {@code float} value + * + * @since 9 */ public static float fma(float a, float b, float c) { return Math.fma(a, b, c); From Roger.Riggs at Oracle.com Fri Jul 15 19:24:37 2016 From: Roger.Riggs at Oracle.com (Roger Riggs) Date: Fri, 15 Jul 2016 15:24:37 -0400 Subject: JDK 9 RFR of 8161413: Math.fma javadoc doesn't have @since 9 [doc-only] In-Reply-To: References: Message-ID: <8dcdb306-d4fb-bd59-87b9-4bff0ffba807@Oracle.com> +1 On 7/15/2016 3:17 PM, Brian Burkhalter wrote: > Please review @ your convenience. > > Issue: https://bugs.openjdk.java.net/browse/JDK-8161413 > Patch: [1] > > Thanks, > > Brian > > [1] diff > > --- a/src/java.base/share/classes/java/lang/Math.java > +++ b/src/java.base/share/classes/java/lang/Math.java > @@ -1613,6 +1613,8 @@ > * @return (a × b + c) > * computed, as if with unlimited range and precision, and rounded > * once to the nearest {@code double} value > + * > + * @since 9 > */ > // @HotSpotIntrinsicCandidate > public static double fma(double a, double b, double c) { > > @@ -1728,6 +1730,8 @@ > * @return (a × b + c) > * computed, as if with unlimited range and precision, and rounded > * once to the nearest {@code float} value > + * > + * @since 9 > */ > // @HotSpotIntrinsicCandidate > public static float fma(float a, float b, float c) { > > > --- a/src/java.base/share/classes/java/lang/StrictMath.java > +++ b/src/java.base/share/classes/java/lang/StrictMath.java > @@ -1276,6 +1276,8 @@ > * @return (a × b + c) > * computed, as if with unlimited range and precision, and rounded > * once to the nearest {@code double} value > + * > + * @since 9 > */ > public static double fma(double a, double b, double c) { > return Math.fma(a, b, c); > > @@ -1328,6 +1330,8 @@ > * @return (a × b + c) > * computed, as if with unlimited range and precision, and rounded > * once to the nearest {@code float} value > + * > + * @since 9 > */ > public static float fma(float a, float b, float c) { > return Math.fma(a, b, c); > From brian.burkhalter at oracle.com Fri Jul 15 19:29:05 2016 From: brian.burkhalter at oracle.com (Brian Burkhalter) Date: Fri, 15 Jul 2016 12:29:05 -0700 Subject: [doc-only] JDK 9 RFR of 8161455: Missing word in API documentation Message-ID: Please review at your convenience. Issue: https://bugs.openjdk.java.net/browse/JDK-8161455 Patch: [1] Thanks, Brian [1] diff --- a/src/java.base/share/classes/java/nio/file/Files.java +++ b/src/java.base/share/classes/java/nio/file/Files.java @@ -3290,8 +3290,8 @@ * a size of {@code 0}. All bytes in the byte array are written to the file. * The method ensures that the file is closed when all bytes have been * written (or an I/O error or other runtime exception is thrown). If an I/O - * error occurs then it may do so after the file has created or truncated, - * or after some bytes have been written to the file. + * error occurs then it may do so after the file has been created or + * truncated, or after some bytes have been written to the file. * *

Usage example: By default the method creates a new file or * overwrites an existing file. Suppose you instead want to append bytes @@ -3360,7 +3360,8 @@ * a size of {@code 0}. The method ensures that the file is closed when all * lines have been written (or an I/O error or other runtime exception is * thrown). If an I/O error occurs then it may do so after the file has - * created or truncated, or after some bytes have been written to the file. + * been created or truncated, or after some bytes have been written to the + * file. * * @param path * the path to the file From Roger.Riggs at Oracle.com Fri Jul 15 19:32:45 2016 From: Roger.Riggs at Oracle.com (Roger Riggs) Date: Fri, 15 Jul 2016 15:32:45 -0400 Subject: [doc-only] JDK 9 RFR of 8161455: Missing word in API documentation In-Reply-To: References: Message-ID: +1 On 7/15/2016 3:29 PM, Brian Burkhalter wrote: > Please review at your convenience. > > Issue: https://bugs.openjdk.java.net/browse/JDK-8161455 > Patch: [1] > > Thanks, > > Brian > > [1] diff > > --- a/src/java.base/share/classes/java/nio/file/Files.java > +++ b/src/java.base/share/classes/java/nio/file/Files.java > @@ -3290,8 +3290,8 @@ > * a size of {@code 0}. All bytes in the byte array are written to the file. > * The method ensures that the file is closed when all bytes have been > * written (or an I/O error or other runtime exception is thrown). If an I/O > - * error occurs then it may do so after the file has created or truncated, > - * or after some bytes have been written to the file. > + * error occurs then it may do so after the file has been created or > + * truncated, or after some bytes have been written to the file. > * > *

Usage example: By default the method creates a new file or > * overwrites an existing file. Suppose you instead want to append bytes > @@ -3360,7 +3360,8 @@ > * a size of {@code 0}. The method ensures that the file is closed when all > * lines have been written (or an I/O error or other runtime exception is > * thrown). If an I/O error occurs then it may do so after the file has > - * created or truncated, or after some bytes have been written to the file. > + * been created or truncated, or after some bytes have been written to the > + * file. > * > * @param path > * the path to the file From Alan.Bateman at oracle.com Fri Jul 15 19:32:56 2016 From: Alan.Bateman at oracle.com (Alan Bateman) Date: Fri, 15 Jul 2016 20:32:56 +0100 Subject: [doc-only] JDK 9 RFR of 8161455: Missing word in API documentation In-Reply-To: References: Message-ID: <9d95fd70-63c4-a731-ca66-f73bd56a3153@oracle.com> On 15/07/2016 20:29, Brian Burkhalter wrote: > Please review at your convenience. > > Issue: https://bugs.openjdk.java.net/browse/JDK-8161455 > Patch: [1] > > This looks fine. -Alan From steve.drach at oracle.com Fri Jul 15 21:17:02 2016 From: steve.drach at oracle.com (Steve Drach) Date: Fri, 15 Jul 2016 14:17:02 -0700 Subject: RFR: 8157524 Revert JarFile methods "entries" and "stream" to Java 8 behavior Message-ID: <152083C7-7593-4231-BD0C-F0734B16E14E@oracle.com> Hi, Please review this change to JarFile that reverts JarFile::stream and JarFile::entries to JDK 8 behavior. The code is identical to that in JDK 8 except line 504 in JarEntryIterator that now uses a different constructor to create a JarFileEntry. I also added some implementation notes explaining how to create a versionedStream and a versionedEntries method. issue: https://bugs.openjdk.java.net/browse/JDK-8157524 webrev: http://cr.openjdk.java.net/~sdrach/8157524/webrev/index.html Thanks, Steve From claes.redestad at oracle.com Fri Jul 15 23:07:34 2016 From: claes.redestad at oracle.com (Claes Redestad) Date: Sat, 16 Jul 2016 01:07:34 +0200 Subject: RFR: 8157524 Revert JarFile methods "entries" and "stream" to Java 8 behavior In-Reply-To: <152083C7-7593-4231-BD0C-F0734B16E14E@oracle.com> References: <152083C7-7593-4231-BD0C-F0734B16E14E@oracle.com> Message-ID: <57896CB6.8070900@oracle.com> Hi, this looks good to me, and it makes sense to me that upgrading to Java 9 and using this API on a Multi-release JAR doesn't suddenly filter out entries. /Claes On 2016-07-15 23:17, Steve Drach wrote: > Hi, > > Please review this change to JarFile that reverts JarFile::stream and JarFile::entries to JDK 8 behavior. The code is identical to that in JDK 8 except line 504 in JarEntryIterator that now uses a different constructor to create a JarFileEntry. I also added some implementation notes explaining how to create a versionedStream and a versionedEntries method. > > issue: https://bugs.openjdk.java.net/browse/JDK-8157524 > webrev: http://cr.openjdk.java.net/~sdrach/8157524/webrev/index.html > > Thanks, > Steve > From joe.darcy at oracle.com Fri Jul 15 23:17:18 2016 From: joe.darcy at oracle.com (Joseph D. Darcy) Date: Fri, 15 Jul 2016 16:17:18 -0700 Subject: JDK 9 RFR of JDK-8161500: Use getTypeName and StringJoiner in core reflection toString methods Message-ID: <57896EFE.6080507@oracle.com> Hello, Please review this straightforward cleanup of some of the core reflection implementation classes: JDK-8161500: Use getTypeName and StringJoiner in core reflection toString methods http://cr.openjdk.java.net/~darcy/8161500.1/ All java/lang/Class and java/lang/reflect regression tests pass with this patch. (If the fix for JDK-8054213: "Class name repeated in output of Type.toString()" is pushed before this fix, a simple merge will be needed.) Thanks, -Joe From claes.redestad at oracle.com Fri Jul 15 23:55:01 2016 From: claes.redestad at oracle.com (Claes Redestad) Date: Sat, 16 Jul 2016 01:55:01 +0200 Subject: JDK 9 RFR of JDK-8161500: Use getTypeName and StringJoiner in core reflection toString methods In-Reply-To: <57896EFE.6080507@oracle.com> References: <57896EFE.6080507@oracle.com> Message-ID: <578977D5.3010808@oracle.com> Looks OK, although I find: StringJoiner sj = StringJoiner(delimiter, before, after); ... sb.append(sj.toString()); to be a messier read than: sb.append(before); StringJoiner sj = new StringJoiner(delimiter); ... sb.append(sj.toString()) .append(after); Any of these are ever used in a performance sensitive manner? I assume no, but still curious. :-) /Claes On 2016-07-16 01:17, Joseph D. Darcy wrote: > Hello, > > Please review this straightforward cleanup of some of the core > reflection implementation classes: > > JDK-8161500: Use getTypeName and StringJoiner in core reflection > toString methods > http://cr.openjdk.java.net/~darcy/8161500.1/ > > All java/lang/Class and java/lang/reflect regression tests pass with > this patch. > > (If the fix for JDK-8054213: "Class name repeated in output of > Type.toString()" is pushed before this fix, a simple merge will be needed.) > > Thanks, > > -Joe From david.holmes at oracle.com Fri Jul 15 23:55:23 2016 From: david.holmes at oracle.com (David Holmes) Date: Sat, 16 Jul 2016 09:55:23 +1000 Subject: RFR: 8140723: Remove source code conditionalized on JAVASE_EMBEDDED In-Reply-To: References: Message-ID: Can I please get someone from AWT to approve this. Thanks, David On 14/07/2016 2:25 PM, David Holmes wrote: > The bug report for this is confidential but quite simply all of the > little tweaks and knobs we added to the open build and source files to > support the Java SE Embedded product no longer need to be there for JDK > 9. Many of them have already been removed via other changes but this > cleans up the rest. > > webrev: http://cr.openjdk.java.net/~dholmes/8140723/webrev.jdk/ > > The changes relate to: > - Java version information > - isEmbedded() check in test code Platform.java > - special AWT build settings for Embedded > - special Toolkit handling for Embedded > > In make/lib/Awt2dLibraries.gmk I commented out a setting which was > seemingly introduced only to support (old) embedded releases: > > # decimal constant is unsigned only in ISO C90 (JAVASE_EMBEDDED) > BUILD_LIBAWT_XAWT_XToolkit.c_CFLAGS := -w > > which I think pertained to: > > #define DEF_AWT_MAX_POLL_TIMEOUT ((uint32_t)4000000000) > > Unless AWT folk indicate otherwise I will delete those two lines in > final push. > > Thanks, > David > ----- From Alan.Bateman at oracle.com Sat Jul 16 07:29:12 2016 From: Alan.Bateman at oracle.com (Alan Bateman) Date: Sat, 16 Jul 2016 08:29:12 +0100 Subject: RFR: 8157524 Revert JarFile methods "entries" and "stream" to Java 8 behavior In-Reply-To: <152083C7-7593-4231-BD0C-F0734B16E14E@oracle.com> References: <152083C7-7593-4231-BD0C-F0734B16E14E@oracle.com> Message-ID: <0be2a17f-7fad-64d9-6b97-7568473cb7c9@oracle.com> On 15/07/2016 22:17, Steve Drach wrote: > Hi, > > Please review this change to JarFile that reverts JarFile::stream and JarFile::entries to JDK 8 behavior. The code is identical to that in JDK 8 except line 504 in JarEntryIterator that now uses a different constructor to create a JarFileEntry. I also added some implementation notes explaining how to create a versionedStream and a versionedEntries method. > > issue: https://bugs.openjdk.java.net/browse/JDK-8157524 > webrev: http://cr.openjdk.java.net/~sdrach/8157524/webrev/index.html > This looks okay to me. For @implNote then you can put the example in {@code ...} and that will allow to use angled brackets (no need for < etc). In ModulePath then it would be good to move versionedStream to jarPackages. A comment on the method would be useful too although we have other changes coming to this code so we can do it then. -Alan From david.holmes at oracle.com Mon Jul 18 00:19:39 2016 From: david.holmes at oracle.com (David Holmes) Date: Mon, 18 Jul 2016 10:19:39 +1000 Subject: Breakages in jdk9/dev Message-ID: <5d257254-a669-1c76-d3fb-099adb174aed@oracle.com> FYI: It appears some changes in the JDK are exposing some bugs in the JVM. The following crash appears on OSX, and can happen during the build process: https://bugs.openjdk.java.net/browse/JDK-8155781 The following runtime crash may also be seen on 64-bit: https://bugs.openjdk.java.net/browse/JDK-8161550 David From amy.lu at oracle.com Mon Jul 18 06:46:58 2016 From: amy.lu at oracle.com (Amy Lu) Date: Mon, 18 Jul 2016 14:46:58 +0800 Subject: JDK 9 RFR of JDK-8161567: Mark java/util/concurrent/forkjoin/FJExceptionTableLeak.java as intermittently failing Message-ID: <578C7B62.3060105@oracle.com> java/util/concurrent/forkjoin/FJExceptionTableLeak.java Test was ever fixed in JDK-8144990, but still failing intermittently as reported in JDK-8151158. This patch is to add back @key intermittent to the test. (and keep it in tier2 till issue resolved.) Please review. bug: https://bugs.openjdk.java.net/browse/JDK-8161567 webrev: http://cr.openjdk.java.net/~amlu/8161567/webrev.00/ Thanks, Amy --- old/test/java/util/concurrent/forkjoin/FJExceptionTableLeak.java 2016-07-18 14:37:25.000000000 +0800 +++ new/test/java/util/concurrent/forkjoin/FJExceptionTableLeak.java 2016-07-18 14:37:25.000000000 +0800 @@ -35,6 +35,7 @@ * @test * @author Doug Lea * @bug 8004138 + * @key intermittent * @summary Check if ForkJoinPool table leaks thrown exceptions. * @run main/othervm -Xmx8m -Djava.util.concurrent.ForkJoinPool.common.parallelism=4 FJExceptionTableLeak */ From paul.sandoz at oracle.com Mon Jul 18 08:23:23 2016 From: paul.sandoz at oracle.com (Paul Sandoz) Date: Mon, 18 Jul 2016 10:23:23 +0200 Subject: RFR: 8157524 Revert JarFile methods "entries" and "stream" to Java 8 behavior In-Reply-To: <152083C7-7593-4231-BD0C-F0734B16E14E@oracle.com> References: <152083C7-7593-4231-BD0C-F0734B16E14E@oracle.com> Message-ID: <1DC235CC-CCD2-447E-AD7D-CD41E7195CFA@oracle.com> > On 15 Jul 2016, at 23:17, Steve Drach wrote: > > Hi, > > Please review this change to JarFile that reverts JarFile::stream and JarFile::entries to JDK 8 behavior. The code is identical to that in JDK 8 except line 504 in JarEntryIterator that now uses a different constructor to create a JarFileEntry. I also added some implementation notes explaining how to create a versionedStream and a versionedEntries method. > > issue: https://bugs.openjdk.java.net/browse/JDK-8157524 > webrev: http://cr.openjdk.java.net/~sdrach/8157524/webrev/index.html > You should use an @apiNote, as this is presenting some interesting information on how to use this method and not some particular characteristics of the implementation. I would be inclined to drop the note for Enumeration and add a @see tag referencing the Stream returned method. Paul. From frank.yuan at oracle.com Mon Jul 18 09:32:32 2016 From: frank.yuan at oracle.com (Frank Yuan) Date: Mon, 18 Jul 2016 17:32:32 +0800 Subject: RFR (JAXP) JDK-8067170: Enable security manager on JAXP unit tests Message-ID: <022401d1e0d7$54111090$fc3331b0$@oracle.com> Hi Would you like to review http://cr.openjdk.java.net/~fyuan/8067170/webrev.00/? Bug: https://bugs.openjdk.java.net/browse/JDK-8067170 In this change, I enabled security manager for JAXP unit tests with improving the implementation approach and fixing some defects. Now jaxp tests use TestNG annotation to enable security manager and apply policies combination, like the following example(this full example is at: http://cr.openjdk.java.net/~fyuan/8067170/webrev.00/test/javax/xml/jaxp/unittest/parsers/Bug8003147Test.java.html): @Listeners({ jaxp.library.FilePolicy.class, jaxp.library.InternalAPIPolicy.class }) public class Bug8003147Test { There are also 2 additional patterns for some special cases: 1. JAXPTestUtilities.runWithTmpPermission(Runnable, Permission.) is used for some cases which require their own special permissions, e.g. http://cr.openjdk.java.net/~fyuan/8067170/webrev.00/test/javax/xml/jaxp/unittest/transform/CR6551600Test.java.sdiff.html. 2. JAXPTestUtilities.tryRunWithPolicyManager(Runnable, Permission.) is used for cases where some test methods need to be run with security manager and some others need to be run without security manager because they have different behaviors when having sm or not. E.g. http://cr.openjdk.java.net/~fyuan/8067170/webrev.00/test/javax/xml/jaxp/unittest/parsers/FactoryFindTest.java.sdiff.html. Such cases must run in single thread, all other cases don't require it, are thread safe. Btw, I moved internaltest into unittest because it's unnecessary to separate them. Thanks, Frank From amy.lu at oracle.com Mon Jul 18 09:42:14 2016 From: amy.lu at oracle.com (Amy Lu) Date: Mon, 18 Jul 2016 17:42:14 +0800 Subject: RFR (JAXP) JDK-8067170: Enable security manager on JAXP unit tests In-Reply-To: <022401d1e0d7$54111090$fc3331b0$@oracle.com> References: <022401d1e0d7$54111090$fc3331b0$@oracle.com> Message-ID: <578CA476.7030407@oracle.com> On 7/18/16 5:32 PM, Frank Yuan wrote: > Btw, I moved internaltest into unittest because it's unnecessary to separate them. Maybe you'd like to regenerate the webrev with hg move for those files? Thanks, Amy From claes.redestad at oracle.com Mon Jul 18 10:57:13 2016 From: claes.redestad at oracle.com (Claes Redestad) Date: Mon, 18 Jul 2016 12:57:13 +0200 Subject: RFR(S): 8161212: Test times out: java/lang/invoke/LoopCombinatorLongSignatureTest.java In-Reply-To: <44D4317A-C0A0-48D8-BA80-032848CC0B18@oracle.com> References: <44D4317A-C0A0-48D8-BA80-032848CC0B18@oracle.com> Message-ID: <578CB609.5040102@oracle.com> Hi, On 2016-07-13 15:12, Michael Haupt wrote: > Dear all, > > please review this fix. > Bug: https://bugs.openjdk.java.net/browse/JDK-8161212 > Webrev: http://cr.openjdk.java.net/~mhaupt/8161212/webrev.00/ fix looks OK, but I'm genuinely curious about best practice when it comes to pass arguments to jtreg tests. How do I even pass -run to the actual test? Naively System properties seems easier and possibly less fragile (assuming tests aren't run with a very strict security policy somewhere so that we'd have to pair the test with the associated permissions): jtreg ... -Djava.lang.invoke.LoopCombinatorLongSignatureTest.run java/lang/invoke/LoopCombinatorLongSignatureTest.java boolean run = System.getProperty("java.lang.invoke.LoopCombinatorLongSignatureTest.run") != null; Thanks! /Claes > > Running the test in LambdaForm interpretation mode takes a long time. As the test is actually about capturing excessively long loop clause lists, running the constructed loop should be optional. The fix disables running the loop by default and introduces a -run option that can be used if the loop should actually be run. > > Thanks, > > Michael > From michael.haupt at oracle.com Mon Jul 18 12:08:42 2016 From: michael.haupt at oracle.com (Michael Haupt) Date: Mon, 18 Jul 2016 14:08:42 +0200 Subject: RFR(S): 8161212: Test times out: java/lang/invoke/LoopCombinatorLongSignatureTest.java In-Reply-To: <578CB609.5040102@oracle.com> References: <44D4317A-C0A0-48D8-BA80-032848CC0B18@oracle.com> <578CB609.5040102@oracle.com> Message-ID: <9E189C4A-CCC1-4FD4-A193-7B26EA3408E4@oracle.com> Hi Claes, thank you. Of course you're right about the -run option; I've replaced this with a -D interface and pushed that version. Best, Michael > Am 18.07.2016 um 12:57 schrieb Claes Redestad : > > Hi, > > On 2016-07-13 15:12, Michael Haupt wrote: >> Dear all, >> >> please review this fix. >> Bug: https://bugs.openjdk.java.net/browse/JDK-8161212 >> Webrev: http://cr.openjdk.java.net/~mhaupt/8161212/webrev.00/ > > fix looks OK, but I'm genuinely curious about best practice when it comes to pass arguments to jtreg tests. How do I even pass -run to the actual test? > > Naively System properties seems easier and possibly less fragile (assuming tests aren't run with a very strict security policy somewhere so that we'd have to pair the test with the associated permissions): > > jtreg ... -Djava.lang.invoke.LoopCombinatorLongSignatureTest.run java/lang/invoke/LoopCombinatorLongSignatureTest.java > > boolean run = System.getProperty("java.lang.invoke.LoopCombinatorLongSignatureTest.run") != null; > > Thanks! > > /Claes > >> >> Running the test in LambdaForm interpretation mode takes a long time. As the test is actually about capturing excessively long loop clause lists, running the constructed loop should be optional. The fix disables running the loop by default and introduces a -run option that can be used if the loop should actually be run. >> >> Thanks, >> >> Michael >> > -- Dr. Michael Haupt | Principal Member of Technical Staff Phone: +49 331 200 7277 | Fax: +49 331 200 7561 Oracle Java Platform Group | LangTools Team | Nashorn Oracle Deutschland B.V. & Co. KG | Schiffbauergasse 14 | 14467 Potsdam, Germany ORACLE Deutschland B.V. & Co. KG | Hauptverwaltung: Riesstra?e 25, D-80992 M?nchen Registergericht: Amtsgericht M?nchen, HRA 95603 Komplement?rin: ORACLE Deutschland Verwaltung B.V. | Hertogswetering 163/167, 3543 AS Utrecht, Niederlande Handelsregister der Handelskammer Midden-Nederland, Nr. 30143697 Gesch?ftsf?hrer: Alexander van der Ven, Jan Schultheiss, Val Maher Oracle is committed to developing practices and products that help protect the environment From frederic.parain at oracle.com Mon Jul 18 13:48:45 2016 From: frederic.parain at oracle.com (frederic parain) Date: Mon, 18 Jul 2016 09:48:45 -0400 Subject: RFR(XXXXXXXS): 8161034 Incorrect GPL header in jdk/src/java.base/windows/native/libjava/jni_util_md.c Message-ID: <581ce474-34c4-0469-4a85-8608807e5e20@oracle.com> Hello, src/java.base/windows/native/libjava/jni_util_md.c file contains incorrect GPL header which fails make/scripts/lic_check.sh script check. Failure is caused by missing comma after modification years. Please, help to review its addition: http://cr.openjdk.java.net/~fparain/8161034/webrev.00/ lic_check.sh passes after this modification: ### Checking copyright notice in the file: jdk/src/java.base/windows/native/libjava/jni_util_md.c ### SUCCESS: The license header for /export/fparain/WORK/JDK9/8161034/hs/jdk/src/java.base/windows/native/libjava/jni_util_md.c has been verified. ### Thank you, Fred From martinrb at google.com Mon Jul 18 14:38:32 2016 From: martinrb at google.com (Martin Buchholz) Date: Mon, 18 Jul 2016 07:38:32 -0700 Subject: JDK 9 RFR of JDK-8161567: Mark java/util/concurrent/forkjoin/FJExceptionTableLeak.java as intermittently failing In-Reply-To: <578C7B62.3060105@oracle.com> References: <578C7B62.3060105@oracle.com> Message-ID: Like I always say, I'm unhappy with the increased memory requirements. Java programs that used to run in 4m now need more than 8m. Hotspot should be fixed! If this is dependent on the particular GC, maybe there's a way to require not having that gc. I see: ./java/lang/management/MemoryMXBean/LowMemoryTest2.sh:28:# @requires vm.gc=="null" ./java/lang/management/MemoryMXBean/PendingAllGC.sh:29:# @requires vm.gc=="null" ./java/lang/management/MemoryMXBean/MemoryManagementConcMarkSweepGC.sh:29:# @requires vm.gc=="ConcMarkSweep" | vm.gc=="null" ./java/lang/management/MemoryMXBean/MemoryTestAllGC.sh:29:# @requires vm.gc=="Parallel" | vm.gc=="null" ./java/lang/management/MemoryMXBean/MemoryManagementParallelGC.sh:29:# @requires vm.gc=="Parallel" | vm.gc=="null" ./java/lang/management/MemoryMXBean/MemoryManagementSerialGC.sh:29:# @requires vm.gc=="Serial" | vm.gc=="null" Maybe we can make this test pass in a similar way. Bug reports should be clearer about which VM flags actually cause the failure. On Sun, Jul 17, 2016 at 11:46 PM, Amy Lu wrote: > java/util/concurrent/forkjoin/FJExceptionTableLeak.java > > Test was ever fixed in JDK-8144990, but still failing intermittently as > reported in JDK-8151158. > > This patch is to add back @key intermittent to the test. (and keep it in > tier2 till issue resolved.) > Please review. > > bug: https://bugs.openjdk.java.net/browse/JDK-8161567 > webrev: http://cr.openjdk.java.net/~amlu/8161567/webrev.00/ > > Thanks, > Amy > > --- old/test/java/util/concurrent/forkjoin/FJExceptionTableLeak.java > 2016-07-18 14:37:25.000000000 +0800 > +++ new/test/java/util/concurrent/forkjoin/FJExceptionTableLeak.java > 2016-07-18 14:37:25.000000000 +0800 > @@ -35,6 +35,7 @@ > * @test > * @author Doug Lea > * @bug 8004138 > + * @key intermittent > * @summary Check if ForkJoinPool table leaks thrown exceptions. > * @run main/othervm -Xmx8m > -Djava.util.concurrent.ForkJoinPool.common.parallelism=4 > FJExceptionTableLeak > */ > > > From Alan.Bateman at oracle.com Mon Jul 18 14:39:28 2016 From: Alan.Bateman at oracle.com (Alan Bateman) Date: Mon, 18 Jul 2016 15:39:28 +0100 Subject: RFR(XXXXXXXS): 8161034 Incorrect GPL header in jdk/src/java.base/windows/native/libjava/jni_util_md.c In-Reply-To: <581ce474-34c4-0469-4a85-8608807e5e20@oracle.com> References: <581ce474-34c4-0469-4a85-8608807e5e20@oracle.com> Message-ID: <1fc0c3e0-28b6-d03f-358b-ad59026152a2@oracle.com> On 18/07/2016 14:48, frederic parain wrote: > Hello, > > src/java.base/windows/native/libjava/jni_util_md.c file contains > incorrect GPL header which fails make/scripts/lic_check.sh script check. > > Failure is caused by missing comma after modification years. Please, > help to review its addition: > http://cr.openjdk.java.net/~fparain/8161034/webrev.00/ > > lic_check.sh passes after this modification: > ### Checking copyright notice in the file: > jdk/src/java.base/windows/native/libjava/jni_util_md.c > ### > SUCCESS: The license header for > /export/fparain/WORK/JDK9/8161034/hs/jdk/src/java.base/windows/native/libjava/jni_util_md.c > has been verified. > ### Looks fine. From frederic.parain at oracle.com Mon Jul 18 15:19:59 2016 From: frederic.parain at oracle.com (frederic parain) Date: Mon, 18 Jul 2016 11:19:59 -0400 Subject: RFR(XXXXXXXS): 8161034 Incorrect GPL header in jdk/src/java.base/windows/native/libjava/jni_util_md.c In-Reply-To: <1fc0c3e0-28b6-d03f-358b-ad59026152a2@oracle.com> References: <581ce474-34c4-0469-4a85-8608807e5e20@oracle.com> <1fc0c3e0-28b6-d03f-358b-ad59026152a2@oracle.com> Message-ID: <76cc6c20-a241-b4fb-3c8d-f02143ff7866@oracle.com> Thanks for the review Alan! Fred On 18/07/2016 10:39, Alan Bateman wrote: > On 18/07/2016 14:48, frederic parain wrote: > >> Hello, >> >> src/java.base/windows/native/libjava/jni_util_md.c file contains >> incorrect GPL header which fails make/scripts/lic_check.sh script check. >> >> Failure is caused by missing comma after modification years. Please, >> help to review its addition: >> http://cr.openjdk.java.net/~fparain/8161034/webrev.00/ >> >> lic_check.sh passes after this modification: >> ### Checking copyright notice in the file: >> jdk/src/java.base/windows/native/libjava/jni_util_md.c >> ### >> SUCCESS: The license header for >> /export/fparain/WORK/JDK9/8161034/hs/jdk/src/java.base/windows/native/libjava/jni_util_md.c >> has been verified. >> ### > Looks fine. From svetlana.nikandrova at oracle.com Mon Jul 18 15:49:27 2016 From: svetlana.nikandrova at oracle.com (Svetlana Nikandrova) Date: Mon, 18 Jul 2016 18:49:27 +0300 Subject: RFR (JAXP): 8021787: javax.xml.datatype.XMLGregorianCalendar.getMonth() return is documented wrong Message-ID: <578CFA87.2040004@oracle.com> Hello all, please review this javadoc fix for javax.xml.datatype.XMLGregorianCalendar.getMonth() Webrev: http://cr.openjdk.java.net/~snikandrova/8021787/webrev.00/ JBS: https://bugs.openjdk.java.net/browse/JDK-8021787 Thank you, Svetlana From naoto.sato at oracle.com Mon Jul 18 15:54:56 2016 From: naoto.sato at oracle.com (Naoto Sato) Date: Mon, 18 Jul 2016 08:54:56 -0700 Subject: [9] RFR: 8159214: jlink --include-locales problems In-Reply-To: References: Message-ID: <71d5d09c-5c8a-766e-30d3-1cf707282345@oracle.com> Ping. On 7/14/16 5:42 AM, Naoto Sato wrote: > Hello, > > Please review the fix to the following issue: > > https://bugs.openjdk.java.net/browse/JDK-8159214 > > The fix is located at: > > http://cr.openjdk.java.net/~naoto/8159214/webrev.04/ > > Naoto From paul.sandoz at oracle.com Mon Jul 18 16:06:44 2016 From: paul.sandoz at oracle.com (Paul Sandoz) Date: Mon, 18 Jul 2016 18:06:44 +0200 Subject: 8161129 Unsafe::getUnsafe should allow the platform class loader to access it Message-ID: <8FB3C72D-C02E-4C39-95C2-AC10A14C78CC@oracle.com> Hi, Please review the patch below. Since Jigsaw encapsulates jdk.internal.misc.Unsafe there is no need to perform any runtime checks such as: - hiding the getUnsafe method from reflection; and - checking the class loader of the calling class for invocation of getUnsafe. This more cleanly enables qualified modules to utilise the internal Unsafe without reflection gymnastics, even though we should be reviewing that usage and to reduce it where possible. I also took the opportunity to hide the ?theInternalUnsafe? field in the sun.misc.Unsafe. That just avoids any futile attempts to obtain the field?s value after which any reflective access on that value will fail. Paul. diff -r 4f5f82c457af src/java.base/share/classes/jdk/internal/misc/Unsafe.java --- a/src/java.base/share/classes/jdk/internal/misc/Unsafe.java Mon Jul 18 13:13:52 2016 +0800 +++ b/src/java.base/share/classes/jdk/internal/misc/Unsafe.java Mon Jul 18 17:50:20 2016 +0200 @@ -26,8 +26,6 @@ package jdk.internal.misc; import jdk.internal.HotSpotIntrinsicCandidate; -import jdk.internal.reflect.CallerSensitive; -import jdk.internal.reflect.Reflection; import jdk.internal.vm.annotation.ForceInline; import java.lang.reflect.Field; @@ -57,7 +55,6 @@ private static native void registerNatives(); static { registerNatives(); - Reflection.registerMethodsToFilter(Unsafe.class, "getUnsafe"); } private Unsafe() {} @@ -87,16 +84,8 @@ * }} * * (It may assist compilers to make the local variable {@code final}.) - * - * @throws SecurityException if the class loader of the caller - * class is not in the system domain in which all permissions - * are granted. */ - @CallerSensitive public static Unsafe getUnsafe() { - Class caller = Reflection.getCallerClass(); - if (!VM.isSystemDomainLoader(caller.getClassLoader())) - throw new SecurityException("Unsafe"); return theUnsafe; } diff -r 4f5f82c457af src/jdk.unsupported/share/classes/sun/misc/Unsafe.java --- a/src/jdk.unsupported/share/classes/sun/misc/Unsafe.java Mon Jul 18 13:13:52 2016 +0800 +++ b/src/jdk.unsupported/share/classes/sun/misc/Unsafe.java Mon Jul 18 17:50:20 2016 +0200 @@ -56,6 +56,7 @@ static { Reflection.registerMethodsToFilter(Unsafe.class, "getUnsafe"); + Reflection.registerFieldsToFilter(Unsafe.class, "theInternalUnsafe"); } private Unsafe() {} From james.laskey at oracle.com Mon Jul 18 16:12:57 2016 From: james.laskey at oracle.com (Jim Laskey (Oracle)) Date: Mon, 18 Jul 2016 13:12:57 -0300 Subject: [9] RFR: 8159214: jlink --include-locales problems In-Reply-To: <71d5d09c-5c8a-766e-30d3-1cf707282345@oracle.com> References: <71d5d09c-5c8a-766e-30d3-1cf707282345@oracle.com> Message-ID: <988D0269-066B-4A37-913B-58E01F7B6F03@oracle.com> +1 > On Jul 18, 2016, at 12:54 PM, Naoto Sato wrote: > > Ping. > > On 7/14/16 5:42 AM, Naoto Sato wrote: >> Hello, >> >> Please review the fix to the following issue: >> >> https://bugs.openjdk.java.net/browse/JDK-8159214 >> >> The fix is located at: >> >> http://cr.openjdk.java.net/~naoto/8159214/webrev.04/ >> >> Naoto From peter.levart at gmail.com Mon Jul 18 16:33:49 2016 From: peter.levart at gmail.com (Peter Levart) Date: Mon, 18 Jul 2016 18:33:49 +0200 Subject: 8161129 Unsafe::getUnsafe should allow the platform class loader to access it In-Reply-To: <8FB3C72D-C02E-4C39-95C2-AC10A14C78CC@oracle.com> References: <8FB3C72D-C02E-4C39-95C2-AC10A14C78CC@oracle.com> Message-ID: <1f33d8e2-0253-0251-3e11-2eebd674b647@gmail.com> Hi Paul, Just curious, what was the purpose of hiding a public method in a public class in an exported package from reflection? I'm talking about sun.misc.Unsafe::getUnsafe ... Regards, Peter On 07/18/2016 06:06 PM, Paul Sandoz wrote: > Hi, > > Please review the patch below. > > Since Jigsaw encapsulates jdk.internal.misc.Unsafe there is no need to perform any runtime checks such as: > > - hiding the getUnsafe method from reflection; and > - checking the class loader of the calling class for invocation of getUnsafe. > > This more cleanly enables qualified modules to utilise the internal Unsafe without reflection gymnastics, even though we should be reviewing that usage and to reduce it where possible. > > I also took the opportunity to hide the ?theInternalUnsafe? field in the sun.misc.Unsafe. That just avoids any futile attempts to obtain the field?s value after which any reflective access on that value will fail. > > Paul. > > diff -r 4f5f82c457af src/java.base/share/classes/jdk/internal/misc/Unsafe.java > --- a/src/java.base/share/classes/jdk/internal/misc/Unsafe.java Mon Jul 18 13:13:52 2016 +0800 > +++ b/src/java.base/share/classes/jdk/internal/misc/Unsafe.java Mon Jul 18 17:50:20 2016 +0200 > @@ -26,8 +26,6 @@ > package jdk.internal.misc; > > import jdk.internal.HotSpotIntrinsicCandidate; > -import jdk.internal.reflect.CallerSensitive; > -import jdk.internal.reflect.Reflection; > import jdk.internal.vm.annotation.ForceInline; > > import java.lang.reflect.Field; > @@ -57,7 +55,6 @@ > private static native void registerNatives(); > static { > registerNatives(); > - Reflection.registerMethodsToFilter(Unsafe.class, "getUnsafe"); > } > > private Unsafe() {} > @@ -87,16 +84,8 @@ > * }} > * > * (It may assist compilers to make the local variable {@code final}.) > - * > - * @throws SecurityException if the class loader of the caller > - * class is not in the system domain in which all permissions > - * are granted. > */ > - @CallerSensitive > public static Unsafe getUnsafe() { > - Class caller = Reflection.getCallerClass(); > - if (!VM.isSystemDomainLoader(caller.getClassLoader())) > - throw new SecurityException("Unsafe"); > return theUnsafe; > } > > diff -r 4f5f82c457af src/jdk.unsupported/share/classes/sun/misc/Unsafe.java > --- a/src/jdk.unsupported/share/classes/sun/misc/Unsafe.java Mon Jul 18 13:13:52 2016 +0800 > +++ b/src/jdk.unsupported/share/classes/sun/misc/Unsafe.java Mon Jul 18 17:50:20 2016 +0200 > @@ -56,6 +56,7 @@ > > static { > Reflection.registerMethodsToFilter(Unsafe.class, "getUnsafe"); > + Reflection.registerFieldsToFilter(Unsafe.class, "theInternalUnsafe"); > } > > private Unsafe() {} From Alan.Bateman at oracle.com Mon Jul 18 16:37:57 2016 From: Alan.Bateman at oracle.com (Alan Bateman) Date: Mon, 18 Jul 2016 17:37:57 +0100 Subject: 8161129 Unsafe::getUnsafe should allow the platform class loader to access it In-Reply-To: <1f33d8e2-0253-0251-3e11-2eebd674b647@gmail.com> References: <8FB3C72D-C02E-4C39-95C2-AC10A14C78CC@oracle.com> <1f33d8e2-0253-0251-3e11-2eebd674b647@gmail.com> Message-ID: On 18/07/2016 17:33, Peter Levart wrote: > Hi Paul, > > Just curious, what was the purpose of hiding a public method in a > public class in an exported package from reflection? I'm talking about > sun.misc.Unsafe::getUnsafe ... > > Regards, Peter As I recall, it was an effort in JDK 6 (and prior to OpenJDK) to make it less tempting to use directly. It didn't work :-) -Alan From joe.darcy at oracle.com Mon Jul 18 17:25:16 2016 From: joe.darcy at oracle.com (joe darcy) Date: Mon, 18 Jul 2016 10:25:16 -0700 Subject: JDK 9 RFR of JDK-8161500: Use getTypeName and StringJoiner in core reflection toString methods In-Reply-To: <578977D5.3010808@oracle.com> References: <57896EFE.6080507@oracle.com> <578977D5.3010808@oracle.com> Message-ID: <63e538fe-c129-cba4-e2a1-8bce013541c3@oracle.com> Hi Claes, On 7/15/2016 4:55 PM, Claes Redestad wrote: > Looks OK, although I find: > > StringJoiner sj = StringJoiner(delimiter, before, after); > ... > sb.append(sj.toString()); > > to be a messier read than: > > sb.append(before); > StringJoiner sj = new StringJoiner(delimiter); > ... > sb.append(sj.toString()) > .append(after); For the usagse in Executable.java where the "(" and ")" are always issued, I switched back to appending those characters directly to the string builder. > > Any of these are ever used in a performance sensitive manner? I assume > no, but still curious. :-) I would be shocked if these were used in a performance sensitive context :-) Thanks for the review, -Joe > > /Claes > > On 2016-07-16 01:17, Joseph D. Darcy wrote: >> Hello, >> >> Please review this straightforward cleanup of some of the core >> reflection implementation classes: >> >> JDK-8161500: Use getTypeName and StringJoiner in core reflection >> toString methods >> http://cr.openjdk.java.net/~darcy/8161500.1/ >> >> All java/lang/Class and java/lang/reflect regression tests pass with >> this patch. >> >> (If the fix for JDK-8054213: "Class name repeated in output of >> Type.toString()" is pushed before this fix, a simple merge will be >> needed.) >> >> Thanks, >> >> -Joe From forax at univ-mlv.fr Mon Jul 18 17:29:01 2016 From: forax at univ-mlv.fr (Remi Forax) Date: Mon, 18 Jul 2016 19:29:01 +0200 (CEST) Subject: 8161129 Unsafe::getUnsafe should allow the platform class loader to access it In-Reply-To: <8FB3C72D-C02E-4C39-95C2-AC10A14C78CC@oracle.com> References: <8FB3C72D-C02E-4C39-95C2-AC10A14C78CC@oracle.com> Message-ID: <178440770.499743.1468862941121.JavaMail.zimbra@u-pem.fr> Hi Paul, ----- Mail original ----- > De: "Paul Sandoz" > ?: "Core-Libs-Dev" > Envoy?: Lundi 18 Juillet 2016 18:06:44 > Objet: 8161129 Unsafe::getUnsafe should allow the platform class loader to access it > > Hi, > > Please review the patch below. > [...] > I also took the opportunity to hide the ?theInternalUnsafe? field in the > sun.misc.Unsafe. That just avoids any futile attempts to obtain the field?s > value after which any reflective access on that value will fail. I see 3 good reasons to not do that, - as you said it is futile to try to get a reference to jdk.internal.misc.Unsafe because you will never be able to call a method on it. - the code you add contains a string that reference a field name which is erro prone when doing a refactoring - jdk.internal.misc.Unsafe is stored in static fields of a lot of exported classes, so why trying to 'protect' only sun.misc.Unsafe. > > Paul. R?mi > diff -r 4f5f82c457af src/jdk.unsupported/share/classes/sun/misc/Unsafe.java > --- a/src/jdk.unsupported/share/classes/sun/misc/Unsafe.java Mon Jul 18 > 13:13:52 2016 +0800 > +++ b/src/jdk.unsupported/share/classes/sun/misc/Unsafe.java Mon Jul 18 > 17:50:20 2016 +0200 > @@ -56,6 +56,7 @@ > > static { > Reflection.registerMethodsToFilter(Unsafe.class, "getUnsafe"); > + Reflection.registerFieldsToFilter(Unsafe.class, > "theInternalUnsafe"); > } > > private Unsafe() {} > From huizhe.wang at oracle.com Mon Jul 18 17:34:24 2016 From: huizhe.wang at oracle.com (huizhe wang) Date: Mon, 18 Jul 2016 10:34:24 -0700 Subject: RFR (JAXP): 8021787: javax.xml.datatype.XMLGregorianCalendar.getMonth() return is documented wrong In-Reply-To: <578CFA87.2040004@oracle.com> References: <578CFA87.2040004@oracle.com> Message-ID: <51440a13-ab2a-11cf-c42f-b58d6deeba30@oracle.com> Hi Svetlana, Thanks for working on these bugs. The change is correct. It would be better to say: "Returns the month of this calendar", in both the returns tag and the description (not number of month). While we are in this class, it would be good to at least fix the missing @returns tags in a number of methods, e.g. getDay, getTimezone, getHour, getMinute, toGregorianCalendar. Also, it @Override equals, hashCode, toString, and clone. Thanks, Joe On 7/18/2016 8:49 AM, Svetlana Nikandrova wrote: > Hello all, > > please review this javadoc fix for > javax.xml.datatype.XMLGregorianCalendar.getMonth() > Webrev: > http://cr.openjdk.java.net/~snikandrova/8021787/webrev.00/ > > JBS: > https://bugs.openjdk.java.net/browse/JDK-8021787 > > Thank you, > Svetlana From steve.drach at oracle.com Mon Jul 18 18:06:16 2016 From: steve.drach at oracle.com (Steve Drach) Date: Mon, 18 Jul 2016 11:06:16 -0700 Subject: RFR: 8157524 Revert JarFile methods "entries" and "stream" to Java 8 behavior In-Reply-To: <1DC235CC-CCD2-447E-AD7D-CD41E7195CFA@oracle.com> References: <152083C7-7593-4231-BD0C-F0734B16E14E@oracle.com> <1DC235CC-CCD2-447E-AD7D-CD41E7195CFA@oracle.com> Message-ID: >> Please review this change to JarFile that reverts JarFile::stream and JarFile::entries to JDK 8 behavior. The code is identical to that in JDK 8 except line 504 in JarEntryIterator that now uses a different constructor to create a JarFileEntry. I also added some implementation notes explaining how to create a versionedStream and a versionedEntries method. >> >> issue: https://bugs.openjdk.java.net/browse/JDK-8157524 >> webrev: http://cr.openjdk.java.net/~sdrach/8157524/webrev/index.html I put an updated webrev at http://cr.openjdk.java.net/~sdrach/8157524/webrev.01/index.html > For @implNote then you can put the example in {@code ...} and that will allow to use angled brackets (no need for < etc). Okay. I doesn?t seem to allow nested @, so I just dropped the @Override annotations on the example > > In ModulePath then it would be good to move versionedStream to jarPackages. It?s used in two places, moving it to jarPackages won?t work, I think. I also put a check in to see if it?s a multi-release jar. > A comment on the method would be useful too although we have other changes coming to this code so we can do it then. I put a comment in > > You should use an @apiNote, as this is presenting some interesting information on how to use this method and not some particular characteristics of the implementation. Okay > > I would be inclined to drop the note for Enumeration and add a @see tag referencing the Stream returned method. I actually had to use the versionedEntries method for jdeps. Because of that and because I don?t see the harm with leaving it in, I left it in. From Alan.Bateman at oracle.com Mon Jul 18 18:47:49 2016 From: Alan.Bateman at oracle.com (Alan Bateman) Date: Mon, 18 Jul 2016 19:47:49 +0100 Subject: RFR: 8157524 Revert JarFile methods "entries" and "stream" to Java 8 behavior In-Reply-To: References: <152083C7-7593-4231-BD0C-F0734B16E14E@oracle.com> <1DC235CC-CCD2-447E-AD7D-CD41E7195CFA@oracle.com> Message-ID: <272ab4d4-8f1e-3844-b421-9b601896e161@oracle.com> On 18/07/2016 19:06, Steve Drach wrote: > > It?s used in two places, moving it to jarPackages won?t work, I think. > I also put a check in to see if it?s a multi-release jar. I meant to move the method down to where jarPackages is located. I would probably adjust the comment too but we can do that once your changes are in jdk9/dev as we have several patches that will change this code. So I think what you have is okay. -Alan From steve.drach at oracle.com Mon Jul 18 18:55:38 2016 From: steve.drach at oracle.com (Steve Drach) Date: Mon, 18 Jul 2016 11:55:38 -0700 Subject: RFR: 8157524 Revert JarFile methods "entries" and "stream" to Java 8 behavior In-Reply-To: <272ab4d4-8f1e-3844-b421-9b601896e161@oracle.com> References: <152083C7-7593-4231-BD0C-F0734B16E14E@oracle.com> <1DC235CC-CCD2-447E-AD7D-CD41E7195CFA@oracle.com> <272ab4d4-8f1e-3844-b421-9b601896e161@oracle.com> Message-ID: >> It?s used in two places, moving it to jarPackages won?t work, I think. I also put a check in to see if it?s a multi-release jar. > I meant to move the method down to where jarPackages is located. I would probably adjust the comment too but we can do that once your changes are in jdk9/dev as we have several patches that will change this code. So I think what you have is okay. Okay. Will do. From david.holmes at oracle.com Mon Jul 18 23:56:47 2016 From: david.holmes at oracle.com (David Holmes) Date: Tue, 19 Jul 2016 09:56:47 +1000 Subject: JDK 9 RFR of JDK-8161567: Mark java/util/concurrent/forkjoin/FJExceptionTableLeak.java as intermittently failing In-Reply-To: References: <578C7B62.3060105@oracle.com> Message-ID: <42f2d069-bed0-3b5b-e37b-a3764c0d37be@oracle.com> Hi Martin, On 19/07/2016 12:38 AM, Martin Buchholz wrote: > Like I always say, I'm unhappy with the increased memory requirements. > Java programs that used to run in 4m now need more than 8m. Hotspot should > be fixed! I've updated the comments in https://bugs.openjdk.java.net/browse/JDK-8151158 I agree further investigation is needed in this case. > If this is dependent on the particular GC, maybe there's a way to require > not having that gc. GC algorithm itself should not be causing OOME. David ----- > I see: > > ./java/lang/management/MemoryMXBean/LowMemoryTest2.sh:28:# @requires > vm.gc=="null" > ./java/lang/management/MemoryMXBean/PendingAllGC.sh:29:# @requires > vm.gc=="null" > ./java/lang/management/MemoryMXBean/MemoryManagementConcMarkSweepGC.sh:29:# > @requires vm.gc=="ConcMarkSweep" | vm.gc=="null" > ./java/lang/management/MemoryMXBean/MemoryTestAllGC.sh:29:# @requires > vm.gc=="Parallel" | vm.gc=="null" > ./java/lang/management/MemoryMXBean/MemoryManagementParallelGC.sh:29:# > @requires vm.gc=="Parallel" | vm.gc=="null" > ./java/lang/management/MemoryMXBean/MemoryManagementSerialGC.sh:29:# > @requires vm.gc=="Serial" | vm.gc=="null" > > Maybe we can make this test pass in a similar way. > > Bug reports should be clearer about which VM flags actually cause the > failure. > > > On Sun, Jul 17, 2016 at 11:46 PM, Amy Lu wrote: > >> java/util/concurrent/forkjoin/FJExceptionTableLeak.java >> >> Test was ever fixed in JDK-8144990, but still failing intermittently as >> reported in JDK-8151158. >> >> This patch is to add back @key intermittent to the test. (and keep it in >> tier2 till issue resolved.) >> Please review. >> >> bug: https://bugs.openjdk.java.net/browse/JDK-8161567 >> webrev: http://cr.openjdk.java.net/~amlu/8161567/webrev.00/ >> >> Thanks, >> Amy >> >> --- old/test/java/util/concurrent/forkjoin/FJExceptionTableLeak.java >> 2016-07-18 14:37:25.000000000 +0800 >> +++ new/test/java/util/concurrent/forkjoin/FJExceptionTableLeak.java >> 2016-07-18 14:37:25.000000000 +0800 >> @@ -35,6 +35,7 @@ >> * @test >> * @author Doug Lea >> * @bug 8004138 >> + * @key intermittent >> * @summary Check if ForkJoinPool table leaks thrown exceptions. >> * @run main/othervm -Xmx8m >> -Djava.util.concurrent.ForkJoinPool.common.parallelism=4 >> FJExceptionTableLeak >> */ >> >> >> From joe.darcy at oracle.com Tue Jul 19 00:00:37 2016 From: joe.darcy at oracle.com (Joseph D. Darcy) Date: Mon, 18 Jul 2016 17:00:37 -0700 Subject: JDK 9 RFR of JDK-8161567: Mark java/util/concurrent/forkjoin/FJExceptionTableLeak.java as intermittently failing In-Reply-To: <42f2d069-bed0-3b5b-e37b-a3764c0d37be@oracle.com> References: <578C7B62.3060105@oracle.com> <42f2d069-bed0-3b5b-e37b-a3764c0d37be@oracle.com> Message-ID: <578D6DA5.8050703@oracle.com> Hello, While the underlying issues are being investigated, I think it is worthwhile to tag the test as intermittently failing to aid those having to QA any if its failures. Cheers, -Joe On 7/18/2016 4:56 PM, David Holmes wrote: > Hi Martin, > > On 19/07/2016 12:38 AM, Martin Buchholz wrote: >> Like I always say, I'm unhappy with the increased memory requirements. >> Java programs that used to run in 4m now need more than 8m. Hotspot >> should >> be fixed! > > I've updated the comments in > > https://bugs.openjdk.java.net/browse/JDK-8151158 > > I agree further investigation is needed in this case. > >> If this is dependent on the particular GC, maybe there's a way to >> require >> not having that gc. > > GC algorithm itself should not be causing OOME. > > David > ----- > >> I see: >> >> ./java/lang/management/MemoryMXBean/LowMemoryTest2.sh:28:# @requires >> vm.gc=="null" >> ./java/lang/management/MemoryMXBean/PendingAllGC.sh:29:# @requires >> vm.gc=="null" >> ./java/lang/management/MemoryMXBean/MemoryManagementConcMarkSweepGC.sh:29:# >> >> @requires vm.gc=="ConcMarkSweep" | vm.gc=="null" >> ./java/lang/management/MemoryMXBean/MemoryTestAllGC.sh:29:# @requires >> vm.gc=="Parallel" | vm.gc=="null" >> ./java/lang/management/MemoryMXBean/MemoryManagementParallelGC.sh:29:# >> @requires vm.gc=="Parallel" | vm.gc=="null" >> ./java/lang/management/MemoryMXBean/MemoryManagementSerialGC.sh:29:# >> @requires vm.gc=="Serial" | vm.gc=="null" >> >> Maybe we can make this test pass in a similar way. >> >> Bug reports should be clearer about which VM flags actually cause the >> failure. >> >> >> On Sun, Jul 17, 2016 at 11:46 PM, Amy Lu wrote: >> >>> java/util/concurrent/forkjoin/FJExceptionTableLeak.java >>> >>> Test was ever fixed in JDK-8144990, but still failing intermittently as >>> reported in JDK-8151158. >>> >>> This patch is to add back @key intermittent to the test. (and keep >>> it in >>> tier2 till issue resolved.) >>> Please review. >>> >>> bug: https://bugs.openjdk.java.net/browse/JDK-8161567 >>> webrev: http://cr.openjdk.java.net/~amlu/8161567/webrev.00/ >>> >>> Thanks, >>> Amy >>> >>> --- old/test/java/util/concurrent/forkjoin/FJExceptionTableLeak.java >>> 2016-07-18 14:37:25.000000000 +0800 >>> +++ new/test/java/util/concurrent/forkjoin/FJExceptionTableLeak.java >>> 2016-07-18 14:37:25.000000000 +0800 >>> @@ -35,6 +35,7 @@ >>> * @test >>> * @author Doug Lea >>> * @bug 8004138 >>> + * @key intermittent >>> * @summary Check if ForkJoinPool table leaks thrown exceptions. >>> * @run main/othervm -Xmx8m >>> -Djava.util.concurrent.ForkJoinPool.common.parallelism=4 >>> FJExceptionTableLeak >>> */ >>> >>> >>> From martinrb at google.com Tue Jul 19 00:34:41 2016 From: martinrb at google.com (Martin Buchholz) Date: Mon, 18 Jul 2016 17:34:41 -0700 Subject: JDK 9 RFR of JDK-8161567: Mark java/util/concurrent/forkjoin/FJExceptionTableLeak.java as intermittently failing In-Reply-To: <578D6DA5.8050703@oracle.com> References: <578C7B62.3060105@oracle.com> <42f2d069-bed0-3b5b-e37b-a3764c0d37be@oracle.com> <578D6DA5.8050703@oracle.com> Message-ID: Okay, we're all agreed. Amy can demote this test, and I'll try to think hard about how to improve the test, with my newfound insight. On Mon, Jul 18, 2016 at 5:00 PM, Joseph D. Darcy wrote: > Hello, > > While the underlying issues are being investigated, I think it is > worthwhile to tag the test as intermittently failing to aid those having to > QA any if its failures. > > Cheers, > > -Joe > > > On 7/18/2016 4:56 PM, David Holmes wrote: > >> Hi Martin, >> >> On 19/07/2016 12:38 AM, Martin Buchholz wrote: >> >>> Like I always say, I'm unhappy with the increased memory requirements. >>> Java programs that used to run in 4m now need more than 8m. Hotspot >>> should >>> be fixed! >>> >> >> I've updated the comments in >> >> https://bugs.openjdk.java.net/browse/JDK-8151158 >> >> I agree further investigation is needed in this case. >> >> If this is dependent on the particular GC, maybe there's a way to require >>> not having that gc. >>> >> >> GC algorithm itself should not be causing OOME. >> >> David >> ----- >> >> I see: >>> >>> ./java/lang/management/MemoryMXBean/LowMemoryTest2.sh:28:# @requires >>> vm.gc=="null" >>> ./java/lang/management/MemoryMXBean/PendingAllGC.sh:29:# @requires >>> vm.gc=="null" >>> ./java/lang/management/MemoryMXBean/MemoryManagementConcMarkSweepGC.sh:29:# >>> >>> @requires vm.gc=="ConcMarkSweep" | vm.gc=="null" >>> ./java/lang/management/MemoryMXBean/MemoryTestAllGC.sh:29:# @requires >>> vm.gc=="Parallel" | vm.gc=="null" >>> ./java/lang/management/MemoryMXBean/MemoryManagementParallelGC.sh:29:# >>> @requires vm.gc=="Parallel" | vm.gc=="null" >>> ./java/lang/management/MemoryMXBean/MemoryManagementSerialGC.sh:29:# >>> @requires vm.gc=="Serial" | vm.gc=="null" >>> >>> Maybe we can make this test pass in a similar way. >>> >>> Bug reports should be clearer about which VM flags actually cause the >>> failure. >>> >>> >>> On Sun, Jul 17, 2016 at 11:46 PM, Amy Lu wrote: >>> >>> java/util/concurrent/forkjoin/FJExceptionTableLeak.java >>>> >>>> Test was ever fixed in JDK-8144990, but still failing intermittently as >>>> reported in JDK-8151158. >>>> >>>> This patch is to add back @key intermittent to the test. (and keep it in >>>> tier2 till issue resolved.) >>>> Please review. >>>> >>>> bug: https://bugs.openjdk.java.net/browse/JDK-8161567 >>>> webrev: http://cr.openjdk.java.net/~amlu/8161567/webrev.00/ >>>> >>>> Thanks, >>>> Amy >>>> >>>> --- old/test/java/util/concurrent/forkjoin/FJExceptionTableLeak.java >>>> 2016-07-18 14:37:25.000000000 +0800 >>>> +++ new/test/java/util/concurrent/forkjoin/FJExceptionTableLeak.java >>>> 2016-07-18 14:37:25.000000000 +0800 >>>> @@ -35,6 +35,7 @@ >>>> * @test >>>> * @author Doug Lea >>>> * @bug 8004138 >>>> + * @key intermittent >>>> * @summary Check if ForkJoinPool table leaks thrown exceptions. >>>> * @run main/othervm -Xmx8m >>>> -Djava.util.concurrent.ForkJoinPool.common.parallelism=4 >>>> FJExceptionTableLeak >>>> */ >>>> >>>> >>>> >>>> > From rafael.wth at gmail.com Tue Jul 19 00:43:20 2016 From: rafael.wth at gmail.com (Rafael Winterhalter) Date: Tue, 19 Jul 2016 02:43:20 +0200 Subject: Change of the toString implementation for annotations Message-ID: Hello, I recognized a failing test on Java 9 caused by a changed return value returned by toString on an annotation with a class-property. When calling toString on an annotation: @interface Foo { Class value(); } instantiated as @Foo(Bar.class) with Java 8 it would be printed as: @Foo(class Bar) while in Java 9 it is printed as: @Foo(Bar.class) Is this change intended? I do not see a big benefit of this implementation change and it could break code. In my case, the problem is not that big, it is an easy fix but still, I found it a bit surprising. Thank you. Best regards, Rafael From brian.burkhalter at oracle.com Tue Jul 19 00:45:48 2016 From: brian.burkhalter at oracle.com (Brian Burkhalter) Date: Mon, 18 Jul 2016 17:45:48 -0700 Subject: JDK 9 RFR of 8161402: Provide a javadoc description for java.prefs module Message-ID: <4DCDC178-0007-4129-8E4E-B7B654D03769@oracle.com> Please review at your convenience. Issue: https://bugs.openjdk.java.net/browse/JDK-8161402 Patch: [1] Thanks, Brian [1] diff --- a/src/java.prefs/share/classes/module-info.java +++ b/src/java.prefs/share/classes/module-info.java @@ -23,6 +23,10 @@ * questions. */ +/** + * java.prefs defines and exports the preferences APIs of the Java SE platform. + */ + module java.prefs { requires java.xml; From steve.drach at oracle.com Tue Jul 19 01:33:50 2016 From: steve.drach at oracle.com (Steve Drach) Date: Mon, 18 Jul 2016 18:33:50 -0700 Subject: RFR: 8158295 Add a multi-release jar validation mechanism to jar tool In-Reply-To: <35D52343-AC93-4CC6-8507-869D9750AA8A@oracle.com> References: <35D52343-AC93-4CC6-8507-869D9750AA8A@oracle.com> Message-ID: >> Please review the following: >> >> webrev: http://cr.openjdk.java.net/~sdrach/8158295/webrev.01/ >> issue: https://bugs.openjdk.java.net/browse/JDK-8158295 >> >> This changeset adds a multi-release jar validator to jar tool. After the jar tool builds a multi-release jar, the potential resultant jar file is passed to the validator to assure that the jar file meets the minimal standards of a multi-release jar, in particular that versioned classes have the same api as base classes they override. There are other checks, for example warning if two classes are identical. If the jar file is invalid, it is not kept, so ?create will not produce a jar file and ?update will keep the input jar file. I?ve updated the webrev to address the issues raised ? http://cr.openjdk.java.net/~sdrach/8158295/webrev.02/index.html > > jar/Main.java > > 284 // This code would be repeated in the create and update sections. > 285 // In order not to do that, it's here as a consumer. > 286 Consumer validateAndClose = tmpfile -> { > Why does it need to be Consumer rather than just a method? I changed it to a method. > > Then i think you don?t need to rethow, but you can still keep the try block and use finally for File.deleteIfExist since it will not complain for the case where you move. Done. > > > 558 int i1 = s1.indexOf('/', n); > 559 int i2 = s1.indexOf('/', n); > 560 if (i1 == -1) throw new NumberFormatException(s1); > 561 if (i2 == -2) throw new NumberFormatException(s2); > > I think you are trying to reject entries directly under the versioned area so it?s not about numbers (same in the validator, so there is some redundancy?). A couple things here. The most obvious is it should be ?if (i2 == -1)?. I replaced NumberFormatException with a new InvalidJarException. I added a comment that this code is used to sort the version numbers as string representations of numbers, therefore ?9? goes before ?10?, not usual for string sorts. > > > 588 AtomicBoolean validHolder = new AtomicBoolean(); > 589 validHolder.set(valid); > > Pass valid to the constructor Done. > > > Validator/FingerPrint.java > > It would be useful to have some comments on what is checked in terms of API compatibility. e.g. describe what FingerPrint collects and how Validator uses it. Added some commentary to FingerPrint. > > > FingerPrint.java > > 205 private final Map fields = new HashMap<>(); > 206 private final Map methods = new HashMap<>(); > > Not sure you need to use a Map, why not use a Set? Not sure why I did it with Maps instead of Sets, but I wanted to keep the method and field names and maybe that made sense at one time. It doesn?t now, so Sets they are. > > Change Method to be literally a representation of a single method rather than a consolidation that is lossy for the set of exceptions. Done. From joe.darcy at oracle.com Tue Jul 19 01:57:19 2016 From: joe.darcy at oracle.com (joe darcy) Date: Mon, 18 Jul 2016 18:57:19 -0700 Subject: JDK 9 RFR of 8161402: Provide a javadoc description for java.prefs module In-Reply-To: <4DCDC178-0007-4129-8E4E-B7B654D03769@oracle.com> References: <4DCDC178-0007-4129-8E4E-B7B654D03769@oracle.com> Message-ID: Hi Brian, As as grammatical comment, I might start with "The {@code java.prefs} module defines ...", but otherwise, the change looks fine. Thanks, -Joe On 7/18/2016 5:45 PM, Brian Burkhalter wrote: > Please review at your convenience. > > Issue: https://bugs.openjdk.java.net/browse/JDK-8161402 > Patch: [1] > > Thanks, > > Brian > > [1] diff > > --- a/src/java.prefs/share/classes/module-info.java > +++ b/src/java.prefs/share/classes/module-info.java > @@ -23,6 +23,10 @@ > * questions. > */ > > +/** > + * java.prefs defines and exports the preferences APIs of the Java SE platform. > + */ > + > module java.prefs { > requires java.xml; From martinrb at google.com Tue Jul 19 02:07:27 2016 From: martinrb at google.com (Martin Buchholz) Date: Mon, 18 Jul 2016 19:07:27 -0700 Subject: 8161129 Unsafe::getUnsafe should allow the platform class loader to access it In-Reply-To: <178440770.499743.1468862941121.JavaMail.zimbra@u-pem.fr> References: <8FB3C72D-C02E-4C39-95C2-AC10A14C78CC@oracle.com> <178440770.499743.1468862941121.JavaMail.zimbra@u-pem.fr> Message-ID: Recent discussion here: http://markmail.org/search/?q=core-libs-dev%20ConcurrentHashMap%20jdk.internal.misc.unsafe#query:core-libs-dev%20ConcurrentHashMap%20jdk.internal.misc.unsafe+page:1+mid:iviymmlotcuasv6t+state:results There are too many places where reflective code can get its hands on a jdk.internal.misc.Unsafe. They can even call its toString method, but (perhaps!) not the dangerous methods. On Mon, Jul 18, 2016 at 10:29 AM, Remi Forax wrote: > Hi Paul, > > ----- Mail original ----- > > De: "Paul Sandoz" > > ?: "Core-Libs-Dev" > > Envoy?: Lundi 18 Juillet 2016 18:06:44 > > Objet: 8161129 Unsafe::getUnsafe should allow the platform class loader > to access it > > > > Hi, > > > > Please review the patch below. > > > > [...] > > > I also took the opportunity to hide the ?theInternalUnsafe? field in the > > sun.misc.Unsafe. That just avoids any futile attempts to obtain the > field?s > > value after which any reflective access on that value will fail. > > I see 3 good reasons to not do that, > - as you said it is futile to try to get a reference to > jdk.internal.misc.Unsafe because you will never be able to call a method on > it. > - the code you add contains a string that reference a field name which is > erro prone when doing a refactoring > - jdk.internal.misc.Unsafe is stored in static fields of a lot of exported > classes, so why trying to 'protect' only sun.misc.Unsafe. > > > > > Paul. > > R?mi > > > > diff -r 4f5f82c457af > src/jdk.unsupported/share/classes/sun/misc/Unsafe.java > > --- a/src/jdk.unsupported/share/classes/sun/misc/Unsafe.java Mon Jul 18 > > 13:13:52 2016 +0800 > > +++ b/src/jdk.unsupported/share/classes/sun/misc/Unsafe.java Mon Jul 18 > > 17:50:20 2016 +0200 > > @@ -56,6 +56,7 @@ > > > > static { > > Reflection.registerMethodsToFilter(Unsafe.class, "getUnsafe"); > > + Reflection.registerFieldsToFilter(Unsafe.class, > > "theInternalUnsafe"); > > } > > > > private Unsafe() {} > > > From joe.darcy at oracle.com Tue Jul 19 02:13:01 2016 From: joe.darcy at oracle.com (joe darcy) Date: Mon, 18 Jul 2016 19:13:01 -0700 Subject: Change of the toString implementation for annotations In-Reply-To: References: Message-ID: Hello Rafael, On 7/18/2016 5:43 PM, Rafael Winterhalter wrote: > Hello, > I recognized a failing test on Java 9 caused by a changed return value > returned by toString on an annotation with a class-property. > > When calling toString on an annotation: @interface Foo { Class value(); > } instantiated as @Foo(Bar.class) with Java 8 it would be printed as: > > @Foo(class Bar) > > while in Java 9 it is printed as: > > @Foo(Bar.class) > > Is this change intended? I do not see a big benefit of this implementation > change and it could break code. In my case, the problem is not that big, it > is an easy fix but still, I found it a bit surprising. > I pushed the change your test noticed; it was done as part of JDK-5040830: (ann) please improve toString() for annotations containing exception proxies https://bugs.openjdk.java.net/browse/JDK-5040830 The basic rationale for the change is that "Foo.class" is the syntax that appears when annotations are in source code so the toString() form should generally reflect that. Thanks for running your project against JDK 9 builds; HTH, -Joe From john.r.rose at oracle.com Tue Jul 19 02:38:27 2016 From: john.r.rose at oracle.com (John Rose) Date: Mon, 18 Jul 2016 19:38:27 -0700 Subject: 8161129 Unsafe::getUnsafe should allow the platform class loader to access it In-Reply-To: References: <8FB3C72D-C02E-4C39-95C2-AC10A14C78CC@oracle.com> <178440770.499743.1468862941121.JavaMail.zimbra@u-pem.fr> Message-ID: <8B3836AF-1B8C-430D-9A15-AED424E174F4@oracle.com> +1 to Martin and Remi. The call to registerMethodsToFilter is very old, way out of date, and accomplishes nothing useful today. Modular access checks for reflective method calls is our main line of defense, if the security manager is turned off. There are other things we might try in the future that are analogous to registerMethodsToFilter, but it doesn't add anything today. ? John On Jul 18, 2016, at 7:07 PM, Martin Buchholz wrote: > > Recent discussion here: > > http://markmail.org/search/?q=core-libs-dev%20ConcurrentHashMap%20jdk.internal.misc.unsafe#query:core-libs-dev%20ConcurrentHashMap%20jdk.internal.misc.unsafe+page:1+mid:iviymmlotcuasv6t+state:results > > There are too many places where reflective code can get its hands on a > jdk.internal.misc.Unsafe. They can even call its toString method, but > (perhaps!) not the dangerous methods. > > On Mon, Jul 18, 2016 at 10:29 AM, Remi Forax wrote: > >> Hi Paul, >> >> ----- Mail original ----- >>> De: "Paul Sandoz" >>> ?: "Core-Libs-Dev" >>> Envoy?: Lundi 18 Juillet 2016 18:06:44 >>> Objet: 8161129 Unsafe::getUnsafe should allow the platform class loader >> to access it >>> >>> Hi, >>> >>> Please review the patch below. >>> >> >> [...] >> >>> I also took the opportunity to hide the ?theInternalUnsafe? field in the >>> sun.misc.Unsafe. That just avoids any futile attempts to obtain the >> field?s >>> value after which any reflective access on that value will fail. >> >> I see 3 good reasons to not do that, >> - as you said it is futile to try to get a reference to >> jdk.internal.misc.Unsafe because you will never be able to call a method on >> it. >> - the code you add contains a string that reference a field name which is >> erro prone when doing a refactoring >> - jdk.internal.misc.Unsafe is stored in static fields of a lot of exported >> classes, so why trying to 'protect' only sun.misc.Unsafe. >> >>> >>> Paul. >> >> R?mi >> >> >>> diff -r 4f5f82c457af >> src/jdk.unsupported/share/classes/sun/misc/Unsafe.java >>> --- a/src/jdk.unsupported/share/classes/sun/misc/Unsafe.java Mon Jul 18 >>> 13:13:52 2016 +0800 >>> +++ b/src/jdk.unsupported/share/classes/sun/misc/Unsafe.java Mon Jul 18 >>> 17:50:20 2016 +0200 >>> @@ -56,6 +56,7 @@ >>> >>> static { >>> Reflection.registerMethodsToFilter(Unsafe.class, "getUnsafe"); >>> + Reflection.registerFieldsToFilter(Unsafe.class, >>> "theInternalUnsafe"); >>> } >>> >>> private Unsafe() {} >>> >> From frank.yuan at oracle.com Tue Jul 19 02:42:03 2016 From: frank.yuan at oracle.com (Frank Yuan) Date: Tue, 19 Jul 2016 10:42:03 +0800 Subject: RFR (JAXP) JDK-8067170: Enable security manager on JAXP unit tests In-Reply-To: <578CA476.7030407@oracle.com> References: <022401d1e0d7$54111090$fc3331b0$@oracle.com> <578CA476.7030407@oracle.com> Message-ID: <014e01d1e167$26460860$72d21920$@oracle.com> > -----Original Message----- > From: Amy Lu [mailto:amy.lu at oracle.com] > Sent: Monday, July 18, 2016 5:42 PM > To: Frank Yuan; 'core-libs-dev' > Subject: Re: RFR (JAXP) JDK-8067170: Enable security manager on JAXP unit tests > > On 7/18/16 5:32 PM, Frank Yuan wrote: > > Btw, I moved internaltest into unittest because it's unnecessary to separate them. > > Maybe you'd like to regenerate the webrev with hg move for those files? > Yes, I will. Thank you very much! Frank > Thanks, > Amy From xueming.shen at oracle.com Tue Jul 19 06:23:11 2016 From: xueming.shen at oracle.com (Xueming Shen) Date: Mon, 18 Jul 2016 23:23:11 -0700 Subject: RFR JDK-8155616: java/util/zip/TestLocalTime.java fails intermittently with storing mtime failed Message-ID: <578DC74F.3070909@oracle.com> Hi Amy, I finally got to the bottom of this failure. It appears the timestamps that trigger the failure are those that (1) < 1980 and (2) within the daylight saving time gap, which means the local date-time is actually not valid, for example 1968-04-28/2:51:25, this ldt should be adjusted to 3:51:25 when switched to summer time. This is really a corner case that should not have any real impact to real world use scenario. The implementation itself is correct. Just the test case need adjusted. Please help review. issue: https://bugs.openjdk.java.net/browse/JDK-8155616 webrev: http://cr.openjdk.java.net/~sherman/8155616/webrev Thanks, Sherman From Alan.Bateman at oracle.com Tue Jul 19 07:12:11 2016 From: Alan.Bateman at oracle.com (Alan Bateman) Date: Tue, 19 Jul 2016 08:12:11 +0100 Subject: JDK 9 RFR of 8161402: Provide a javadoc description for java.prefs module In-Reply-To: References: <4DCDC178-0007-4129-8E4E-B7B654D03769@oracle.com> Message-ID: <9cf0f075-2521-04ec-401c-1398295a1aa0@oracle.com> On 19/07/2016 02:57, joe darcy wrote: > Hi Brian, > > As as grammatical comment, I might start with "The {@code java.prefs} > module defines ...", but otherwise, the change looks fine. Also I think it's API rather than "APIs". At some point then we need to do a pass over all the javadoc comments in the module-info.java files to get them consistent. In this case, I could imagine changing in the future to just say that it defines and exports the preferences API. -Alan From amy.lu at oracle.com Tue Jul 19 07:24:37 2016 From: amy.lu at oracle.com (Amy Lu) Date: Tue, 19 Jul 2016 15:24:37 +0800 Subject: RFR JDK-8155616: java/util/zip/TestLocalTime.java fails intermittently with storing mtime failed In-Reply-To: <578DC74F.3070909@oracle.com> References: <578DC74F.3070909@oracle.com> Message-ID: <578DD5B5.4060304@oracle.com> Thanks for the fix, really a corner case. I think this looks reasonable. Just one minor thing, please update copyright header on the year when commit. BTW. I'm not official reviewer. Thanks, Amy On 7/19/16 2:23 PM, Xueming Shen wrote: > Hi Amy, > > I finally got to the bottom of this failure. It appears the timestamps > that > trigger the failure are those that (1) < 1980 and (2) within the > daylight saving > time gap, which means the local date-time is actually not valid, for > example > 1968-04-28/2:51:25, this ldt should be adjusted to 3:51:25 when switched > to summer time. This is really a corner case that should not have any > real > impact to real world use scenario. The implementation itself is > correct. Just the > test case need adjusted. Please help review. > > issue: https://bugs.openjdk.java.net/browse/JDK-8155616 > webrev: http://cr.openjdk.java.net/~sherman/8155616/webrev > > Thanks, > Sherman > From paul.sandoz at oracle.com Tue Jul 19 07:58:17 2016 From: paul.sandoz at oracle.com (Paul Sandoz) Date: Tue, 19 Jul 2016 09:58:17 +0200 Subject: 8161129 Unsafe::getUnsafe should allow the platform class loader to access it In-Reply-To: References: <8FB3C72D-C02E-4C39-95C2-AC10A14C78CC@oracle.com> <178440770.499743.1468862941121.JavaMail.zimbra@u-pem.fr> Message-ID: <73881DB2-DA68-45C2-BD17-F031AB018240@oracle.com> > On 19 Jul 2016, at 04:07, Martin Buchholz wrote: > > Recent discussion here: > > http://markmail.org/search/?q=core-libs-dev%20ConcurrentHashMap%20jdk.internal.misc.unsafe#query:core-libs-dev%20ConcurrentHashMap%20jdk.internal.misc.unsafe+page:1+mid:iviymmlotcuasv6t+state:results > > There are too many places where reflective code can get its hands on a jdk.internal.misc.Unsafe. They can even call its toString method, but (perhaps!) not the dangerous methods. > Right, and even synchronise on it :-) since they are methods on Object. Access control will block reflective invocation on the Unsafe methods for unqualified exports. It?s Remi?s last point that clinched it for me, i have removed: Reflection.registerFieldsToFilter(Unsafe.class, "theInternalUnsafe"); Paul. > On Mon, Jul 18, 2016 at 10:29 AM, Remi Forax wrote: > Hi Paul, > > ----- Mail original ----- > > De: "Paul Sandoz" > > ?: "Core-Libs-Dev" > > Envoy?: Lundi 18 Juillet 2016 18:06:44 > > Objet: 8161129 Unsafe::getUnsafe should allow the platform class loader to access it > > > > Hi, > > > > Please review the patch below. > > > > [...] > > > I also took the opportunity to hide the ?theInternalUnsafe? field in the > > sun.misc.Unsafe. That just avoids any futile attempts to obtain the field?s > > value after which any reflective access on that value will fail. > > I see 3 good reasons to not do that, > - as you said it is futile to try to get a reference to jdk.internal.misc.Unsafe because you will never be able to call a method on it. > - the code you add contains a string that reference a field name which is erro prone when doing a refactoring > - jdk.internal.misc.Unsafe is stored in static fields of a lot of exported classes, so why trying to 'protect' only sun.misc.Unsafe. > > > > > Paul. > > R?mi > > > > diff -r 4f5f82c457af src/jdk.unsupported/share/classes/sun/misc/Unsafe.java > > --- a/src/jdk.unsupported/share/classes/sun/misc/Unsafe.java Mon Jul 18 > > 13:13:52 2016 +0800 > > +++ b/src/jdk.unsupported/share/classes/sun/misc/Unsafe.java Mon Jul 18 > > 17:50:20 2016 +0200 > > @@ -56,6 +56,7 @@ > > > > static { > > Reflection.registerMethodsToFilter(Unsafe.class, "getUnsafe"); > > + Reflection.registerFieldsToFilter(Unsafe.class, > > "theInternalUnsafe"); > > } > > > > private Unsafe() {} > > > From peter.levart at gmail.com Tue Jul 19 08:05:49 2016 From: peter.levart at gmail.com (Peter Levart) Date: Tue, 19 Jul 2016 10:05:49 +0200 Subject: 8161129 Unsafe::getUnsafe should allow the platform class loader to access it In-Reply-To: <73881DB2-DA68-45C2-BD17-F031AB018240@oracle.com> References: <8FB3C72D-C02E-4C39-95C2-AC10A14C78CC@oracle.com> <178440770.499743.1468862941121.JavaMail.zimbra@u-pem.fr> <73881DB2-DA68-45C2-BD17-F031AB018240@oracle.com> Message-ID: Just a thought... Is it already too late (or too early?) to consider for jdk.internal.misc.Unsafe to expose a static instead of instance API ? Having instance API was a clever way to fold access checks to static initializer of consumer class, but with Jigsaw, this is not needed any more, right? Regards, Peter On 07/19/2016 09:58 AM, Paul Sandoz wrote: >> On 19 Jul 2016, at 04:07, Martin Buchholz wrote: >> >> Recent discussion here: >> >> http://markmail.org/search/?q=core-libs-dev%20ConcurrentHashMap%20jdk.internal.misc.unsafe#query:core-libs-dev%20ConcurrentHashMap%20jdk.internal.misc.unsafe+page:1+mid:iviymmlotcuasv6t+state:results >> >> There are too many places where reflective code can get its hands on a jdk.internal.misc.Unsafe. They can even call its toString method, but (perhaps!) not the dangerous methods. >> > Right, and even synchronise on it :-) since they are methods on Object. Access control will block reflective invocation on the Unsafe methods for unqualified exports. > > It?s Remi?s last point that clinched it for me, i have removed: > > Reflection.registerFieldsToFilter(Unsafe.class, "theInternalUnsafe"); > > Paul. > > > >> On Mon, Jul 18, 2016 at 10:29 AM, Remi Forax wrote: >> Hi Paul, >> >> ----- Mail original ----- >>> De: "Paul Sandoz" >>> ?: "Core-Libs-Dev" >>> Envoy?: Lundi 18 Juillet 2016 18:06:44 >>> Objet: 8161129 Unsafe::getUnsafe should allow the platform class loader to access it >>> >>> Hi, >>> >>> Please review the patch below. >>> >> [...] >> >>> I also took the opportunity to hide the ?theInternalUnsafe? field in the >>> sun.misc.Unsafe. That just avoids any futile attempts to obtain the field?s >>> value after which any reflective access on that value will fail. >> I see 3 good reasons to not do that, >> - as you said it is futile to try to get a reference to jdk.internal.misc.Unsafe because you will never be able to call a method on it. >> - the code you add contains a string that reference a field name which is erro prone when doing a refactoring >> - jdk.internal.misc.Unsafe is stored in static fields of a lot of exported classes, so why trying to 'protect' only sun.misc.Unsafe. >> >>> Paul. >> R?mi >> >> >>> diff -r 4f5f82c457af src/jdk.unsupported/share/classes/sun/misc/Unsafe.java >>> --- a/src/jdk.unsupported/share/classes/sun/misc/Unsafe.java Mon Jul 18 >>> 13:13:52 2016 +0800 >>> +++ b/src/jdk.unsupported/share/classes/sun/misc/Unsafe.java Mon Jul 18 >>> 17:50:20 2016 +0200 >>> @@ -56,6 +56,7 @@ >>> >>> static { >>> Reflection.registerMethodsToFilter(Unsafe.class, "getUnsafe"); >>> + Reflection.registerFieldsToFilter(Unsafe.class, >>> "theInternalUnsafe"); >>> } >>> >>> private Unsafe() {} >>> From paul.sandoz at oracle.com Tue Jul 19 08:12:59 2016 From: paul.sandoz at oracle.com (Paul Sandoz) Date: Tue, 19 Jul 2016 10:12:59 +0200 Subject: RFR: 8157524 Revert JarFile methods "entries" and "stream" to Java 8 behavior In-Reply-To: References: <152083C7-7593-4231-BD0C-F0734B16E14E@oracle.com> <1DC235CC-CCD2-447E-AD7D-CD41E7195CFA@oracle.com> Message-ID: > On 18 Jul 2016, at 20:06, Steve Drach wrote: > >> >> I would be inclined to drop the note for Enumeration and add a @see tag referencing the Stream returned method. > > I actually had to use the versionedEntries method for jdeps. Because of that and because I don?t see the harm with leaving it in, I left it in. > You are implicitly making reference in the @apiNote note of entries() to a method in the @apiNote of stream() 533 * Iterator it = versionedStream(jf).iterator(); That?s quite confusing. If you wanna keep the @apiNote in entires i recommend keep the two notes independent, and also add a @see to stream(). Paul. From forax at univ-mlv.fr Tue Jul 19 08:13:13 2016 From: forax at univ-mlv.fr (Remi Forax) Date: Tue, 19 Jul 2016 10:13:13 +0200 (CEST) Subject: 8161129 Unsafe::getUnsafe should allow the platform class loader to access it In-Reply-To: References: <8FB3C72D-C02E-4C39-95C2-AC10A14C78CC@oracle.com> <178440770.499743.1468862941121.JavaMail.zimbra@u-pem.fr> <73881DB2-DA68-45C2-BD17-F031AB018240@oracle.com> Message-ID: <1197915480.106509.1468915993692.JavaMail.zimbra@u-pem.fr> Hi Peter, Yes, very true, you should log a bug on this, it can be done later during the development of 10 because it requires a coordinate JDK / VM change. R?mi ----- Mail original ----- > De: "Peter Levart" > ?: "Paul Sandoz" > Cc: "Core-Libs-Dev" > Envoy?: Mardi 19 Juillet 2016 10:05:49 > Objet: Re: 8161129 Unsafe::getUnsafe should allow the platform class loader to access it > > Just a thought... > > Is it already too late (or too early?) to consider for > jdk.internal.misc.Unsafe to expose a static instead of instance API ? > > Having instance API was a clever way to fold access checks to static > initializer of consumer class, but with Jigsaw, this is not needed any > more, right? > > Regards, Peter > > On 07/19/2016 09:58 AM, Paul Sandoz wrote: > >> On 19 Jul 2016, at 04:07, Martin Buchholz wrote: > >> > >> Recent discussion here: > >> > >> http://markmail.org/search/?q=core-libs-dev%20ConcurrentHashMap%20jdk.internal.misc.unsafe#query:core-libs-dev%20ConcurrentHashMap%20jdk.internal.misc.unsafe+page:1+mid:iviymmlotcuasv6t+state:results > >> > >> There are too many places where reflective code can get its hands on a > >> jdk.internal.misc.Unsafe. They can even call its toString method, but > >> (perhaps!) not the dangerous methods. > >> > > Right, and even synchronise on it :-) since they are methods on Object. > > Access control will block reflective invocation on the Unsafe methods for > > unqualified exports. > > > > It?s Remi?s last point that clinched it for me, i have removed: > > > > Reflection.registerFieldsToFilter(Unsafe.class, "theInternalUnsafe"); > > > > Paul. > > > > > > > >> On Mon, Jul 18, 2016 at 10:29 AM, Remi Forax wrote: > >> Hi Paul, > >> > >> ----- Mail original ----- > >>> De: "Paul Sandoz" > >>> ?: "Core-Libs-Dev" > >>> Envoy?: Lundi 18 Juillet 2016 18:06:44 > >>> Objet: 8161129 Unsafe::getUnsafe should allow the platform class loader > >>> to access it > >>> > >>> Hi, > >>> > >>> Please review the patch below. > >>> > >> [...] > >> > >>> I also took the opportunity to hide the ?theInternalUnsafe? field in the > >>> sun.misc.Unsafe. That just avoids any futile attempts to obtain the > >>> field?s > >>> value after which any reflective access on that value will fail. > >> I see 3 good reasons to not do that, > >> - as you said it is futile to try to get a reference to > >> jdk.internal.misc.Unsafe because you will never be able to call a method > >> on it. > >> - the code you add contains a string that reference a field name which is > >> erro prone when doing a refactoring > >> - jdk.internal.misc.Unsafe is stored in static fields of a lot of exported > >> classes, so why trying to 'protect' only sun.misc.Unsafe. > >> > >>> Paul. > >> R?mi > >> > >> > >>> diff -r 4f5f82c457af > >>> src/jdk.unsupported/share/classes/sun/misc/Unsafe.java > >>> --- a/src/jdk.unsupported/share/classes/sun/misc/Unsafe.java Mon Jul 18 > >>> 13:13:52 2016 +0800 > >>> +++ b/src/jdk.unsupported/share/classes/sun/misc/Unsafe.java Mon Jul 18 > >>> 17:50:20 2016 +0200 > >>> @@ -56,6 +56,7 @@ > >>> > >>> static { > >>> Reflection.registerMethodsToFilter(Unsafe.class, "getUnsafe"); > >>> + Reflection.registerFieldsToFilter(Unsafe.class, > >>> "theInternalUnsafe"); > >>> } > >>> > >>> private Unsafe() {} > >>> > > From paul.sandoz at oracle.com Tue Jul 19 08:18:27 2016 From: paul.sandoz at oracle.com (Paul Sandoz) Date: Tue, 19 Jul 2016 10:18:27 +0200 Subject: 8161129 Unsafe::getUnsafe should allow the platform class loader to access it In-Reply-To: <1197915480.106509.1468915993692.JavaMail.zimbra@u-pem.fr> References: <8FB3C72D-C02E-4C39-95C2-AC10A14C78CC@oracle.com> <178440770.499743.1468862941121.JavaMail.zimbra@u-pem.fr> <73881DB2-DA68-45C2-BD17-F031AB018240@oracle.com> <1197915480.106509.1468915993692.JavaMail.zimbra@u-pem.fr> Message-ID: <0D8A1336-C087-4216-AA62-4043DD219F02@oracle.com> > On 19 Jul 2016, at 10:13, Remi Forax wrote: > > Hi Peter, > Yes, very true, > you should log a bug on this, > it can be done later during the development of 10 because it requires a coordinate JDK / VM change. > Yes, changing all instance methods to static methods is a larger change that i would prefer not to take on at this point. Perhaps later! Paul. From alexandr.scherbatiy at oracle.com Tue Jul 19 11:26:24 2016 From: alexandr.scherbatiy at oracle.com (Alexandr Scherbatiy) Date: Tue, 19 Jul 2016 14:26:24 +0300 Subject: RFR: 8140723: Remove source code conditionalized on JAVASE_EMBEDDED In-Reply-To: References: Message-ID: The fix looks good to me. Thanks, Alexandr. On 7/16/2016 2:55 AM, David Holmes wrote: > Can I please get someone from AWT to approve this. > > Thanks, > David > > On 14/07/2016 2:25 PM, David Holmes wrote: >> The bug report for this is confidential but quite simply all of the >> little tweaks and knobs we added to the open build and source files to >> support the Java SE Embedded product no longer need to be there for JDK >> 9. Many of them have already been removed via other changes but this >> cleans up the rest. >> >> webrev: http://cr.openjdk.java.net/~dholmes/8140723/webrev.jdk/ >> >> The changes relate to: >> - Java version information >> - isEmbedded() check in test code Platform.java >> - special AWT build settings for Embedded >> - special Toolkit handling for Embedded >> >> In make/lib/Awt2dLibraries.gmk I commented out a setting which was >> seemingly introduced only to support (old) embedded releases: >> >> # decimal constant is unsigned only in ISO C90 (JAVASE_EMBEDDED) >> BUILD_LIBAWT_XAWT_XToolkit.c_CFLAGS := -w >> >> which I think pertained to: >> >> #define DEF_AWT_MAX_POLL_TIMEOUT ((uint32_t)4000000000) >> >> Unless AWT folk indicate otherwise I will delete those two lines in >> final push. >> >> Thanks, >> David >> ----- From david.holmes at oracle.com Tue Jul 19 11:32:26 2016 From: david.holmes at oracle.com (David Holmes) Date: Tue, 19 Jul 2016 21:32:26 +1000 Subject: RFR: 8140723: Remove source code conditionalized on JAVASE_EMBEDDED In-Reply-To: References: Message-ID: Thanks Alexandr! David On 19/07/2016 9:26 PM, Alexandr Scherbatiy wrote: > The fix looks good to me. > > Thanks, > Alexandr. > > On 7/16/2016 2:55 AM, David Holmes wrote: >> Can I please get someone from AWT to approve this. >> >> Thanks, >> David >> >> On 14/07/2016 2:25 PM, David Holmes wrote: >>> The bug report for this is confidential but quite simply all of the >>> little tweaks and knobs we added to the open build and source files to >>> support the Java SE Embedded product no longer need to be there for JDK >>> 9. Many of them have already been removed via other changes but this >>> cleans up the rest. >>> >>> webrev: http://cr.openjdk.java.net/~dholmes/8140723/webrev.jdk/ >>> >>> The changes relate to: >>> - Java version information >>> - isEmbedded() check in test code Platform.java >>> - special AWT build settings for Embedded >>> - special Toolkit handling for Embedded >>> >>> In make/lib/Awt2dLibraries.gmk I commented out a setting which was >>> seemingly introduced only to support (old) embedded releases: >>> >>> # decimal constant is unsigned only in ISO C90 (JAVASE_EMBEDDED) >>> BUILD_LIBAWT_XAWT_XToolkit.c_CFLAGS := -w >>> >>> which I think pertained to: >>> >>> #define DEF_AWT_MAX_POLL_TIMEOUT ((uint32_t)4000000000) >>> >>> Unless AWT folk indicate otherwise I will delete those two lines in >>> final push. >>> >>> Thanks, >>> David >>> ----- > From lance.andersen at oracle.com Tue Jul 19 12:31:04 2016 From: lance.andersen at oracle.com (Lance Andersen) Date: Tue, 19 Jul 2016 08:31:04 -0400 Subject: JDK 9 RFR of 8161402: Provide a javadoc description for java.prefs module In-Reply-To: <9cf0f075-2521-04ec-401c-1398295a1aa0@oracle.com> References: <4DCDC178-0007-4129-8E4E-B7B654D03769@oracle.com> <9cf0f075-2521-04ec-401c-1398295a1aa0@oracle.com> Message-ID: I know I have to do the same for a few modules. Do you have a preference on the wording so it consistent to help reduce follow on changes: The {@code java.XXX} module defines and exports the XXX API Is that the preferred direction? > On Jul 19, 2016, at 3:12 AM, Alan Bateman wrote: > > On 19/07/2016 02:57, joe darcy wrote: > >> Hi Brian, >> >> As as grammatical comment, I might start with "The {@code java.prefs} module defines ...", but otherwise, the change looks fine. > Also I think it's API rather than "APIs". > > At some point then we need to do a pass over all the javadoc comments in the module-info.java files to get them consistent. In this case, I could imagine changing in the future to just say that it defines and exports the preferences API. > > -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 Roger.Riggs at Oracle.com Tue Jul 19 12:47:13 2016 From: Roger.Riggs at Oracle.com (Roger Riggs) Date: Tue, 19 Jul 2016 08:47:13 -0400 Subject: JDK 9 RFR of 8161402: Provide a javadoc description for java.prefs module In-Reply-To: <4DCDC178-0007-4129-8E4E-B7B654D03769@oracle.com> References: <4DCDC178-0007-4129-8E4E-B7B654D03769@oracle.com> Message-ID: <09289752-a388-7906-c6bf-9cc59dd23a61@Oracle.com> ok. I would omit the 'of the Java SE platform' as being self referential and unnecessary. (and API should be singular) $.02, Roger On 7/18/2016 8:45 PM, Brian Burkhalter wrote: > Please review at your convenience. > > Issue: https://bugs.openjdk.java.net/browse/JDK-8161402 > Patch: [1] > > Thanks, > > Brian > > [1] diff > > --- a/src/java.prefs/share/classes/module-info.java > +++ b/src/java.prefs/share/classes/module-info.java > @@ -23,6 +23,10 @@ > * questions. > */ > > +/** > + * java.prefs defines and exports the preferences APIs of the Java SE platform. > + */ > + > module java.prefs { > requires java.xml; From svetlana.nikandrova at oracle.com Tue Jul 19 13:26:42 2016 From: svetlana.nikandrova at oracle.com (Svetlana Nikandrova) Date: Tue, 19 Jul 2016 16:26:42 +0300 Subject: RFR (JAXP): 8021787: javax.xml.datatype.XMLGregorianCalendar.getMonth() return is documented wrong In-Reply-To: <51440a13-ab2a-11cf-c42f-b58d6deeba30@oracle.com> References: <578CFA87.2040004@oracle.com> <51440a13-ab2a-11cf-c42f-b58d6deeba30@oracle.com> Message-ID: <578E2A92.5030307@oracle.com> Hi Joe, thank you for your replay. As I'm new to javadoc writing feel free to add any comments. Please see updated webrev: http://cr.openjdk.java.net/~snikandrova/8021787/webrev.01/ Thank you, Svetlana On 18.07.2016 20:34, huizhe wang wrote: > Hi Svetlana, > > Thanks for working on these bugs. The change is correct. It would be > better to say: "Returns the month of this calendar", in both the > returns tag and the description (not number of month). > > While we are in this class, it would be good to at least fix the > missing @returns tags in a number of methods, e.g. getDay, > getTimezone, getHour, getMinute, toGregorianCalendar. Also, it > @Override equals, hashCode, toString, and clone. > > Thanks, > > Joe > > On 7/18/2016 8:49 AM, Svetlana Nikandrova wrote: >> Hello all, >> >> please review this javadoc fix for >> javax.xml.datatype.XMLGregorianCalendar.getMonth() >> Webrev: >> http://cr.openjdk.java.net/~snikandrova/8021787/webrev.00/ >> >> JBS: >> https://bugs.openjdk.java.net/browse/JDK-8021787 >> >> Thank you, >> Svetlana > From Roger.Riggs at Oracle.com Tue Jul 19 14:02:44 2016 From: Roger.Riggs at Oracle.com (Roger Riggs) Date: Tue, 19 Jul 2016 10:02:44 -0400 Subject: RFR 9: JEP 290: Filter Incoming Serialization Data Message-ID: Please review the design, implementation, and tests of JEP 290: Filter Incoming Serialization Data[1] It allows incoming streams of object-serialization data to be filtered in order to improve both security and robustness. The JEP[1] has more detail on the background and scope. The core mechanism is a filter interface implemented by serialization clients and set on an |ObjectInputStream|. The filter is called during the deserialization process to validate the classes being deserialized, the sizes of arrays being created, and metrics describing stream length, stream depth, and number of references as the stream is being decoded. A process-wide filter can be configured that is applied to every ObjectInputStream. The API of ObjectInputStream can be used to set a custom filter to supersede or augment the process-wide filter. Webrev: http://cr.openjdk.java.net/~rriggs/webrev-serial-filter-jdk9-8155760/ SpecDiff: http://cr.openjdk.java.net/~rriggs/filter-diffs/overview-summary.html Javadoc (subset) http://cr.openjdk.java.net/~rriggs/filter-javadoc/java/io/ObjectInputStream.html http://cr.openjdk.java.net/~rriggs/filter-javadoc/java/io/ObjectInputFilter.html Comments appreciated, Roger [1] JEP 290: https://bugs.openjdk.java.net/browse/JDK-8154961 From brian.burkhalter at oracle.com Tue Jul 19 15:06:48 2016 From: brian.burkhalter at oracle.com (Brian Burkhalter) Date: Tue, 19 Jul 2016 08:06:48 -0700 Subject: JDK 9 RFR of 8161402: Provide a javadoc description for java.prefs module In-Reply-To: <09289752-a388-7906-c6bf-9cc59dd23a61@Oracle.com> References: <4DCDC178-0007-4129-8E4E-B7B654D03769@oracle.com> <09289752-a388-7906-c6bf-9cc59dd23a61@Oracle.com> Message-ID: It seems to me it would be less work overall if there were only one single issue to subsume adding the verbiage for all modules. There is only one single line of verbiage for each such issue and having so many reviews go around is a lot of noise. Then also if a CCC were required there would be only one. As suggested, there should be consistency in the verbiage without redundancy. A general template for the verbiage should be agreed upon first before the existing issues continue to be addressed or collapsed into one single issue. My $0.005. Brian From claes.redestad at oracle.com Tue Jul 19 15:16:01 2016 From: claes.redestad at oracle.com (Claes Redestad) Date: Tue, 19 Jul 2016 17:16:01 +0200 Subject: RFR: 8161379: Force inline methods calling Reflection.getCallerClass Message-ID: <578E4431.7060603@oracle.com> Hi, most @CallerSensitive methodscall Reflection.getCallerClass(), which turn out to have problematic performance characteristics when it fails to inline. Making @CallerSensitive imply @ForceInline actually works rather well across benchmarks, but didn't meet with approval from hotspot-compiler because it's a hack (unlike @ForceInline /s). Instead, here is a patch to explicitly @ForceInline those methods where it can plausibly be helping with performance: Webrev: http://cr.openjdk.java.net/~redestad/8161379/jdk.01/ Bug: https://bugs.openjdk.java.net/browse/JDK-8161379 Thanks! /Claes From Alan.Bateman at oracle.com Tue Jul 19 15:19:26 2016 From: Alan.Bateman at oracle.com (Alan Bateman) Date: Tue, 19 Jul 2016 16:19:26 +0100 Subject: JDK 9 RFR of 8161402: Provide a javadoc description for java.prefs module In-Reply-To: References: <4DCDC178-0007-4129-8E4E-B7B654D03769@oracle.com> <09289752-a388-7906-c6bf-9cc59dd23a61@Oracle.com> Message-ID: On 19/07/2016 16:06, Brian Burkhalter wrote: > It seems to me it would be less work overall if there were only one single issue to subsume adding the verbiage for all modules. There is only one single line of verbiage for each such issue and having so many reviews go around is a lot of noise. Then also if a CCC were required there would be only one. As suggested, there should be consistency in the verbiage without redundancy. A general template for the verbiage should be agreed upon first before the existing issues continue to be addressed or collapsed into one single issue. > I agree, I think we should close the bulk of these issues and replace with one issue. Shura - are you okay if we close all the issues that you created and replace them with one? -Alan From alexandre.iline at oracle.com Tue Jul 19 15:20:40 2016 From: alexandre.iline at oracle.com (Alexandre (Shura) Iline) Date: Tue, 19 Jul 2016 08:20:40 -0700 Subject: JDK 9 RFR of 8161402: Provide a javadoc description for java.prefs module In-Reply-To: References: <4DCDC178-0007-4129-8E4E-B7B654D03769@oracle.com> <09289752-a388-7906-c6bf-9cc59dd23a61@Oracle.com> Message-ID: <72F74301-C748-4F83-AC28-82C9EB32822B@oracle.com> > On Jul 19, 2016, at 8:19 AM, Alan Bateman wrote: > > On 19/07/2016 16:06, Brian Burkhalter wrote: > >> It seems to me it would be less work overall if there were only one single issue to subsume adding the verbiage for all modules. There is only one single line of verbiage for each such issue and having so many reviews go around is a lot of noise. Then also if a CCC were required there would be only one. As suggested, there should be consistency in the verbiage without redundancy. A general template for the verbiage should be agreed upon first before the existing issues continue to be addressed or collapsed into one single issue. >> > I agree, I think we should close the bulk of these issues and replace with one issue. > > Shura - are you okay if we close all the issues that you created and replace them with one? Absolutely. Shura > > -Alan From xueming.shen at oracle.com Tue Jul 19 15:24:52 2016 From: xueming.shen at oracle.com (Xueming Shen) Date: Tue, 19 Jul 2016 08:24:52 -0700 Subject: RFR JDK-8155616: java/util/zip/TestLocalTime.java fails intermittently with storing mtime failed In-Reply-To: <578DD5B5.4060304@oracle.com> References: <578DC74F.3070909@oracle.com> <578DD5B5.4060304@oracle.com> Message-ID: <71983c2e-584d-f516-10c7-2fc3e63e258d@oracle.com> Thanks Amy! webrev has been updated accordingly for the copyright header. Sherman On 7/19/16 12:24 AM, Amy Lu wrote: > Thanks for the fix, really a corner case. > > I think this looks reasonable. > > Just one minor thing, please update copyright header on the year when > commit. > > BTW. I'm not official reviewer. > > Thanks, > Amy > > On 7/19/16 2:23 PM, Xueming Shen wrote: >> Hi Amy, >> >> I finally got to the bottom of this failure. It appears the >> timestamps that >> trigger the failure are those that (1) < 1980 and (2) within the >> daylight saving >> time gap, which means the local date-time is actually not valid, for >> example >> 1968-04-28/2:51:25, this ldt should be adjusted to 3:51:25 when switched >> to summer time. This is really a corner case that should not have any >> real >> impact to real world use scenario. The implementation itself is >> correct. Just the >> test case need adjusted. Please help review. >> >> issue: https://bugs.openjdk.java.net/browse/JDK-8155616 >> webrev: http://cr.openjdk.java.net/~sherman/8155616/webrev >> >> Thanks, >> Sherman >> > From pbenedict at apache.org Tue Jul 19 15:28:23 2016 From: pbenedict at apache.org (Paul Benedict) Date: Tue, 19 Jul 2016 10:28:23 -0500 Subject: Question on MVJAR usage Message-ID: I have some questions. I believe core-lib is the right place. If not please let me know. 1) Given a Java 9 runtime, is there any perceptible difference between a non-multiversion jar, and a versioned jar which has placed all its classes under /META-INF/versions/9 ? Pretend each jar has the same identical binaries/resources. 2) Does the runtime care if the class version does not match what's under /META-INF/versions/9? For example, what if I have targeted a Java 8 class file format under versions/9? 3) Why does the new MVJAR JEP writeup [1] use versions/8 in the example? Is it simply for illustration, but I don't see how that's a useful example since it's an impossibility. There is no MVJAR support prior to Java 8 so isn't a better (and realer) example be /9 and /10? 3) The same MVJAR JEP writeup doesn't clearly indicate what is considered a "platform version". All the examples show a single digit, but I believe Verona [2] has specificed the platform to include both major and minor versions. For example, Verona says the minor version may include "revisions to standard APIs mandated by a Maintenance Release of the relevant Platform Specification". Because it mentions platform, it should be possible to do /9, /9.0, and /9.1. Please advise? 4) Although MVJAR JEP writeup says "JAR metadata, such as that found in the MANIFEST.MF file and the META-INF/services directory, need not be versioned." The keyword here is "need not" which is not the same as "can not" or "may not". So if it is needed, how does one version different services for different platforms? Can there be /META-INF under the appropriate versioned folder? Maybe /META-INF/versions/9/META-INF? I do not see anything in the JEP that says it's supported or non-supported. Please advise. [1] http://openjdk.java.net/jeps/238 [2] http://openjdk.java.net/jeps/223 Cheers, Paul From brian.burkhalter at oracle.com Tue Jul 19 15:31:33 2016 From: brian.burkhalter at oracle.com (Brian Burkhalter) Date: Tue, 19 Jul 2016 08:31:33 -0700 Subject: JDK 9 RFR of 8161402: Provide a javadoc description for java.prefs module In-Reply-To: <72F74301-C748-4F83-AC28-82C9EB32822B@oracle.com> References: <4DCDC178-0007-4129-8E4E-B7B654D03769@oracle.com> <09289752-a388-7906-c6bf-9cc59dd23a61@Oracle.com> <72F74301-C748-4F83-AC28-82C9EB32822B@oracle.com> Message-ID: <9E6376C9-0626-46DD-95E2-CDAAB5ABF364@oracle.com> On Jul 19, 2016, at 8:20 AM, Alexandre (Shura) Iline wrote: >> On Jul 19, 2016, at 8:19 AM, Alan Bateman wrote: >> >> I agree, I think we should close the bulk of these issues and replace with one issue. >> >> Shura - are you okay if we close all the issues that you created and replace them with one? > > Absolutely. If no one else wants to do it I can take this task of collapsing the issues, etc. It should comprise also reexamining the verbiage already in place (java.base, java.desktop, etc.). Brian From Roger.Riggs at Oracle.com Tue Jul 19 15:39:49 2016 From: Roger.Riggs at Oracle.com (Roger Riggs) Date: Tue, 19 Jul 2016 11:39:49 -0400 Subject: RFR JDK-8155616: java/util/zip/TestLocalTime.java fails intermittently with storing mtime failed In-Reply-To: <71983c2e-584d-f516-10c7-2fc3e63e258d@oracle.com> References: <578DC74F.3070909@oracle.com> <578DD5B5.4060304@oracle.com> <71983c2e-584d-f516-10c7-2fc3e63e258d@oracle.com> Message-ID: <5bfe478d-b50c-8493-54d1-d73cb72d1a03@Oracle.com> Hi Sherman, Looks good to normalize to the system timezone, even if it was changed. +1, Roger On 7/19/2016 11:24 AM, Xueming Shen wrote: > Thanks Amy! > > webrev has been updated accordingly for the copyright header. > > Sherman > > On 7/19/16 12:24 AM, Amy Lu wrote: >> Thanks for the fix, really a corner case. >> >> I think this looks reasonable. >> >> Just one minor thing, please update copyright header on the year when >> commit. >> >> BTW. I'm not official reviewer. >> >> Thanks, >> Amy >> >> On 7/19/16 2:23 PM, Xueming Shen wrote: >>> Hi Amy, >>> >>> I finally got to the bottom of this failure. It appears the >>> timestamps that >>> trigger the failure are those that (1) < 1980 and (2) within the >>> daylight saving >>> time gap, which means the local date-time is actually not valid, for >>> example >>> 1968-04-28/2:51:25, this ldt should be adjusted to 3:51:25 when >>> switched >>> to summer time. This is really a corner case that should not have >>> any real >>> impact to real world use scenario. The implementation itself is >>> correct. Just the >>> test case need adjusted. Please help review. >>> >>> issue: https://bugs.openjdk.java.net/browse/JDK-8155616 >>> webrev: http://cr.openjdk.java.net/~sherman/8155616/webrev >>> >>> Thanks, >>> Sherman >>> >> > From svetlana.nikandrova at oracle.com Tue Jul 19 16:29:01 2016 From: svetlana.nikandrova at oracle.com (Svetlana Nikandrova) Date: Tue, 19 Jul 2016 19:29:01 +0300 Subject: [8u-dev] RFR (JAXP) 8028363: XmlGregorianCalendarImpl.getTimeZone() bug when offset is less than 10 minutes Message-ID: <578E554D.5090502@oracle.com> Hello, please review this fix for 8u-dev. For jdk9 problem has been addressed in JEP 255 (Xerces update). Please note that changeset contains of 2 parts: XMLGregorianCalendarImpl fix in jaxp ws: http://cr.openjdk.java.net/~snikandrova/8028363/jaxp/webrev.00/ Regression test in jdk ws: http://cr.openjdk.java.net/~snikandrova/8028363/jdk/webrev.00/ JBS: https://bugs.openjdk.java.net/browse/JDK-8028363 Description: While concatenating timezone representations string for TimeZone.getTimeZone() XmlGregorianCalendarImpl missed prior "0" in minutes part if minutes value is less then 10 (like "0" in 11:05). Thank you, Svetlana From steve.drach at oracle.com Tue Jul 19 16:33:49 2016 From: steve.drach at oracle.com (Steve Drach) Date: Tue, 19 Jul 2016 09:33:49 -0700 Subject: RFR: 8157524 Revert JarFile methods "entries" and "stream" to Java 8 behavior In-Reply-To: References: <152083C7-7593-4231-BD0C-F0734B16E14E@oracle.com> <1DC235CC-CCD2-447E-AD7D-CD41E7195CFA@oracle.com> Message-ID: <4EEC9046-A5C0-4223-ABA0-909EB0B81E10@oracle.com> It doesn?t add that much value. I?ll take it out. > On Jul 19, 2016, at 1:12 AM, Paul Sandoz wrote: > > >> On 18 Jul 2016, at 20:06, Steve Drach wrote: >> >>> >>> I would be inclined to drop the note for Enumeration and add a @see tag referencing the Stream returned method. >> >> I actually had to use the versionedEntries method for jdeps. Because of that and because I don?t see the harm with leaving it in, I left it in. >> > > You are implicitly making reference in the @apiNote note of entries() to a method in the @apiNote of stream() > > 533 * Iterator it = versionedStream(jf).iterator(); > > That?s quite confusing. If you wanna keep the @apiNote in entires i recommend keep the two notes independent, and also add a @see to stream(). > > Paul. From steve.drach at oracle.com Tue Jul 19 18:41:34 2016 From: steve.drach at oracle.com (Steve Drach) Date: Tue, 19 Jul 2016 11:41:34 -0700 Subject: Question on MVJAR usage In-Reply-To: References: Message-ID: <5260A08B-6BB1-4801-B358-745B4305B528@oracle.com> Hi Paul, > I have some questions. I believe core-lib is the right place. If not please > let me know. This is the right place. First, the name was changed to Multi-Release JAR, so it?s MRJAR (or Mr. Jar) instead of MVJAR. > > 1) Given a Java 9 runtime, is there any perceptible difference between a > non-multiversion jar, and a versioned jar which has placed all its classes > under /META-INF/versions/9 ? Pretend each jar has the same identical > binaries/resources. There is probably a small difference in performance although I haven?t measured it. Whether the difference is perceptible or not probably depends on the characteristics of the sensor. > > 2) Does the runtime care if the class version does not match what's under > /META-INF/versions/9? For example, what if I have targeted a Java 8 class > file format under versions/9? The MRJAR runtime does not care. However if you put a class file targeted for Java 10 in the /META-INF/versions/9 directory and run it on a Java 9 platform, you?ll probably get an error. > > 3) Why does the new MVJAR JEP writeup [1] use versions/8 in the example? Because we don?t have a real example that uses Java 9 and the JEP was written when we thought we?d target this feature for Java 8. > Is > it simply for illustration, but I don't see how that's a useful example > since it's an impossibility. There is no MVJAR support prior to Java 8 so > isn't a better (and realer) example be /9 and /10? Yes, it would be better, but as I said, we don?t have a real world example yet, so anything we do would be a contrived example. We probably need to do something with that part of the JEP. > > 3) The same MVJAR JEP writeup doesn't clearly indicate what is considered a > "platform version". All the examples show a single digit, but I believe > Verona [2] has specificed the platform to include both major and minor > versions. For example, Verona says the minor version may include "revisions > to standard APIs mandated by a Maintenance Release of the relevant Platform > Specification". Because it mentions platform, it should be possible to do > /9, /9.0, and /9.1. Please advise? Platform versions are major versions, i.e. 8, 9, 10, etc. They are the values derived from Runtime.Version::major > > 4) Although MVJAR JEP writeup says "JAR metadata, such as that found in the > MANIFEST.MF file and the META-INF/services directory, need not be > versioned." The keyword here is "need not" which is not the same as "can > not" or "may not?. Yes, you are right, it?s incorrect. Perhaps it should say "JAR metadata, such as that found in the MANIFEST.MF file and the META-INF/services directory, are not versioned.? > So if it is needed, how does one version different > services for different platforms? It can?t be done. > Can there be /META-INF under the > appropriate versioned folder? Technically, it can be done but it won?t be interpreted as a ?true? META-INF directory, it?ll just be a path component for the jar entry. > Maybe /META-INF/versions/9/META-INF? You won?t achieve what you expect, depending of course on what you expect. ;-) > I do not > see anything in the JEP that says it's supported or non-supported. Please > advise. It?s not supported. > > [1] http://openjdk.java.net/jeps/238 > [2] http://openjdk.java.net/jeps/223 > > Cheers, > Paul From pbenedict at apache.org Tue Jul 19 18:48:57 2016 From: pbenedict at apache.org (Paul Benedict) Date: Tue, 19 Jul 2016 13:48:57 -0500 Subject: Question on MVJAR usage In-Reply-To: <5260A08B-6BB1-4801-B358-745B4305B528@oracle.com> References: <5260A08B-6BB1-4801-B358-745B4305B528@oracle.com> Message-ID: Thank you Steve. I have only one follow-up then. If the platform version is *always* a major version, does that imply that minor versions will not add API? The big benefit of MRJAR :-) is that I can provide separate code for different targeted runtimes. If 9.1 wouldn't add new API, then I am good. If that's the policy, great. I just want to confirm it is because I don't see too much of a technical difference between the two cases (8 to 9 vs 9.0 to 9.1). Does that make sense? Cheers, Paul On Tue, Jul 19, 2016 at 1:41 PM, Steve Drach wrote: > Hi Paul, > > > I have some questions. I believe core-lib is the right place. If not > please > > let me know. > > This is the right place. First, the name was changed to Multi-Release > JAR, so it?s MRJAR (or Mr. Jar) instead of MVJAR. > > > > > 1) Given a Java 9 runtime, is there any perceptible difference between a > > non-multiversion jar, and a versioned jar which has placed all its > classes > > under /META-INF/versions/9 ? Pretend each jar has the same identical > > binaries/resources. > > There is probably a small difference in performance although I haven?t > measured it. Whether the difference is perceptible or not probably depends > on the characteristics of the sensor. > > > > > 2) Does the runtime care if the class version does not match what's under > > /META-INF/versions/9? For example, what if I have targeted a Java 8 class > > file format under versions/9? > > The MRJAR runtime does not care. However if you put a class file targeted > for Java 10 in the /META-INF/versions/9 directory and run it on a Java 9 > platform, you?ll probably get an error. > > > > > 3) Why does the new MVJAR JEP writeup [1] use versions/8 in the example? > > Because we don?t have a real example that uses Java 9 and the JEP was > written when we thought we?d target this feature for Java 8. > > > Is > > it simply for illustration, but I don't see how that's a useful example > > since it's an impossibility. There is no MVJAR support prior to Java 8 so > > isn't a better (and realer) example be /9 and /10? > > Yes, it would be better, but as I said, we don?t have a real world example > yet, so anything we do would be a contrived example. We probably need to > do something with that part of the JEP. > > > > > 3) The same MVJAR JEP writeup doesn't clearly indicate what is > considered a > > "platform version". All the examples show a single digit, but I believe > > Verona [2] has specificed the platform to include both major and minor > > versions. For example, Verona says the minor version may include > "revisions > > to standard APIs mandated by a Maintenance Release of the relevant > Platform > > Specification". Because it mentions platform, it should be possible to do > > /9, /9.0, and /9.1. Please advise? > > Platform versions are major versions, i.e. 8, 9, 10, etc. They are the > values derived from Runtime.Version::major > > > > > 4) Although MVJAR JEP writeup says "JAR metadata, such as that found in > the > > MANIFEST.MF file and the META-INF/services directory, need not be > > versioned." The keyword here is "need not" which is not the same as "can > > not" or "may not?. > > Yes, you are right, it?s incorrect. Perhaps it should say "JAR metadata, > such as that found in the MANIFEST.MF file and the META-INF/services > directory, are not versioned.? > > > So if it is needed, how does one version different > > services for different platforms? > > It can?t be done. > > > Can there be /META-INF under the > > appropriate versioned folder? > > Technically, it can be done but it won?t be interpreted as a ?true? > META-INF directory, it?ll just be a path component for the jar entry. > > > Maybe /META-INF/versions/9/META-INF? > > You won?t achieve what you expect, depending of course on what you expect. > ;-) > > > I do not > > see anything in the JEP that says it's supported or non-supported. Please > > advise. > > It?s not supported. > > > > > [1] http://openjdk.java.net/jeps/238 > > [2] http://openjdk.java.net/jeps/223 > > > > Cheers, > > Paul > > From claes.redestad at oracle.com Tue Jul 19 19:17:02 2016 From: claes.redestad at oracle.com (Claes Redestad) Date: Tue, 19 Jul 2016 21:17:02 +0200 Subject: RFR: 8161588: MemberName::resolveOrNull cause and hide NoSuchMethodErrors Message-ID: <578E7CAE.6070705@oracle.com> Hi, please review this bug fix to ensure MemberName::resolveOrNull doesn't throw exceptions when speculatively looking up members that aren't there. HS: http://cr.openjdk.java.net/~redestad/8161588/hs.01 JDK: http://cr.openjdk.java.net/~redestad/8161588/jdk.01 This avoids throwing NoSuchMethodError etc just to be ignored, avoiding a performance penalty when looking things up speculatively (which is key to possible upcoming work to generate more JLI code with jlink). There's a pre-existing issue not dealt with by this fix in that the exceptions thrown in MHN_resolve_Mem are never observed, instead the exceptions thrown from various LinkResolver methods are observed. We could clear all pending exceptions in resolve_MemberName, but this breaks tests that are very particular about which exception is thrown when and where, thus I opted to add the clear_pending boolean to allow clearing the exception conditionally instead, keeping behavior identical for MemberName::resolveOrFail Thanks! /Claes From steve.drach at oracle.com Tue Jul 19 20:14:49 2016 From: steve.drach at oracle.com (Steve Drach) Date: Tue, 19 Jul 2016 13:14:49 -0700 Subject: Question on MVJAR usage In-Reply-To: References: <5260A08B-6BB1-4801-B358-745B4305B528@oracle.com> Message-ID: <045C6EB3-21B7-4D3C-A4C2-638B39A3D181@oracle.com> > Thank you Steve. I have only one follow-up then. If the platform version is *always* a major version, does that imply that minor versions will not add API? No. Minor releases can add new JDK specific apis. We?ve chosen to support only major release for now, a known restriction. > The big benefit of MRJAR :-) is that I can provide separate code for different targeted runtimes. If 9.1 wouldn't add new API, then I am good. If that's the policy, great. I just want to confirm it is because I don't see too much of a technical difference between the two cases (8 to 9 vs 9.0 to 9.1). Does that make sense? Yes, it makes sense, but as I said, it?s a known restriction. > > Cheers, > Paul > > On Tue, Jul 19, 2016 at 1:41 PM, Steve Drach > wrote: > Hi Paul, > > > I have some questions. I believe core-lib is the right place. If not please > > let me know. > > This is the right place. First, the name was changed to Multi-Release JAR, so it?s MRJAR (or Mr. Jar) instead of MVJAR. > > > > > 1) Given a Java 9 runtime, is there any perceptible difference between a > > non-multiversion jar, and a versioned jar which has placed all its classes > > under /META-INF/versions/9 ? Pretend each jar has the same identical > > binaries/resources. > > There is probably a small difference in performance although I haven?t measured it. Whether the difference is perceptible or not probably depends on the characteristics of the sensor. > > > > > 2) Does the runtime care if the class version does not match what's under > > /META-INF/versions/9? For example, what if I have targeted a Java 8 class > > file format under versions/9? > > The MRJAR runtime does not care. However if you put a class file targeted for Java 10 in the /META-INF/versions/9 directory and run it on a Java 9 platform, you?ll probably get an error. > > > > > 3) Why does the new MVJAR JEP writeup [1] use versions/8 in the example? > > Because we don?t have a real example that uses Java 9 and the JEP was written when we thought we?d target this feature for Java 8. > > > Is > > it simply for illustration, but I don't see how that's a useful example > > since it's an impossibility. There is no MVJAR support prior to Java 8 so > > isn't a better (and realer) example be /9 and /10? > > Yes, it would be better, but as I said, we don?t have a real world example yet, so anything we do would be a contrived example. We probably need to do something with that part of the JEP. > > > > > 3) The same MVJAR JEP writeup doesn't clearly indicate what is considered a > > "platform version". All the examples show a single digit, but I believe > > Verona [2] has specificed the platform to include both major and minor > > versions. For example, Verona says the minor version may include "revisions > > to standard APIs mandated by a Maintenance Release of the relevant Platform > > Specification". Because it mentions platform, it should be possible to do > > /9, /9.0, and /9.1. Please advise? > > Platform versions are major versions, i.e. 8, 9, 10, etc. They are the values derived from Runtime.Version::major > > > > > 4) Although MVJAR JEP writeup says "JAR metadata, such as that found in the > > MANIFEST.MF file and the META-INF/services directory, need not be > > versioned." The keyword here is "need not" which is not the same as "can > > not" or "may not?. > > Yes, you are right, it?s incorrect. Perhaps it should say "JAR metadata, such as that found in the MANIFEST.MF file and the META-INF/services directory, are not versioned.? > > > So if it is needed, how does one version different > > services for different platforms? > > It can?t be done. > > > Can there be /META-INF under the > > appropriate versioned folder? > > Technically, it can be done but it won?t be interpreted as a ?true? META-INF directory, it?ll just be a path component for the jar entry. > > > Maybe /META-INF/versions/9/META-INF? > > You won?t achieve what you expect, depending of course on what you expect. ;-) > > > I do not > > see anything in the JEP that says it's supported or non-supported. Please > > advise. > > It?s not supported. > > > > > [1] http://openjdk.java.net/jeps/238 > > [2] http://openjdk.java.net/jeps/223 > > > > Cheers, > > Paul > > From lance.andersen at oracle.com Tue Jul 19 21:43:57 2016 From: lance.andersen at oracle.com (Lance Andersen) Date: Tue, 19 Jul 2016 17:43:57 -0400 Subject: JDK 9 RFR of 8161402: Provide a javadoc description for java.prefs module In-Reply-To: <9E6376C9-0626-46DD-95E2-CDAAB5ABF364@oracle.com> References: <4DCDC178-0007-4129-8E4E-B7B654D03769@oracle.com> <09289752-a388-7906-c6bf-9cc59dd23a61@Oracle.com> <72F74301-C748-4F83-AC28-82C9EB32822B@oracle.com> <9E6376C9-0626-46DD-95E2-CDAAB5ABF364@oracle.com> Message-ID: <00AB10EB-A4BD-49D6-927C-FF60BC98B032@oracle.com> Brian and I exchanged email off-line. I will take ownership of this and grab the existing bugs Wed. Best Lance > On Jul 19, 2016, at 11:31 AM, Brian Burkhalter wrote: > > On Jul 19, 2016, at 8:20 AM, Alexandre (Shura) Iline wrote: > >>> On Jul 19, 2016, at 8:19 AM, Alan Bateman wrote: >>> >>> I agree, I think we should close the bulk of these issues and replace with one issue. >>> >>> Shura - are you okay if we close all the issues that you created and replace them with one? >> >> Absolutely. > > If no one else wants to do it I can take this task of collapsing the issues, etc. It should comprise also reexamining the verbiage already in place (java.base, java.desktop, etc.). > > Brian 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 alexandre.iline at oracle.com Tue Jul 19 21:52:01 2016 From: alexandre.iline at oracle.com (Alexandre (Shura) Iline) Date: Tue, 19 Jul 2016 14:52:01 -0700 Subject: JDK 9 RFR of 8161402: Provide a javadoc description for java.prefs module In-Reply-To: <00AB10EB-A4BD-49D6-927C-FF60BC98B032@oracle.com> References: <4DCDC178-0007-4129-8E4E-B7B654D03769@oracle.com> <09289752-a388-7906-c6bf-9cc59dd23a61@Oracle.com> <72F74301-C748-4F83-AC28-82C9EB32822B@oracle.com> <9E6376C9-0626-46DD-95E2-CDAAB5ABF364@oracle.com> <00AB10EB-A4BD-49D6-927C-FF60BC98B032@oracle.com> Message-ID: I was originally assuming that different engineers would be responsible for providing descriptions for different modules ? if to merge all that into one bug, a single person will either have to come up with everything himself/herself or go around and ask for all the description in the e-mail. Should we instead create an umbrella issue which the sub-tasks suggesting descriptions in the comments or something similar? Shura > On Jul 19, 2016, at 2:43 PM, Lance Andersen wrote: > > Brian and I exchanged email off-line. I will take ownership of this and grab the existing bugs Wed. > > Best > Lance >> On Jul 19, 2016, at 11:31 AM, Brian Burkhalter > wrote: >> >> On Jul 19, 2016, at 8:20 AM, Alexandre (Shura) Iline > wrote: >> >>>> On Jul 19, 2016, at 8:19 AM, Alan Bateman > wrote: >>>> >>>> I agree, I think we should close the bulk of these issues and replace with one issue. >>>> >>>> Shura - are you okay if we close all the issues that you created and replace them with one? >>> >>> Absolutely. >> >> If no one else wants to do it I can take this task of collapsing the issues, etc. It should comprise also reexamining the verbiage already in place (java.base, java.desktop, etc.). >> >> Brian > > > > 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 Tue Jul 19 21:59:56 2016 From: lance.andersen at oracle.com (Lance Andersen) Date: Tue, 19 Jul 2016 17:59:56 -0400 Subject: JDK 9 RFR of 8161402: Provide a javadoc description for java.prefs module In-Reply-To: References: <4DCDC178-0007-4129-8E4E-B7B654D03769@oracle.com> <09289752-a388-7906-c6bf-9cc59dd23a61@Oracle.com> <72F74301-C748-4F83-AC28-82C9EB32822B@oracle.com> <9E6376C9-0626-46DD-95E2-CDAAB5ABF364@oracle.com> <00AB10EB-A4BD-49D6-927C-FF60BC98B032@oracle.com> Message-ID: <2F692250-D6C7-4F8C-9A30-13F59F4B5324@oracle.com> OK, now I am confused :-) Earlier in the thread, it was raised that it would be more efficient to have 1 bug and 1 owner. Your reply seemed to agree to that, but now it looks like you are rethinking this? The module descriptions seemed to all be something similar to The {@code java.XXX} module defines and exports the XXX API At least that is what was being proposed on the thread for] Brian?s changeset Best Lance > On Jul 19, 2016, at 5:52 PM, Alexandre (Shura) Iline wrote: > > I was originally assuming that different engineers would be responsible for providing descriptions for different modules ? if to merge all that into one bug, a single person will either have to come up with everything himself/herself or go around and ask for all the description in the e-mail. Should we instead create an umbrella issue which the sub-tasks suggesting descriptions in the comments or something similar? > > Shura > >> On Jul 19, 2016, at 2:43 PM, Lance Andersen > wrote: >> >> Brian and I exchanged email off-line. I will take ownership of this and grab the existing bugs Wed. >> >> Best >> Lance >>> On Jul 19, 2016, at 11:31 AM, Brian Burkhalter > wrote: >>> >>> On Jul 19, 2016, at 8:20 AM, Alexandre (Shura) Iline > wrote: >>> >>>>> On Jul 19, 2016, at 8:19 AM, Alan Bateman > wrote: >>>>> >>>>> I agree, I think we should close the bulk of these issues and replace with one issue. >>>>> >>>>> Shura - are you okay if we close all the issues that you created and replace them with one? >>>> >>>> Absolutely. >>> >>> If no one else wants to do it I can take this task of collapsing the issues, etc. It should comprise also reexamining the verbiage already in place (java.base, java.desktop, etc.). >>> >>> Brian >> >> >> >> 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 alexandre.iline at oracle.com Tue Jul 19 22:06:14 2016 From: alexandre.iline at oracle.com (Alexandre (Shura) Iline) Date: Tue, 19 Jul 2016 15:06:14 -0700 Subject: JDK 9 RFR of 8161402: Provide a javadoc description for java.prefs module In-Reply-To: <2F692250-D6C7-4F8C-9A30-13F59F4B5324@oracle.com> References: <4DCDC178-0007-4129-8E4E-B7B654D03769@oracle.com> <09289752-a388-7906-c6bf-9cc59dd23a61@Oracle.com> <72F74301-C748-4F83-AC28-82C9EB32822B@oracle.com> <9E6376C9-0626-46DD-95E2-CDAAB5ABF364@oracle.com> <00AB10EB-A4BD-49D6-927C-FF60BC98B032@oracle.com> <2F692250-D6C7-4F8C-9A30-13F59F4B5324@oracle.com> Message-ID: > On Jul 19, 2016, at 2:59 PM, Lance Andersen wrote: > > OK, now I am confused :-) > > Earlier in the thread, it was raised that it would be more efficient to have 1 bug and 1 owner. Your reply seemed to agree to that, but now it looks like you are rethinking this? > > The module descriptions seemed to all be something similar to > > The {@code java.XXX} module defines and exports the XXX API > > At least that is what was being proposed on the thread for] Brian?s changes In that case it is of course possible to do by a single person. If somebody wants to provide a thorough description, he or she will have to create another bug. Shura > > Best > Lance >> On Jul 19, 2016, at 5:52 PM, Alexandre (Shura) Iline > wrote: >> >> I was originally assuming that different engineers would be responsible for providing descriptions for different modules ? if to merge all that into one bug, a single person will either have to come up with everything himself/herself or go around and ask for all the description in the e-mail. Should we instead create an umbrella issue which the sub-tasks suggesting descriptions in the comments or something similar? >> >> Shura >> >>> On Jul 19, 2016, at 2:43 PM, Lance Andersen > wrote: >>> >>> Brian and I exchanged email off-line. I will take ownership of this and grab the existing bugs Wed. >>> >>> Best >>> Lance >>>> On Jul 19, 2016, at 11:31 AM, Brian Burkhalter > wrote: >>>> >>>> On Jul 19, 2016, at 8:20 AM, Alexandre (Shura) Iline > wrote: >>>> >>>>>> On Jul 19, 2016, at 8:19 AM, Alan Bateman > wrote: >>>>>> >>>>>> I agree, I think we should close the bulk of these issues and replace with one issue. >>>>>> >>>>>> Shura - are you okay if we close all the issues that you created and replace them with one? >>>>> >>>>> Absolutely. >>>> >>>> If no one else wants to do it I can take this task of collapsing the issues, etc. It should comprise also reexamining the verbiage already in place (java.base, java.desktop, etc.). >>>> >>>> Brian >>> >>> >>> >>> 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 brent.christian at oracle.com Tue Jul 19 23:26:57 2016 From: brent.christian at oracle.com (Brent Christian) Date: Tue, 19 Jul 2016 16:26:57 -0700 Subject: RFR 9 : 8161718 : Copyright/License updates to corba, jdk Message-ID: <67ace086-07ea-076b-06b0-070a48f7cf59@oracle.com> Hi, Please review some spacing and punctuation changes that should be made to the copyright and license text in the corba and jdk repositories. No code changes. Bug: https://bugs.openjdk.java.net/browse/JDK-8161718 Webrev: http://cr.openjdk.java.net/~bchristi/8161718/webrev.00/index.html -Brent From brian.burkhalter at oracle.com Tue Jul 19 23:45:22 2016 From: brian.burkhalter at oracle.com (Brian Burkhalter) Date: Tue, 19 Jul 2016 16:45:22 -0700 Subject: RFR 9 : 8161718 : Copyright/License updates to corba, jdk In-Reply-To: <67ace086-07ea-076b-06b0-070a48f7cf59@oracle.com> References: <67ace086-07ea-076b-06b0-070a48f7cf59@oracle.com> Message-ID: <49CB29FC-0119-4A74-8F30-AF2C2FA03EC0@oracle.com> Hi Brent, Looks OK to me. Brian On Jul 19, 2016, at 4:26 PM, Brent Christian wrote: > Hi, > > Please review some spacing and punctuation changes that should be made to the copyright and license text in the corba and jdk repositories. No code changes. > > Bug: https://bugs.openjdk.java.net/browse/JDK-8161718 > Webrev: http://cr.openjdk.java.net/~bchristi/8161718/webrev.00/index.html > > -Brent From naoto.sato at oracle.com Tue Jul 19 23:46:23 2016 From: naoto.sato at oracle.com (Naoto Sato) Date: Tue, 19 Jul 2016 16:46:23 -0700 Subject: RFR 9 : 8161718 : Copyright/License updates to corba, jdk In-Reply-To: <49CB29FC-0119-4A74-8F30-AF2C2FA03EC0@oracle.com> References: <67ace086-07ea-076b-06b0-070a48f7cf59@oracle.com> <49CB29FC-0119-4A74-8F30-AF2C2FA03EC0@oracle.com> Message-ID: <24f14eb7-1ca3-a4e6-eb9f-d8856a21ba1d@oracle.com> +1 Naoto On 7/19/16 4:45 PM, Brian Burkhalter wrote: > Hi Brent, > > Looks OK to me. > > Brian > > On Jul 19, 2016, at 4:26 PM, Brent Christian wrote: > >> Hi, >> >> Please review some spacing and punctuation changes that should be made to the copyright and license text in the corba and jdk repositories. No code changes. >> >> Bug: https://bugs.openjdk.java.net/browse/JDK-8161718 >> Webrev: http://cr.openjdk.java.net/~bchristi/8161718/webrev.00/index.html >> >> -Brent > From brent.christian at oracle.com Tue Jul 19 23:47:43 2016 From: brent.christian at oracle.com (Brent Christian) Date: Tue, 19 Jul 2016 16:47:43 -0700 Subject: RFR 9 : 8161718 : Copyright/License updates to corba, jdk In-Reply-To: <24f14eb7-1ca3-a4e6-eb9f-d8856a21ba1d@oracle.com> References: <67ace086-07ea-076b-06b0-070a48f7cf59@oracle.com> <49CB29FC-0119-4A74-8F30-AF2C2FA03EC0@oracle.com> <24f14eb7-1ca3-a4e6-eb9f-d8856a21ba1d@oracle.com> Message-ID: Thank you, Brian and Naoto! -Brent On 7/19/16 4:46 PM, Naoto Sato wrote: > +1 > > Naoto > > On 7/19/16 4:45 PM, Brian Burkhalter wrote: >> Hi Brent, >> >> Looks OK to me. >> >> Brian >> >> On Jul 19, 2016, at 4:26 PM, Brent Christian >> wrote: >> >>> Hi, >>> >>> Please review some spacing and punctuation changes that should be >>> made to the copyright and license text in the corba and jdk >>> repositories. No code changes. >>> >>> Bug: https://bugs.openjdk.java.net/browse/JDK-8161718 >>> Webrev: >>> http://cr.openjdk.java.net/~bchristi/8161718/webrev.00/index.html >>> >>> -Brent >> From weijun.wang at oracle.com Wed Jul 20 03:18:06 2016 From: weijun.wang at oracle.com (Wang Weijun) Date: Wed, 20 Jul 2016 11:18:06 +0800 Subject: RFR 9: JEP 290: Filter Incoming Serialization Data In-Reply-To: References: Message-ID: The ObjectInputFilter interface has only one method. Are we expecting more methods to be added later and maybe some people will only be interested in a new method? If yes, I suggest we provide a default implementation of the current method to return ALLOWED. --Max > On Jul 19, 2016, at 10:02 PM, Roger Riggs wrote: > > Please review the design, implementation, and tests of JEP 290: Filter Incoming Serialization Data[1] From peter.levart at gmail.com Wed Jul 20 08:19:29 2016 From: peter.levart at gmail.com (Peter Levart) Date: Wed, 20 Jul 2016 10:19:29 +0200 Subject: RFR 9: JEP 290: Filter Incoming Serialization Data In-Reply-To: References: Message-ID: <97bdccb1-3aca-a354-4eb6-4df1e79dac94@gmail.com> Hi Roger, On first reading, I have the following thoughts: - The name "ObjectInputFilter" makes me think that it is a function that "filters" the input stream (like a Predicate in Stream::filter(Predicate)), but it is in fact a validator that terminates deserialization on 1st rejection. So perhaps a different name is in order - ObjectInputValidator ? - I haven't found in the public javadocs, an explanation of what happens when the filter returns ALLOWED, REJECTED or UNDECIDED. Docs just say that the deserialization is terminated (on UNDECIDED too?) but not with what exception (there is some explanation on OIS::filterCheck, but this is a private method). - The crux of behavioral docs is on the OIS::setObjectInputFilter method. I would expect it to be on the ObjectInputFilter class, but I understand that OIS subclasses might have a different behavior. How do they behave indeed? For example IIOPInputStream does not use the filter, right? - I had some trouble to precisely understand the behavior from the docs alone. The following in OIS::setObjectInputFilter: 1174 * @implSpec 1175 * The filter, when {@code non-null}, is invoked during {@linkplain #readObject()} 1176 * for each object (regular or class) in the stream including the following: 1177 *

    1178 *
  • each object reference previously deserialized from the stream, 1179 *
  • each regular class, 1180 *
  • each interface of a dynamic proxy and the dynamic proxy class itself, 1181 *
  • each array is filtered using the array size and the type of the array, 1182 *
  • each object replaced by its class' {@code readResolve} method 1183 * is filtered using the replacement object's class and if it is an array, the length, 1184 *
  • and each object replaced by {@linkplain #resolveObject resolveObject} 1185 * is filtered using the replacement object's class and if it is an array, the length. 1186 *
1187 * 1188 * When the {@link ObjectInputFilter#checkInput checkInput} method is invoked 1189 * it is passed the current class, (null if no class), ...does not specify when the passed-in class might be "null". Reading the implementation, I see it is null when a back reference to previously deserialized object is read from stream, but javadocs are not clear about that. - I wonder if invoking the filter for each interface of a dynamic proxy is necessary (other properties passed to the filter don't change during iteration through the interfaces and each interface call-back is not an indicator that an object is about to be read-in next). This is not uniform with other objects where the filter is invoked only once. Why is a dynamic proxy so special? If one wants to check the proxy interfaces in the filter, she can obtain them manually: if (Proxy.isProxyClass(clazz)) { for (Class intf : class.getInterfaces()) { ... } } - The docs might be more clear about when precisely the filter is invoked (i.e. after the type of the object and possible length of array or the back reference has already been read from the stream, but the object state has not been read yet). This is important to correctly interpret the streamBytes parameter. The docs might also be more clear about when the nRefs is incremented (it says: "for each call". Is it before or after the call?). - What is the purpose of the UNDECIDED return? I suspect it is meant to be used in some filter implementation that delegates the validation to some "parent" filter and respects its decision unless it is UNDECIDED in which case it decides (or does not) on its own. Should such strategy be mentioned in the docs to encourage inter-operable filter implementations? - The call-back is invoked after the type of the object and possible array length is read from stream but before the object's state is read. Suppose that the object that is about to be read is either Externalizable object or an object with a readObject() method(s) that consume block data from the stream. This block data can be large. Should there be a call-back to "announce" the block data too? (for example, when the 'clazz' is null and the 'size' is 0, the call-back reports a back-reference to a previously read object, but when the 'clazz' is null and the 'size' > 0, it announces the 'size' bytes of block data. Does this make sense?) That's it for the start. If I notice something else, I'll post again. Regards, Peter On 07/19/2016 04:02 PM, Roger Riggs wrote: > Please review the design, implementation, and tests of JEP 290: Filter > Incoming Serialization Data[1] > > It allows incoming streams of object-serialization data to be filtered > in order to improve both security and robustness. > The JEP[1] has more detail on the background and scope. > > The core mechanism is a filter interface implemented by serialization > clients and set on an |ObjectInputStream|. The filter is called during > the deserialization process to validate the classes being > deserialized, the sizes of arrays being created, and metrics > describing stream length, stream depth, and number of references as > the stream is being decoded. > > A process-wide filter can be configured that is applied to every > ObjectInputStream. > The API of ObjectInputStream can be used to set a custom filter to > supersede or augment the process-wide filter. > > Webrev: > http://cr.openjdk.java.net/~rriggs/webrev-serial-filter-jdk9-8155760/ > > SpecDiff: > http://cr.openjdk.java.net/~rriggs/filter-diffs/overview-summary.html > > Javadoc (subset) > http://cr.openjdk.java.net/~rriggs/filter-javadoc/java/io/ObjectInputStream.html > > http://cr.openjdk.java.net/~rriggs/filter-javadoc/java/io/ObjectInputFilter.html > > > Comments appreciated, Roger > > [1] JEP 290: https://bugs.openjdk.java.net/browse/JDK-8154961 > From Roger.Riggs at Oracle.com Wed Jul 20 13:30:06 2016 From: Roger.Riggs at Oracle.com (Roger Riggs) Date: Wed, 20 Jul 2016 09:30:06 -0400 Subject: RFR 9: JEP 290: Filter Incoming Serialization Data In-Reply-To: References: Message-ID: <16ee7f86-7ae2-b93b-e46b-e2c315f7db71@Oracle.com> Hi Max, The use of filtering needs to be very intentional and so an implementation should be required. I don't expect there to be additional methods and if so a default for checkInput could be added at that time. Roger On 7/19/2016 11:18 PM, Wang Weijun wrote: > The ObjectInputFilter interface has only one method. Are we expecting more methods to be added later and maybe some people will only be interested in a new method? If yes, I suggest we provide a default implementation of the current method to return ALLOWED. > > --Max > >> On Jul 19, 2016, at 10:02 PM, Roger Riggs wrote: >> >> Please review the design, implementation, and tests of JEP 290: Filter Incoming Serialization Data[1] From daniel.fuchs at oracle.com Wed Jul 20 14:22:22 2016 From: daniel.fuchs at oracle.com (Daniel Fuchs) Date: Wed, 20 Jul 2016 15:22:22 +0100 Subject: RFR 9: JEP 290: Filter Incoming Serialization Data In-Reply-To: References: Message-ID: <279da5eb-d7d3-c883-8638-a0852ab81870@oracle.com> Hi Roger, 3901 /** 3902 * Method for getting the array size for any array. 3903 */ 3904 private static int arrayLength(Object array) { why not using java.lang.reflect.Array::getLength? best regards, -- daniel On 19/07/16 15:02, Roger Riggs wrote: > Please review the design, implementation, and tests of JEP 290: Filter > Incoming Serialization Data[1] > > It allows incoming streams of object-serialization data to be filtered > in order to improve both security and robustness. > The JEP[1] has more detail on the background and scope. > > The core mechanism is a filter interface implemented by serialization > clients and set on an |ObjectInputStream|. The filter is called during > the deserialization process to validate the classes being deserialized, > the sizes of arrays being created, and metrics describing stream length, > stream depth, and number of references as the stream is being decoded. > > A process-wide filter can be configured that is applied to every > ObjectInputStream. > The API of ObjectInputStream can be used to set a custom filter to > supersede or augment the process-wide filter. > > Webrev: > http://cr.openjdk.java.net/~rriggs/webrev-serial-filter-jdk9-8155760/ > > SpecDiff: > http://cr.openjdk.java.net/~rriggs/filter-diffs/overview-summary.html > > Javadoc (subset) > http://cr.openjdk.java.net/~rriggs/filter-javadoc/java/io/ObjectInputStream.html > > http://cr.openjdk.java.net/~rriggs/filter-javadoc/java/io/ObjectInputFilter.html > > > Comments appreciated, Roger > > [1] JEP 290: https://bugs.openjdk.java.net/browse/JDK-8154961 > From Roger.Riggs at Oracle.com Wed Jul 20 14:44:55 2016 From: Roger.Riggs at Oracle.com (Roger Riggs) Date: Wed, 20 Jul 2016 10:44:55 -0400 Subject: RFR 9: JEP 290: Filter Incoming Serialization Data In-Reply-To: <97bdccb1-3aca-a354-4eb6-4df1e79dac94@gmail.com> References: <97bdccb1-3aca-a354-4eb6-4df1e79dac94@gmail.com> Message-ID: Hi Peter, On 7/20/2016 4:19 AM, Peter Levart wrote: > Hi Roger, > > On first reading, I have the following thoughts: > > - The name "ObjectInputFilter" makes me think that it is a function > that "filters" the input stream (like a Predicate in > Stream::filter(Predicate)), but it is in fact a validator that > terminates deserialization on 1st rejection. So perhaps a different > name is in order - ObjectInputValidator ? 'Filterin'g is used in some internet use cases as blocking packets, connections, etc. but it is not perfect. There is already a Validation concept in ObjectInputStream.registerValidation () that is a hook for validating multiple objects after the graph is reconstructed. And we would want to avoid any ambiguity in terminology. I also considered 'audit' as a possible verb but found support for 'filter'. > > - I haven't found in the public javadocs, an explanation of what > happens when the filter returns ALLOWED, REJECTED or UNDECIDED. Docs > just say that the deserialization is terminated (on UNDECIDED too?) > but not with what exception (there is some explanation on > OIS::filterCheck, but this is a private method). > > - The crux of behavioral docs is on the OIS::setObjectInputFilter > method. I would expect it to be on the ObjectInputFilter class, but I > understand that OIS subclasses might have a different behavior. How do > they behave indeed? For example IIOPInputStream does not use the > filter, right? oops, an omission. As implemented in filterCheck, it should be documented as throwing IllegalClassException if the filter returns REJECTED or throws an exception. The bias is slightly toward accepting inputs that are not specifically identified as rejected. IIOPInputStream could use the serialFilter, but the implementation would be different. The conditions describing calls to the filter are still appropriate and could be implemented by IIOPIS. Subclasses could be given flexibility in how or whether the filter is used. I'll take another look at IIOPIS. > > - I had some trouble to precisely understand the behavior from the > docs alone. The following in OIS::setObjectInputFilter: > > 1174 * @implSpec > 1175 * The filter, when {@code non-null}, is invoked during > {@linkplain #readObject()} > 1176 * for each object (regular or class) in the stream including > the following: > 1177 *
    > 1178 *
  • each object reference previously deserialized from > the stream, > 1179 *
  • each regular class, > 1180 *
  • each interface of a dynamic proxy and the dynamic > proxy class itself, > 1181 *
  • each array is filtered using the array size and > the type of the array, > 1182 *
  • each object replaced by its class' {@code > readResolve} method > 1183 * is filtered using the replacement object's class > and if it is an array, the length, > 1184 *
  • and each object replaced by {@linkplain > #resolveObject resolveObject} > 1185 * is filtered using the replacement object's class > and if it is an array, the length. > 1186 *
> 1187 * > 1188 * When the {@link ObjectInputFilter#checkInput checkInput} > method is invoked > 1189 * it is passed the current class, (null if no class), > > ...does not specify when the passed-in class might be "null". Reading > the implementation, I see it is null when a back reference to > previously deserialized object is read from stream, but javadocs are > not clear about that. good point, that should be clarified in each of the cases. > > - I wonder if invoking the filter for each interface of a dynamic > proxy is necessary (other properties passed to the filter don't change > during iteration through the interfaces and each interface call-back > is not an indicator that an object is about to be read-in next). This > is not uniform with other objects where the filter is invoked only > once. Why is a dynamic proxy so special? If one wants to check the > proxy interfaces in the filter, she can obtain them manually: > > if (Proxy.isProxyClass(clazz)) { > for (Class intf : class.getInterfaces()) { > ... > } > } It allows filters to be simpler, with fewer special cases to implement and therefore more reliable. > > - The docs might be more clear about when precisely the filter is > invoked (i.e. after the type of the object and possible length of > array or the back reference has already been read from the stream, but > the object state has not been read yet). This is important to > correctly interpret the streamBytes parameter. The docs might also be > more clear about when the nRefs is incremented (it says: "for each > call". Is it before or after the call?). Some flexibility should be allowed in the implementation. Without extra overhead it will point into the middle of some sequence in the stream, not to a typecode. The intention of streamBytes was to give an indication that the stream was larger than expected, not a precise location in the stream. Similarly with depth and nRefs, the filter is not likely to know exactly how big or how deep or how many references are expected but can only check for values that are known to be out of bounds. > > - What is the purpose of the UNDECIDED return? I suspect it is meant > to be used in some filter implementation that delegates the validation > to some "parent" filter and respects its decision unless it is > UNDECIDED in which case it decides (or does not) on its own. Should > such strategy be mentioned in the docs to encourage inter-operable > filter implementations? Yes, some simple filters might be for purposes of black-listing or white-listing. The pattern based filters, as produced by ObjectInputFilter.createFilter(patterns), can simply represent white or black listing, but if none of the patterns match, it can only report UNDECIDED. A custom filter, should check if there is a process-wide filter configured and invoke it first. Returning its status unless it is UNDECIDED and in that case use its own logic to determine the status. Definitely worthy of an @apiNote in ObjectInputFilter. > > - The call-back is invoked after the type of the object and possible > array length is read from stream but before the object's state is > read. Suppose that the object that is about to be read is either > Externalizable object or an object with a readObject() method(s) that > consume block data from the stream. This block data can be large. > Should there be a call-back to "announce" the block data too? (for > example, when the 'clazz' is null and the 'size' is 0, the call-back > reports a back-reference to a previously read object, but when the > 'clazz' is null and the 'size' > 0, it announces the 'size' bytes of > block data. Does this make sense?) Interesting case, I'll take another look at that. Since block data records are <= 1024, a filter might not have enough information to make an informed decision. Those bytes would show up in the stream bytes but not until the next object is read. > > That's it for the start. If I notice something else, I'll post again. Thanks, Roger > > Regards, Peter > > > On 07/19/2016 04:02 PM, Roger Riggs wrote: >> Please review the design, implementation, and tests of JEP 290: >> Filter Incoming Serialization Data[1] >> >> It allows incoming streams of object-serialization data to be >> filtered in order to improve both security and robustness. >> The JEP[1] has more detail on the background and scope. >> >> The core mechanism is a filter interface implemented by serialization >> clients and set on an |ObjectInputStream|. The filter is called >> during the deserialization process to validate the classes being >> deserialized, the sizes of arrays being created, and metrics >> describing stream length, stream depth, and number of references as >> the stream is being decoded. >> >> A process-wide filter can be configured that is applied to every >> ObjectInputStream. >> The API of ObjectInputStream can be used to set a custom filter to >> supersede or augment the process-wide filter. >> >> Webrev: >> http://cr.openjdk.java.net/~rriggs/webrev-serial-filter-jdk9-8155760/ >> >> SpecDiff: >> http://cr.openjdk.java.net/~rriggs/filter-diffs/overview-summary.html >> >> Javadoc (subset) >> http://cr.openjdk.java.net/~rriggs/filter-javadoc/java/io/ObjectInputStream.html >> >> http://cr.openjdk.java.net/~rriggs/filter-javadoc/java/io/ObjectInputFilter.html >> >> >> Comments appreciated, Roger >> >> [1] JEP 290: https://bugs.openjdk.java.net/browse/JDK-8154961 >> > From Roger.Riggs at Oracle.com Wed Jul 20 14:49:46 2016 From: Roger.Riggs at Oracle.com (Roger Riggs) Date: Wed, 20 Jul 2016 10:49:46 -0400 Subject: RFR 9: JEP 290: Filter Incoming Serialization Data In-Reply-To: <279da5eb-d7d3-c883-8638-a0852ab81870@oracle.com> References: <279da5eb-d7d3-c883-8638-a0852ab81870@oracle.com> Message-ID: <0399da9f-2752-a7ad-f61f-fd5835a3f9f6@Oracle.com> Will do, thanks, Roger On 7/20/2016 10:22 AM, Daniel Fuchs wrote: > Hi Roger, > > 3901 /** > 3902 * Method for getting the array size for any array. > 3903 */ > 3904 private static int arrayLength(Object array) { > > why not using java.lang.reflect.Array::getLength? > > best regards, > > -- daniel > > On 19/07/16 15:02, Roger Riggs wrote: >> Please review the design, implementation, and tests of JEP 290: Filter >> Incoming Serialization Data[1] >> >> It allows incoming streams of object-serialization data to be filtered >> in order to improve both security and robustness. >> The JEP[1] has more detail on the background and scope. >> >> The core mechanism is a filter interface implemented by serialization >> clients and set on an |ObjectInputStream|. The filter is called during >> the deserialization process to validate the classes being deserialized, >> the sizes of arrays being created, and metrics describing stream length, >> stream depth, and number of references as the stream is being decoded. >> >> A process-wide filter can be configured that is applied to every >> ObjectInputStream. >> The API of ObjectInputStream can be used to set a custom filter to >> supersede or augment the process-wide filter. >> >> Webrev: >> http://cr.openjdk.java.net/~rriggs/webrev-serial-filter-jdk9-8155760/ >> >> SpecDiff: >> http://cr.openjdk.java.net/~rriggs/filter-diffs/overview-summary.html >> >> Javadoc (subset) >> http://cr.openjdk.java.net/~rriggs/filter-javadoc/java/io/ObjectInputStream.html >> >> >> http://cr.openjdk.java.net/~rriggs/filter-javadoc/java/io/ObjectInputFilter.html >> >> >> >> Comments appreciated, Roger >> >> [1] JEP 290: https://bugs.openjdk.java.net/browse/JDK-8154961 >> > From james.laskey at oracle.com Wed Jul 20 17:19:58 2016 From: james.laskey at oracle.com (Jim Laskey (Oracle)) Date: Wed, 20 Jul 2016 14:19:58 -0300 Subject: RFR: JDK-8158407 - jimage: verify should do more extensive test Message-ID: http://cr.openjdk.java.net/~jlaskey/8158407/webrev/index.html https://bugs.openjdk.java.net/browse/JDK-8158407 From ecki at zusammenkunft.net Wed Jul 20 18:42:26 2016 From: ecki at zusammenkunft.net (Bernd Eckenfels) Date: Wed, 20 Jul 2016 20:42:26 +0200 Subject: RFR 9: JEP 290: Filter Incoming Serialization Data In-Reply-To: <16ee7f86-7ae2-b93b-e46b-e2c315f7db71@Oracle.com> References: <16ee7f86-7ae2-b93b-e46b-e2c315f7db71@Oracle.com> Message-ID: <20160720204226.000047b4.ecki@zusammenkunft.net> Hello, I have my own stream which does that (however mostly on the classes, not array size) and I used a Predicate functional interface for the filtering. I also have a prefix checking white and blacklist implementation for it. (using a sorted array and binary search). I try to et the code online later. Gruss Bernd Am Wed, 20 Jul 2016 09:30:06 -0400 schrieb Roger Riggs : > Hi Max, > > The use of filtering needs to be very intentional and so an > implementation should be required. > I don't expect there to be additional methods and if so a default for > checkInput could be added at that time. > > Roger > > > On 7/19/2016 11:18 PM, Wang Weijun wrote: > > The ObjectInputFilter interface has only one method. Are we > > expecting more methods to be added later and maybe some people will > > only be interested in a new method? If yes, I suggest we provide a > > default implementation of the current method to return ALLOWED. > > > > --Max > > > >> On Jul 19, 2016, at 10:02 PM, Roger Riggs > >> wrote: > >> > >> Please review the design, implementation, and tests of JEP 290: > >> Filter Incoming Serialization Data[1] > From volker.simonis at gmail.com Wed Jul 20 18:49:14 2016 From: volker.simonis at gmail.com (Volker Simonis) Date: Wed, 20 Jul 2016 20:49:14 +0200 Subject: RFR(XXS): 8161951: 8132379 introduced non ANSI C coding Message-ID: Hi, can somebody please review the following trivial fix: http://cr.openjdk.java.net/~simonis/webrevs/2016/8161951/ https://bugs.openjdk.java.net/browse/JDK-8161951 Change '8132379: -J options can cause crash or "Warning: app args parsing error passing arguments as-is"' uses the following non ANSI C compatible code for declaring a block-level variable: for (i = 0; i < argc; i++) { j = appArgIdx[i]; jboolean arg_expand = (JLI_StrCmp(stdargs[j].arg, strv[i]) == 0) ? stdargs[j].has_wildcard : JNI_FALSE; But ANSI C only allows the declaration of block local variable at the beginning of a block. As the fix is trivial, it makes no sense to restrict ourselves to compilers which support this C99 feature (e.g. > VS2012). Thank you and best regards, Volker From naoto.sato at oracle.com Wed Jul 20 19:51:20 2016 From: naoto.sato at oracle.com (Naoto Sato) Date: Wed, 20 Jul 2016 12:51:20 -0700 Subject: [9] RFR: 8161937: non-ASCII characters in source code comments Message-ID: <16ee3b5e-a240-c674-4787-852660533e53@oracle.com> Hello, Please review this small fix for the following issue: https://bugs.openjdk.java.net/browse/JDK-8161937 The proposed fix is located at: http://cr.openjdk.java.net/~naoto/8161937/webrev.00/ This is just to replace those non-ASCII characters used in comments with the equivalents in ASCII range. It's hard to tell the difference from the webrev above, but the change replaced the following characters: U+2014 (EM DASH) -> U+002D (HYPHEN-MINUS -) U+2019 (RIGHT SINGLE QUOTATION MARK) -> U+0027 (APOSTROPHE ') U+201C (LEFT DOUBLE QUOTATION MARK) -> U+0022 (QUOTATION MARK ") U+201D (RIGHT DOUBLE QUOTATION MARK) -> U+0022 (QUOTATION MARK ") Naoto From Alan.Bateman at oracle.com Wed Jul 20 19:58:46 2016 From: Alan.Bateman at oracle.com (Alan Bateman) Date: Wed, 20 Jul 2016 20:58:46 +0100 Subject: [9] RFR: 8161937: non-ASCII characters in source code comments In-Reply-To: <16ee3b5e-a240-c674-4787-852660533e53@oracle.com> References: <16ee3b5e-a240-c674-4787-852660533e53@oracle.com> Message-ID: <1da685d2-6af5-95f9-c8e1-f5091290dc6b@oracle.com> On 20/07/2016 20:51, Naoto Sato wrote: > Hello, > > Please review this small fix for the following issue: > > https://bugs.openjdk.java.net/browse/JDK-8161937 > > The proposed fix is located at: > > http://cr.openjdk.java.net/~naoto/8161937/webrev.00/ > > This is just to replace those non-ASCII characters used in comments > with the equivalents in ASCII range. It's hard to tell the difference > from the webrev above, but the change replaced the following characters: > > U+2014 (EM DASH) -> U+002D (HYPHEN-MINUS -) > U+2019 (RIGHT SINGLE QUOTATION MARK) -> U+0027 (APOSTROPHE ') > U+201C (LEFT DOUBLE QUOTATION MARK) -> U+0022 (QUOTATION MARK ") > U+201D (RIGHT DOUBLE QUOTATION MARK) -> U+0022 (QUOTATION MARK ") It's subtle but it possible to see it with the udiffs. The change looks okay to me. -Alan From iris.clark at oracle.com Wed Jul 20 20:10:33 2016 From: iris.clark at oracle.com (Iris Clark) Date: Wed, 20 Jul 2016 13:10:33 -0700 (PDT) Subject: RFR(s) 8161236: Runtime.Version.{compareTo, equals}IgnoreOpt should be renamed Message-ID: Hi. Please review changes in jdk and langtools (module jdk.jshell) to address the following bug: 8161236: Runtime.Version.{compareTo,equals}IgnoreOpt should be renamed https://bugs.openjdk.java.net/browse/JDK-8161236 Webrev: http://cr.openjdk.java.net/~iris/verona/8161236/webrev.0/ We update the method declarations to replace the token "Opt" with "Optional", thus aligning the method names with the associated getter, Runtime.Version.optional(). Specification references to those methods and any uses of the methods were also updated. JPRT runs (testsets hotspot and pit) show no failures related to these changes. A CCC request is in flight. Regards, Iris From robert.field at oracle.com Thu Jul 21 01:15:36 2016 From: robert.field at oracle.com (Robert Field) Date: Wed, 20 Jul 2016 18:15:36 -0700 Subject: RFR(s) 8161236: Runtime.Version.{compareTo, equals}IgnoreOpt should be renamed In-Reply-To: References: Message-ID: <57902238.8090207@oracle.com> Thumbs up on JShell change. -Robert On 07/20/16 13:10, Iris Clark wrote: > Hi. > > > > Please review changes in jdk and langtools (module jdk.jshell) to address the following bug: > > > > 8161236: Runtime.Version.{compareTo,equals}IgnoreOpt should be renamed > > https://bugs.openjdk.java.net/browse/JDK-8161236 > > > > Webrev: > > > > http://cr.openjdk.java.net/~iris/verona/8161236/webrev.0/ > > > > We update the method declarations to replace the token "Opt" with "Optional", thus aligning the method names with the associated getter, Runtime.Version.optional(). Specification references to those methods and any uses of the methods were also updated. > > > > JPRT runs (testsets hotspot and pit) show no failures related to these changes. A CCC request is in flight. > > > > Regards, > > Iris > > From iris.clark at oracle.com Thu Jul 21 04:06:37 2016 From: iris.clark at oracle.com (Iris Clark) Date: Wed, 20 Jul 2016 21:06:37 -0700 (PDT) Subject: RFR(s) 8161236: Runtime.Version.{compareTo, equals}IgnoreOpt should be renamed In-Reply-To: <57902238.8090207@oracle.com> References: <57902238.8090207@oracle.com> Message-ID: <7530576c-f55e-4b17-8d66-febecfe8e056@default> Hi, Robert. Thanks for Reviewing! iris -----Original Message----- From: Robert Field Sent: Wednesday, July 20, 2016 6:16 PM To: Iris Clark; Kumar Srinivasan; Java Core Libs; compiler-dev at openjdk.java.net; kulla-dev at openjdk.java.net Subject: Re: RFR(s) 8161236: Runtime.Version.{compareTo, equals}IgnoreOpt should be renamed Thumbs up on JShell change. -Robert On 07/20/16 13:10, Iris Clark wrote: > Hi. > > > > Please review changes in jdk and langtools (module jdk.jshell) to address the following bug: > > > > 8161236: Runtime.Version.{compareTo,equals}IgnoreOpt should be renamed > > https://bugs.openjdk.java.net/browse/JDK-8161236 > > > > Webrev: > > > > http://cr.openjdk.java.net/~iris/verona/8161236/webrev.0/ > > > > We update the method declarations to replace the token "Opt" with "Optional", thus aligning the method names with the associated getter, Runtime.Version.optional(). Specification references to those methods and any uses of the methods were also updated. > > > > JPRT runs (testsets hotspot and pit) show no failures related to these changes. A CCC request is in flight. > > > > Regards, > > Iris > > From david.holmes at oracle.com Thu Jul 21 05:49:51 2016 From: david.holmes at oracle.com (David Holmes) Date: Thu, 21 Jul 2016 15:49:51 +1000 Subject: RFR(XXS): 8161951: 8132379 introduced non ANSI C coding In-Reply-To: References: Message-ID: <107550f2-6f08-6fe1-2469-cbf03c369901@oracle.com> Hi Volker, On 21/07/2016 4:49 AM, Volker Simonis wrote: > Hi, > > can somebody please review the following trivial fix: > > http://cr.openjdk.java.net/~simonis/webrevs/2016/8161951/ > https://bugs.openjdk.java.net/browse/JDK-8161951 > > Change '8132379: -J options can cause crash or "Warning: app args > parsing error passing arguments as-is"' uses the following non ANSI C > compatible code for declaring a block-level variable: > > for (i = 0; i < argc; i++) { > j = appArgIdx[i]; > jboolean arg_expand = (JLI_StrCmp(stdargs[j].arg, strv[i]) == 0) > ? stdargs[j].has_wildcard > : JNI_FALSE; > > But ANSI C only allows the declaration of block local variable at the > beginning of a block. > > As the fix is trivial, it makes no sense to restrict ourselves to > compilers which support this C99 feature (e.g. > VS2012). Ok - Reviewed. But you really can't expect OpenJDK 9 to keep supporting C89 restrictions. We have people trying to get in C++11 constructs! :) Cheers, David > Thank you and best regards, > Volker > From peter.levart at gmail.com Thu Jul 21 07:42:23 2016 From: peter.levart at gmail.com (Peter Levart) Date: Thu, 21 Jul 2016 09:42:23 +0200 Subject: RFR 9: JEP 290: Filter Incoming Serialization Data In-Reply-To: References: <97bdccb1-3aca-a354-4eb6-4df1e79dac94@gmail.com> Message-ID: Hi Roger, On 07/20/2016 04:44 PM, Roger Riggs wrote: >> >> - What is the purpose of the UNDECIDED return? I suspect it is meant >> to be used in some filter implementation that delegates the >> validation to some "parent" filter and respects its decision unless >> it is UNDECIDED in which case it decides (or does not) on its own. >> Should such strategy be mentioned in the docs to encourage >> inter-operable filter implementations? > Yes, some simple filters might be for purposes of black-listing or > white-listing. > The pattern based filters, as produced by > ObjectInputFilter.createFilter(patterns), can simply represent > white or black listing, but if none of the patterns match, it can only > report UNDECIDED. > > A custom filter, should check if there is a process-wide filter > configured and invoke it first. > Returning its status unless it is UNDECIDED and in that case use its > own logic to determine the status. > > Definitely worthy of an @apiNote in ObjectInputFilter. Shoud Config.createFilter(pattern) then have an overload that allows specifying a "parent" filter in addition to the "pattern" ? > >> >> - The call-back is invoked after the type of the object and possible >> array length is read from stream but before the object's state is >> read. Suppose that the object that is about to be read is either >> Externalizable object or an object with a readObject() method(s) that >> consume block data from the stream. This block data can be large. >> Should there be a call-back to "announce" the block data too? (for >> example, when the 'clazz' is null and the 'size' is 0, the call-back >> reports a back-reference to a previously read object, but when the >> 'clazz' is null and the 'size' > 0, it announces the 'size' bytes of >> block data. Does this make sense?) > Interesting case, I'll take another look at that. Since block data > records are <= 1024, a filter might not > have enough information to make an informed decision. Those bytes > would show up in > the stream bytes but not until the next object is read. ...which could be to late. If the filter is to be also used as a defense against forged streams that try to provoke DOS by triggering frequent GCs and OutOfMemoryError(s), then such call-back that announces each block data record could help achieve that. Regards, Peter From volker.simonis at gmail.com Thu Jul 21 08:27:39 2016 From: volker.simonis at gmail.com (Volker Simonis) Date: Thu, 21 Jul 2016 10:27:39 +0200 Subject: RFR(XXS): 8161951: 8132379 introduced non ANSI C coding In-Reply-To: <107550f2-6f08-6fe1-2469-cbf03c369901@oracle.com> References: <107550f2-6f08-6fe1-2469-cbf03c369901@oracle.com> Message-ID: On Thu, Jul 21, 2016 at 7:49 AM, David Holmes wrote: > Hi Volker, > > On 21/07/2016 4:49 AM, Volker Simonis wrote: >> >> Hi, >> >> can somebody please review the following trivial fix: >> >> http://cr.openjdk.java.net/~simonis/webrevs/2016/8161951/ >> https://bugs.openjdk.java.net/browse/JDK-8161951 >> >> Change '8132379: -J options can cause crash or "Warning: app args >> parsing error passing arguments as-is"' uses the following non ANSI C >> compatible code for declaring a block-level variable: >> >> for (i = 0; i < argc; i++) { >> j = appArgIdx[i]; >> jboolean arg_expand = (JLI_StrCmp(stdargs[j].arg, strv[i]) == 0) >> ? stdargs[j].has_wildcard >> : JNI_FALSE; >> >> But ANSI C only allows the declaration of block local variable at the >> beginning of a block. >> >> As the fix is trivial, it makes no sense to restrict ourselves to >> compilers which support this C99 feature (e.g. > VS2012). > > > Ok - Reviewed. But you really can't expect OpenJDK 9 to keep supporting C89 > restrictions. We have people trying to get in C++11 constructs! :) > Thanks David! And I agree, but unfortunately VS2010 and VS2012 are still quite common in the industry and although they have been released quite a while after C99 was published they still don' support this feature :( Regards, Volker > Cheers, > David > > >> Thank you and best regards, >> Volker >> > From nadeesh.tv at oracle.com Thu Jul 21 11:21:02 2016 From: nadeesh.tv at oracle.com (nadeesh tv) Date: Thu, 21 Jul 2016 16:51:02 +0530 Subject: RFR:JDK-8066806:java.time.format.DateTimeFormatter cannot parse an offset with single digit hour In-Reply-To: <575AA1AB.2080200@oracle.com> References: <5746AA87.3040501@oracle.com> <5757C25E.9040605@oracle.com> <79e6445f-d482-bd32-5123-c364a5d086eb@Oracle.com> <57593666.2060202@oracle.com> <57594C1E.3080501@oracle.com> <575AA1AB.2080200@oracle.com> Message-ID: <5790B01E.30304@oracle.com> Hi, Please see the updated webrev http://cr.openjdk.java.net/~ntv/8066806/webrev.08/ Changes in this webrev: For leninent mode , doc change in DateTimeFormatterBuilder.java " In the lenient mode, parser will be greedy and parse maximum digits possible. " Added new test cases for lenient mode. -- Thanks and Regards, Nadeesh TV On 6/10/2016 4:47 PM, nadeesh tv wrote: > Hi, > > Please see the updated webrev > http://cr.openjdk.java.net/~ntv/8066806/webrev.08/ > > Thanks and Regards, > Nadeesh > On 6/9/2016 4:29 PM, nadeesh tv wrote: >> Hi Stephen, >> >> On 6/9/2016 4:19 PM, Stephen Colebourne wrote: >>> "absHours / 10 > 0" would be simpler as "absHours >= 10" >>> >>> Around line 3595 we have >>> boolean paddedHour = isPaddedHour(); >>> but 6 lines down isPaddedHour() is used, not the local variable >>> >>> There is an extra space in the message here: >>> new DateTimeException(" Value out of Range >>> also, I'd use "range", not "Range". >> Thanks. >>> >>> The maximum for ZoneOffset is actually 18:00:00 not 23:59:59, however >>> it is not worth validating that here. The base validation for 23/59/59 >>> that has been added is just fine, values between 18 and 23 will be >>> rejected later in the processs when attempting to create an instance >>> of ZoneOffset. >>> >>> I don't see any tests for >>> >>> new DateTimeFormatterBuilder().appendOffset(pattern, >>> "Z").appendValue(ChronoField.NANO_OF_DAY).toFormatter().parse(offset + >>> "12345") >>> >>> which should work for most of the patterns. >> I intentionally avoided it. I will create a positive test cases for >> working patterns and negative test cases for rest. >> >> Regards, >> Nadeesh >>> >>> thanks >>> Stephen >>> >>> On 9 June 2016 at 10:27, nadeesh tv wrote: >>>> Hi Roger, >>>> Thanks for the comments. >>>> >>>> Please see the updated webrev >>>> http://cr.openjdk.java.net/~ntv/8066806/webrev.07/ >>>> Thanks and regards, >>>> Nadeesh >>>> >>>> On 6/9/2016 2:36 AM, Roger Riggs wrote: >>>> >>>> HI Nadeesh, >>>> >>>> Looking better >>>> >>>> DateTimeFormatterBuilder: >>>> >>>> - line 3678: If array[1] == 24, offsetSeconds will be greater >>>> that seconds >>>> in a day; that's not right. >>>> I don't think hour=24 is valid. (and there would be test >>>> case(s) for >>>> it.) >>>> >>>> There should be test cases for offsets over the limit of hours, >>>> minutes, and >>>> seconds: 24:60:60 >>>> >>>> Thanks, Roger >>>> >>>> >>>> >>>> On 6/8/2016 2:59 AM, nadeesh tv wrote: >>>> >>>> Hi, >>>> >>>> Please see the updated webrev >>>> http://cr.openjdk.java.net/~ntv/8066806/webrev.06/ >>>> >>>> I reused code provided by Stephen and handled the edge cases >>>> accordingly >>>> >>>> Thanks and Regards, >>>> Nadeesh >>>> >>>> On 5/31/2016 7:15 PM, Stephen Colebourne wrote: >>>> >>>> Where the new patterns are described in Javadoc, there is no >>>> discussion of the difference between "H" and "HH". >>>> >>>> Add after >>>> >>>> "Patterns containing "HH" will format and parse a two digit hour, >>>> zero-padded if necessary. Patterns containing "H" will format with no >>>> zero-padding, and parse either one or two digits." >>>> >>>> "with colo" should be "with colon" >>>> >>>> As for the main code, I've had a go at a rewrite: >>>> https://gist.github.com/jodastephen/68857dd344e33bd6c0b3b4d24279d2e4 >>>> >>>> It is completely untested, and surely has mistakes, however as a >>>> design it seems reasonable. >>>> >>>> I agree that the tests need to cover these cases: >>>> >>>> - offset at end of line >>>> - offset followed by letters >>>> - offset followed by numbers >>>> >>>> Stephen >>>> >>>> >>>> On 26 May 2016 at 08:49, nadeesh tv wrote: >>>> >>>> Hi all, >>>> >>>> Please review >>>> >>>> BugId : https://bugs.openjdk.java.net/browse/JDK-8066806 >>>> >>>> Issue: java.time.format.DateTimeFormatter cannot parse an offset >>>> with single >>>> digit hour >>>> >>>> webrev: http://cr.openjdk.java.net/~ntv/8066806/webrev.03/ >>>> >>>> Solution: Added the suggested patterns but the parsing logic became >>>> too >>>> complex. >>>> Appreciate any suggestion to make the parsing less complicated >>>> >>>> -- >>>> Thanks and Regards, >>>> Nadeesh TV >>>> >>>> >>>> >>>> >>>> -- >>>> Thanks and Regards, >>>> Nadeesh TV >>>> >> > -- Thanks and Regards, Nadeesh TV From Alan.Bateman at oracle.com Thu Jul 21 11:36:05 2016 From: Alan.Bateman at oracle.com (Alan Bateman) Date: Thu, 21 Jul 2016 12:36:05 +0100 Subject: RFR(s) 8161236: Runtime.Version.{compareTo, equals}IgnoreOpt should be renamed In-Reply-To: References: Message-ID: <563b5669-dc42-599c-ff87-b6eac3851f09@oracle.com> On 20/07/2016 21:10, Iris Clark wrote: > Hi. > > > > Please review changes in jdk and langtools (module jdk.jshell) to address the following bug: > > The rename looks okay to me. -Alan From paul.sandoz at oracle.com Thu Jul 21 11:40:02 2016 From: paul.sandoz at oracle.com (Paul Sandoz) Date: Thu, 21 Jul 2016 13:40:02 +0200 Subject: RFR 8161947 runtime/Unsafe/GetUnsafe.java is failing on jdk9/dev Message-ID: <18FEA9FE-FE28-4B01-B5C3-C05810B32A61@oracle.com> Hi, The fix for: https://bugs.openjdk.java.net/browse/JDK-8161129 8161129 Unsafe::getUnsafe should allow the platform class loader to access it broke a test in the Hotspot repo test area that i did not realize existed. That test can be deleted. There is an existing test in the JDK repo test area that tests the same functionality in sun.misc.Unsafe, which is arguably the right location, i have renamed that test. Paul. Hotspot test changes ? diff -r 9f5a448947a4 test/runtime/Unsafe/GetUnsafe.java --- a/test/runtime/Unsafe/GetUnsafe.java Wed Jul 20 14:47:53 2016 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +0,0 @@ -/* - * 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 - * @summary Verifies that getUnsafe() actually throws SecurityException when unsafeAccess is prohibited. - * @library /testlibrary - * @modules java.base/jdk.internal.misc - * @run main GetUnsafe - */ - -import jdk.internal.misc.Unsafe; -import static jdk.test.lib.Asserts.*; - -public class GetUnsafe { - public static void main(String args[]) throws Exception { - try { - Unsafe unsafe = Unsafe.getUnsafe(); - } catch (SecurityException e) { - // Expected - return; - } - throw new RuntimeException("Did not get expected SecurityException"); - } -} JDK test changes ? diff --git a/test/sun/misc/Safe.java b/test/sun/misc/GetSunMiscUnsafe.java rename from test/sun/misc/Safe.java rename to test/sun/misc/GetSunMiscUnsafe.java --- a/test/sun/misc/Safe.java +++ b/test/sun/misc/GetSunMiscUnsafe.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2016 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 @@ -29,7 +29,7 @@ */ -public class Safe { +public class GetSunMiscUnsafe { public static void main(String[] args) throws Exception { try { From Alan.Bateman at oracle.com Thu Jul 21 12:04:35 2016 From: Alan.Bateman at oracle.com (Alan Bateman) Date: Thu, 21 Jul 2016 13:04:35 +0100 Subject: RFR 8161947 runtime/Unsafe/GetUnsafe.java is failing on jdk9/dev In-Reply-To: <18FEA9FE-FE28-4B01-B5C3-C05810B32A61@oracle.com> References: <18FEA9FE-FE28-4B01-B5C3-C05810B32A61@oracle.com> Message-ID: <33d44485-4b3c-976e-ac82-b0e1562df564@oracle.com> On 21/07/2016 12:40, Paul Sandoz wrote: > Hi, > > The fix for: > > https://bugs.openjdk.java.net/browse/JDK-8161129 > 8161129 Unsafe::getUnsafe should allow the platform class loader to access it > > broke a test in the Hotspot repo test area that i did not realize existed. That test can be deleted. There is an existing test in the JDK repo test area that tests the same functionality in sun.misc.Unsafe, which is arguably the right location, i have renamed that test. Make sense. For the test in the jdk repo then maybe it should be changed to catch SecurityException rather than Exception. -Alan From svetlana.nikandrova at oracle.com Thu Jul 21 12:13:43 2016 From: svetlana.nikandrova at oracle.com (Svetlana Nikandrova) Date: Thu, 21 Jul 2016 15:13:43 +0300 Subject: [8u-dev] RFR (JAXP) 8028363: XmlGregorianCalendarImpl.getTimeZone() bug when offset is less than 10 minutes In-Reply-To: <578E554D.5090502@oracle.com> References: <578E554D.5090502@oracle.com> Message-ID: <5790BC77.6060702@oracle.com> Little reminder. On 19.07.2016 19:29, Svetlana Nikandrova wrote: > Hello, > > please review this fix for 8u-dev. For jdk9 problem has been addressed > in JEP 255 (Xerces > update). > Please note that changeset contains of 2 parts: > XMLGregorianCalendarImpl fix in jaxp ws: > http://cr.openjdk.java.net/~snikandrova/8028363/jaxp/webrev.00/ > > Regression test in jdk ws: > http://cr.openjdk.java.net/~snikandrova/8028363/jdk/webrev.00/ > > > JBS: > https://bugs.openjdk.java.net/browse/JDK-8028363 > > Description: > While concatenating timezone representations string for > TimeZone.getTimeZone() XmlGregorianCalendarImpl missed prior "0" in > minutes part if minutes value is less then 10 (like "0" in 11:05). > > Thank you, > Svetlana > From svetlana.nikandrova at oracle.com Thu Jul 21 12:14:14 2016 From: svetlana.nikandrova at oracle.com (Svetlana Nikandrova) Date: Thu, 21 Jul 2016 15:14:14 +0300 Subject: RFR (JAXP): 8021787: javax.xml.datatype.XMLGregorianCalendar.getMonth() return is documented wrong In-Reply-To: <578E2A92.5030307@oracle.com> References: <578CFA87.2040004@oracle.com> <51440a13-ab2a-11cf-c42f-b58d6deeba30@oracle.com> <578E2A92.5030307@oracle.com> Message-ID: <5790BC96.5040204@oracle.com> Kindly reminder. On 19.07.2016 16:26, Svetlana Nikandrova wrote: > Hi Joe, > > thank you for your replay. As I'm new to javadoc writing feel free to > add any comments. > Please see updated webrev: > http://cr.openjdk.java.net/~snikandrova/8021787/webrev.01/ > > > Thank you, > Svetlana > > On 18.07.2016 20:34, huizhe wang wrote: >> Hi Svetlana, >> >> Thanks for working on these bugs. The change is correct. It would be >> better to say: "Returns the month of this calendar", in both the >> returns tag and the description (not number of month). >> >> While we are in this class, it would be good to at least fix the >> missing @returns tags in a number of methods, e.g. getDay, >> getTimezone, getHour, getMinute, toGregorianCalendar. Also, it >> @Override equals, hashCode, toString, and clone. >> >> Thanks, >> >> Joe >> >> On 7/18/2016 8:49 AM, Svetlana Nikandrova wrote: >>> Hello all, >>> >>> please review this javadoc fix for >>> javax.xml.datatype.XMLGregorianCalendar.getMonth() >>> Webrev: >>> http://cr.openjdk.java.net/~snikandrova/8021787/webrev.00/ >>> >>> JBS: >>> https://bugs.openjdk.java.net/browse/JDK-8021787 >>> >>> Thank you, >>> Svetlana >> > From david.holmes at oracle.com Thu Jul 21 12:37:21 2016 From: david.holmes at oracle.com (David Holmes) Date: Thu, 21 Jul 2016 22:37:21 +1000 Subject: RFR 8161947 runtime/Unsafe/GetUnsafe.java is failing on jdk9/dev In-Reply-To: <18FEA9FE-FE28-4B01-B5C3-C05810B32A61@oracle.com> References: <18FEA9FE-FE28-4B01-B5C3-C05810B32A61@oracle.com> Message-ID: Hi Paul, On 21/07/2016 9:40 PM, Paul Sandoz wrote: > Hi, > > The fix for: > > https://bugs.openjdk.java.net/browse/JDK-8161129 > 8161129 Unsafe::getUnsafe should allow the platform class loader to access it > > broke a test in the Hotspot repo test area that i did not realize existed. That test can be deleted. There is an existing test in the JDK repo test area that tests the same functionality in sun.misc.Unsafe, which is arguably the right location, i have renamed that test. > > Paul. > > Hotspot test changes > ? > > diff -r 9f5a448947a4 test/runtime/Unsafe/GetUnsafe.java > --- a/test/runtime/Unsafe/GetUnsafe.java Wed Jul 20 14:47:53 2016 +0300 > +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 > @@ -1,45 +0,0 @@ > -/* > - * 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 > - * @summary Verifies that getUnsafe() actually throws SecurityException when unsafeAccess is prohibited. > - * @library /testlibrary > - * @modules java.base/jdk.internal.misc > - * @run main GetUnsafe > - */ > - > -import jdk.internal.misc.Unsafe; > -import static jdk.test.lib.Asserts.*; > - > -public class GetUnsafe { > - public static void main(String args[]) throws Exception { > - try { > - Unsafe unsafe = Unsafe.getUnsafe(); > - } catch (SecurityException e) { > - // Expected > - return; > - } > - throw new RuntimeException("Did not get expected SecurityException"); > - } > -} Removal looks fine. > > JDK test changes > ? > > diff --git a/test/sun/misc/Safe.java b/test/sun/misc/GetSunMiscUnsafe.java > rename from test/sun/misc/Safe.java > rename to test/sun/misc/GetSunMiscUnsafe.java > --- a/test/sun/misc/Safe.java > +++ b/test/sun/misc/GetSunMiscUnsafe.java > @@ -1,5 +1,5 @@ > /* > - * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved. > + * Copyright (c) 2001, 2016 Oracle and/or its affiliates. All rights reserved. Comma needed after 2016 I'll leave the body of the test to core-libs folk. Thanks, David ----- > * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. > * > * This code is free software; you can redistribute it and/or modify it > @@ -29,7 +29,7 @@ > */ > > > -public class Safe { > +public class GetSunMiscUnsafe { > > public static void main(String[] args) throws Exception { > try { > > From ivan.gerasimov at oracle.com Thu Jul 21 12:59:22 2016 From: ivan.gerasimov at oracle.com (Ivan Gerasimov) Date: Thu, 21 Jul 2016 15:59:22 +0300 Subject: [9] RFR: 8161937: non-ASCII characters in source code comments In-Reply-To: <16ee3b5e-a240-c674-4787-852660533e53@oracle.com> References: <16ee3b5e-a240-c674-4787-852660533e53@oracle.com> Message-ID: <0ecb1dcb-fb7c-1ebe-b538-74ffb58348e5@oracle.com> Hi Naoto! I see that the same non-ASCII chars are used in src/java.base/share/native/libjimage/jimage.hpp and in src/java.base/share/native/libjimage/imageDecompressor.hpp It might make sense to change them as well. With kind regards, Ivan On 20.07.2016 22:51, Naoto Sato wrote: > Hello, > > Please review this small fix for the following issue: > > https://bugs.openjdk.java.net/browse/JDK-8161937 > > The proposed fix is located at: > > http://cr.openjdk.java.net/~naoto/8161937/webrev.00/ > > This is just to replace those non-ASCII characters used in comments > with the equivalents in ASCII range. It's hard to tell the difference > from the webrev above, but the change replaced the following characters: > > U+2014 (EM DASH) -> U+002D (HYPHEN-MINUS -) > U+2019 (RIGHT SINGLE QUOTATION MARK) -> U+0027 (APOSTROPHE ') > U+201C (LEFT DOUBLE QUOTATION MARK) -> U+0022 (QUOTATION MARK ") > U+201D (RIGHT DOUBLE QUOTATION MARK) -> U+0022 (QUOTATION MARK ") > > Naoto > From Roger.Riggs at Oracle.com Thu Jul 21 13:10:55 2016 From: Roger.Riggs at Oracle.com (Roger Riggs) Date: Thu, 21 Jul 2016 09:10:55 -0400 Subject: RFR (JAXP): 8021787: javax.xml.datatype.XMLGregorianCalendar.getMonth() return is documented wrong In-Reply-To: <5790BC96.5040204@oracle.com> References: <578CFA87.2040004@oracle.com> <51440a13-ab2a-11cf-c42f-b58d6deeba30@oracle.com> <578E2A92.5030307@oracle.com> <5790BC96.5040204@oracle.com> Message-ID: <8e6f8936-1f1b-fa5b-90c3-5b7449dae652@Oracle.com> Hi Svenlana, Line 515: For consistency within the class, the first sentence should start 'Return', the rest of the methods use 'Return'. Line 520: in @return the "Returns" should be removed. And capitialize "The". Thanks, Roger On 7/21/2016 8:14 AM, Svetlana Nikandrova wrote: > Kindly reminder. > > On 19.07.2016 16:26, Svetlana Nikandrova wrote: >> Hi Joe, >> >> thank you for your review. As I'm new to javadoc writing feel free to >> add any comments. >> Please see updated webrev: >> http://cr.openjdk.java.net/~snikandrova/8021787/webrev.01/ >> >> >> Thank you, >> Svetlana >> >> On 18.07.2016 20:34, huizhe wang wrote: >>> Hi Svetlana, >>> >>> Thanks for working on these bugs. The change is correct. It would be >>> better to say: "Returns the month of this calendar", in both the >>> returns tag and the description (not number of month). >>> >>> While we are in this class, it would be good to at least fix the >>> missing @returns tags in a number of methods, e.g. getDay, >>> getTimezone, getHour, getMinute, toGregorianCalendar. Also, it >>> @Override equals, hashCode, toString, and clone. >>> >>> Thanks, >>> >>> Joe >>> >>> On 7/18/2016 8:49 AM, Svetlana Nikandrova wrote: >>>> Hello all, >>>> >>>> please review this javadoc fix for >>>> javax.xml.datatype.XMLGregorianCalendar.getMonth() >>>> Webrev: >>>> http://cr.openjdk.java.net/~snikandrova/8021787/webrev.00/ >>>> >>>> JBS: >>>> https://bugs.openjdk.java.net/browse/JDK-8021787 >>>> >>>> Thank you, >>>> Svetlana >>> >> > From Roger.Riggs at Oracle.com Thu Jul 21 13:13:25 2016 From: Roger.Riggs at Oracle.com (Roger Riggs) Date: Thu, 21 Jul 2016 09:13:25 -0400 Subject: [8u-dev] RFR (JAXP) 8028363: XmlGregorianCalendarImpl.getTimeZone() bug when offset is less than 10 minutes In-Reply-To: <5790BC77.6060702@oracle.com> References: <578E554D.5090502@oracle.com> <5790BC77.6060702@oracle.com> Message-ID: <1ebb59fc-430d-d6bc-2ab4-6cf0521049fd@Oracle.com> Hi Svetlana, Looks good. Thanks, Roger On 7/21/2016 8:13 AM, Svetlana Nikandrova wrote: > Little reminder. > > On 19.07.2016 19:29, Svetlana Nikandrova wrote: >> Hello, >> >> please review this fix for 8u-dev. For jdk9 problem has been >> addressed in JEP 255 >> (Xerces update). >> Please note that changeset contains of 2 parts: >> XMLGregorianCalendarImpl fix in jaxp ws: >> http://cr.openjdk.java.net/~snikandrova/8028363/jaxp/webrev.00/ >> >> Regression test in jdk ws: >> http://cr.openjdk.java.net/~snikandrova/8028363/jdk/webrev.00/ >> >> >> JBS: >> https://bugs.openjdk.java.net/browse/JDK-8028363 >> >> Description: >> While concatenating timezone representations string for >> TimeZone.getTimeZone() XmlGregorianCalendarImpl missed prior "0" in >> minutes part if minutes value is less then 10 (like "0" in 11:05). >> >> Thank you, >> Svetlana >> > From Roger.Riggs at Oracle.com Thu Jul 21 13:29:34 2016 From: Roger.Riggs at Oracle.com (Roger Riggs) Date: Thu, 21 Jul 2016 09:29:34 -0400 Subject: RFR:JDK-8066806:java.time.format.DateTimeFormatter cannot parse an offset with single digit hour In-Reply-To: <5790B01E.30304@oracle.com> References: <5746AA87.3040501@oracle.com> <5757C25E.9040605@oracle.com> <79e6445f-d482-bd32-5123-c364a5d086eb@Oracle.com> <57593666.2060202@oracle.com> <57594C1E.3080501@oracle.com> <575AA1AB.2080200@oracle.com> <5790B01E.30304@oracle.com> Message-ID: Hi Nadeesh, Found the changes in http://cr.openjdk.java.net/~ntv/8066806/webrev.09/ Editorial: " Inthe lenient mode,*the *parser will be greedy and parse*the *maximum digits possible." TCKDateTimeFormatterBuilder.java: The lines 1473, 1479, 1485, etc. are way too long, perhaps wrap/break them so each line starts with "." And wrap any other line longer than 100 chars. (Side by side diffs are annoying if the lines are too long). Otherwise, looks good, Thanks, Roger On 7/21/2016 7:21 AM, nadeesh tv wrote: > Hi, > > Please see the updated webrev > > http://cr.openjdk.java.net/~ntv/8066806/webrev.08/ > > Changes in this webrev: > For leninent mode , doc change in DateTimeFormatterBuilder.java > " > > In the lenient mode, parser will be greedy and parse maximum digits > possible. > " > > Added new test cases for lenient mode. > From paul.sandoz at oracle.com Thu Jul 21 13:30:14 2016 From: paul.sandoz at oracle.com (Paul Sandoz) Date: Thu, 21 Jul 2016 15:30:14 +0200 Subject: RFR 8161947 runtime/Unsafe/GetUnsafe.java is failing on jdk9/dev In-Reply-To: <33d44485-4b3c-976e-ac82-b0e1562df564@oracle.com> References: <18FEA9FE-FE28-4B01-B5C3-C05810B32A61@oracle.com> <33d44485-4b3c-976e-ac82-b0e1562df564@oracle.com> Message-ID: <06B219E4-058C-46EF-9009-AB03CFC66605@oracle.com> > On 21 Jul 2016, at 14:04, Alan Bateman wrote: > > On 21/07/2016 12:40, Paul Sandoz wrote: > >> Hi, >> >> The fix for: >> >> https://bugs.openjdk.java.net/browse/JDK-8161129 >> 8161129 Unsafe::getUnsafe should allow the platform class loader to access it >> >> broke a test in the Hotspot repo test area that i did not realize existed. That test can be deleted. There is an existing test in the JDK repo test area that tests the same functionality in sun.misc.Unsafe, which is arguably the right location, i have renamed that test. > Make sense. For the test in the jdk repo then maybe it should be changed to catch SecurityException rather than Exception. > Updated, thanks, Paul. From paul.sandoz at oracle.com Thu Jul 21 13:30:42 2016 From: paul.sandoz at oracle.com (Paul Sandoz) Date: Thu, 21 Jul 2016 15:30:42 +0200 Subject: RFR 8161947 runtime/Unsafe/GetUnsafe.java is failing on jdk9/dev In-Reply-To: References: <18FEA9FE-FE28-4B01-B5C3-C05810B32A61@oracle.com> Message-ID: <9351D1EC-CE67-4DFA-AB91-CCAD40D88B83@oracle.com> > On 21 Jul 2016, at 14:37, David Holmes wrote: > >> >> JDK test changes >> ? >> >> diff --git a/test/sun/misc/Safe.java b/test/sun/misc/GetSunMiscUnsafe.java >> rename from test/sun/misc/Safe.java >> rename to test/sun/misc/GetSunMiscUnsafe.java >> --- a/test/sun/misc/Safe.java >> +++ b/test/sun/misc/GetSunMiscUnsafe.java >> @@ -1,5 +1,5 @@ >> /* >> - * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved. >> + * Copyright (c) 2001, 2016 Oracle and/or its affiliates. All rights reserved. > > Comma needed after 2016 > Updated, thanks, Paul. From iris.clark at oracle.com Thu Jul 21 16:15:33 2016 From: iris.clark at oracle.com (Iris Clark) Date: Thu, 21 Jul 2016 09:15:33 -0700 (PDT) Subject: RFR(s) 8161236: Runtime.Version.{compareTo, equals}IgnoreOpt should be renamed In-Reply-To: <563b5669-dc42-599c-ff87-b6eac3851f09@oracle.com> References: <563b5669-dc42-599c-ff87-b6eac3851f09@oracle.com> Message-ID: <3991de58-1791-46c9-ba8a-76100153ca9f@default> Hi, Alan. Thanks! iris -----Original Message----- From: Alan Bateman Sent: Thursday, July 21, 2016 4:36 AM To: Iris Clark; Kumar Srinivasan; Java Core Libs; compiler-dev at openjdk.java.net; kulla-dev at openjdk.java.net Subject: Re: RFR(s) 8161236: Runtime.Version.{compareTo, equals}IgnoreOpt should be renamed On 20/07/2016 21:10, Iris Clark wrote: > Hi. > > > > Please review changes in jdk and langtools (module jdk.jshell) to address the following bug: > > The rename looks okay to me. -Alan From huizhe.wang at oracle.com Thu Jul 21 16:25:13 2016 From: huizhe.wang at oracle.com (huizhe wang) Date: Thu, 21 Jul 2016 09:25:13 -0700 Subject: RFR (JAXP): 8021787: javax.xml.datatype.XMLGregorianCalendar.getMonth() return is documented wrong In-Reply-To: <578E2A92.5030307@oracle.com> References: <578CFA87.2040004@oracle.com> <51440a13-ab2a-11cf-c42f-b58d6deeba30@oracle.com> <578E2A92.5030307@oracle.com> Message-ID: Hi Svetlana, It would be good to apply the same format to these get* methods. Please see below. @@ -510,16 +510,16 @@ * @see #getYear() */ public abstract BigInteger getEonAndYear(); /** - * Return number of month or {@link DatatypeConstants#FIELD_UNDEFINED}. + * Returns the month of this calendar or {@link DatatypeConstants#FIELD_UNDEFINED}. *

Value constraints for this value are summarized in * month field of date/time field mapping table. * - * @return year of this {@code XMLGregorianCalendar}. + * @return Returns the month of this {@code XMLGregorianCalendar}. remove the duplicated "Returns", that is @return the month of the{@code XMLGregorianCalendar}, from 1 to 12. */ public abstract int getMonth(); /** ------------------------------------------------------------------------ @@ -526,10 +526,12 @@ * Return day in month or {@link DatatypeConstants#FIELD_UNDEFINED}. Returns the day of month *

Value constraints for this value are summarized in * day field of date/time field mapping table. * + * @return Day in month of this {@code XMLGregorianCalendar}. @return the day of month of the{@code XMLGregorianCalendar}, from 1 to 31. + * * @see #setDay(int) */ public abstract int getDay(); /** ------------------------------------------------------------------------ @@ -537,10 +539,12 @@ * {@link DatatypeConstants#FIELD_UNDEFINED} if this optional field is not defined. Returns the Timezone offset... *

Value constraints for this value are summarized in * timezone field of date/time field mapping table. * + * @return Timezone offset in minutes of this {@code XMLGregorianCalendar}. @return the Timezone ... + * * @see #setTimezone(int) */ public abstract int getTimezone(); /** ------------------------------------------------------------------------ @@ -547,10 +551,13 @@ * Return hours or {@link DatatypeConstants#FIELD_UNDEFINED}. Returns the hour of day * Returns {@link DatatypeConstants#FIELD_UNDEFINED} if this field is not defined. * *

Value constraints for this value are summarized in * hour field of date/time field mapping table. + * + * @return Hours of this {@code XMLGregorianCalendar}. @return the hour of dayof this {@code XMLGregorianCalendar}, from 0 to 23. + * * @see #setTime(int, int, int) */ public abstract int getHour(); /** ------------------------------------------------------------------------ @@ -557,10 +564,13 @@ * Return minutes or {@link DatatypeConstants#FIELD_UNDEFINED}. Returns the minute of hour... * Returns {@link DatatypeConstants#FIELD_UNDEFINED} if this field is not defined. * *

Value constraints for this value are summarized in * minute field of date/time field mapping table. + * + * @return Minutes of this {@code XMLGregorianCalendar}. @return the minute of hourof this {@code XMLGregorianCalendar}, from 0 to 59. + * * @see #setTime(int, int, int) */ public abstract int getMinute(); /** ------------------------------------------------------------------------ @@ -679,10 +689,11 @@ * {@code XMLGregorianCalendar} and * {@link #compare(XMLGregorianCalendar obj)} * returns {@link DatatypeConstants#EQUAL}, * otherwise {@code false}. */ + @Override public boolean equals(Object obj) { if (obj == null || !(obj instanceof XMLGregorianCalendar)) { return false; } ------------------------------------------------------------------------ @@ -692,10 +703,11 @@ /** * Returns a hash code consistent with the definition of the equals method. * * @return hash code of this object. */ + @Override public int hashCode() { // Following two dates compare to EQUALS since in different timezones. // 2000-01-15T12:00:00-05:00 == 2000-01-15T13:00:00-04:00 // ------------------------------------------------------------------------ @@ -853,13 +865,13 @@ * * @return A non-{@code null} valid {@code String} representation of this {@code XMLGregorianCalendar}. * * @throws IllegalStateException if the combination of set fields * does not match one of the eight defined XML Schema builtin date/time datatypes. - * * @see #toXMLFormat() */ + @Override public String toString() { return toXMLFormat(); } ------------------------------------------------------------------------ @@ -968,10 +980,12 @@ *

  • Its fields ERA, YEAR, MONTH, DAY_OF_MONTH, HOUR_OF_DAY, * MINUTE, SECOND and MILLISECOND are set using the method * {@code Calendar.set(int,int)}
  • * * + * @return a {@code java.util.GregorianCalendar} conversion of this instance. @return an instance of{@link java.util.GregorianCalendar}. + * * @see #toGregorianCalendar(java.util.TimeZone, java.util.Locale, XMLGregorianCalendar) */ public abstract GregorianCalendar toGregorianCalendar(); /** ------------------------------------------------------------------------ @@ -1047,13 +1061,13 @@ * @return TimeZone for this. */ public abstract TimeZone getTimeZone(int defaultZoneoffset); - /** * Creates and returns a copy of this object. * * @return copy of this {@code Object} */ + @Override public abstract Object clone(); } Thanks, Joe On 7/19/2016 6:26 AM, Svetlana Nikandrova wrote: > Hi Joe, > > thank you for your replay. As I'm new to javadoc writing feel free to > add any comments. > Please see updated webrev: > http://cr.openjdk.java.net/~snikandrova/8021787/webrev.01/ > > > Thank you, > Svetlana > > On 18.07.2016 20:34, huizhe wang wrote: >> Hi Svetlana, >> >> Thanks for working on these bugs. The change is correct. It would be >> better to say: "Returns the month of this calendar", in both the >> returns tag and the description (not number of month). >> >> While we are in this class, it would be good to at least fix the >> missing @returns tags in a number of methods, e.g. getDay, >> getTimezone, getHour, getMinute, toGregorianCalendar. Also, it >> @Override equals, hashCode, toString, and clone. >> >> Thanks, >> >> Joe >> >> On 7/18/2016 8:49 AM, Svetlana Nikandrova wrote: >>> Hello all, >>> >>> please review this javadoc fix for >>> javax.xml.datatype.XMLGregorianCalendar.getMonth() >>> Webrev: >>> http://cr.openjdk.java.net/~snikandrova/8021787/webrev.00/ >>> >>> JBS: >>> https://bugs.openjdk.java.net/browse/JDK-8021787 >>> >>> Thank you, >>> Svetlana >> > From huizhe.wang at oracle.com Thu Jul 21 16:32:33 2016 From: huizhe.wang at oracle.com (huizhe wang) Date: Thu, 21 Jul 2016 09:32:33 -0700 Subject: RFR (JAXP): 8021787: javax.xml.datatype.XMLGregorianCalendar.getMonth() return is documented wrong In-Reply-To: References: <578CFA87.2040004@oracle.com> <51440a13-ab2a-11cf-c42f-b58d6deeba30@oracle.com> <578E2A92.5030307@oracle.com> Message-ID: <91d1116b-df84-319c-1f7e-34f32f7a1d47@oracle.com> The editor of the new version of Thunderbird seems to be troublesome, with missing or added whitespace as a result of copy&paste. But when you "@return the hour of dayof this", you know I meant "@return the hour of day of this" :-) Or the double whitespace should have been a single one. -Joe On 7/21/2016 9:25 AM, huizhe wang wrote: > Hi Svetlana, > > It would be good to apply the same format to these get* methods. > Please see below. > > @@ -510,16 +510,16 @@ > * @see #getYear() > */ > public abstract BigInteger getEonAndYear(); > > /** > - * Return number of month or {@link DatatypeConstants#FIELD_UNDEFINED}. > + * Returns the month of this calendar or {@link > DatatypeConstants#FIELD_UNDEFINED}. > *

    Value constraints for this value are summarized in > * month field of date/time > field mapping table. > * > - * @return year of this {@code XMLGregorianCalendar}. > + * @return Returns the month of this {@code XMLGregorianCalendar}. > > remove the duplicated "Returns", that is > > @return the month of the{@code XMLGregorianCalendar}, from 1 to 12. > > > */ > public abstract int getMonth(); > > /** > > ------------------------------------------------------------------------ > > @@ -526,10 +526,12 @@ > * Return day in month or {@link > DatatypeConstants#FIELD_UNDEFINED}. > > Returns the day of month > > *

    Value constraints for this value are summarized in > * day field of date/time field > mapping table. > * > + * @return Day in month of this {@code XMLGregorianCalendar}. > > @return the day of month of the{@code XMLGregorianCalendar}, from 1 > to 31. > > > + * > * @see #setDay(int) > */ > public abstract int getDay(); > > /** > > ------------------------------------------------------------------------ > > @@ -537,10 +539,12 @@ > * {@link DatatypeConstants#FIELD_UNDEFINED} if this optional > field is not defined. > > Returns the Timezone offset... > > *

    Value constraints for this value are summarized in > * timezone field of > date/time field mapping table. > * > + * @return Timezone offset in minutes of this {@code > XMLGregorianCalendar}. > > @return the Timezone ... > > + * > * @see #setTimezone(int) > */ > public abstract int getTimezone(); > > /** > > ------------------------------------------------------------------------ > > @@ -547,10 +551,13 @@ > * Return hours or {@link DatatypeConstants#FIELD_UNDEFINED}. > > Returns the hour of day > > * Returns {@link DatatypeConstants#FIELD_UNDEFINED} if this > field is not defined. > * > *

    Value constraints for this value are summarized in > * hour field of date/time > field mapping table. > + * > + * @return Hours of this {@code XMLGregorianCalendar}. > > @return the hour of dayof this {@code XMLGregorianCalendar}, from 0 to > 23. > > + * > * @see #setTime(int, int, int) > */ > public abstract int getHour(); > > /** > > ------------------------------------------------------------------------ > > @@ -557,10 +564,13 @@ > * Return minutes or {@link DatatypeConstants#FIELD_UNDEFINED}. > > Returns the minute of hour... > > * Returns {@link DatatypeConstants#FIELD_UNDEFINED} if this > field is not defined. > * > *

    Value constraints for this value are summarized in > * minute field of date/time > field mapping table. > + * > + * @return Minutes of this {@code XMLGregorianCalendar}. > > @return the minute of hourof this {@code XMLGregorianCalendar}, from 0 > to 59. > > + * > * @see #setTime(int, int, int) > */ > public abstract int getMinute(); > > /** > > ------------------------------------------------------------------------ > > @@ -679,10 +689,11 @@ > * {@code XMLGregorianCalendar} and > * {@link #compare(XMLGregorianCalendar obj)} > * returns {@link DatatypeConstants#EQUAL}, > * otherwise {@code false}. > */ > + @Override > public boolean equals(Object obj) { > > if (obj == null || !(obj instanceof XMLGregorianCalendar)) { > return false; > } > > ------------------------------------------------------------------------ > > @@ -692,10 +703,11 @@ > /** > * Returns a hash code consistent with the definition of the > equals method. > * > * @return hash code of this object. > */ > + @Override > public int hashCode() { > > // Following two dates compare to EQUALS since in different > timezones. > // 2000-01-15T12:00:00-05:00 == 2000-01-15T13:00:00-04:00 > // > > ------------------------------------------------------------------------ > > @@ -853,13 +865,13 @@ > * > * @return A non-{@code null} valid {@code String} > representation of this {@code XMLGregorianCalendar}. > * > * @throws IllegalStateException if the combination of set fields > * does not match one of the eight defined XML Schema builtin > date/time datatypes. > - * > * @see #toXMLFormat() > */ > + @Override > public String toString() { > > return toXMLFormat(); > } > > > ------------------------------------------------------------------------ > > @@ -968,10 +980,12 @@ > *

  • Its fields ERA, YEAR, MONTH, DAY_OF_MONTH, HOUR_OF_DAY, > * MINUTE, SECOND and MILLISECOND are set using the method > * {@code Calendar.set(int,int)}
  • > * > * > + * @return a {@code java.util.GregorianCalendar} conversion of this > instance. > > @return an instance of{@link java.util.GregorianCalendar}. > > + * > * @see #toGregorianCalendar(java.util.TimeZone, > java.util.Locale, XMLGregorianCalendar) > */ > public abstract GregorianCalendar toGregorianCalendar(); > > /** > > ------------------------------------------------------------------------ > > @@ -1047,13 +1061,13 @@ > * @return TimeZone for this. > */ > public abstract TimeZone getTimeZone(int defaultZoneoffset); > > > - > /** > * Creates and returns a copy of this object. > * > * @return copy of this {@code Object} > */ > + @Override > public abstract Object clone(); > } > > > Thanks, > Joe > > > On 7/19/2016 6:26 AM, Svetlana Nikandrova wrote: >> Hi Joe, >> >> thank you for your replay. As I'm new to javadoc writing feel free to >> add any comments. >> Please see updated webrev: >> http://cr.openjdk.java.net/~snikandrova/8021787/webrev.01/ >> >> >> Thank you, >> Svetlana >> >> On 18.07.2016 20:34, huizhe wang wrote: >>> Hi Svetlana, >>> >>> Thanks for working on these bugs. The change is correct. It would be >>> better to say: "Returns the month of this calendar", in both the >>> returns tag and the description (not number of month). >>> >>> While we are in this class, it would be good to at least fix the >>> missing @returns tags in a number of methods, e.g. getDay, >>> getTimezone, getHour, getMinute, toGregorianCalendar. Also, it >>> @Override equals, hashCode, toString, and clone. >>> >>> Thanks, >>> >>> Joe >>> >>> On 7/18/2016 8:49 AM, Svetlana Nikandrova wrote: >>>> Hello all, >>>> >>>> please review this javadoc fix for >>>> javax.xml.datatype.XMLGregorianCalendar.getMonth() >>>> Webrev: >>>> http://cr.openjdk.java.net/~snikandrova/8021787/webrev.00/ >>>> >>>> JBS: >>>> https://bugs.openjdk.java.net/browse/JDK-8021787 >>>> >>>> Thank you, >>>> Svetlana >>> >> > From lance.andersen at oracle.com Thu Jul 21 16:37:18 2016 From: lance.andersen at oracle.com (Lance Andersen) Date: Thu, 21 Jul 2016 12:37:18 -0400 Subject: RFR 8161965 -> Fwd: JDK 9 RFR of 8161402: Provide a javadoc description for java.prefs module References: Message-ID: <4A7129B8-343A-4D8E-A537-F086B9609405@oracle.com> I took a stab at the javadoc descriptions for the modules modeled after what we discussed for the java.prefs module. The webrev can be found at http://cr.openjdk.java.net/~lancea/8161965/ Once we reach agreement, will a CCC be needed given this is really not a spec change? Best Lance > Begin forwarded message: > > From: Brian Burkhalter > Subject: Re: JDK 9 RFR of 8161402: Provide a javadoc description for java.prefs module > Date: July 19, 2016 at 11:06:48 AM EDT > To: Core-Libs-Dev > > It seems to me it would be less work overall if there were only one single issue to subsume adding the verbiage for all modules. There is only one single line of verbiage for each such issue and having so many reviews go around is a lot of noise. Then also if a CCC were required there would be only one. As suggested, there should be consistency in the verbiage without redundancy. A general template for the verbiage should be agreed upon first before the existing issues continue to be addressed or collapsed into one single issue. > > My $0.005. > > Brian 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 Jul 21 17:03:04 2016 From: Alan.Bateman at oracle.com (Alan Bateman) Date: Thu, 21 Jul 2016 18:03:04 +0100 Subject: RFR 8161965 -> Fwd: JDK 9 RFR of 8161402: Provide a javadoc description for java.prefs module In-Reply-To: <4A7129B8-343A-4D8E-A537-F086B9609405@oracle.com> References: <4A7129B8-343A-4D8E-A537-F086B9609405@oracle.com> Message-ID: On 21/07/2016 17:37, Lance Andersen wrote: > I took a stab at the javadoc descriptions for the modules modeled after what we discussed for the java.prefs module. > > The webrev can be found at http://cr.openjdk.java.net/~lancea/8161965/ It's good to do these in bulk and get some consistently. A general comment is that it uses acronyms for several APIs. For example java.xml say "JAXP" then I assume it should have "XML Processing". JDBC, JNDI, JAXB, ... there are several that I think should be clearer. java.activation has "activation API", shouldn't this be "JavaBeans Activation Framework". I'm not sure what to say for java.annotations.common. I think it has to say something about it defining a subset of the Common Annotations. For java.transaction then the exceptions also for interop with CORBA Transaction Services. The text might need to say that it's the Java SE subset of the Java Transaction API. The java.management module exports java.lang.management so that will need text. I think Jon Gibbons is working on text for java.compiler and jdk.compiler so you might be able to drop java.compiler from your patch. -Alan From brent.christian at oracle.com Thu Jul 21 17:08:42 2016 From: brent.christian at oracle.com (Brent Christian) Date: Thu, 21 Jul 2016 10:08:42 -0700 Subject: RFR 9 8161039 : System.getProperty("os.version") returns incorrect version number on Mac Message-ID: Hi, The fix for 7131356 introduced a minor behavior change in the value of the "os.version" system property on MacOS. On systems running an OS with a patch version of 0, we've started including this in the value of os.version (e.g. "10.11.0"), whereas before the trailing ".0" was omitted. Please review this fix, which restores the previous behavior. Bug: https://bugs.openjdk.java.net/browse/JDK-8161039 Webrev: http://cr.openjdk.java.net/~bchristi/8161039/webrev.00/ Thanks! -Brent From Alan.Bateman at oracle.com Thu Jul 21 17:12:13 2016 From: Alan.Bateman at oracle.com (Alan Bateman) Date: Thu, 21 Jul 2016 18:12:13 +0100 Subject: RFR 9 8161039 : System.getProperty("os.version") returns incorrect version number on Mac In-Reply-To: References: Message-ID: On 21/07/2016 18:08, Brent Christian wrote: > Hi, > > The fix for 7131356 introduced a minor behavior change in the value of > the "os.version" system property on MacOS. > > On systems running an OS with a patch version of 0, we've started > including this in the value of os.version (e.g. "10.11.0"), whereas > before the trailing ".0" was omitted. > > Please review this fix, which restores the previous behavior. This looks okay to me. -Alan From brian.burkhalter at oracle.com Thu Jul 21 17:32:02 2016 From: brian.burkhalter at oracle.com (Brian Burkhalter) Date: Thu, 21 Jul 2016 10:32:02 -0700 Subject: RFR 8161965 -> Fwd: JDK 9 RFR of 8161402: Provide a javadoc description for java.prefs module In-Reply-To: References: <4A7129B8-343A-4D8E-A537-F086B9609405@oracle.com> Message-ID: And the java.desktop description was already checked in so it should be examined for consistency I suppose. Brian On Jul 21, 2016, at 10:03 AM, Alan Bateman wrote: > I think Jon Gibbons is working on text for java.compiler and jdk.compiler so you might be able to drop java.compiler from your patch. From sean.coffey at oracle.com Thu Jul 21 17:40:21 2016 From: sean.coffey at oracle.com (=?UTF-8?Q?Se=c3=a1n_Coffey?=) Date: Thu, 21 Jul 2016 18:40:21 +0100 Subject: [8u-dev] RFR (JAXP) 8028363: XmlGregorianCalendarImpl.getTimeZone() bug when offset is less than 10 minutes In-Reply-To: <5790BC77.6060702@oracle.com> References: <578E554D.5090502@oracle.com> <5790BC77.6060702@oracle.com> Message-ID: <29630e4c-0d7b-60b5-e1ca-00b6b06fa02f@oracle.com> Looks fine to me also Svetlana. Regards, Sean. On 21/07/2016 13:13, Svetlana Nikandrova wrote: > Little reminder. > > On 19.07.2016 19:29, Svetlana Nikandrova wrote: >> Hello, >> >> please review this fix for 8u-dev. For jdk9 problem has been >> addressed in JEP 255 >> (Xerces update). >> Please note that changeset contains of 2 parts: >> XMLGregorianCalendarImpl fix in jaxp ws: >> http://cr.openjdk.java.net/~snikandrova/8028363/jaxp/webrev.00/ >> >> Regression test in jdk ws: >> http://cr.openjdk.java.net/~snikandrova/8028363/jdk/webrev.00/ >> >> >> JBS: >> https://bugs.openjdk.java.net/browse/JDK-8028363 >> >> Description: >> While concatenating timezone representations string for >> TimeZone.getTimeZone() XmlGregorianCalendarImpl missed prior "0" in >> minutes part if minutes value is less then 10 (like "0" in 11:05). >> >> Thank you, >> Svetlana >> > From lance.andersen at oracle.com Thu Jul 21 17:41:49 2016 From: lance.andersen at oracle.com (Lance Andersen) Date: Thu, 21 Jul 2016 13:41:49 -0400 Subject: RFR 8161965 -> Fwd: JDK 9 RFR of 8161402: Provide a javadoc description for java.prefs module In-Reply-To: References: <4A7129B8-343A-4D8E-A537-F086B9609405@oracle.com> Message-ID: <47637AD5-F334-4AF2-9422-F4470106EBB3@oracle.com> > On Jul 21, 2016, at 1:03 PM, Alan Bateman wrote: > > On 21/07/2016 17:37, Lance Andersen wrote: > >> I took a stab at the javadoc descriptions for the modules modeled after what we discussed for the java.prefs module. >> >> The webrev can be found at http://cr.openjdk.java.net/~lancea/8161965/ > It's good to do these in bulk and get some consistently. > > A general comment is that it uses acronyms for several APIs. For example java.xml say "JAXP" then I assume it should have "XML Processing". JDBC, JNDI, JAXB, ... there are several that I think should be clearer. I can add the JCP naming for the ones that are applicable, for JDBC that is correct it is not an acronym > > java.activation has "activation API", shouldn't this be "JavaBeans Activation Framework?. Yes > > I'm not sure what to say for java.annotations.common. I think it has to say something about it defining a subset of the Common Annotations. I can add that before the ?. core JAX-WS wording > > For java.transaction then the exceptions also for interop with CORBA Transaction Services. The text might need to say that it's the Java SE subset of the Java Transaction API. > OK will take another stab at this, I was leveraging wording from the javadocs > The java.management module exports java.lang.management so that will need text. OK must have missed that Once I hear from others, I will push another webrev > > I think Jon Gibbons is working on text for java.compiler and jdk.compiler so you might be able to drop java.compiler from your patch. > OK, or Jon can just suggest his preferred wording? either way is fine. Best Lance > -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 lance.andersen at oracle.com Thu Jul 21 17:44:01 2016 From: lance.andersen at oracle.com (Lance Andersen) Date: Thu, 21 Jul 2016 13:44:01 -0400 Subject: RFR 8161965 -> Fwd: JDK 9 RFR of 8161402: Provide a javadoc description for java.prefs module In-Reply-To: References: <4A7129B8-343A-4D8E-A537-F086B9609405@oracle.com> Message-ID: <5AB4A4B5-5791-4B57-8FBD-D6DFE87457D3@oracle.com> > On Jul 21, 2016, at 1:32 PM, Brian Burkhalter wrote: > > And the java.desktop description was already checked in so it should be examined for consistency I suppose. OK, will take a look > > Brian > > On Jul 21, 2016, at 10:03 AM, Alan Bateman wrote: > >> I think Jon Gibbons is working on text for java.compiler and jdk.compiler so you might be able to drop java.compiler from your patch. > 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 martinrb at google.com Thu Jul 21 17:49:36 2016 From: martinrb at google.com (Martin Buchholz) Date: Thu, 21 Jul 2016 10:49:36 -0700 Subject: RFR: JDK-8044629: (reflect) Constructor.getAnnotatedReceiverType() returns wrong value In-Reply-To: <20140813085406.GD22209@oracle.com> References: <1B51A5CD-A909-42C4-97D1-1F8F5DFE55D2@oracle.com> <9E339B30-A01D-4427-A2D1-A0E96E5A978C@oracle.com> <20140813085406.GD22209@oracle.com> Message-ID: Hi Joel, Paul, A coworker ran into the change of behavior here in jdk9. Specifically, we noticed that a local class constructor has a receiver parameter, but getAnnotatedReceiverType returns null. The changed jdk9 spec is actually very clear about that: http://download.java.net/java/jdk9/docs/api/java/lang/reflect/Constructor.html#getAnnotatedReceiverType-- """If this Executable object represents a static method or represents a constructor of a top level, static member, local, or anonymous class, then the return value is null.""" BUT we can't think of any reason WHY a local inner class would be treated differently from an inner member class. Why not the simple and obvious rule: if there is a receiver parameter, return an appropriate non-null AnnotatedType? You already have an excellent jtreg test, but here's what I was playing with: import java.lang.reflect.Constructor; public class LocalClassReceiverTypeBug { public static void main(String[] args) throws Throwable { class StaticLocal {} printConstructor(StaticLocal.class); new LocalClassReceiverTypeBug().instanceMain(); } public void instanceMain() throws Throwable { class InstanceLocal {} printConstructor(InstanceLocal.class); printConstructor(Inner.class); printConstructor(Nested.class); } static class Nested {} class Inner {} static void printConstructor(Class klazz) { Constructor[] constructors = klazz.getDeclaredConstructors(); if (constructors.length != 1) throw new AssertionError(); System.out.printf("constructor=%s%n", constructors[0]); System.out.printf("receiver type=%s%n", constructors[0].getAnnotatedReceiverType()); } } On Wed, Aug 13, 2014 at 1:54 AM, Joel Borggren-Franck < joel.franck at oracle.com> wrote: > Hi Paul, > > On 2014-06-24, Paul Sandoz wrote: > > > > On Jun 17, 2014, at 6:52 PM, Joel Borggr?n-Franck < > joel.franck at oracle.com> wrote: > > > > > > Can I get a review for this fix and javadoc clarification for > https://bugs.openjdk.java.net/browse/JDK-8044629 > > > > > > > +1 > > > > I never quite realised just how convoluted it was to determine that a > class is an inner class. > > Neither did I until I had to implement it :) > > cheers > /Joel > From naoto.sato at oracle.com Thu Jul 21 17:47:39 2016 From: naoto.sato at oracle.com (Naoto Sato) Date: Thu, 21 Jul 2016 10:47:39 -0700 Subject: [9] RFR: 8161937: non-ASCII characters in source code comments In-Reply-To: <0ecb1dcb-fb7c-1ebe-b538-74ffb58348e5@oracle.com> References: <16ee3b5e-a240-c674-4787-852660533e53@oracle.com> <0ecb1dcb-fb7c-1ebe-b538-74ffb58348e5@oracle.com> Message-ID: <415eb103-9e7e-1cc0-4a84-a0f7eaa9f429@oracle.com> Thanks Ivan. I've already pushed the fix, so I created a new one (JDK-8162343) Naoto On 7/21/16 5:59 AM, Ivan Gerasimov wrote: > Hi Naoto! > > I see that the same non-ASCII chars are used in > src/java.base/share/native/libjimage/jimage.hpp > and in > src/java.base/share/native/libjimage/imageDecompressor.hpp > > It might make sense to change them as well. > > With kind regards, > Ivan > > > > On 20.07.2016 22:51, Naoto Sato wrote: >> Hello, >> >> Please review this small fix for the following issue: >> >> https://bugs.openjdk.java.net/browse/JDK-8161937 >> >> The proposed fix is located at: >> >> http://cr.openjdk.java.net/~naoto/8161937/webrev.00/ >> >> This is just to replace those non-ASCII characters used in comments >> with the equivalents in ASCII range. It's hard to tell the difference >> from the webrev above, but the change replaced the following characters: >> >> U+2014 (EM DASH) -> U+002D (HYPHEN-MINUS -) >> U+2019 (RIGHT SINGLE QUOTATION MARK) -> U+0027 (APOSTROPHE ') >> U+201C (LEFT DOUBLE QUOTATION MARK) -> U+0022 (QUOTATION MARK ") >> U+201D (RIGHT DOUBLE QUOTATION MARK) -> U+0022 (QUOTATION MARK ") >> >> Naoto >> > From joel.borggren.franck at gmail.com Thu Jul 21 18:16:33 2016 From: joel.borggren.franck at gmail.com (=?UTF-8?Q?Joel_Borggr=C3=A9n=2DFranck?=) Date: Thu, 21 Jul 2016 20:16:33 +0200 Subject: RFR: JDK-8044629: (reflect) Constructor.getAnnotatedReceiverType() returns wrong value In-Reply-To: References: <1B51A5CD-A909-42C4-97D1-1F8F5DFE55D2@oracle.com> <9E339B30-A01D-4427-A2D1-A0E96E5A978C@oracle.com> <20140813085406.GD22209@oracle.com> Message-ID: Hi Martin, I'm away from my workstation at the moment, so this is from memory. IIRC a local class is pure scoping and lacks an "outer this" which is what you annotate for constructors. There should not be receiver type to annotate. Since I can't run your code I can't see what's wrong but I might be able to help if you paste the output from a run. Cheers /Joel On Jul 21, 2016 19:49, "Martin Buchholz" wrote: > Hi Joel, Paul, > > A coworker ran into the change of behavior here in jdk9. Specifically, we > noticed that a local class constructor has a receiver parameter, > but getAnnotatedReceiverType returns null. The changed jdk9 spec is > actually very clear about that: > > > http://download.java.net/java/jdk9/docs/api/java/lang/reflect/Constructor.html#getAnnotatedReceiverType-- > """If this Executable object represents a static method or represents a > constructor of a top level, static member, local, or anonymous class, then > the return value is null.""" > > BUT we can't think of any reason WHY a local inner class would be treated > differently from an inner member class. Why not the simple and obvious > rule: if there is a receiver parameter, return an appropriate non-null > AnnotatedType? > > You already have an excellent jtreg test, but here's what I was playing > with: > > import java.lang.reflect.Constructor; > > public class LocalClassReceiverTypeBug { > public static void main(String[] args) throws Throwable { > class StaticLocal {} > printConstructor(StaticLocal.class); > new LocalClassReceiverTypeBug().instanceMain(); > } > > public void instanceMain() throws Throwable { > class InstanceLocal {} > printConstructor(InstanceLocal.class); > printConstructor(Inner.class); > printConstructor(Nested.class); > } > > static class Nested {} > class Inner {} > > static void printConstructor(Class klazz) { > Constructor[] constructors = klazz.getDeclaredConstructors(); > if (constructors.length != 1) throw new AssertionError(); > System.out.printf("constructor=%s%n", constructors[0]); > System.out.printf("receiver type=%s%n", > constructors[0].getAnnotatedReceiverType()); > } > } > > > > On Wed, Aug 13, 2014 at 1:54 AM, Joel Borggren-Franck < > joel.franck at oracle.com> wrote: > >> Hi Paul, >> >> On 2014-06-24, Paul Sandoz wrote: >> > >> > On Jun 17, 2014, at 6:52 PM, Joel Borggr?n-Franck < >> joel.franck at oracle.com> wrote: >> > > >> > > Can I get a review for this fix and javadoc clarification for >> https://bugs.openjdk.java.net/browse/JDK-8044629 >> > > >> > >> > +1 >> > >> > I never quite realised just how convoluted it was to determine that a >> class is an inner class. >> >> Neither did I until I had to implement it :) >> >> cheers >> /Joel >> > > From Roger.Riggs at Oracle.com Thu Jul 21 18:19:33 2016 From: Roger.Riggs at Oracle.com (Roger Riggs) Date: Thu, 21 Jul 2016 14:19:33 -0400 Subject: RFR 9: JEP 290: Filter Incoming Serialization Data In-Reply-To: References: <97bdccb1-3aca-a354-4eb6-4df1e79dac94@gmail.com> Message-ID: <7fd53029-5586-cbbe-4e5e-c074c14d6fa8@Oracle.com> Hi Peter, On 7/21/2016 3:42 AM, Peter Levart wrote: > Hi Roger, > > > On 07/20/2016 04:44 PM, Roger Riggs wrote: >>> >>> - What is the purpose of the UNDECIDED return? I suspect it is meant >>> to be used in some filter implementation that delegates the >>> validation to some "parent" filter and respects its decision unless >>> it is UNDECIDED in which case it decides (or does not) on its own. >>> Should such strategy be mentioned in the docs to encourage >>> inter-operable filter implementations? >> Yes, some simple filters might be for purposes of black-listing or >> white-listing. >> The pattern based filters, as produced by >> ObjectInputFilter.createFilter(patterns), can simply represent >> white or black listing, but if none of the patterns match, it can >> only report UNDECIDED. >> >> A custom filter, should check if there is a process-wide filter >> configured and invoke it first. >> Returning its status unless it is UNDECIDED and in that case use its >> own logic to determine the status. >> >> Definitely worthy of an @apiNote in ObjectInputFilter. > > Shoud Config.createFilter(pattern) then have an overload that allows > specifying a "parent" filter in addition to the "pattern" ? > Supplying a filter as a method has more flexibility in what it can check and how it combines filters. With lambdas it is very easy to write a filter to handle the more complex cases. The pattern based filters are intended to cover only simple white-list/black list cases. So for now, simple is good enough to start. >> >>> >>> - The call-back is invoked after the type of the object and possible >>> array length is read from stream but before the object's state is >>> read. Suppose that the object that is about to be read is either >>> Externalizable object or an object with a readObject() method(s) >>> that consume block data from the stream. This block data can be >>> large. Should there be a call-back to "announce" the block data too? >>> (for example, when the 'clazz' is null and the 'size' is 0, the >>> call-back reports a back-reference to a previously read object, but >>> when the 'clazz' is null and the 'size' > 0, it announces the 'size' >>> bytes of block data. Does this make sense?) >> Interesting case, I'll take another look at that. Since block data >> records are <= 1024, a filter might not >> have enough information to make an informed decision. Those bytes >> would show up in >> the stream bytes but not until the next object is read. > > ...which could be to late. If the filter is to be also used as a > defense against forged streams that try to provoke DOS by triggering > frequent GCs and OutOfMemoryError(s), then such call-back that > announces each block data record could help achieve that. Individual block data lengths are not very informative since block data can be segmented but a cumulative (for the whole stream) block data size suitable for a callback from the start of each block data segment might be useful. Thanks, Roger > > Regards, Peter > From martinrb at google.com Thu Jul 21 18:39:57 2016 From: martinrb at google.com (Martin Buchholz) Date: Thu, 21 Jul 2016 11:39:57 -0700 Subject: RFR: JDK-8044629: (reflect) Constructor.getAnnotatedReceiverType() returns wrong value In-Reply-To: References: <1B51A5CD-A909-42C4-97D1-1F8F5DFE55D2@oracle.com> <9E339B30-A01D-4427-A2D1-A0E96E5A978C@oracle.com> <20140813085406.GD22209@oracle.com> Message-ID: Joel, Thanks for responding so quickly! Here' s a slightly modified version of my repro recipe: You can see that local classes in instance methods have a receiver type, just like a member inner class. local classes in static methods (naturally!) do not. I expect the two flavors of local classes to be treated differently. I've never understood why """All local classes are inner classes""" (even in a static method?) https://docs.oracle.com/javase/specs/jls/se8/html/jls-14.html#jls-14.3 import java.lang.reflect.Constructor; public class LocalClassReceiverTypeBug { public static void main(String[] args) throws Throwable { class StaticLocal {} printConstructor(StaticLocal.class); new LocalClassReceiverTypeBug().instanceMain(); } public void instanceMain() throws Throwable { class InstanceLocal {} printConstructor(InstanceLocal.class); printConstructor(Inner.class); // printConstructor(Nested.class); } static class Nested {} class Inner {} static void printConstructor(Class klazz) { Constructor[] constructors = klazz.getDeclaredConstructors(); if (constructors.length != 1) throw new AssertionError(); Constructor constructor = constructors[0]; System.out.printf("constructor=%s receivertype=%s%n", constructor, constructor.getAnnotatedReceiverType()); } } ==> javac -source 9 -Xlint:all LocalClassReceiverTypeBug.java ==> java -esa -ea LocalClassReceiverTypeBug constructor=LocalClassReceiverTypeBug$1StaticLocal() receivertype=null constructor=LocalClassReceiverTypeBug$1InstanceLocal(LocalClassReceiverTypeBug) receivertype=null constructor=LocalClassReceiverTypeBug$Inner(LocalClassReceiverTypeBug) receivertype=sun.reflect.annotation.AnnotatedTypeFactory$AnnotatedTypeBaseImpl at 1810399e On Thu, Jul 21, 2016 at 11:16 AM, Joel Borggr?n-Franck < joel.borggren.franck at gmail.com> wrote: > Hi Martin, > > I'm away from my workstation at the moment, so this is from memory. IIRC a > local class is pure scoping and lacks an "outer this" which is what you > annotate for constructors. There should not be receiver type to annotate. > Since I can't run your code I can't see what's wrong but I might be able to > help if you paste the output from a run. > > Cheers > /Joel > > On Jul 21, 2016 19:49, "Martin Buchholz" wrote: > >> Hi Joel, Paul, >> >> A coworker ran into the change of behavior here in jdk9. Specifically, >> we noticed that a local class constructor has a receiver parameter, >> but getAnnotatedReceiverType returns null. The changed jdk9 spec is >> actually very clear about that: >> >> >> http://download.java.net/java/jdk9/docs/api/java/lang/reflect/Constructor.html#getAnnotatedReceiverType-- >> """If this Executable object represents a static method or represents a >> constructor of a top level, static member, local, or anonymous class, then >> the return value is null.""" >> >> BUT we can't think of any reason WHY a local inner class would be treated >> differently from an inner member class. Why not the simple and obvious >> rule: if there is a receiver parameter, return an appropriate non-null >> AnnotatedType? >> >> You already have an excellent jtreg test, but here's what I was playing >> with: >> >> import java.lang.reflect.Constructor; >> >> public class LocalClassReceiverTypeBug { >> public static void main(String[] args) throws Throwable { >> class StaticLocal {} >> printConstructor(StaticLocal.class); >> new LocalClassReceiverTypeBug().instanceMain(); >> } >> >> public void instanceMain() throws Throwable { >> class InstanceLocal {} >> printConstructor(InstanceLocal.class); >> printConstructor(Inner.class); >> printConstructor(Nested.class); >> } >> >> static class Nested {} >> class Inner {} >> >> static void printConstructor(Class klazz) { >> Constructor[] constructors = klazz.getDeclaredConstructors(); >> if (constructors.length != 1) throw new AssertionError(); >> System.out.printf("constructor=%s%n", constructors[0]); >> System.out.printf("receiver type=%s%n", >> constructors[0].getAnnotatedReceiverType()); >> } >> } >> >> >> >> On Wed, Aug 13, 2014 at 1:54 AM, Joel Borggren-Franck < >> joel.franck at oracle.com> wrote: >> >>> Hi Paul, >>> >>> On 2014-06-24, Paul Sandoz wrote: >>> > >>> > On Jun 17, 2014, at 6:52 PM, Joel Borggr?n-Franck < >>> joel.franck at oracle.com> wrote: >>> > > >>> > > Can I get a review for this fix and javadoc clarification for >>> https://bugs.openjdk.java.net/browse/JDK-8044629 >>> > > >>> > >>> > +1 >>> > >>> > I never quite realised just how convoluted it was to determine that a >>> class is an inner class. >>> >>> Neither did I until I had to implement it :) >>> >>> cheers >>> /Joel >>> >> >> From joel.borggren.franck at gmail.com Thu Jul 21 18:50:59 2016 From: joel.borggren.franck at gmail.com (=?UTF-8?Q?Joel_Borggr=C3=A9n=2DFranck?=) Date: Thu, 21 Jul 2016 20:50:59 +0200 Subject: RFR: JDK-8044629: (reflect) Constructor.getAnnotatedReceiverType() returns wrong value In-Reply-To: References: <1B51A5CD-A909-42C4-97D1-1F8F5DFE55D2@oracle.com> <9E339B30-A01D-4427-A2D1-A0E96E5A978C@oracle.com> <20140813085406.GD22209@oracle.com> Message-ID: This is the first time I noticed the second paragraph of $14.3, strange indeed! I'd ping compiler-dev with this, Alex will probably know if this is a spec bug in $14.3 or just an irregularity. Cheers /Joel On Jul 21, 2016 20:39, "Martin Buchholz" wrote: > Joel, Thanks for responding so quickly! > > Here' s a slightly modified version of my repro recipe: > You can see that local classes in instance methods have a receiver type, > just like a member inner class. > local classes in static methods (naturally!) do not. I expect the two > flavors of local classes to be treated differently. > > I've never understood why > """All local classes are inner classes""" > (even in a static method?) > https://docs.oracle.com/javase/specs/jls/se8/html/jls-14.html#jls-14.3 > > > import java.lang.reflect.Constructor; > > public class LocalClassReceiverTypeBug { > public static void main(String[] args) throws Throwable { > class StaticLocal {} > printConstructor(StaticLocal.class); > new LocalClassReceiverTypeBug().instanceMain(); > } > > public void instanceMain() throws Throwable { > class InstanceLocal {} > printConstructor(InstanceLocal.class); > printConstructor(Inner.class); > // printConstructor(Nested.class); > } > > static class Nested {} > class Inner {} > > static void printConstructor(Class klazz) { > Constructor[] constructors = klazz.getDeclaredConstructors(); > if (constructors.length != 1) throw new AssertionError(); > Constructor constructor = constructors[0]; > System.out.printf("constructor=%s receivertype=%s%n", > constructor, > constructor.getAnnotatedReceiverType()); > } > } > ==> javac -source 9 -Xlint:all LocalClassReceiverTypeBug.java > ==> java -esa -ea LocalClassReceiverTypeBug > constructor=LocalClassReceiverTypeBug$1StaticLocal() receivertype=null > constructor=LocalClassReceiverTypeBug$1InstanceLocal(LocalClassReceiverTypeBug) > receivertype=null > constructor=LocalClassReceiverTypeBug$Inner(LocalClassReceiverTypeBug) > receivertype=sun.reflect.annotation.AnnotatedTypeFactory$AnnotatedTypeBaseImpl at 1810399e > > > On Thu, Jul 21, 2016 at 11:16 AM, Joel Borggr?n-Franck < > joel.borggren.franck at gmail.com> wrote: > >> Hi Martin, >> >> I'm away from my workstation at the moment, so this is from memory. IIRC >> a local class is pure scoping and lacks an "outer this" which is what you >> annotate for constructors. There should not be receiver type to annotate. >> Since I can't run your code I can't see what's wrong but I might be able to >> help if you paste the output from a run. >> >> Cheers >> /Joel >> >> On Jul 21, 2016 19:49, "Martin Buchholz" wrote: >> >>> Hi Joel, Paul, >>> >>> A coworker ran into the change of behavior here in jdk9. Specifically, >>> we noticed that a local class constructor has a receiver parameter, >>> but getAnnotatedReceiverType returns null. The changed jdk9 spec is >>> actually very clear about that: >>> >>> >>> http://download.java.net/java/jdk9/docs/api/java/lang/reflect/Constructor.html#getAnnotatedReceiverType-- >>> """If this Executable object represents a static method or represents a >>> constructor of a top level, static member, local, or anonymous class, then >>> the return value is null.""" >>> >>> BUT we can't think of any reason WHY a local inner class would be >>> treated differently from an inner member class. Why not the simple and >>> obvious rule: if there is a receiver parameter, return an appropriate >>> non-null AnnotatedType? >>> >>> You already have an excellent jtreg test, but here's what I was playing >>> with: >>> >>> import java.lang.reflect.Constructor; >>> >>> public class LocalClassReceiverTypeBug { >>> public static void main(String[] args) throws Throwable { >>> class StaticLocal {} >>> printConstructor(StaticLocal.class); >>> new LocalClassReceiverTypeBug().instanceMain(); >>> } >>> >>> public void instanceMain() throws Throwable { >>> class InstanceLocal {} >>> printConstructor(InstanceLocal.class); >>> printConstructor(Inner.class); >>> printConstructor(Nested.class); >>> } >>> >>> static class Nested {} >>> class Inner {} >>> >>> static void printConstructor(Class klazz) { >>> Constructor[] constructors = klazz.getDeclaredConstructors(); >>> if (constructors.length != 1) throw new AssertionError(); >>> System.out.printf("constructor=%s%n", constructors[0]); >>> System.out.printf("receiver type=%s%n", >>> constructors[0].getAnnotatedReceiverType()); >>> } >>> } >>> >>> >>> >>> On Wed, Aug 13, 2014 at 1:54 AM, Joel Borggren-Franck < >>> joel.franck at oracle.com> wrote: >>> >>>> Hi Paul, >>>> >>>> On 2014-06-24, Paul Sandoz wrote: >>>> > >>>> > On Jun 17, 2014, at 6:52 PM, Joel Borggr?n-Franck < >>>> joel.franck at oracle.com> wrote: >>>> > > >>>> > > Can I get a review for this fix and javadoc clarification for >>>> https://bugs.openjdk.java.net/browse/JDK-8044629 >>>> > > >>>> > >>>> > +1 >>>> > >>>> > I never quite realised just how convoluted it was to determine that a >>>> class is an inner class. >>>> >>>> Neither did I until I had to implement it :) >>>> >>>> cheers >>>> /Joel >>>> >>> >>> > From martinrb at google.com Thu Jul 21 19:07:30 2016 From: martinrb at google.com (Martin Buchholz) Date: Thu, 21 Jul 2016 12:07:30 -0700 Subject: RFR: jsr166 jdk9 integration wave 8 Message-ID: Time for the next round. No spec changes! http://cr.openjdk.java.net/~martin/webrevs/openjdk9/jsr166-jdk9-integration/ From peter.levart at gmail.com Thu Jul 21 20:45:12 2016 From: peter.levart at gmail.com (Peter Levart) Date: Thu, 21 Jul 2016 22:45:12 +0200 Subject: RFR: jsr166 jdk9 integration wave 8 In-Reply-To: References: Message-ID: <3da68ea0-7d7e-bf6b-7d72-e833f6a4add4@gmail.com> Hi Martin, On 07/21/2016 09:07 PM, Martin Buchholz wrote: > Time for the next round. No spec changes! > > http://cr.openjdk.java.net/~martin/webrevs/openjdk9/jsr166-jdk9-integration/ 86 @SuppressWarnings("unchecked") // can now be removed from AtomicReference.get(), right? Regards, Peter From martinrb at google.com Thu Jul 21 20:52:42 2016 From: martinrb at google.com (Martin Buchholz) Date: Thu, 21 Jul 2016 13:52:42 -0700 Subject: RFR: jsr166 jdk9 integration wave 8 In-Reply-To: <3da68ea0-7d7e-bf6b-7d72-e833f6a4add4@gmail.com> References: <3da68ea0-7d7e-bf6b-7d72-e833f6a4add4@gmail.com> Message-ID: Thanks! Done. On Thu, Jul 21, 2016 at 1:45 PM, Peter Levart wrote: > Hi Martin, > > On 07/21/2016 09:07 PM, Martin Buchholz wrote: > > Time for the next round. No spec changes! > http://cr.openjdk.java.net/~martin/webrevs/openjdk9/jsr166-jdk9-integration/ > > > 86 @SuppressWarnings("unchecked") // can now be removed from > AtomicReference.get(), right? > > Regards, Peter > > From iris.clark at oracle.com Thu Jul 21 21:01:52 2016 From: iris.clark at oracle.com (Iris Clark) Date: Thu, 21 Jul 2016 14:01:52 -0700 (PDT) Subject: RFR(s) 8161236: Runtime.Version.{compareTo, equals}IgnoreOpt should be renamed In-Reply-To: References: Message-ID: Hi, Kumar. Thank you very much for pushing the changesets to resolve this bug! Regards. iris From: Iris Clark Sent: Wednesday, July 20, 2016 1:11 PM To: Kumar Srinivasan; Java Core Libs; compiler-dev at openjdk.java.net; kulla-dev at openjdk.java.net Subject: RFR(s) 8161236: Runtime.Version.{compareTo, equals}IgnoreOpt should be renamed Hi. Please review changes in jdk and langtools (module jdk.jshell) to address the following bug: 8161236: Runtime.Version.{compareTo,equals}IgnoreOpt should be renamed https://bugs.openjdk.java.net/browse/JDK-8161236 Webrev: http://cr.openjdk.java.net/~iris/verona/8161236/webrev.0/ We update the method declarations to replace the token "Opt" with "Optional", thus aligning the method names with the associated getter, Runtime.Version.optional(). Specification references to those methods and any uses of the methods were also updated. JPRT runs (testsets hotspot and pit) show no failures related to these changes. A CCC request is in flight. Regards, Iris From naoto.sato at oracle.com Thu Jul 21 22:44:51 2016 From: naoto.sato at oracle.com (Naoto Sato) Date: Thu, 21 Jul 2016 15:44:51 -0700 Subject: [9] RFR: 8162343: non-ASCII characters in source code comments (.hpp) Message-ID: <8ddfaaf7-6412-d88c-d2bb-495a21ec003f@oracle.com> Hello, Please review the change to the following issue: https://bugs.openjdk.java.net/browse/JDK-8162343 The proposed fix is located at: http://cr.openjdk.java.net/~naoto/8162343/webrev.00/ It's a trivial fix following the bug 8161937. Naoto From david.holmes at oracle.com Fri Jul 22 01:20:10 2016 From: david.holmes at oracle.com (David Holmes) Date: Fri, 22 Jul 2016 11:20:10 +1000 Subject: RFR: JDK-8044629: (reflect) Constructor.getAnnotatedReceiverType() returns wrong value In-Reply-To: References: <1B51A5CD-A909-42C4-97D1-1F8F5DFE55D2@oracle.com> <9E339B30-A01D-4427-A2D1-A0E96E5A978C@oracle.com> <20140813085406.GD22209@oracle.com> Message-ID: <305959f3-b496-72a6-ea7d-fa51ddb1f993@oracle.com> On 22/07/2016 4:50 AM, Joel Borggr?n-Franck wrote: > This is the first time I noticed the second paragraph of $14.3, strange > indeed! I'd ping compiler-dev with this, Alex will probably know if this is > a spec bug in $14.3 or just an irregularity. It is an irregularity - for want of a better word. See: https://docs.oracle.com/javase/specs/jls/se8/html/jls-8.html#jls-8.1.3 "An instance of an inner class I whose declaration occurs in a static context has no lexically enclosing instances. " David ----- > Cheers > /Joel > > On Jul 21, 2016 20:39, "Martin Buchholz" wrote: > >> Joel, Thanks for responding so quickly! >> >> Here' s a slightly modified version of my repro recipe: >> You can see that local classes in instance methods have a receiver type, >> just like a member inner class. >> local classes in static methods (naturally!) do not. I expect the two >> flavors of local classes to be treated differently. >> >> I've never understood why >> """All local classes are inner classes""" >> (even in a static method?) >> https://docs.oracle.com/javase/specs/jls/se8/html/jls-14.html#jls-14.3 >> >> >> import java.lang.reflect.Constructor; >> >> public class LocalClassReceiverTypeBug { >> public static void main(String[] args) throws Throwable { >> class StaticLocal {} >> printConstructor(StaticLocal.class); >> new LocalClassReceiverTypeBug().instanceMain(); >> } >> >> public void instanceMain() throws Throwable { >> class InstanceLocal {} >> printConstructor(InstanceLocal.class); >> printConstructor(Inner.class); >> // printConstructor(Nested.class); >> } >> >> static class Nested {} >> class Inner {} >> >> static void printConstructor(Class klazz) { >> Constructor[] constructors = klazz.getDeclaredConstructors(); >> if (constructors.length != 1) throw new AssertionError(); >> Constructor constructor = constructors[0]; >> System.out.printf("constructor=%s receivertype=%s%n", >> constructor, >> constructor.getAnnotatedReceiverType()); >> } >> } >> ==> javac -source 9 -Xlint:all LocalClassReceiverTypeBug.java >> ==> java -esa -ea LocalClassReceiverTypeBug >> constructor=LocalClassReceiverTypeBug$1StaticLocal() receivertype=null >> constructor=LocalClassReceiverTypeBug$1InstanceLocal(LocalClassReceiverTypeBug) >> receivertype=null >> constructor=LocalClassReceiverTypeBug$Inner(LocalClassReceiverTypeBug) >> receivertype=sun.reflect.annotation.AnnotatedTypeFactory$AnnotatedTypeBaseImpl at 1810399e >> >> >> On Thu, Jul 21, 2016 at 11:16 AM, Joel Borggr?n-Franck < >> joel.borggren.franck at gmail.com> wrote: >> >>> Hi Martin, >>> >>> I'm away from my workstation at the moment, so this is from memory. IIRC >>> a local class is pure scoping and lacks an "outer this" which is what you >>> annotate for constructors. There should not be receiver type to annotate. >>> Since I can't run your code I can't see what's wrong but I might be able to >>> help if you paste the output from a run. >>> >>> Cheers >>> /Joel >>> >>> On Jul 21, 2016 19:49, "Martin Buchholz" wrote: >>> >>>> Hi Joel, Paul, >>>> >>>> A coworker ran into the change of behavior here in jdk9. Specifically, >>>> we noticed that a local class constructor has a receiver parameter, >>>> but getAnnotatedReceiverType returns null. The changed jdk9 spec is >>>> actually very clear about that: >>>> >>>> >>>> http://download.java.net/java/jdk9/docs/api/java/lang/reflect/Constructor.html#getAnnotatedReceiverType-- >>>> """If this Executable object represents a static method or represents a >>>> constructor of a top level, static member, local, or anonymous class, then >>>> the return value is null.""" >>>> >>>> BUT we can't think of any reason WHY a local inner class would be >>>> treated differently from an inner member class. Why not the simple and >>>> obvious rule: if there is a receiver parameter, return an appropriate >>>> non-null AnnotatedType? >>>> >>>> You already have an excellent jtreg test, but here's what I was playing >>>> with: >>>> >>>> import java.lang.reflect.Constructor; >>>> >>>> public class LocalClassReceiverTypeBug { >>>> public static void main(String[] args) throws Throwable { >>>> class StaticLocal {} >>>> printConstructor(StaticLocal.class); >>>> new LocalClassReceiverTypeBug().instanceMain(); >>>> } >>>> >>>> public void instanceMain() throws Throwable { >>>> class InstanceLocal {} >>>> printConstructor(InstanceLocal.class); >>>> printConstructor(Inner.class); >>>> printConstructor(Nested.class); >>>> } >>>> >>>> static class Nested {} >>>> class Inner {} >>>> >>>> static void printConstructor(Class klazz) { >>>> Constructor[] constructors = klazz.getDeclaredConstructors(); >>>> if (constructors.length != 1) throw new AssertionError(); >>>> System.out.printf("constructor=%s%n", constructors[0]); >>>> System.out.printf("receiver type=%s%n", >>>> constructors[0].getAnnotatedReceiverType()); >>>> } >>>> } >>>> >>>> >>>> >>>> On Wed, Aug 13, 2014 at 1:54 AM, Joel Borggren-Franck < >>>> joel.franck at oracle.com> wrote: >>>> >>>>> Hi Paul, >>>>> >>>>> On 2014-06-24, Paul Sandoz wrote: >>>>>> >>>>>> On Jun 17, 2014, at 6:52 PM, Joel Borggr?n-Franck < >>>>> joel.franck at oracle.com> wrote: >>>>>>> >>>>>>> Can I get a review for this fix and javadoc clarification for >>>>> https://bugs.openjdk.java.net/browse/JDK-8044629 >>>>>>> >>>>>> >>>>>> +1 >>>>>> >>>>>> I never quite realised just how convoluted it was to determine that a >>>>> class is an inner class. >>>>> >>>>> Neither did I until I had to implement it :) >>>>> >>>>> cheers >>>>> /Joel >>>>> >>>> >>>> >> From frank.yuan at oracle.com Fri Jul 22 06:59:18 2016 From: frank.yuan at oracle.com (Frank Yuan) Date: Fri, 22 Jul 2016 14:59:18 +0800 Subject: RFR (JAXP) JDK-8067170: Enable security manager on JAXP unit tests In-Reply-To: <578CA476.7030407@oracle.com> References: <022401d1e0d7$54111090$fc3331b0$@oracle.com> <578CA476.7030407@oracle.com> Message-ID: <03a601d1e3e6$92c45a60$b84d0f20$@oracle.com> According to Amy's suggestion, re-generate a webrev http://cr.openjdk.java.net/~fyuan/8067170/webrev.01/ as well as fix some issues, please check. Thanks Frank > -----Original Message----- > From: Amy Lu [mailto:amy.lu at oracle.com] > Sent: Monday, July 18, 2016 5:42 PM > To: Frank Yuan; 'core-libs-dev' > Subject: Re: RFR (JAXP) JDK-8067170: Enable security manager on JAXP unit tests > > On 7/18/16 5:32 PM, Frank Yuan wrote: > > Btw, I moved internaltest into unittest because it's unnecessary to separate them. > > Maybe you'd like to regenerate the webrev with hg move for those files? > > Thanks, > Amy From peter.levart at gmail.com Fri Jul 22 07:00:41 2016 From: peter.levart at gmail.com (Peter Levart) Date: Fri, 22 Jul 2016 09:00:41 +0200 Subject: RFR 9: JEP 290: Filter Incoming Serialization Data In-Reply-To: <7fd53029-5586-cbbe-4e5e-c074c14d6fa8@Oracle.com> References: <97bdccb1-3aca-a354-4eb6-4df1e79dac94@gmail.com> <7fd53029-5586-cbbe-4e5e-c074c14d6fa8@Oracle.com> Message-ID: <10d8193d-a18b-51cd-681b-32ad41a431cf@gmail.com> Hi Roger, On 07/21/2016 08:19 PM, Roger Riggs wrote: >>>> - The call-back is invoked after the type of the object and >>>> possible array length is read from stream but before the object's >>>> state is read. Suppose that the object that is about to be read is >>>> either Externalizable object or an object with a readObject() >>>> method(s) that consume block data from the stream. This block data >>>> can be large. Should there be a call-back to "announce" the block >>>> data too? (for example, when the 'clazz' is null and the 'size' is >>>> 0, the call-back reports a back-reference to a previously read >>>> object, but when the 'clazz' is null and the 'size' > 0, it >>>> announces the 'size' bytes of block data. Does this make sense?) >>> Interesting case, I'll take another look at that. Since block data >>> records are <= 1024, a filter might not >>> have enough information to make an informed decision. Those bytes >>> would show up in >>> the stream bytes but not until the next object is read. >> >> ...which could be to late. If the filter is to be also used as a >> defense against forged streams that try to provoke DOS by triggering >> frequent GCs and OutOfMemoryError(s), then such call-back that >> announces each block data record could help achieve that. > Individual block data lengths are not very informative since block > data can be segmented but > a cumulative (for the whole stream) block data size suitable for a > callback from the > start of each block data segment might be useful. Is it possible to identify which block data records "belong" to a particular object? If yes, then perhaps cumulative sum(s) of block data sizes for a particular object could be passed to the call-back together with the Class of the object the data belongs to (similar to how array is reported, the size would be cumulative block data size read so-far and the filter could distinguish such callback from array callback by inspecting clazz.isArray()). In conjunction with cumulative size of the whole stream which is already passed now, I think this is enough to implement all kinds of safety-belts. If you think that such addition starts to become complex from combinatorial standpoint then what about passing an additional enum argument identifying a particular "event"? It would then be easy do document the rest of parameters for each event type... Regards, Peter From peter.levart at gmail.com Fri Jul 22 07:08:56 2016 From: peter.levart at gmail.com (Peter Levart) Date: Fri, 22 Jul 2016 09:08:56 +0200 Subject: RFR 9: JEP 290: Filter Incoming Serialization Data In-Reply-To: <10d8193d-a18b-51cd-681b-32ad41a431cf@gmail.com> References: <97bdccb1-3aca-a354-4eb6-4df1e79dac94@gmail.com> <7fd53029-5586-cbbe-4e5e-c074c14d6fa8@Oracle.com> <10d8193d-a18b-51cd-681b-32ad41a431cf@gmail.com> Message-ID: <7005ec07-454c-55ee-4976-11ef1c41bc41@gmail.com> On 07/22/2016 09:00 AM, Peter Levart wrote: > If you think that such addition starts to become complex from > combinatorial standpoint then what about passing an additional enum > argument identifying a particular "event"? It would then be easy do > document the rest of parameters for each event type... ...also, filter implementations then become more readable as they might use a switch statement on the enum parameter which would clearly stand-out in code and express the intent to all readers not only to those that read the documentation... Peter From daniel.fuchs at oracle.com Fri Jul 22 07:58:35 2016 From: daniel.fuchs at oracle.com (Daniel Fuchs) Date: Fri, 22 Jul 2016 08:58:35 +0100 Subject: RFR (JAXP) JDK-8067170: Enable security manager on JAXP unit tests In-Reply-To: <03a601d1e3e6$92c45a60$b84d0f20$@oracle.com> References: <022401d1e0d7$54111090$fc3331b0$@oracle.com> <578CA476.7030407@oracle.com> <03a601d1e3e6$92c45a60$b84d0f20$@oracle.com> Message-ID: Hi Frank, I see that in order to be able to run the tests, you were forced to add a few permissions that the test/test infrastructure need to setup things: 107 addPermission(new SecurityPermission("getPolicy")); 108 addPermission(new SecurityPermission("setPolicy")); 109 addPermission(new RuntimePermission("getClassLoader")); 110 addPermission(new RuntimePermission("createClassLoader")); 111 addPermission(new RuntimePermission("setSecurityManager")); 112 addPermission(new RuntimePermission("createSecurityManager")); 113 addPermission(new RuntimePermission("modifyThread")); 114 addPermission(new PropertyPermission("*", "read, write")); 115 addPermission(new ReflectPermission("suppressAccessChecks")); 116 addPermission(new RuntimePermission("setIO")); 117 addPermission(new RuntimePermission("setContextClassLoader")); 118 addPermission(new RuntimePermission("accessDeclaredMembers")); These are quite powerful permissions, and adding them by default also means that you might miss a bug - if e.g. a doPrivileged is missing somewhere in the JAXP code when jaxp tries to e.g. get/create a classloader, or read a system property, you might not see it. I had a similar issue when writing logging test, were I wanted to temporarily disable permission checking in the middle of a test to perform an infrastructure configuration. So what I did is use an ThreadLocal to temporarily disable permission checking - which allows me in my tests to do things like: boolean before = allowAll.get().get(); allowAll.get().set(true); try { do something that requires a permission } finally { allowAll.get().set(before); } My implementation of Policy::implies also checks for if (allowAll.get().get()) return true; This allows me to control more tightly the set of permissions I want my test to run under, while still being able to perform any action I want to set up things without having to give the same permission to all. Hope this helps, -- daniel On 22/07/16 07:59, Frank Yuan wrote: > According to Amy's suggestion, re-generate a webrev http://cr.openjdk.java.net/~fyuan/8067170/webrev.01/ as well as fix some issues, > please check. > > Thanks > Frank > >> -----Original Message----- >> From: Amy Lu [mailto:amy.lu at oracle.com] >> Sent: Monday, July 18, 2016 5:42 PM >> To: Frank Yuan; 'core-libs-dev' >> Subject: Re: RFR (JAXP) JDK-8067170: Enable security manager on JAXP unit tests >> >> On 7/18/16 5:32 PM, Frank Yuan wrote: >>> Btw, I moved internaltest into unittest because it's unnecessary to separate them. >> >> Maybe you'd like to regenerate the webrev with hg move for those files? >> >> Thanks, >> Amy > > From volker.simonis at gmail.com Fri Jul 22 09:08:31 2016 From: volker.simonis at gmail.com (Volker Simonis) Date: Fri, 22 Jul 2016 11:08:31 +0200 Subject: [8u] request for approval: "8152172: PPC64: Support AES intrinsics" Message-ID: Hi, could you please approve the backport of the following, mostly ppc64 change to jdk8u-dev: 8152172: PPC64: Support AES intrinsics Bug: https://bugs.openjdk.java.net/browse/JDK-8152172 Webrev: http://cr.openjdk.java.net/~simonis/webrevs/2016/8152172_8u_hs/ Webrev http://cr.openjdk.java.net/~simonis/webrevs/2016/8152172_8u_jdk/ Review: http://mail.openjdk.java.net/pipermail/hotspot-compiler-dev/2016-March/thread.html#22032 URL:http://hg.openjdk.java.net/jdk9/hs-comp/jdk/rev/74bc7be0777b URL:http://hg.openjdk.java.net/jdk9/hs-comp/hotspot/rev/68394bf0a09f As you can see, the change consists of two parts - the main one in the hotpsot repo and a small part in the jdk repo. The jdk part applied cleanly to jdk8u (with the usual directory shuffling). The hotspot part required a small tweak, but only in the ppc-only part. This is because the feature detection for the AES instructions was already active in jdk9 when the original change was made but is not available in jdk8u until now. You can find the additional changes at the end of this mail for your convenience. The required shared changes cleanly apply to jdk8u. As Vladimir pointed out in a previous thread, shared Hotspot changes have to go through JPRT even in jdk8u-dev. So I need a sponsor to do that and synchronously push both parts. @Hiroshii: could you please verify that you are fine with the change? I've done some tests on Power8LE but just want to be sure this downport satisfies your needs as well. Thank you and best regards, Volker ===================== diff -r 15928d255046 src/cpu/ppc/vm/vm_version_ppc.cpp --- a/src/cpu/ppc/vm/vm_version_ppc.cpp Wed Jul 13 00:47:40 2016 -0700 +++ b/src/cpu/ppc/vm/vm_version_ppc.cpp Fri Jul 22 10:32:36 2016 +0200 @@ -452,6 +476,7 @@ a->popcntw(R7, R5); // code[7] -> popcntw a->fcfids(F3, F4); // code[8] -> fcfids a->vand(VR0, VR0, VR0); // code[9] -> vand + a->vcipher(VR0, VR1, VR2); // code[10] -> vcipher a->blr(); // Emit function to set one cache line to zero. Emit function descriptor and get pointer to it. @@ -495,6 +520,7 @@ if (code[feature_cntr++]) features |= popcntw_m; if (code[feature_cntr++]) features |= fcfids_m; if (code[feature_cntr++]) features |= vand_m; + if (code[feature_cntr++]) features |= vcipher_m; // Print the detection code. if (PrintAssembly) { diff -r 15928d255046 src/cpu/ppc/vm/vm_version_ppc.hpp --- a/src/cpu/ppc/vm/vm_version_ppc.hpp Wed Jul 13 00:47:40 2016 -0700 +++ b/src/cpu/ppc/vm/vm_version_ppc.hpp Fri Jul 22 10:32:36 2016 +0200 @@ -42,6 +42,7 @@ fcfids, vand, dcba, + vcipher, num_features // last entry to count features }; enum Feature_Flag_Set { @@ -56,6 +57,7 @@ fcfids_m = (1 << fcfids ), vand_m = (1 << vand ), dcba_m = (1 << dcba ), + vcipher_m = (1 << vcipher), all_features_m = -1 }; static int _features; @@ -83,6 +85,7 @@ static bool has_fcfids() { return (_features & fcfids_m) != 0; } static bool has_vand() { return (_features & vand_m) != 0; } static bool has_dcba() { return (_features & dcba_m) != 0; } + static bool has_vcipher() { return (_features & vcipher_m) != 0; } static const char* cpu_features() { return _features_str; } From frank.yuan at oracle.com Fri Jul 22 09:15:35 2016 From: frank.yuan at oracle.com (Frank Yuan) Date: Fri, 22 Jul 2016 17:15:35 +0800 Subject: RFR (JAXP) JDK-8067170: Enable security manager on JAXP unit tests In-Reply-To: References: <022401d1e0d7$54111090$fc3331b0$@oracle.com> <578CA476.7030407@oracle.com> <03a601d1e3e6$92c45a60$b84d0f20$@oracle.com> Message-ID: <040101d1e3f9$9d19a340$d74ce9c0$@oracle.com> Hi Daniel Thank you very much for your review and the comments! > -----Original Message----- > From: Daniel Fuchs [mailto:daniel.fuchs at oracle.com] > Subject: Re: RFR (JAXP) JDK-8067170: Enable security manager on JAXP unit tests > > Hi Frank, > > I see that in order to be able to run the tests, you were forced > to add a few permissions that the test/test infrastructure need > to setup things: > > 107 addPermission(new SecurityPermission("getPolicy")); > 108 addPermission(new SecurityPermission("setPolicy")); > 109 addPermission(new RuntimePermission("getClassLoader")); > 110 addPermission(new RuntimePermission("createClassLoader")); > 111 addPermission(new RuntimePermission("setSecurityManager")); > 112 addPermission(new RuntimePermission("createSecurityManager")); > 113 addPermission(new RuntimePermission("modifyThread")); > 114 addPermission(new PropertyPermission("*", "read, write")); > 115 addPermission(new ReflectPermission("suppressAccessChecks")); > 116 addPermission(new RuntimePermission("setIO")); > 117 addPermission(new RuntimePermission("setContextClassLoader")); > 118 addPermission(new RuntimePermission("accessDeclaredMembers")); > > These are quite powerful permissions, and adding them by default > also means that you might miss a bug - if e.g. a doPrivileged is > missing somewhere in the JAXP code when jaxp tries to e.g. get/create > a classloader, or read a system property, you might not see > it. Yes, I agree completely. I would control the permission assignment more tightly: 1. only allow the following necessary permissions in default: addPermission(new SecurityPermission("getPolicy")); addPermission(new SecurityPermission("setPolicy")); addPermission(new RuntimePermission("setSecurityManager")); 2. other permissions in current default set are commonly used for the tests, so I would add more Policy classes like existing FilePolicy, etc. //ClassLoaderPolicy, an individual test may only require some of them, but I would put them in only one class if you agree addPermission(new RuntimePermission("getClassLoader")); addPermission(new RuntimePermission("createClassLoader")); addPermission(new RuntimePermission("setContextClassLoader")); // PropertyPolicy, there are various properties needed by the tests, I would not classify them further... addPermission(new PropertyPermission("*", "read, write")); //Reflection permissions, jtreg may require them in deed, so I may add them in default set addPermission(new ReflectPermission("suppressAccessChecks")); addPermission(new RuntimePermission("accessDeclaredMembers")); //other permissions are used in less tests, I may use tryRunWithTmpPermission instead of Policy class addPermission(new RuntimePermission("setIO")); addPermission(new RuntimePermission("createSecurityManager")); addPermission(new RuntimePermission("modifyThread")); How about you think? > > I had a similar issue when writing logging test, were I wanted > to temporarily disable permission checking in the middle of a test > to perform an infrastructure configuration. > > So what I did is use an ThreadLocal to temporarily > disable permission checking - which allows me in my tests to do things > like: > > boolean before = allowAll.get().get(); > allowAll.get().set(true); > try { > do something that requires a permission > } finally { > allowAll.get().set(before); > } > JAXPTestUtilities.tryRunWithTmpPermission is similar with this, see the example: http://cr.openjdk.java.net/~fyuan/8067170/webrev.01/test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug6555001.java.sdiff.htm l > My implementation of Policy::implies also checks for > > if (allowAll.get().get()) return true; > > This allows me to control more tightly the set of permissions > I want my test to run under, while still being able to > perform any action I want to set up things without having > to give the same permission to all. > > Hope this helps, > > -- daniel > > > > On 22/07/16 07:59, Frank Yuan wrote: > > According to Amy's suggestion, re-generate a webrev http://cr.openjdk.java.net/~fyuan/8067170/webrev.01/ as well as fix some issues, > > please check. > > > > Thanks > > Frank > > > >> -----Original Message----- > >> From: Amy Lu [mailto:amy.lu at oracle.com] > >> Sent: Monday, July 18, 2016 5:42 PM > >> To: Frank Yuan; 'core-libs-dev' > >> Subject: Re: RFR (JAXP) JDK-8067170: Enable security manager on JAXP unit tests > >> > >> On 7/18/16 5:32 PM, Frank Yuan wrote: > >>> Btw, I moved internaltest into unittest because it's unnecessary to separate them. > >> > >> Maybe you'd like to regenerate the webrev with hg move for those files? > >> > >> Thanks, > >> Amy > > > > From nadeesh.tv at oracle.com Fri Jul 22 09:37:57 2016 From: nadeesh.tv at oracle.com (nadeesh tv) Date: Fri, 22 Jul 2016 15:07:57 +0530 Subject: RFR:JDK-8066806:java.time.format.DateTimeFormatter cannot parse an offset with single digit hour In-Reply-To: References: <5746AA87.3040501@oracle.com> <5757C25E.9040605@oracle.com> <79e6445f-d482-bd32-5123-c364a5d086eb@Oracle.com> <57593666.2060202@oracle.com> <57594C1E.3080501@oracle.com> <575AA1AB.2080200@oracle.com> <5790B01E.30304@oracle.com> Message-ID: <5791E975.8080105@oracle.com> Hi Roger, Thanks for the comments and sorry for the incorrect link. Please see the updated webrev which includes your suggestions. http://cr.openjdk.java.net/~ntv/8066806/webrev.10/ -- Thanks and Regards, Nadeesh TV On 7/21/2016 6:59 PM, Roger Riggs wrote: > Hi Nadeesh, > > Found the changes in http://cr.openjdk.java.net/~ntv/8066806/webrev.09/ > > Editorial: > " > Inthelenient mode,*the*parser will be greedy and parse*the*maximum digits possible." > TCKDateTimeFormatterBuilder.java: > > The lines 1473, 1479, 1485, etc. are way too long, perhaps wrap/break > them so each line starts with "." > > And wrap any other line longer than 100 chars. (Side by side diffs > are annoying if the lines are too long). > > Otherwise, looks good, > > Thanks, Roger > > > On 7/21/2016 7:21 AM, nadeesh tv wrote: >> Hi, >> >> Please see the updated webrev >> >> http://cr.openjdk.java.net/~ntv/8066806/webrev.08/ >> >> Changes in this webrev: >> For leninent mode , doc change in DateTimeFormatterBuilder.java >> " >> >> In the lenient mode, parser will be greedy and parse maximum digits >> possible. >> " >> >> Added new test cases for lenient mode. >> > -- Thanks and Regards, Nadeesh TV From scolebourne at joda.org Fri Jul 22 10:08:17 2016 From: scolebourne at joda.org (Stephen Colebourne) Date: Fri, 22 Jul 2016 11:08:17 +0100 Subject: RFR:JDK-8066806:java.time.format.DateTimeFormatter cannot parse an offset with single digit hour In-Reply-To: <5791E975.8080105@oracle.com> References: <5746AA87.3040501@oracle.com> <5757C25E.9040605@oracle.com> <79e6445f-d482-bd32-5123-c364a5d086eb@Oracle.com> <57593666.2060202@oracle.com> <57594C1E.3080501@oracle.com> <575AA1AB.2080200@oracle.com> <5790B01E.30304@oracle.com> <5791E975.8080105@oracle.com> Message-ID: These tests are expected to throw exceptions: test_strict_appendOffsetId() test_strict_appendOffset_1() test_strict_appendOffset_2() test_strict_appendOffset_3() test_strict_appendOffset_4() As such, they should not contain assertEquals(). They should only contain the code that is expected to throw (thus they should not have .get(OFFSET_SECONDS) either). test_strict_offset_adjacentInvalidPattern_parse test_lenient_offset_adjacentInvalidPattern_parse should not have .get(OFFSET_SECONDS) Indentation on line 1621/1622 thanks Stephen On 22 July 2016 at 10:37, nadeesh tv wrote: > Hi Roger, > > Thanks for the comments and sorry for the incorrect link. > > Please see the updated webrev which includes your suggestions. > > http://cr.openjdk.java.net/~ntv/8066806/webrev.10/ > > -- > Thanks and Regards, > Nadeesh TV > > > On 7/21/2016 6:59 PM, Roger Riggs wrote: > > Hi Nadeesh, > > Found the changes in http://cr.openjdk.java.net/~ntv/8066806/webrev.09/ > > Editorial: > " > > In the lenient mode, the parser will be greedy and parse the maximum digits > possible." > > TCKDateTimeFormatterBuilder.java: > > The lines 1473, 1479, 1485, etc. are way too long, perhaps wrap/break them > so each line starts with "." > > And wrap any other line longer than 100 chars. (Side by side diffs are > annoying if the lines are too long). > > Otherwise, looks good, > > Thanks, Roger > > > On 7/21/2016 7:21 AM, nadeesh tv wrote: > > Hi, > > Please see the updated webrev > > http://cr.openjdk.java.net/~ntv/8066806/webrev.08/ > > Changes in this webrev: > For leninent mode , doc change in DateTimeFormatterBuilder.java > " > > In the lenient mode, parser will be greedy and parse maximum digits > possible. > " > > Added new test cases for lenient mode. > > > > -- > Thanks and Regards, > Nadeesh TV > From christoph.langer at sap.com Fri Jul 22 10:38:11 2016 From: christoph.langer at sap.com (Langer, Christoph) Date: Fri, 22 Jul 2016 10:38:11 +0000 Subject: JAXP: XSLTC transformer swallows empty namespace declaration which is necessary to undeclare default namespace Message-ID: Hi, I have a customer reporting the following phenomena which I believe is an issue. Consider the following xsl: ---------------------XSL--------------------- ---------------------End of XSL--------------------- This is the XML snippet where the XSL gets applied (just a dummy): The result with the current XSLTC is: But this would not undeclare the default namespace "ns1" from the element named "root" for the element named "test" which was the intention of the xsl. So I believe it should be: Looking at the coding I came up with the following: http://cr.openjdk.java.net/~clanger/webrevs/xsltc-namespaceissue/ With that, XSLTC would also emit the namespace attribute for an empty namespace. It works for my example but I'm not sure if it is the right thing to do or if it breaks things at other places and violates specs elsewhere. Comparing with the Apache Xalan, I can see that the Apache XSLTC matches the JDK XSLTC behavior to suppress the namespace declaration but the interpretative transformer (org.apache.xalan.processor.TransformerFactoryImpl) would emit the namespace attribute. Please give me some comments before I open a Bug... Thanks a lot in advance Christoph From daniel.fuchs at oracle.com Fri Jul 22 12:53:43 2016 From: daniel.fuchs at oracle.com (Daniel Fuchs) Date: Fri, 22 Jul 2016 13:53:43 +0100 Subject: RFR (JAXP) JDK-8067170: Enable security manager on JAXP unit tests In-Reply-To: <040101d1e3f9$9d19a340$d74ce9c0$@oracle.com> References: <022401d1e0d7$54111090$fc3331b0$@oracle.com> <578CA476.7030407@oracle.com> <03a601d1e3e6$92c45a60$b84d0f20$@oracle.com> <040101d1e3f9$9d19a340$d74ce9c0$@oracle.com> Message-ID: <88977a21-e4d1-e792-00db-1debc3162b08@oracle.com> On 22/07/16 10:15, Frank Yuan wrote: > Hi Daniel > > Thank you very much for your review and the comments! > >> -----Original Message----- >> From: Daniel Fuchs [mailto:daniel.fuchs at oracle.com] >> Subject: Re: RFR (JAXP) JDK-8067170: Enable security manager on JAXP unit tests >> >> Hi Frank, >> >> I see that in order to be able to run the tests, you were forced >> to add a few permissions that the test/test infrastructure need >> to setup things: >> >> 107 addPermission(new SecurityPermission("getPolicy")); >> 108 addPermission(new SecurityPermission("setPolicy")); >> 109 addPermission(new RuntimePermission("getClassLoader")); >> 110 addPermission(new RuntimePermission("createClassLoader")); >> 111 addPermission(new RuntimePermission("setSecurityManager")); >> 112 addPermission(new RuntimePermission("createSecurityManager")); >> 113 addPermission(new RuntimePermission("modifyThread")); >> 114 addPermission(new PropertyPermission("*", "read, write")); >> 115 addPermission(new ReflectPermission("suppressAccessChecks")); >> 116 addPermission(new RuntimePermission("setIO")); >> 117 addPermission(new RuntimePermission("setContextClassLoader")); >> 118 addPermission(new RuntimePermission("accessDeclaredMembers")); >> >> These are quite powerful permissions, and adding them by default >> also means that you might miss a bug - if e.g. a doPrivileged is >> missing somewhere in the JAXP code when jaxp tries to e.g. get/create >> a classloader, or read a system property, you might not see >> it. > Yes, I agree completely. I would control the permission assignment more tightly: > 1. only allow the following necessary permissions in default: > addPermission(new SecurityPermission("getPolicy")); > addPermission(new SecurityPermission("setPolicy")); > addPermission(new RuntimePermission("setSecurityManager")); > 2. other permissions in current default set are commonly used for the tests, so I would add more Policy classes like existing > FilePolicy, etc. > //ClassLoaderPolicy, an individual test may only require some of them, but I would put them in only one class if you agree > addPermission(new RuntimePermission("getClassLoader")); > addPermission(new RuntimePermission("createClassLoader")); > addPermission(new RuntimePermission("setContextClassLoader")); > > // PropertyPolicy, there are various properties needed by the tests, I would not classify them further... > addPermission(new PropertyPermission("*", "read, write")); > > //Reflection permissions, jtreg may require them in deed, so I may add them in default set > addPermission(new ReflectPermission("suppressAccessChecks")); > addPermission(new RuntimePermission("accessDeclaredMembers")); > > //other permissions are used in less tests, I may use tryRunWithTmpPermission instead of Policy class > addPermission(new RuntimePermission("setIO")); > addPermission(new RuntimePermission("createSecurityManager")); > addPermission(new RuntimePermission("modifyThread")); > > How about you think? It would definitely improve things - but then all the classes in the test that runs with this new policy class will inherit from these permissions as well. This may or may not be an issue. (I confess I haven't looked at all the webrev ;-() >> I had a similar issue when writing logging test, were I wanted >> to temporarily disable permission checking in the middle of a test >> to perform an infrastructure configuration. >> >> So what I did is use an ThreadLocal to temporarily >> disable permission checking - which allows me in my tests to do things >> like: >> >> boolean before = allowAll.get().get(); >> allowAll.get().set(true); >> try { >> do something that requires a permission >> } finally { >> allowAll.get().set(before); >> } >> > JAXPTestUtilities.tryRunWithTmpPermission is similar with this, see the example: > http://cr.openjdk.java.net/~fyuan/8067170/webrev.01/test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug6555001.java.sdiff.htm > l Yes that part looks fine. cheers, -- daniel >> My implementation of Policy::implies also checks for >> >> if (allowAll.get().get()) return true; >> >> This allows me to control more tightly the set of permissions >> I want my test to run under, while still being able to >> perform any action I want to set up things without having >> to give the same permission to all. >> >> Hope this helps, >> >> -- daniel >> >> >> >> On 22/07/16 07:59, Frank Yuan wrote: >>> According to Amy's suggestion, re-generate a webrev http://cr.openjdk.java.net/~fyuan/8067170/webrev.01/ as well as fix some > issues, >>> please check. >>> >>> Thanks >>> Frank >>> >>>> -----Original Message----- >>>> From: Amy Lu [mailto:amy.lu at oracle.com] >>>> Sent: Monday, July 18, 2016 5:42 PM >>>> To: Frank Yuan; 'core-libs-dev' >>>> Subject: Re: RFR (JAXP) JDK-8067170: Enable security manager on JAXP unit tests >>>> >>>> On 7/18/16 5:32 PM, Frank Yuan wrote: >>>>> Btw, I moved internaltest into unittest because it's unnecessary to separate them. >>>> >>>> Maybe you'd like to regenerate the webrev with hg move for those files? >>>> >>>> Thanks, >>>> Amy >>> >>> > > From oleg.barbashov at oracle.com Fri Jul 22 15:46:28 2016 From: oleg.barbashov at oracle.com (Oleg G. Barbashov) Date: Fri, 22 Jul 2016 18:46:28 +0300 Subject: RFR: 8158295 Add a multi-release jar validation mechanism to jar tool In-Reply-To: References: Message-ID: <1760798a-7931-76cf-9758-803d1cc608bd@oracle.com> Hi Steve, I would also suggest to pass VM options to jar util in test/tools/jar/multiRelease/Basic.java: 540 commands.add(jar); +541 commands.addAll(Utils.getForwardVmOptions()); Also it seems that there is no need to compile classes using separate process: 526 String javac = JDKToolFinder.getJDKTool("javac"); It is possible to use jdk/test/lib/testlibrary/CompilerUtils.java instead. Thanks, Oleg 07.07.2016 23:32, Steve Drach ?????: > Hi, > > Please review the following: > > webrev: http://cr.openjdk.java.net/~sdrach/8158295/webrev.01/ > issue: https://bugs.openjdk.java.net/browse/JDK-8158295 > > This changeset adds a multi-release jar validator to jar tool. After the jar tool builds a multi-release jar, the potential resultant jar file is passed to the validator to assure that the jar file meets the minimal standards of a multi-release jar, in particular that versioned classes have the same api as base classes they override. There are other checks, for example warning if two classes are identical. If the jar file is invalid, it is not kept, so ?create will not produce a jar file and ?update will keep the input jar file. > > Thanks > Steve From daniel.fuchs at oracle.com Fri Jul 22 16:16:09 2016 From: daniel.fuchs at oracle.com (Daniel Fuchs) Date: Fri, 22 Jul 2016 17:16:09 +0100 Subject: [JAXP] RFR: 8153082: Update XSTL compiler to generate classes that invoke addReads Message-ID: <74b953e2-f07e-afa8-80d0-f55014780f94@oracle.com> Hi, Please find below a fix for 8153082: Update XSTL compiler to generate classes that invoke addReads https://bugs.openjdk.java.net/browse/JDK-8153082 This fix removes a dependency from java.xml to an internal java base API. http://cr.openjdk.java.net/~dfuchs/webrev_8153082/webrev.00/ It changes FunctionCall.java to generate an additional addReads statement before invoking a method on an external class. Namely, where the generated translet class used to have a call to: com.foo.Bar.func(...); (resp: new com.foo.Bar(....)) it will now also contain an additional call to Module.addReads to add the external's class module to the list of modules that the generated translet's module can read. So the generated code now looks like: .class.getModule().addReads( Class.forName("com.foo.Bar").getModule()); com.foo.Bar.func(...); (resp: new com.foo.Bar(....)) best regards, -- daniel From christoph.langer at sap.com Fri Jul 22 19:23:24 2016 From: christoph.langer at sap.com (Langer, Christoph) Date: Fri, 22 Jul 2016 19:23:24 +0000 Subject: [JAXP] RFR: 8153082: Update XSTL compiler to generate classes that invoke addReads In-Reply-To: <74b953e2-f07e-afa8-80d0-f55014780f94@oracle.com> References: <74b953e2-f07e-afa8-80d0-f55014780f94@oracle.com> Message-ID: <22a6662f4b8440a5860ee8f3dfdc55e6@DEWDFE13DE11.global.corp.sap> Hi Daniel, looks good to me. Maybe you'll want to take the chance to update the apache headers in the xalan files? Best regards Christoph > -----Original Message----- > From: core-libs-dev [mailto:core-libs-dev-bounces at openjdk.java.net] On Behalf > Of Daniel Fuchs > Sent: Freitag, 22. Juli 2016 18:16 > To: core-libs-dev > Subject: [JAXP] RFR: 8153082: Update XSTL compiler to generate classes that > invoke addReads > > Hi, > > Please find below a fix for > 8153082: Update XSTL compiler to generate classes that invoke addReads > https://bugs.openjdk.java.net/browse/JDK-8153082 > > This fix removes a dependency from java.xml to an internal > java base API. > > http://cr.openjdk.java.net/~dfuchs/webrev_8153082/webrev.00/ > > It changes FunctionCall.java to generate an additional > addReads statement before invoking a method on an external > class. > > Namely, where the generated translet class used to have > a call to: > > com.foo.Bar.func(...); > (resp: new com.foo.Bar(....)) > > it will now also contain an additional call to Module.addReads > to add the external's class module to the list of modules that > the generated translet's module can read. So the generated > code now looks like: > > .class.getModule().addReads( > Class.forName("com.foo.Bar").getModule()); > com.foo.Bar.func(...); > (resp: new com.foo.Bar(....)) > > best regards, > > -- daniel From steve.drach at oracle.com Fri Jul 22 20:35:53 2016 From: steve.drach at oracle.com (Steve Drach) Date: Fri, 22 Jul 2016 13:35:53 -0700 Subject: RFR: 8158295 Add a multi-release jar validation mechanism to jar tool In-Reply-To: <1760798a-7931-76cf-9758-803d1cc608bd@oracle.com> References: <1760798a-7931-76cf-9758-803d1cc608bd@oracle.com> Message-ID: <93F8FF66-7014-4A76-8C75-E7307325B913@oracle.com> > I would also suggest to pass VM options to jar util in test/tools/jar/multiRelease/Basic.java: > > 540 commands.add(jar); > +541 commands.addAll(Utils.getForwardVmOptions()); Done. > > Also it seems that there is no need to compile classes using separate process: > > 526 String javac = JDKToolFinder.getJDKTool("javac"); > > It is possible to use jdk/test/lib/testlibrary/CompilerUtils.java instead. Yes, it does seem possible, and I?ll remember that in the future, but what I have works, so I think I?ll stick with it. > > Thanks, > Oleg > > 07.07.2016 23:32, Steve Drach ?????: >> Hi, >> >> Please review the following: >> >> webrev: http://cr.openjdk.java.net/~sdrach/8158295/webrev.01/ >> issue: https://bugs.openjdk.java.net/browse/JDK-8158295 >> >> This changeset adds a multi-release jar validator to jar tool. After the jar tool builds a multi-release jar, the potential resultant jar file is passed to the validator to assure that the jar file meets the minimal standards of a multi-release jar, in particular that versioned classes have the same api as base classes they override. There are other checks, for example warning if two classes are identical. If the jar file is invalid, it is not kept, so ?create will not produce a jar file and ?update will keep the input jar file. >> >> Thanks >> Steve > > From oleg.barbashov at oracle.com Fri Jul 22 20:54:26 2016 From: oleg.barbashov at oracle.com (Oleg G. Barbashov) Date: Fri, 22 Jul 2016 23:54:26 +0300 Subject: RFR: 8158295 Add a multi-release jar validation mechanism to jar tool In-Reply-To: <93F8FF66-7014-4A76-8C75-E7307325B913@oracle.com> References: <1760798a-7931-76cf-9758-803d1cc608bd@oracle.com> <93F8FF66-7014-4A76-8C75-E7307325B913@oracle.com> Message-ID: 22.07.2016 23:35, Steve Drach ?????: >> I would also suggest to pass VM options to jar util in test/tools/jar/multiRelease/Basic.java: >> >> 540 commands.add(jar); >> +541 commands.addAll(Utils.getForwardVmOptions()); > Done. > >> Also it seems that there is no need to compile classes using separate process: >> >> 526 String javac = JDKToolFinder.getJDKTool("javac"); >> >> It is possible to use jdk/test/lib/testlibrary/CompilerUtils.java instead. > Yes, it does seem possible, and I?ll remember that in the future, but what I have works, so I think I?ll stick with it. In this case it is also needed to pass the jtreg's javac options ("test.compiler.opts"). - Oleg > >> Thanks, >> Oleg >> >> 07.07.2016 23:32, Steve Drach ?????: >>> Hi, >>> >>> Please review the following: >>> >>> webrev: http://cr.openjdk.java.net/~sdrach/8158295/webrev.01/ >>> issue: https://bugs.openjdk.java.net/browse/JDK-8158295 >>> >>> This changeset adds a multi-release jar validator to jar tool. After the jar tool builds a multi-release jar, the potential resultant jar file is passed to the validator to assure that the jar file meets the minimal standards of a multi-release jar, in particular that versioned classes have the same api as base classes they override. There are other checks, for example warning if two classes are identical. If the jar file is invalid, it is not kept, so ?create will not produce a jar file and ?update will keep the input jar file. >>> >>> Thanks >>> Steve >> From Roger.Riggs at Oracle.com Fri Jul 22 20:55:55 2016 From: Roger.Riggs at Oracle.com (Roger Riggs) Date: Fri, 22 Jul 2016 16:55:55 -0400 Subject: RFR 9: JEP 290: Filter Incoming Serialization Data In-Reply-To: <10d8193d-a18b-51cd-681b-32ad41a431cf@gmail.com> References: <97bdccb1-3aca-a354-4eb6-4df1e79dac94@gmail.com> <7fd53029-5586-cbbe-4e5e-c074c14d6fa8@Oracle.com> <10d8193d-a18b-51cd-681b-32ad41a431cf@gmail.com> Message-ID: Hi Peter, A filter callback based on blockdata records would more frequently inform the filter of progress in the stream and the amount of data being consumed is already available from streamBytes. That could improve detection of excessive data without complicating the interface and it would not be all that useful to pass the size of individual block data records. And it only helps in the case of a class with exclusively primitive data and poor checks on the data stream. As far as I can see, it increases the number of filter callbacks quite a bit and adds little value. The current thresholds depth, number of refs, array size, and stream size can identify out of bounds conditions. I don't want argue that it can't happen but we're definitely down the slippery slope beyond what is needed if it tries to expose the shape of the graph or what bytes go where. Roger On 7/22/2016 3:00 AM, Peter Levart wrote: > Hi Roger, > > > On 07/21/2016 08:19 PM, Roger Riggs wrote: >>>>> - The call-back is invoked after the type of the object and >>>>> possible array length is read from stream but before the object's >>>>> state is read. Suppose that the object that is about to be read is >>>>> either Externalizable object or an object with a readObject() >>>>> method(s) that consume block data from the stream. This block data >>>>> can be large. Should there be a call-back to "announce" the block >>>>> data too? (for example, when the 'clazz' is null and the 'size' is >>>>> 0, the call-back reports a back-reference to a previously read >>>>> object, but when the 'clazz' is null and the 'size' > 0, it >>>>> announces the 'size' bytes of block data. Does this make sense?) >>>> Interesting case, I'll take another look at that. Since block data >>>> records are <= 1024, a filter might not >>>> have enough information to make an informed decision. Those bytes >>>> would show up in >>>> the stream bytes but not until the next object is read. >>> >>> ...which could be to late. If the filter is to be also used as a >>> defense against forged streams that try to provoke DOS by triggering >>> frequent GCs and OutOfMemoryError(s), then such call-back that >>> announces each block data record could help achieve that. >> Individual block data lengths are not very informative since block >> data can be segmented but >> a cumulative (for the whole stream) block data size suitable for a >> callback from the >> start of each block data segment might be useful. > > Is it possible to identify which block data records "belong" to a > particular object? If yes, then perhaps cumulative sum(s) of block > data sizes for a particular object could be passed to the call-back > together with the Class of the object the data belongs to (similar to > how array is reported, the size would be cumulative block data size > read so-far and the filter could distinguish such callback from array > callback by inspecting clazz.isArray()). In conjunction with > cumulative size of the whole stream which is already passed now, I > think this is enough to implement all kinds of safety-belts. > > If you think that such addition starts to become complex from > combinatorial standpoint then what about passing an additional enum > argument identifying a particular "event"? It would then be easy do > document the rest of parameters for each event type... > > Regards, Peter > From steve.drach at oracle.com Fri Jul 22 20:57:18 2016 From: steve.drach at oracle.com (Steve Drach) Date: Fri, 22 Jul 2016 13:57:18 -0700 Subject: RFR: 8158295 Add a multi-release jar validation mechanism to jar tool In-Reply-To: References: <1760798a-7931-76cf-9758-803d1cc608bd@oracle.com> <93F8FF66-7014-4A76-8C75-E7307325B913@oracle.com> Message-ID: <1647A5B8-CA69-4FDB-ADA1-510E2C6B54CE@oracle.com> >>> I would also suggest to pass VM options to jar util in test/tools/jar/multiRelease/Basic.java: >>> >>> 540 commands.add(jar); >>> +541 commands.addAll(Utils.getForwardVmOptions()); >> Done. >> >>> Also it seems that there is no need to compile classes using separate process: >>> >>> 526 String javac = JDKToolFinder.getJDKTool("javac"); >>> >>> It is possible to use jdk/test/lib/testlibrary/CompilerUtils.java instead. >> Yes, it does seem possible, and I?ll remember that in the future, but what I have works, so I think I?ll stick with it. > > In this case it is also needed to pass the jtreg's javac options ("test.compiler.opts?). OK > > - Oleg >> >>> Thanks, >>> Oleg >>> >>> 07.07.2016 23:32, Steve Drach ?????: >>>> Hi, >>>> >>>> Please review the following: >>>> >>>> webrev: http://cr.openjdk.java.net/~sdrach/8158295/webrev.01/ >>>> issue: https://bugs.openjdk.java.net/browse/JDK-8158295 >>>> >>>> This changeset adds a multi-release jar validator to jar tool. After the jar tool builds a multi-release jar, the potential resultant jar file is passed to the validator to assure that the jar file meets the minimal standards of a multi-release jar, in particular that versioned classes have the same api as base classes they override. There are other checks, for example warning if two classes are identical. If the jar file is invalid, it is not kept, so ?create will not produce a jar file and ?update will keep the input jar file. >>>> >>>> Thanks >>>> Steve >>> > From xueming.shen at oracle.com Fri Jul 22 21:26:55 2016 From: xueming.shen at oracle.com (Xueming Shen) Date: Fri, 22 Jul 2016 14:26:55 -0700 Subject: RFR JDK-8161942: java.util.zip.ZipEntry.java not covering UpperLimit range of DOS epoch Message-ID: <57928F9F.8070702@oracle.com> Hi, Please help review the change for JDK-8161942 issue: https://bugs.openjdk.java.net/browse/JDK-8161942 webrev: http://cr.openjdk.java.net/~sherman/8161942/webrev The current ZipInputStream/ZipEntry implementation stores the "date-time" into the ZIP file/entry's extended timestamp fields in extra data, when the date-time is out of the MS-DOS range (1980 - 2107.xxx), by using the info-zip's extended timestamp, which by specification is in "unix 32-bit timestamp", which unfortunately has the 2038 problem (the seconds overflow after 2038-...). So when the date-time set for ZipEntry.setTimeLocal() is later than the dos-date-time's upper bound 2107, it also too big for the info-zip's extended timestamp. One approach to solve this problem is simply to update the spec to say if the date-time is too big for the MS-DOS date-time range, the behavior is undefined, given it will take a while for any zip file to have such a timestamp in any real world use scenario :-) But since the other newly added (1.8) set|getLastModified|LastAccess|CreationTime methods are also suffering the same problem when the date-time set is later than 2038, it appears it might be worth putting in an implementation that at least works for such timestamp. The proposed change here is to use the MS NTFS time format to store such timestamps when the unix-32-bit-timestamp is too small to store them. MS NTFS time format is one of the formats supported by our implementation (also supported by zip/unzip command) when reading the zip entry, the only disadvantage is it's a little bigger, take total 36 bytes for three timestamps. But given the fact that we should not see such timestamps for at least another 20 years, I would not be worried about the size difference, for now. Thanks, Sherman From claes.redestad at oracle.com Fri Jul 22 21:47:41 2016 From: claes.redestad at oracle.com (Claes Redestad) Date: Fri, 22 Jul 2016 23:47:41 +0200 Subject: RFR JDK-8161942: java.util.zip.ZipEntry.java not covering UpperLimit range of DOS epoch In-Reply-To: <57928F9F.8070702@oracle.com> References: <57928F9F.8070702@oracle.com> Message-ID: <5792947D.4060506@oracle.com> Looks good to me. Good to know we'll be all set for 2038 now! ;-) /Claes On 07/22/2016 11:26 PM, Xueming Shen wrote: > Hi, > > Please help review the change for JDK-8161942 > > issue: https://bugs.openjdk.java.net/browse/JDK-8161942 > webrev: http://cr.openjdk.java.net/~sherman/8161942/webrev > > > The current ZipInputStream/ZipEntry implementation stores the "date-time" > into the ZIP file/entry's extended timestamp fields in extra data, > when the > date-time is out of the MS-DOS range (1980 - 2107.xxx), by using the > info-zip's extended timestamp, which by specification is in "unix 32-bit > timestamp", which unfortunately has the 2038 problem (the seconds > overflow > after 2038-...). So when the date-time set for ZipEntry.setTimeLocal() is > later than the dos-date-time's upper bound 2107, it also too big for the > info-zip's extended timestamp. > > One approach to solve this problem is simply to update the spec to say > if the date-time is too big for the MS-DOS date-time range, the > behavior is > undefined, given it will take a while for any zip file to have such a > timestamp > in any real world use scenario :-) But since the other newly added (1.8) > set|getLastModified|LastAccess|CreationTime methods are also suffering > the same problem when the date-time set is later than 2038, it appears > it might be worth putting in an implementation that at least works for > such timestamp. The proposed change here is to use the MS NTFS time > format to store such timestamps when the unix-32-bit-timestamp is > too small to store them. MS NTFS time format is one of the formats > supported by our implementation (also supported by zip/unzip command) > when reading the zip entry, the only disadvantage is it's a little > bigger, > take total 36 bytes for three timestamps. But given the fact that we > should > not see such timestamps for at least another 20 years, I would not be > worried > about the size difference, for now. > > Thanks, > Sherman > > > From martinrb at google.com Sat Jul 23 01:11:25 2016 From: martinrb at google.com (Martin Buchholz) Date: Fri, 22 Jul 2016 18:11:25 -0700 Subject: RFR: JDK-8044629: (reflect) Constructor.getAnnotatedReceiverType() returns wrong value In-Reply-To: References: <1B51A5CD-A909-42C4-97D1-1F8F5DFE55D2@oracle.com> <9E339B30-A01D-4427-A2D1-A0E96E5A978C@oracle.com> <20140813085406.GD22209@oracle.com> Message-ID: Bug 8029042: Receiver parameter not supported on local class constructor also suggests that a local class of an instance method "is a perfectly good inner class" and so getAnnotatedReceiverType should treat them equivalently. On Thu, Jul 21, 2016 at 11:50 AM, Joel Borggr?n-Franck < joel.borggren.franck at gmail.com> wrote: > This is the first time I noticed the second paragraph of $14.3, strange > indeed! I'd ping compiler-dev with this, Alex will probably know if this is > a spec bug in $14.3 or just an irregularity. > > Cheers > /Joel > > On Jul 21, 2016 20:39, "Martin Buchholz" wrote: > >> Joel, Thanks for responding so quickly! >> >> Here' s a slightly modified version of my repro recipe: >> You can see that local classes in instance methods have a receiver type, >> just like a member inner class. >> local classes in static methods (naturally!) do not. I expect the two >> flavors of local classes to be treated differently. >> >> I've never understood why >> """All local classes are inner classes""" >> (even in a static method?) >> https://docs.oracle.com/javase/specs/jls/se8/html/jls-14.html#jls-14.3 >> >> >> import java.lang.reflect.Constructor; >> >> public class LocalClassReceiverTypeBug { >> public static void main(String[] args) throws Throwable { >> class StaticLocal {} >> printConstructor(StaticLocal.class); >> new LocalClassReceiverTypeBug().instanceMain(); >> } >> >> public void instanceMain() throws Throwable { >> class InstanceLocal {} >> printConstructor(InstanceLocal.class); >> printConstructor(Inner.class); >> // printConstructor(Nested.class); >> } >> >> static class Nested {} >> class Inner {} >> >> static void printConstructor(Class klazz) { >> Constructor[] constructors = klazz.getDeclaredConstructors(); >> if (constructors.length != 1) throw new AssertionError(); >> Constructor constructor = constructors[0]; >> System.out.printf("constructor=%s receivertype=%s%n", >> constructor, >> constructor.getAnnotatedReceiverType()); >> } >> } >> ==> javac -source 9 -Xlint:all LocalClassReceiverTypeBug.java >> ==> java -esa -ea LocalClassReceiverTypeBug >> constructor=LocalClassReceiverTypeBug$1StaticLocal() receivertype=null >> constructor=LocalClassReceiverTypeBug$1InstanceLocal(LocalClassReceiverTypeBug) >> receivertype=null >> constructor=LocalClassReceiverTypeBug$Inner(LocalClassReceiverTypeBug) >> receivertype=sun.reflect.annotation.AnnotatedTypeFactory$AnnotatedTypeBaseImpl at 1810399e >> >> >> On Thu, Jul 21, 2016 at 11:16 AM, Joel Borggr?n-Franck < >> joel.borggren.franck at gmail.com> wrote: >> >>> Hi Martin, >>> >>> I'm away from my workstation at the moment, so this is from memory. IIRC >>> a local class is pure scoping and lacks an "outer this" which is what you >>> annotate for constructors. There should not be receiver type to annotate. >>> Since I can't run your code I can't see what's wrong but I might be able to >>> help if you paste the output from a run. >>> >>> Cheers >>> /Joel >>> >>> On Jul 21, 2016 19:49, "Martin Buchholz" wrote: >>> >>>> Hi Joel, Paul, >>>> >>>> A coworker ran into the change of behavior here in jdk9. Specifically, >>>> we noticed that a local class constructor has a receiver parameter, >>>> but getAnnotatedReceiverType returns null. The changed jdk9 spec is >>>> actually very clear about that: >>>> >>>> >>>> http://download.java.net/java/jdk9/docs/api/java/lang/reflect/Constructor.html#getAnnotatedReceiverType-- >>>> """If this Executable object represents a static method or represents a >>>> constructor of a top level, static member, local, or anonymous class, then >>>> the return value is null.""" >>>> >>>> BUT we can't think of any reason WHY a local inner class would be >>>> treated differently from an inner member class. Why not the simple and >>>> obvious rule: if there is a receiver parameter, return an appropriate >>>> non-null AnnotatedType? >>>> >>>> You already have an excellent jtreg test, but here's what I was playing >>>> with: >>>> >>>> import java.lang.reflect.Constructor; >>>> >>>> public class LocalClassReceiverTypeBug { >>>> public static void main(String[] args) throws Throwable { >>>> class StaticLocal {} >>>> printConstructor(StaticLocal.class); >>>> new LocalClassReceiverTypeBug().instanceMain(); >>>> } >>>> >>>> public void instanceMain() throws Throwable { >>>> class InstanceLocal {} >>>> printConstructor(InstanceLocal.class); >>>> printConstructor(Inner.class); >>>> printConstructor(Nested.class); >>>> } >>>> >>>> static class Nested {} >>>> class Inner {} >>>> >>>> static void printConstructor(Class klazz) { >>>> Constructor[] constructors = klazz.getDeclaredConstructors(); >>>> if (constructors.length != 1) throw new AssertionError(); >>>> System.out.printf("constructor=%s%n", constructors[0]); >>>> System.out.printf("receiver type=%s%n", >>>> constructors[0].getAnnotatedReceiverType()); >>>> } >>>> } >>>> >>>> >>>> >>>> On Wed, Aug 13, 2014 at 1:54 AM, Joel Borggren-Franck < >>>> joel.franck at oracle.com> wrote: >>>> >>>>> Hi Paul, >>>>> >>>>> On 2014-06-24, Paul Sandoz wrote: >>>>> > >>>>> > On Jun 17, 2014, at 6:52 PM, Joel Borggr?n-Franck < >>>>> joel.franck at oracle.com> wrote: >>>>> > > >>>>> > > Can I get a review for this fix and javadoc clarification for >>>>> https://bugs.openjdk.java.net/browse/JDK-8044629 >>>>> > > >>>>> > >>>>> > +1 >>>>> > >>>>> > I never quite realised just how convoluted it was to determine that >>>>> a class is an inner class. >>>>> >>>>> Neither did I until I had to implement it :) >>>>> >>>>> cheers >>>>> /Joel >>>>> >>>> >>>> >> From Alan.Bateman at oracle.com Sat Jul 23 06:57:52 2016 From: Alan.Bateman at oracle.com (Alan Bateman) Date: Sat, 23 Jul 2016 07:57:52 +0100 Subject: [JAXP] RFR: 8153082: Update XSTL compiler to generate classes that invoke addReads In-Reply-To: <74b953e2-f07e-afa8-80d0-f55014780f94@oracle.com> References: <74b953e2-f07e-afa8-80d0-f55014780f94@oracle.com> Message-ID: <5b5e0f45-3a86-4ac7-a1c0-23d2eb5a4a73@oracle.com> On 22/07/2016 17:16, Daniel Fuchs wrote: > Hi, > > Please find below a fix for > 8153082: Update XSTL compiler to generate classes that invoke addReads > https://bugs.openjdk.java.net/browse/JDK-8153082 > > This fix removes a dependency from java.xml to an internal > java base API. This looks good. The only thing that looks a bit strange is changing the class file version during generation. It there any reason not to bump the default? Separately, we should cache the Configuration as each translet has the same but that is a separate issue of course. -Alan From claes.redestad at oracle.com Sat Jul 23 16:23:31 2016 From: claes.redestad at oracle.com (Claes Redestad) Date: Sat, 23 Jul 2016 18:23:31 +0200 Subject: RFR: 8162439: Runtime.Version.parse needs fast-path for major versions Message-ID: <57939A03.7080104@oracle.com> Hi, please review this patch to address a startup regression due to use of Runtime.Version.parse("8") etc in JarFile, as introduced by JDK-8150680. This solution introduce a fast-path in case of what appears to be a single number is sent to Runtime.Version.parse to avoid initializing Runtime.VersionBuilder: Webrev: http://cr.openjdk.java.net/~redestad/8162439/webrev.01/ Bug: https://bugs.openjdk.java.net/browse/JDK-8162439 Passes all existing tests. Thanks! /Claes From huizhe.wang at oracle.com Sun Jul 24 04:04:29 2016 From: huizhe.wang at oracle.com (huizhe wang) Date: Sat, 23 Jul 2016 21:04:29 -0700 Subject: [JAXP] RFR: 8153082: Update XSTL compiler to generate classes that invoke addReads In-Reply-To: <5b5e0f45-3a86-4ac7-a1c0-23d2eb5a4a73@oracle.com> References: <74b953e2-f07e-afa8-80d0-f55014780f94@oracle.com> <5b5e0f45-3a86-4ac7-a1c0-23d2eb5a4a73@oracle.com> Message-ID: <0039181c-ce23-ed17-ffd1-c5e492f726ad@oracle.com> On 7/22/2016 11:57 PM, Alan Bateman wrote: > On 22/07/2016 17:16, Daniel Fuchs wrote: > >> Hi, >> >> Please find below a fix for >> 8153082: Update XSTL compiler to generate classes that invoke addReads >> https://bugs.openjdk.java.net/browse/JDK-8153082 >> >> This fix removes a dependency from java.xml to an internal >> java base API. > This looks good. The only thing that looks a bit strange is changing > the class file version during generation. It there any reason not to > bump the default? Separately, we should cache the Configuration as > each translet has the same but that is a separate issue of course. +1, and +1 for bumping up the default to MAJOR_1_5/MINOR_1_5. The next then, is that we'll need to consider upgrading BCEL. -Joe > > -Alan From andrey.dyachkov at gmail.com Sun Jul 24 11:42:15 2016 From: andrey.dyachkov at gmail.com (Andrey Dyachkov) Date: Sun, 24 Jul 2016 11:42:15 +0000 Subject: [PATCH] JDK-8155102: Process.toString could include pid, isAlive, exitStatus In-Reply-To: <9066d1a2-4a7d-bff4-60d8-d62ff559272d@Oracle.com> References: <9066d1a2-4a7d-bff4-60d8-d62ff559272d@Oracle.com> Message-ID: Hi Roger, Thank you for reviewing it! I've prepared another version. diff --git a/src/java.base/unix/classes/java/lang/ProcessImpl.java b/src/java.base/unix/classes/java/lang/ProcessImpl.java --- a/src/java.base/unix/classes/java/lang/ProcessImpl.java +++ b/src/java.base/unix/classes/java/lang/ProcessImpl.java @@ -630,6 +630,21 @@ return !hasExited; } + /** + * The {@code toString} method for class {@code ProcessImpl} + * returns a string consisting of the native process ID of the process, + * exit code of the process and the status of the process. + * + * @return a string representation of the object. + */ + @Override + public String toString() { + return new StringBuilder("ProcessImpl{pid=").append(pid) + .append(", exitcode=").append(exitcode) + .append(", hasExited=").append(hasExited) + .append("}").toString(); + } + private static native void init(); static { On Mon, 9 May 2016 at 16:50 Roger Riggs wrote: > Hi Andrey, > > Since toString is a public method it needs to provide complete javadoc > specification > as providing values for debugging information. ToString methods > typically directly > reflect the state of the fields of the object. > > Why should the exitValue have the value of the pid if the process is not > alive? > > Also, the if toString is providing the exitValue then it should be > identified as "exitValue", not exitCode. > the isAlive value should be identified as "isAlive". > The implementation class should not be exposed. (remove > this.getClass().getSimpleName()). > > The performance of what seems like a simple toString method is not going > to be great > because of the native calls necessary to determine if the process is > alive (called twice) > and in the case of exitValue to handle the IllegalStateException. > > Some of the overhead could be avoided, by implementing toString in each > of the ProcessImpl.java > files where the current state is known more conveniently with less > overhead. > > $.02, Roger > > > On 5/8/2016 2:47 PM, Andrey Dyachkov wrote: > > Hello, > > > > I have added toString() method in Process.java. > > > > diff --git a/src/java.base/share/classes/java/lang/Process.java > > b/src/java.base/share/classes/java/lang/Process.java > > --- a/src/java.base/share/classes/java/lang/Process.java > > +++ b/src/java.base/share/classes/java/lang/Process.java > > @@ -548,5 +548,16 @@ > > return toHandle().descendants(); > > } > > > > + @Override > > + public String toString() { > > + boolean isAlive = this.isAlive(); > > + return new > > StringBuilder(this.getClass().getSimpleName()).append("[") > > + .append("running=").append(isAlive).append(", ") > > + .append(isAlive ? "pid=" : "exitCode=") > > + .append(isAlive ? this.getPid() : > this.exitValue()) > > + .append("]") > > + .toString(); > > + } > > + > > > > } > > -- With great enthusiasm, Andrey From huizhe.wang at oracle.com Mon Jul 25 01:52:25 2016 From: huizhe.wang at oracle.com (huizhe wang) Date: Sun, 24 Jul 2016 18:52:25 -0700 Subject: [8u-dev] RFR (JAXP) 8028363: XmlGregorianCalendarImpl.getTimeZone() bug when offset is less than 10 minutes In-Reply-To: <29630e4c-0d7b-60b5-e1ca-00b6b06fa02f@oracle.com> References: <578E554D.5090502@oracle.com> <5790BC77.6060702@oracle.com> <29630e4c-0d7b-60b5-e1ca-00b6b06fa02f@oracle.com> Message-ID: <6d00767a-f296-8be9-816a-172a38655cd4@oracle.com> +1. -Joe On 7/21/2016 10:40 AM, Se?n Coffey wrote: > Looks fine to me also Svetlana. > > Regards, > Sean. > > On 21/07/2016 13:13, Svetlana Nikandrova wrote: >> Little reminder. >> >> On 19.07.2016 19:29, Svetlana Nikandrova wrote: >>> Hello, >>> >>> please review this fix for 8u-dev. For jdk9 problem has been >>> addressed in JEP 255 >>> (Xerces update). >>> Please note that changeset contains of 2 parts: >>> XMLGregorianCalendarImpl fix in jaxp ws: >>> http://cr.openjdk.java.net/~snikandrova/8028363/jaxp/webrev.00/ >>> >>> Regression test in jdk ws: >>> http://cr.openjdk.java.net/~snikandrova/8028363/jdk/webrev.00/ >>> >>> >>> JBS: >>> https://bugs.openjdk.java.net/browse/JDK-8028363 >>> >>> Description: >>> While concatenating timezone representations string for >>> TimeZone.getTimeZone() XmlGregorianCalendarImpl missed prior "0" in >>> minutes part if minutes value is less then 10 (like "0" in 11:05). >>> >>> Thank you, >>> Svetlana >>> >> > From huizhe.wang at oracle.com Mon Jul 25 04:44:43 2016 From: huizhe.wang at oracle.com (huizhe wang) Date: Sun, 24 Jul 2016 21:44:43 -0700 Subject: RFR (JAXP) 8158084: Catalog API: JAXP XML Processor Support Message-ID: Hi, This is an enhancement to support the Catalog API (javax.xml.catalog) throughout the JAXP processors. All of the CatalogFeatures are supported by the JAXP factories and processors (e.g. SAXParser), and corresponding System properties as specified in the CatalogFeatures. An additional javax.xml property "USE_CATALOG" is added to allow switching on/off the Catalog support for a processor or all of them (through the System properties or jaxp.properties). The USE_CATALOG feature is on by default for all processors. The only thing needed then, to resolve external references with a catalog, is setting the path to the catalog on the processor. While the USE_CATALOG is on by default, the Catalog support is noninterference. As long as no catalog is set, the Catalog is mute. Catalog, even if one exists, will not interfere with custom resolvers, it is simply ignored if a custom resolver is present. specdiff: http://cr.openjdk.java.net/~joehw/jdk9/8158084/specdiff/overview-summary.html webrev: http://cr.openjdk.java.net/~joehw/jdk9/8158084/webrev/ Tests: 140ish new test cases; all existing SQE/unit tests pass. JCK has a large number of failures due to one Catalog API test that left a configuration file behind. I'll discuss that with the JCK team. Thanks, Joe From huizhe.wang at oracle.com Mon Jul 25 06:20:57 2016 From: huizhe.wang at oracle.com (huizhe wang) Date: Sun, 24 Jul 2016 23:20:57 -0700 Subject: RFR (JAXP) JDK-8067170: Enable security manager on JAXP unit tests In-Reply-To: <88977a21-e4d1-e792-00db-1debc3162b08@oracle.com> References: <022401d1e0d7$54111090$fc3331b0$@oracle.com> <578CA476.7030407@oracle.com> <03a601d1e3e6$92c45a60$b84d0f20$@oracle.com> <040101d1e3f9$9d19a340$d74ce9c0$@oracle.com> <88977a21-e4d1-e792-00db-1debc3162b08@oracle.com> Message-ID: On 7/22/2016 5:53 AM, Daniel Fuchs wrote: > On 22/07/16 10:15, Frank Yuan wrote: >> Hi Daniel >> >> Thank you very much for your review and the comments! >> >>> -----Original Message----- >>> From: Daniel Fuchs [mailto:daniel.fuchs at oracle.com] >>> Subject: Re: RFR (JAXP) JDK-8067170: Enable security manager on JAXP >>> unit tests >>> >>> Hi Frank, >>> >>> I see that in order to be able to run the tests, you were forced >>> to add a few permissions that the test/test infrastructure need >>> to setup things: >>> >>> 107 addPermission(new SecurityPermission("getPolicy")); >>> 108 addPermission(new SecurityPermission("setPolicy")); >>> 109 addPermission(new RuntimePermission("getClassLoader")); >>> 110 addPermission(new >>> RuntimePermission("createClassLoader")); >>> 111 addPermission(new >>> RuntimePermission("setSecurityManager")); >>> 112 addPermission(new >>> RuntimePermission("createSecurityManager")); >>> 113 addPermission(new RuntimePermission("modifyThread")); >>> 114 addPermission(new PropertyPermission("*", "read, >>> write")); >>> 115 addPermission(new >>> ReflectPermission("suppressAccessChecks")); >>> 116 addPermission(new RuntimePermission("setIO")); >>> 117 addPermission(new >>> RuntimePermission("setContextClassLoader")); >>> 118 addPermission(new >>> RuntimePermission("accessDeclaredMembers")); >>> >>> These are quite powerful permissions, and adding them by default >>> also means that you might miss a bug - if e.g. a doPrivileged is >>> missing somewhere in the JAXP code when jaxp tries to e.g. get/create >>> a classloader, or read a system property, you might not see >>> it. Very true. Some of these permissions came from our standalone JAXP tests that were granted to ant and junit. >> Yes, I agree completely. I would control the permission assignment >> more tightly: >> 1. only allow the following necessary permissions in default: >> addPermission(new SecurityPermission("getPolicy")); >> addPermission(new SecurityPermission("setPolicy")); >> addPermission(new RuntimePermission("setSecurityManager")); These are safe for the current code base. So may be add a note to remind for any future changes. >> 2. other permissions in current default set are commonly used for the >> tests, so I would add more Policy classes like existing >> FilePolicy, etc. >> //ClassLoaderPolicy, an individual test may only require some of >> them, but I would put them in only one class if you agree >> addPermission(new RuntimePermission("getClassLoader")); >> addPermission(new RuntimePermission("createClassLoader")); >> addPermission(new RuntimePermission("setContextClassLoader")); >> >> // PropertyPolicy, there are various properties needed by the >> tests, I would not classify them further... >> addPermission(new PropertyPermission("*", "read, write")); >> >> //Reflection permissions, jtreg may require them in deed, so I may >> add them in default set >> addPermission(new ReflectPermission("suppressAccessChecks")); >> addPermission(new RuntimePermission("accessDeclaredMembers")); >> >> //other permissions are used in less tests, I may use >> tryRunWithTmpPermission instead of Policy class >> addPermission(new RuntimePermission("setIO")); >> addPermission(new RuntimePermission("createSecurityManager")); >> addPermission(new RuntimePermission("modifyThread")); >> >> How about you think? My understanding is that you intend to grand specific permissions limited to the test that will extend these policies, e.g. FilePolicy. I think this is ok and an improvement. > > It would definitely improve things - but then all the classes > in the test that runs with this new policy class will inherit > from these permissions as well. This may or may not be an issue. > (I confess I haven't looked at all the webrev ;-() Yeah, it would be good to make sure a policy is safe with the code. If both the test code and the code may need a permission, we may have a conflict that we need to solve. It may be good to start with the basic permission, and add only if required by the test code, with a note preferably noting what exactly is needed. "DefaultFeaturesTest" in this regard, doesn't seem to require FilePolicy, but CatalogReferCircularityTest requires permission to where the source files are located, in this case, it would be good to make it specific. For example, instead of being called "FilePolicy", it may be clearer to add a parameter so that it's known where the File permission is given (e.g. the source dir in this case). Best, Joe > > >>> I had a similar issue when writing logging test, were I wanted >>> to temporarily disable permission checking in the middle of a test >>> to perform an infrastructure configuration. >>> >>> So what I did is use an ThreadLocal to temporarily >>> disable permission checking - which allows me in my tests to do things >>> like: >>> >>> boolean before = allowAll.get().get(); >>> allowAll.get().set(true); >>> try { >>> do something that requires a permission >>> } finally { >>> allowAll.get().set(before); >>> } >>> >> JAXPTestUtilities.tryRunWithTmpPermission is similar with this, see >> the example: >> http://cr.openjdk.java.net/~fyuan/8067170/webrev.01/test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug6555001.java.sdiff.htm >> >> l > > Yes that part looks fine. > > cheers, > > -- daniel > >>> My implementation of Policy::implies also checks for >>> >>> if (allowAll.get().get()) return true; >>> >>> This allows me to control more tightly the set of permissions >>> I want my test to run under, while still being able to >>> perform any action I want to set up things without having >>> to give the same permission to all. >>> >>> Hope this helps, >>> >>> -- daniel >>> >>> >>> >>> On 22/07/16 07:59, Frank Yuan wrote: >>>> According to Amy's suggestion, re-generate a webrev >>>> http://cr.openjdk.java.net/~fyuan/8067170/webrev.01/ as well as fix >>>> some >> issues, >>>> please check. >>>> >>>> Thanks >>>> Frank >>>> >>>>> -----Original Message----- >>>>> From: Amy Lu [mailto:amy.lu at oracle.com] >>>>> Sent: Monday, July 18, 2016 5:42 PM >>>>> To: Frank Yuan; 'core-libs-dev' >>>>> Subject: Re: RFR (JAXP) JDK-8067170: Enable security manager on >>>>> JAXP unit tests >>>>> >>>>> On 7/18/16 5:32 PM, Frank Yuan wrote: >>>>>> Btw, I moved internaltest into unittest because it's unnecessary >>>>>> to separate them. >>>>> >>>>> Maybe you'd like to regenerate the webrev with hg move for those >>>>> files? >>>>> >>>>> Thanks, >>>>> Amy >>>> >>>> >> >> > From nadeesh.tv at oracle.com Mon Jul 25 06:37:12 2016 From: nadeesh.tv at oracle.com (nadeesh tv) Date: Mon, 25 Jul 2016 12:07:12 +0530 Subject: RFR:JDK-8066806:java.time.format.DateTimeFormatter cannot parse an offset with single digit hour In-Reply-To: References: <5746AA87.3040501@oracle.com> <5757C25E.9040605@oracle.com> <79e6445f-d482-bd32-5123-c364a5d086eb@Oracle.com> <57593666.2060202@oracle.com> <57594C1E.3080501@oracle.com> <575AA1AB.2080200@oracle.com> <5790B01E.30304@oracle.com> <5791E975.8080105@oracle.com> Message-ID: <5795B398.4000401@oracle.com> Hi Stephen, Thanks for the comments. Please see the updated webrev http://cr.openjdk.java.net/~ntv/8066806/webrev.11/ Changes: Included the suggestions of Stephen Thanks and regards, Nadeesh On 7/22/2016 3:38 PM, Stephen Colebourne wrote: > These tests are expected to throw exceptions: > > test_strict_appendOffsetId() > test_strict_appendOffset_1() > test_strict_appendOffset_2() > test_strict_appendOffset_3() > test_strict_appendOffset_4() > > As such, they should not contain assertEquals(). They should only > contain the code that is expected to throw (thus they should not have > .get(OFFSET_SECONDS) either). > > test_strict_offset_adjacentInvalidPattern_parse > test_lenient_offset_adjacentInvalidPattern_parse > > should not have .get(OFFSET_SECONDS) > > Indentation on line 1621/1622 > > thanks > Stephen > > > On 22 July 2016 at 10:37, nadeesh tv wrote: >> Hi Roger, >> >> Thanks for the comments and sorry for the incorrect link. >> >> Please see the updated webrev which includes your suggestions. >> >> http://cr.openjdk.java.net/~ntv/8066806/webrev.10/ >> >> -- >> Thanks and Regards, >> Nadeesh TV >> >> >> On 7/21/2016 6:59 PM, Roger Riggs wrote: >> >> Hi Nadeesh, >> >> Found the changes in http://cr.openjdk.java.net/~ntv/8066806/webrev.09/ >> >> Editorial: >> " >> >> In the lenient mode, the parser will be greedy and parse the maximum digits >> possible." >> >> TCKDateTimeFormatterBuilder.java: >> >> The lines 1473, 1479, 1485, etc. are way too long, perhaps wrap/break them >> so each line starts with "." >> >> And wrap any other line longer than 100 chars. (Side by side diffs are >> annoying if the lines are too long). >> >> Otherwise, looks good, >> >> Thanks, Roger >> >> >> On 7/21/2016 7:21 AM, nadeesh tv wrote: >> >> Hi, >> >> Please see the updated webrev >> >> http://cr.openjdk.java.net/~ntv/8066806/webrev.08/ >> >> Changes in this webrev: >> For leninent mode , doc change in DateTimeFormatterBuilder.java >> " >> >> In the lenient mode, parser will be greedy and parse maximum digits >> possible. >> " >> >> Added new test cases for lenient mode. >> >> >> >> -- >> Thanks and Regards, >> Nadeesh TV >> -- Thanks and Regards, Nadeesh TV From frank.yuan at oracle.com Mon Jul 25 09:46:52 2016 From: frank.yuan at oracle.com (Frank Yuan) Date: Mon, 25 Jul 2016 17:46:52 +0800 Subject: RFR (JAXP) JDK-8067170: Enable security manager on JAXP unit tests In-Reply-To: References: <022401d1e0d7$54111090$fc3331b0$@oracle.com> <578CA476.7030407@oracle.com> <03a601d1e3e6$92c45a60$b84d0f20$@oracle.com> <040101d1e3f9$9d19a340$d74ce9c0$@oracle.com> <88977a21-e4d1-e792-00db-1debc3162b08@oracle.com> Message-ID: <024a01d1e659$7dcefcd0$796cf670$@oracle.com> > -----Original Message----- > From: huizhe wang [mailto:huizhe.wang at oracle.com] > Subject: Re: RFR (JAXP) JDK-8067170: Enable security manager on JAXP unit tests > > > > On 7/22/2016 5:53 AM, Daniel Fuchs wrote: > > On 22/07/16 10:15, Frank Yuan wrote: > >> Hi Daniel > >> > >> Thank you very much for your review and the comments! > >> > >>> -----Original Message----- > >>> From: Daniel Fuchs [mailto:daniel.fuchs at oracle.com] > >>> Subject: Re: RFR (JAXP) JDK-8067170: Enable security manager on JAXP > >>> unit tests > >>> > >>> Hi Frank, > >>> > >>> I see that in order to be able to run the tests, you were forced > >>> to add a few permissions that the test/test infrastructure need > >>> to setup things: > >>> > >>> > >>> These are quite powerful permissions, and adding them by default > >>> also means that you might miss a bug - if e.g. a doPrivileged is > >>> missing somewhere in the JAXP code when jaxp tries to e.g. get/create > >>> a classloader, or read a system property, you might not see > >>> it. > > Very true. Some of these permissions came from our standalone JAXP tests > that were granted to ant and junit. > > >> Yes, I agree completely. I would control the permission assignment > >> more tightly: > >> 1. only allow the following necessary permissions in default: > >> addPermission(new SecurityPermission("getPolicy")); > >> addPermission(new SecurityPermission("setPolicy")); > >> addPermission(new RuntimePermission("setSecurityManager")); > > These are safe for the current code base. So may be add a note to remind > for any future changes. > > >> 2. other permissions in current default set are commonly used for the > >> tests, so I would add more Policy classes like existing > >> FilePolicy, etc. > >> //ClassLoaderPolicy, an individual test may only require some of > >> them, but I would put them in only one class if you agree > >> addPermission(new RuntimePermission("getClassLoader")); > >> addPermission(new RuntimePermission("createClassLoader")); > >> addPermission(new RuntimePermission("modifyThread")); > >> > >> How about you think? > > My understanding is that you intend to grand specific permissions > limited to the test that will extend these policies, e.g. FilePolicy. I > think this is ok and an improvement. > > > > > It would definitely improve things - but then all the classes > > in the test that runs with this new policy class will inherit > > from these permissions as well. This may or may not be an issue. > > (I confess I haven't looked at all the webrev ;-() > I will reduce the scope of the extra permissions as possible, and make sure the safety, e.g. surround the user code(i.e. the test code) which requires a permission explicitly with corresponding permission assignment > Yeah, it would be good to make sure a policy is safe with the code. If > both the test code and the code may need a permission, we may have a > conflict that we need to solve. It may be good to start with the basic > permission, and add only if required by the test code, with a note > preferably noting what exactly is needed. "DefaultFeaturesTest" in this > regard, doesn't seem to require FilePolicy, but > CatalogReferCircularityTest requires permission to where the source > files are located, in this case, it would be good to make it specific. > For example, instead of being called "FilePolicy", it may be clearer to > add a parameter so that it's known where the File permission is given > (e.g. the source dir in this case). Currently FilePolicy(maybe it's better to rename to TestFilePolicy) has full access permission to user.dir and read permission to test.src, I think they belong to user permission, jaxp lib won't doPrivileged on this. Btw, it's unable to add parameter in @Listeners({ xxx.class }) unless using more tricky and complex means. I believe I will meet problem to identify if a doPrivileged is missing when I strip the extra permissions and then solve the test failures case by case, so I would ask you when should we add doPrivileged in jaxp/jdk library code? 1. Should doPrivileged only for where the permission can't be granted to the user code, e.g. read some secret system property 2. Or should doPrivileged for where the permission needn't be granted to the user code, e.g. read some internal property Frank > > Best, > Joe > > > From scolebourne at joda.org Mon Jul 25 11:43:46 2016 From: scolebourne at joda.org (Stephen Colebourne) Date: Mon, 25 Jul 2016 12:43:46 +0100 Subject: RFR:JDK-8066806:java.time.format.DateTimeFormatter cannot parse an offset with single digit hour In-Reply-To: <5795B398.4000401@oracle.com> References: <5746AA87.3040501@oracle.com> <5757C25E.9040605@oracle.com> <79e6445f-d482-bd32-5123-c364a5d086eb@Oracle.com> <57593666.2060202@oracle.com> <57594C1E.3080501@oracle.com> <575AA1AB.2080200@oracle.com> <5790B01E.30304@oracle.com> <5791E975.8080105@oracle.com> <5795B398.4000401@oracle.com> Message-ID: I don't have any more comments, +1 Stephen On 25 July 2016 at 07:37, nadeesh tv wrote: > Hi Stephen, > > Thanks for the comments. > Please see the updated webrev > http://cr.openjdk.java.net/~ntv/8066806/webrev.11/ > > Changes: Included the suggestions of Stephen > > Thanks and regards, > Nadeesh > > > > On 7/22/2016 3:38 PM, Stephen Colebourne wrote: >> >> These tests are expected to throw exceptions: >> >> test_strict_appendOffsetId() >> test_strict_appendOffset_1() >> test_strict_appendOffset_2() >> test_strict_appendOffset_3() >> test_strict_appendOffset_4() >> >> As such, they should not contain assertEquals(). They should only >> contain the code that is expected to throw (thus they should not have >> .get(OFFSET_SECONDS) either). >> >> test_strict_offset_adjacentInvalidPattern_parse >> test_lenient_offset_adjacentInvalidPattern_parse >> >> should not have .get(OFFSET_SECONDS) >> >> Indentation on line 1621/1622 >> >> thanks >> Stephen >> >> >> On 22 July 2016 at 10:37, nadeesh tv wrote: >>> >>> Hi Roger, >>> >>> Thanks for the comments and sorry for the incorrect link. >>> >>> Please see the updated webrev which includes your suggestions. >>> >>> http://cr.openjdk.java.net/~ntv/8066806/webrev.10/ >>> >>> -- >>> Thanks and Regards, >>> Nadeesh TV >>> >>> >>> On 7/21/2016 6:59 PM, Roger Riggs wrote: >>> >>> Hi Nadeesh, >>> >>> Found the changes in http://cr.openjdk.java.net/~ntv/8066806/webrev.09/ >>> >>> Editorial: >>> " >>> >>> In the lenient mode, the parser will be greedy and parse the maximum >>> digits >>> possible." >>> >>> TCKDateTimeFormatterBuilder.java: >>> >>> The lines 1473, 1479, 1485, etc. are way too long, perhaps wrap/break >>> them >>> so each line starts with "." >>> >>> And wrap any other line longer than 100 chars. (Side by side diffs are >>> annoying if the lines are too long). >>> >>> Otherwise, looks good, >>> >>> Thanks, Roger >>> >>> >>> On 7/21/2016 7:21 AM, nadeesh tv wrote: >>> >>> Hi, >>> >>> Please see the updated webrev >>> >>> http://cr.openjdk.java.net/~ntv/8066806/webrev.08/ >>> >>> Changes in this webrev: >>> For leninent mode , doc change in DateTimeFormatterBuilder.java >>> " >>> >>> In the lenient mode, parser will be greedy and parse maximum digits >>> possible. >>> " >>> >>> Added new test cases for lenient mode. >>> >>> >>> >>> -- >>> Thanks and Regards, >>> Nadeesh TV >>> > > -- > Thanks and Regards, > Nadeesh TV > From svetlana.nikandrova at oracle.com Mon Jul 25 12:42:49 2016 From: svetlana.nikandrova at oracle.com (Svetlana Nikandrova) Date: Mon, 25 Jul 2016 15:42:49 +0300 Subject: RFR (JAXP): 8021787: javax.xml.datatype.XMLGregorianCalendar.getMonth() return is documented wrong In-Reply-To: <91d1116b-df84-319c-1f7e-34f32f7a1d47@oracle.com> References: <578CFA87.2040004@oracle.com> <51440a13-ab2a-11cf-c42f-b58d6deeba30@oracle.com> <578E2A92.5030307@oracle.com> <91d1116b-df84-319c-1f7e-34f32f7a1d47@oracle.com> Message-ID: <57960949.4040502@oracle.com> Hi Joe, Roger, thank you for your replays. A have changed javadoc as Joe suggested (hope I didn't missed any in-line comments) and added a bunch of "s" and "The" to Returns and @return. Hope now it looks better and more consistent: http://cr.openjdk.java.net/~snikandrova/8021787/webrev.02/ Thank you, Svetlana On 21.07.2016 19:32, huizhe wang wrote: > The editor of the new version of Thunderbird seems to be troublesome, > with missing or added whitespace as a result of copy&paste. But when > you "@return the hour of dayof this", you know I meant "@return the > hour of day of this" :-) Or the double whitespace should have been a > single one. > > -Joe > > On 7/21/2016 9:25 AM, huizhe wang wrote: >> Hi Svetlana, >> >> It would be good to apply the same format to these get* methods. >> Please see below. >> >> @@ -510,16 +510,16 @@ >> * @see #getYear() >> */ >> public abstract BigInteger getEonAndYear(); >> >> /** >> - * Return number of month or {@link DatatypeConstants#FIELD_UNDEFINED}. >> + * Returns the month of this calendar or {@link >> DatatypeConstants#FIELD_UNDEFINED}. >> *

    Value constraints for this value are summarized in >> * month field of date/time >> field mapping table. >> * >> - * @return year of this {@code XMLGregorianCalendar}. >> + * @return Returns the month of this {@code XMLGregorianCalendar}. >> >> remove the duplicated "Returns", that is >> >> @return the month of the{@code XMLGregorianCalendar}, from 1 to 12. >> >> >> */ >> public abstract int getMonth(); >> >> /** >> >> ------------------------------------------------------------------------ >> >> @@ -526,10 +526,12 @@ >> * Return day in month or {@link >> DatatypeConstants#FIELD_UNDEFINED}. >> >> Returns the day of month >> >> *

    Value constraints for this value are summarized in >> * day field of date/time field >> mapping table. >> * >> + * @return Day in month of this {@code XMLGregorianCalendar}. >> >> @return the day of month of the{@code XMLGregorianCalendar}, from 1 >> to 31. >> >> >> + * >> * @see #setDay(int) >> */ >> public abstract int getDay(); >> >> /** >> >> ------------------------------------------------------------------------ >> >> @@ -537,10 +539,12 @@ >> * {@link DatatypeConstants#FIELD_UNDEFINED} if this >> optional field is not defined. >> >> Returns the Timezone offset... >> >> *

    Value constraints for this value are summarized in >> * timezone field of >> date/time field mapping table. >> * >> + * @return Timezone offset in minutes of this {@code >> XMLGregorianCalendar}. >> >> @return the Timezone ... >> >> + * >> * @see #setTimezone(int) >> */ >> public abstract int getTimezone(); >> >> /** >> >> ------------------------------------------------------------------------ >> >> @@ -547,10 +551,13 @@ >> * Return hours or {@link DatatypeConstants#FIELD_UNDEFINED}. >> >> Returns the hour of day >> >> * Returns {@link DatatypeConstants#FIELD_UNDEFINED} if this >> field is not defined. >> * >> *

    Value constraints for this value are summarized in >> * hour field of date/time >> field mapping table. >> + * >> + * @return Hours of this {@code XMLGregorianCalendar}. >> >> @return the hour of dayof this {@code XMLGregorianCalendar}, from 0 >> to 23. >> >> + * >> * @see #setTime(int, int, int) >> */ >> public abstract int getHour(); >> >> /** >> >> ------------------------------------------------------------------------ >> >> @@ -557,10 +564,13 @@ >> * Return minutes or {@link DatatypeConstants#FIELD_UNDEFINED}. >> >> Returns the minute of hour... >> >> * Returns {@link DatatypeConstants#FIELD_UNDEFINED} if this >> field is not defined. >> * >> *

    Value constraints for this value are summarized in >> * minute field of date/time >> field mapping table. >> + * >> + * @return Minutes of this {@code XMLGregorianCalendar}. >> >> @return the minute of hourof this {@code XMLGregorianCalendar}, from >> 0 to 59. >> >> + * >> * @see #setTime(int, int, int) >> */ >> public abstract int getMinute(); >> >> /** >> >> ------------------------------------------------------------------------ >> >> @@ -679,10 +689,11 @@ >> * {@code XMLGregorianCalendar} and >> * {@link #compare(XMLGregorianCalendar obj)} >> * returns {@link DatatypeConstants#EQUAL}, >> * otherwise {@code false}. >> */ >> + @Override >> public boolean equals(Object obj) { >> >> if (obj == null || !(obj instanceof XMLGregorianCalendar)) { >> return false; >> } >> >> ------------------------------------------------------------------------ >> >> @@ -692,10 +703,11 @@ >> /** >> * Returns a hash code consistent with the definition of the >> equals method. >> * >> * @return hash code of this object. >> */ >> + @Override >> public int hashCode() { >> >> // Following two dates compare to EQUALS since in different >> timezones. >> // 2000-01-15T12:00:00-05:00 == 2000-01-15T13:00:00-04:00 >> // >> >> ------------------------------------------------------------------------ >> >> @@ -853,13 +865,13 @@ >> * >> * @return A non-{@code null} valid {@code String} >> representation of this {@code XMLGregorianCalendar}. >> * >> * @throws IllegalStateException if the combination of set fields >> * does not match one of the eight defined XML Schema builtin >> date/time datatypes. >> - * >> * @see #toXMLFormat() >> */ >> + @Override >> public String toString() { >> >> return toXMLFormat(); >> } >> >> >> ------------------------------------------------------------------------ >> >> @@ -968,10 +980,12 @@ >> *

  • Its fields ERA, YEAR, MONTH, DAY_OF_MONTH, HOUR_OF_DAY, >> * MINUTE, SECOND and MILLISECOND are set using the method >> * {@code Calendar.set(int,int)}
  • >> * >> * >> + * @return a {@code java.util.GregorianCalendar} conversion of this >> instance. >> >> @return an instance of{@link java.util.GregorianCalendar}. >> >> + * >> * @see #toGregorianCalendar(java.util.TimeZone, >> java.util.Locale, XMLGregorianCalendar) >> */ >> public abstract GregorianCalendar toGregorianCalendar(); >> >> /** >> >> ------------------------------------------------------------------------ >> >> @@ -1047,13 +1061,13 @@ >> * @return TimeZone for this. >> */ >> public abstract TimeZone getTimeZone(int defaultZoneoffset); >> >> >> - >> /** >> * Creates and returns a copy of this object. >> * >> * @return copy of this {@code Object} >> */ >> + @Override >> public abstract Object clone(); >> } >> >> >> Thanks, >> Joe >> >> >> On 7/19/2016 6:26 AM, Svetlana Nikandrova wrote: >>> Hi Joe, >>> >>> thank you for your replay. As I'm new to javadoc writing feel free >>> to add any comments. >>> Please see updated webrev: >>> http://cr.openjdk.java.net/~snikandrova/8021787/webrev.01/ >>> >>> >>> Thank you, >>> Svetlana >>> >>> On 18.07.2016 20:34, huizhe wang wrote: >>>> Hi Svetlana, >>>> >>>> Thanks for working on these bugs. The change is correct. It would >>>> be better to say: "Returns the month of this calendar", in both the >>>> returns tag and the description (not number of month). >>>> >>>> While we are in this class, it would be good to at least fix the >>>> missing @returns tags in a number of methods, e.g. getDay, >>>> getTimezone, getHour, getMinute, toGregorianCalendar. Also, it >>>> @Override equals, hashCode, toString, and clone. >>>> >>>> Thanks, >>>> >>>> Joe >>>> >>>> On 7/18/2016 8:49 AM, Svetlana Nikandrova wrote: >>>>> Hello all, >>>>> >>>>> please review this javadoc fix for >>>>> javax.xml.datatype.XMLGregorianCalendar.getMonth() >>>>> Webrev: >>>>> http://cr.openjdk.java.net/~snikandrova/8021787/webrev.00/ >>>>> >>>>> JBS: >>>>> https://bugs.openjdk.java.net/browse/JDK-8021787 >>>>> >>>>> Thank you, >>>>> Svetlana >>>> >>> >> > From daniel.fuchs at oracle.com Mon Jul 25 14:42:38 2016 From: daniel.fuchs at oracle.com (Daniel Fuchs) Date: Mon, 25 Jul 2016 15:42:38 +0100 Subject: [JAXP] RFR: 8153082: Update XSTL compiler to generate classes that invoke addReads In-Reply-To: <22a6662f4b8440a5860ee8f3dfdc55e6@DEWDFE13DE11.global.corp.sap> References: <74b953e2-f07e-afa8-80d0-f55014780f94@oracle.com> <22a6662f4b8440a5860ee8f3dfdc55e6@DEWDFE13DE11.global.corp.sap> Message-ID: Hi Christoph, On 22/07/16 20:23, Langer, Christoph wrote: > Hi Daniel, > > looks good to me. > > Maybe you'll want to take the chance to update the apache headers in the xalan files? > Thanks for your review! I'm only an occasional wanderer in JAXP land - which files do you see have an outdated header? I'll try to ping Joe Wang to get the correct headers. best regards, -- daniel From chris.hegarty at oracle.com Mon Jul 25 14:54:03 2016 From: chris.hegarty at oracle.com (Chris Hegarty) Date: Mon, 25 Jul 2016 15:54:03 +0100 Subject: RFR 9: JEP 290: Filter Incoming Serialization Data In-Reply-To: References: Message-ID: Roger, Mainly looks good. Some comments on the spec: - Use the Present Simple Tense consistently, e.g. "Return*S* an ObjectInputFilter computed from a string of patterns." - ObjectInputFilter. Was there a comment already on the use of links? For example the following is showing in the javadoc: "ObjectInputStream.setObjectInputFilter(java.io.ObjectInputFilter)" when "setObjectInputFilter" would be better. Same comment applies to the links to ObjectInputFilter.Status, and other places. - ObjectInputFilter class description. "If set on an ObjectInputStream, the method*(s)* are called ..." - Looking at the example in the ObjectInputFilter class description makes me think that maybe the default process-wide filter should be a filter that simply returns UNDECIDED, rather than being null. Is it important to discern whether, or not, it has been set? - ObjectInputFilter.Config The initial sentence in the class description should describe the class itself, so maybe " A utility class for ..." - "process-wide" is this an agreed upon term? I'm just curious where it came from. Is there a more common term for this? - Config.setSerialFilter: SecurityException - if there is security manager and the SerializablePermission("serialFilter") is not granted or if there is no securityManager set and the process-wide filter has already been set non-null It is a little odd to throw a SE if there is no SM, no ? - Is there a class/package level statement covering null, or should it be covered for each applicable method? - ObjectInputStream "... the serialization filter for the stream." -> "... the serialization filter for THIS stream." - setObjectInputFilter: "The checkInput method is called for each class and reference in the stream". Does this apply to back references too? - setObjectInputFilter: "... when the ObjectInputStream is constructed and CANNOT be re-set until an object has been deserialized." -Chris. On 19/07/16 15:02, Roger Riggs wrote: > Please review the design, implementation, and tests of JEP 290: Filter > Incoming Serialization Data[1] > > It allows incoming streams of object-serialization data to be filtered > in order to improve both security and robustness. > The JEP[1] has more detail on the background and scope. > > The core mechanism is a filter interface implemented by serialization > clients and set on an |ObjectInputStream|. The filter is called during > the deserialization process to validate the classes being deserialized, > the sizes of arrays being created, and metrics describing stream length, > stream depth, and number of references as the stream is being decoded. > > A process-wide filter can be configured that is applied to every > ObjectInputStream. > The API of ObjectInputStream can be used to set a custom filter to > supersede or augment the process-wide filter. > > Webrev: > http://cr.openjdk.java.net/~rriggs/webrev-serial-filter-jdk9-8155760/ > > SpecDiff: > http://cr.openjdk.java.net/~rriggs/filter-diffs/overview-summary.html > > Javadoc (subset) > http://cr.openjdk.java.net/~rriggs/filter-javadoc/java/io/ObjectInputStream.html > > http://cr.openjdk.java.net/~rriggs/filter-javadoc/java/io/ObjectInputFilter.html > > > Comments appreciated, Roger > > [1] JEP 290: https://bugs.openjdk.java.net/browse/JDK-8154961 > From daniel.fuchs at oracle.com Mon Jul 25 14:59:35 2016 From: daniel.fuchs at oracle.com (Daniel Fuchs) Date: Mon, 25 Jul 2016 15:59:35 +0100 Subject: [JAXP] RFR: 8153082: Update XSTL compiler to generate classes that invoke addReads In-Reply-To: <5b5e0f45-3a86-4ac7-a1c0-23d2eb5a4a73@oracle.com> References: <74b953e2-f07e-afa8-80d0-f55014780f94@oracle.com> <5b5e0f45-3a86-4ac7-a1c0-23d2eb5a4a73@oracle.com> Message-ID: <74c635f6-c368-5f79-196f-dd3ad1f77ce8@oracle.com> Hi Alan, On 23/07/16 07:57, Alan Bateman wrote: > On 22/07/2016 17:16, Daniel Fuchs wrote: > >> Hi, >> >> Please find below a fix for >> 8153082: Update XSTL compiler to generate classes that invoke addReads >> https://bugs.openjdk.java.net/browse/JDK-8153082 >> >> This fix removes a dependency from java.xml to an internal >> java base API. > This looks good. The only thing that looks a bit strange is changing the > class file version during generation. It there any reason not to bump > the default? Separately, we should cache the Configuration as each > translet has the same but that is a separate issue of course. I've done the experiment and bumped the default class file version to 49. But then some other tests (e.g. SAXTFactoryTest) started failing with strange ClassFileFormat errors (see at the end of the mail). My guess is that the XSLT compiler (or is it BCEL?) is not ready for a global upgrade of class file version to 49. It seems that something is sometimes genereting bytecode that's incompatible with class file version 49 (I verified that those tests would pass with 48, but they fail with 49). I have unfortunately no idea what exactly is causing the issue - so I've revised my patch to generate 1.1 compatible byte code instead. (mixing bytecode that requires v < 49 with bytecode that requires v > 48 does not sound like a good idea ;-( ) So here is a new webrev that does not require 49 and makes all the tests happy: http://cr.openjdk.java.net/~dfuchs/webrev_8153082/webrev.01/ best regards, -- daniel ----------------------------------------------------------------- ---- ClassFormatError in SAXTFactoryTest when class file version is > 48 java.lang.ClassFormatError: Illegal class name "die/verwandlung/" in class file at java.lang.ClassLoader.defineClass1(java.base at 9-internal/Native Method) at java.lang.ClassLoader.defineClass(java.base at 9-internal/ClassLoader.java:942) at java.lang.ClassLoader.defineClass(java.base at 9-internal/ClassLoader.java:806) at com.sun.org.apache.xalan.internal.xsltc.trax.TemplatesImpl$TransletClassLoader.defineClass(java.xml at 9-internal/TemplatesImpl.java:197) at com.sun.org.apache.xalan.internal.xsltc.trax.TemplatesImpl.defineTransletClasses(java.xml at 9-internal/TemplatesImpl.java:492) at com.sun.org.apache.xalan.internal.xsltc.trax.TemplatesImpl.getTransletInstance(java.xml at 9-internal/TemplatesImpl.java:529) at com.sun.org.apache.xalan.internal.xsltc.trax.TemplatesImpl.newTransformer(java.xml at 9-internal/TemplatesImpl.java:564) at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTransformer(java.xml at 9-internal/TransformerFactoryImpl.java:798) at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTransformerHandler(java.xml at 9-internal/TransformerFactoryImpl.java:1105) at javax.xml.transform.ptests.SAXTFactoryTest.testcase06(SAXTFactoryTest.java:237) at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(java.base at 9-internal/Native Method) at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(java.base at 9-internal/NativeMethodAccessorImpl.java:62) at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(java.base at 9-internal/DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(java.base at 9-internal/Method.java:533) at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:84) at org.testng.internal.Invoker.invokeMethod(Invoker.java:714) at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901) at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231) at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127) at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111) at org.testng.TestRunner.privateRun(TestRunner.java:767) at org.testng.TestRunner.run(TestRunner.java:617) at org.testng.SuiteRunner.runTest(SuiteRunner.java:334) at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329) at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291) at org.testng.SuiteRunner.run(SuiteRunner.java:240) at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52) at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86) at org.testng.TestNG.runSuitesSequentially(TestNG.java:1224) at org.testng.TestNG.runSuitesLocally(TestNG.java:1149) at org.testng.TestNG.run(TestNG.java:1057) at com.sun.javatest.regtest.TestNGAction$TestNGRunner.main(TestNGAction.java:220) at com.sun.javatest.regtest.TestNGAction$TestNGRunner.main(TestNGAction.java:184) at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(java.base at 9-internal/Native Method) at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(java.base at 9-internal/NativeMethodAccessorImpl.java:62) at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(java.base at 9-internal/DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(java.base at 9-internal/Method.java:533) at com.sun.javatest.regtest.agent.MainWrapper$MainThread.run(MainWrapper.java:110) at java.lang.Thread.run(java.base at 9-internal/Thread.java:843) From christoph.langer at sap.com Mon Jul 25 15:16:21 2016 From: christoph.langer at sap.com (Langer, Christoph) Date: Mon, 25 Jul 2016 15:16:21 +0000 Subject: [JAXP] RFR: 8153082: Update XSTL compiler to generate classes that invoke addReads In-Reply-To: References: <74b953e2-f07e-afa8-80d0-f55014780f94@oracle.com> <22a6662f4b8440a5860ee8f3dfdc55e6@DEWDFE13DE11.global.corp.sap> Message-ID: Hi Daniel, yes, I just recognized the header is different everywhere. It is a good idea to consult Joe on this - he was also giving me hints on how to do it correctly when I was touching JAXP. Best regards Christoph > -----Original Message----- > From: Daniel Fuchs [mailto:daniel.fuchs at oracle.com] > Sent: Montag, 25. Juli 2016 16:43 > To: Langer, Christoph > Cc: Joe Wang ; core-libs-dev dev at openjdk.java.net> > Subject: Re: [JAXP] RFR: 8153082: Update XSTL compiler to generate classes > that invoke addReads > > Hi Christoph, > > On 22/07/16 20:23, Langer, Christoph wrote: > > Hi Daniel, > > > > looks good to me. > > > > Maybe you'll want to take the chance to update the apache headers in the > xalan files? > > > > Thanks for your review! > > I'm only an occasional wanderer in JAXP land - which files do you see > have an outdated header? > > I'll try to ping Joe Wang to get the correct headers. > > best regards, > > -- daniel From christoph.langer at sap.com Mon Jul 25 15:27:18 2016 From: christoph.langer at sap.com (Langer, Christoph) Date: Mon, 25 Jul 2016 15:27:18 +0000 Subject: RFR (JAXP) 8158084: Catalog API: JAXP XML Processor Support In-Reply-To: References: Message-ID: Hi Joe, looking good to me at a glance and contains some nice cleanups/warning fixes. But of course I'm not a reviewer. I think in src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/FunctionCall.java src/java.xml/share/classes/jdk/xml/internal/SecuritySupport.java you forgot to add the year 2016 to the copyright header. Also in src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/XSLTC.java the $id tag under the header can be removed. Best regards Christoph > -----Original Message----- > From: core-libs-dev [mailto:core-libs-dev-bounces at openjdk.java.net] On Behalf > Of huizhe wang > Sent: Montag, 25. Juli 2016 06:45 > To: core-libs-dev > Subject: RFR (JAXP) 8158084: Catalog API: JAXP XML Processor Support > > Hi, > > This is an enhancement to support the Catalog API (javax.xml.catalog) > throughout the JAXP processors. All of the CatalogFeatures are supported > by the JAXP factories and processors (e.g. SAXParser), and corresponding > System properties as specified in the CatalogFeatures. An additional > javax.xml property "USE_CATALOG" is added to allow switching on/off the > Catalog support for a processor or all of them (through the System > properties or jaxp.properties). > > The USE_CATALOG feature is on by default for all processors. The only > thing needed then, to resolve external references with a catalog, is > setting the path to the catalog on the processor. While the USE_CATALOG > is on by default, the Catalog support is noninterference. As long as no > catalog is set, the Catalog is mute. Catalog, even if one exists, will > not interfere with custom resolvers, it is simply ignored if a custom > resolver is present. > > > specdiff: > http://cr.openjdk.java.net/~joehw/jdk9/8158084/specdiff/overview- > summary.html > > webrev: http://cr.openjdk.java.net/~joehw/jdk9/8158084/webrev/ > > > Tests: 140ish new test cases; all existing SQE/unit tests pass. JCK has > a large number of failures due to one Catalog API test that left a > configuration file behind. I'll discuss that with the JCK team. > > > Thanks, > > Joe > > From brian.goetz at oracle.com Mon Jul 25 17:05:41 2016 From: brian.goetz at oracle.com (Brian Goetz) Date: Mon, 25 Jul 2016 13:05:41 -0400 Subject: RFR 9: JEP 290: Filter Incoming Serialization Data In-Reply-To: References: Message-ID: <7359120b-fd6f-5c1d-ae12-ed784a437b68@oracle.com> A few more comments: - Do you want to tag OIF as a functional interface? (I think yes, you intend to use this with lambdas.) - Need explanation of what happens when someone returns UNDECIDED -- and perhaps some motivating explanation of why it is there at all, rather than just returning boolean. - Are we sure we want to pass a Class, rather than a class name, to the filter? Passing a Class means that the serialization layer may cause the class to be loaded, even if the deserialization is ultimately rejected -- and therefore a malicious stream can force class loading (whose may have side-effects.) It would be nicer if a rejected stream didn't cause extraneous classes to be loaded. On 7/19/2016 10:02 AM, Roger Riggs wrote: > Please review the design, implementation, and tests of JEP 290: Filter > Incoming Serialization Data[1] > > It allows incoming streams of object-serialization data to be filtered > in order to improve both security and robustness. > The JEP[1] has more detail on the background and scope. > > The core mechanism is a filter interface implemented by serialization > clients and set on an |ObjectInputStream|. The filter is called during > the deserialization process to validate the classes being > deserialized, the sizes of arrays being created, and metrics > describing stream length, stream depth, and number of references as > the stream is being decoded. > > A process-wide filter can be configured that is applied to every > ObjectInputStream. > The API of ObjectInputStream can be used to set a custom filter to > supersede or augment the process-wide filter. > > Webrev: > http://cr.openjdk.java.net/~rriggs/webrev-serial-filter-jdk9-8155760/ > > SpecDiff: > http://cr.openjdk.java.net/~rriggs/filter-diffs/overview-summary.html > > Javadoc (subset) > http://cr.openjdk.java.net/~rriggs/filter-javadoc/java/io/ObjectInputStream.html > > http://cr.openjdk.java.net/~rriggs/filter-javadoc/java/io/ObjectInputFilter.html > > > Comments appreciated, Roger > > [1] JEP 290: https://bugs.openjdk.java.net/browse/JDK-8154961 > From daniel.fuchs at oracle.com Mon Jul 25 17:21:54 2016 From: daniel.fuchs at oracle.com (Daniel Fuchs) Date: Mon, 25 Jul 2016 18:21:54 +0100 Subject: [JAXP] RFR: 8153082: Update XSTL compiler to generate classes that invoke addReads In-Reply-To: References: <74b953e2-f07e-afa8-80d0-f55014780f94@oracle.com> <22a6662f4b8440a5860ee8f3dfdc55e6@DEWDFE13DE11.global.corp.sap> Message-ID: <72250ada-17ae-8064-eb4e-8b53a2d36c63@oracle.com> Hi, Here is the later version of the fix: - Header files fixed - Bytecode 1.1 compatible http://cr.openjdk.java.net/~dfuchs/webrev_8153082/webrev.02/ cheers, -- daniel On 25/07/16 16:16, Langer, Christoph wrote: > Hi Daniel, > > yes, I just recognized the header is different everywhere. It is a good idea to consult Joe on this - he was also giving me hints on how to do it correctly when I was touching JAXP. > > Best regards > Christoph > >> -----Original Message----- >> From: Daniel Fuchs [mailto:daniel.fuchs at oracle.com] >> Sent: Montag, 25. Juli 2016 16:43 >> To: Langer, Christoph >> Cc: Joe Wang ; core-libs-dev > dev at openjdk.java.net> >> Subject: Re: [JAXP] RFR: 8153082: Update XSTL compiler to generate classes >> that invoke addReads >> >> Hi Christoph, >> >> On 22/07/16 20:23, Langer, Christoph wrote: >>> Hi Daniel, >>> >>> looks good to me. >>> >>> Maybe you'll want to take the chance to update the apache headers in the >> xalan files? >>> >> >> Thanks for your review! >> >> I'm only an occasional wanderer in JAXP land - which files do you see >> have an outdated header? >> >> I'll try to ping Joe Wang to get the correct headers. >> >> best regards, >> >> -- daniel From christoph.langer at sap.com Mon Jul 25 17:38:44 2016 From: christoph.langer at sap.com (Langer, Christoph) Date: Mon, 25 Jul 2016 17:38:44 +0000 Subject: [JAXP] RFR: 8153082: Update XSTL compiler to generate classes that invoke addReads In-Reply-To: <72250ada-17ae-8064-eb4e-8b53a2d36c63@oracle.com> References: <74b953e2-f07e-afa8-80d0-f55014780f94@oracle.com> <22a6662f4b8440a5860ee8f3dfdc55e6@DEWDFE13DE11.global.corp.sap> <72250ada-17ae-8064-eb4e-8b53a2d36c63@oracle.com> Message-ID: Hi, looking good. I believe you could also remove the comment sections after the headers like: /* * $Id: Constants.java,v 1.7 2006/06/19 19:49:04 spericas Exp $ */ But no need for new webrev for that, of course :-) Best regards Christoph > -----Original Message----- > From: Daniel Fuchs [mailto:daniel.fuchs at oracle.com] > Sent: Montag, 25. Juli 2016 19:22 > To: Langer, Christoph ; Joe Wang > ; Alan Bateman > Cc: core-libs-dev > Subject: Re: [JAXP] RFR: 8153082: Update XSTL compiler to generate classes > that invoke addReads > > Hi, > > Here is the later version of the fix: > > - Header files fixed > - Bytecode 1.1 compatible > > http://cr.openjdk.java.net/~dfuchs/webrev_8153082/webrev.02/ > > cheers, > > -- daniel > > On 25/07/16 16:16, Langer, Christoph wrote: > > Hi Daniel, > > > > yes, I just recognized the header is different everywhere. It is a good idea to > consult Joe on this - he was also giving me hints on how to do it correctly when I > was touching JAXP. > > > > Best regards > > Christoph > > > >> -----Original Message----- > >> From: Daniel Fuchs [mailto:daniel.fuchs at oracle.com] > >> Sent: Montag, 25. Juli 2016 16:43 > >> To: Langer, Christoph > >> Cc: Joe Wang ; core-libs-dev >> dev at openjdk.java.net> > >> Subject: Re: [JAXP] RFR: 8153082: Update XSTL compiler to generate classes > >> that invoke addReads > >> > >> Hi Christoph, > >> > >> On 22/07/16 20:23, Langer, Christoph wrote: > >>> Hi Daniel, > >>> > >>> looks good to me. > >>> > >>> Maybe you'll want to take the chance to update the apache headers in the > >> xalan files? > >>> > >> > >> Thanks for your review! > >> > >> I'm only an occasional wanderer in JAXP land - which files do you see > >> have an outdated header? > >> > >> I'll try to ping Joe Wang to get the correct headers. > >> > >> best regards, > >> > >> -- daniel From huizhe.wang at oracle.com Mon Jul 25 17:40:17 2016 From: huizhe.wang at oracle.com (huizhe wang) Date: Mon, 25 Jul 2016 10:40:17 -0700 Subject: RFR (JAXP) 8158084: Catalog API: JAXP XML Processor Support In-Reply-To: References: Message-ID: Thanks Christoph. Fixed those headers. I wished to get these classes free from warnings, but had to find a balance between fixing warnings and adding too much noise to the patch. We could definitely make some dedicated warning patches. -Joe On 7/25/2016 8:27 AM, Langer, Christoph wrote: > Hi Joe, > > looking good to me at a glance and contains some nice cleanups/warning fixes. But of course I'm not a reviewer. > > I think in > src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/FunctionCall.java > src/java.xml/share/classes/jdk/xml/internal/SecuritySupport.java > you forgot to add the year 2016 to the copyright header. > > Also in > src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/XSLTC.java > the $id tag under the header can be removed. > > Best regards > Christoph > >> -----Original Message----- >> From: core-libs-dev [mailto:core-libs-dev-bounces at openjdk.java.net] On Behalf >> Of huizhe wang >> Sent: Montag, 25. Juli 2016 06:45 >> To: core-libs-dev >> Subject: RFR (JAXP) 8158084: Catalog API: JAXP XML Processor Support >> >> Hi, >> >> This is an enhancement to support the Catalog API (javax.xml.catalog) >> throughout the JAXP processors. All of the CatalogFeatures are supported >> by the JAXP factories and processors (e.g. SAXParser), and corresponding >> System properties as specified in the CatalogFeatures. An additional >> javax.xml property "USE_CATALOG" is added to allow switching on/off the >> Catalog support for a processor or all of them (through the System >> properties or jaxp.properties). >> >> The USE_CATALOG feature is on by default for all processors. The only >> thing needed then, to resolve external references with a catalog, is >> setting the path to the catalog on the processor. While the USE_CATALOG >> is on by default, the Catalog support is noninterference. As long as no >> catalog is set, the Catalog is mute. Catalog, even if one exists, will >> not interfere with custom resolvers, it is simply ignored if a custom >> resolver is present. >> >> >> specdiff: >> http://cr.openjdk.java.net/~joehw/jdk9/8158084/specdiff/overview- >> summary.html >> >> webrev: http://cr.openjdk.java.net/~joehw/jdk9/8158084/webrev/ >> >> >> Tests: 140ish new test cases; all existing SQE/unit tests pass. JCK has >> a large number of failures due to one Catalog API test that left a >> configuration file behind. I'll discuss that with the JCK team. >> >> >> Thanks, >> >> Joe >> >> From daniel.fuchs at oracle.com Mon Jul 25 17:40:31 2016 From: daniel.fuchs at oracle.com (Daniel Fuchs) Date: Mon, 25 Jul 2016 18:40:31 +0100 Subject: [JAXP] RFR: 8153082: Update XSTL compiler to generate classes that invoke addReads In-Reply-To: References: <74b953e2-f07e-afa8-80d0-f55014780f94@oracle.com> <22a6662f4b8440a5860ee8f3dfdc55e6@DEWDFE13DE11.global.corp.sap> <72250ada-17ae-8064-eb4e-8b53a2d36c63@oracle.com> Message-ID: <15333771-771f-5a21-df56-0727619f4e09@oracle.com> On 25/07/16 18:38, Langer, Christoph wrote: > Hi, > > looking good. I believe you could also remove the comment sections after the headers like: > /* > * $Id: Constants.java,v 1.7 2006/06/19 19:49:04 spericas Exp $ > */ > > But no need for new webrev for that, of course :-) Thanks Christoph! I was unsure whether to keep it or remove it. I will remove it before pushing. best regards, -- daniel > > Best regards > Christoph > >> -----Original Message----- >> From: Daniel Fuchs [mailto:daniel.fuchs at oracle.com] >> Sent: Montag, 25. Juli 2016 19:22 >> To: Langer, Christoph ; Joe Wang >> ; Alan Bateman >> Cc: core-libs-dev >> Subject: Re: [JAXP] RFR: 8153082: Update XSTL compiler to generate classes >> that invoke addReads >> >> Hi, >> >> Here is the later version of the fix: >> >> - Header files fixed >> - Bytecode 1.1 compatible >> >> http://cr.openjdk.java.net/~dfuchs/webrev_8153082/webrev.02/ >> >> cheers, >> >> -- daniel >> >> On 25/07/16 16:16, Langer, Christoph wrote: >>> Hi Daniel, >>> >>> yes, I just recognized the header is different everywhere. It is a good idea to >> consult Joe on this - he was also giving me hints on how to do it correctly when I >> was touching JAXP. >>> >>> Best regards >>> Christoph >>> >>>> -----Original Message----- >>>> From: Daniel Fuchs [mailto:daniel.fuchs at oracle.com] >>>> Sent: Montag, 25. Juli 2016 16:43 >>>> To: Langer, Christoph >>>> Cc: Joe Wang ; core-libs-dev >>> dev at openjdk.java.net> >>>> Subject: Re: [JAXP] RFR: 8153082: Update XSTL compiler to generate classes >>>> that invoke addReads >>>> >>>> Hi Christoph, >>>> >>>> On 22/07/16 20:23, Langer, Christoph wrote: >>>>> Hi Daniel, >>>>> >>>>> looks good to me. >>>>> >>>>> Maybe you'll want to take the chance to update the apache headers in the >>>> xalan files? >>>>> >>>> >>>> Thanks for your review! >>>> >>>> I'm only an occasional wanderer in JAXP land - which files do you see >>>> have an outdated header? >>>> >>>> I'll try to ping Joe Wang to get the correct headers. >>>> >>>> best regards, >>>> >>>> -- daniel > From huizhe.wang at oracle.com Mon Jul 25 17:48:33 2016 From: huizhe.wang at oracle.com (huizhe wang) Date: Mon, 25 Jul 2016 10:48:33 -0700 Subject: RFR (JAXP): 8021787: javax.xml.datatype.XMLGregorianCalendar.getMonth() return is documented wrong In-Reply-To: <57960949.4040502@oracle.com> References: <578CFA87.2040004@oracle.com> <51440a13-ab2a-11cf-c42f-b58d6deeba30@oracle.com> <578E2A92.5030307@oracle.com> <91d1116b-df84-319c-1f7e-34f32f7a1d47@oracle.com> <57960949.4040502@oracle.com> Message-ID: Thanks Svetlana. The patch looks good to me. -Joe On 7/25/2016 5:42 AM, Svetlana Nikandrova wrote: > Hi Joe, Roger, > > thank you for your replays. A have changed javadoc as Joe suggested > (hope I didn't missed any in-line comments) and added a bunch of "s" > and "The" to Returns and @return. > Hope now it looks better and more consistent: > http://cr.openjdk.java.net/~snikandrova/8021787/webrev.02/ > > > Thank you, > Svetlana > > On 21.07.2016 19:32, huizhe wang wrote: >> The editor of the new version of Thunderbird seems to be troublesome, >> with missing or added whitespace as a result of copy&paste. But when >> you "@return the hour of dayof this", you know I meant "@return the >> hour of day of this" :-) Or the double whitespace should have been a >> single one. >> >> -Joe >> >> On 7/21/2016 9:25 AM, huizhe wang wrote: >>> Hi Svetlana, >>> >>> It would be good to apply the same format to these get* methods. >>> Please see below. >>> >>> @@ -510,16 +510,16 @@ >>> * @see #getYear() >>> */ >>> public abstract BigInteger getEonAndYear(); >>> >>> /** >>> - * Return number of month or {@link >>> DatatypeConstants#FIELD_UNDEFINED}. >>> + * Returns the month of this calendar or {@link >>> DatatypeConstants#FIELD_UNDEFINED}. >>> *

    Value constraints for this value are summarized in >>> * month field of date/time >>> field mapping table. >>> * >>> - * @return year of this {@code XMLGregorianCalendar}. >>> + * @return Returns the month of this {@code XMLGregorianCalendar}. >>> >>> remove the duplicated "Returns", that is >>> >>> @return the month of the{@code XMLGregorianCalendar}, from 1 to 12. >>> >>> >>> */ >>> public abstract int getMonth(); >>> >>> /** >>> >>> ------------------------------------------------------------------------ >>> >>> >>> @@ -526,10 +526,12 @@ >>> * Return day in month or {@link >>> DatatypeConstants#FIELD_UNDEFINED}. >>> >>> Returns the day of month >>> >>> *

    Value constraints for this value are summarized in >>> * day field of date/time >>> field mapping table. >>> * >>> + * @return Day in month of this {@code XMLGregorianCalendar}. >>> >>> @return the day of month of the{@code XMLGregorianCalendar}, from 1 >>> to 31. >>> >>> >>> + * >>> * @see #setDay(int) >>> */ >>> public abstract int getDay(); >>> >>> /** >>> >>> ------------------------------------------------------------------------ >>> >>> >>> @@ -537,10 +539,12 @@ >>> * {@link DatatypeConstants#FIELD_UNDEFINED} if this >>> optional field is not defined. >>> >>> Returns the Timezone offset... >>> >>> *

    Value constraints for this value are summarized in >>> * timezone field of >>> date/time field mapping table. >>> * >>> + * @return Timezone offset in minutes of this {@code >>> XMLGregorianCalendar}. >>> >>> @return the Timezone ... >>> >>> + * >>> * @see #setTimezone(int) >>> */ >>> public abstract int getTimezone(); >>> >>> /** >>> >>> ------------------------------------------------------------------------ >>> >>> >>> @@ -547,10 +551,13 @@ >>> * Return hours or {@link DatatypeConstants#FIELD_UNDEFINED}. >>> >>> Returns the hour of day >>> >>> * Returns {@link DatatypeConstants#FIELD_UNDEFINED} if >>> this field is not defined. >>> * >>> *

    Value constraints for this value are summarized in >>> * hour field of date/time >>> field mapping table. >>> + * >>> + * @return Hours of this {@code XMLGregorianCalendar}. >>> >>> @return the hour of dayof this {@code XMLGregorianCalendar}, from 0 >>> to 23. >>> >>> + * >>> * @see #setTime(int, int, int) >>> */ >>> public abstract int getHour(); >>> >>> /** >>> >>> ------------------------------------------------------------------------ >>> >>> >>> @@ -557,10 +564,13 @@ >>> * Return minutes or {@link >>> DatatypeConstants#FIELD_UNDEFINED}. >>> >>> Returns the minute of hour... >>> >>> * Returns {@link DatatypeConstants#FIELD_UNDEFINED} if >>> this field is not defined. >>> * >>> *

    Value constraints for this value are summarized in >>> * minute field of >>> date/time field mapping table. >>> + * >>> + * @return Minutes of this {@code XMLGregorianCalendar}. >>> >>> @return the minute of hourof this {@code XMLGregorianCalendar}, from >>> 0 to 59. >>> >>> + * >>> * @see #setTime(int, int, int) >>> */ >>> public abstract int getMinute(); >>> >>> /** >>> >>> ------------------------------------------------------------------------ >>> >>> >>> @@ -679,10 +689,11 @@ >>> * {@code XMLGregorianCalendar} and >>> * {@link #compare(XMLGregorianCalendar obj)} >>> * returns {@link DatatypeConstants#EQUAL}, >>> * otherwise {@code false}. >>> */ >>> + @Override >>> public boolean equals(Object obj) { >>> >>> if (obj == null || !(obj instanceof XMLGregorianCalendar)) { >>> return false; >>> } >>> >>> ------------------------------------------------------------------------ >>> >>> >>> @@ -692,10 +703,11 @@ >>> /** >>> * Returns a hash code consistent with the definition of the >>> equals method. >>> * >>> * @return hash code of this object. >>> */ >>> + @Override >>> public int hashCode() { >>> >>> // Following two dates compare to EQUALS since in different >>> timezones. >>> // 2000-01-15T12:00:00-05:00 == 2000-01-15T13:00:00-04:00 >>> // >>> >>> ------------------------------------------------------------------------ >>> >>> >>> @@ -853,13 +865,13 @@ >>> * >>> * @return A non-{@code null} valid {@code String} >>> representation of this {@code XMLGregorianCalendar}. >>> * >>> * @throws IllegalStateException if the combination of set fields >>> * does not match one of the eight defined XML Schema >>> builtin date/time datatypes. >>> - * >>> * @see #toXMLFormat() >>> */ >>> + @Override >>> public String toString() { >>> >>> return toXMLFormat(); >>> } >>> >>> >>> ------------------------------------------------------------------------ >>> >>> >>> @@ -968,10 +980,12 @@ >>> *

  • Its fields ERA, YEAR, MONTH, DAY_OF_MONTH, HOUR_OF_DAY, >>> * MINUTE, SECOND and MILLISECOND are set using the method >>> * {@code Calendar.set(int,int)}
  • >>> * >>> * >>> + * @return a {@code java.util.GregorianCalendar} conversion of this >>> instance. >>> >>> @return an instance of{@link java.util.GregorianCalendar}. >>> >>> + * >>> * @see #toGregorianCalendar(java.util.TimeZone, >>> java.util.Locale, XMLGregorianCalendar) >>> */ >>> public abstract GregorianCalendar toGregorianCalendar(); >>> >>> /** >>> >>> ------------------------------------------------------------------------ >>> >>> >>> @@ -1047,13 +1061,13 @@ >>> * @return TimeZone for this. >>> */ >>> public abstract TimeZone getTimeZone(int defaultZoneoffset); >>> >>> >>> - >>> /** >>> * Creates and returns a copy of this object. >>> * >>> * @return copy of this {@code Object} >>> */ >>> + @Override >>> public abstract Object clone(); >>> } >>> >>> >>> Thanks, >>> Joe >>> >>> >>> On 7/19/2016 6:26 AM, Svetlana Nikandrova wrote: >>>> Hi Joe, >>>> >>>> thank you for your replay. As I'm new to javadoc writing feel free >>>> to add any comments. >>>> Please see updated webrev: >>>> http://cr.openjdk.java.net/~snikandrova/8021787/webrev.01/ >>>> >>>> >>>> Thank you, >>>> Svetlana >>>> >>>> On 18.07.2016 20:34, huizhe wang wrote: >>>>> Hi Svetlana, >>>>> >>>>> Thanks for working on these bugs. The change is correct. It would >>>>> be better to say: "Returns the month of this calendar", in both >>>>> the returns tag and the description (not number of month). >>>>> >>>>> While we are in this class, it would be good to at least fix the >>>>> missing @returns tags in a number of methods, e.g. getDay, >>>>> getTimezone, getHour, getMinute, toGregorianCalendar. Also, it >>>>> @Override equals, hashCode, toString, and clone. >>>>> >>>>> Thanks, >>>>> >>>>> Joe >>>>> >>>>> On 7/18/2016 8:49 AM, Svetlana Nikandrova wrote: >>>>>> Hello all, >>>>>> >>>>>> please review this javadoc fix for >>>>>> javax.xml.datatype.XMLGregorianCalendar.getMonth() >>>>>> Webrev: >>>>>> http://cr.openjdk.java.net/~snikandrova/8021787/webrev.00/ >>>>>> >>>>>> JBS: >>>>>> https://bugs.openjdk.java.net/browse/JDK-8021787 >>>>>> >>>>>> Thank you, >>>>>> Svetlana >>>>> >>>> >>> >> > From iris.clark at oracle.com Mon Jul 25 18:01:26 2016 From: iris.clark at oracle.com (Iris Clark) Date: Mon, 25 Jul 2016 11:01:26 -0700 (PDT) Subject: RFR: 8162439: Runtime.Version.parse needs fast-path for major versions In-Reply-To: <57939A03.7080104@oracle.com> References: <57939A03.7080104@oracle.com> Message-ID: Hi, Claes. > Webrev: http://cr.openjdk.java.net/~redestad/8162439/webrev.01/ > Bug: https://bugs.openjdk.java.net/browse/JDK-8162439 I think that this change looks good. We provide a shortcut for the common case where only the major version number is of interest without introducing a new API. Note that this has a minor side-effect that invocations of the form Runtime.Version.parse("notANumber") will now throw NFE instead of IAE. I don't think that this is a problem since NFE extends IAE and the order that the exceptions will be checked is intentionally unspecified. Regards, iris (not a Reviewer) -----Original Message----- From: Claes Redestad Sent: Saturday, July 23, 2016 9:24 AM To: core-libs-dev at openjdk.java.net core-libs-dev Subject: RFR: 8162439: Runtime.Version.parse needs fast-path for major versions Hi, please review this patch to address a startup regression due to use of Runtime.Version.parse("8") etc in JarFile, as introduced by JDK-8150680. This solution introduce a fast-path in case of what appears to be a single number is sent to Runtime.Version.parse to avoid initializing Runtime.VersionBuilder: Webrev: http://cr.openjdk.java.net/~redestad/8162439/webrev.01/ Bug: https://bugs.openjdk.java.net/browse/JDK-8162439 Passes all existing tests. Thanks! /Claes From daniel.fuchs at oracle.com Mon Jul 25 18:10:20 2016 From: daniel.fuchs at oracle.com (Daniel Fuchs) Date: Mon, 25 Jul 2016 19:10:20 +0100 Subject: RFR: 6543126: Level.known can leak memory Message-ID: <18377964-f7c7-e1a2-4cb5-05df2085bb5a@oracle.com> Hi, Please find below a fix for: 6543126: Level.known can leak memory https://bugs.openjdk.java.net/browse/JDK-6543126 webrev: http://cr.openjdk.java.net/~dfuchs/webrev_6543126/webrev.00 This is a fix for a long standing issue: Level maintains a list of know levels which has strong references to any created levels. Because the references are strong references, they prevent the garbage collection of levels, level classes, and level class loaders. This fix changes the KnownLevel class to extend WeakReference in order to only retain a weak reference to custom level instances. best regards, -- daniel From Roger.Riggs at Oracle.com Mon Jul 25 18:55:15 2016 From: Roger.Riggs at Oracle.com (Roger Riggs) Date: Mon, 25 Jul 2016 14:55:15 -0400 Subject: RFR 9: JEP 290: Filter Incoming Serialization Data In-Reply-To: References: Message-ID: <7a1bd8d7-1bf6-7357-6fcd-b7c83b08e52b@Oracle.com> Hi Chris, Thanks for the review and comments, Updates in place: Webrev: http://cr.openjdk.java.net/~rriggs/webrev-serial-filter-jdk9-8155760/ SpecDiff: http://cr.openjdk.java.net/~rriggs/filter-diffs/overview-summary.html Javadoc (subset) http://cr.openjdk.java.net/~rriggs/filter-javadoc/java/io/ObjectInputStream.html http://cr.openjdk.java.net/~rriggs/filter-javadoc/java/io/ObjectInputFilter.html On 7/25/2016 10:54 AM, Chris Hegarty wrote: > Roger, > > Mainly looks good. Some comments on the spec: > > - Use the Present Simple Tense consistently, e.g. > "Return*S* an ObjectInputFilter computed from a string of patterns." ok > > - ObjectInputFilter. Was there a comment already on the use of links? > For example the following is showing in the javadoc: > "ObjectInputStream.setObjectInputFilter(java.io.ObjectInputFilter)" > when "setObjectInputFilter" would be better. ok, will fix (It would be nice if javadoc had a @linksimple that didn't supply the whole signature). > > Same comment applies to the links to ObjectInputFilter.Status, and > other places. > > - ObjectInputFilter class description. "If set on an > ObjectInputStream, the method*(s)* are called ..." ok > > - Looking at the example in the ObjectInputFilter class description > makes me think that maybe the default process-wide filter should > be a filter that simply returns UNDECIDED, rather than being null. > Is it important to discern whether, or not, it has been set? When writing a customized filter, it is useful to know whether the process-wide filter is has been configured. Usually it is not and there will be a (slight) performance improvement in not calling it and checking the return. > > - ObjectInputFilter.Config > The initial sentence in the class description should describe the > class itself, so maybe " A utility class for ..." ok > > - "process-wide" is this an agreed upon term? I'm just curious where > it came from. Is there a more common term for this? It is useful to distinguish between the filter applied by default to all ObjectInputStreams from one set for a particular stream. I initially used 'global' but that seemed overly broad. The description is used sparingly but I'm open to suggestions. > > - Config.setSerialFilter: SecurityException - if there is security > manager and the SerializablePermission("serialFilter") is not > granted or if there is no securityManager set and the process-wide > filter has already been set non-null > > It is a little odd to throw a SE if there is no SM, no ? True, that would be better as IllegalStateException; updated > > - Is there a class/package level statement covering null, or should > it be covered for each applicable method? Added one. > > - ObjectInputStream > "... the serialization filter for the stream." -> > "... the serialization filter for THIS stream." ok > > - setObjectInputFilter: "The checkInput method is called for each > class and reference in the stream". Does this apply to back > references too? yes, a reference in the stream, as opposed to a new instance in the stream, refers to back references. > > - setObjectInputFilter: "... when the ObjectInputStream is constructed > and CANNOT be re-set until an object has been deserialized." The intent was to prevent it from being modified during deserialization. But I think it will be clearer if it can only be set non-null once and only if the previous value was the pre-configured process-wide filter. I've also had the recommendation that ObjectInputStream.setObjectInputFilter should be protected by the same permission as configuring the process-wide filter. (SerializablePermission("serialFilter")) Roger > > -Chris. > > On 19/07/16 15:02, Roger Riggs wrote: >> Please review the design, implementation, and tests of JEP 290: Filter >> Incoming Serialization Data[1] >> >> It allows incoming streams of object-serialization data to be filtered >> in order to improve both security and robustness. >> The JEP[1] has more detail on the background and scope. >> >> The core mechanism is a filter interface implemented by serialization >> clients and set on an |ObjectInputStream|. The filter is called during >> the deserialization process to validate the classes being deserialized, >> the sizes of arrays being created, and metrics describing stream length, >> stream depth, and number of references as the stream is being decoded. >> >> A process-wide filter can be configured that is applied to every >> ObjectInputStream. >> The API of ObjectInputStream can be used to set a custom filter to >> supersede or augment the process-wide filter. >> >> Webrev: >> http://cr.openjdk.java.net/~rriggs/webrev-serial-filter-jdk9-8155760/ >> >> SpecDiff: >> http://cr.openjdk.java.net/~rriggs/filter-diffs/overview-summary.html >> >> Javadoc (subset) >> http://cr.openjdk.java.net/~rriggs/filter-javadoc/java/io/ObjectInputStream.html >> >> >> http://cr.openjdk.java.net/~rriggs/filter-javadoc/java/io/ObjectInputFilter.html >> >> >> >> Comments appreciated, Roger >> >> [1] JEP 290: https://bugs.openjdk.java.net/browse/JDK-8154961 >> From Roger.Riggs at Oracle.com Mon Jul 25 18:58:19 2016 From: Roger.Riggs at Oracle.com (Roger Riggs) Date: Mon, 25 Jul 2016 14:58:19 -0400 Subject: RFR 9: JEP 290: Filter Incoming Serialization Data In-Reply-To: <7359120b-fd6f-5c1d-ae12-ed784a437b68@oracle.com> References: <7359120b-fd6f-5c1d-ae12-ed784a437b68@oracle.com> Message-ID: Hi Brian, On 7/25/2016 1:05 PM, Brian Goetz wrote: > A few more comments: > > - Do you want to tag OIF as a functional interface? (I think yes, > you intend to use this with lambdas.) ok > > - Need explanation of what happens when someone returns UNDECIDED -- > and perhaps some motivating explanation of why it is there at all, > rather than just returning boolean. I expanded on the explanation in the class javadoc[4]. A filter may be passed a class that is out of the intended scope of the filter and would be misleading for it to report true or false when it did not have correct answer. Or it may be passed no object, only the depth or number of refs and doesn't care about other parameters. The enum result allows the filter to be explicit that it checked its conditions and did not make an arbitrary decision about inputs if it did not care about any of them. > > - Are we sure we want to pass a Class, rather than a class name, to > the filter? Passing a Class means that the serialization layer may > cause the class to be loaded, even if the deserialization is > ultimately rejected -- and therefore a malicious stream can force > class loading (whose may have side-effects.) It would be > nicer if a rejected stream didn't cause extraneous classes to be loaded. Serialization has mechanisms to resolve classes and those are carefully controlled to find the right classloader, etc. Serialization already does class lookups without triggering initialization to avoid early execution. Initialization is (AFAIK) deferred until an instance is created. With a class, the filter can do more interesting and useful checks, for example checking the inheritance and interfaces, and module without having to repeat (correctly) the work done to resolve the class in the right context. Thanks, Roger Links: Webrev: [1] http://cr.openjdk.java.net/~rriggs/webrev-serial-filter-jdk9-8155760/ SpecDiff: [2] http://cr.openjdk.java.net/~rriggs/filter-diffs/overview-summary.html Javadoc (subset) [3] http://cr.openjdk.java.net/~rriggs/filter-javadoc/java/io/ObjectInputStream.html [4] http://cr.openjdk.java.net/~rriggs/filter-javadoc/java/io/ObjectInputFilter.html > > On 7/19/2016 10:02 AM, Roger Riggs wrote: >> Please review the design, implementation, and tests of JEP 290: >> Filter Incoming Serialization Data[1] >> >> It allows incoming streams of object-serialization data to be >> filtered in order to improve both security and robustness. >> The JEP[1] has more detail on the background and scope. >> >> The core mechanism is a filter interface implemented by serialization >> clients and set on an |ObjectInputStream|. The filter is called >> during the deserialization process to validate the classes being >> deserialized, the sizes of arrays being created, and metrics >> describing stream length, stream depth, and number of references as >> the stream is being decoded. >> >> A process-wide filter can be configured that is applied to every >> ObjectInputStream. >> The API of ObjectInputStream can be used to set a custom filter to >> supersede or augment the process-wide filter. >> >> Webrev: >> http://cr.openjdk.java.net/~rriggs/webrev-serial-filter-jdk9-8155760/ >> >> SpecDiff: >> http://cr.openjdk.java.net/~rriggs/filter-diffs/overview-summary.html >> >> Javadoc (subset) >> http://cr.openjdk.java.net/~rriggs/filter-javadoc/java/io/ObjectInputStream.html >> >> http://cr.openjdk.java.net/~rriggs/filter-javadoc/java/io/ObjectInputFilter.html >> >> >> Comments appreciated, Roger >> >> [1] JEP 290: https://bugs.openjdk.java.net/browse/JDK-8154961 >> > From martinrb at google.com Mon Jul 25 19:25:09 2016 From: martinrb at google.com (Martin Buchholz) Date: Mon, 25 Jul 2016 12:25:09 -0700 Subject: RFR: jsr166 jdk9 integration wave 8 In-Reply-To: References: <3da68ea0-7d7e-bf6b-7d72-e833f6a4add4@gmail.com> Message-ID: Wave 8 updated with urgent temporary fix for 8162396: j.u.c java.lang.LinkageError On Thu, Jul 21, 2016 at 1:52 PM, Martin Buchholz wrote: > Thanks! Done. > > On Thu, Jul 21, 2016 at 1:45 PM, Peter Levart > wrote: > >> Hi Martin, >> >> On 07/21/2016 09:07 PM, Martin Buchholz wrote: >> >> Time for the next round. No spec changes! >> http://cr.openjdk.java.net/~martin/webrevs/openjdk9/jsr166-jdk9-integration/ >> >> >> 86 @SuppressWarnings("unchecked") // can now be removed from >> AtomicReference.get(), right? >> >> Regards, Peter >> >> > From Roger.Riggs at Oracle.com Mon Jul 25 19:56:02 2016 From: Roger.Riggs at Oracle.com (Roger Riggs) Date: Mon, 25 Jul 2016 15:56:02 -0400 Subject: RFR:JDK-8066806:java.time.format.DateTimeFormatter cannot parse an offset with single digit hour In-Reply-To: References: <5746AA87.3040501@oracle.com> <5757C25E.9040605@oracle.com> <79e6445f-d482-bd32-5123-c364a5d086eb@Oracle.com> <57593666.2060202@oracle.com> <57594C1E.3080501@oracle.com> <575AA1AB.2080200@oracle.com> <5790B01E.30304@oracle.com> <5791E975.8080105@oracle.com> <5795B398.4000401@oracle.com> Message-ID: <7f556b09-09ea-d495-8db9-e9a096a1eeff@Oracle.com> +1 On 7/25/2016 7:43 AM, Stephen Colebourne wrote: > I don't have any more comments, +1 > Stephen > > On 25 July 2016 at 07:37, nadeesh tv wrote: >> Hi Stephen, >> >> Thanks for the comments. >> Please see the updated webrev >> http://cr.openjdk.java.net/~ntv/8066806/webrev.11/ >> >> Changes: Included the suggestions of Stephen >> >> Thanks and regards, >> Nadeesh >> >> >> >> On 7/22/2016 3:38 PM, Stephen Colebourne wrote: >>> These tests are expected to throw exceptions: >>> >>> test_strict_appendOffsetId() >>> test_strict_appendOffset_1() >>> test_strict_appendOffset_2() >>> test_strict_appendOffset_3() >>> test_strict_appendOffset_4() >>> >>> As such, they should not contain assertEquals(). They should only >>> contain the code that is expected to throw (thus they should not have >>> .get(OFFSET_SECONDS) either). >>> >>> test_strict_offset_adjacentInvalidPattern_parse >>> test_lenient_offset_adjacentInvalidPattern_parse >>> >>> should not have .get(OFFSET_SECONDS) >>> >>> Indentation on line 1621/1622 >>> >>> thanks >>> Stephen >>> >>> >>> On 22 July 2016 at 10:37, nadeesh tv wrote: >>>> Hi Roger, >>>> >>>> Thanks for the comments and sorry for the incorrect link. >>>> >>>> Please see the updated webrev which includes your suggestions. >>>> >>>> http://cr.openjdk.java.net/~ntv/8066806/webrev.10/ >>>> >>>> -- >>>> Thanks and Regards, >>>> Nadeesh TV >>>> >>>> >>>> On 7/21/2016 6:59 PM, Roger Riggs wrote: >>>> >>>> Hi Nadeesh, >>>> >>>> Found the changes in http://cr.openjdk.java.net/~ntv/8066806/webrev.09/ >>>> >>>> Editorial: >>>> " >>>> >>>> In the lenient mode, the parser will be greedy and parse the maximum >>>> digits >>>> possible." >>>> >>>> TCKDateTimeFormatterBuilder.java: >>>> >>>> The lines 1473, 1479, 1485, etc. are way too long, perhaps wrap/break >>>> them >>>> so each line starts with "." >>>> >>>> And wrap any other line longer than 100 chars. (Side by side diffs are >>>> annoying if the lines are too long). >>>> >>>> Otherwise, looks good, >>>> >>>> Thanks, Roger >>>> >>>> >>>> On 7/21/2016 7:21 AM, nadeesh tv wrote: >>>> >>>> Hi, >>>> >>>> Please see the updated webrev >>>> >>>> http://cr.openjdk.java.net/~ntv/8066806/webrev.08/ >>>> >>>> Changes in this webrev: >>>> For leninent mode , doc change in DateTimeFormatterBuilder.java >>>> " >>>> >>>> In the lenient mode, parser will be greedy and parse maximum digits >>>> possible. >>>> " >>>> >>>> Added new test cases for lenient mode. >>>> >>>> >>>> >>>> -- >>>> Thanks and Regards, >>>> Nadeesh TV >>>> >> -- >> Thanks and Regards, >> Nadeesh TV >> From huizhe.wang at oracle.com Mon Jul 25 23:53:53 2016 From: huizhe.wang at oracle.com (huizhe wang) Date: Mon, 25 Jul 2016 16:53:53 -0700 Subject: RFR (JAXP) JDK-8067170: Enable security manager on JAXP unit tests In-Reply-To: <024a01d1e659$7dcefcd0$796cf670$@oracle.com> References: <022401d1e0d7$54111090$fc3331b0$@oracle.com> <578CA476.7030407@oracle.com> <03a601d1e3e6$92c45a60$b84d0f20$@oracle.com> <040101d1e3f9$9d19a340$d74ce9c0$@oracle.com> <88977a21-e4d1-e792-00db-1debc3162b08@oracle.com> <024a01d1e659$7dcefcd0$796cf670$@oracle.com> Message-ID: <27ea3634-6e47-70e9-4099-69bd86d3d635@oracle.com> On 7/25/2016 2:46 AM, Frank Yuan wrote: >> -----Original Message----- >> From: huizhe wang [mailto:huizhe.wang at oracle.com] >> Subject: Re: RFR (JAXP) JDK-8067170: Enable security manager on JAXP unit tests >> >> >> >> On 7/22/2016 5:53 AM, Daniel Fuchs wrote: >>> On 22/07/16 10:15, Frank Yuan wrote: >>>> Hi Daniel >>>> >>>> Thank you very much for your review and the comments! >>>> >>>>> -----Original Message----- >>>>> From: Daniel Fuchs [mailto:daniel.fuchs at oracle.com] >>>>> Subject: Re: RFR (JAXP) JDK-8067170: Enable security manager on JAXP >>>>> unit tests >>>>> >>>>> Hi Frank, >>>>> >>>>> I see that in order to be able to run the tests, you were forced >>>>> to add a few permissions that the test/test infrastructure need >>>>> to setup things: >>>>> >>>>> These are quite powerful permissions, and adding them by default >>>>> also means that you might miss a bug - if e.g. a doPrivileged is >>>>> missing somewhere in the JAXP code when jaxp tries to e.g. get/create >>>>> a classloader, or read a system property, you might not see >>>>> it. >> Very true. Some of these permissions came from our standalone JAXP tests >> that were granted to ant and junit. >> >>>> Yes, I agree completely. I would control the permission assignment >>>> more tightly: >>>> 1. only allow the following necessary permissions in default: >>>> addPermission(new SecurityPermission("getPolicy")); >>>> addPermission(new SecurityPermission("setPolicy")); >>>> addPermission(new RuntimePermission("setSecurityManager")); >> These are safe for the current code base. So may be add a note to remind >> for any future changes. >> >>>> 2. other permissions in current default set are commonly used for the >>>> tests, so I would add more Policy classes like existing >>>> FilePolicy, etc. >>>> //ClassLoaderPolicy, an individual test may only require some of >>>> them, but I would put them in only one class if you agree >>>> addPermission(new RuntimePermission("getClassLoader")); >>>> addPermission(new RuntimePermission("createClassLoader")); >>>> addPermission(new RuntimePermission("modifyThread")); >>>> >>>> How about you think? >> My understanding is that you intend to grand specific permissions >> limited to the test that will extend these policies, e.g. FilePolicy. I >> think this is ok and an improvement. >> >>> It would definitely improve things - but then all the classes >>> in the test that runs with this new policy class will inherit >>> from these permissions as well. This may or may not be an issue. >>> (I confess I haven't looked at all the webrev ;-() > I will reduce the scope of the extra permissions as possible, and make sure the safety, e.g. surround the user code(i.e. the test > code) which requires a permission explicitly with corresponding permission assignment > >> Yeah, it would be good to make sure a policy is safe with the code. If >> both the test code and the code may need a permission, we may have a >> conflict that we need to solve. It may be good to start with the basic >> permission, and add only if required by the test code, with a note >> preferably noting what exactly is needed. "DefaultFeaturesTest" in this >> regard, doesn't seem to require FilePolicy, but >> CatalogReferCircularityTest requires permission to where the source >> files are located, in this case, it would be good to make it specific. >> For example, instead of being called "FilePolicy", it may be clearer to >> add a parameter so that it's known where the File permission is given >> (e.g. the source dir in this case). > Currently FilePolicy(maybe it's better to rename to TestFilePolicy) has full access permission to user.dir and read permission to > test.src, I think they belong to user permission, jaxp lib won't doPrivileged on this. > Btw, it's unable to add parameter in @Listeners({ xxx.class }) unless using more tricky and complex means. > > I believe I will meet problem to identify if a doPrivileged is missing when I strip the extra permissions and then solve the test > failures case by case, so I would ask you when should we add doPrivileged in jaxp/jdk library code? > 1. Should doPrivileged only for where the permission can't be granted to the user code, e.g. read some secret system property > 2. Or should doPrivileged for where the permission needn't be granted to the user code, e.g. read some internal property The library code shall have *minimal permission* to perform operations as required by the *specification/javadoc*. The tests should avoid blanket permission so as to expose issues in the code they test. For example, the Catalog API specified several System properties. It therefore shall give privilege to reading those and only those System properties. To verify that the code performs properly when Security Manager is present, a blanket permission, e.g. new PropertyPermission("*", "read, write"), should be avoided. Note that when this permission is removed from the BasePolicy, FilePolicy won't run since it requires permission to read "user.dir". To avoid having to grant the permission, the test may choose to read the property before setting the SecurityManager. You might not be able to use TestNG Listeners in such case, or maybe you can by initializing the properties before the test starts. Furthermore, the spec also requires that relative file paths be resolved to "user.dir", another reason not to grant that property permission in test. However, the test does need to give FilePermission to any user files. So FilePermission to user.dir and test.src are fine. Thanks, Joe > > > Frank > >> Best, >> Joe >> From martinrb at google.com Tue Jul 26 00:46:04 2016 From: martinrb at google.com (Martin Buchholz) Date: Mon, 25 Jul 2016 17:46:04 -0700 Subject: RFR: JDK-8044629: (reflect) Constructor.getAnnotatedReceiverType() returns wrong value In-Reply-To: References: <1B51A5CD-A909-42C4-97D1-1F8F5DFE55D2@oracle.com> <9E339B30-A01D-4427-A2D1-A0E96E5A978C@oracle.com> <20140813085406.GD22209@oracle.com> Message-ID: I filed a couple of bugs. Here's a relevant JIRA search: https://bugs.openjdk.java.net/issues/?jql=Subcomponent%20%3D%20java.lang%3Areflect%20AND%20watcher%20%3D%20martin Because of the trickiness of local vs inner classes, Alex may want to make a decision on the correct behavior. On Fri, Jul 22, 2016 at 6:11 PM, Martin Buchholz wrote: > Bug 8029042: Receiver parameter not supported on local class constructor > also suggests that a local class of an instance method "is a perfectly > good inner class" and so getAnnotatedReceiverType should treat them > equivalently. > > On Thu, Jul 21, 2016 at 11:50 AM, Joel Borggr?n-Franck < > joel.borggren.franck at gmail.com> wrote: > >> This is the first time I noticed the second paragraph of $14.3, strange >> indeed! I'd ping compiler-dev with this, Alex will probably know if this is >> a spec bug in $14.3 or just an irregularity. >> >> Cheers >> /Joel >> >> On Jul 21, 2016 20:39, "Martin Buchholz" wrote: >> >>> Joel, Thanks for responding so quickly! >>> >>> Here' s a slightly modified version of my repro recipe: >>> You can see that local classes in instance methods have a receiver type, >>> just like a member inner class. >>> local classes in static methods (naturally!) do not. I expect the two >>> flavors of local classes to be treated differently. >>> >>> I've never understood why >>> """All local classes are inner classes""" >>> (even in a static method?) >>> https://docs.oracle.com/javase/specs/jls/se8/html/jls-14.html#jls-14.3 >>> >>> >>> import java.lang.reflect.Constructor; >>> >>> public class LocalClassReceiverTypeBug { >>> public static void main(String[] args) throws Throwable { >>> class StaticLocal {} >>> printConstructor(StaticLocal.class); >>> new LocalClassReceiverTypeBug().instanceMain(); >>> } >>> >>> public void instanceMain() throws Throwable { >>> class InstanceLocal {} >>> printConstructor(InstanceLocal.class); >>> printConstructor(Inner.class); >>> // printConstructor(Nested.class); >>> } >>> >>> static class Nested {} >>> class Inner {} >>> >>> static void printConstructor(Class klazz) { >>> Constructor[] constructors = klazz.getDeclaredConstructors(); >>> if (constructors.length != 1) throw new AssertionError(); >>> Constructor constructor = constructors[0]; >>> System.out.printf("constructor=%s receivertype=%s%n", >>> constructor, >>> constructor.getAnnotatedReceiverType()); >>> } >>> } >>> ==> javac -source 9 -Xlint:all LocalClassReceiverTypeBug.java >>> ==> java -esa -ea LocalClassReceiverTypeBug >>> constructor=LocalClassReceiverTypeBug$1StaticLocal() receivertype=null >>> constructor=LocalClassReceiverTypeBug$1InstanceLocal(LocalClassReceiverTypeBug) >>> receivertype=null >>> constructor=LocalClassReceiverTypeBug$Inner(LocalClassReceiverTypeBug) >>> receivertype=sun.reflect.annotation.AnnotatedTypeFactory$AnnotatedTypeBaseImpl at 1810399e >>> >>> >>> On Thu, Jul 21, 2016 at 11:16 AM, Joel Borggr?n-Franck < >>> joel.borggren.franck at gmail.com> wrote: >>> >>>> Hi Martin, >>>> >>>> I'm away from my workstation at the moment, so this is from memory. >>>> IIRC a local class is pure scoping and lacks an "outer this" which is what >>>> you annotate for constructors. There should not be receiver type to >>>> annotate. Since I can't run your code I can't see what's wrong but I might >>>> be able to help if you paste the output from a run. >>>> >>>> Cheers >>>> /Joel >>>> >>>> On Jul 21, 2016 19:49, "Martin Buchholz" wrote: >>>> >>>>> Hi Joel, Paul, >>>>> >>>>> A coworker ran into the change of behavior here in jdk9. >>>>> Specifically, we noticed that a local class constructor has a receiver >>>>> parameter, but getAnnotatedReceiverType returns null. The changed jdk9 >>>>> spec is actually very clear about that: >>>>> >>>>> >>>>> http://download.java.net/java/jdk9/docs/api/java/lang/reflect/Constructor.html#getAnnotatedReceiverType-- >>>>> """If this Executable object represents a static method or represents >>>>> a constructor of a top level, static member, local, or anonymous class, >>>>> then the return value is null.""" >>>>> >>>>> BUT we can't think of any reason WHY a local inner class would be >>>>> treated differently from an inner member class. Why not the simple and >>>>> obvious rule: if there is a receiver parameter, return an appropriate >>>>> non-null AnnotatedType? >>>>> >>>>> You already have an excellent jtreg test, but here's what I was >>>>> playing with: >>>>> >>>>> import java.lang.reflect.Constructor; >>>>> >>>>> public class LocalClassReceiverTypeBug { >>>>> public static void main(String[] args) throws Throwable { >>>>> class StaticLocal {} >>>>> printConstructor(StaticLocal.class); >>>>> new LocalClassReceiverTypeBug().instanceMain(); >>>>> } >>>>> >>>>> public void instanceMain() throws Throwable { >>>>> class InstanceLocal {} >>>>> printConstructor(InstanceLocal.class); >>>>> printConstructor(Inner.class); >>>>> printConstructor(Nested.class); >>>>> } >>>>> >>>>> static class Nested {} >>>>> class Inner {} >>>>> >>>>> static void printConstructor(Class klazz) { >>>>> Constructor[] constructors = >>>>> klazz.getDeclaredConstructors(); >>>>> if (constructors.length != 1) throw new AssertionError(); >>>>> System.out.printf("constructor=%s%n", constructors[0]); >>>>> System.out.printf("receiver type=%s%n", >>>>> constructors[0].getAnnotatedReceiverType()); >>>>> } >>>>> } >>>>> >>>>> >>>>> >>>>> On Wed, Aug 13, 2014 at 1:54 AM, Joel Borggren-Franck < >>>>> joel.franck at oracle.com> wrote: >>>>> >>>>>> Hi Paul, >>>>>> >>>>>> On 2014-06-24, Paul Sandoz wrote: >>>>>> > >>>>>> > On Jun 17, 2014, at 6:52 PM, Joel Borggr?n-Franck < >>>>>> joel.franck at oracle.com> wrote: >>>>>> > > >>>>>> > > Can I get a review for this fix and javadoc clarification for >>>>>> https://bugs.openjdk.java.net/browse/JDK-8044629 >>>>>> > > >>>>>> > >>>>>> > +1 >>>>>> > >>>>>> > I never quite realised just how convoluted it was to determine that >>>>>> a class is an inner class. >>>>>> >>>>>> Neither did I until I had to implement it :) >>>>>> >>>>>> cheers >>>>>> /Joel >>>>>> >>>>> >>>>> >>> > From daniel.fuchs at oracle.com Tue Jul 26 00:47:03 2016 From: daniel.fuchs at oracle.com (Daniel Fuchs) Date: Tue, 26 Jul 2016 01:47:03 +0100 Subject: RFR (JAXP) JDK-8067170: Enable security manager on JAXP unit tests In-Reply-To: <27ea3634-6e47-70e9-4099-69bd86d3d635@oracle.com> References: <022401d1e0d7$54111090$fc3331b0$@oracle.com> <578CA476.7030407@oracle.com> <03a601d1e3e6$92c45a60$b84d0f20$@oracle.com> <040101d1e3f9$9d19a340$d74ce9c0$@oracle.com> <88977a21-e4d1-e792-00db-1debc3162b08@oracle.com> <024a01d1e659$7dcefcd0$796cf670$@oracle.com> <27ea3634-6e47-70e9-4099-69bd86d3d635@oracle.com> Message-ID: On 26/07/16 00:53, huizhe wang wrote: > To avoid having to grant the permission, the test may choose to read the > property before setting the SecurityManager. You might not be able to > use TestNG Listeners in such case, or maybe you can by initializing the > properties before the test starts. Or you can use my trick with an AtomicBoolean for such cases: set allowAll to true try { read system property } finally { set allowAll to false (or to the value it had before) } Adding a ThreadLocal allowAll to BasePolicy for that purpose is very easy :-) That should ensure that you only need to give those permissions to the test that a regular user of the JAXP API would need to use the JAXP API. If the test read/writes an XML document from file, then the FilePermission to read/write that document is something that a regular user of JAXP would need. So those permission should be granted to the test through Policy. If the test reads/writes a system property or creates a directory or create a class loader to set up an initial configuration for the test to run, then this is not something a regular user of the JAXP API would need - so it would then be legitimate to perform this setup inside a block that sets allowAll to true to locally escape permissions checks during this setup, thus avoiding to grant those permissions to all in the Policy (alternatively you could use your tmpPermissions trick to do that as well - but it is a bit more complex and adds more clutter than a simple on/off switch). cheers, -- daniel From frank.yuan at oracle.com Tue Jul 26 03:24:59 2016 From: frank.yuan at oracle.com (Frank Yuan) Date: Tue, 26 Jul 2016 11:24:59 +0800 Subject: RFR (JAXP) JDK-8067170: Enable security manager on JAXP unit tests In-Reply-To: References: <022401d1e0d7$54111090$fc3331b0$@oracle.com> <578CA476.7030407@oracle.com> <03a601d1e3e6$92c45a60$b84d0f20$@oracle.com> <040101d1e3f9$9d19a340$d74ce9c0$@oracle.com> <88977a21-e4d1-e792-00db-1debc3162b08@oracle.com> <024a01d1e659$7dcefcd0$796cf670$@oracle.com> <27ea3634-6e47-70e9-4099-69bd86d3d635@oracle.com> Message-ID: <027101d1e6ed$5107d340$f31779c0$@oracle.com> Hi Joe and Daniel Thank you very much for your suggestions! Now I fully understand the rule(at least I think so :P) I will use a runWithAllPerm block surrounding the user setup code as Daniel's way. Btw, Daniel, ThreadLocal should not need Atomic any more, correct? Frank > -----Original Message----- > From: Daniel Fuchs [mailto:daniel.fuchs at oracle.com] > Sent: Tuesday, July 26, 2016 8:47 AM > To: huizhe wang; Frank Yuan > Cc: 'Amy Lu'; 'core-libs-dev' > Subject: Re: RFR (JAXP) JDK-8067170: Enable security manager on JAXP unit tests > > On 26/07/16 00:53, huizhe wang wrote: > > To avoid having to grant the permission, the test may choose to read the > > property before setting the SecurityManager. You might not be able to > > use TestNG Listeners in such case, or maybe you can by initializing the > > properties before the test starts. > > Or you can use my trick with an AtomicBoolean for such cases: > > set allowAll to true > try { > read system property > } finally { > set allowAll to false (or to the value it had before) > } > > Adding a ThreadLocal allowAll to BasePolicy > for that purpose is very easy :-) > > That should ensure that you only need to give those permissions > to the test that a regular user of the JAXP API would need to > use the JAXP API. > > If the test read/writes an XML document from file, then the > FilePermission to read/write that document is something that > a regular user of JAXP would need. So those permission should > be granted to the test through Policy. > > If the test reads/writes a system property or creates a directory > or create a class loader to set up an initial configuration for > the test to run, then this is not something a regular user of the > JAXP API would need - so it would then be legitimate to perform this > setup inside a block that sets allowAll to true to locally escape > permissions checks during this setup, thus avoiding to grant those > permissions to all in the Policy (alternatively you could use your > tmpPermissions trick to do that as well - but it is a bit more > complex and adds more clutter than a simple on/off switch). > > cheers, > > -- daniel From huizhe.wang at oracle.com Tue Jul 26 06:40:00 2016 From: huizhe.wang at oracle.com (huizhe wang) Date: Mon, 25 Jul 2016 23:40:00 -0700 Subject: JAXP: XSLTC transformer swallows empty namespace declaration which is necessary to undeclare default namespace In-Reply-To: References: Message-ID: <0c9cf7ff-18c5-1c09-4ee5-29650b33c695@oracle.com> On 7/22/2016 3:38 AM, Langer, Christoph wrote: > Hi, > > I have a customer reporting the following phenomena which I believe is an issue. > > Consider the following xsl: > > ---------------------XSL--------------------- > > > > > > > > > > > > ---------------------End of XSL--------------------- > > > This is the XML snippet where the XSL gets applied (just a dummy): > > > The result with the current XSLTC is: > > But this would not undeclare the default namespace "ns1" from the element named "root" for the element named "test" which was the intention of the xsl. So I believe it should be: > > > Looking at the coding I came up with the following: http://cr.openjdk.java.net/~clanger/webrevs/xsltc-namespaceissue/ With that, XSLTC would also emit the namespace attribute for an empty namespace. It works for my example but I'm not sure if it is the right thing to do or if it breaks things at other places and violates specs elsewhere. I'm not sure why empty namespace was explicitly excluded. But for the 2nd part, the developer was clear with a note on the intention. You may want to try removing the condition statement that excluded the empty namespace, but keep the 2nd part as is, and then run the tests to see if there's any issue or a reason why it was excluded. > > Comparing with the Apache Xalan, I can see that the Apache XSLTC matches the JDK XSLTC behavior to suppress the namespace declaration but the interpretative transformer (org.apache.xalan.processor.TransformerFactoryImpl) would emit the namespace attribute. Ok, the interpretative may be correct. On another thought, if the following workaround works for you, we may as well leave the current implementation as is: try replacing in the above, with " Thanks, Joe > > Please give me some comments before I open a Bug... > > Thanks a lot in advance > Christoph > From daniel.fuchs at oracle.com Tue Jul 26 07:46:28 2016 From: daniel.fuchs at oracle.com (Daniel Fuchs) Date: Tue, 26 Jul 2016 08:46:28 +0100 Subject: RFR (JAXP) JDK-8067170: Enable security manager on JAXP unit tests In-Reply-To: <027101d1e6ed$5107d340$f31779c0$@oracle.com> References: <022401d1e0d7$54111090$fc3331b0$@oracle.com> <578CA476.7030407@oracle.com> <03a601d1e3e6$92c45a60$b84d0f20$@oracle.com> <040101d1e3f9$9d19a340$d74ce9c0$@oracle.com> <88977a21-e4d1-e792-00db-1debc3162b08@oracle.com> <024a01d1e659$7dcefcd0$796cf670$@oracle.com> <27ea3634-6e47-70e9-4099-69bd86d3d635@oracle.com> <027101d1e6ed$5107d340$f31779c0$@oracle.com> Message-ID: <903949ef-50a5-ccd9-07cd-ebdd65d65fa5@oracle.com> On 26/07/16 04:24, Frank Yuan wrote: > Thank you very much for your suggestions! Now I fully understand the rule(at least I think so :P) > I will use a runWithAllPerm block surrounding the user setup code as Daniel's way. Btw, Daniel, ThreadLocal should not need Atomic > any more, correct? > Hi Frank, runWithAllPerm is another way to do it. It uses a ThreadLocal, right? I agree it's adequate. Just be careful of what might happen if you run runWithAllPerm inside runWithPermissions, or runWithPermissions(runnable, a,b,c) with a runnable that later calls runWithPermission(runnable2, a, d, e) further down the road. At the moment I'm not sure whether your code will work correctly in the presence of such nested invocation (maybe it does), but because it seems to be index based it's not immediately obvious (I'm not asking you to change it - just to verify and confirm that it's something you have taken into account, and that you're confident that it works). Best regards, -- daniel From frank.yuan at oracle.com Tue Jul 26 08:23:08 2016 From: frank.yuan at oracle.com (Frank Yuan) Date: Tue, 26 Jul 2016 16:23:08 +0800 Subject: RFR (JAXP) JDK-8067170: Enable security manager on JAXP unit tests In-Reply-To: <903949ef-50a5-ccd9-07cd-ebdd65d65fa5@oracle.com> References: <022401d1e0d7$54111090$fc3331b0$@oracle.com> <578CA476.7030407@oracle.com> <03a601d1e3e6$92c45a60$b84d0f20$@oracle.com> <040101d1e3f9$9d19a340$d74ce9c0$@oracle.com> <88977a21-e4d1-e792-00db-1debc3162b08@oracle.com> <024a01d1e659$7dcefcd0$796cf670$@oracle.com> <27ea3634-6e47-70e9-4099-69bd86d3d635@oracle.com> <027101d1e6ed$5107d340$f31779c0$@oracle.com> <903949ef-50a5-ccd9-07cd-ebdd65d65fa5@oracle.com> Message-ID: <034e01d1e716$f59207e0$e0b617a0$@oracle.com> Hi Daniel I didn't state clear, actually, I want/wanted to take the absolutely same way as your allowAll except I am going to add a common function(called runWithAllPerm) to run it, no Permission arguments any longer. I will send you a draft to you and Joe to make it clear before I finish all rework. Thanks Frank > -----Original Message----- > From: Daniel Fuchs [mailto:daniel.fuchs at oracle.com] > Sent: Tuesday, July 26, 2016 3:46 PM > To: Frank Yuan; 'huizhe wang' > Cc: 'Amy Lu'; 'core-libs-dev' > Subject: Re: RFR (JAXP) JDK-8067170: Enable security manager on JAXP unit tests > > On 26/07/16 04:24, Frank Yuan wrote: > > Thank you very much for your suggestions! Now I fully understand the rule(at least I think so :P) > > I will use a runWithAllPerm block surrounding the user setup code as Daniel's way. Btw, Daniel, ThreadLocal should not need Atomic > > any more, correct? > > > > Hi Frank, > > runWithAllPerm is another way to do it. > It uses a ThreadLocal, right? > > I agree it's adequate. Just be careful of what might > happen if you run runWithAllPerm inside runWithPermissions, > or runWithPermissions(runnable, a,b,c) with a runnable that > later calls runWithPermission(runnable2, a, d, e) further down > the road. > > At the moment I'm not sure whether your code will work correctly > in the presence of such nested invocation (maybe it does), > but because it seems to be index based it's not immediately > obvious (I'm not asking you to change it - just to verify and > confirm that it's something you have taken into account, and > that you're confident that it works). > > > Best regards, > > -- daniel From Alan.Bateman at oracle.com Tue Jul 26 09:44:03 2016 From: Alan.Bateman at oracle.com (Alan Bateman) Date: Tue, 26 Jul 2016 10:44:03 +0100 Subject: [JAXP] RFR: 8153082: Update XSTL compiler to generate classes that invoke addReads In-Reply-To: <72250ada-17ae-8064-eb4e-8b53a2d36c63@oracle.com> References: <74b953e2-f07e-afa8-80d0-f55014780f94@oracle.com> <22a6662f4b8440a5860ee8f3dfdc55e6@DEWDFE13DE11.global.corp.sap> <72250ada-17ae-8064-eb4e-8b53a2d36c63@oracle.com> Message-ID: <85203b09-1ca9-8881-d323-8f89eea562c3@oracle.com> On 25/07/2016 18:21, Daniel Fuchs wrote: > Hi, > > Here is the later version of the fix: > > - Header files fixed > - Bytecode 1.1 compatible > > http://cr.openjdk.java.net/~dfuchs/webrev_8153082/webrev.02/ This looks okay to me although I think I'd like to understand more as to why this needs to emit v45 classes (something for another issue). -Alan From daniel.fuchs at oracle.com Tue Jul 26 11:50:56 2016 From: daniel.fuchs at oracle.com (Daniel Fuchs) Date: Tue, 26 Jul 2016 12:50:56 +0100 Subject: [JAXP] RFR: 8153082: Update XSTL compiler to generate classes that invoke addReads In-Reply-To: <85203b09-1ca9-8881-d323-8f89eea562c3@oracle.com> References: <74b953e2-f07e-afa8-80d0-f55014780f94@oracle.com> <22a6662f4b8440a5860ee8f3dfdc55e6@DEWDFE13DE11.global.corp.sap> <72250ada-17ae-8064-eb4e-8b53a2d36c63@oracle.com> <85203b09-1ca9-8881-d323-8f89eea562c3@oracle.com> Message-ID: <2fc56d32-e3ca-56a3-dc53-c31116a25d09@oracle.com> On 26/07/16 10:44, Alan Bateman wrote: > On 25/07/2016 18:21, Daniel Fuchs wrote: > >> Hi, >> >> Here is the later version of the fix: >> >> - Header files fixed >> - Bytecode 1.1 compatible >> >> http://cr.openjdk.java.net/~dfuchs/webrev_8153082/webrev.02/ > This looks okay to me although I think I'd like to understand more as to > why this needs to emit v45 classes (something for another issue). Thanks Alan. I logged https://bugs.openjdk.java.net/browse/JDK-8162527 to track it. best regards, -- daniel > > -Alan From christoph.langer at sap.com Tue Jul 26 11:56:41 2016 From: christoph.langer at sap.com (Langer, Christoph) Date: Tue, 26 Jul 2016 11:56:41 +0000 Subject: JAXP: XSLTC transformer swallows empty namespace declaration which is necessary to undeclare default namespace In-Reply-To: <0c9cf7ff-18c5-1c09-4ee5-29650b33c695@oracle.com> References: <0c9cf7ff-18c5-1c09-4ee5-29650b33c695@oracle.com> Message-ID: Hi Joe, thanks for looking at this. Here is my comments: > I'm not sure why empty namespace was explicitly excluded. But for the > 2nd part, the developer was clear with a note on the intention. You may > want to try removing the condition statement that excluded the empty > namespace, but keep the 2nd part as is, and then run the tests to see if > there's any issue or a reason why it was excluded. You are right, the comment for the second part is quite explicit. However, the method declaresDefaultNS() of XslElement always returns false and the comment to it says: "This method is now deprecated. The new implemation of this class never declares the default NS". As I didn't find any other class in the hierarchy overwriting this method, I decided to remove it and to cleanup code. Are you ok with that or is it illegal here? > On another thought, if the following workaround works for you, we may as > well leave the current implementation as is: > try replacing in the above, with name=\"test\" namespace=\"\" />" This might work, however, the customer wants to change his current XML toolkit to the JDK one and expects his existing XML/XSL code to work as is. So that's no option. I'll go open a bug for that now and prepare a real review. Best regards Christoph From daniel.fuchs at oracle.com Tue Jul 26 13:47:23 2016 From: daniel.fuchs at oracle.com (Daniel Fuchs) Date: Tue, 26 Jul 2016 14:47:23 +0100 Subject: JAXP: XSLTC transformer swallows empty namespace declaration which is necessary to undeclare default namespace In-Reply-To: References: <0c9cf7ff-18c5-1c09-4ee5-29650b33c695@oracle.com> Message-ID: <2b078b1f-1a90-07ad-026f-5bf9dc2764fc@oracle.com> Hi Christoph, Joe, Actually what I see with the latest dev version of JDK 9 (eng. build built a few minutes ago) is this: Notice that xmlns="ns1" appears twice in the root element. So maybe there's more than one bug here :-( cheers, -- daniel On 26/07/16 12:56, Langer, Christoph wrote: > Hi Joe, > > thanks for looking at this. > > Here is my comments: >> I'm not sure why empty namespace was explicitly excluded. But for the >> 2nd part, the developer was clear with a note on the intention. You may >> want to try removing the condition statement that excluded the empty >> namespace, but keep the 2nd part as is, and then run the tests to see if >> there's any issue or a reason why it was excluded. > > You are right, the comment for the second part is quite explicit. However, the method declaresDefaultNS() of XslElement always returns false and the comment to it says: "This method is now deprecated. The new implemation of this class never declares the default NS". As I didn't find any other class in the hierarchy overwriting this method, I decided to remove it and to cleanup code. Are you ok with that or is it illegal here? > > >> On another thought, if the following workaround works for you, we may as >> well leave the current implementation as is: >> try replacing in the above, with > name=\"test\" namespace=\"\" />" > > This might work, however, the customer wants to change his current XML toolkit to the JDK one and expects his existing XML/XSL code to work as is. So that's no option. > > I'll go open a bug for that now and prepare a real review. > > Best regards > Christoph > From christoph.langer at sap.com Tue Jul 26 13:53:46 2016 From: christoph.langer at sap.com (Langer, Christoph) Date: Tue, 26 Jul 2016 13:53:46 +0000 Subject: JAXP: XSLTC transformer swallows empty namespace declaration which is necessary to undeclare default namespace In-Reply-To: <2b078b1f-1a90-07ad-026f-5bf9dc2764fc@oracle.com> References: <0c9cf7ff-18c5-1c09-4ee5-29650b33c695@oracle.com> <2b078b1f-1a90-07ad-026f-5bf9dc2764fc@oracle.com> Message-ID: <122d925d174842e3befd05bec57f556f@DEWDFE13DE11.global.corp.sap> Hi Daniel, you mean with my webrev built in or with the current jdk9 dev? Best Christoph > -----Original Message----- > From: Daniel Fuchs [mailto:daniel.fuchs at oracle.com] > Sent: Dienstag, 26. Juli 2016 15:47 > To: Langer, Christoph ; huizhe wang > > Cc: core-libs-dev at openjdk.java.net > Subject: Re: JAXP: XSLTC transformer swallows empty namespace declaration > which is necessary to undeclare default namespace > > Hi Christoph, Joe, > > Actually what I see with the latest dev version of > JDK 9 (eng. build built a few minutes ago) is this: > > xmlns="ns1"> > > Notice that xmlns="ns1" appears twice in the root element. > > So maybe there's more than one bug here :-( > > cheers, > > -- daniel > > On 26/07/16 12:56, Langer, Christoph wrote: > > Hi Joe, > > > > thanks for looking at this. > > > > Here is my comments: > >> I'm not sure why empty namespace was explicitly excluded. But for the > >> 2nd part, the developer was clear with a note on the intention. You may > >> want to try removing the condition statement that excluded the empty > >> namespace, but keep the 2nd part as is, and then run the tests to see if > >> there's any issue or a reason why it was excluded. > > > > You are right, the comment for the second part is quite explicit. However, the > method declaresDefaultNS() of XslElement always returns false and the > comment to it says: "This method is now deprecated. The new implemation of > this class never declares the default NS". As I didn't find any other class in the > hierarchy overwriting this method, I decided to remove it and to cleanup code. > Are you ok with that or is it illegal here? > > > > > >> On another thought, if the following workaround works for you, we may as > >> well leave the current implementation as is: > >> try replacing in the above, with >> name=\"test\" namespace=\"\" />" > > > > This might work, however, the customer wants to change his current XML > toolkit to the JDK one and expects his existing XML/XSL code to work as is. So > that's no option. > > > > I'll go open a bug for that now and prepare a real review. > > > > Best regards > > Christoph > > From daniel.fuchs at oracle.com Tue Jul 26 13:56:36 2016 From: daniel.fuchs at oracle.com (Daniel Fuchs) Date: Tue, 26 Jul 2016 14:56:36 +0100 Subject: JAXP: XSLTC transformer swallows empty namespace declaration which is necessary to undeclare default namespace In-Reply-To: <122d925d174842e3befd05bec57f556f@DEWDFE13DE11.global.corp.sap> References: <0c9cf7ff-18c5-1c09-4ee5-29650b33c695@oracle.com> <2b078b1f-1a90-07ad-026f-5bf9dc2764fc@oracle.com> <122d925d174842e3befd05bec57f556f@DEWDFE13DE11.global.corp.sap> Message-ID: <98197a4d-651f-9023-f0fd-24e6f6e72940@oracle.com> Hi Christoph, On 26/07/16 14:53, Langer, Christoph wrote: > Hi Daniel, > > you mean with my webrev built in or with the current jdk9 dev? With the current jdk9 dev - sorry if that was unclear. cheers, -- daniel public static void main(String[] args) throws XMLStreamException, TransformerConfigurationException, TransformerException { TransformerFactory trans = TransformerFactory.newInstance(); XMLInputFactory input = XMLInputFactory.newFactory(); XMLOutputFactory output = XMLOutputFactory.newFactory(); XMLEventReader reader = input.createXMLEventReader(XSLTTest.class.getResourceAsStream("test.xsl")); StAXSource source = new StAXSource(reader); Templates temp = trans.newTemplates(source); StAXResult result = new StAXResult(output.createXMLEventWriter(System.out)); temp.newTransformer().transform( new StAXSource(input.createXMLEventReader(XSLTTest.class.getResourceAsStream("test.xml"))), result); } > > Best > Christoph From daniel.fuchs at oracle.com Tue Jul 26 14:08:05 2016 From: daniel.fuchs at oracle.com (Daniel Fuchs) Date: Tue, 26 Jul 2016 15:08:05 +0100 Subject: JAXP: XSLTC transformer swallows empty namespace declaration which is necessary to undeclare default namespace In-Reply-To: <122d925d174842e3befd05bec57f556f@DEWDFE13DE11.global.corp.sap> References: <0c9cf7ff-18c5-1c09-4ee5-29650b33c695@oracle.com> <2b078b1f-1a90-07ad-026f-5bf9dc2764fc@oracle.com> <122d925d174842e3befd05bec57f556f@DEWDFE13DE11.global.corp.sap> Message-ID: On 26/07/16 14:53, Langer, Christoph wrote: > you mean with my webrev built in or with the current jdk9 dev? ... and with your patch applied I see this: cheers, -- daniel From paul.sandoz at oracle.com Tue Jul 26 15:07:09 2016 From: paul.sandoz at oracle.com (Paul Sandoz) Date: Tue, 26 Jul 2016 17:07:09 +0200 Subject: RFR: jsr166 jdk9 integration wave 8 In-Reply-To: References: <3da68ea0-7d7e-bf6b-7d72-e833f6a4add4@gmail.com> Message-ID: <695CD40B-3FA6-4FCE-8A5B-67A506520A15@oracle.com> > On 25 Jul 2016, at 21:25, Martin Buchholz wrote: > > Wave 8 updated with urgent temporary fix for > 8162396: j.u.c java.lang.LinkageError > Thank you for doing that. +1 JPRT run passed. Paul. From chris.hegarty at oracle.com Tue Jul 26 15:24:00 2016 From: chris.hegarty at oracle.com (Chris Hegarty) Date: Tue, 26 Jul 2016 16:24:00 +0100 Subject: RFR [9] 8160513: ClassNotFoundException sun.misc.GC when running Tomcat 9 with JDK 9 Message-ID: The GC.Daemon thread has no need of any user defined class loader, so should set its context class loader to null before starting, so as to not inadvertently retain a reference to the creating thread?s context class loader. http://cr.openjdk.java.net/~chegar/8160513/ https://bugs.openjdk.java.net/browse/JDK-8160513 -Chris. P.S. I added a detailed comment the JIRA issue, for those wondering why Tomcat is running into this. From chris.hegarty at oracle.com Tue Jul 26 16:20:33 2016 From: chris.hegarty at oracle.com (Chris Hegarty) Date: Tue, 26 Jul 2016 17:20:33 +0100 Subject: RFR 9: JEP 290: Filter Incoming Serialization Data In-Reply-To: <7a1bd8d7-1bf6-7357-6fcd-b7c83b08e52b@Oracle.com> References: <7a1bd8d7-1bf6-7357-6fcd-b7c83b08e52b@Oracle.com> Message-ID: Another final thought that just occurred to me? java.io.SerializablePermission will need its class-level javadoc updated to include the new permission target name. -Chris. > On 25 Jul 2016, at 19:55, Roger Riggs wrote: > > Hi Chris, > > Thanks for the review and comments, > > Updates in place: > > Webrev: > http://cr.openjdk.java.net/~rriggs/webrev-serial-filter-jdk9-8155760/ > > SpecDiff: > http://cr.openjdk.java.net/~rriggs/filter-diffs/overview-summary.html > > Javadoc (subset) > http://cr.openjdk.java.net/~rriggs/filter-javadoc/java/io/ObjectInputStream.html > > http://cr.openjdk.java.net/~rriggs/filter-javadoc/java/io/ObjectInputFilter.html > > > On 7/25/2016 10:54 AM, Chris Hegarty wrote: >> Roger, >> >> Mainly looks good. Some comments on the spec: >> >> - Use the Present Simple Tense consistently, e.g. >> "Return*S* an ObjectInputFilter computed from a string of patterns." > ok >> >> - ObjectInputFilter. Was there a comment already on the use of links? >> For example the following is showing in the javadoc: >> "ObjectInputStream.setObjectInputFilter(java.io.ObjectInputFilter)" >> when "setObjectInputFilter" would be better. > ok, will fix (It would be nice if javadoc had a @linksimple that didn't supply the whole signature). >> >> Same comment applies to the links to ObjectInputFilter.Status, and >> other places. >> >> - ObjectInputFilter class description. "If set on an >> ObjectInputStream, the method*(s)* are called ..." > ok >> >> - Looking at the example in the ObjectInputFilter class description >> makes me think that maybe the default process-wide filter should >> be a filter that simply returns UNDECIDED, rather than being null. >> Is it important to discern whether, or not, it has been set? > When writing a customized filter, it is useful to know whether the process-wide filter is has been configured. > Usually it is not and there will be a (slight) performance improvement in not calling it and checking the return. > >> >> - ObjectInputFilter.Config >> The initial sentence in the class description should describe the >> class itself, so maybe " A utility class for ..." > ok >> >> - "process-wide" is this an agreed upon term? I'm just curious where >> it came from. Is there a more common term for this? > It is useful to distinguish between the filter applied by default to all ObjectInputStreams from > one set for a particular stream. I initially used 'global' but that seemed overly broad. > The description is used sparingly but I'm open to suggestions. >> >> - Config.setSerialFilter: SecurityException - if there is security >> manager and the SerializablePermission("serialFilter") is not >> granted or if there is no securityManager set and the process-wide >> filter has already been set non-null >> >> It is a little odd to throw a SE if there is no SM, no ? > True, that would be better as IllegalStateException; updated >> >> - Is there a class/package level statement covering null, or should >> it be covered for each applicable method? > Added one. >> >> - ObjectInputStream >> "... the serialization filter for the stream." -> >> "... the serialization filter for THIS stream." > ok >> >> - setObjectInputFilter: "The checkInput method is called for each >> class and reference in the stream". Does this apply to back >> references too? > yes, a reference in the stream, as opposed to a new instance in the stream, > refers to back references. >> >> - setObjectInputFilter: "... when the ObjectInputStream is constructed >> and CANNOT be re-set until an object has been deserialized." > The intent was to prevent it from being modified during deserialization. > But I think it will be clearer if it can only be set non-null once and only if the previous > value was the pre-configured process-wide filter. > > I've also had the recommendation that ObjectInputStream.setObjectInputFilter > should be protected by the same permission as configuring the process-wide filter. > (SerializablePermission("serialFilter")) > > Roger > > > >> >> -Chris. >> >> On 19/07/16 15:02, Roger Riggs wrote: >>> Please review the design, implementation, and tests of JEP 290: Filter >>> Incoming Serialization Data[1] >>> >>> It allows incoming streams of object-serialization data to be filtered >>> in order to improve both security and robustness. >>> The JEP[1] has more detail on the background and scope. >>> >>> The core mechanism is a filter interface implemented by serialization >>> clients and set on an |ObjectInputStream|. The filter is called during >>> the deserialization process to validate the classes being deserialized, >>> the sizes of arrays being created, and metrics describing stream length, >>> stream depth, and number of references as the stream is being decoded. >>> >>> A process-wide filter can be configured that is applied to every >>> ObjectInputStream. >>> The API of ObjectInputStream can be used to set a custom filter to >>> supersede or augment the process-wide filter. >>> >>> Webrev: >>> http://cr.openjdk.java.net/~rriggs/webrev-serial-filter-jdk9-8155760/ >>> >>> SpecDiff: >>> http://cr.openjdk.java.net/~rriggs/filter-diffs/overview-summary.html >>> >>> Javadoc (subset) >>> http://cr.openjdk.java.net/~rriggs/filter-javadoc/java/io/ObjectInputStream.html >>> >>> http://cr.openjdk.java.net/~rriggs/filter-javadoc/java/io/ObjectInputFilter.html >>> >>> >>> Comments appreciated, Roger >>> >>> [1] JEP 290: https://bugs.openjdk.java.net/browse/JDK-8154961 >>> > From lance.andersen at oracle.com Tue Jul 26 16:25:11 2016 From: lance.andersen at oracle.com (Lance Andersen) Date: Tue, 26 Jul 2016 12:25:11 -0400 Subject: RFR 8161965 -> Fwd: JDK 9 RFR of 8161402: Provide a javadoc description for java.prefs module In-Reply-To: <47637AD5-F334-4AF2-9422-F4470106EBB3@oracle.com> References: <4A7129B8-343A-4D8E-A537-F086B9609405@oracle.com> <47637AD5-F334-4AF2-9422-F4470106EBB3@oracle.com> Message-ID: <4662A0B7-7379-49AC-A6BB-A311EB3C8EB6@oracle.com> Hi all, Take 2 on the module description javadocs. http://cr.openjdk.java.net/~lancea/8161965 the xxx.01 include the updated changes. Alan, I tried to incorporate your suggested changes. Hopefully we are getting closer. Best Lance > On Jul 21, 2016, at 1:41 PM, Lance Andersen wrote: > > >> On Jul 21, 2016, at 1:03 PM, Alan Bateman wrote: >> >> On 21/07/2016 17:37, Lance Andersen wrote: >> >>> I took a stab at the javadoc descriptions for the modules modeled after what we discussed for the java.prefs module. >>> >>> The webrev can be found at http://cr.openjdk.java.net/~lancea/8161965/ >> It's good to do these in bulk and get some consistently. >> >> A general comment is that it uses acronyms for several APIs. For example java.xml say "JAXP" then I assume it should have "XML Processing". JDBC, JNDI, JAXB, ... there are several that I think should be clearer. > > I can add the JCP naming for the ones that are applicable, for JDBC that is correct it is not an acronym >> >> java.activation has "activation API", shouldn't this be "JavaBeans Activation Framework?. > Yes >> >> I'm not sure what to say for java.annotations.common. I think it has to say something about it defining a subset of the Common Annotations. > I can add that before the ?. core JAX-WS wording >> >> For java.transaction then the exceptions also for interop with CORBA Transaction Services. The text might need to say that it's the Java SE subset of the Java Transaction API. >> > OK will take another stab at this, I was leveraging wording from the javadocs >> The java.management module exports java.lang.management so that will need text. > OK must have missed that > > > Once I hear from others, I will push another webrev > >> >> I think Jon Gibbons is working on text for java.compiler and jdk.compiler so you might be able to drop java.compiler from your patch. >> > OK, or Jon can just suggest his preferred wording? either way is fine. > > Best > Lance >> -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 > > > 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 Jul 26 16:34:51 2016 From: Roger.Riggs at Oracle.com (Roger Riggs) Date: Tue, 26 Jul 2016 12:34:51 -0400 Subject: RFR 9: JEP 290: Filter Incoming Serialization Data In-Reply-To: References: <7a1bd8d7-1bf6-7357-6fcd-b7c83b08e52b@Oracle.com> Message-ID: <3ce4aef4-e0fc-4d4f-dfd6-484e12f89e2a@Oracle.com> Hi Chris, yes, its in the webrev, but I neglected to include it in the javadoc and specdiff updates. Thanks, Roger On 7/26/2016 12:20 PM, Chris Hegarty wrote: > Another final thought that just occurred to me? > > java.io.SerializablePermission will need its class-level javadoc updated to > include the new permission target name. > > -Chris. > >> On 25 Jul 2016, at 19:55, Roger Riggs wrote: >> >> Hi Chris, >> >> Thanks for the review and comments, >> >> Updates in place: >> >> Webrev: >> http://cr.openjdk.java.net/~rriggs/webrev-serial-filter-jdk9-8155760/ >> >> SpecDiff: >> http://cr.openjdk.java.net/~rriggs/filter-diffs/overview-summary.html >> >> Javadoc (subset) >> http://cr.openjdk.java.net/~rriggs/filter-javadoc/java/io/ObjectInputStream.html >> >> http://cr.openjdk.java.net/~rriggs/filter-javadoc/java/io/ObjectInputFilter.html >> >> >> On 7/25/2016 10:54 AM, Chris Hegarty wrote: >>> Roger, >>> >>> Mainly looks good. Some comments on the spec: >>> >>> - Use the Present Simple Tense consistently, e.g. >>> "Return*S* an ObjectInputFilter computed from a string of patterns." >> ok >>> - ObjectInputFilter. Was there a comment already on the use of links? >>> For example the following is showing in the javadoc: >>> "ObjectInputStream.setObjectInputFilter(java.io.ObjectInputFilter)" >>> when "setObjectInputFilter" would be better. >> ok, will fix (It would be nice if javadoc had a @linksimple that didn't supply the whole signature). >>> Same comment applies to the links to ObjectInputFilter.Status, and >>> other places. >>> >>> - ObjectInputFilter class description. "If set on an >>> ObjectInputStream, the method*(s)* are called ..." >> ok >>> - Looking at the example in the ObjectInputFilter class description >>> makes me think that maybe the default process-wide filter should >>> be a filter that simply returns UNDECIDED, rather than being null. >>> Is it important to discern whether, or not, it has been set? >> When writing a customized filter, it is useful to know whether the process-wide filter is has been configured. >> Usually it is not and there will be a (slight) performance improvement in not calling it and checking the return. >> >>> - ObjectInputFilter.Config >>> The initial sentence in the class description should describe the >>> class itself, so maybe " A utility class for ..." >> ok >>> - "process-wide" is this an agreed upon term? I'm just curious where >>> it came from. Is there a more common term for this? >> It is useful to distinguish between the filter applied by default to all ObjectInputStreams from >> one set for a particular stream. I initially used 'global' but that seemed overly broad. >> The description is used sparingly but I'm open to suggestions. >>> - Config.setSerialFilter: SecurityException - if there is security >>> manager and the SerializablePermission("serialFilter") is not >>> granted or if there is no securityManager set and the process-wide >>> filter has already been set non-null >>> >>> It is a little odd to throw a SE if there is no SM, no ? >> True, that would be better as IllegalStateException; updated >>> - Is there a class/package level statement covering null, or should >>> it be covered for each applicable method? >> Added one. >>> - ObjectInputStream >>> "... the serialization filter for the stream." -> >>> "... the serialization filter for THIS stream." >> ok >>> - setObjectInputFilter: "The checkInput method is called for each >>> class and reference in the stream". Does this apply to back >>> references too? >> yes, a reference in the stream, as opposed to a new instance in the stream, >> refers to back references. >>> - setObjectInputFilter: "... when the ObjectInputStream is constructed >>> and CANNOT be re-set until an object has been deserialized." >> The intent was to prevent it from being modified during deserialization. >> But I think it will be clearer if it can only be set non-null once and only if the previous >> value was the pre-configured process-wide filter. >> >> I've also had the recommendation that ObjectInputStream.setObjectInputFilter >> should be protected by the same permission as configuring the process-wide filter. >> (SerializablePermission("serialFilter")) >> >> Roger >> >> >> >>> -Chris. >>> >>> On 19/07/16 15:02, Roger Riggs wrote: >>>> Please review the design, implementation, and tests of JEP 290: Filter >>>> Incoming Serialization Data[1] >>>> >>>> It allows incoming streams of object-serialization data to be filtered >>>> in order to improve both security and robustness. >>>> The JEP[1] has more detail on the background and scope. >>>> >>>> The core mechanism is a filter interface implemented by serialization >>>> clients and set on an |ObjectInputStream|. The filter is called during >>>> the deserialization process to validate the classes being deserialized, >>>> the sizes of arrays being created, and metrics describing stream length, >>>> stream depth, and number of references as the stream is being decoded. >>>> >>>> A process-wide filter can be configured that is applied to every >>>> ObjectInputStream. >>>> The API of ObjectInputStream can be used to set a custom filter to >>>> supersede or augment the process-wide filter. >>>> >>>> Webrev: >>>> http://cr.openjdk.java.net/~rriggs/webrev-serial-filter-jdk9-8155760/ >>>> >>>> SpecDiff: >>>> http://cr.openjdk.java.net/~rriggs/filter-diffs/overview-summary.html >>>> >>>> Javadoc (subset) >>>> http://cr.openjdk.java.net/~rriggs/filter-javadoc/java/io/ObjectInputStream.html >>>> >>>> http://cr.openjdk.java.net/~rriggs/filter-javadoc/java/io/ObjectInputFilter.html >>>> >>>> >>>> Comments appreciated, Roger >>>> >>>> [1] JEP 290: https://bugs.openjdk.java.net/browse/JDK-8154961 >>>> From naoto.sato at oracle.com Tue Jul 26 17:16:10 2016 From: naoto.sato at oracle.com (Naoto Sato) Date: Tue, 26 Jul 2016 10:16:10 -0700 Subject: [9] RFR: 8162343: non-ASCII characters in source code comments (.hpp) In-Reply-To: <8ddfaaf7-6412-d88c-d2bb-495a21ec003f@oracle.com> References: <8ddfaaf7-6412-d88c-d2bb-495a21ec003f@oracle.com> Message-ID: <324ff0ba-1979-4442-80cb-861bddfe5e47@oracle.com> Ping. On 7/21/16 3:44 PM, Naoto Sato wrote: > Hello, > > Please review the change to the following issue: > > https://bugs.openjdk.java.net/browse/JDK-8162343 > > The proposed fix is located at: > > http://cr.openjdk.java.net/~naoto/8162343/webrev.00/ > > It's a trivial fix following the bug 8161937. > > Naoto From daniel.fuchs at oracle.com Tue Jul 26 17:32:54 2016 From: daniel.fuchs at oracle.com (Daniel Fuchs) Date: Tue, 26 Jul 2016 18:32:54 +0100 Subject: JAXP: XSLTC transformer swallows empty namespace declaration which is necessary to undeclare default namespace In-Reply-To: References: Message-ID: Hi Christoph, I was at first a bit suspicious of your proposed patch, but I applied it and played with it and could not fault it. Now I tend to believe this is the correct thing to do (though that's not my area of expertise). I tried it with a bit more elaborate content in the "transform" template: ------------------------------ XSL ---------------------------- --------------------------------------------------------------- and that gave me the content I expected (ignoring the double xmlns declaration which seems to be another bug): -- Formatted result with your patch (newlines added manually) -- --------------------------------------------------------------- This seems a more correct result than what the JDK currently does: ------------------ Current JDK 9/dev --------------------------- --------------------------------------------------------------- where the empty default namespace declaration always disappears, even at line 4 in the element ! Hope this helps, -- daniel On 22/07/16 11:38, Langer, Christoph wrote: > Hi, > > I have a customer reporting the following phenomena which I believe is an issue. > > Consider the following xsl: > > ---------------------XSL--------------------- > > > > > > > > > > > > ---------------------End of XSL--------------------- > > > This is the XML snippet where the XSL gets applied (just a dummy): > > > The result with the current XSLTC is: > > But this would not undeclare the default namespace "ns1" from the element named "root" for the element named "test" which was the intention of the xsl. So I believe it should be: > > > Looking at the coding I came up with the following: http://cr.openjdk.java.net/~clanger/webrevs/xsltc-namespaceissue/ With that, XSLTC would also emit the namespace attribute for an empty namespace. It works for my example but I'm not sure if it is the right thing to do or if it breaks things at other places and violates specs elsewhere. > > Comparing with the Apache Xalan, I can see that the Apache XSLTC matches the JDK XSLTC behavior to suppress the namespace declaration but the interpretative transformer (org.apache.xalan.processor.TransformerFactoryImpl) would emit the namespace attribute. > > Please give me some comments before I open a Bug... > > Thanks a lot in advance > Christoph > From Roger.Riggs at Oracle.com Tue Jul 26 17:36:05 2016 From: Roger.Riggs at Oracle.com (Roger Riggs) Date: Tue, 26 Jul 2016 13:36:05 -0400 Subject: [9] RFR: 8162343: non-ASCII characters in source code comments (.hpp) In-Reply-To: <324ff0ba-1979-4442-80cb-861bddfe5e47@oracle.com> References: <8ddfaaf7-6412-d88c-d2bb-495a21ec003f@oracle.com> <324ff0ba-1979-4442-80cb-861bddfe5e47@oracle.com> Message-ID: <286088a6-0422-9be1-0bdb-fa71a0b0bbef@Oracle.com> Look fine, Roger On 7/26/2016 1:16 PM, Naoto Sato wrote: > Ping. > > On 7/21/16 3:44 PM, Naoto Sato wrote: >> Hello, >> >> Please review the change to the following issue: >> >> https://bugs.openjdk.java.net/browse/JDK-8162343 >> >> The proposed fix is located at: >> >> http://cr.openjdk.java.net/~naoto/8162343/webrev.00/ >> >> It's a trivial fix following the bug 8161937. >> >> Naoto From Roger.Riggs at Oracle.com Tue Jul 26 17:49:34 2016 From: Roger.Riggs at Oracle.com (Roger Riggs) Date: Tue, 26 Jul 2016 13:49:34 -0400 Subject: RFR (JAXP): 8021787: javax.xml.datatype.XMLGregorianCalendar.getMonth() return is documented wrong In-Reply-To: <57960949.4040502@oracle.com> References: <578CFA87.2040004@oracle.com> <51440a13-ab2a-11cf-c42f-b58d6deeba30@oracle.com> <578E2A92.5030307@oracle.com> <91d1116b-df84-319c-1f7e-34f32f7a1d47@oracle.com> <57960949.4040502@oracle.com> Message-ID: <1532186c-a53f-240e-3f70-75f0a04d1a05@Oracle.com> Hi Svetlana, Looks ok to me. Roger On 7/25/2016 8:42 AM, Svetlana Nikandrova wrote: > Hi Joe, Roger, > > thank you for your replays. A have changed javadoc as Joe suggested > (hope I didn't missed any in-line comments) and added a bunch of "s" > and "The" to Returns and @return. > Hope now it looks better and more consistent: > http://cr.openjdk.java.net/~snikandrova/8021787/webrev.02/ > > > Thank you, > Svetlana > > On 21.07.2016 19:32, huizhe wang wrote: >> The editor of the new version of Thunderbird seems to be troublesome, >> with missing or added whitespace as a result of copy&paste. But when >> you "@return the hour of dayof this", you know I meant "@return the >> hour of day of this" :-) Or the double whitespace should have been a >> single one. >> >> -Joe >> >> On 7/21/2016 9:25 AM, huizhe wang wrote: >>> Hi Svetlana, >>> >>> It would be good to apply the same format to these get* methods. >>> Please see below. >>> >>> @@ -510,16 +510,16 @@ >>> * @see #getYear() >>> */ >>> public abstract BigInteger getEonAndYear(); >>> >>> /** >>> - * Return number of month or {@link >>> DatatypeConstants#FIELD_UNDEFINED}. >>> + * Returns the month of this calendar or {@link >>> DatatypeConstants#FIELD_UNDEFINED}. >>> *

    Value constraints for this value are summarized in >>> * month field of date/time >>> field mapping table. >>> * >>> - * @return year of this {@code XMLGregorianCalendar}. >>> + * @return Returns the month of this {@code XMLGregorianCalendar}. >>> >>> remove the duplicated "Returns", that is >>> >>> @return the month of the{@code XMLGregorianCalendar}, from 1 to 12. >>> >>> >>> */ >>> public abstract int getMonth(); >>> >>> /** >>> >>> ------------------------------------------------------------------------ >>> >>> >>> @@ -526,10 +526,12 @@ >>> * Return day in month or {@link >>> DatatypeConstants#FIELD_UNDEFINED}. >>> >>> Returns the day of month >>> >>> *

    Value constraints for this value are summarized in >>> * day field of date/time >>> field mapping table. >>> * >>> + * @return Day in month of this {@code XMLGregorianCalendar}. >>> >>> @return the day of month of the{@code XMLGregorianCalendar}, from 1 >>> to 31. >>> >>> >>> + * >>> * @see #setDay(int) >>> */ >>> public abstract int getDay(); >>> >>> /** >>> >>> ------------------------------------------------------------------------ >>> >>> >>> @@ -537,10 +539,12 @@ >>> * {@link DatatypeConstants#FIELD_UNDEFINED} if this >>> optional field is not defined. >>> >>> Returns the Timezone offset... >>> >>> *

    Value constraints for this value are summarized in >>> * timezone field of >>> date/time field mapping table. >>> * >>> + * @return Timezone offset in minutes of this {@code >>> XMLGregorianCalendar}. >>> >>> @return the Timezone ... >>> >>> + * >>> * @see #setTimezone(int) >>> */ >>> public abstract int getTimezone(); >>> >>> /** >>> >>> ------------------------------------------------------------------------ >>> >>> >>> @@ -547,10 +551,13 @@ >>> * Return hours or {@link DatatypeConstants#FIELD_UNDEFINED}. >>> >>> Returns the hour of day >>> >>> * Returns {@link DatatypeConstants#FIELD_UNDEFINED} if >>> this field is not defined. >>> * >>> *

    Value constraints for this value are summarized in >>> * hour field of date/time >>> field mapping table. >>> + * >>> + * @return Hours of this {@code XMLGregorianCalendar}. >>> >>> @return the hour of dayof this {@code XMLGregorianCalendar}, from 0 >>> to 23. >>> >>> + * >>> * @see #setTime(int, int, int) >>> */ >>> public abstract int getHour(); >>> >>> /** >>> >>> ------------------------------------------------------------------------ >>> >>> >>> @@ -557,10 +564,13 @@ >>> * Return minutes or {@link >>> DatatypeConstants#FIELD_UNDEFINED}. >>> >>> Returns the minute of hour... >>> >>> * Returns {@link DatatypeConstants#FIELD_UNDEFINED} if >>> this field is not defined. >>> * >>> *

    Value constraints for this value are summarized in >>> * minute field of >>> date/time field mapping table. >>> + * >>> + * @return Minutes of this {@code XMLGregorianCalendar}. >>> >>> @return the minute of hourof this {@code XMLGregorianCalendar}, from >>> 0 to 59. >>> >>> + * >>> * @see #setTime(int, int, int) >>> */ >>> public abstract int getMinute(); >>> >>> /** >>> >>> ------------------------------------------------------------------------ >>> >>> >>> @@ -679,10 +689,11 @@ >>> * {@code XMLGregorianCalendar} and >>> * {@link #compare(XMLGregorianCalendar obj)} >>> * returns {@link DatatypeConstants#EQUAL}, >>> * otherwise {@code false}. >>> */ >>> + @Override >>> public boolean equals(Object obj) { >>> >>> if (obj == null || !(obj instanceof XMLGregorianCalendar)) { >>> return false; >>> } >>> >>> ------------------------------------------------------------------------ >>> >>> >>> @@ -692,10 +703,11 @@ >>> /** >>> * Returns a hash code consistent with the definition of the >>> equals method. >>> * >>> * @return hash code of this object. >>> */ >>> + @Override >>> public int hashCode() { >>> >>> // Following two dates compare to EQUALS since in different >>> timezones. >>> // 2000-01-15T12:00:00-05:00 == 2000-01-15T13:00:00-04:00 >>> // >>> >>> ------------------------------------------------------------------------ >>> >>> >>> @@ -853,13 +865,13 @@ >>> * >>> * @return A non-{@code null} valid {@code String} >>> representation of this {@code XMLGregorianCalendar}. >>> * >>> * @throws IllegalStateException if the combination of set fields >>> * does not match one of the eight defined XML Schema >>> builtin date/time datatypes. >>> - * >>> * @see #toXMLFormat() >>> */ >>> + @Override >>> public String toString() { >>> >>> return toXMLFormat(); >>> } >>> >>> >>> ------------------------------------------------------------------------ >>> >>> >>> @@ -968,10 +980,12 @@ >>> *

  • Its fields ERA, YEAR, MONTH, DAY_OF_MONTH, HOUR_OF_DAY, >>> * MINUTE, SECOND and MILLISECOND are set using the method >>> * {@code Calendar.set(int,int)}
  • >>> * >>> * >>> + * @return a {@code java.util.GregorianCalendar} conversion of this >>> instance. >>> >>> @return an instance of{@link java.util.GregorianCalendar}. >>> >>> + * >>> * @see #toGregorianCalendar(java.util.TimeZone, >>> java.util.Locale, XMLGregorianCalendar) >>> */ >>> public abstract GregorianCalendar toGregorianCalendar(); >>> >>> /** >>> >>> ------------------------------------------------------------------------ >>> >>> >>> @@ -1047,13 +1061,13 @@ >>> * @return TimeZone for this. >>> */ >>> public abstract TimeZone getTimeZone(int defaultZoneoffset); >>> >>> >>> - >>> /** >>> * Creates and returns a copy of this object. >>> * >>> * @return copy of this {@code Object} >>> */ >>> + @Override >>> public abstract Object clone(); >>> } >>> >>> >>> Thanks, >>> Joe >>> >>> >>> On 7/19/2016 6:26 AM, Svetlana Nikandrova wrote: >>>> Hi Joe, >>>> >>>> thank you for your replay. As I'm new to javadoc writing feel free >>>> to add any comments. >>>> Please see updated webrev: >>>> http://cr.openjdk.java.net/~snikandrova/8021787/webrev.01/ >>>> >>>> >>>> Thank you, >>>> Svetlana >>>> >>>> On 18.07.2016 20:34, huizhe wang wrote: >>>>> Hi Svetlana, >>>>> >>>>> Thanks for working on these bugs. The change is correct. It would >>>>> be better to say: "Returns the month of this calendar", in both >>>>> the returns tag and the description (not number of month). >>>>> >>>>> While we are in this class, it would be good to at least fix the >>>>> missing @returns tags in a number of methods, e.g. getDay, >>>>> getTimezone, getHour, getMinute, toGregorianCalendar. Also, it >>>>> @Override equals, hashCode, toString, and clone. >>>>> >>>>> Thanks, >>>>> >>>>> Joe >>>>> >>>>> On 7/18/2016 8:49 AM, Svetlana Nikandrova wrote: >>>>>> Hello all, >>>>>> >>>>>> please review this javadoc fix for >>>>>> javax.xml.datatype.XMLGregorianCalendar.getMonth() >>>>>> Webrev: >>>>>> http://cr.openjdk.java.net/~snikandrova/8021787/webrev.00/ >>>>>> >>>>>> JBS: >>>>>> https://bugs.openjdk.java.net/browse/JDK-8021787 >>>>>> >>>>>> Thank you, >>>>>> Svetlana >>>>> >>>> >>> >> > From Roger.Riggs at Oracle.com Tue Jul 26 17:57:01 2016 From: Roger.Riggs at Oracle.com (Roger Riggs) Date: Tue, 26 Jul 2016 13:57:01 -0400 Subject: RFR 9: JEP 290: Filter Incoming Serialization Data In-Reply-To: <3ce4aef4-e0fc-4d4f-dfd6-484e12f89e2a@Oracle.com> References: <7a1bd8d7-1bf6-7357-6fcd-b7c83b08e52b@Oracle.com> <3ce4aef4-e0fc-4d4f-dfd6-484e12f89e2a@Oracle.com> Message-ID: <9666c25e-ef9c-8ea2-6175-019801b2e75f@Oracle.com> Hi, Updated the specdiff and javadoc with SerializablePermission and misc editorial cleanups. SpecDiff: http://cr.openjdk.java.net/~rriggs/filter-diffs/overview-summary.html Javadoc (subset) http://cr.openjdk.java.net/~rriggs/filter-javadoc/java/io/ObjectInputStream.html http://cr.openjdk.java.net/~rriggs/filter-javadoc/java/io/ObjectInputFilter.html http://cr.openjdk.java.net/~rriggs/filter-javadoc/java/io/SerializablePermission.html Also, noticed that a filter could not distinguish between a reference to an array class and the callback to check the size of a zero length array (size == 0). Modified the range of the size to be positive when creating an array and otherwise negative. Webrev: http://cr.openjdk.java.net/~rriggs/webrev-serial-filter-jdk9-8155760/ Roger On 7/26/2016 12:34 PM, Roger Riggs wrote: > Hi Chris, > > yes, its in the webrev, but I neglected to include it in the javadoc > and specdiff updates. > > Thanks, Roger > > > On 7/26/2016 12:20 PM, Chris Hegarty wrote: >> Another final thought that just occurred to me? >> >> java.io.SerializablePermission will need its class-level javadoc >> updated to >> include the new permission target name. >> >> -Chris. >> >>> On 25 Jul 2016, at 19:55, Roger Riggs wrote: >>> >>> Hi Chris, >>> >>> Thanks for the review and comments, >>> >>> Updates in place: >>> >>> Webrev: >>> http://cr.openjdk.java.net/~rriggs/webrev-serial-filter-jdk9-8155760/ >>> >>> SpecDiff: >>> http://cr.openjdk.java.net/~rriggs/filter-diffs/overview-summary.html >>> >>> Javadoc (subset) >>> http://cr.openjdk.java.net/~rriggs/filter-javadoc/java/io/ObjectInputStream.html >>> >>> >>> http://cr.openjdk.java.net/~rriggs/filter-javadoc/java/io/ObjectInputFilter.html >>> >>> From henry.jen at oracle.com Tue Jul 26 18:12:29 2016 From: henry.jen at oracle.com (Henry Jen) Date: Tue, 26 Jul 2016 11:12:29 -0700 Subject: [9] RFR: 8162343: non-ASCII characters in source code comments (.hpp) In-Reply-To: <324ff0ba-1979-4442-80cb-861bddfe5e47@oracle.com> References: <8ddfaaf7-6412-d88c-d2bb-495a21ec003f@oracle.com> <324ff0ba-1979-4442-80cb-861bddfe5e47@oracle.com> Message-ID: Looks good to me, but I am not a Reviewer. Cheers, Henry On July 26, 2016 at 10:16:36 AM, Naoto Sato (naoto.sato at oracle.com) wrote: > Ping. > > On 7/21/16 3:44 PM, Naoto Sato wrote: > > Hello, > > > > Please review the change to the following issue: > > > > https://bugs.openjdk.java.net/browse/JDK-8162343 > > > > The proposed fix is located at: > > > > http://cr.openjdk.java.net/~naoto/8162343/webrev.00/ > > > > It's a trivial fix following the bug 8161937. > > > > Naoto > From joe.darcy at oracle.com Tue Jul 26 19:08:09 2016 From: joe.darcy at oracle.com (joe darcy) Date: Tue, 26 Jul 2016 12:08:09 -0700 Subject: JDK 9 RFR of JDK-8162539: Test fails because it expects a blank between method signature and throws exception Message-ID: <3c38d12f-d616-5c6b-dad0-6bf953ec768c@oracle.com> Hello, Please review the changes to address JDK-8162539: Test fails because it expects a blank between method signature and throws exception http://cr.openjdk.java.net/~darcy/8162539.0/ In brief, recent refactorings of the toString output in core reflection (JDK-8161500 Use getTypeName and StringJoiner in core reflection generic toString methods) omitted a space character between the closing ")" and "throws" for toString output, but correctly included the space in toGenericString output. The simple fix is to add the space character; regression tests are suitably augmented and slightly refactored. Thanks, -Joe From coleen.phillimore at oracle.com Tue Jul 26 19:23:19 2016 From: coleen.phillimore at oracle.com (Coleen Phillimore) Date: Tue, 26 Jul 2016 15:23:19 -0400 Subject: JDK 9 RFR of JDK-8162539: Test fails because it expects a blank between method signature and throws exception In-Reply-To: <3c38d12f-d616-5c6b-dad0-6bf953ec768c@oracle.com> References: <3c38d12f-d616-5c6b-dad0-6bf953ec768c@oracle.com> Message-ID: Thank you for fixing this so quickly. This looks good but I have a question about: http://cr.openjdk.java.net/~darcy/8162539.0/test/java/lang/reflect/Constructor/GenericStringTest.java.udiff.html @ExpectedGenericString( "protected TestClass1(S,T) throws java.lang.Exception") + @ExpectedString( + "protected TestClass1(java.lang.Object,java.lang.Object) throws java.lang.Exception") protected TestClass1(S s, T t) throws Exception{} I can't really read the metaprogramming but why didn't the existing @Expected{Generic}String strings here find the problem? thanks, Coleen On 7/26/16 3:08 PM, joe darcy wrote: > Hello, > > Please review the changes to address > > JDK-8162539: Test fails because it expects a blank between method > signature and throws exception > http://cr.openjdk.java.net/~darcy/8162539.0/ > > In brief, recent refactorings of the toString output in core > reflection (JDK-8161500 Use getTypeName and StringJoiner in core > reflection generic toString methods) omitted a space character between > the closing ")" and "throws" for toString output, but correctly > included the space in toGenericString output. > > The simple fix is to add the space character; regression tests are > suitably augmented and slightly refactored. > > Thanks, > > -Joe > From joe.darcy at oracle.com Tue Jul 26 19:36:13 2016 From: joe.darcy at oracle.com (joe darcy) Date: Tue, 26 Jul 2016 12:36:13 -0700 Subject: JDK 9 RFR of JDK-8162539: Test fails because it expects a blank between method signature and throws exception In-Reply-To: References: <3c38d12f-d616-5c6b-dad0-6bf953ec768c@oracle.com> Message-ID: Hi Coleen, The existing tests covered *toGenericString* output with a throws clauses but omitted coverage of *toString* methods with a throws clause. That let the omission of the space character in toString output slip through. (There is some logically duplicated structure in the implementations of the toString and toGenericString methods.) On the core libs side, I believe there weren't any regression tests of the toString output of core reflection objects until the toGenericString methods were added in JDK 5. That is one reason the test are weighted toward toGenericString since the tests were added for that functionality. HTH, -Joe On 7/26/2016 12:23 PM, Coleen Phillimore wrote: > Thank you for fixing this so quickly. This looks good but I have a > question about: > > http://cr.openjdk.java.net/~darcy/8162539.0/test/java/lang/reflect/Constructor/GenericStringTest.java.udiff.html > @ExpectedGenericString( > "protected TestClass1(S,T) throws java.lang.Exception") > + @ExpectedString( > + "protected TestClass1(java.lang.Object,java.lang.Object) throws > java.lang.Exception") > protected TestClass1(S s, T t) throws Exception{} > > I can't really read the metaprogramming but why didn't the existing > @Expected{Generic}String strings here find the problem? > > thanks, > Coleen > > On 7/26/16 3:08 PM, joe darcy wrote: >> Hello, >> >> Please review the changes to address >> >> JDK-8162539: Test fails because it expects a blank between method >> signature and throws exception >> http://cr.openjdk.java.net/~darcy/8162539.0/ >> >> In brief, recent refactorings of the toString output in core >> reflection (JDK-8161500 Use getTypeName and StringJoiner in core >> reflection generic toString methods) omitted a space character >> between the closing ")" and "throws" for toString output, but >> correctly included the space in toGenericString output. >> >> The simple fix is to add the space character; regression tests are >> suitably augmented and slightly refactored. >> >> Thanks, >> >> -Joe >> > From coleen.phillimore at oracle.com Tue Jul 26 19:45:02 2016 From: coleen.phillimore at oracle.com (Coleen Phillimore) Date: Tue, 26 Jul 2016 15:45:02 -0400 Subject: JDK 9 RFR of JDK-8162539: Test fails because it expects a blank between method signature and throws exception In-Reply-To: References: <3c38d12f-d616-5c6b-dad0-6bf953ec768c@oracle.com> Message-ID: <5f11b942-ef86-8bf4-ef9f-b034369f30a4@oracle.com> On 7/26/16 3:36 PM, joe darcy wrote: > > Hi Coleen, > > The existing tests covered *toGenericString* output with a throws > clauses but omitted coverage of *toString* methods with a throws > clause. That let the omission of the space character in toString > output slip through. > > (There is some logically duplicated structure in the implementations > of the toString and toGenericString methods.) > > On the core libs side, I believe there weren't any regression tests of > the toString output of core reflection objects until the > toGenericString methods were added in JDK 5. That is one reason the > test are weighted toward toGenericString since the tests were added > for that functionality. > > HTH, > Yes, thanks. Glad there's a test now. Coleen > -Joe > > > On 7/26/2016 12:23 PM, Coleen Phillimore wrote: >> Thank you for fixing this so quickly. This looks good but I have a >> question about: >> >> http://cr.openjdk.java.net/~darcy/8162539.0/test/java/lang/reflect/Constructor/GenericStringTest.java.udiff.html >> @ExpectedGenericString( >> "protected TestClass1(S,T) throws java.lang.Exception") >> + @ExpectedString( >> + "protected TestClass1(java.lang.Object,java.lang.Object) throws >> java.lang.Exception") >> protected TestClass1(S s, T t) throws Exception{} >> >> I can't really read the metaprogramming but why didn't the existing >> @Expected{Generic}String strings here find the problem? >> >> thanks, >> Coleen >> >> On 7/26/16 3:08 PM, joe darcy wrote: >>> Hello, >>> >>> Please review the changes to address >>> >>> JDK-8162539: Test fails because it expects a blank between >>> method signature and throws exception >>> http://cr.openjdk.java.net/~darcy/8162539.0/ >>> >>> In brief, recent refactorings of the toString output in core >>> reflection (JDK-8161500 Use getTypeName and StringJoiner in core >>> reflection generic toString methods) omitted a space character >>> between the closing ")" and "throws" for toString output, but >>> correctly included the space in toGenericString output. >>> >>> The simple fix is to add the space character; regression tests are >>> suitably augmented and slightly refactored. >>> >>> Thanks, >>> >>> -Joe >>> >> > From martinrb at google.com Tue Jul 26 20:35:05 2016 From: martinrb at google.com (Martin Buchholz) Date: Tue, 26 Jul 2016 13:35:05 -0700 Subject: RFR: 8162563: Fix double checked locking in System.console() Message-ID: Hi Xueming, I'd like you to do a wee code review, http://cr.openjdk.java.net/~martin/webrevs/openjdk9/Console-double-checked-locking/ From Roger.Riggs at Oracle.com Tue Jul 26 20:56:29 2016 From: Roger.Riggs at Oracle.com (Roger Riggs) Date: Tue, 26 Jul 2016 16:56:29 -0400 Subject: RFR: 8162563: Fix double checked locking in System.console() In-Reply-To: References: Message-ID: <8710f01b-a384-c46b-391d-1964fc033d7d@Oracle.com> Hi Martin, That looks ok to me. Roger On 7/26/2016 4:35 PM, Martin Buchholz wrote: > Hi Xueming, > > I'd like you to do a wee code review, > > http://cr.openjdk.java.net/~martin/webrevs/openjdk9/Console-double-checked-locking/ From huizhe.wang at oracle.com Tue Jul 26 21:13:55 2016 From: huizhe.wang at oracle.com (Joe Wang) Date: Tue, 26 Jul 2016 14:13:55 -0700 Subject: JAXP: XSLTC transformer swallows empty namespace declaration which is necessary to undeclare default namespace In-Reply-To: References: Message-ID: <5797D293.4070706@oracle.com> Hi Daniel, I tried your xsl, but I got the same result using either JDK 8 or a recent JDK 9 (jdk9dev) build: For the issue with regard to empty namespace, please open a bug and let's fix it. Thanks, Joe On 7/26/16, 10:32 AM, Daniel Fuchs wrote: > Hi Christoph, > > I was at first a bit suspicious of your proposed patch, but > I applied it and played with it and could not fault it. > Now I tend to believe this is the correct thing to do (though > that's not my area of expertise). > > I tried it with a bit more elaborate content in the "transform" > template: > > ------------------------------ XSL ---------------------------- > > version="1.0"> > > > > > > > > > > > > > > > --------------------------------------------------------------- > > and that gave me the content I expected (ignoring the double > xmlns declaration which seems to be another bug): > > > -- Formatted result with your patch (newlines added manually) -- > > > > > > > > > > --------------------------------------------------------------- > > This seems a more correct result than what the JDK currently does: > > ------------------ Current JDK 9/dev --------------------------- > > > > > > > > > > --------------------------------------------------------------- > > where the empty default namespace declaration always disappears, > even at line 4 in the element ! > > Hope this helps, > > -- daniel > > On 22/07/16 11:38, Langer, Christoph wrote: >> Hi, >> >> I have a customer reporting the following phenomena which I believe >> is an issue. >> >> Consider the following xsl: >> >> ---------------------XSL--------------------- >> >> > version="1.0"> >> >> >> >> >> >> >> >> >> >> ---------------------End of XSL--------------------- >> >> >> This is the XML snippet where the XSL gets applied (just a dummy): >> >> >> The result with the current XSLTC is: >> >> But this would not undeclare the default namespace "ns1" from the >> element named "root" for the element named "test" which was the >> intention of the xsl. So I believe it should be: >> > xmlns=""/> >> >> Looking at the coding I came up with the following: >> http://cr.openjdk.java.net/~clanger/webrevs/xsltc-namespaceissue/ >> With that, XSLTC would also emit the namespace attribute for an empty >> namespace. It works for my example but I'm not sure if it is the >> right thing to do or if it breaks things at other places and violates >> specs elsewhere. >> >> Comparing with the Apache Xalan, I can see that the Apache XSLTC >> matches the JDK XSLTC behavior to suppress the namespace declaration >> but the interpretative transformer >> (org.apache.xalan.processor.TransformerFactoryImpl) would emit the >> namespace attribute. >> >> Please give me some comments before I open a Bug... >> >> Thanks a lot in advance >> Christoph >> > From xueming.shen at oracle.com Tue Jul 26 22:39:43 2016 From: xueming.shen at oracle.com (Xueming Shen) Date: Tue, 26 Jul 2016 15:39:43 -0700 Subject: RFR: 8162563: Fix double checked locking in System.console() In-Reply-To: References: Message-ID: <9a9c606d-1508-5e72-6f48-90c372e99865@oracle.com> +1 On 7/26/16 1:35 PM, Martin Buchholz wrote: > Hi Xueming, > > I'd like you to do a wee code review, > > http://cr.openjdk.java.net/~martin/webrevs/openjdk9/Console-double-checked-locking/ > From martinrb at google.com Tue Jul 26 22:59:10 2016 From: martinrb at google.com (Martin Buchholz) Date: Tue, 26 Jul 2016 15:59:10 -0700 Subject: RFR: 8162563: Fix double checked locking in System.console() In-Reply-To: <9a9c606d-1508-5e72-6f48-90c372e99865@oracle.com> References: <9a9c606d-1508-5e72-6f48-90c372e99865@oracle.com> Message-ID: Thanks. Nice to have a change measured in hours instead of weeks... From weijun.wang at oracle.com Tue Jul 26 23:49:45 2016 From: weijun.wang at oracle.com (Weijun Wang) Date: Wed, 27 Jul 2016 07:49:45 +0800 Subject: RFR 8161965 -> Fwd: JDK 9 RFR of 8161402: Provide a javadoc description for java.prefs module In-Reply-To: <4662A0B7-7379-49AC-A6BB-A311EB3C8EB6@oracle.com> References: <4A7129B8-343A-4D8E-A537-F086B9609405@oracle.com> <47637AD5-F334-4AF2-9422-F4470106EBB3@oracle.com> <4662A0B7-7379-49AC-A6BB-A311EB3C8EB6@oracle.com> Message-ID: <29e38b8e-cdcb-7b40-6da8-84ed09ab8540@oracle.com> MY suggestions on 2 security-related modules: java.security.jgss: The {@code java.security.jgss} module defines and exports the interfaces and classes related to the Java binding of the Generic Security Services Application Program Interface (GSS-API). This module also includes GSS-API mechanisms such as Kerberos v5 and SPNEGO. java.security.sasl: The {@code java.security.sasl} module defines and exports the interfaces and classes related to the Simple Authentication and Security Layer (SASL). This module also includes SASL mechanisms such as DIGEST-MD5, CRAM-MD5, NTLM, etc. Thanks Max On 7/27/2016 0:25, Lance Andersen wrote: > Hi all, > > Take 2 on the module description javadocs. > > http://cr.openjdk.java.net/~lancea/8161965 > > the xxx.01 include the updated changes. > From david.holmes at oracle.com Wed Jul 27 02:31:11 2016 From: david.holmes at oracle.com (David Holmes) Date: Wed, 27 Jul 2016 12:31:11 +1000 Subject: RFR: 8162563: Fix double checked locking in System.console() In-Reply-To: References: Message-ID: On 27/07/2016 6:35 AM, Martin Buchholz wrote: > Hi Xueming, > > I'd like you to do a wee code review, > > http://cr.openjdk.java.net/~martin/webrevs/openjdk9/Console-double-checked-locking/ Humour me - where is the bug? We're simply retrieving the existing Console singleton that is safely published through static initialization. All this seems to do is improve the performance if a race occurs. AFAICS the use of locking here isn't necessary at all. Cheers, David From martinrb at google.com Wed Jul 27 05:45:10 2016 From: martinrb at google.com (Martin Buchholz) Date: Tue, 26 Jul 2016 22:45:10 -0700 Subject: RFR: 8162563: Fix double checked locking in System.console() In-Reply-To: References: Message-ID: Hi David, I didn't even look at Console.java! I just fixed the double-checked locking in System.java. Looking now at Console.cons, that is NOT safely statically initialized: SharedSecrets.setJavaIOAccess(new JavaIOAccess() { public Console console() { if (istty()) { if (cons == null) cons = new Console(); return cons; } return null; } (but it's currently safe because only System.java accesses it) Now perhaps Console.cons is deserving of its own proper init-once code. Perhaps we don't need a static Console field in both classes Console and System? On Tue, Jul 26, 2016 at 7:31 PM, David Holmes wrote: > On 27/07/2016 6:35 AM, Martin Buchholz wrote: > >> Hi Xueming, >> >> I'd like you to do a wee code review, >> >> >> http://cr.openjdk.java.net/~martin/webrevs/openjdk9/Console-double-checked-locking/ >> > > Humour me - where is the bug? We're simply retrieving the existing Console > singleton that is safely published through static initialization. All this > seems to do is improve the performance if a race occurs. > > AFAICS the use of locking here isn't necessary at all. > > Cheers, > David > > From david.holmes at oracle.com Wed Jul 27 06:13:31 2016 From: david.holmes at oracle.com (David Holmes) Date: Wed, 27 Jul 2016 16:13:31 +1000 Subject: RFR: 8162563: Fix double checked locking in System.console() In-Reply-To: References: Message-ID: <20208de7-50a2-b4c6-3306-73d6da9b1e8a@oracle.com> On 27/07/2016 3:45 PM, Martin Buchholz wrote: > Hi David, > > I didn't even look at Console.java! I just fixed the double-checked > locking in System.java. > > Looking now at Console.cons, that is NOT safely statically initialized: > > SharedSecrets.setJavaIOAccess(new JavaIOAccess() { > public Console console() { > if (istty()) { > if (cons == null) > cons = new Console(); > return cons; > } > return null; > } > > (but it's currently safe because only System.java accesses it) The above code is in a static initialization block. Cheers, David > Now perhaps Console.cons is deserving of its own proper init-once code. > Perhaps we don't need a static Console field in both classes Console and > System? > > > On Tue, Jul 26, 2016 at 7:31 PM, David Holmes > wrote: > > On 27/07/2016 6:35 AM, Martin Buchholz wrote: > > Hi Xueming, > > I'd like you to do a wee code review, > > http://cr.openjdk.java.net/~martin/webrevs/openjdk9/Console-double-checked-locking/ > > > Humour me - where is the bug? We're simply retrieving the existing > Console singleton that is safely published through static > initialization. All this seems to do is improve the performance if a > race occurs. > > AFAICS the use of locking here isn't necessary at all. > > Cheers, > David > > From frank.yuan at oracle.com Wed Jul 27 09:27:42 2016 From: frank.yuan at oracle.com (Frank Yuan) Date: Wed, 27 Jul 2016 17:27:42 +0800 Subject: RFR (JAXP) JDK-8067170: Enable security manager on JAXP unit tests In-Reply-To: <903949ef-50a5-ccd9-07cd-ebdd65d65fa5@oracle.com> References: <022401d1e0d7$54111090$fc3331b0$@oracle.com> <578CA476.7030407@oracle.com> <03a601d1e3e6$92c45a60$b84d0f20$@oracle.com> <040101d1e3f9$9d19a340$d74ce9c0$@oracle.com> <88977a21-e4d1-e792-00db-1debc3162b08@oracle.com> <024a01d1e659$7dcefcd0$796cf670$@oracle.com> <27ea3634-6e47-70e9-4099-69bd86d3d635@oracle.com> <027101d1e6ed$5107d340$f31779c0$@oracle.com> <903949ef-50a5-ccd9-07cd-ebdd65d65fa5@oracle.com> Message-ID: <032801d1e7e9$22162d50$664287f0$@oracle.com> Hi Daniel Would you like to have a look at the following changes before I finish all rework? It shows runWithAllPerm, and the handling for user.dir property in FilePolicy.java. The code like runWithTmpPermission is still kept, please ignore them, I will remove them finally. diff -r 1bfe60e61bad test/javax/xml/jaxp/libs/jaxp/library/FilePolicy.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/javax/xml/jaxp/libs/jaxp/library/FilePolicy.java Wed Jul 27 02:23:58 2016 -0700 @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2016, 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. + */ +package jaxp.library; + +import static jaxp.library.JAXPTestUtilities.getSystemProperty; + +import java.io.FilePermission; + +import org.testng.ITestContext; + +/** + * This policy can access local XML files. + */ +public class FilePolicy extends BasePolicy { + + @Override + public void onStart(ITestContext arg0) { + JAXPPolicyManager policyManager = JAXPPolicyManager.getJAXPPolicyManager(true); + String userdir = getSystemProperty("user.dir"); + policyManager.addPermission(new FilePermission(userdir + "/-", "read, write, delete")); + policyManager.addPermission(new FilePermission(System.getProperty("test.src") + "/-", "read")); + policyManager.addPermission(new FilePermission(userdir, "read")); + } +} diff -r 1bfe60e61bad test/javax/xml/jaxp/libs/jaxp/library/JAXPPolicyManager.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/javax/xml/jaxp/libs/jaxp/library/JAXPPolicyManager.java Wed Jul 27 02:23:58 2016 -0700 @@ -0,0 +1,312 @@ +/* + * Copyright (c) 2015, 2016, 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. + */ +package jaxp.library; + + +import java.lang.reflect.ReflectPermission; +import java.security.CodeSource; +import java.security.Permission; +import java.security.PermissionCollection; +import java.security.Permissions; +import java.security.Policy; +import java.security.ProtectionDomain; +import java.security.SecurityPermission; +import java.util.ArrayList; +import java.util.Enumeration; +import java.util.List; +import java.util.PropertyPermission; +import java.util.StringJoiner; + + +/* + * This is a base class that every test class must extend if it needs to be run + * with security mode. + */ +public class JAXPPolicyManager { + /* + * Backing up policy. + */ + private Policy policyBackup; + + /* + * Backing up security manager. + */ + private SecurityManager smBackup; + + /* + * Current policy. + */ + private TestPolicy policy = new TestPolicy(); + + /* + * JAXPPolicyManager singleton. + */ + private static JAXPPolicyManager policyManager = null; + + /* + * Install a SecurityManager along with a default Policy to allow testNG to + * run when there is a security manager. + */ + private JAXPPolicyManager() { + // Backing up policy and security manager for restore + policyBackup = Policy.getPolicy(); + smBackup = System.getSecurityManager(); + + // Set customized policy + setDefaultPermissions(); + Policy.setPolicy(policy); + System.setSecurityManager(new SecurityManager()); + } + + static synchronized JAXPPolicyManager getJAXPPolicyManager(boolean createIfNone) { + if (policyManager == null & createIfNone) + policyManager = new JAXPPolicyManager(); + return policyManager; + } + + private void teardown() throws Exception { + System.setSecurityManager(smBackup); + Policy.setPolicy(policyBackup); + } + + /* + * Restore the original Policy and SecurityManager. + */ + static synchronized void teardownPolicyManager() throws Exception { + if (policyManager != null) { + policyManager.teardown(); + policyManager = null; + } + } + + /* + * Set default permissions, sub-class of JAXPBaseTest should override this + * method. + */ + private void setDefaultPermissions() { + //Permissions to set security manager and policy + addPermission(new SecurityPermission("getPolicy")); + addPermission(new SecurityPermission("setPolicy")); + addPermission(new RuntimePermission("setSecurityManager")); + //Properties that jtreg and TestNG require + addPermission(new PropertyPermission("testng.show.stack.frames", "read")); + addPermission(new PropertyPermission("test.src", "read")); + addPermission(new PropertyPermission("test.classes", "read")); + addPermission(new PropertyPermission("dataproviderthreadcount", "read")); + addPermission(new PropertyPermission("experimental", "read")); + + //addPermission(new PropertyPermission("fileStringBuffer", "read")); + /* + addPermission(new RuntimePermission("getClassLoader")); + addPermission(new RuntimePermission("createClassLoader")); + addPermission(new RuntimePermission("createSecurityManager")); + addPermission(new RuntimePermission("modifyThread")); + addPermission(new PropertyPermission("*", "read, write")); + addPermission(new ReflectPermission("suppressAccessChecks")); + addPermission(new RuntimePermission("setIO")); + addPermission(new RuntimePermission("setContextClassLoader")); + addPermission(new RuntimePermission("accessDeclaredMembers"));*/ + } + + /* + * Add permission to the TestPolicy. + * + * @param permission to be added. + */ + void addPermission(Permission p) { + policy.addPermission(p); + } + + /* + * Add a temporary permission in current thread context. This won't impact + * global policy and doesn't support permission combination. + * + * @param permission + * to add. + * @return index of the added permission. + */ + int addTmpPermission(Permission p) { + return policy.addTmpPermission(p); + } + + /* + * set allowAll in current thread context. + */ + void setAllowAll(boolean allow) { + policy.setAllowAll(allow); + } + + /* + * Remove a temporary permission from current thread context. + * + * @param index to remove. + * + * @throws RuntimeException if no temporary permission list in current + * thread context or no permission correlated to the index. + */ + void removeTmpPermission(int index) { + policy.removeTmpPermission(index); + } + + +} + +/* + * Simple Policy class that supports the required Permissions to validate the + * JAXP concrete classes. + */ +class TestPolicy extends Policy { + private final PermissionCollection permissions = new Permissions(); + + private ThreadLocal> transientPermissions = new ThreadLocal<>(); + private ThreadLocal allowAll = new ThreadLocal<>(); + + private static Policy defaultPolicy = Policy.getPolicy(); + + /* + * Add permission to this policy. + * + * @param permission to be added. + */ + void addPermission(Permission p) { + permissions.add(p); + } + + /* + * Set all permissions. Caution: this should not called carefully unless + * it's really needed. + * + * private void setAllPermissions() { permissions.add(new AllPermission()); + * } + */ + + /* + * Overloaded methods from the Policy class. + */ + @Override + public String toString() { + StringJoiner sj = new StringJoiner("\n", "policy: ", ""); + Enumeration perms = permissions.elements(); + while (perms.hasMoreElements()) { + sj.add(perms.nextElement().toString()); + } + return sj.toString(); + + } + + @Override + public PermissionCollection getPermissions(ProtectionDomain domain) { + return permissions; + } + + @Override + public PermissionCollection getPermissions(CodeSource codesource) { + return permissions; + } + + @Override + public boolean implies(ProtectionDomain domain, Permission perm) { + if (allowAll()) + return true; + + if (defaultPolicy.implies(domain, perm)) + return true; + + if (permissions.implies(perm)) + return true; + else + return tmpImplies(perm); + } + + /* + * Add a temporary permission in current thread context. This won't impact + * global policy and doesn't support permission combination. + * + * @param permission to add. + * @return index of the added permission. + */ + int addTmpPermission(Permission p) { + List tmpPermissions = transientPermissions.get(); + if (tmpPermissions == null) + tmpPermissions = new ArrayList<>(); + + tmpPermissions.add(p); + transientPermissions.set(tmpPermissions); + return tmpPermissions.size() - 1; + } + + /* + * Remove a temporary permission from current thread context. + * + * @param index to remove. + * + * @throws RuntimeException if no temporary permission list in current + * thread context or no permission correlated to the index. + */ + void removeTmpPermission(int index) { + try { + List tmpPermissions = transientPermissions.get(); + tmpPermissions.remove(index); + } catch (NullPointerException | IndexOutOfBoundsException e) { + throw new RuntimeException("Tried to delete a non-existent temporary permission", e); + } + } + + /* + * Checks to see if the specified permission is implied by temporary + * permission list in current thread context. + * + * @param permission the Permission object to compare. + * + * @return true if "permission" is implied by any permission in the + * temporary permission list, false if not. + */ + private boolean tmpImplies(Permission perm) { + List tmpPermissions = transientPermissions.get(); + if (tmpPermissions != null) { + for (Permission p : tmpPermissions) { + if (p.implies(perm)) + return true; + } + } + return false; + } + + /* + * Checks to see if allow all permission requests in current thread context. + */ + private boolean allowAll() { + Boolean allow = allowAll.get(); + if (allow != null) { + return allow; + } + return false; + } + + /* + * set allowAll in current thread context. + */ + void setAllowAll(boolean allow) { + allowAll.set(allow); + } +} diff -r 1bfe60e61bad test/javax/xml/jaxp/libs/jaxp/library/JAXPTestUtilities.java --- a/test/javax/xml/jaxp/libs/jaxp/library/JAXPTestUtilities.java Mon Apr 04 14:54:38 2016 -0700 +++ b/test/javax/xml/jaxp/libs/jaxp/library/JAXPTestUtilities.java Wed Jul 27 02:23:58 2016 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -22,6 +22,8 @@ */ package jaxp.library; +import static org.testng.Assert.fail; + import java.io.ByteArrayInputStream; import java.io.File; import java.io.IOException; @@ -34,12 +36,18 @@ import java.nio.charset.UnsupportedCharsetException; import java.nio.file.Files; import java.nio.file.Paths; +import java.security.Permission; +import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Optional; import java.util.concurrent.ConcurrentHashMap; +import java.util.function.Supplier; import java.util.regex.Pattern; import java.util.stream.Collectors; +import java.util.stream.Stream; + import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; @@ -48,7 +56,7 @@ import javax.xml.transform.TransformerFactory; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; -import static org.testng.Assert.fail; + import org.w3c.dom.Document; import org.w3c.dom.Node; import org.xml.sax.SAXException; @@ -74,12 +82,6 @@ public static final String FILE_SEP = "/"; /** - * Current test directory. - */ - public static final String USER_DIR = - System.getProperty("user.dir", ".") + FILE_SEP;; - - /** * A map storing every test's current test file pointer. File number should * be incremental and it's a thread-safe reading on this file number. */ @@ -89,7 +91,7 @@ /** * BOM table for storing BOM header. */ - private final static Map bom = new HashMap<>(); + private final static Map bom = new HashMap(); /** * Initialize all BOM headers. @@ -130,8 +132,15 @@ */ public static boolean compareWithGold(String goldfile, String outputfile, Charset cs) throws IOException { - return Files.readAllLines(Paths.get(goldfile)). + boolean isSame = Files.readAllLines(Paths.get(goldfile)). equals(Files.readAllLines(Paths.get(outputfile), cs)); + if (!isSame) { + System.err.println("Golden file " + goldfile + " :"); + Files.readAllLines(Paths.get(goldfile)).forEach(System.err::println); + System.err.println("Output file " + outputfile + " :"); + Files.readAllLines(Paths.get(outputfile), cs).forEach(System.err::println); + } + return isSame; } /** @@ -308,10 +317,10 @@ int nextNumber = currentFileNumber.contains(clazz) ? currentFileNumber.get(clazz) + 1 : 1; Integer i = currentFileNumber.putIfAbsent(clazz, nextNumber); - if (i != null && i != nextNumber) { + if (i != null) { do { nextNumber = currentFileNumber.get(clazz) + 1; - } while (currentFileNumber.replace(clazz, nextNumber -1, nextNumber)); + } while (!currentFileNumber.replace(clazz, nextNumber - 1, nextNumber)); } return USER_DIR + clazz.getName() + nextNumber + ".out"; } @@ -332,4 +341,146 @@ toAbsolutePath().toString(); return normalizedPath.replace("\\", FILE_SEP) + FILE_SEP; } + + + /** + * Run the RunnableWithException with creating a JAXPPolicyManager and + * assigning temporary permissions. It's not thread-safe to use this + * function. + * + * @param r + * RunnableWithException to execute + * @param ps + * assigning permissions to add. + */ + public static void tryRunWithPolicyManager(RunnableWithException r, Permission... ps) throws Exception { + JAXPPolicyManager policyManager = JAXPPolicyManager.getJAXPPolicyManager(true); + if (policyManager != null) + Stream.of(ps).forEach(p -> policyManager.addTmpPermission(p)); + try { + r.run(); + } finally { + JAXPPolicyManager.teardownPolicyManager(); + } + } + + /** + * Run the runnable with assigning temporary permissions. This won't impact + * global policy. + * + * @param r + * Runnable to run + * @param ps + * assigning permissions to add. + */ + public static void runWithTmpPermission(Runnable r, Permission... ps) { + JAXPPolicyManager policyManager = JAXPPolicyManager.getJAXPPolicyManager(false); + List tmpPermissionIndexes = new ArrayList(); + if (policyManager != null) + Stream.of(ps).forEach(p -> tmpPermissionIndexes.add(policyManager.addTmpPermission(p))); + try { + r.run(); + } finally { + tmpPermissionIndexes.forEach(index -> policyManager.removeTmpPermission(index)); + } + } + + /** + * Run the supplier with all permissions. This won't impact global policy. + * + * @param s + * Supplier to run + */ + public static T runWithAllPerm(Supplier s) { + Optional policyManager = Optional.ofNullable(JAXPPolicyManager + .getJAXPPolicyManager(false)); + policyManager.ifPresent(manager -> manager.setAllowAll(true)); + try { + return s.get(); + } finally { + policyManager.ifPresent(manager -> manager.setAllowAll(false)); + } + } + + /** + * Run the Runnable with all permissions. This won't impact global policy. + * + * @param s + * Supplier to run + */ + public static void runWithAllPerm(Runnable r) { + Optional policyManager = Optional.ofNullable(JAXPPolicyManager + .getJAXPPolicyManager(false)); + policyManager.ifPresent(manager -> manager.setAllowAll(true)); + try { + r.run(); + } finally { + policyManager.ifPresent(manager -> manager.setAllowAll(false)); + } + } + + /** + * Acquire a system property. + * + * @param name + * System property name to be acquired. + * @return property value + */ + public static String getSystemProperty(String name) { + return runWithAllPerm(() -> System.getProperty(name)); + } + + /** + * Set a system property by given system value. + * + * @param name + * System property name to be set. + * @param value + * System property value to be set. + */ + public static void setSystemProperty(String name, String value) { + runWithAllPerm(() -> System.setProperty(name, value)); + } + + /** + * Clear a system property. + * + * @param name + * System property name to be cleared. + */ + public static void clearSystemProperty(String name) { + runWithAllPerm(() -> clearSystemProperty(name)); + } + + /** + * Run the RunnableWithException with assigning temporary permissions. This + * won't impact global policy. + * + * @param r + * RunnableWithException to execute + * @param ps + * assigning permissions to add. + */ + public static void tryRunWithTmpPermission(RunnableWithException r, Permission... ps) throws Exception { + JAXPPolicyManager policyManager = JAXPPolicyManager.getJAXPPolicyManager(false); + List tmpPermissionIndexes = new ArrayList(); + if (policyManager != null) + Stream.of(ps).forEach(p -> tmpPermissionIndexes.add(policyManager.addTmpPermission(p))); + try { + r.run(); + } finally { + tmpPermissionIndexes.forEach(index -> policyManager.removeTmpPermission(index)); + } + } + + @FunctionalInterface + public interface RunnableWithException { + void run() throws Exception; + } + + /** + * Current test directory. + */ + public static final String USER_DIR = getSystemProperty("user.dir") + FILE_SEP;; + } diff -r 1bfe60e61bad test/javax/xml/jaxp/unittest/transform/Bug6490921.java --- a/test/javax/xml/jaxp/unittest/transform/Bug6490921.java Mon Apr 04 14:54:38 2016 -0700 +++ b/test/javax/xml/jaxp/unittest/transform/Bug6490921.java Wed Jul 27 02:22:40 2016 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -23,6 +23,8 @@ package transform; +import static jaxp.library.JAXPTestUtilities.setSystemProperty; + import java.io.IOException; import java.io.StringReader; import java.io.StringWriter; @@ -37,6 +39,7 @@ import javax.xml.transform.stream.StreamResult; import org.testng.Assert; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.xml.sax.InputSource; import org.xml.sax.SAXException; @@ -46,6 +49,7 @@ * @bug 6490921 * @summary Test property org.xml.sax.driver is always applied in transformer API. */ + at Listeners({jaxp.library.BasePolicy.class}) public class Bug6490921 { public static class ReaderStub extends XMLFilterImpl { @@ -71,7 +75,7 @@ public void test01() { String xml = ""; ReaderStub.used = false; - System.setProperty("org.xml.sax.driver", ""); + setSystemProperty("org.xml.sax.driver", ""); // Don't set 'org.xml.sax.driver' here, just use default try { @@ -91,7 +95,7 @@ public void test02() { String xml = ""; ReaderStub.used = false; - System.setProperty("org.xml.sax.driver", ReaderStub.class.getName()); + setSystemProperty("org.xml.sax.driver", ReaderStub.class.getName()); try { TransformerFactory transFactory = TransformerFactory.newInstance(); Transformer transformer = transFactory.newTransformer(); @@ -111,7 +115,7 @@ + " Hello World!\n" + "\n"; ReaderStub.used = false; - System.setProperty("org.xml.sax.driver", ReaderStub.class.getName()); + setSystemProperty("org.xml.sax.driver", ReaderStub.class.getName()); try { TransformerFactory transFactory = TransformerFactory.newInstance(); if (transFactory.getFeature(SAXTransformerFactory.FEATURE) == false) { Thanks Frank -----Original Message----- From: Daniel Fuchs [mailto:daniel.fuchs at oracle.com] Sent: Tuesday, July 26, 2016 3:46 PM To: Frank Yuan; 'huizhe wang' Cc: 'Amy Lu'; 'core-libs-dev' Subject: Re: RFR (JAXP) JDK-8067170: Enable security manager on JAXP unit tests On 26/07/16 04:24, Frank Yuan wrote: > Thank you very much for your suggestions! Now I fully understand the rule(at least I think so :P) > I will use a runWithAllPerm block surrounding the user setup code as Daniel's way. Btw, Daniel, ThreadLocal should not need Atomic > any more, correct? > Hi Frank, runWithAllPerm is another way to do it. It uses a ThreadLocal, right? I agree it's adequate. Just be careful of what might happen if you run runWithAllPerm inside runWithPermissions, or runWithPermissions(runnable, a,b,c) with a runnable that later calls runWithPermission(runnable2, a, d, e) further down the road. At the moment I'm not sure whether your code will work correctly in the presence of such nested invocation (maybe it does), but because it seems to be index based it's not immediately obvious (I'm not asking you to change it - just to verify and confirm that it's something you have taken into account, and that you're confident that it works). Best regards, -- daniel From chris.hegarty at oracle.com Wed Jul 27 10:17:23 2016 From: chris.hegarty at oracle.com (Chris Hegarty) Date: Wed, 27 Jul 2016 11:17:23 +0100 Subject: RFR: 6543126: Level.known can leak memory In-Reply-To: <18377964-f7c7-e1a2-4cb5-05df2085bb5a@oracle.com> References: <18377964-f7c7-e1a2-4cb5-05df2085bb5a@oracle.com> Message-ID: Hi Daniel, On 25/07/16 19:10, Daniel Fuchs wrote: > Hi, > > Please find below a fix for: > > 6543126: Level.known can leak memory > https://bugs.openjdk.java.net/browse/JDK-6543126 > > webrev: > http://cr.openjdk.java.net/~dfuchs/webrev_6543126/webrev.00 Since mirroredLevel is a strong reference to the same given Level, in the case where the level's class is the JDK's Level.class, then you do not need either of the reachabilityFence's. With this change there is a race between checking the weak reference and accessing the mirroredLevel, this is evident in findLevel(String). I think this is benign, the code is racy, but not susceptible to any issues resulting from this. Otherwise, the changes look good to me. -Chris From paul.sandoz at oracle.com Wed Jul 27 11:47:12 2016 From: paul.sandoz at oracle.com (Paul Sandoz) Date: Wed, 27 Jul 2016 13:47:12 +0200 Subject: RFR 8162458 Buffer view implementations use incorrect offset for Unsafe access Message-ID: <2F815E1E-1DA6-4010-9B39-5D7BBB2DF069@oracle.com> Hi, I made an embarrassing mistake in the fix for https://bugs.openjdk.java.net/browse/JDK-8151163 All Buffer implementations should leverage Unsafe unaligned accessors The offset calculation for Unsafe access was incorrect, it?s easy to get confused because for heap buffers the offset is relative to the array, and for direct buffers the address (which can update for slices/duplicates). Disturbingly all existing tests were passing both for core and hotspot when i pushed to hs. As a penance i wrote a combinatorial test for buffer views to navigate the twisty maze of heap/direct, aligned/unaligned, little/big endian for accessing binary data and views from the source buffer. Please review: http://cr.openjdk.java.net/~psandoz/jdk9/JDK-8162458-byte-buffer-view-offset-access-incorrect/webrev/ (This may be a duplicate of [1]). Test has been verified to fail with the existing code. Focused JPRT runs pass, but i will kick off core/hotspot runs later on today. I will push to hs since that is where JDK-8151163 and it has not been integrated into jdk9/dev. Paul. [1] https://bugs.openjdk.java.net/browse/JDK-8159257 unsafe.cpp: assert(byte_offset < p_size) failed: Unsafe access: offset 32767 > object's size 16 For the test runtime/Unsafe/RangeCheck.java I can reproduce a crash in jdk9/dev which does not have JDK-8151163, and i can reproduce on jdk9/hs with this fix for JDK-8162458. From oleg.barbashov at oracle.com Wed Jul 27 12:34:20 2016 From: oleg.barbashov at oracle.com (Oleg G. Barbashov) Date: Wed, 27 Jul 2016 15:34:20 +0300 Subject: RFR: 8158295 Add a multi-release jar validation mechanism to jar tool In-Reply-To: References: Message-ID: <33e3741c-fb99-f09c-3cf2-179e2c5491ea@oracle.com> 07.07.2016 23:32, Steve Drach ?????: > Hi, > > Please review the following: > > webrev: http://cr.openjdk.java.net/~sdrach/8158295/webrev.01/ > issue: https://bugs.openjdk.java.net/browse/JDK-8158295 > > This changeset adds a multi-release jar validator to jar tool. After the jar tool builds a multi-release jar, the potential resultant jar file is passed to the validator to assure that the jar file meets the minimal standards of a multi-release jar, in particular that versioned classes have the same api as base classes they override. There are other checks, for example warning if two classes are identical. If the jar file is invalid, it is not kept, so ?create will not produce a jar file and ?update will keep the input jar file. > > Thanks > Steve 574 private boolean validate(String fname) { 575 boolean valid = true; 576 Validator validator = new Validator(this); 577 578 try (JarFile jf = new JarFile(fname)) { 579 AtomicBoolean validHolder = new AtomicBoolean(valid); 580 jf.stream() 581 .filter(e -> !e.isDirectory()) 582 .filter(e -> !e.getName().equals(MANIFEST_NAME)) 583 .filter(e -> !e.getName().endsWith(MODULE_INFO)) 584 .sorted(entryComparator) 585 .forEachOrdered(je -> { 586 boolean b = validator.accept(je, jf); 587 if (validHolder.get()) validHolder.set(b); 588 }); 589 valid = validHolder.get(); 590 } catch (IOException e) { 591 error(formatMsg2("error.validator.jarfile.exception", fname, e.getMessage())); 592 valid = false; 593 } catch (InvalidJarException e) { 594 error(formatMsg("error.validator.bad.entry.name", e.getMessage())); 595 valid = false; 596 } 597 return valid; 598 } (IMHO) Using of AtomicBoolean and forEachOrdered() for stateful validator here looks forced. It may be avoided by using regular iterator with "for" loop: Stream sorted = jf.stream() .filter(e -> !e.isDirectory()) .filter(e -> !e.getName().equals(MANIFEST_NAME)) .filter(e -> !e.getName().endsWith(MODULE_INFO)) .sorted(entryComparator); for (Iterator iter = sorted.iterator(); iter.hasNext();) { if (!validator.accept(iter.next(), jf)) { valid = false; } } or even better by storing "valid" state inside the Validator after turning it to regular Consumer: try (JarFile jf = new JarFile(fname)) { Validator validator = new Validator(this, jf); jf.stream() .filter(e -> !e.isDirectory()) .filter(e -> !e.getName().equals(MANIFEST_NAME)) .filter(e -> !e.getName().endsWith(MODULE_INFO)) .sorted(entryComparator) .forEachOrdered(validator); return validator.isValidated(); } catch (IOException e) { error(formatMsg2("error.validator.jarfile.exception", fname, e.getMessage())); return false; } catch (NumberFormatException e) { error(formatMsg("error.validator.bad.entry.name", e.getMessage())); return false; } Moreover what is the reason to have an external loop over the jar's entries? Even if we will use several different filter sets in future it would be better to use it as optional parameter for Validator. From daniel.fuchs at oracle.com Wed Jul 27 12:52:41 2016 From: daniel.fuchs at oracle.com (Daniel Fuchs) Date: Wed, 27 Jul 2016 13:52:41 +0100 Subject: RFR (JAXP) JDK-8067170: Enable security manager on JAXP unit tests In-Reply-To: <032801d1e7e9$22162d50$664287f0$@oracle.com> References: <022401d1e0d7$54111090$fc3331b0$@oracle.com> <578CA476.7030407@oracle.com> <03a601d1e3e6$92c45a60$b84d0f20$@oracle.com> <040101d1e3f9$9d19a340$d74ce9c0$@oracle.com> <88977a21-e4d1-e792-00db-1debc3162b08@oracle.com> <024a01d1e659$7dcefcd0$796cf670$@oracle.com> <27ea3634-6e47-70e9-4099-69bd86d3d635@oracle.com> <027101d1e6ed$5107d340$f31779c0$@oracle.com> <903949ef-50a5-ccd9-07cd-ebdd65d65fa5@oracle.com> <032801d1e7e9$22162d50$664287f0$@oracle.com> Message-ID: <7830330b-df99-023e-b778-61725d4e6001@oracle.com> Hi Frank, Please see my comments inline. On 27/07/16 10:27, Frank Yuan wrote: > Hi Daniel > > Would you like to have a look at the following changes before I finish all rework? > It shows runWithAllPerm, and the handling for user.dir property in FilePolicy.java. The code like runWithTmpPermission is still > kept, please ignore them, I will remove them finally. > > diff -r 1bfe60e61bad test/javax/xml/jaxp/libs/jaxp/library/FilePolicy.java > --- /dev/null Thu Jan 01 00:00:00 1970 +0000 > +++ b/test/javax/xml/jaxp/libs/jaxp/library/FilePolicy.java Wed Jul 27 02:23:58 2016 -0700 > @@ -0,0 +1,44 @@ > +/* > + * Copyright (c) 2016, 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. > + */ > +package jaxp.library; > + > +import static jaxp.library.JAXPTestUtilities.getSystemProperty; > + > +import java.io.FilePermission; > + > +import org.testng.ITestContext; > + > +/** > + * This policy can access local XML files. > + */ > +public class FilePolicy extends BasePolicy { > + > + @Override > + public void onStart(ITestContext arg0) { > + JAXPPolicyManager policyManager = JAXPPolicyManager.getJAXPPolicyManager(true); > + String userdir = getSystemProperty("user.dir"); > + policyManager.addPermission(new FilePermission(userdir + "/-", "read, write, delete")); I see that FilePermission allows white spaces but I believe the canonical form would be "read,write,delete"; > + policyManager.addPermission(new FilePermission(System.getProperty("test.src") + "/-", "read")); > + policyManager.addPermission(new FilePermission(userdir, "read")); > + } > +} > diff -r 1bfe60e61bad test/javax/xml/jaxp/libs/jaxp/library/JAXPPolicyManager.java > --- /dev/null Thu Jan 01 00:00:00 1970 +0000 > +++ b/test/javax/xml/jaxp/libs/jaxp/library/JAXPPolicyManager.java Wed Jul 27 02:23:58 2016 -0700 > @@ -0,0 +1,312 @@ [...] > + private void setDefaultPermissions() { > + //Permissions to set security manager and policy > + addPermission(new SecurityPermission("getPolicy")); > + addPermission(new SecurityPermission("setPolicy")); > + addPermission(new RuntimePermission("setSecurityManager")); > + //Properties that jtreg and TestNG require > + addPermission(new PropertyPermission("testng.show.stack.frames", "read")); > + addPermission(new PropertyPermission("test.src", "read")); > + addPermission(new PropertyPermission("test.classes", "read")); > + addPermission(new PropertyPermission("dataproviderthreadcount", "read")); > + addPermission(new PropertyPermission("experimental", "read")); > + > + //addPermission(new PropertyPermission("fileStringBuffer", "read")); > + /* > + addPermission(new RuntimePermission("getClassLoader")); > + addPermission(new RuntimePermission("createClassLoader")); > + addPermission(new RuntimePermission("createSecurityManager")); > + addPermission(new RuntimePermission("modifyThread")); > + addPermission(new PropertyPermission("*", "read, write")); > + addPermission(new ReflectPermission("suppressAccessChecks")); > + addPermission(new RuntimePermission("setIO")); > + addPermission(new RuntimePermission("setContextClassLoader")); > + addPermission(new RuntimePermission("accessDeclaredMembers"));*/ Good to see these permissions are now commented: make sure to remove the commented code in the final version. > + /* > + * set allowAll in current thread context. > + */ > + void setAllowAll(boolean allow) { > + policy.setAllowAll(allow); > + } I'd suggest to return the previous value of allowAll here. This will be more convenient to restore the previous value in the finally block. Since setters usually don't return values you might name it e.g. /** * Switches allowAll to the given value and return its * previous value in current thread context. *

    * Example of use: * {@code * final boolean before = switchAllowAll(true); * try { * // do some privileged operation here * } finally { * // restore allowAll to its previous value * switchAllowAll(before); * } * } */ boolean switchAllowAll(boolean allowAll) { // alternatively you could add a switchAllowAll method // to TestPolicy final boolean before = policy.allowAll(); policy.setAllowAll(allowAll); return before; } [..] > + /** > + * Run the RunnableWithException with creating a JAXPPolicyManager and > + * assigning temporary permissions. It's not thread-safe to use this > + * function. > + * > + * @param r > + * RunnableWithException to execute > + * @param ps > + * assigning permissions to add. > + */ > + public static void tryRunWithPolicyManager(RunnableWithException r, Permission... ps) throws Exception { > + JAXPPolicyManager policyManager = JAXPPolicyManager.getJAXPPolicyManager(true); > + if (policyManager != null) > + Stream.of(ps).forEach(p -> policyManager.addTmpPermission(p)); > + try { > + r.run(); > + } finally { > + JAXPPolicyManager.teardownPolicyManager(); > + } > + } This method is suspicious because if there existed a JAXPPolicyManager before entering it it will be removed after the method finishes. I'd suggest removing this method. You can accomplish the same things by calling: JAXPPolicyManager policyManager = JAXPPolicyManager.getJAXPPolicyManager(true); runWithTmpPermission(r, ps); since runWithTmpPermission seems to do things right. > + > + /** > + * Run the runnable with assigning temporary permissions. This won't impact > + * global policy. > + * > + * @param r > + * Runnable to run > + * @param ps > + * assigning permissions to add. > + */ > + public static void runWithTmpPermission(Runnable r, Permission... ps) { > + JAXPPolicyManager policyManager = JAXPPolicyManager.getJAXPPolicyManager(false); > + List tmpPermissionIndexes = new ArrayList(); > + if (policyManager != null) > + Stream.of(ps).forEach(p -> tmpPermissionIndexes.add(policyManager.addTmpPermission(p))); > + try { > + r.run(); > + } finally { if policyManager is null this will throw NPE. Maybe you shoud make addTmpPermission and removeTmpPermission static in JAXPPolicyManager, and delegate the null checking of the global policyManager instance inside those methods. > + tmpPermissionIndexes.forEach(index -> policyManager.removeTmpPermission(index)); > + } > + } > + > + /** > + * Run the supplier with all permissions. This won't impact global policy. > + * > + * @param s > + * Supplier to run > + */ > + public static T runWithAllPerm(Supplier s) { > + Optional policyManager = Optional.ofNullable(JAXPPolicyManager > + .getJAXPPolicyManager(false)); > + policyManager.ifPresent(manager -> manager.setAllowAll(true)); > + try { > + return s.get(); > + } finally { > + policyManager.ifPresent(manager -> manager.setAllowAll(false)); This should restore allowAll to its previous value rather than 'false'. Maybe you should make setAllowAll/switchAllowAll static in policyManager. The allowAll ThreadLocal can be static as well, so you don't really to have an instance of JAXPPolicyManager or TestPolicy to switch it on or off. > + } > + } > + > + /** > + * Run the Runnable with all permissions. This won't impact global policy. > + * > + * @param s > + * Supplier to run > + */ > + public static void runWithAllPerm(Runnable r) { > + Optional policyManager = Optional.ofNullable(JAXPPolicyManager > + .getJAXPPolicyManager(false)); > + policyManager.ifPresent(manager -> manager.setAllowAll(true)); > + try { > + r.run(); > + } finally { > + policyManager.ifPresent(manager -> manager.setAllowAll(false)); This should restore allowAll to its previous value rather than 'false'. > > diff -r 1bfe60e61bad test/javax/xml/jaxp/unittest/transform/Bug6490921.java > --- a/test/javax/xml/jaxp/unittest/transform/Bug6490921.java Mon Apr 04 14:54:38 2016 -0700 > +++ b/test/javax/xml/jaxp/unittest/transform/Bug6490921.java Wed Jul 27 02:22:40 2016 -0700 > @@ -1,5 +1,5 @@ > /* > - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. > + * Copyright (c) 2014, 2016, 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 > @@ -23,6 +23,8 @@ > > package transform; > > +import static jaxp.library.JAXPTestUtilities.setSystemProperty; > + > import java.io.IOException; > import java.io.StringReader; > import java.io.StringWriter; > @@ -37,6 +39,7 @@ > import javax.xml.transform.stream.StreamResult; > > import org.testng.Assert; > +import org.testng.annotations.Listeners; > import org.testng.annotations.Test; > import org.xml.sax.InputSource; > import org.xml.sax.SAXException; > @@ -46,6 +49,7 @@ > * @bug 6490921 > * @summary Test property org.xml.sax.driver is always applied in transformer API. > */ > + at Listeners({jaxp.library.BasePolicy.class}) > public class Bug6490921 { > > public static class ReaderStub extends XMLFilterImpl { > @@ -71,7 +75,7 @@ > public void test01() { > String xml = ""; > ReaderStub.used = false; > - System.setProperty("org.xml.sax.driver", ""); > + setSystemProperty("org.xml.sax.driver", ""); > > // Don't set 'org.xml.sax.driver' here, just use default > try { > @@ -91,7 +95,7 @@ > public void test02() { > String xml = ""; > ReaderStub.used = false; > - System.setProperty("org.xml.sax.driver", ReaderStub.class.getName()); > + setSystemProperty("org.xml.sax.driver", ReaderStub.class.getName()); > try { > TransformerFactory transFactory = TransformerFactory.newInstance(); > Transformer transformer = transFactory.newTransformer(); > @@ -111,7 +115,7 @@ > + " Hello World!\n" + "\n"; > > ReaderStub.used = false; > - System.setProperty("org.xml.sax.driver", ReaderStub.class.getName()); > + setSystemProperty("org.xml.sax.driver", ReaderStub.class.getName()); > try { > TransformerFactory transFactory = TransformerFactory.newInstance(); > if (transFactory.getFeature(SAXTransformerFactory.FEATURE) == false) { > I think the test looks fine. cheers, -- daniel > Thanks > Frank > > -----Original Message----- > From: Daniel Fuchs [mailto:daniel.fuchs at oracle.com] > Sent: Tuesday, July 26, 2016 3:46 PM > To: Frank Yuan; 'huizhe wang' > Cc: 'Amy Lu'; 'core-libs-dev' > Subject: Re: RFR (JAXP) JDK-8067170: Enable security manager on JAXP unit tests > > On 26/07/16 04:24, Frank Yuan wrote: >> Thank you very much for your suggestions! Now I fully understand the rule(at least I think so :P) >> I will use a runWithAllPerm block surrounding the user setup code as Daniel's way. Btw, Daniel, ThreadLocal should not need Atomic >> any more, correct? >> > > Hi Frank, > > runWithAllPerm is another way to do it. > It uses a ThreadLocal, right? > > I agree it's adequate. Just be careful of what might > happen if you run runWithAllPerm inside runWithPermissions, > or runWithPermissions(runnable, a,b,c) with a runnable that > later calls runWithPermission(runnable2, a, d, e) further down > the road. > > At the moment I'm not sure whether your code will work correctly > in the presence of such nested invocation (maybe it does), > but because it seems to be index based it's not immediately > obvious (I'm not asking you to change it - just to verify and > confirm that it's something you have taken into account, and > that you're confident that it works). > > > Best regards, > > -- daniel > From daniel.fuchs at oracle.com Wed Jul 27 12:58:51 2016 From: daniel.fuchs at oracle.com (Daniel Fuchs) Date: Wed, 27 Jul 2016 13:58:51 +0100 Subject: RFR: 6543126: Level.known can leak memory In-Reply-To: References: <18377964-f7c7-e1a2-4cb5-05df2085bb5a@oracle.com> Message-ID: Hi Chris, On 27/07/16 11:17, Chris Hegarty wrote: > Hi Daniel, > > On 25/07/16 19:10, Daniel Fuchs wrote: >> Hi, >> >> Please find below a fix for: >> >> 6543126: Level.known can leak memory >> https://bugs.openjdk.java.net/browse/JDK-6543126 >> >> webrev: >> http://cr.openjdk.java.net/~dfuchs/webrev_6543126/webrev.00 > > Since mirroredLevel is a strong reference to the same given Level, > in the case where the level's class is the JDK's Level.class, then > you do not need either of the reachabilityFence's. Yes good catch. > With this change there is a race between checking the weak reference > and accessing the mirroredLevel, this is evident in findLevel(String). > I think this is benign, the code is racy, but not susceptible to any > issues resulting from this. Yes - nothing would prevent the custom level Object (the reference's target) to be garbaged collected just after the mirrored level is returned, but we don't care. So there would be no point in trying to ensure the reference is not stale just before returning. That's acceptable. > > Otherwise, the changes look good to me. Thanks! > > -Chris From daniel.fuchs at oracle.com Wed Jul 27 13:15:36 2016 From: daniel.fuchs at oracle.com (Daniel Fuchs) Date: Wed, 27 Jul 2016 14:15:36 +0100 Subject: RFR 9: JEP 290: Filter Incoming Serialization Data In-Reply-To: <9666c25e-ef9c-8ea2-6175-019801b2e75f@Oracle.com> References: <7a1bd8d7-1bf6-7357-6fcd-b7c83b08e52b@Oracle.com> <3ce4aef4-e0fc-4d4f-dfd6-484e12f89e2a@Oracle.com> <9666c25e-ef9c-8ea2-6175-019801b2e75f@Oracle.com> Message-ID: <58bbd16f-f6d4-f51d-1073-5dd7ee7a1f04@oracle.com> Hi Roger, ObjectInputStream.java: 179 * If a {@link #setObjectInputFilter(ObjectInputFilter) filter is set} 184 * A {@link ObjectInputFilter.Config#setSerialFilter(ObjectInputFilter) process-wide filter} these two lines should be using {@linkplain, not {@link. 308 private ObjectInputFilter serialFilter; This field is supposed to be set only once. We can't use final because we may not know its value right at construction time, so the setter tries to do its best to ensure that the field is not changed after serialization has begun. To improve that and make it more 'final-like' I would make this field volatile and the setter synchronized. best regards, -- daniel On 26/07/16 18:57, Roger Riggs wrote: > Hi, > > Updated the specdiff and javadoc with SerializablePermission and misc > editorial cleanups. > > SpecDiff: > http://cr.openjdk.java.net/~rriggs/filter-diffs/overview-summary.html > > Javadoc (subset) > http://cr.openjdk.java.net/~rriggs/filter-javadoc/java/io/ObjectInputStream.html > > http://cr.openjdk.java.net/~rriggs/filter-javadoc/java/io/ObjectInputFilter.html > > http://cr.openjdk.java.net/~rriggs/filter-javadoc/java/io/SerializablePermission.html > > > Also, noticed that a filter could not distinguish between a reference to > an array class and > the callback to check the size of a zero length array (size == 0). > Modified the > range of the size to be positive when creating an array and otherwise > negative. > > Webrev: > http://cr.openjdk.java.net/~rriggs/webrev-serial-filter-jdk9-8155760/ > > Roger > > > On 7/26/2016 12:34 PM, Roger Riggs wrote: >> Hi Chris, >> >> yes, its in the webrev, but I neglected to include it in the javadoc >> and specdiff updates. >> >> Thanks, Roger >> >> >> On 7/26/2016 12:20 PM, Chris Hegarty wrote: >>> Another final thought that just occurred to me? >>> >>> java.io.SerializablePermission will need its class-level javadoc >>> updated to >>> include the new permission target name. >>> >>> -Chris. >>> >>>> On 25 Jul 2016, at 19:55, Roger Riggs wrote: >>>> >>>> Hi Chris, >>>> >>>> Thanks for the review and comments, >>>> >>>> Updates in place: >>>> >>>> Webrev: >>>> http://cr.openjdk.java.net/~rriggs/webrev-serial-filter-jdk9-8155760/ >>>> >>>> SpecDiff: >>>> http://cr.openjdk.java.net/~rriggs/filter-diffs/overview-summary.html >>>> >>>> Javadoc (subset) >>>> http://cr.openjdk.java.net/~rriggs/filter-javadoc/java/io/ObjectInputStream.html >>>> >>>> >>>> http://cr.openjdk.java.net/~rriggs/filter-javadoc/java/io/ObjectInputFilter.html >>>> >>>> > From martinrb at google.com Wed Jul 27 13:39:44 2016 From: martinrb at google.com (Martin Buchholz) Date: Wed, 27 Jul 2016 06:39:44 -0700 Subject: RFR: 8162563: Fix double checked locking in System.console() In-Reply-To: <20208de7-50a2-b4c6-3306-73d6da9b1e8a@oracle.com> References: <20208de7-50a2-b4c6-3306-73d6da9b1e8a@oracle.com> Message-ID: On Tue, Jul 26, 2016 at 11:13 PM, David Holmes wrote: > On 27/07/2016 3:45 PM, Martin Buchholz wrote: > >> Hi David, >> >> I didn't even look at Console.java! I just fixed the double-checked >> locking in System.java. >> >> Looking now at Console.cons, that is NOT safely statically initialized: >> >> SharedSecrets.setJavaIOAccess(new JavaIOAccess() { >> public Console console() { >> if (istty()) { >> if (cons == null) >> cons = new Console(); >> return cons; >> } >> return null; >> } >> >> (but it's currently safe because only System.java accesses it) >> > > The above code is in a static initialization block. > Sure, but the code isn't run (yet), just made available to be run later via JavaIOAccess when System.console() is called. From Roger.Riggs at Oracle.com Wed Jul 27 14:37:28 2016 From: Roger.Riggs at Oracle.com (Roger Riggs) Date: Wed, 27 Jul 2016 10:37:28 -0400 Subject: RFR 9: JEP 290: Filter Incoming Serialization Data In-Reply-To: <58bbd16f-f6d4-f51d-1073-5dd7ee7a1f04@oracle.com> References: <7a1bd8d7-1bf6-7357-6fcd-b7c83b08e52b@Oracle.com> <3ce4aef4-e0fc-4d4f-dfd6-484e12f89e2a@Oracle.com> <9666c25e-ef9c-8ea2-6175-019801b2e75f@Oracle.com> <58bbd16f-f6d4-f51d-1073-5dd7ee7a1f04@oracle.com> Message-ID: <8f483d12-aa78-a1d8-69fd-88c19e7ca7ea@Oracle.com> Hi Daniel, On 7/27/2016 9:15 AM, Daniel Fuchs wrote: > Hi Roger, > > ObjectInputStream.java: > > 179 * If a {@link #setObjectInputFilter(ObjectInputFilter) filter is > set} > > 184 * A {@link > ObjectInputFilter.Config#setSerialFilter(ObjectInputFilter) > process-wide filter} > > these two lines should be using {@linkplain, not {@link. right, will fix > > 308 private ObjectInputFilter serialFilter; > > This field is supposed to be set only once. We can't use final > because we may not know its value right at construction time, so > the setter tries to do its best to ensure that the field is not > changed after serialization has begun. > To improve that and make it more 'final-like' I would make this > field volatile and the setter synchronized. I don't think this is necessary, the initial value is set in the constructor and is therefore safely published. OIS is not-thread safe and is used from a single thread. The owning thread would set/replace the filter before any deserialization occurs and calls to readObject/readUnshared would be in that same thread. Thanks, Roger > > best regards, > > -- daniel > > > On 26/07/16 18:57, Roger Riggs wrote: >> Hi, >> >> Updated the specdiff and javadoc with SerializablePermission and misc >> editorial cleanups. >> >> SpecDiff: >> http://cr.openjdk.java.net/~rriggs/filter-diffs/overview-summary.html >> >> Javadoc (subset) >> http://cr.openjdk.java.net/~rriggs/filter-javadoc/java/io/ObjectInputStream.html >> >> >> http://cr.openjdk.java.net/~rriggs/filter-javadoc/java/io/ObjectInputFilter.html >> >> >> http://cr.openjdk.java.net/~rriggs/filter-javadoc/java/io/SerializablePermission.html >> >> >> >> Also, noticed that a filter could not distinguish between a reference to >> an array class and >> the callback to check the size of a zero length array (size == 0). >> Modified the >> range of the size to be positive when creating an array and otherwise >> negative. >> >> Webrev: >> http://cr.openjdk.java.net/~rriggs/webrev-serial-filter-jdk9-8155760/ >> >> Roger >> >> >> On 7/26/2016 12:34 PM, Roger Riggs wrote: >>> Hi Chris, >>> >>> yes, its in the webrev, but I neglected to include it in the javadoc >>> and specdiff updates. >>> >>> Thanks, Roger >>> >>> >>> On 7/26/2016 12:20 PM, Chris Hegarty wrote: >>>> Another final thought that just occurred to me? >>>> >>>> java.io.SerializablePermission will need its class-level javadoc >>>> updated to >>>> include the new permission target name. >>>> >>>> -Chris. >>>> >>>>> On 25 Jul 2016, at 19:55, Roger Riggs wrote: >>>>> >>>>> Hi Chris, >>>>> >>>>> Thanks for the review and comments, >>>>> >>>>> Updates in place: >>>>> >>>>> Webrev: >>>>> http://cr.openjdk.java.net/~rriggs/webrev-serial-filter-jdk9-8155760/ >>>>> >>>>> SpecDiff: >>>>> http://cr.openjdk.java.net/~rriggs/filter-diffs/overview-summary.html >>>>> >>>>> Javadoc (subset) >>>>> http://cr.openjdk.java.net/~rriggs/filter-javadoc/java/io/ObjectInputStream.html >>>>> >>>>> >>>>> >>>>> http://cr.openjdk.java.net/~rriggs/filter-javadoc/java/io/ObjectInputFilter.html >>>>> >>>>> >>>>> >> > From daniel.fuchs at oracle.com Wed Jul 27 15:01:09 2016 From: daniel.fuchs at oracle.com (Daniel Fuchs) Date: Wed, 27 Jul 2016 16:01:09 +0100 Subject: RFR [9] 8160513: ClassNotFoundException sun.misc.GC when running Tomcat 9 with JDK 9 In-Reply-To: References: Message-ID: <1b0051cd-840f-94f0-7bac-cc88ba1e7d22@oracle.com> On 26/07/16 16:24, Chris Hegarty wrote: > The GC.Daemon thread has no need of any user defined class loader, > so should set its context class loader to null before starting, so as to > not inadvertently retain a reference to the creating thread?s context > class loader. > > http://cr.openjdk.java.net/~chegar/8160513/ > https://bugs.openjdk.java.net/browse/JDK-8160513 Looks good to me Chris. Another possibility might be to use InnocuousThread? best regards, -- daniel > > -Chris. > > P.S. I added a detailed comment the JIRA issue, for those wondering > why Tomcat is running into this. > From mark.sheppard at oracle.com Wed Jul 27 15:13:02 2016 From: mark.sheppard at oracle.com (Mark Sheppard) Date: Wed, 27 Jul 2016 16:13:02 +0100 Subject: RFR [9] 8160513: ClassNotFoundException sun.misc.GC when running Tomcat 9 with JDK 9 In-Reply-To: References: Message-ID: Hi Chris, change looks good to me. just to clarify, the ClassNotFoundException in this instance is due to the migration of sun.misc.GC to sun.rmi.transport.GC. from a more general scope, the change to the latter is to relieve JreMemoryLeakPreventionListener of the need to perform reflective access on this GC class, and hence mitigates any potential memory leak JDK-8157570 posed in the Daemon thread of sun.rmi.transport.GC regards Mark On 26/07/2016 16:24, Chris Hegarty wrote: > The GC.Daemon thread has no need of any user defined class loader, > so should set its context class loader to null before starting, so as to > not inadvertently retain a reference to the creating thread?s context > class loader. > > http://cr.openjdk.java.net/~chegar/8160513/ > https://bugs.openjdk.java.net/browse/JDK-8160513 > > -Chris. > > P.S. I added a detailed comment the JIRA issue, for those wondering > why Tomcat is running into this. From chris.hegarty at oracle.com Wed Jul 27 15:27:54 2016 From: chris.hegarty at oracle.com (Chris Hegarty) Date: Wed, 27 Jul 2016 16:27:54 +0100 Subject: RFR [9] 8160513: ClassNotFoundException sun.misc.GC when running Tomcat 9 with JDK 9 In-Reply-To: References: Message-ID: <92b669de-2c38-2842-bc56-7f4e3ecb9772@oracle.com> On 27/07/16 16:13, Mark Sheppard wrote: > Hi Chris, > > change looks good to me. Thanks for looking at this Mark. > just to clarify, the ClassNotFoundException in this instance is due to > the migration of > sun.misc.GC to sun.rmi.transport.GC. Correct. > from a more general scope, > the change to the latter is to relieve JreMemoryLeakPreventionListener > of the need to > perform reflective access on this GC class, and hence mitigates any > potential memory leak JDK-8157570 > posed in the Daemon thread of sun.rmi.transport.GC Correct. Once this change is in JDK 9 I will contact Tomcat and propose that they remove the reflective access to sun.misc.GC, in their JDK 9 trunk. -Chris. > regards > Mark > > > On 26/07/2016 16:24, Chris Hegarty wrote: >> The GC.Daemon thread has no need of any user defined class loader, >> so should set its context class loader to null before starting, so as to >> not inadvertently retain a reference to the creating thread?s context >> class loader. >> >> http://cr.openjdk.java.net/~chegar/8160513/ >> https://bugs.openjdk.java.net/browse/JDK-8160513 >> >> -Chris. >> >> P.S. I added a detailed comment the JIRA issue, for those wondering >> why Tomcat is running into this. > From claes.redestad at oracle.com Wed Jul 27 17:36:49 2016 From: claes.redestad at oracle.com (Claes Redestad) Date: Wed, 27 Jul 2016 19:36:49 +0200 Subject: RFR: 8162439: Runtime.Version.parse needs fast-path for major versions In-Reply-To: References: <57939A03.7080104@oracle.com> Message-ID: <5798F131.5020802@oracle.com> On 07/25/2016 08:01 PM, Iris Clark wrote: > Hi, Claes. > >> Webrev: http://cr.openjdk.java.net/~redestad/8162439/webrev.01/ >> Bug: https://bugs.openjdk.java.net/browse/JDK-8162439 > I think that this change looks good. We provide a shortcut for the common case where only the major version number is of interest without introducing a new API. Thanks! Any reviewer want to give this the go-ahead? > > Note that this has a minor side-effect that invocations of the form Runtime.Version.parse("notANumber") will now throw NFE instead of IAE. I don't think that this is a problem since NFE extends IAE and the order that the exceptions will be checked is intentionally unspecified. Right, I considered the minor behavior difference and thought it would be considered OK and in accordance with the specification, and unproblematic since this API is as of yet unreleased. As an aside: I do think specifying both NFE and IAE to be thrown is suspicious when it's not perfectly clear when which one is to be expected, since it invites to wrong code with strict dependencies on which is currently thrown when, even though it's unspecified, which would mean changing the implementation (like in this patch) would have some possibility of messing with compatibility. I wonder if we should simply specify IAE and drop NFE to allow greater flexibility for future implementations? /Claes > > Regards, > iris > (not a Reviewer) > > -----Original Message----- > From: Claes Redestad > Sent: Saturday, July 23, 2016 9:24 AM > To: core-libs-dev at openjdk.java.net core-libs-dev > Subject: RFR: 8162439: Runtime.Version.parse needs fast-path for major versions > > Hi, > > please review this patch to address a startup regression due to use of > Runtime.Version.parse("8") etc in JarFile, as introduced by JDK-8150680. > This solution introduce a fast-path in case of what appears to be a single number is sent to Runtime.Version.parse to avoid initializing > Runtime.VersionBuilder: > > Webrev: http://cr.openjdk.java.net/~redestad/8162439/webrev.01/ > Bug: https://bugs.openjdk.java.net/browse/JDK-8162439 > > Passes all existing tests. > > Thanks! > > /Claes From martinrb at google.com Wed Jul 27 17:42:33 2016 From: martinrb at google.com (Martin Buchholz) Date: Wed, 27 Jul 2016 10:42:33 -0700 Subject: RFR: 8160605: java/util/SplittableRandom/SplittableRandomTest.java failed with timeout Message-ID: Hi Paul, This deletes the testng ports of jsr166 tck random tests. If you can remember doing any work worth keeping, other than explicitly testing -Djava.util.secureRandomSeed=true (which we are adding to our tck tests), let me know. http://cr.openjdk.java.net/~martin/webrevs/openjdk9/jsr166-RandomTests/ From huizhe.wang at oracle.com Wed Jul 27 20:05:22 2016 From: huizhe.wang at oracle.com (Joe Wang) Date: Wed, 27 Jul 2016 13:05:22 -0700 Subject: RFR (JAXP) JDK-8067170: Enable security manager on JAXP unit tests In-Reply-To: <032801d1e7e9$22162d50$664287f0$@oracle.com> References: <022401d1e0d7$54111090$fc3331b0$@oracle.com> <578CA476.7030407@oracle.com> <03a601d1e3e6$92c45a60$b84d0f20$@oracle.com> <040101d1e3f9$9d19a340$d74ce9c0$@oracle.com> <88977a21-e4d1-e792-00db-1debc3162b08@oracle.com> <024a01d1e659$7dcefcd0$796cf670$@oracle.com> <27ea3634-6e47-70e9-4099-69bd86d3d635@oracle.com> <027101d1e6ed$5107d340$f31779c0$@oracle.com> <903949ef-50a5-ccd9-07cd-ebdd65d65fa5@oracle.com> <032801d1e7e9$22162d50$664287f0$@oracle.com> Message-ID: <57991402.1040308@oracle.com> On 7/27/16, 2:27 AM, Frank Yuan wrote: > Hi Daniel > > Would you like to have a look at the following changes before I finish all rework? > It shows runWithAllPerm, and the handling for user.dir property in FilePolicy.java. The code like runWithTmpPermission is still > kept, please ignore them, I will remove them finally. > > diff -r 1bfe60e61bad test/javax/xml/jaxp/libs/jaxp/library/FilePolicy.java > --- /dev/null Thu Jan 01 00:00:00 1970 +0000 > +++ b/test/javax/xml/jaxp/libs/jaxp/library/FilePolicy.java Wed Jul 27 02:23:58 2016 -0700 > @@ -0,0 +1,44 @@ > +/* > + * Copyright (c) 2016, 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. > + */ > +package jaxp.library; > + > +import static jaxp.library.JAXPTestUtilities.getSystemProperty; > + > +import java.io.FilePermission; > + > +import org.testng.ITestContext; > + > +/** > + * This policy can access local XML files. > + */ > +public class FilePolicy extends BasePolicy { > + > + @Override > + public void onStart(ITestContext arg0) { > + JAXPPolicyManager policyManager = JAXPPolicyManager.getJAXPPolicyManager(true); > + String userdir = getSystemProperty("user.dir"); > + policyManager.addPermission(new FilePermission(userdir + "/-", "read, write, delete")); > + policyManager.addPermission(new FilePermission(System.getProperty("test.src") + "/-", "read")); > + policyManager.addPermission(new FilePermission(userdir, "read")); > + } > +} > diff -r 1bfe60e61bad test/javax/xml/jaxp/libs/jaxp/library/JAXPPolicyManager.java > --- /dev/null Thu Jan 01 00:00:00 1970 +0000 > +++ b/test/javax/xml/jaxp/libs/jaxp/library/JAXPPolicyManager.java Wed Jul 27 02:23:58 2016 -0700 > @@ -0,0 +1,312 @@ > +/* > + * Copyright (c) 2015, 2016, 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. > + */ > +package jaxp.library; > + > + > +import java.lang.reflect.ReflectPermission; > +import java.security.CodeSource; > +import java.security.Permission; > +import java.security.PermissionCollection; > +import java.security.Permissions; > +import java.security.Policy; > +import java.security.ProtectionDomain; > +import java.security.SecurityPermission; > +import java.util.ArrayList; > +import java.util.Enumeration; > +import java.util.List; > +import java.util.PropertyPermission; > +import java.util.StringJoiner; > + > + > +/* > + * This is a base class that every test class must extend if it needs to be run > + * with security mode. > + */ > +public class JAXPPolicyManager { > + /* > + * Backing up policy. > + */ > + private Policy policyBackup; > + > + /* > + * Backing up security manager. > + */ > + private SecurityManager smBackup; > + > + /* > + * Current policy. > + */ > + private TestPolicy policy = new TestPolicy(); > + > + /* > + * JAXPPolicyManager singleton. > + */ > + private static JAXPPolicyManager policyManager = null; > + > + /* > + * Install a SecurityManager along with a default Policy to allow testNG to > + * run when there is a security manager. > + */ > + private JAXPPolicyManager() { > + // Backing up policy and security manager for restore > + policyBackup = Policy.getPolicy(); > + smBackup = System.getSecurityManager(); > + > + // Set customized policy > + setDefaultPermissions(); > + Policy.setPolicy(policy); > + System.setSecurityManager(new SecurityManager()); > + } Will the test suite be configured to run with and without SecurityManager? It seems to me, with a TestNG test listener, a SecurityManager is always installed. I don't seem to see it checks whether the test shall run with a SecurityManager. -Joe > + > + static synchronized JAXPPolicyManager getJAXPPolicyManager(boolean createIfNone) { > + if (policyManager == null& createIfNone) > + policyManager = new JAXPPolicyManager(); > + return policyManager; > + } > + > + private void teardown() throws Exception { > + System.setSecurityManager(smBackup); > + Policy.setPolicy(policyBackup); > + } > + > + /* > + * Restore the original Policy and SecurityManager. > + */ > + static synchronized void teardownPolicyManager() throws Exception { > + if (policyManager != null) { > + policyManager.teardown(); > + policyManager = null; > + } > + } > + > + /* > + * Set default permissions, sub-class of JAXPBaseTest should override this > + * method. > + */ > + private void setDefaultPermissions() { > + //Permissions to set security manager and policy > + addPermission(new SecurityPermission("getPolicy")); > + addPermission(new SecurityPermission("setPolicy")); > + addPermission(new RuntimePermission("setSecurityManager")); > + //Properties that jtreg and TestNG require > + addPermission(new PropertyPermission("testng.show.stack.frames", "read")); > + addPermission(new PropertyPermission("test.src", "read")); > + addPermission(new PropertyPermission("test.classes", "read")); > + addPermission(new PropertyPermission("dataproviderthreadcount", "read")); > + addPermission(new PropertyPermission("experimental", "read")); > + > + //addPermission(new PropertyPermission("fileStringBuffer", "read")); > + /* > + addPermission(new RuntimePermission("getClassLoader")); > + addPermission(new RuntimePermission("createClassLoader")); > + addPermission(new RuntimePermission("createSecurityManager")); > + addPermission(new RuntimePermission("modifyThread")); > + addPermission(new PropertyPermission("*", "read, write")); > + addPermission(new ReflectPermission("suppressAccessChecks")); > + addPermission(new RuntimePermission("setIO")); > + addPermission(new RuntimePermission("setContextClassLoader")); > + addPermission(new RuntimePermission("accessDeclaredMembers"));*/ > + } > + > + /* > + * Add permission to the TestPolicy. > + * > + * @param permission to be added. > + */ > + void addPermission(Permission p) { > + policy.addPermission(p); > + } > + > + /* > + * Add a temporary permission in current thread context. This won't impact > + * global policy and doesn't support permission combination. > + * > + * @param permission > + * to add. > + * @return index of the added permission. > + */ > + int addTmpPermission(Permission p) { > + return policy.addTmpPermission(p); > + } > + > + /* > + * set allowAll in current thread context. > + */ > + void setAllowAll(boolean allow) { > + policy.setAllowAll(allow); > + } > + > + /* > + * Remove a temporary permission from current thread context. > + * > + * @param index to remove. > + * > + * @throws RuntimeException if no temporary permission list in current > + * thread context or no permission correlated to the index. > + */ > + void removeTmpPermission(int index) { > + policy.removeTmpPermission(index); > + } > + > + > +} > + > +/* > + * Simple Policy class that supports the required Permissions to validate the > + * JAXP concrete classes. > + */ > +class TestPolicy extends Policy { > + private final PermissionCollection permissions = new Permissions(); > + > + private ThreadLocal> transientPermissions = new ThreadLocal<>(); > + private ThreadLocal allowAll = new ThreadLocal<>(); > + > + private static Policy defaultPolicy = Policy.getPolicy(); > + > + /* > + * Add permission to this policy. > + * > + * @param permission to be added. > + */ > + void addPermission(Permission p) { > + permissions.add(p); > + } > + > + /* > + * Set all permissions. Caution: this should not called carefully unless > + * it's really needed. > + * > + * private void setAllPermissions() { permissions.add(new AllPermission()); > + * } > + */ > + > + /* > + * Overloaded methods from the Policy class. > + */ > + @Override > + public String toString() { > + StringJoiner sj = new StringJoiner("\n", "policy: ", ""); > + Enumeration perms = permissions.elements(); > + while (perms.hasMoreElements()) { > + sj.add(perms.nextElement().toString()); > + } > + return sj.toString(); > + > + } > + > + @Override > + public PermissionCollection getPermissions(ProtectionDomain domain) { > + return permissions; > + } > + > + @Override > + public PermissionCollection getPermissions(CodeSource codesource) { > + return permissions; > + } > + > + @Override > + public boolean implies(ProtectionDomain domain, Permission perm) { > + if (allowAll()) > + return true; > + > + if (defaultPolicy.implies(domain, perm)) > + return true; > + > + if (permissions.implies(perm)) > + return true; > + else > + return tmpImplies(perm); > + } > + > + /* > + * Add a temporary permission in current thread context. This won't impact > + * global policy and doesn't support permission combination. > + * > + * @param permission to add. > + * @return index of the added permission. > + */ > + int addTmpPermission(Permission p) { > + List tmpPermissions = transientPermissions.get(); > + if (tmpPermissions == null) > + tmpPermissions = new ArrayList<>(); > + > + tmpPermissions.add(p); > + transientPermissions.set(tmpPermissions); > + return tmpPermissions.size() - 1; > + } > + > + /* > + * Remove a temporary permission from current thread context. > + * > + * @param index to remove. > + * > + * @throws RuntimeException if no temporary permission list in current > + * thread context or no permission correlated to the index. > + */ > + void removeTmpPermission(int index) { > + try { > + List tmpPermissions = transientPermissions.get(); > + tmpPermissions.remove(index); > + } catch (NullPointerException | IndexOutOfBoundsException e) { > + throw new RuntimeException("Tried to delete a non-existent temporary permission", e); > + } > + } > + > + /* > + * Checks to see if the specified permission is implied by temporary > + * permission list in current thread context. > + * > + * @param permission the Permission object to compare. > + * > + * @return true if "permission" is implied by any permission in the > + * temporary permission list, false if not. > + */ > + private boolean tmpImplies(Permission perm) { > + List tmpPermissions = transientPermissions.get(); > + if (tmpPermissions != null) { > + for (Permission p : tmpPermissions) { > + if (p.implies(perm)) > + return true; > + } > + } > + return false; > + } > + > + /* > + * Checks to see if allow all permission requests in current thread context. > + */ > + private boolean allowAll() { > + Boolean allow = allowAll.get(); > + if (allow != null) { > + return allow; > + } > + return false; > + } > + > + /* > + * set allowAll in current thread context. > + */ > + void setAllowAll(boolean allow) { > + allowAll.set(allow); > + } > +} > diff -r 1bfe60e61bad test/javax/xml/jaxp/libs/jaxp/library/JAXPTestUtilities.java > --- a/test/javax/xml/jaxp/libs/jaxp/library/JAXPTestUtilities.java Mon Apr 04 14:54:38 2016 -0700 > +++ b/test/javax/xml/jaxp/libs/jaxp/library/JAXPTestUtilities.java Wed Jul 27 02:23:58 2016 -0700 > @@ -1,5 +1,5 @@ > /* > - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. > + * Copyright (c) 2014, 2016, 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 > @@ -22,6 +22,8 @@ > */ > package jaxp.library; > > +import static org.testng.Assert.fail; > + > import java.io.ByteArrayInputStream; > import java.io.File; > import java.io.IOException; > @@ -34,12 +36,18 @@ > import java.nio.charset.UnsupportedCharsetException; > import java.nio.file.Files; > import java.nio.file.Paths; > +import java.security.Permission; > +import java.util.ArrayList; > import java.util.HashMap; > import java.util.List; > import java.util.Map; > +import java.util.Optional; > import java.util.concurrent.ConcurrentHashMap; > +import java.util.function.Supplier; > import java.util.regex.Pattern; > import java.util.stream.Collectors; > +import java.util.stream.Stream; > + > import javax.xml.parsers.DocumentBuilder; > import javax.xml.parsers.DocumentBuilderFactory; > import javax.xml.parsers.ParserConfigurationException; > @@ -48,7 +56,7 @@ > import javax.xml.transform.TransformerFactory; > import javax.xml.transform.dom.DOMSource; > import javax.xml.transform.stream.StreamResult; > -import static org.testng.Assert.fail; > + > import org.w3c.dom.Document; > import org.w3c.dom.Node; > import org.xml.sax.SAXException; > @@ -74,12 +82,6 @@ > public static final String FILE_SEP = "/"; > > /** > - * Current test directory. > - */ > - public static final String USER_DIR = > - System.getProperty("user.dir", ".") + FILE_SEP;; > - > - /** > * A map storing every test's current test file pointer. File number should > * be incremental and it's a thread-safe reading on this file number. > */ > @@ -89,7 +91,7 @@ > /** > * BOM table for storing BOM header. > */ > - private final static Map bom = new HashMap<>(); > + private final static Map bom = new HashMap(); > > /** > * Initialize all BOM headers. > @@ -130,8 +132,15 @@ > */ > public static boolean compareWithGold(String goldfile, String outputfile, > Charset cs) throws IOException { > - return Files.readAllLines(Paths.get(goldfile)). > + boolean isSame = Files.readAllLines(Paths.get(goldfile)). > equals(Files.readAllLines(Paths.get(outputfile), cs)); > + if (!isSame) { > + System.err.println("Golden file " + goldfile + " :"); > + Files.readAllLines(Paths.get(goldfile)).forEach(System.err::println); > + System.err.println("Output file " + outputfile + " :"); > + Files.readAllLines(Paths.get(outputfile), cs).forEach(System.err::println); > + } > + return isSame; > } > > /** > @@ -308,10 +317,10 @@ > int nextNumber = currentFileNumber.contains(clazz) > ? currentFileNumber.get(clazz) + 1 : 1; > Integer i = currentFileNumber.putIfAbsent(clazz, nextNumber); > - if (i != null&& i != nextNumber) { > + if (i != null) { > do { > nextNumber = currentFileNumber.get(clazz) + 1; > - } while (currentFileNumber.replace(clazz, nextNumber -1, nextNumber)); > + } while (!currentFileNumber.replace(clazz, nextNumber - 1, nextNumber)); > } > return USER_DIR + clazz.getName() + nextNumber + ".out"; > } > @@ -332,4 +341,146 @@ > toAbsolutePath().toString(); > return normalizedPath.replace("\\", FILE_SEP) + FILE_SEP; > } > + > + > + /** > + * Run the RunnableWithException with creating a JAXPPolicyManager and > + * assigning temporary permissions. It's not thread-safe to use this > + * function. > + * > + * @param r > + * RunnableWithException to execute > + * @param ps > + * assigning permissions to add. > + */ > + public static void tryRunWithPolicyManager(RunnableWithException r, Permission... ps) throws Exception { > + JAXPPolicyManager policyManager = JAXPPolicyManager.getJAXPPolicyManager(true); > + if (policyManager != null) > + Stream.of(ps).forEach(p -> policyManager.addTmpPermission(p)); > + try { > + r.run(); > + } finally { > + JAXPPolicyManager.teardownPolicyManager(); > + } > + } > + > + /** > + * Run the runnable with assigning temporary permissions. This won't impact > + * global policy. > + * > + * @param r > + * Runnable to run > + * @param ps > + * assigning permissions to add. > + */ > + public static void runWithTmpPermission(Runnable r, Permission... ps) { > + JAXPPolicyManager policyManager = JAXPPolicyManager.getJAXPPolicyManager(false); > + List tmpPermissionIndexes = new ArrayList(); > + if (policyManager != null) > + Stream.of(ps).forEach(p -> tmpPermissionIndexes.add(policyManager.addTmpPermission(p))); > + try { > + r.run(); > + } finally { > + tmpPermissionIndexes.forEach(index -> policyManager.removeTmpPermission(index)); > + } > + } > + > + /** > + * Run the supplier with all permissions. This won't impact global policy. > + * > + * @param s > + * Supplier to run > + */ > + public static T runWithAllPerm(Supplier s) { > + Optional policyManager = Optional.ofNullable(JAXPPolicyManager > + .getJAXPPolicyManager(false)); > + policyManager.ifPresent(manager -> manager.setAllowAll(true)); > + try { > + return s.get(); > + } finally { > + policyManager.ifPresent(manager -> manager.setAllowAll(false)); > + } > + } > + > + /** > + * Run the Runnable with all permissions. This won't impact global policy. > + * > + * @param s > + * Supplier to run > + */ > + public static void runWithAllPerm(Runnable r) { > + Optional policyManager = Optional.ofNullable(JAXPPolicyManager > + .getJAXPPolicyManager(false)); > + policyManager.ifPresent(manager -> manager.setAllowAll(true)); > + try { > + r.run(); > + } finally { > + policyManager.ifPresent(manager -> manager.setAllowAll(false)); > + } > + } > + > + /** > + * Acquire a system property. > + * > + * @param name > + * System property name to be acquired. > + * @return property value > + */ > + public static String getSystemProperty(String name) { > + return runWithAllPerm(() -> System.getProperty(name)); > + } > + > + /** > + * Set a system property by given system value. > + * > + * @param name > + * System property name to be set. > + * @param value > + * System property value to be set. > + */ > + public static void setSystemProperty(String name, String value) { > + runWithAllPerm(() -> System.setProperty(name, value)); > + } > + > + /** > + * Clear a system property. > + * > + * @param name > + * System property name to be cleared. > + */ > + public static void clearSystemProperty(String name) { > + runWithAllPerm(() -> clearSystemProperty(name)); > + } > + > + /** > + * Run the RunnableWithException with assigning temporary permissions. This > + * won't impact global policy. > + * > + * @param r > + * RunnableWithException to execute > + * @param ps > + * assigning permissions to add. > + */ > + public static void tryRunWithTmpPermission(RunnableWithException r, Permission... ps) throws Exception { > + JAXPPolicyManager policyManager = JAXPPolicyManager.getJAXPPolicyManager(false); > + List tmpPermissionIndexes = new ArrayList(); > + if (policyManager != null) > + Stream.of(ps).forEach(p -> tmpPermissionIndexes.add(policyManager.addTmpPermission(p))); > + try { > + r.run(); > + } finally { > + tmpPermissionIndexes.forEach(index -> policyManager.removeTmpPermission(index)); > + } > + } > + > + @FunctionalInterface > + public interface RunnableWithException { > + void run() throws Exception; > + } > + > + /** > + * Current test directory. > + */ > + public static final String USER_DIR = getSystemProperty("user.dir") + FILE_SEP;; > + > } > > > diff -r 1bfe60e61bad test/javax/xml/jaxp/unittest/transform/Bug6490921.java > --- a/test/javax/xml/jaxp/unittest/transform/Bug6490921.java Mon Apr 04 14:54:38 2016 -0700 > +++ b/test/javax/xml/jaxp/unittest/transform/Bug6490921.java Wed Jul 27 02:22:40 2016 -0700 > @@ -1,5 +1,5 @@ > /* > - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. > + * Copyright (c) 2014, 2016, 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 > @@ -23,6 +23,8 @@ > > package transform; > > +import static jaxp.library.JAXPTestUtilities.setSystemProperty; > + > import java.io.IOException; > import java.io.StringReader; > import java.io.StringWriter; > @@ -37,6 +39,7 @@ > import javax.xml.transform.stream.StreamResult; > > import org.testng.Assert; > +import org.testng.annotations.Listeners; > import org.testng.annotations.Test; > import org.xml.sax.InputSource; > import org.xml.sax.SAXException; > @@ -46,6 +49,7 @@ > * @bug 6490921 > * @summary Test property org.xml.sax.driver is always applied in transformer API. > */ > + at Listeners({jaxp.library.BasePolicy.class}) > public class Bug6490921 { > > public static class ReaderStub extends XMLFilterImpl { > @@ -71,7 +75,7 @@ > public void test01() { > String xml = ""; > ReaderStub.used = false; > - System.setProperty("org.xml.sax.driver", ""); > + setSystemProperty("org.xml.sax.driver", ""); > > // Don't set 'org.xml.sax.driver' here, just use default > try { > @@ -91,7 +95,7 @@ > public void test02() { > String xml = ""; > ReaderStub.used = false; > - System.setProperty("org.xml.sax.driver", ReaderStub.class.getName()); > + setSystemProperty("org.xml.sax.driver", ReaderStub.class.getName()); > try { > TransformerFactory transFactory = TransformerFactory.newInstance(); > Transformer transformer = transFactory.newTransformer(); > @@ -111,7 +115,7 @@ > + "Hello World!\n" + "\n"; > > ReaderStub.used = false; > - System.setProperty("org.xml.sax.driver", ReaderStub.class.getName()); > + setSystemProperty("org.xml.sax.driver", ReaderStub.class.getName()); > try { > TransformerFactory transFactory = TransformerFactory.newInstance(); > if (transFactory.getFeature(SAXTransformerFactory.FEATURE) == false) { > > Thanks > Frank > > -----Original Message----- > From: Daniel Fuchs [mailto:daniel.fuchs at oracle.com] > Sent: Tuesday, July 26, 2016 3:46 PM > To: Frank Yuan; 'huizhe wang' > Cc: 'Amy Lu'; 'core-libs-dev' > Subject: Re: RFR (JAXP) JDK-8067170: Enable security manager on JAXP unit tests > > On 26/07/16 04:24, Frank Yuan wrote: >> Thank you very much for your suggestions! Now I fully understand the rule(at least I think so :P) >> I will use a runWithAllPerm block surrounding the user setup code as Daniel's way. Btw, Daniel, ThreadLocal should not need Atomic >> any more, correct? >> > Hi Frank, > > runWithAllPerm is another way to do it. > It uses a ThreadLocal, right? > > I agree it's adequate. Just be careful of what might > happen if you run runWithAllPerm inside runWithPermissions, > or runWithPermissions(runnable, a,b,c) with a runnable that > later calls runWithPermission(runnable2, a, d, e) further down > the road. > > At the moment I'm not sure whether your code will work correctly > in the presence of such nested invocation (maybe it does), > but because it seems to be index based it's not immediately > obvious (I'm not asking you to change it - just to verify and > confirm that it's something you have taken into account, and > that you're confident that it works). > > > Best regards, > > -- daniel > From lance.andersen at oracle.com Wed Jul 27 20:17:15 2016 From: lance.andersen at oracle.com (Lance Andersen) Date: Wed, 27 Jul 2016 16:17:15 -0400 Subject: RFR (JAXP) 8158084: Catalog API: JAXP XML Processor Support In-Reply-To: References: Message-ID: <26EEB003-9FD3-44B8-8E84-029D038AB5CF@oracle.com> Hi Joe, This looks OK to me. You might want to get the JCK test addressed before pushing your changes Best Lance > On Jul 25, 2016, at 12:44 AM, huizhe wang wrote: > > Hi, > > This is an enhancement to support the Catalog API (javax.xml.catalog) throughout the JAXP processors. All of the CatalogFeatures are supported by the JAXP factories and processors (e.g. SAXParser), and corresponding System properties as specified in the CatalogFeatures. An additional javax.xml property "USE_CATALOG" is added to allow switching on/off the Catalog support for a processor or all of them (through the System properties or jaxp.properties). > > The USE_CATALOG feature is on by default for all processors. The only thing needed then, to resolve external references with a catalog, is setting the path to the catalog on the processor. While the USE_CATALOG is on by default, the Catalog support is noninterference. As long as no catalog is set, the Catalog is mute. Catalog, even if one exists, will not interfere with custom resolvers, it is simply ignored if a custom resolver is present. > > > specdiff: http://cr.openjdk.java.net/~joehw/jdk9/8158084/specdiff/overview-summary.html > > webrev: http://cr.openjdk.java.net/~joehw/jdk9/8158084/webrev/ > > > Tests: 140ish new test cases; all existing SQE/unit tests pass. JCK has a large number of failures due to one Catalog API test that left a configuration file behind. I'll discuss that with the JCK team. > > > 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 Jul 27 22:06:43 2016 From: huizhe.wang at oracle.com (Joe Wang) Date: Wed, 27 Jul 2016 15:06:43 -0700 Subject: RFR (JAXP) 8158084: Catalog API: JAXP XML Processor Support In-Reply-To: <26EEB003-9FD3-44B8-8E84-029D038AB5CF@oracle.com> References: <26EEB003-9FD3-44B8-8E84-029D038AB5CF@oracle.com> Message-ID: <57993073.9020109@oracle.com> Thanks Lance! Prabu believed that the JCK test should have been fixed by a previous patch. I'll send him a build to double-check. Best, Joe On 7/27/16, 1:17 PM, Lance Andersen wrote: > Hi Joe, > > This looks OK to me. > > > You might want to get the JCK test addressed before pushing your changes > > Best > Lance >> On Jul 25, 2016, at 12:44 AM, huizhe wang > > wrote: >> >> Hi, >> >> This is an enhancement to support the Catalog API (javax.xml.catalog) >> throughout the JAXP processors. All of the CatalogFeatures are >> supported by the JAXP factories and processors (e.g. SAXParser), and >> corresponding System properties as specified in the CatalogFeatures. >> An additional javax.xml property "USE_CATALOG" is added to allow >> switching on/off the Catalog support for a processor or all of them >> (through the System properties or jaxp.properties). >> >> The USE_CATALOG feature is on by default for all processors. The only >> thing needed then, to resolve external references with a catalog, is >> setting the path to the catalog on the processor. While the >> USE_CATALOG is on by default, the Catalog support is noninterference. >> As long as no catalog is set, the Catalog is mute. Catalog, even if >> one exists, will not interfere with custom resolvers, it is simply >> ignored if a custom resolver is present. >> >> >> specdiff: >> http://cr.openjdk.java.net/~joehw/jdk9/8158084/specdiff/overview-summary.html >> >> >> webrev: http://cr.openjdk.java.net/~joehw/jdk9/8158084/webrev/ >> >> >> >> Tests: 140ish new test cases; all existing SQE/unit tests pass. JCK >> has a large number of failures due to one Catalog API test that left >> a configuration file behind. I'll discuss that with the JCK team. >> >> >> 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 joe.darcy at oracle.com Wed Jul 27 22:16:44 2016 From: joe.darcy at oracle.com (Joseph D. Darcy) Date: Wed, 27 Jul 2016 15:16:44 -0700 Subject: JDK 9 RFR of JDK-8162666: Mark ValidationWarningsTest.java as intermittently failing Message-ID: <579932CC.4000009@oracle.com> The test javax/xml/jaxp/unittest/common/ValidationWarningsTest.java is known to intermittently fail (JDK-8150145) and should be marked accordingly. Please review the patch below with does this (and removes an unnecessary space from the TEST.ROOT file). Thanks, -Joe --- a/test/TEST.ROOT Wed Jul 27 18:23:04 2016 +0300 +++ b/test/TEST.ROOT Wed Jul 27 15:07:26 2016 -0700 @@ -15,7 +15,7 @@ othervm.dirs=javax/xml/jaxp # Group definitions -groups=TEST.groups +groups=TEST.groups # Minimum jtreg version requiredVersion=4.2 b02 diff -r 794a2f7c2bb6 test/javax/xml/jaxp/unittest/common/ValidationWarningsTest.java --- a/test/javax/xml/jaxp/unittest/common/ValidationWarningsTest.java Wed Jul 27 18:23:04 2016 +0300 +++ b/test/javax/xml/jaxp/unittest/common/ValidationWarningsTest.java Wed Jul 27 15:07:26 2016 -0700 @@ -38,8 +38,9 @@ /* * @test + * @bug 8144593 + * @key intermittent * @modules javax.xml/com.sun.org.apache.xerces.internal.jaxp - * @bug 8144593 * @summary Check that warnings about unsupported properties from SAX * parsers are suppressed during the xml validation process. */ From lance.andersen at oracle.com Wed Jul 27 22:32:05 2016 From: lance.andersen at oracle.com (Lance Andersen) Date: Wed, 27 Jul 2016 18:32:05 -0400 Subject: JDK 9 RFR of JDK-8162666: Mark ValidationWarningsTest.java as intermittently failing In-Reply-To: <579932CC.4000009@oracle.com> References: <579932CC.4000009@oracle.com> Message-ID: +1 > On Jul 27, 2016, at 6:16 PM, Joseph D. Darcy wrote: > > The test > > javax/xml/jaxp/unittest/common/ValidationWarningsTest.java > > is known to intermittently fail (JDK-8150145) and should be marked accordingly. > > Please review the patch below with does this (and removes an unnecessary space from the TEST.ROOT file). > > Thanks, > > -Joe > > --- a/test/TEST.ROOT Wed Jul 27 18:23:04 2016 +0300 > +++ b/test/TEST.ROOT Wed Jul 27 15:07:26 2016 -0700 > @@ -15,7 +15,7 @@ > othervm.dirs=javax/xml/jaxp > > # Group definitions > -groups=TEST.groups > +groups=TEST.groups > > # Minimum jtreg version > requiredVersion=4.2 b02 > diff -r 794a2f7c2bb6 test/javax/xml/jaxp/unittest/common/ValidationWarningsTest.java > --- a/test/javax/xml/jaxp/unittest/common/ValidationWarningsTest.java Wed Jul 27 18:23:04 2016 +0300 > +++ b/test/javax/xml/jaxp/unittest/common/ValidationWarningsTest.java Wed Jul 27 15:07:26 2016 -0700 > @@ -38,8 +38,9 @@ > > /* > * @test > + * @bug 8144593 > + * @key intermittent > * @modules javax.xml/com.sun.org.apache.xerces.internal.jaxp > - * @bug 8144593 > * @summary Check that warnings about unsupported properties from SAX > * parsers are suppressed during the xml validation process. > */ 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 Thu Jul 28 01:43:10 2016 From: david.holmes at oracle.com (David Holmes) Date: Thu, 28 Jul 2016 11:43:10 +1000 Subject: RFR: 8162563: Fix double checked locking in System.console() In-Reply-To: References: <20208de7-50a2-b4c6-3306-73d6da9b1e8a@oracle.com> Message-ID: On 27/07/2016 11:39 PM, Martin Buchholz wrote: > > > On Tue, Jul 26, 2016 at 11:13 PM, David Holmes > wrote: > > On 27/07/2016 3:45 PM, Martin Buchholz wrote: > > Hi David, > > I didn't even look at Console.java! I just fixed the double-checked > locking in System.java. > > Looking now at Console.cons, that is NOT safely statically > initialized: > > SharedSecrets.setJavaIOAccess(new JavaIOAccess() { > public Console console() { > if (istty()) { > if (cons == null) > cons = new Console(); > return cons; > } > return null; > } > > (but it's currently safe because only System.java accesses it) > > > The above code is in a static initialization block. > > > Sure, but the code isn't run (yet), just made available to be run later > via JavaIOAccess when System.console() is called. Ah! Right - my mistake, sorry. David From frank.yuan at oracle.com Thu Jul 28 09:56:19 2016 From: frank.yuan at oracle.com (Frank Yuan) Date: Thu, 28 Jul 2016 17:56:19 +0800 Subject: RFR (JAXP) JDK-8067170: Enable security manager on JAXP unit tests In-Reply-To: <57991402.1040308@oracle.com> References: <022401d1e0d7$54111090$fc3331b0$@oracle.com> <578CA476.7030407@oracle.com> <03a601d1e3e6$92c45a60$b84d0f20$@oracle.com> <040101d1e3f9$9d19a340$d74ce9c0$@oracle.com> <88977a21-e4d1-e792-00db-1debc3162b08@oracle.com> <024a01d1e659$7dcefcd0$796cf670$@oracle.com> <27ea3634-6e47-70e9-4099-69bd86d3d635@oracle.com> <027101d1e6ed$5107d340$f31779c0$@oracle.com> <903949ef-50a5-ccd9-07cd-ebdd65d65fa5@oracle.com> <032801d1e7e9$22162d50$664287f0$@oracle.com> <57991402.1040308@oracle.com> Message-ID: <02d701d1e8b6$4d451540$e7cf3fc0$@oracle.com> > > + /* > > + * Install a SecurityManager along with a default Policy to allow testNG to > > + * run when there is a security manager. > > + */ > > + private JAXPPolicyManager() { > > + // Backing up policy and security manager for restore > > + policyBackup = Policy.getPolicy(); > > + smBackup = System.getSecurityManager(); > > + > > + // Set customized policy > > + setDefaultPermissions(); > > + Policy.setPolicy(policy); > > + System.setSecurityManager(new SecurityManager()); > > + } > > Will the test suite be configured to run with and without > SecurityManager? It seems to me, with a TestNG test listener, a > SecurityManager is always installed. I don't seem to see it checks > whether the test shall run with a SecurityManager. > > -Joe > It's same as the original code, I think it's to be ready for running in agent mode. Frank From chris.hegarty at oracle.com Thu Jul 28 10:22:05 2016 From: chris.hegarty at oracle.com (Chris Hegarty) Date: Thu, 28 Jul 2016 11:22:05 +0100 Subject: RFR [9] 8157570: sun.rmi.transport.GC retains a strong reference to the context class loader ( was :8160513 ) In-Reply-To: <1b0051cd-840f-94f0-7bac-cc88ba1e7d22@oracle.com> References: <1b0051cd-840f-94f0-7bac-cc88ba1e7d22@oracle.com> Message-ID: <811F7081-BEC0-41E3-8A91-5ACF0FA36AB7@oracle.com> [ switching to 8157570 as it better describes the issue, rather than the affect ] > Looks good to me Chris. > Another possibility might be to use InnocuousThread? Good idea Daniel. I updated the webrev to use InnocuousThread, and added an assert, since this is no test. http://cr.openjdk.java.net/~chegar/8157570/ -Chris. [1] https://bugs.openjdk.java.net/browse/JDK-8157570 From frank.yuan at oracle.com Thu Jul 28 10:22:45 2016 From: frank.yuan at oracle.com (Frank Yuan) Date: Thu, 28 Jul 2016 18:22:45 +0800 Subject: RFR (JAXP) JDK-8067170: Enable security manager on JAXP unit tests In-Reply-To: <7830330b-df99-023e-b778-61725d4e6001@oracle.com> References: <022401d1e0d7$54111090$fc3331b0$@oracle.com> <578CA476.7030407@oracle.com> <03a601d1e3e6$92c45a60$b84d0f20$@oracle.com> <040101d1e3f9$9d19a340$d74ce9c0$@oracle.com> <88977a21-e4d1-e792-00db-1debc3162b08@oracle.com> <024a01d1e659$7dcefcd0$796cf670$@oracle.com> <27ea3634-6e47-70e9-4099-69bd86d3d635@oracle.com> <027101d1e6ed$5107d340$f31779c0$@oracle.com> <903949ef-50a5-ccd9-07cd-ebdd65d65fa5@oracle.com> <032801d1e7e9$22162d50$664287f0$@oracle.com> <7830330b-df99-023e-b778-61725d4e6001@oracle.com> Message-ID: <02da01d1e8b9$fdab70c0$f9025240$@oracle.com> Hi Daniel Thank you very much for your comments! Please check my reply inline below: > > Hi Frank, > > Please see my comments inline. > > On 27/07/16 10:27, Frank Yuan wrote: > > Hi Daniel > > > > Would you like to have a look at the following changes before I finish all rework? > > It shows runWithAllPerm, and the handling for user.dir property in FilePolicy.java. The code like runWithTmpPermission is still > > kept, please ignore them, I will remove them finally. > > > > diff -r 1bfe60e61bad test/javax/xml/jaxp/libs/jaxp/library/FilePolicy.java > > --- /dev/null Thu Jan 01 00:00:00 1970 +0000 > > +++ b/test/javax/xml/jaxp/libs/jaxp/library/FilePolicy.java Wed Jul 27 02:23:58 2016 -0700 > > @@ -0,0 +1,44 @@ ... > > + addPermission(new RuntimePermission("setIO")); > > + addPermission(new RuntimePermission("setContextClassLoader")); > > + addPermission(new RuntimePermission("accessDeclaredMembers"));*/ > > Good to see these permissions are now commented: make sure to remove > the commented code in the final version. > Corrected, thanks! > > + /* > > + * set allowAll in current thread context. > > + */ > > + void setAllowAll(boolean allow) { > > + policy.setAllowAll(allow); > > + } > > I'd suggest to return the previous value of allowAll here. > This will be more convenient to restore the previous value > in the finally block. > Since setters usually don't return values you might name it e.g. > > /** > * Switches allowAll to the given value and return its > * previous value in current thread context. > *

    > * Example of use: > * {@code > * final boolean before = switchAllowAll(true); > * try { > * // do some privileged operation here > * } finally { > * // restore allowAll to its previous value > * switchAllowAll(before); > * } > * } > */ > boolean switchAllowAll(boolean allowAll) { > // alternatively you could add a switchAllowAll method > // to TestPolicy > final boolean before = policy.allowAll(); > policy.setAllowAll(allowAll); > return before; > } > > [..] switchAllowAll is more flexible, but I would take only one use case, that is setAllowAll(true)); try { do something } finally { setAllowAll(false); } > > + /** > > + * Run the RunnableWithException with creating a JAXPPolicyManager and > > + * assigning temporary permissions. It's not thread-safe to use this > > + * function. > > + * > > + * @param r > > + * RunnableWithException to execute > > + * @param ps > > + * assigning permissions to add. > > + */ > > + public static void tryRunWithPolicyManager(RunnableWithException r, Permission... ps) throws Exception { > > + JAXPPolicyManager policyManager = JAXPPolicyManager.getJAXPPolicyManager(true); > > + if (policyManager != null) > > + Stream.of(ps).forEach(p -> policyManager.addTmpPermission(p)); > > + try { > > + r.run(); > > + } finally { > > + JAXPPolicyManager.teardownPolicyManager(); > > + } > > + } > > This method is suspicious because if there existed a JAXPPolicyManager > before entering it it will be removed after the method finishes. > I'd suggest removing this method. You can accomplish the same things > by calling: > > JAXPPolicyManager policyManager = > JAXPPolicyManager.getJAXPPolicyManager(true); > runWithTmpPermission(r, ps); > > since runWithTmpPermission seems to do things right. > JAXPTestUtilities.tryRunWithPolicyManager(Runnable, Permission.) is used for cases where some test methods need to be run with security manager and some others need to be run without security manager because they have different behaviors when having sm or not. E.g. http://cr.openjdk.java.net/~fyuan/8067170/webrev.00/test/javax/xml/jaxp/unittest/parsers/FactoryFindTest.java.sdiff.html. Such cases must run in single thread, all other cases don't require it, are thread safe. > > + > > + /** > > + * Run the runnable with assigning temporary permissions. This won't impact > > + * global policy. > > + * > > + * @param r > > + * Runnable to run > > + * @param ps > > + * assigning permissions to add. > > + */ > > + public static void runWithTmpPermission(Runnable r, Permission... ps) { > > + JAXPPolicyManager policyManager = JAXPPolicyManager.getJAXPPolicyManager(false); > > + List tmpPermissionIndexes = new ArrayList(); > > + if (policyManager != null) > > + Stream.of(ps).forEach(p -> tmpPermissionIndexes.add(policyManager.addTmpPermission(p))); > > + try { > > + r.run(); > > + } finally { > > if policyManager is null this will throw NPE. > Maybe you shoud make addTmpPermission and removeTmpPermission static > in JAXPPolicyManager, and delegate the null checking of the global > policyManager instance inside those methods. > If policyManager is null, Stream.of(ps) has not any iteration, so it's safe. > > + tmpPermissionIndexes.forEach(index -> policyManager.removeTmpPermission(index)); > > + } > > + } > > > > + > > + /** > > + * Run the supplier with all permissions. This won't impact global policy. > > + * > > + * @param s > > + * Supplier to run > > + */ > > + public static T runWithAllPerm(Supplier s) { > > + Optional policyManager = Optional.ofNullable(JAXPPolicyManager > > + .getJAXPPolicyManager(false)); > > + policyManager.ifPresent(manager -> manager.setAllowAll(true)); > > + try { > > + return s.get(); > > + } finally { > > + policyManager.ifPresent(manager -> manager.setAllowAll(false)); > > This should restore allowAll to its previous value rather than 'false'. Same as a previous comment. > Maybe you should make setAllowAll/switchAllowAll static in > policyManager. The allowAll ThreadLocal can be static as well, so you > don't really to have an instance of JAXPPolicyManager or TestPolicy to > switch it on or off. > Because of ThreadLocal, static is equivalent to instance, I used instance allowAll and setAllowAll because I wanted to emphasize their logic relationship. I would follow your suggestion if you adhere :) Thanks Frank From paul.sandoz at oracle.com Thu Jul 28 10:33:19 2016 From: paul.sandoz at oracle.com (Paul Sandoz) Date: Thu, 28 Jul 2016 12:33:19 +0200 Subject: RFR 8162458 Buffer view implementations use incorrect offset for Unsafe access In-Reply-To: <2F815E1E-1DA6-4010-9B39-5D7BBB2DF069@oracle.com> References: <2F815E1E-1DA6-4010-9B39-5D7BBB2DF069@oracle.com> Message-ID: <90A0B797-2324-42B5-BAF9-E28AAB48B3E5@oracle.com> Hooking in nio dev. I think this issue is important to review/push soon (i.e. this week) so as it does not leak out beyond the hs repo. ? Incidentally this patch also fixes what might have been a long standing bug in the compact method of buffer views. Here is ByteBufferAsIntBufferB?s compact method: public IntBuffer compact() { int pos = position(); int lim = limit(); assert (pos <= lim); int rem = (pos <= lim ? lim - pos : 0); ByteBuffer db = bb.duplicate(); db.limit(ix(lim)); db.position(ix(0)); ByteBuffer sb = db.slice(); sb.position(pos << 2); sb.compact(); position(rem); limit(capacity()); discardMark(); return this; } For view heap buffers the ix method used to return an offset relative to the underlying byte array, not relative to the buffer. this this can result values that are beyond the capacity of the buffer. The following code: ByteBuffer bb0 = ByteBuffer.allocate(16); ByteBuffer bb4 = bb0.position(4).slice(); ByteBuffer bb8 = bb4.position(4).slice(); IntBuffer ib = bb8.asIntBuffer().compact(); results in: Exception in thread "main" java.lang.IllegalArgumentException: newLimit > capacity: (16 > 8) Paul. > On 27 Jul 2016, at 13:47, Paul Sandoz wrote: > > Hi, > > I made an embarrassing mistake in the fix for > > https://bugs.openjdk.java.net/browse/JDK-8151163 > All Buffer implementations should leverage Unsafe unaligned accessors > > The offset calculation for Unsafe access was incorrect, it?s easy to get confused because for heap buffers the offset is relative to the array, and for direct buffers the address (which can update for slices/duplicates). Disturbingly all existing tests were passing both for core and hotspot when i pushed to hs. > > As a penance i wrote a combinatorial test for buffer views to navigate the twisty maze of heap/direct, aligned/unaligned, little/big endian for accessing binary data and views from the source buffer. > > Please review: > > http://cr.openjdk.java.net/~psandoz/jdk9/JDK-8162458-byte-buffer-view-offset-access-incorrect/webrev/ > > (This may be a duplicate of [1]). > > Test has been verified to fail with the existing code. Focused JPRT runs pass, but i will kick off core/hotspot runs later on today. > > I will push to hs since that is where JDK-8151163 and it has not been integrated into jdk9/dev. > > Paul. > > [1] https://bugs.openjdk.java.net/browse/JDK-8159257 > unsafe.cpp: assert(byte_offset < p_size) failed: Unsafe access: offset 32767 > object's size 16 > > For the test runtime/Unsafe/RangeCheck.java I can reproduce a crash in jdk9/dev which does not have JDK-8151163, and i can reproduce on jdk9/hs with this fix for JDK-8162458. From Alan.Bateman at oracle.com Thu Jul 28 10:40:14 2016 From: Alan.Bateman at oracle.com (Alan Bateman) Date: Thu, 28 Jul 2016 11:40:14 +0100 Subject: RFR 8162458 Buffer view implementations use incorrect offset for Unsafe access In-Reply-To: <2F815E1E-1DA6-4010-9B39-5D7BBB2DF069@oracle.com> References: <2F815E1E-1DA6-4010-9B39-5D7BBB2DF069@oracle.com> Message-ID: <71d960ae-7bf5-2fbf-c783-63efa87d2e98@oracle.com> On 27/07/2016 12:47, Paul Sandoz wrote: > Hi, > > I made an embarrassing mistake in the fix for > > https://bugs.openjdk.java.net/browse/JDK-8151163 > All Buffer implementations should leverage Unsafe unaligned accessors > > The offset calculation for Unsafe access was incorrect, it?s easy to get confused because for heap buffers the offset is relative to the array, and for direct buffers the address (which can update for slices/duplicates). Disturbingly all existing tests were passing both for core and hotspot when i pushed to hs. > > As a penance i wrote a combinatorial test for buffer views to navigate the twisty maze of heap/direct, aligned/unaligned, little/big endian for accessing binary data and views from the source buffer. > > Please review: > > http://cr.openjdk.java.net/~psandoz/jdk9/JDK-8162458-byte-buffer-view-offset-access-incorrect/webrev/ > > (This may be a duplicate of [1]). > > Test has been verified to fail with the existing code. Focused JPRT runs pass, but i will kick off core/hotspot runs later on today. > It is disturbing that it wasn't caught by the original tests. The new test does appear to overlap with existing tests but I think that is okay. One small request is to trim down the really long lines as they are annoying when doing side-by-side diffs. In any case, the offsets in the updated code look right for me but tests is the only way to catch issues. -Alan From Alan.Bateman at oracle.com Thu Jul 28 11:28:16 2016 From: Alan.Bateman at oracle.com (Alan Bateman) Date: Thu, 28 Jul 2016 12:28:16 +0100 Subject: RFR [9] 8157570: sun.rmi.transport.GC retains a strong reference to the context class loader ( was :8160513 ) In-Reply-To: <811F7081-BEC0-41E3-8A91-5ACF0FA36AB7@oracle.com> References: <1b0051cd-840f-94f0-7bac-cc88ba1e7d22@oracle.com> <811F7081-BEC0-41E3-8A91-5ACF0FA36AB7@oracle.com> Message-ID: <4398c120-9268-3490-9e2f-425351a5f9bf@oracle.com> On 28/07/2016 11:22, Chris Hegarty wrote: > [ switching to 8157570 as it better describes the issue, rather than the affect ] > > >> Looks good to me Chris. >> Another possibility might be to use InnocuousThread? > Good idea Daniel. I updated the webrev to use InnocuousThread, and > added an assert, since this is no test. > > http://cr.openjdk.java.net/~chegar/8157570/ > > This looks much better and looks good to me. Separately, should the thread name be "RMI GC Daemon" to make it a bit clearer in thread dumps. -Alan From chris.hegarty at oracle.com Thu Jul 28 11:40:26 2016 From: chris.hegarty at oracle.com (Chris Hegarty) Date: Thu, 28 Jul 2016 12:40:26 +0100 Subject: RFR [9] 8157570: sun.rmi.transport.GC retains a strong reference to the context class loader ( was :8160513 ) In-Reply-To: <4398c120-9268-3490-9e2f-425351a5f9bf@oracle.com> References: <1b0051cd-840f-94f0-7bac-cc88ba1e7d22@oracle.com> <811F7081-BEC0-41E3-8A91-5ACF0FA36AB7@oracle.com> <4398c120-9268-3490-9e2f-425351a5f9bf@oracle.com> Message-ID: On 28 Jul 2016, at 12:28, Alan Bateman wrote: > > On 28/07/2016 11:22, Chris Hegarty wrote: > >> [ switching to 8157570 as it better describes the issue, rather than the affect ] >> >> >>> Looks good to me Chris. >>> Another possibility might be to use InnocuousThread? >> Good idea Daniel. I updated the webrev to use InnocuousThread, and >> added an assert, since this is no test. >> >> http://cr.openjdk.java.net/~chegar/8157570/ >> >> > This looks much better and looks good to me. Separately, should the thread name be "RMI GC Daemon" to make it a bit clearer in thread dumps. Thanks for the review Alan. Webrev updated in-place http://cr.openjdk.java.net/~chegar/8157570/ -Chris. From Alan.Bateman at oracle.com Thu Jul 28 11:41:44 2016 From: Alan.Bateman at oracle.com (Alan Bateman) Date: Thu, 28 Jul 2016 12:41:44 +0100 Subject: RFR [9] 8157570: sun.rmi.transport.GC retains a strong reference to the context class loader ( was :8160513 ) In-Reply-To: References: <1b0051cd-840f-94f0-7bac-cc88ba1e7d22@oracle.com> <811F7081-BEC0-41E3-8A91-5ACF0FA36AB7@oracle.com> <4398c120-9268-3490-9e2f-425351a5f9bf@oracle.com> Message-ID: <4e8e5754-20d2-b9e5-ae8f-eb5af13b778e@oracle.com> On 28/07/2016 12:40, Chris Hegarty wrote: > > Thanks for the review Alan. Webrev updated in-place > http://cr.openjdk.java.net/~chegar/8157570/ > > Looks good. From paul.sandoz at oracle.com Thu Jul 28 11:44:17 2016 From: paul.sandoz at oracle.com (Paul Sandoz) Date: Thu, 28 Jul 2016 13:44:17 +0200 Subject: RFR: 8160605: java/util/SplittableRandom/SplittableRandomTest.java failed with timeout In-Reply-To: References: Message-ID: <6733462C-68ED-46D2-8063-414C3BB4ADB7@oracle.com> > On 27 Jul 2016, at 19:42, Martin Buchholz wrote: > > Hi Paul, > > This deletes the testng ports of jsr166 tck random tests. > > If you can remember doing any work worth keeping, other than explicitly testing -Djava.util.secureRandomSeed=true (which we are adding to our tck tests), let me know. > > http://cr.openjdk.java.net/~martin/webrevs/openjdk9/jsr166-RandomTests/ None that i can think of. +1 Paul. From paul.sandoz at oracle.com Thu Jul 28 11:55:19 2016 From: paul.sandoz at oracle.com (Paul Sandoz) Date: Thu, 28 Jul 2016 13:55:19 +0200 Subject: RFR 8162458 Buffer view implementations use incorrect offset for Unsafe access In-Reply-To: <71d960ae-7bf5-2fbf-c783-63efa87d2e98@oracle.com> References: <2F815E1E-1DA6-4010-9B39-5D7BBB2DF069@oracle.com> <71d960ae-7bf5-2fbf-c783-63efa87d2e98@oracle.com> Message-ID: > On 28 Jul 2016, at 12:40, Alan Bateman wrote: > > On 27/07/2016 12:47, Paul Sandoz wrote: > >> Hi, >> >> I made an embarrassing mistake in the fix for >> >> https://bugs.openjdk.java.net/browse/JDK-8151163 >> All Buffer implementations should leverage Unsafe unaligned accessors >> >> The offset calculation for Unsafe access was incorrect, it?s easy to get confused because for heap buffers the offset is relative to the array, and for direct buffers the address (which can update for slices/duplicates). Disturbingly all existing tests were passing both for core and hotspot when i pushed to hs. >> >> As a penance i wrote a combinatorial test for buffer views to navigate the twisty maze of heap/direct, aligned/unaligned, little/big endian for accessing binary data and views from the source buffer. >> >> Please review: >> >> http://cr.openjdk.java.net/~psandoz/jdk9/JDK-8162458-byte-buffer-view-offset-access-incorrect/webrev/ >> >> (This may be a duplicate of [1]). >> >> Test has been verified to fail with the existing code. Focused JPRT runs pass, but i will kick off core/hotspot runs later on today. >> > It is disturbing that it wasn't caught by the original tests. The new test does appear to overlap with existing tests but I think that is okay. Yes, i wanted to write a focused test that explicitly enumerates the test cases (and is easy to add more), otherwise it can be really hard to track down which combination of properties are failing. > One small request is to trim down the really long lines as they are annoying when doing side-by-side diffs. > I split up lines over 110 characters or more. > In any case, the offsets in the updated code look right for me but tests is the only way to catch issues. > Thanks, Paul. From daniel.fuchs at oracle.com Thu Jul 28 12:05:51 2016 From: daniel.fuchs at oracle.com (Daniel Fuchs) Date: Thu, 28 Jul 2016 13:05:51 +0100 Subject: RFR [9] 8157570: sun.rmi.transport.GC retains a strong reference to the context class loader ( was :8160513 ) In-Reply-To: References: <1b0051cd-840f-94f0-7bac-cc88ba1e7d22@oracle.com> <811F7081-BEC0-41E3-8A91-5ACF0FA36AB7@oracle.com> <4398c120-9268-3490-9e2f-425351a5f9bf@oracle.com> Message-ID: Hi Chris, Looks good to me! best regards, -- daniel On 28/07/16 12:40, Chris Hegarty wrote: > On 28 Jul 2016, at 12:28, Alan Bateman wrote: >> >> On 28/07/2016 11:22, Chris Hegarty wrote: >> >>> [ switching to 8157570 as it better describes the issue, rather than the affect ] >>> >>> >>>> Looks good to me Chris. >>>> Another possibility might be to use InnocuousThread? >>> Good idea Daniel. I updated the webrev to use InnocuousThread, and >>> added an assert, since this is no test. >>> >>> http://cr.openjdk.java.net/~chegar/8157570/ >>> >>> >> This looks much better and looks good to me. Separately, should the thread name be "RMI GC Daemon" to make it a bit clearer in thread dumps. > > Thanks for the review Alan. Webrev updated in-place > http://cr.openjdk.java.net/~chegar/8157570/ > > -Chris. > From paul.sandoz at oracle.com Thu Jul 28 12:55:57 2016 From: paul.sandoz at oracle.com (Paul Sandoz) Date: Thu, 28 Jul 2016 14:55:57 +0200 Subject: RFR: 8162439: Runtime.Version.parse needs fast-path for major versions In-Reply-To: <5798F131.5020802@oracle.com> References: <57939A03.7080104@oracle.com> <5798F131.5020802@oracle.com> Message-ID: > On 27 Jul 2016, at 19:36, Claes Redestad wrote: > > On 07/25/2016 08:01 PM, Iris Clark wrote: >> Hi, Claes. >> >>> Webrev: http://cr.openjdk.java.net/~redestad/8162439/webrev.01/ >>> Bug: https://bugs.openjdk.java.net/browse/JDK-8162439 >> I think that this change looks good. We provide a shortcut for the common case where only the major version number is of interest without introducing a new API. > > Thanks! Any reviewer want to give this the go-ahead? Looks ok. I suppose you could do: boolean isSimpleNumber(String s) { for (int i = 0; i < s.length(); i++) { char c = s.get(i); if (c < ((i > 0) ? ?0? : ?1?) || c > ?9?) return false; } return true; } if (isSimpleNumber(s)) { ... } else { return VersionBuilder.parse(s); } then let VersionBuilder.parse throw errors in incorrectly formatted version strings. Paul. > >> >> Note that this has a minor side-effect that invocations of the form Runtime.Version.parse("notANumber") will now throw NFE instead of IAE. I don't think that this is a problem since NFE extends IAE and the order that the exceptions will be checked is intentionally unspecified. > > Right, I considered the minor behavior difference and thought it would be considered OK and in accordance with the specification, and unproblematic since this API is as of yet unreleased. > > As an aside: I do think specifying both NFE and IAE to be thrown is suspicious when it's not perfectly clear when which one is to be expected, since it invites to wrong code with strict dependencies on which is currently thrown when, even though it's unspecified, which would mean changing the implementation (like in this patch) would have some possibility of messing with compatibility. I wonder if we should simply specify IAE and drop NFE to allow greater flexibility for future implementations? > > /Claes > >> >> Regards, >> iris >> (not a Reviewer) >> >> -----Original Message----- >> From: Claes Redestad >> Sent: Saturday, July 23, 2016 9:24 AM >> To: core-libs-dev at openjdk.java.net core-libs-dev >> Subject: RFR: 8162439: Runtime.Version.parse needs fast-path for major versions >> >> Hi, >> >> please review this patch to address a startup regression due to use of >> Runtime.Version.parse("8") etc in JarFile, as introduced by JDK-8150680. >> This solution introduce a fast-path in case of what appears to be a single number is sent to Runtime.Version.parse to avoid initializing >> Runtime.VersionBuilder: >> >> Webrev: http://cr.openjdk.java.net/~redestad/8162439/webrev.01/ >> Bug: https://bugs.openjdk.java.net/browse/JDK-8162439 >> >> Passes all existing tests. >> >> Thanks! >> >> /Claes > From christoph.langer at sap.com Thu Jul 28 13:10:20 2016 From: christoph.langer at sap.com (Langer, Christoph) Date: Thu, 28 Jul 2016 13:10:20 +0000 Subject: RFR (JAXP): 8162598 XSLTC transformer swallows empty namespace declaration which is needed to undeclare default namespace Message-ID: Hi, please review my change for the XSLT namespace issue. Webrev: http://cr.openjdk.java.net/~clanger/webrevs/8162598.1/ Bug: https://bugs.openjdk.java.net/browse/JDK-8162598 The issue has already been discussed in this thread: http://mail.openjdk.java.net/pipermail/core-libs-dev/2016-July/042525.html Apart from the real fix in LiteralElement.java, method translate(), I've done some further cleanups in a few places. @Joe: The cleanups collide with some places of your proposed change for https://bugs.openjdk.java.net/browse/JDK-8158084 where we'd like to do the same things. So we'll have to synchronize on pushing. I've also enhanced the test case "TransformerTest" and added a method which does a regression test for the bug reported. Thanks in advance for reviewing. Best regards Christoph From chris.hegarty at oracle.com Thu Jul 28 13:22:24 2016 From: chris.hegarty at oracle.com (Chris Hegarty) Date: Thu, 28 Jul 2016 14:22:24 +0100 Subject: RFR [9] 8156824: com.sun.jndi.ldap.pool.PoolCleaner should clear its context class loader Message-ID: Another issue where an internal platform thread is unnecessarily retaining a reference to its creating thread?s context class loader. In this case, it appears to be safe to use an InnocuousThread, which will have a null context class loader. http://cr.openjdk.java.net/~chegar/8156824/01/ https://bugs.openjdk.java.net/browse/JDK-8156824 It?s not clear to me why the construction was not always in a privileged block, maybe ?modifyThread? was assumed. We now definitely need a privileged block as the context class loader is being set. -Chris. From rafael.wth at gmail.com Thu Jul 28 13:38:09 2016 From: rafael.wth at gmail.com (Rafael Winterhalter) Date: Thu, 28 Jul 2016 15:38:09 +0200 Subject: Change of the toString implementation for annotations In-Reply-To: References: Message-ID: Hi Joe, thank you for your answer. Can I ask for the rationale of using {} instead of [] only for classes? If the goal was to come closer to the source code representation, would this not imply to use curly braces for all array of an annotation? Thank you for your time! Best regards, Rafael 2016-07-19 4:13 GMT+02:00 joe darcy : > Hello Rafael, > > On 7/18/2016 5:43 PM, Rafael Winterhalter wrote: > >> Hello, >> I recognized a failing test on Java 9 caused by a changed return value >> returned by toString on an annotation with a class-property. >> >> When calling toString on an annotation: @interface Foo { Class value(); >> } instantiated as @Foo(Bar.class) with Java 8 it would be printed as: >> >> @Foo(class Bar) >> >> while in Java 9 it is printed as: >> >> @Foo(Bar.class) >> >> Is this change intended? I do not see a big benefit of this implementation >> change and it could break code. In my case, the problem is not that big, >> it >> is an easy fix but still, I found it a bit surprising. >> >> > I pushed the change your test noticed; it was done as part of > > JDK-5040830: (ann) please improve toString() for annotations > containing exception proxies > https://bugs.openjdk.java.net/browse/JDK-5040830 > > The basic rationale for the change is that "Foo.class" is the syntax that > appears when annotations are in source code so the toString() form should > generally reflect that. > > Thanks for running your project against JDK 9 builds; HTH, > > -Joe > From Alan.Bateman at oracle.com Thu Jul 28 13:46:32 2016 From: Alan.Bateman at oracle.com (Alan Bateman) Date: Thu, 28 Jul 2016 14:46:32 +0100 Subject: RFR [9] 8156824: com.sun.jndi.ldap.pool.PoolCleaner should clear its context class loader In-Reply-To: References: Message-ID: On 28/07/2016 14:22, Chris Hegarty wrote: > Another issue where an internal platform thread is unnecessarily > retaining a reference to its creating thread?s context class loader. > In this case, it appears to be safe to use an InnocuousThread, > which will have a null context class loader. > > http://cr.openjdk.java.net/~chegar/8156824/01/ > https://bugs.openjdk.java.net/browse/JDK-8156824 > > It?s not clear to me why the construction was not always in a > privileged block, maybe ?modifyThread? was assumed. We now > definitely need a privileged block as the context class loader is > being set. > This looks good to me. -Alan From daniel.fuchs at oracle.com Thu Jul 28 13:52:43 2016 From: daniel.fuchs at oracle.com (Daniel Fuchs) Date: Thu, 28 Jul 2016 14:52:43 +0100 Subject: RFR [9] 8156824: com.sun.jndi.ldap.pool.PoolCleaner should clear its context class loader In-Reply-To: References: Message-ID: On 28/07/16 14:22, Chris Hegarty wrote: > Another issue where an internal platform thread is unnecessarily > retaining a reference to its creating thread?s context class loader. > In this case, it appears to be safe to use an InnocuousThread, > which will have a null context class loader. > > http://cr.openjdk.java.net/~chegar/8156824/01/ > https://bugs.openjdk.java.net/browse/JDK-8156824 Hi Chris, I was concerned that Pool.expire() might require permissions (it writes to the socket channel and closes the socket), but if I'm not mistaken you only need perms to create/bind a socket, right? best regards, -- daniel > > It?s not clear to me why the construction was not always in a > privileged block, maybe ?modifyThread? was assumed. We now > definitely need a privileged block as the context class loader is > being set. > > -Chris. > From chris.hegarty at oracle.com Thu Jul 28 14:11:22 2016 From: chris.hegarty at oracle.com (Chris Hegarty) Date: Thu, 28 Jul 2016 15:11:22 +0100 Subject: RFR [9] 8156824: com.sun.jndi.ldap.pool.PoolCleaner should clear its context class loader In-Reply-To: References: Message-ID: <4A19A4EA-C042-47F0-97B5-44AB10B7E502@oracle.com> > On 28 Jul 2016, at 14:52, Daniel Fuchs wrote: > > On 28/07/16 14:22, Chris Hegarty wrote: >> Another issue where an internal platform thread is unnecessarily >> retaining a reference to its creating thread?s context class loader. >> In this case, it appears to be safe to use an InnocuousThread, >> which will have a null context class loader. >> >> http://cr.openjdk.java.net/~chegar/8156824/01/ >> https://bugs.openjdk.java.net/browse/JDK-8156824 > > Hi Chris, > > I was concerned that Pool.expire() might require permissions > (it writes to the socket channel and closes the socket), > but if I'm not mistaken you only need perms to create/bind > a socket, right? Correct. -Chris. From daniel.fuchs at oracle.com Thu Jul 28 14:16:21 2016 From: daniel.fuchs at oracle.com (Daniel Fuchs) Date: Thu, 28 Jul 2016 15:16:21 +0100 Subject: RFR [9] 8156824: com.sun.jndi.ldap.pool.PoolCleaner should clear its context class loader In-Reply-To: <4A19A4EA-C042-47F0-97B5-44AB10B7E502@oracle.com> References: <4A19A4EA-C042-47F0-97B5-44AB10B7E502@oracle.com> Message-ID: On 28/07/16 15:11, Chris Hegarty wrote: >> On 28 Jul 2016, at 14:52, Daniel Fuchs wrote: >> > >> > On 28/07/16 14:22, Chris Hegarty wrote: >>> >> Another issue where an internal platform thread is unnecessarily >>> >> retaining a reference to its creating thread?s context class loader. >>> >> In this case, it appears to be safe to use an InnocuousThread, >>> >> which will have a null context class loader. >>> >> >>> >> http://cr.openjdk.java.net/~chegar/8156824/01/ >>> >> https://bugs.openjdk.java.net/browse/JDK-8156824 >> > >> > Hi Chris, >> > >> > I was concerned that Pool.expire() might require permissions >> > (it writes to the socket channel and closes the socket), >> > but if I'm not mistaken you only need perms to create/bind >> > a socket, right? > Correct. Then I guess this looks OK. best regards, -- daniel From daniel.daugherty at oracle.com Thu Jul 28 14:29:47 2016 From: daniel.daugherty at oracle.com (Daniel D. Daugherty) Date: Thu, 28 Jul 2016 08:29:47 -0600 Subject: RFR 8162458 Buffer view implementations use incorrect offset for Unsafe access In-Reply-To: <90A0B797-2324-42B5-BAF9-E28AAB48B3E5@oracle.com> References: <2F815E1E-1DA6-4010-9B39-5D7BBB2DF069@oracle.com> <90A0B797-2324-42B5-BAF9-E28AAB48B3E5@oracle.com> Message-ID: <130ce829-b790-54b3-21ad-20da02623377@oracle.com> Paul, I have marked this bug (JDK-8162458) as an 'integration_blocker' in order to keep JDK-8151163 from leaving JDK9-hs in its current state. Dan On 7/28/16 4:33 AM, Paul Sandoz wrote: > Hooking in nio dev. > > I think this issue is important to review/push soon (i.e. this week) so as it does not leak out beyond the hs repo. > > ? > > Incidentally this patch also fixes what might have been a long standing bug in the compact method of buffer views. > > Here is ByteBufferAsIntBufferB?s compact method: > > public IntBuffer compact() { > > int pos = position(); > int lim = limit(); > assert (pos <= lim); > int rem = (pos <= lim ? lim - pos : 0); > > ByteBuffer db = bb.duplicate(); > db.limit(ix(lim)); > db.position(ix(0)); > ByteBuffer sb = db.slice(); > sb.position(pos << 2); > sb.compact(); > position(rem); > limit(capacity()); > discardMark(); > return this; > } > > > For view heap buffers the ix method used to return an offset relative to the underlying byte array, not relative to the buffer. this this can result values that are beyond the capacity of the buffer. > > The following code: > > ByteBuffer bb0 = ByteBuffer.allocate(16); > ByteBuffer bb4 = bb0.position(4).slice(); > ByteBuffer bb8 = bb4.position(4).slice(); > IntBuffer ib = bb8.asIntBuffer().compact(); > > results in: > > Exception in thread "main" java.lang.IllegalArgumentException: newLimit > capacity: (16 > 8) > > Paul. > > >> On 27 Jul 2016, at 13:47, Paul Sandoz wrote: >> >> Hi, >> >> I made an embarrassing mistake in the fix for >> >> https://bugs.openjdk.java.net/browse/JDK-8151163 >> All Buffer implementations should leverage Unsafe unaligned accessors >> >> The offset calculation for Unsafe access was incorrect, it?s easy to get confused because for heap buffers the offset is relative to the array, and for direct buffers the address (which can update for slices/duplicates). Disturbingly all existing tests were passing both for core and hotspot when i pushed to hs. >> >> As a penance i wrote a combinatorial test for buffer views to navigate the twisty maze of heap/direct, aligned/unaligned, little/big endian for accessing binary data and views from the source buffer. >> >> Please review: >> >> http://cr.openjdk.java.net/~psandoz/jdk9/JDK-8162458-byte-buffer-view-offset-access-incorrect/webrev/ >> >> (This may be a duplicate of [1]). >> >> Test has been verified to fail with the existing code. Focused JPRT runs pass, but i will kick off core/hotspot runs later on today. >> >> I will push to hs since that is where JDK-8151163 and it has not been integrated into jdk9/dev. >> >> Paul. >> >> [1] https://bugs.openjdk.java.net/browse/JDK-8159257 >> unsafe.cpp: assert(byte_offset < p_size) failed: Unsafe access: offset 32767 > object's size 16 >> >> For the test runtime/Unsafe/RangeCheck.java I can reproduce a crash in jdk9/dev which does not have JDK-8151163, and i can reproduce on jdk9/hs with this fix for JDK-8162458. > From daniel.fuchs at oracle.com Thu Jul 28 14:31:40 2016 From: daniel.fuchs at oracle.com (Daniel Fuchs) Date: Thu, 28 Jul 2016 15:31:40 +0100 Subject: RFR (JAXP): 8162598 XSLTC transformer swallows empty namespace declaration which is needed to undeclare default namespace In-Reply-To: References: Message-ID: Hi Christoph, Looks good in general, even though the idiom if (existing instanceof Stack) caught my eye. Thanks for the new test! I wonder if it should be made more strict - with a golden record of the expected results. In particular, to check that the xmlns="" in element is removed only when it should. Before your fix, it was always removed, even when it should not have! best regards, -- daniel On 28/07/16 14:10, Langer, Christoph wrote: > Hi, > > > > please review my change for the XSLT namespace issue. > > > > Webrev: http://cr.openjdk.java.net/~clanger/webrevs/8162598.1/ > > Bug: https://bugs.openjdk.java.net/browse/JDK-8162598 > > > > The issue has already been discussed in this thread: > http://mail.openjdk.java.net/pipermail/core-libs-dev/2016-July/042525.html > > > > Apart from the real fix in LiteralElement.java, method translate(), I?ve > done some further cleanups in a few places. @Joe: The cleanups collide > with some places of your proposed change for > https://bugs.openjdk.java.net/browse/JDK-8158084 where we?d like to do > the same things. So we?ll have to synchronize on pushing. > > > > I?ve also enhanced the test case ?TransformerTest? and added a method > which does a regression test for the bug reported. > > > > Thanks in advance for reviewing. > > > > Best regards > > Christoph > > > From christoph.langer at sap.com Thu Jul 28 15:05:43 2016 From: christoph.langer at sap.com (Langer, Christoph) Date: Thu, 28 Jul 2016 15:05:43 +0000 Subject: RFR (JAXP): 8162598 XSLTC transformer swallows empty namespace declaration which is needed to undeclare default namespace In-Reply-To: References: Message-ID: <133dd9c4ff2d4e5390f1cd6e8f7e8875@DEWDFE13DE11.global.corp.sap> Hi Daniel, thanks for reviewing. Here my comments: > Looks good in general, even though the idiom > if (existing instanceof Stack) > caught my eye. I didn't like it either but found no better way to get rid of the warnings. If you have a better idea here, let me know :) > Thanks for the new test! I wonder if it should be > made more strict - with a golden record of the expected > results. > > In particular, to check that the xmlns="" in element > is removed only when it should. > Before your fix, it was always removed, even when it > should not have! Well, I could String-compare the generated XML result with the blueprint - but I thought using the DOM API to query for the expected namespaces would be more resilient to future changes or platform specifics. But, as above, if you have suggestions on how it could be done better, I would love to refactor my test. Best Christoph From rafael.wth at gmail.com Thu Jul 28 15:33:34 2016 From: rafael.wth at gmail.com (Rafael Winterhalter) Date: Thu, 28 Jul 2016 17:33:34 +0200 Subject: Change of the toString implementation for annotations In-Reply-To: References: Message-ID: Another remark about "printability". Array types are printed in their internal form, i.e. "java.lang.Void[].class" becomes "Ljava.lang.Void;.class" in the string form. While I very much agree over the improvements of the toString implementation of the unresolved values, I still wonder if this special treatment is really necessary and justify the compatibility break. Are the curly braces meant to avoid confusion from parsing annotation values where the braces could also be part of a type literal? Any parser would need to process the annotation string sensitively anyways as string values could contain any value, if this is the case. Best regards, Rafael 2016-07-28 15:38 GMT+02:00 Rafael Winterhalter : > Hi Joe, > thank you for your answer. Can I ask for the rationale of using {} instead > of [] only for classes? If the goal was to come closer to the source code > representation, would this not imply to use curly braces for all array of > an annotation? > Thank you for your time! Best regards, Rafael > > 2016-07-19 4:13 GMT+02:00 joe darcy : > >> Hello Rafael, >> >> On 7/18/2016 5:43 PM, Rafael Winterhalter wrote: >> >>> Hello, >>> I recognized a failing test on Java 9 caused by a changed return value >>> returned by toString on an annotation with a class-property. >>> >>> When calling toString on an annotation: @interface Foo { Class >>> value(); >>> } instantiated as @Foo(Bar.class) with Java 8 it would be printed as: >>> >>> @Foo(class Bar) >>> >>> while in Java 9 it is printed as: >>> >>> @Foo(Bar.class) >>> >>> Is this change intended? I do not see a big benefit of this >>> implementation >>> change and it could break code. In my case, the problem is not that big, >>> it >>> is an easy fix but still, I found it a bit surprising. >>> >>> >> I pushed the change your test noticed; it was done as part of >> >> JDK-5040830: (ann) please improve toString() for annotations >> containing exception proxies >> https://bugs.openjdk.java.net/browse/JDK-5040830 >> >> The basic rationale for the change is that "Foo.class" is the syntax that >> appears when annotations are in source code so the toString() form should >> generally reflect that. >> >> Thanks for running your project against JDK 9 builds; HTH, >> >> -Joe >> > > From daniel.fuchs at oracle.com Thu Jul 28 15:34:34 2016 From: daniel.fuchs at oracle.com (Daniel Fuchs) Date: Thu, 28 Jul 2016 16:34:34 +0100 Subject: RFR (JAXP): 8162598 XSLTC transformer swallows empty namespace declaration which is needed to undeclare default namespace In-Reply-To: <133dd9c4ff2d4e5390f1cd6e8f7e8875@DEWDFE13DE11.global.corp.sap> References: <133dd9c4ff2d4e5390f1cd6e8f7e8875@DEWDFE13DE11.global.corp.sap> Message-ID: <4cfbcea3-af67-a770-005b-1df270a8e999@oracle.com> Hi Christoph, On 28/07/16 16:05, Langer, Christoph wrote: >> Looks good in general, even though the idiom >> > if (existing instanceof Stack) >> > caught my eye. > I didn't like it either but found no better way to get rid of the warnings. If you have a better idea here, let me know :) > The following code: static class Foo { T get() { return null; } } public static void main(String[] args) throws Exception { Foo x = new Foo<>(); if (x instanceof Foo) { System.out.println("ah"); } } doesn't generate any warning when compiled with javac -Xlint:all cheers, -- daniel From chris.hegarty at oracle.com Thu Jul 28 16:30:37 2016 From: chris.hegarty at oracle.com (Chris Hegarty) Date: Thu, 28 Jul 2016 17:30:37 +0100 Subject: RFR [9] 8134779 & 8134847: Minor usability issues with the jmod tool Message-ID: <5BD70CE2-7336-4389-AA94-7A1300E4AC6E@oracle.com> This is a minor change for a couple of usability issues with the jmod tool. It now issues a warning when it encounters duplicate entries, or an out of place module-info.class. http://cr.openjdk.java.net/~chegar/8134779_8134847/ https://bugs.openjdk.java.net/browse/JDK-8134779 https://bugs.openjdk.java.net/browse/JDK-8134847 -Chris. From Alan.Bateman at oracle.com Thu Jul 28 18:15:28 2016 From: Alan.Bateman at oracle.com (Alan Bateman) Date: Thu, 28 Jul 2016 19:15:28 +0100 Subject: RFR [9] 8134779 & 8134847: Minor usability issues with the jmod tool In-Reply-To: <5BD70CE2-7336-4389-AA94-7A1300E4AC6E@oracle.com> References: <5BD70CE2-7336-4389-AA94-7A1300E4AC6E@oracle.com> Message-ID: <1d6a823a-fda2-2824-eafc-9494f4103b3c@oracle.com> On 28/07/2016 17:30, Chris Hegarty wrote: > This is a minor change for a couple of usability issues with the jmod tool. > It now issues a warning when it encounters duplicate entries, or an out > of place module-info.class. > > http://cr.openjdk.java.net/~chegar/8134779_8134847/ > This looks okay to me. -Alan From oleg.barbashov at oracle.com Thu Jul 28 18:59:23 2016 From: oleg.barbashov at oracle.com (Oleg G. Barbashov) Date: Thu, 28 Jul 2016 21:59:23 +0300 Subject: RFR: 8158295 Add a multi-release jar validation mechanism to jar tool In-Reply-To: <33e3741c-fb99-f09c-3cf2-179e2c5491ea@oracle.com> References: <33e3741c-fb99-f09c-3cf2-179e2c5491ea@oracle.com> Message-ID: 27.07.2016 15:34, Oleg G. Barbashov ?????: > > 07.07.2016 23:32, Steve Drach ?????: >> Hi, >> >> Please review the following: >> >> webrev: http://cr.openjdk.java.net/~sdrach/8158295/webrev.01/ >> >> issue: https://bugs.openjdk.java.net/browse/JDK-8158295 >> >> >> This changeset adds a multi-release jar validator to jar tool. After >> the jar tool builds a multi-release jar, the potential resultant jar >> file is passed to the validator to assure that the jar file meets the >> minimal standards of a multi-release jar, in particular that >> versioned classes have the same api as base classes they override. >> There are other checks, for example warning if two classes are >> identical. If the jar file is invalid, it is not kept, so ?create >> will not produce a jar file and ?update will keep the input jar file. >> >> Thanks >> Steve > > 574 private boolean validate(String fname) { > 575 boolean valid = true; > 576 Validator validator = new Validator(this); > 577 > 578 try (JarFile jf = new JarFile(fname)) { > 579 AtomicBoolean validHolder = new AtomicBoolean(valid); > 580 jf.stream() > 581 .filter(e -> !e.isDirectory()) > 582 .filter(e -> !e.getName().equals(MANIFEST_NAME)) > 583 .filter(e -> !e.getName().endsWith(MODULE_INFO)) > 584 .sorted(entryComparator) > 585 .forEachOrdered(je -> { > 586 boolean b = validator.accept(je, jf); > 587 if (validHolder.get()) validHolder.set(b); > 588 }); > 589 valid = validHolder.get(); > 590 } catch (IOException e) { > 591 error(formatMsg2("error.validator.jarfile.exception", fname, > e.getMessage())); > 592 valid = false; > 593 } catch (InvalidJarException e) { > 594 error(formatMsg("error.validator.bad.entry.name", > e.getMessage())); > 595 valid = false; > 596 } > 597 return valid; > 598 } > > (IMHO) Using of AtomicBoolean and forEachOrdered() for stateful > validator here looks forced. It may be avoided by using regular > iterator with "for" loop: > > Stream sorted = jf.stream() > .filter(e -> !e.isDirectory()) > .filter(e -> !e.getName().equals(MANIFEST_NAME)) > .filter(e -> !e.getName().endsWith(MODULE_INFO)) > .sorted(entryComparator); > for (Iterator iter = sorted.iterator(); > iter.hasNext();) { > if (!validator.accept(iter.next(), jf)) { > valid = false; > } > } > > or even better by storing "valid" state inside the Validator after > turning it to regular Consumer: > > try (JarFile jf = new JarFile(fname)) { > Validator validator = new Validator(this, jf); > jf.stream() > .filter(e -> !e.isDirectory()) > .filter(e -> !e.getName().equals(MANIFEST_NAME)) > .filter(e -> !e.getName().endsWith(MODULE_INFO)) > .sorted(entryComparator) > .forEachOrdered(validator); > return validator.isValidated(); > } catch (IOException e) { > error(formatMsg2("error.validator.jarfile.exception", > fname, e.getMessage())); > return false; > } catch (NumberFormatException e) { > error(formatMsg("error.validator.bad.entry.name", > e.getMessage())); > return false; > } > > Moreover what is the reason to have an external loop over the jar's > entries? Even if we will use several different filter sets in future > it would be better to use it as optional parameter for Validator. > I mean that the jar file entries iteration code ("580 jf.stream().filter(e.... ") ... 588 }); ) processing should be a part of "Validator". From steve.drach at oracle.com Thu Jul 28 19:01:59 2016 From: steve.drach at oracle.com (Steve Drach) Date: Thu, 28 Jul 2016 12:01:59 -0700 Subject: RFR: 8158295 Add a multi-release jar validation mechanism to jar tool In-Reply-To: References: <33e3741c-fb99-f09c-3cf2-179e2c5491ea@oracle.com> Message-ID: <93788A5B-99D1-46BB-9335-3781B7C22676@oracle.com> > On Jul 28, 2016, at 11:59 AM, Oleg G. Barbashov wrote: > > 27.07.2016 15:34, Oleg G. Barbashov ?????: >> >> 07.07.2016 23:32, Steve Drach ?????: >>> Hi, >>> >>> Please review the following: >>> >>> webrev: http://cr.openjdk.java.net/~sdrach/8158295/webrev.01/ >>> issue: https://bugs.openjdk.java.net/browse/JDK-8158295 >>> >>> This changeset adds a multi-release jar validator to jar tool. After the jar tool builds a multi-release jar, the potential resultant jar file is passed to the validator to assure that the jar file meets the minimal standards of a multi-release jar, in particular that versioned classes have the same api as base classes they override. There are other checks, for example warning if two classes are identical. If the jar file is invalid, it is not kept, so ?create will not produce a jar file and ?update will keep the input jar file. >>> >>> Thanks >>> Steve >> >> 574 private boolean validate(String fname) { >> 575 boolean valid = true; >> 576 Validator validator = new Validator(this); >> 577 >> 578 try (JarFile jf = new JarFile(fname)) { >> 579 AtomicBoolean validHolder = new AtomicBoolean(valid); >> 580 jf.stream() >> 581 .filter(e -> !e.isDirectory()) >> 582 .filter(e -> !e.getName().equals(MANIFEST_NAME)) >> 583 .filter(e -> !e.getName().endsWith(MODULE_INFO)) >> 584 .sorted(entryComparator) >> 585 .forEachOrdered(je -> { >> 586 boolean b = validator.accept(je, jf); >> 587 if (validHolder.get()) validHolder.set(b); >> 588 }); >> 589 valid = validHolder.get(); >> 590 } catch (IOException e) { >> 591 error(formatMsg2("error.validator.jarfile.exception", fname, e.getMessage())); >> 592 valid = false; >> 593 } catch (InvalidJarException e) { >> 594 error(formatMsg("error.validator.bad.entry.name", e.getMessage())); >> 595 valid = false; >> 596 } >> 597 return valid; >> 598 } >> >> (IMHO) Using of AtomicBoolean and forEachOrdered() for stateful validator here looks forced. It may be avoided by using regular iterator with "for" loop: >> >> Stream sorted = jf.stream() >> .filter(e -> !e.isDirectory()) >> .filter(e -> !e.getName().equals(MANIFEST_NAME)) >> .filter(e -> !e.getName().endsWith(MODULE_INFO)) >> .sorted(entryComparator); >> for (Iterator iter = sorted.iterator(); iter.hasNext();) { >> if (!validator.accept(iter.next(), jf)) { >> valid = false; >> } >> } >> >> or even better by storing "valid" state inside the Validator after turning it to regular Consumer: >> >> try (JarFile jf = new JarFile(fname)) { >> Validator validator = new Validator(this, jf); >> jf.stream() >> .filter(e -> !e.isDirectory()) >> .filter(e -> !e.getName().equals(MANIFEST_NAME)) >> .filter(e -> !e.getName().endsWith(MODULE_INFO)) >> .sorted(entryComparator) >> .forEachOrdered(validator); >> return validator.isValidated(); >> } catch (IOException e) { >> error(formatMsg2("error.validator.jarfile.exception", fname, e.getMessage())); >> return false; >> } catch (NumberFormatException e) { >> error(formatMsg("error.validator.bad.entry.name", e.getMessage())); >> return false; >> } >> >> Moreover what is the reason to have an external loop over the jar's entries? Even if we will use several different filter sets in future it would be better to use it as optional parameter for Validator. >> > I mean that the jar file entries iteration code ("580 jf.stream().filter(e.... ") ... 588 }); ) processing should be a part of "Validator?. Yes, I know what you meant. I think it?s fine where it is, but I do like your suggestion to make Validator a Consumer and I?ll be releasing an updated webrev soon, with that change and the changes you recommended for the tests. Thanks for the ideas! From steve.drach at oracle.com Thu Jul 28 19:33:01 2016 From: steve.drach at oracle.com (Steve Drach) Date: Thu, 28 Jul 2016 12:33:01 -0700 Subject: RFR: 8158295 Add a multi-release jar validation mechanism to jar tool In-Reply-To: References: <35D52343-AC93-4CC6-8507-869D9750AA8A@oracle.com> Message-ID: <79BA1451-3822-4DEA-BED3-A4AA87DE8BC2@oracle.com> I?ve updated the webrev to incorporate the changes suggested by Oleg Barbashov. This changeset has a couple of minor changes to the tests and I?ve changed the Validator class to be an instance of Consumer. http://cr.openjdk.java.net/~sdrach/8158295/webrev.03/index.html > On Jul 18, 2016, at 6:33 PM, Steve Drach wrote: > >>> Please review the following: >>> >>> webrev: http://cr.openjdk.java.net/~sdrach/8158295/webrev.01/ >>> issue: https://bugs.openjdk.java.net/browse/JDK-8158295 >>> >>> This changeset adds a multi-release jar validator to jar tool. After the jar tool builds a multi-release jar, the potential resultant jar file is passed to the validator to assure that the jar file meets the minimal standards of a multi-release jar, in particular that versioned classes have the same api as base classes they override. There are other checks, for example warning if two classes are identical. If the jar file is invalid, it is not kept, so ?create will not produce a jar file and ?update will keep the input jar file. > > I?ve updated the webrev to address the issues raised ? http://cr.openjdk.java.net/~sdrach/8158295/webrev.02/index.html > >> >> jar/Main.java >> >> 284 // This code would be repeated in the create and update sections. >> 285 // In order not to do that, it's here as a consumer. >> 286 Consumer validateAndClose = tmpfile -> { >> Why does it need to be Consumer rather than just a method? > > I changed it to a method. > >> >> Then i think you don?t need to rethow, but you can still keep the try block and use finally for File.deleteIfExist since it will not complain for the case where you move. > > Done. > >> >> >> 558 int i1 = s1.indexOf('/', n); >> 559 int i2 = s1.indexOf('/', n); >> 560 if (i1 == -1) throw new NumberFormatException(s1); >> 561 if (i2 == -2) throw new NumberFormatException(s2); >> >> I think you are trying to reject entries directly under the versioned area so it?s not about numbers (same in the validator, so there is some redundancy?). > > A couple things here. The most obvious is it should be ?if (i2 == -1)?. I replaced NumberFormatException with a new InvalidJarException. I added a comment that > this code is used to sort the version numbers as string representations of numbers, therefore ?9? goes before ?10?, not usual for string sorts. > >> >> >> 588 AtomicBoolean validHolder = new AtomicBoolean(); >> 589 validHolder.set(valid); >> >> Pass valid to the constructor > > Done. > >> >> >> Validator/FingerPrint.java >> >> It would be useful to have some comments on what is checked in terms of API compatibility. e.g. describe what FingerPrint collects and how Validator uses it. > > Added some commentary to FingerPrint. > >> >> >> FingerPrint.java >> >> 205 private final Map fields = new HashMap<>(); >> 206 private final Map methods = new HashMap<>(); >> >> Not sure you need to use a Map, why not use a Set? > > Not sure why I did it with Maps instead of Sets, but I wanted to keep the method and field names and maybe that made sense at one time. It doesn?t now, so Sets they are. > >> >> Change Method to be literally a representation of a single method rather than a consolidation that is lossy for the set of exceptions. > > Done. > > From lange.fabian at gmail.com Thu Jul 28 20:13:48 2016 From: lange.fabian at gmail.com (Fabian Lange) Date: Thu, 28 Jul 2016 22:13:48 +0200 Subject: Files.read/readAllBytes can loop once with zero size buffer Message-ID: Hi, I just noticed that when one uses Files.readAllBytes() to read for example from the Linux proc file system, where file size is claimed to be 0, Files.read() will allocate a buffer of size 0 before then adjusting in a second loop (arraycopying the zero size buffer) In my opinion an initial size of 0 should not be used. I admit this might be a regression for files which are really empty and return an empty byte array, but I think it is actually more common to read from files which incorrectly report to be zero sized. Fabian From jperkins at redhat.com Thu Jul 28 20:31:38 2016 From: jperkins at redhat.com (James Perkins) Date: Thu, 28 Jul 2016 13:31:38 -0700 Subject: RFR: 6543126: Level.known can leak memory In-Reply-To: <18377964-f7c7-e1a2-4cb5-05df2085bb5a@oracle.com> References: <18377964-f7c7-e1a2-4cb5-05df2085bb5a@oracle.com> Message-ID: I just happened to take a glance at this and noticed the remove method on the KnownLevels doesn't quite look right. Using Optional.of(nameToLevels.get(mirroredLevel.name)).ifPresent((x) -> x.remove(this)); will produce an NPE if the level is not present. If the intention is that the levels may not be present in the list the Optional.ofNullable() should be used. On Mon, Jul 25, 2016 at 11:10 AM, Daniel Fuchs wrote: > Hi, > > Please find below a fix for: > > 6543126: Level.known can leak memory > https://bugs.openjdk.java.net/browse/JDK-6543126 > > webrev: > http://cr.openjdk.java.net/~dfuchs/webrev_6543126/webrev.00 > > This is a fix for a long standing issue: Level maintains a list > of know levels which has strong references to any created levels. > Because the references are strong references, they prevent the garbage > collection of levels, level classes, and level class loaders. > > This fix changes the KnownLevel class to extend WeakReference > in order to only retain a weak reference to custom level instances. > > best regards, > > -- daniel > -- James R. Perkins JBoss by Red Hat From daniel.fuchs at oracle.com Thu Jul 28 21:55:06 2016 From: daniel.fuchs at oracle.com (Daniel Fuchs) Date: Thu, 28 Jul 2016 22:55:06 +0100 Subject: RFR: 6543126: Level.known can leak memory In-Reply-To: References: <18377964-f7c7-e1a2-4cb5-05df2085bb5a@oracle.com> Message-ID: On 28/07/16 21:31, James Perkins wrote: > I just happened to take a glance at this and noticed the remove method > on the KnownLevels doesn't quite look right. > Using Optional.of(nameToLevels.get(mirroredLevel.name)).ifPresent((x) -> > x.remove(this)); will produce an NPE if the level is not present. If the > intention is that the levels may not be present in the list the > Optional.ofNullable() should be used. > Thanks a lot for your keen eyes James! (sigh!) Why would Optional.of() throw a NPE for null? But it does... This wasn't caught by the test because remove() usually follows a purge() and every call to purge() is synchronized, so I don't think it could happen, technically - except possibly for the call purge(KnownLevel). But you're right and the code is wrong, of course. ofNullable() it is! best regards, -- daniel From joe.darcy at oracle.com Thu Jul 28 22:11:28 2016 From: joe.darcy at oracle.com (Joseph D. Darcy) Date: Thu, 28 Jul 2016 15:11:28 -0700 Subject: JDK 9 RFR of JDK-8162746: VersionCheck.java failure after change for JDK-8160921 Message-ID: <579A8310.9090705@oracle.com> Hello, When the binary p2launcher was renamed to jweblauncher (JDK-8160921), the test tools/launcher/VersionCheck.java did not get the corresponding update and started failing. Please review the patch below to address this. Thanks, -Joe --- a/test/tools/launcher/VersionCheck.java Thu Jul 28 12:09:07 2016 -0700 +++ b/test/tools/launcher/VersionCheck.java Thu Jul 28 15:11:02 2016 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2016, 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 @@ -23,7 +23,7 @@ /** * @test - * @bug 6545058 6611182 8016209 8139986 + * @bug 6545058 6611182 8016209 8139986 8162746 * @summary validate and test -version, -fullversion, and internal, as well as * sanity checks if a tool can be launched. * @compile VersionCheck.java @@ -56,7 +56,7 @@ "jcontrol", "jmc", "jmc.ini", - "jp2launcher", + "jweblauncher", "jvisualvm", "packager", "ssvagent", @@ -93,11 +93,11 @@ "jps", "jrunscript", "jjs", - "jp2launcher", "jsadebugd", "jstack", "jstat", "jstatd", + "jweblauncher", "jvisualvm", "keytool", "kinit", From tim.bell at oracle.com Thu Jul 28 22:50:10 2016 From: tim.bell at oracle.com (Tim Bell) Date: Thu, 28 Jul 2016 15:50:10 -0700 Subject: JDK 9 RFR of JDK-8162746: VersionCheck.java failure after change for JDK-8160921 In-Reply-To: <579A8310.9090705@oracle.com> References: <579A8310.9090705@oracle.com> Message-ID: <579A8C22.4020206@oracle.com> Hi Joe: > When the binary p2launcher was renamed to jweblauncher (JDK-8160921), > the test > > tools/launcher/VersionCheck.java > > did not get the corresponding update and started failing. > > Please review the patch below to address this. Looks good to me. Thanks- Tim > Thanks, > > -Joe > > --- a/test/tools/launcher/VersionCheck.java Thu Jul 28 12:09:07 > 2016 -0700 > +++ b/test/tools/launcher/VersionCheck.java Thu Jul 28 15:11:02 > 2016 -0700 > @@ -1,5 +1,5 @@ > /* > - * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights > reserved. > + * Copyright (c) 2007, 2016, 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 > @@ -23,7 +23,7 @@ > > /** > * @test > - * @bug 6545058 6611182 8016209 8139986 > + * @bug 6545058 6611182 8016209 8139986 8162746 > * @summary validate and test -version, -fullversion, and internal, > as well as > * sanity checks if a tool can be launched. > * @compile VersionCheck.java > @@ -56,7 +56,7 @@ > "jcontrol", > "jmc", > "jmc.ini", > - "jp2launcher", > + "jweblauncher", > "jvisualvm", > "packager", > "ssvagent", > @@ -93,11 +93,11 @@ > "jps", > "jrunscript", > "jjs", > - "jp2launcher", > "jsadebugd", > "jstack", > "jstat", > "jstatd", > + "jweblauncher", > "jvisualvm", > "keytool", > "kinit", > From martinrb at google.com Fri Jul 29 01:22:42 2016 From: martinrb at google.com (Martin Buchholz) Date: Thu, 28 Jul 2016 18:22:42 -0700 Subject: Files.read/readAllBytes can loop once with zero size buffer In-Reply-To: References: Message-ID: What do you suggest instead? The extra allocation of a zero-size buffer is not that bad. I think it's best to optimize for files with correct metadata, while tolerating ones with buggy metadata. On Thu, Jul 28, 2016 at 1:13 PM, Fabian Lange wrote: > Hi, > I just noticed that when one uses Files.readAllBytes() to read for > example from the Linux proc file system, where file size is claimed to > be 0, Files.read() will allocate a buffer of size 0 before then > adjusting in a second loop (arraycopying the zero size buffer) > > In my opinion an initial size of 0 should not be used. > I admit this might be a regression for files which are really empty > and return an empty byte array, but I think it is actually more common > to read from files which incorrectly report to be zero sized. > > Fabian > From claes.redestad at oracle.com Fri Jul 29 03:15:52 2016 From: claes.redestad at oracle.com (Claes Redestad) Date: Fri, 29 Jul 2016 05:15:52 +0200 Subject: RFR: 8162439: Runtime.Version.parse needs fast-path for major versions In-Reply-To: References: <57939A03.7080104@oracle.com> <5798F131.5020802@oracle.com> Message-ID: <579ACA68.7070901@oracle.com> Hi Paul, On 07/28/2016 02:55 PM, Paul Sandoz wrote: >> On 27 Jul 2016, at 19:36, Claes Redestad wrote: >> >> On 07/25/2016 08:01 PM, Iris Clark wrote: >>> Hi, Claes. >>> >>>> Webrev: http://cr.openjdk.java.net/~redestad/8162439/webrev.01/ >>>> Bug: https://bugs.openjdk.java.net/browse/JDK-8162439 >>> I think that this change looks good. We provide a shortcut for the common case where only the major version number is of interest without introducing a new API. >> Thanks! Any reviewer want to give this the go-ahead? > Looks ok. > > I suppose you could do: > > boolean isSimpleNumber(String s) { > for (int i = 0; i < s.length(); i++) { > char c = s.get(i); > if (c < ((i > 0) ? ?0? : ?1?) || c > ?9?) > return false; > } > return true; > } > > > if (isSimpleNumber(s)) { > ... > } else { > return VersionBuilder.parse(s); > } > > then let VersionBuilder.parse throw errors in incorrectly formatted version strings. sounds reasonable. It'd still change the behavior for the empty string from IAE to NFE, but only having to do one pass over the input string is nice. Another reasonable comment I got offline was that this patch splits the parsing into two places, which is hacky. Since what we really want to avoid is to eagerly load the Version string patterns (pulling in large parts of j.u.regex), we could inline the parsing code into Runtime.Version.parse, rename VersionBuilder to VersionPattern and access the constants therein from the parse method to allow lazy initialization. The overall result is arguably cleaner: http://cr.openjdk.java.net/~redestad/8162439/webrev.02/ Thanks! /Claes From david.holmes at oracle.com Fri Jul 29 05:51:59 2016 From: david.holmes at oracle.com (David Holmes) Date: Fri, 29 Jul 2016 15:51:59 +1000 Subject: [8u40] RFR 6642881: Improve performance of Class.getClassLoader() In-Reply-To: References: <540A152E.9020507@oracle.com> <540E34C3.4070203@oracle.com> <540E605C.8020707@oracle.com> Message-ID: Hi Leela, On 29/07/2016 12:59 PM, Leela Mohan wrote: > I think, change in the file unsafe.cpp is incorrect. ( > http://cr.openjdk.java.net/~coleenp/6642881_8u40_hotspot/ ) > > Below function is accessing naked oops when thread has transitioned to > "native": > > *+ static jobject get_class_loader(JNIEnv* env, jclass cls) {**+ if > (java_lang_Class::is_primitive(JNIHandles::resolve_non_null(cls))) > {**+ return NULL;**+ }**+ Klass* k = > java_lang_Class::as_Klass(JNIHandles::resolve_non_null(cls));**+ oop > loader = k->class_loader();**+ return JNIHandles::make_local(env, > loader);**+ }* klass types are no longer oops in the Java heap, but metaspace objects that reside in a per-classloader allocation region. They never get compacted or relocated so raw pointers to them are safe. Cheers, David > > - Leela > > On Mon, Sep 8, 2014 at 7:05 PM, Coleen Phillimore < > coleen.phillimore at oracle.com> wrote: > >> >> Thanks, Mandy! >> >> Coleen >> >> >> On 9/8/14, 6:59 PM, Mandy Chung wrote: >> >>> Thumbs up. >>> >>> Mandy >>> >>> On 9/5/2014 12:55 PM, Coleen Phillimore wrote: >>> >>>> Summary: Add classLoader to java/lang/Class instance for fast access >>>> >>>> This is a backport request for 8u40. This change has been in the jdk9 >>>> code for 3 months without any problems. >>>> >>>> The JDK changes hg imported cleanly. The Hotspot change needed a hand >>>> merge for create_mirror call in klass.cpp. >>>> >>>> http://cr.openjdk.java.net/~coleenp/6642881_8u40_jdk/ >>>> http://cr.openjdk.java.net/~coleenp/6642881_8u40_hotspot/ >>>> >>>> bug link https://bugs.openjdk.java.net/browse/JDK-6642881 >>>> >>>> Ran jdk_core jtreg tests in jdk with both jdk/hotspot changes. Also ran >>>> jck java_lang tests with only the hotspot change. The hotspot change can >>>> be tested separately from the jdk change (but not the other way around). >>>> >>>> Thanks, >>>> Coleen >>>> >>> >>> >> From huizhe.wang at oracle.com Fri Jul 29 06:04:28 2016 From: huizhe.wang at oracle.com (huizhe wang) Date: Thu, 28 Jul 2016 23:04:28 -0700 Subject: RFR (JAXP): 8162598 XSLTC transformer swallows empty namespace declaration which is needed to undeclare default namespace In-Reply-To: References: Message-ID: <260fda07-53fb-5686-efb5-b95f746d9da5@oracle.com> Hi Christoph, On 7/28/2016 6:10 AM, Langer, Christoph wrote: > > Hi, > > please review my change for the XSLT namespace issue. > > Webrev: http://cr.openjdk.java.net/~clanger/webrevs/8162598.1/ > > > Bug: https://bugs.openjdk.java.net/browse/JDK-8162598 > > > The issue has already been discussed in this thread: > http://mail.openjdk.java.net/pipermail/core-libs-dev/2016-July/042525.html > > Apart from the real fix in LiteralElement.java, method translate(), > I?ve done some further cleanups in a few places. @Joe: The cleanups > collide with some places of your proposed change for > https://bugs.openjdk.java.net/browse/JDK-8158084 where we?d like to do > the same things. So we?ll have to synchronize on pushing. > My patch has just pushed. Could you merge the changes and re-generate webrev? The change looks to be sensitive. I'll build and run all other tests for you. Best, Joe > I?ve also enhanced the test case ?TransformerTest? and added a method > which does a regression test for the bug reported. > > Thanks in advance for reviewing. > > Best regards > > Christoph > From ecki at zusammenkunft.net Fri Jul 29 06:21:01 2016 From: ecki at zusammenkunft.net (ecki at zusammenkunft.net) Date: Fri, 29 Jul 2016 08:21:01 +0200 Subject: AW: Files.read/readAllBytes can loop once with zero size buffer In-Reply-To: References: Message-ID: <579af5cf.c41f1c0a.bae2d.63ba@mx.google.com> Hello, It could always read with a initial buffer of 0.5-16k and return a truncated copy if it read less (and a omit truncation by returning shared static 0 length array if empty). But this will only optimize the 0 byte case. Gruss Bernd -- http://bernd.eckenfels.net >From Win 10 Mobile Von: Martin Buchholz From lange.fabian at gmail.com Fri Jul 29 06:28:31 2016 From: lange.fabian at gmail.com (Fabian Lange) Date: Fri, 29 Jul 2016 08:28:31 +0200 Subject: Files.read/readAllBytes can loop once with zero size buffer In-Reply-To: <579af5cf.c41f1c0a.bae2d.63ba@mx.google.com> References: <579af5cf.c41f1c0a.bae2d.63ba@mx.google.com> Message-ID: Hi, yes something like that. I have no strong opinion. After discovering this, I switched to a hand rolled implementation with file name depended estimated buffer sizes. But usually inside the JDK, Edge cases are handled better, usually with some Math.min()/Math.max logic. IMHO that really depends how common it could be that SeekableBytesChannel returns a size of 0 while actually containing data. If the proc files are the only realistic scenario, then maybe my concern is not that valid Fabian On Fri, Jul 29, 2016 at 8:21 AM, wrote: > Hello, > > > > It could always read with a initial buffer of 0.5-16k and return a truncated > copy if it read less (and a omit truncation by returning shared static 0 > length array if empty). But this will only optimize the 0 byte case. > > > > > Gruss > Bernd > -- > http://bernd.eckenfels.net > From Win 10 Mobile > > > > Von: Martin Buchholz > Gesendet: Freitag, 29. Juli 2016 03:33 > An: Fabian Lange > Cc: core-libs-dev > Betreff: Re: Files.read/readAllBytes can loop once with zero size buffer > > > > What do you suggest instead? > > > > The extra allocation of a zero-size buffer is not that bad. > > > > I think it's best to optimize for files with correct metadata, while > > tolerating ones with buggy metadata. > > > > On Thu, Jul 28, 2016 at 1:13 PM, Fabian Lange > > wrote: > > > >> Hi, > >> I just noticed that when one uses Files.readAllBytes() to read for > >> example from the Linux proc file system, where file size is claimed to > >> be 0, Files.read() will allocate a buffer of size 0 before then > >> adjusting in a second loop (arraycopying the zero size buffer) > >> > >> In my opinion an initial size of 0 should not be used. > >> I admit this might be a regression for files which are really empty > >> and return an empty byte array, but I think it is actually more common > >> to read from files which incorrectly report to be zero sized. > >> > >> Fabian > >> > > From paul.sandoz at oracle.com Fri Jul 29 07:39:00 2016 From: paul.sandoz at oracle.com (Paul Sandoz) Date: Fri, 29 Jul 2016 09:39:00 +0200 Subject: RFR: 8162439: Runtime.Version.parse needs fast-path for major versions In-Reply-To: <579ACA68.7070901@oracle.com> References: <57939A03.7080104@oracle.com> <5798F131.5020802@oracle.com> <579ACA68.7070901@oracle.com> Message-ID: <47EA9642-D8D7-462B-ADFC-12FFB9F49B4D@oracle.com> > On 29 Jul 2016, at 05:15, Claes Redestad wrote: > > Hi Paul, > > On 07/28/2016 02:55 PM, Paul Sandoz wrote: >>> On 27 Jul 2016, at 19:36, Claes Redestad wrote: >>> >>> On 07/25/2016 08:01 PM, Iris Clark wrote: >>>> Hi, Claes. >>>> >>>>> Webrev: http://cr.openjdk.java.net/~redestad/8162439/webrev.01/ >>>>> Bug: https://bugs.openjdk.java.net/browse/JDK-8162439 >>>> I think that this change looks good. We provide a shortcut for the common case where only the major version number is of interest without introducing a new API. >>> Thanks! Any reviewer want to give this the go-ahead? >> Looks ok. >> >> I suppose you could do: >> >> boolean isSimpleNumber(String s) { >> for (int i = 0; i < s.length(); i++) { >> char c = s.get(i); >> if (c < ((i > 0) ? ?0? : ?1?) || c > ?9?) >> return false; >> } >> return true; >> } >> >> >> if (isSimpleNumber(s)) { >> ... >> } else { >> return VersionBuilder.parse(s); >> } >> >> then let VersionBuilder.parse throw errors in incorrectly formatted version strings. > > sounds reasonable. It'd still change the behavior for the empty string from IAE to NFE, but only having to do one pass over the input string is nice. > Hmm? i am inclined to agree because i am not sure given the pattern matching that one can reliably produce an NFE as anticipated in the JavaDoc. > Another reasonable comment I got offline was that this patch splits the parsing into two places, which is hacky. Since what we really want to avoid is to eagerly load the Version string patterns (pulling in large parts of j.u.regex), we could inline the parsing code into Runtime.Version.parse, rename VersionBuilder to VersionPattern and access the constants therein from the parse method to allow lazy initialization. The overall result is arguably cleaner: > > http://cr.openjdk.java.net/~redestad/8162439/webrev.02/ > Yes, much better. I was thinking similar thoughts about the split after i sent my previous email. Paul. From lange.fabian at gmail.com Fri Jul 29 08:23:31 2016 From: lange.fabian at gmail.com (Fabian Lange) Date: Fri, 29 Jul 2016 10:23:31 +0200 Subject: java.io.Writer uses CharSequence.toString() Message-ID: Hi, this week I learned that java.io.Writer while having append(CharSequence) methods, will invoke toString() on them before actually appending. This is especially sad because after having mad the String, write() will then copy out the chars of the string and then iterate over the chars individually. Something an iteration over chars of the CharSequence could have achieved much better. Fabian From pavel.rappo at oracle.com Fri Jul 29 09:43:20 2016 From: pavel.rappo at oracle.com (Pavel Rappo) Date: Fri, 29 Jul 2016 10:43:20 +0100 Subject: java.io.Writer uses CharSequence.toString() In-Reply-To: References: Message-ID: <4B7197FE-C159-4575-A6B0-2E9C773B1A9C@oracle.com> > On 29 Jul 2016, at 09:23, Fabian Lange wrote: > > This is especially sad because after having mad the String, write() > will then copy out the chars of the string and then iterate over the > chars individually. As far as I can see no one iterates over chars individually. Instead, bulk write is invoked with the char array from the String [1]. In contrast with java.io.OutputStream, java.io.Writer encourages bulk writes, not single char writes. So the premise is that a concrete subclass provides efficient bulk write. If this doesn't hold, then one could override Writer append(CharSequence csq) in this class to behave exactly like you said. > Something an iteration over chars of the CharSequence could have > achieved much better. I'm not sure about this. But you could prove it with a set of benchmarks for concrete subclasses in the JDK. -------------------------------------------------------------------------------- [1] http://hg.openjdk.java.net/jdk9/dev/jdk/file/9410dfad9f32/src/java.base/share/classes/java/io/Writer.java#l203 From daniel.fuchs at oracle.com Fri Jul 29 11:54:30 2016 From: daniel.fuchs at oracle.com (Daniel Fuchs) Date: Fri, 29 Jul 2016 12:54:30 +0100 Subject: RFR: 6543126: Level.known can leak memory In-Reply-To: References: <18377964-f7c7-e1a2-4cb5-05df2085bb5a@oracle.com> Message-ID: Hi, Here is the new webrev with Chris & James feedback taken in. http://cr.openjdk.java.net/~dfuchs/webrev_6543126/webrev.01/ best regards, -- daniel On 28/07/16 22:55, Daniel Fuchs wrote: > On 28/07/16 21:31, James Perkins wrote: >> I just happened to take a glance at this and noticed the remove method >> on the KnownLevels doesn't quite look right. >> Using Optional.of(nameToLevels.get(mirroredLevel.name)).ifPresent((x) -> >> x.remove(this)); will produce an NPE if the level is not present. If the >> intention is that the levels may not be present in the list the >> Optional.ofNullable() should be used. >> > > Thanks a lot for your keen eyes James! > > (sigh!) Why would Optional.of() throw a NPE for null? > But it does... > > This wasn't caught by the test because remove() usually > follows a purge() and every call to purge() is synchronized, > so I don't think it could happen, technically - except possibly > for the call purge(KnownLevel). But you're right and the code > is wrong, of course. > > ofNullable() it is! > > best regards, > > -- daniel From chris.hegarty at oracle.com Fri Jul 29 13:25:44 2016 From: chris.hegarty at oracle.com (Chris Hegarty) Date: Fri, 29 Jul 2016 14:25:44 +0100 Subject: RFR: 6543126: Level.known can leak memory In-Reply-To: References: <18377964-f7c7-e1a2-4cb5-05df2085bb5a@oracle.com> Message-ID: <20af4905-0452-8bd5-61dc-fafe9be1b700@oracle.com> On 29/07/16 12:54, Daniel Fuchs wrote: > Hi, > > Here is the new webrev with Chris & James feedback > taken in. > > http://cr.openjdk.java.net/~dfuchs/webrev_6543126/webrev.01/ This looks good to me Daniel. -Chris. > best regards, > > -- daniel > > On 28/07/16 22:55, Daniel Fuchs wrote: >> On 28/07/16 21:31, James Perkins wrote: >>> I just happened to take a glance at this and noticed the remove method >>> on the KnownLevels doesn't quite look right. >>> Using Optional.of(nameToLevels.get(mirroredLevel.name)).ifPresent((x) -> >>> x.remove(this)); will produce an NPE if the level is not present. If the >>> intention is that the levels may not be present in the list the >>> Optional.ofNullable() should be used. >>> >> >> Thanks a lot for your keen eyes James! >> >> (sigh!) Why would Optional.of() throw a NPE for null? >> But it does... >> >> This wasn't caught by the test because remove() usually >> follows a purge() and every call to purge() is synchronized, >> so I don't think it could happen, technically - except possibly >> for the call purge(KnownLevel). But you're right and the code >> is wrong, of course. >> >> ofNullable() it is! >> >> best regards, >> >> -- daniel > From ecki at zusammenkunft.net Fri Jul 29 14:12:21 2016 From: ecki at zusammenkunft.net (ecki at zusammenkunft.net) Date: Fri, 29 Jul 2016 16:12:21 +0200 Subject: AW: java.io.Writer uses CharSequence.toString() In-Reply-To: References: Message-ID: <579b6448.c3881c0a.c9f2f.1dee@mx.google.com> Hello, Have to agree with Fabian handling CharSequences (and special case StringBuilder) is pretty weak, in CharBuffer.append(CharSequence) you see the same toString. I would expect it to do: - Instamceof String -> use it - Instance of StringBuilder -> extract char[] and iterate - Instance of CharBuffer -> handle - Otherwise: Loop over charAt (the otherwise might be a tradeof between allocation and (not)inlined bounds checks) Alternative would be a CharSequence.fillInto(char[]) BTW wouldn't it be create if char[] implements CharSequence? Gruss Bernd -- http://bernd.eckenfels.net >From Win 10 Mobile Von: Fabian Lange From christoph.langer at sap.com Fri Jul 29 14:55:41 2016 From: christoph.langer at sap.com (Langer, Christoph) Date: Fri, 29 Jul 2016 14:55:41 +0000 Subject: RFR (JAXP): 8162598 XSLTC transformer swallows empty namespace declaration which is needed to undeclare default namespace In-Reply-To: <260fda07-53fb-5686-efb5-b95f746d9da5@oracle.com> References: <260fda07-53fb-5686-efb5-b95f746d9da5@oracle.com> Message-ID: <8b1eb92519b745c8b60c87f14076975f@DEWDFE13DE11.global.corp.sap> Hi Joe, here is the webrev after merging: http://cr.openjdk.java.net/~clanger/webrevs/8162598.2/ Let me know when you have done your tests - then I'll push it. @Daniel: Thanks for your help regarding Stack. You were right, I could remove that "". Thanks & Best regards Christoph From: huizhe wang [mailto:huizhe.wang at oracle.com] Sent: Freitag, 29. Juli 2016 08:04 To: Langer, Christoph ; Daniel Fuchs Cc: core-libs-dev at openjdk.java.net Subject: Re: RFR (JAXP): 8162598 XSLTC transformer swallows empty namespace declaration which is needed to undeclare default namespace Hi Christoph, On 7/28/2016 6:10 AM, Langer, Christoph wrote: Hi, please review my change for the XSLT namespace issue. Webrev: http://cr.openjdk.java.net/~clanger/webrevs/8162598.1/ Bug: https://bugs.openjdk.java.net/browse/JDK-8162598 The issue has already been discussed in this thread: http://mail.openjdk.java.net/pipermail/core-libs-dev/2016-July/042525.html Apart from the real fix in LiteralElement.java, method translate(), I've done some further cleanups in a few places. @Joe: The cleanups collide with some places of your proposed change for https://bugs.openjdk.java.net/browse/JDK-8158084 where we'd like to do the same things. So we'll have to synchronize on pushing. My patch has just pushed. Could you merge the changes and re-generate webrev? The change looks to be sensitive. I'll build and run all other tests for you. Best, Joe I've also enhanced the test case "TransformerTest" and added a method which does a regression test for the bug reported. Thanks in advance for reviewing. Best regards Christoph From leelamohan.venati at gmail.com Fri Jul 29 02:59:06 2016 From: leelamohan.venati at gmail.com (Leela Mohan) Date: Thu, 28 Jul 2016 19:59:06 -0700 Subject: [8u40] RFR 6642881: Improve performance of Class.getClassLoader() In-Reply-To: <540E605C.8020707@oracle.com> References: <540A152E.9020507@oracle.com> <540E34C3.4070203@oracle.com> <540E605C.8020707@oracle.com> Message-ID: I think, change in the file unsafe.cpp is incorrect. ( http://cr.openjdk.java.net/~coleenp/6642881_8u40_hotspot/ ) Below function is accessing naked oops when thread has transitioned to "native": *+ static jobject get_class_loader(JNIEnv* env, jclass cls) {**+ if (java_lang_Class::is_primitive(JNIHandles::resolve_non_null(cls))) {**+ return NULL;**+ }**+ Klass* k = java_lang_Class::as_Klass(JNIHandles::resolve_non_null(cls));**+ oop loader = k->class_loader();**+ return JNIHandles::make_local(env, loader);**+ }* - Leela On Mon, Sep 8, 2014 at 7:05 PM, Coleen Phillimore < coleen.phillimore at oracle.com> wrote: > > Thanks, Mandy! > > Coleen > > > On 9/8/14, 6:59 PM, Mandy Chung wrote: > >> Thumbs up. >> >> Mandy >> >> On 9/5/2014 12:55 PM, Coleen Phillimore wrote: >> >>> Summary: Add classLoader to java/lang/Class instance for fast access >>> >>> This is a backport request for 8u40. This change has been in the jdk9 >>> code for 3 months without any problems. >>> >>> The JDK changes hg imported cleanly. The Hotspot change needed a hand >>> merge for create_mirror call in klass.cpp. >>> >>> http://cr.openjdk.java.net/~coleenp/6642881_8u40_jdk/ >>> http://cr.openjdk.java.net/~coleenp/6642881_8u40_hotspot/ >>> >>> bug link https://bugs.openjdk.java.net/browse/JDK-6642881 >>> >>> Ran jdk_core jtreg tests in jdk with both jdk/hotspot changes. Also ran >>> jck java_lang tests with only the hotspot change. The hotspot change can >>> be tested separately from the jdk change (but not the other way around). >>> >>> Thanks, >>> Coleen >>> >> >> > From leelamohan.venati at gmail.com Fri Jul 29 07:55:47 2016 From: leelamohan.venati at gmail.com (Leela Mohan) Date: Fri, 29 Jul 2016 00:55:47 -0700 Subject: [8u40] RFR 6642881: Improve performance of Class.getClassLoader() In-Reply-To: References: <540A152E.9020507@oracle.com> <540E34C3.4070203@oracle.com> <540E605C.8020707@oracle.com> Message-ID: Hi David, I understand, Klass types are no longer oops but JNIHandles::resolve_non_null() would expose naked oops. In other words, KlassOops are no longer oops but java.lang.Class objects are. Thanks, Leela On Thu, Jul 28, 2016 at 10:51 PM, David Holmes wrote: > Hi Leela, > > On 29/07/2016 12:59 PM, Leela Mohan wrote: > >> I think, change in the file unsafe.cpp is incorrect. ( >> http://cr.openjdk.java.net/~coleenp/6642881_8u40_hotspot/ ) >> >> Below function is accessing naked oops when thread has transitioned to >> "native": >> >> *+ static jobject get_class_loader(JNIEnv* env, jclass cls) {**+ if >> (java_lang_Class::is_primitive(JNIHandles::resolve_non_null(cls))) >> {**+ return NULL;**+ }**+ Klass* k = >> java_lang_Class::as_Klass(JNIHandles::resolve_non_null(cls));**+ oop >> loader = k->class_loader();**+ return JNIHandles::make_local(env, >> loader);**+ }* >> > > klass types are no longer oops in the Java heap, but metaspace objects > that reside in a per-classloader allocation region. They never get > compacted or relocated so raw pointers to them are safe. > > Cheers, > David > > > >> - Leela >> >> On Mon, Sep 8, 2014 at 7:05 PM, Coleen Phillimore < >> coleen.phillimore at oracle.com> wrote: >> >> >>> Thanks, Mandy! >>> >>> Coleen >>> >>> >>> On 9/8/14, 6:59 PM, Mandy Chung wrote: >>> >>> Thumbs up. >>>> >>>> Mandy >>>> >>>> On 9/5/2014 12:55 PM, Coleen Phillimore wrote: >>>> >>>> Summary: Add classLoader to java/lang/Class instance for fast access >>>>> >>>>> This is a backport request for 8u40. This change has been in the jdk9 >>>>> code for 3 months without any problems. >>>>> >>>>> The JDK changes hg imported cleanly. The Hotspot change needed a hand >>>>> merge for create_mirror call in klass.cpp. >>>>> >>>>> http://cr.openjdk.java.net/~coleenp/6642881_8u40_jdk/ >>>>> http://cr.openjdk.java.net/~coleenp/6642881_8u40_hotspot/ >>>>> >>>>> bug link https://bugs.openjdk.java.net/browse/JDK-6642881 >>>>> >>>>> Ran jdk_core jtreg tests in jdk with both jdk/hotspot changes. Also ran >>>>> jck java_lang tests with only the hotspot change. The hotspot change >>>>> can >>>>> be tested separately from the jdk change (but not the other way >>>>> around). >>>>> >>>>> Thanks, >>>>> Coleen >>>>> >>>>> >>>> >>>> >>> From pavel.rappo at oracle.com Fri Jul 29 17:21:37 2016 From: pavel.rappo at oracle.com (Pavel Rappo) Date: Fri, 29 Jul 2016 18:21:37 +0100 Subject: java.io.Writer uses CharSequence.toString() In-Reply-To: <579b6448.c3881c0a.c9f2f.1dee@mx.google.com> References: <579b6448.c3881c0a.c9f2f.1dee@mx.google.com> Message-ID: <195DCE76-918E-4859-91FB-9C7011E1D1AB@oracle.com> Once again, while I agree in some places it could have been done a bit better probably, I would say it's good to a have a look at benchmarks first. If they show there's indeed a big difference between char[] copy = new chars[charSequence.length()]; String s = charSequence.toString(); s.getChars(0, s.length, copy, 0); and char[] copy = new chars[charSequence.length()]; charSequence.getChars(0, charSequence.length(), copy, 0); it could justify an increase in complexity of CharBuffer.append or introducing a new default method (getChars/fillInto) into CharSequence. Possibly. Or maybe not. Because there might be some nontrivial effects we are completely unaware of. Btw, what do you mean by "extract char[]" from StringBuilder? Do you want StringBuilder to give away a reference to its char[] outside? If not, than what's the difference between "extract char[]" from StringBuilder and "use String" in your algorithm? The bottom line is whatever you suggest would likely need a good justification. To me it's not immediately obvious that something like this public CharBuffer append(CharSequence csq) { if (csq == null) { put("null"); } else if (csq instanceof StringBuilder) { char[] chars = new char[csq.length()]; ((StringBuilder) csq).getChars(0, csq.length(), chars, 0); put(chars); } else if (csq instanceof StringBuffer) { char[] chars = new char[csq.length()]; ((StringBuffer) csq).getChars(0, csq.length(), chars, 0); put(chars); } else if (csq instanceof CharBuffer) { CharBuffer buffer = (CharBuffer) csq; int p = buffer.position(); put(buffer); buffer.position(p); } else { for (int i = 0; i < csq.length(); i++) { put(csq.charAt(i)); } } return this; } is better than this (what's there today) public CharBuffer append(CharSequence csq) { if (csq == null) return put("null"); else return put(csq.toString()); } > On 29 Jul 2016, at 15:12, ecki at zusammenkunft.net wrote: > > Hello, > > Have to agree with Fabian handling CharSequences (and special case StringBuilder) is pretty weak, in CharBuffer.append(CharSequence) you see the same toString. I would expect it to do: > - Instamceof String -> use it > - Instance of StringBuilder -> extract char[] and iterate > - Instance of CharBuffer -> handle > - Otherwise: Loop over charAt > > (the otherwise might be a tradeof between allocation and (not)inlined bounds checks) > > Alternative would be a CharSequence.fillInto(char[]) > > BTW wouldn't it be create if char[] implements CharSequence? > > Gruss > Bernd > -- > http://bernd.eckenfels.net > From Win 10 Mobile > > Von: Fabian Lange From martinrb at google.com Fri Jul 29 18:36:39 2016 From: martinrb at google.com (Martin Buchholz) Date: Fri, 29 Jul 2016 11:36:39 -0700 Subject: Files.read/readAllBytes can loop once with zero size buffer In-Reply-To: References: <579af5cf.c41f1c0a.bae2d.63ba@mx.google.com> Message-ID: I think keeping the status quo is the right outcome. The /proc filesystem is intentionally providing incorrect information because providing correct information is deemed to be too expensive (have to compute contents of file for stat?). Reading /proc is sufficiently expensive that the extra realloc of an empty buffer is noise. Be thankful that reading files in /proc works at all! On Thu, Jul 28, 2016 at 11:28 PM, Fabian Lange wrote: > Hi, > yes something like that. I have no strong opinion. After discovering > this, I switched to a hand rolled implementation with file name > depended estimated buffer sizes. > But usually inside the JDK, Edge cases are handled better, usually > with some Math.min()/Math.max logic. > > IMHO that really depends how common it could be that > SeekableBytesChannel returns a size of 0 while actually containing > data. > If the proc files are the only realistic scenario, then maybe my > concern is not that valid > > Fabian > > On Fri, Jul 29, 2016 at 8:21 AM, wrote: > > Hello, > > > > > > > > It could always read with a initial buffer of 0.5-16k and return a > truncated > > copy if it read less (and a omit truncation by returning shared static 0 > > length array if empty). But this will only optimize the 0 byte case. > > > > > > > > > > Gruss > > Bernd > > -- > > http://bernd.eckenfels.net > > From Win 10 Mobile > > > > > > > > Von: Martin Buchholz > > Gesendet: Freitag, 29. Juli 2016 03:33 > > An: Fabian Lange > > Cc: core-libs-dev > > Betreff: Re: Files.read/readAllBytes can loop once with zero size buffer > > > > > > > > What do you suggest instead? > > > > > > > > The extra allocation of a zero-size buffer is not that bad. > > > > > > > > I think it's best to optimize for files with correct metadata, while > > > > tolerating ones with buggy metadata. > > > > > > > > On Thu, Jul 28, 2016 at 1:13 PM, Fabian Lange > > > > wrote: > > > > > > > >> Hi, > > > >> I just noticed that when one uses Files.readAllBytes() to read for > > > >> example from the Linux proc file system, where file size is claimed to > > > >> be 0, Files.read() will allocate a buffer of size 0 before then > > > >> adjusting in a second loop (arraycopying the zero size buffer) > > > >> > > > >> In my opinion an initial size of 0 should not be used. > > > >> I admit this might be a regression for files which are really empty > > > >> and return an empty byte array, but I think it is actually more common > > > >> to read from files which incorrectly report to be zero sized. > > > >> > > > >> Fabian > > > >> > > > > > From dmitrij.pochepko at oracle.com Fri Jul 29 18:42:14 2016 From: dmitrij.pochepko at oracle.com (Dmitrij Pochepko) Date: Fri, 29 Jul 2016 21:42:14 +0300 Subject: RFR(S): 8162727 - Testbug: additional requires properties can't be used for filtering server vm in jdk jtreg tests In-Reply-To: <9491a957-7368-b373-b676-1987ba814550@oracle.com> References: <579A3EB9.7060704@oracle.com> <579AB182.8040502@oracle.com> <9491a957-7368-b373-b676-1987ba814550@oracle.com> Message-ID: <579BA386.20608@oracle.com> Sure, now including core-libs-dev Thanks, Dmitrij On 29.07.2016 20:16, joe darcy wrote: > Hello, > > I also recommend sending this review request over to core-libs-dev > since it affect the jdk repo. > > Thanks, > > -Joe > > > On 7/29/2016 12:35 AM, Dmitry Fazunenko wrote: >> Hi Dmitrij, >> >> The change itself looks good. >> >> One note: this change adds a little overhead (a very little) for >> running tests in jdk repository, but it's required only for VM >> specific tests stored in jdk. As alternative of this change I can >> suggest moving VM specific tests from the 'jdk' to 'hotspot' >> repository. Perhaps, such massive update is too late for JDK9 time >> frame and could be done only in JDK10. >> So, if the changes depending on 8162727 are not so critical and could >> be deferred I would prefer to postpone this fix. >> >> Thanks, >> Dima >> >> >> On 29.07.2016 4:29, Vladimir Kozlov wrote: >>> It affects all groups. Should be reviewed on hotspot-dev. >>> >>> Thanks, >>> Vladimir >>> >>> On 7/28/16 10:19 AM, Dmitrij Pochepko wrote: >>>> Hi, >>>> >>>> please review small patch for 8162727 - Testbug: additional >>>> requires properties can't be used for filtering server vm in jdk >>>> jtreg tests >>>> >>>> A problem is that tests under jdk repo can't use additional jtreg >>>> requires properties(like vm.flavor to filter out client or server >>>> vm). The same functionality was introduced for hotspot repo as part >>>> of JDK-8154956. So, in order to filter tests using these additional >>>> properties a small fix is created. >>>> >>>> webrev: http://cr.openjdk.java.net/~dpochepk/8162727/webrev.01/ >>>> CR: https://bugs.openjdk.java.net/browse/JDK-8162727 >>>> >>>> Thanks, >>>> Dmitrij >> > From volker.simonis at gmail.com Fri Jul 29 18:58:25 2016 From: volker.simonis at gmail.com (Volker Simonis) Date: Fri, 29 Jul 2016 20:58:25 +0200 Subject: [8u] request for approval: "8152172: PPC64: Support AES intrinsics" In-Reply-To: References: Message-ID: Ping! Can I please have an approval for backporting this change to 8u-dev? Thanks, Volker On Fri, Jul 22, 2016 at 11:08 AM, Volker Simonis wrote: > Hi, > > could you please approve the backport of the following, mostly ppc64 > change to jdk8u-dev: > > 8152172: PPC64: Support AES intrinsics > > Bug: https://bugs.openjdk.java.net/browse/JDK-8152172 > Webrev: http://cr.openjdk.java.net/~simonis/webrevs/2016/8152172_8u_hs/ > Webrev http://cr.openjdk.java.net/~simonis/webrevs/2016/8152172_8u_jdk/ > Review: http://mail.openjdk.java.net/pipermail/hotspot-compiler-dev/2016-March/thread.html#22032 > URL:http://hg.openjdk.java.net/jdk9/hs-comp/jdk/rev/74bc7be0777b > URL:http://hg.openjdk.java.net/jdk9/hs-comp/hotspot/rev/68394bf0a09f > > As you can see, the change consists of two parts - the main one in the > hotpsot repo and a small part in the jdk repo. > > The jdk part applied cleanly to jdk8u (with the usual directory shuffling). > > The hotspot part required a small tweak, but only in the ppc-only > part. This is because the feature detection for the AES instructions > was already active in jdk9 when the original change was made but is > not available in jdk8u until now. You can find the additional changes > at the end of this mail for your convenience. > > The required shared changes cleanly apply to jdk8u. > > As Vladimir pointed out in a previous thread, shared Hotspot changes > have to go through JPRT even in jdk8u-dev. So I need a sponsor to do > that and synchronously push both parts. > > @Hiroshii: could you please verify that you are fine with the change? > I've done some tests on Power8LE but just want to be sure this > downport satisfies your needs as well. > > Thank you and best regards, > Volker > > ===================== > > diff -r 15928d255046 src/cpu/ppc/vm/vm_version_ppc.cpp > --- a/src/cpu/ppc/vm/vm_version_ppc.cpp Wed Jul 13 00:47:40 2016 -0700 > +++ b/src/cpu/ppc/vm/vm_version_ppc.cpp Fri Jul 22 10:32:36 2016 +0200 > @@ -452,6 +476,7 @@ > a->popcntw(R7, R5); // code[7] -> popcntw > a->fcfids(F3, F4); // code[8] -> fcfids > a->vand(VR0, VR0, VR0); // code[9] -> vand > + a->vcipher(VR0, VR1, VR2); // code[10] -> vcipher > a->blr(); > > // Emit function to set one cache line to zero. Emit function > descriptor and get pointer to it. > @@ -495,6 +520,7 @@ > if (code[feature_cntr++]) features |= popcntw_m; > if (code[feature_cntr++]) features |= fcfids_m; > if (code[feature_cntr++]) features |= vand_m; > + if (code[feature_cntr++]) features |= vcipher_m; > > // Print the detection code. > if (PrintAssembly) { > diff -r 15928d255046 src/cpu/ppc/vm/vm_version_ppc.hpp > --- a/src/cpu/ppc/vm/vm_version_ppc.hpp Wed Jul 13 00:47:40 2016 -0700 > +++ b/src/cpu/ppc/vm/vm_version_ppc.hpp Fri Jul 22 10:32:36 2016 +0200 > @@ -42,6 +42,7 @@ > fcfids, > vand, > dcba, > + vcipher, > num_features // last entry to count features > }; > enum Feature_Flag_Set { > @@ -56,6 +57,7 @@ > fcfids_m = (1 << fcfids ), > vand_m = (1 << vand ), > dcba_m = (1 << dcba ), > + vcipher_m = (1 << vcipher), > all_features_m = -1 > }; > static int _features; > @@ -83,6 +85,7 @@ > static bool has_fcfids() { return (_features & fcfids_m) != 0; } > static bool has_vand() { return (_features & vand_m) != 0; } > static bool has_dcba() { return (_features & dcba_m) != 0; } > + static bool has_vcipher() { return (_features & vcipher_m) != 0; } > > static const char* cpu_features() { return _features_str; } From ecki at zusammenkunft.net Fri Jul 29 20:14:51 2016 From: ecki at zusammenkunft.net (Bernd Eckenfels) Date: Fri, 29 Jul 2016 22:14:51 +0200 Subject: java.io.Writer uses CharSequence.toString() In-Reply-To: <195DCE76-918E-4859-91FB-9C7011E1D1AB@oracle.com> References: <579b6448.c3881c0a.c9f2f.1dee@mx.google.com> <195DCE76-918E-4859-91FB-9C7011E1D1AB@oracle.com> Message-ID: <20160729221451.00002888.ecki@zusammenkunft.net> Hello, yes I agree that has to be benchmarked. (And probably greatly varries with the input length as well). But besides the performance aspect I wanted to mention something else. I had a password hashing API and wanted to switch from the typical overwriteable char[] signature to a CharSequence. Because if the password is only existing as a String there is no help in copying it to a char[]. And depending on the source CharSequence can deal with all of them. But then I noticed its quite hard to deal with CharSequences where no intermediate Strings are constructed. You asked about the "extract", I was inspired by Peters hint to extractChar in StringUtil of OpenHFT. It is a scary magic in an external API but it could be a internal shortcut within the JDK. I would actally expect encoders to have the same shortcut for strings... https://github.com/OpenHFT/Chronicle-Core/blob/master/src/main/java/net/openhft/chronicle/core/util/StringUtils.java Gruss Bernd Am Fri, 29 Jul 2016 18:21:37 +0100 schrieb Pavel Rappo : > Once again, while I agree in some places it could have been done a > bit better probably, I would say it's good to a have a look at > benchmarks first. > > If they show there's indeed a big difference between > > char[] copy = new chars[charSequence.length()]; > String s = charSequence.toString(); > s.getChars(0, s.length, copy, 0); > > and > > char[] copy = new chars[charSequence.length()]; > charSequence.getChars(0, charSequence.length(), copy, 0); > > it could justify an increase in complexity of CharBuffer.append or > introducing a new default method (getChars/fillInto) into > CharSequence. Possibly. Or maybe not. Because there might be some > nontrivial effects we are completely unaware of. > > Btw, what do you mean by "extract char[]" from StringBuilder? Do you > want StringBuilder to give away a reference to its char[] outside? If > not, than what's the difference between "extract char[]" from > StringBuilder and "use String" in your algorithm? > > The bottom line is whatever you suggest would likely need a good > justification. To me it's not immediately obvious that something like > this > > public CharBuffer append(CharSequence csq) { > if (csq == null) { > put("null"); > } else if (csq instanceof StringBuilder) { > char[] chars = new char[csq.length()]; > ((StringBuilder) csq).getChars(0, csq.length(), chars, 0); > put(chars); > } else if (csq instanceof StringBuffer) { > char[] chars = new char[csq.length()]; > ((StringBuffer) csq).getChars(0, csq.length(), chars, 0); > put(chars); > } else if (csq instanceof CharBuffer) { > CharBuffer buffer = (CharBuffer) csq; > int p = buffer.position(); > put(buffer); > buffer.position(p); > } else { > for (int i = 0; i < csq.length(); i++) { > put(csq.charAt(i)); > } > } > return this; > } > > is better than this (what's there today) > > public CharBuffer append(CharSequence csq) { > if (csq == null) > return put("null"); > else > return put(csq.toString()); > } > > > On 29 Jul 2016, at 15:12, ecki at zusammenkunft.net wrote: > > > > Hello, > > > > Have to agree with Fabian handling CharSequences (and special case > > StringBuilder) is pretty weak, in CharBuffer.append(CharSequence) > > you see the same toString. I would expect it to do: > > - Instamceof String -> use it > > - Instance of StringBuilder -> extract char[] and iterate > > - Instance of CharBuffer -> handle > > - Otherwise: Loop over charAt > > > > (the otherwise might be a tradeof between allocation and > > (not)inlined bounds checks) > > > > Alternative would be a CharSequence.fillInto(char[]) > > > > BTW wouldn't it be create if char[] implements CharSequence? > > > > Gruss > > Bernd > > -- > > http://bernd.eckenfels.net > > From Win 10 Mobile > > > > Von: Fabian Lange > From huizhe.wang at oracle.com Fri Jul 29 20:33:57 2016 From: huizhe.wang at oracle.com (Joe Wang) Date: Fri, 29 Jul 2016 13:33:57 -0700 Subject: RFR (JAXP): 8162598 XSLTC transformer swallows empty namespace declaration which is needed to undeclare default namespace In-Reply-To: <8b1eb92519b745c8b60c87f14076975f@DEWDFE13DE11.global.corp.sap> References: <260fda07-53fb-5686-efb5-b95f746d9da5@oracle.com> <8b1eb92519b745c8b60c87f14076975f@DEWDFE13DE11.global.corp.sap> Message-ID: <579BBDB5.50505@oracle.com> Hi Christoph, All tests passed. Please add a note to the test on what's expected, or some javadoc to the method checkNodeNS8162598. Best, Joe On 7/29/16, 7:55 AM, Langer, Christoph wrote: > > Hi Joe, > > here is the webrev after merging: > http://cr.openjdk.java.net/~clanger/webrevs/8162598.2/ > > > Let me know when you have done your tests -- then I'll push it. > > @Daniel: Thanks for your help regarding Stack. You were right, I > could remove that "". > > Thanks & Best regards > > Christoph > > *From:*huizhe wang [mailto:huizhe.wang at oracle.com] > *Sent:* Freitag, 29. Juli 2016 08:04 > *To:* Langer, Christoph ; Daniel Fuchs > > *Cc:* core-libs-dev at openjdk.java.net > *Subject:* Re: RFR (JAXP): 8162598 XSLTC transformer swallows empty > namespace declaration which is needed to undeclare default namespace > > Hi Christoph, > > On 7/28/2016 6:10 AM, Langer, Christoph wrote: > > Hi, > > please review my change for the XSLT namespace issue. > > Webrev: http://cr.openjdk.java.net/~clanger/webrevs/8162598.1/ > > > Bug: https://bugs.openjdk.java.net/browse/JDK-8162598 > > The issue has already been discussed in this thread: > http://mail.openjdk.java.net/pipermail/core-libs-dev/2016-July/042525.html > > Apart from the real fix in LiteralElement.java, method > translate(), I've done some further cleanups in a few places. > @Joe: The cleanups collide with some places of your proposed > change for https://bugs.openjdk.java.net/browse/JDK-8158084 where > we'd like to do the same things. So we'll have to synchronize on > pushing. > > > My patch has just pushed. Could you merge the changes and re-generate > webrev? The change looks to be sensitive. I'll build and run all > other tests for you. > > Best, > Joe > > > I've also enhanced the test case "TransformerTest" and added a > method which does a regression test for the bug reported. > > Thanks in advance for reviewing. > > Best regards > > Christoph > From Alan.Bateman at oracle.com Fri Jul 29 20:46:03 2016 From: Alan.Bateman at oracle.com (Alan Bateman) Date: Fri, 29 Jul 2016 21:46:03 +0100 Subject: Files.read/readAllBytes can loop once with zero size buffer In-Reply-To: References: <579af5cf.c41f1c0a.bae2d.63ba@mx.google.com> Message-ID: <3e203e35-e065-5990-41cc-1ebb59c42950@oracle.com> On 29/07/2016 19:36, Martin Buchholz wrote: > I think keeping the status quo is the right outcome. The /proc filesystem > is intentionally providing incorrect information because providing correct > information is deemed to be too expensive (have to compute contents of file > for stat?). Reading /proc is sufficiently expensive that the extra realloc > of an empty buffer is noise. Be thankful that reading files in /proc works > at all! > > and just to add that we have a file specifically for /proc as it used to cause problems in early versions. -Alan From ecki at zusammenkunft.net Fri Jul 29 23:19:27 2016 From: ecki at zusammenkunft.net (Bernd Eckenfels) Date: Sat, 30 Jul 2016 01:19:27 +0200 Subject: Files.read/readAllBytes can loop once with zero size buffer In-Reply-To: <3e203e35-e065-5990-41cc-1ebb59c42950@oracle.com> References: <579af5cf.c41f1c0a.bae2d.63ba@mx.google.com> <3e203e35-e065-5990-41cc-1ebb59c42950@oracle.com> Message-ID: <20160730011927.00001047.ecki@zusammenkunft.net> Hello, BTW: I think accessing named pipes/fifos would have the same "problem". But I guess nobody would use readAllBytes() on them :) Gruss Bernd Am Fri, 29 Jul 2016 21:46:03 +0100 schrieb Alan Bateman : > On 29/07/2016 19:36, Martin Buchholz wrote: > > > I think keeping the status quo is the right outcome. The /proc > > filesystem is intentionally providing incorrect information because > > providing correct information is deemed to be too expensive (have > > to compute contents of file for stat?). Reading /proc is > > sufficiently expensive that the extra realloc of an empty buffer is > > noise. Be thankful that reading files in /proc works at all! > > > > > and just to add that we have a file specifically for /proc as it used > to cause problems in early versions. > > -Alan From brent.christian at oracle.com Fri Jul 29 23:23:13 2016 From: brent.christian at oracle.com (Brent Christian) Date: Fri, 29 Jul 2016 16:23:13 -0700 Subject: java.io.Writer uses CharSequence.toString() In-Reply-To: <195DCE76-918E-4859-91FB-9C7011E1D1AB@oracle.com> References: <579b6448.c3881c0a.c9f2f.1dee@mx.google.com> <195DCE76-918E-4859-91FB-9C7011E1D1AB@oracle.com> Message-ID: <579BE561.2020705@oracle.com> Hi, This idea has been brought up before [1]. I concur with Pavel's assessment. I would add that now that latin-1 Strings are stored in a more compact form in JDK 9 ("Compact Strings" [2]), the performance profile of string data is further complicated. Thanks, -Brent 1. https://bugs.openjdk.java.net/browse/JDK-6206838 2. https://bugs.openjdk.java.net/browse/JDK-8054307 On 07/29/2016 10:21 AM, Pavel Rappo wrote: > Once again, while I agree in some places it could have been done a bit better > probably, I would say it's good to a have a look at benchmarks first. > > If they show there's indeed a big difference between > > char[] copy = new chars[charSequence.length()]; > String s = charSequence.toString(); > s.getChars(0, s.length, copy, 0); > > and > > char[] copy = new chars[charSequence.length()]; > charSequence.getChars(0, charSequence.length(), copy, 0); > > it could justify an increase in complexity of CharBuffer.append or introducing a > new default method (getChars/fillInto) into CharSequence. Possibly. Or maybe > not. Because there might be some nontrivial effects we are completely unaware of. > > Btw, what do you mean by "extract char[]" from StringBuilder? Do you want > StringBuilder to give away a reference to its char[] outside? If not, than > what's the difference between "extract char[]" from StringBuilder and "use > String" in your algorithm? > > The bottom line is whatever you suggest would likely need a good justification. > To me it's not immediately obvious that something like this > > public CharBuffer append(CharSequence csq) { > if (csq == null) { > put("null"); > } else if (csq instanceof StringBuilder) { > char[] chars = new char[csq.length()]; > ((StringBuilder) csq).getChars(0, csq.length(), chars, 0); > put(chars); > } else if (csq instanceof StringBuffer) { > char[] chars = new char[csq.length()]; > ((StringBuffer) csq).getChars(0, csq.length(), chars, 0); > put(chars); > } else if (csq instanceof CharBuffer) { > CharBuffer buffer = (CharBuffer) csq; > int p = buffer.position(); > put(buffer); > buffer.position(p); > } else { > for (int i = 0; i < csq.length(); i++) { > put(csq.charAt(i)); > } > } > return this; > } > > is better than this (what's there today) > > public CharBuffer append(CharSequence csq) { > if (csq == null) > return put("null"); > else > return put(csq.toString()); > } > >> On 29 Jul 2016, at 15:12, ecki at zusammenkunft.net wrote: >> >> Hello, >> >> Have to agree with Fabian handling CharSequences (and special case StringBuilder) is pretty weak, in CharBuffer.append(CharSequence) you see the same toString. I would expect it to do: >> - Instamceof String -> use it >> - Instance of StringBuilder -> extract char[] and iterate >> - Instance of CharBuffer -> handle >> - Otherwise: Loop over charAt >> >> (the otherwise might be a tradeof between allocation and (not)inlined bounds checks) >> >> Alternative would be a CharSequence.fillInto(char[]) >> >> BTW wouldn't it be create if char[] implements CharSequence? >> >> Gruss >> Bernd >> -- >> http://bernd.eckenfels.net >> From Win 10 Mobile >> >> Von: Fabian Lange > From joe.darcy at oracle.com Fri Jul 29 23:33:10 2016 From: joe.darcy at oracle.com (joe darcy) Date: Fri, 29 Jul 2016 16:33:10 -0700 Subject: Change of the toString implementation for annotations In-Reply-To: References: Message-ID: <001bf6c3-1dea-2f0a-e3c2-0e511d8432b7@oracle.com> It appears the plain overloads of Arrays.toString cannot be used to provide an annotation source compatible form since they use "[]" rather than "{}" to surround to contents. I'll see if I can handle that. On 7/28/2016 8:33 AM, Rafael Winterhalter wrote: > Another remark about "printability". Array types are printed in their > internal form, i.e. "java.lang.Void[].class" becomes > "Ljava.lang.Void;.class" in the string form. Ah yes, good catch -- some more checking is required there. > > While I very much agree over the improvements of the toString > implementation of the unresolved values, I still wonder if this > special treatment is really necessary and justify the compatibility > break. Are the curly braces meant to avoid confusion from parsing > annotation values where the braces could also be part of a type > literal? Any parser would need to process the annotation string > sensitively anyways as string values could contain any value, if this > is the case. As a general comment, the exact toString output of an annotation is deliberately not specified; from java.lang.annotation.Annotation.toString(): * Returns a string representation of this annotation. The details * of the representation are implementation-dependent [...] Therefore, the details of the toString output of annotations are not a formally exported interface of the platform. (For more details discussions of such matters see [1].) Early in the life of the platform, there was a preference to exactly specify toString output and hash values, etc., but this policy was found to be overly constraining so we moved away from that. HTH, -Joe [1] http://cr.openjdk.java.net/~darcy/OpenJdkDevGuide/OpenJdkDevelopersGuide.v0.777.html > > Best regards, Rafael > > 2016-07-28 15:38 GMT+02:00 Rafael Winterhalter >: > > Hi Joe, > thank you for your answer. Can I ask for the rationale of using {} > instead of [] only for classes? If the goal was to come closer to > the source code representation, would this not imply to use curly > braces for all array of an annotation? > Thank you for your time! Best regards, Rafael > > 2016-07-19 4:13 GMT+02:00 joe darcy >: > > Hello Rafael, > > On 7/18/2016 5:43 PM, Rafael Winterhalter wrote: > > Hello, > I recognized a failing test on Java 9 caused by a changed > return value > returned by toString on an annotation with a class-property. > > When calling toString on an annotation: @interface Foo { > Class value(); > } instantiated as @Foo(Bar.class) with Java 8 it would be > printed as: > > @Foo(class Bar) > > while in Java 9 it is printed as: > > @Foo(Bar.class) > > Is this change intended? I do not see a big benefit of > this implementation > change and it could break code. In my case, the problem is > not that big, it > is an easy fix but still, I found it a bit surprising. > > > I pushed the change your test noticed; it was done as part of > > JDK-5040830: (ann) please improve toString() for > annotations containing exception proxies > https://bugs.openjdk.java.net/browse/JDK-5040830 > > The basic rationale for the change is that "Foo.class" is the > syntax that appears when annotations are in source code so the > toString() form should generally reflect that. > > Thanks for running your project against JDK 9 builds; HTH, > > -Joe > > > From david.holmes at oracle.com Sat Jul 30 00:56:50 2016 From: david.holmes at oracle.com (David Holmes) Date: Sat, 30 Jul 2016 10:56:50 +1000 Subject: [8u40] RFR 6642881: Improve performance of Class.getClassLoader() In-Reply-To: References: <540A152E.9020507@oracle.com> <540E34C3.4070203@oracle.com> <540E605C.8020707@oracle.com> Message-ID: <859ac976-cfb9-2bdf-67cc-10b928b6f24d@oracle.com> On 29/07/2016 5:55 PM, Leela Mohan wrote: > Hi David, > > I understand, Klass types are no longer oops > but JNIHandles::resolve_non_null() would expose naked oops. In other > words, KlassOops are no longer oops but java.lang.Class objects are. Yes my mistake - focusing on the wrong aspect. Good catch. Thanks, David > Thanks, > Leela > > On Thu, Jul 28, 2016 at 10:51 PM, David Holmes > wrote: > > Hi Leela, > > On 29/07/2016 12:59 PM, Leela Mohan wrote: > > I think, change in the file unsafe.cpp is incorrect. ( > http://cr.openjdk.java.net/~coleenp/6642881_8u40_hotspot/ ) > > Below function is accessing naked oops when thread has > transitioned to > "native": > > *+ static jobject get_class_loader(JNIEnv* env, jclass cls) > {**+ if > (java_lang_Class::is_primitive(JNIHandles::resolve_non_null(cls))) > {**+ return NULL;**+ }**+ Klass* k = > java_lang_Class::as_Klass(JNIHandles::resolve_non_null(cls));**+ oop > loader = k->class_loader();**+ return JNIHandles::make_local(env, > loader);**+ }* > > > klass types are no longer oops in the Java heap, but metaspace > objects that reside in a per-classloader allocation region. They > never get compacted or relocated so raw pointers to them are safe. > > Cheers, > David > > > > - Leela > > On Mon, Sep 8, 2014 at 7:05 PM, Coleen Phillimore < > coleen.phillimore at oracle.com > > wrote: > > > Thanks, Mandy! > > Coleen > > > On 9/8/14, 6:59 PM, Mandy Chung wrote: > > Thumbs up. > > Mandy > > On 9/5/2014 12:55 PM, Coleen Phillimore wrote: > > Summary: Add classLoader to java/lang/Class instance > for fast access > > This is a backport request for 8u40. This change > has been in the jdk9 > code for 3 months without any problems. > > The JDK changes hg imported cleanly. The Hotspot > change needed a hand > merge for create_mirror call in klass.cpp. > > http://cr.openjdk.java.net/~coleenp/6642881_8u40_jdk/ > http://cr.openjdk.java.net/~coleenp/6642881_8u40_hotspot/ > > bug link > https://bugs.openjdk.java.net/browse/JDK-6642881 > > Ran jdk_core jtreg tests in jdk with both > jdk/hotspot changes. Also ran > jck java_lang tests with only the hotspot change. > The hotspot change can > be tested separately from the jdk change (but not > the other way around). > > Thanks, > Coleen > > > > > From lange.fabian at gmail.com Sat Jul 30 09:03:01 2016 From: lange.fabian at gmail.com (Fabian Lange) Date: Sat, 30 Jul 2016 11:03:01 +0200 Subject: java.io.Writer uses CharSequence.toString() In-Reply-To: <579BE561.2020705@oracle.com> References: <579b6448.c3881c0a.c9f2f.1dee@mx.google.com> <195DCE76-918E-4859-91FB-9C7011E1D1AB@oracle.com> <579BE561.2020705@oracle.com> Message-ID: Hi, so why did you guys invent CharSequence as an API if it cannot be used. I kind of understand why people use unsafe and come up with their own character data implementations. So you prefer multi megabyte string allocations including their arraycopy, (java.lang.StringBuilder.toString()) public String toString() { // Create a copy, don't share the array return new String(value, 0, count); } which then will arraycopy again this multimegabyte char array java.io.Writer.write(String, int, int) } else { // Don't permanently allocate very large buffers. cbuf = new char[len]; } str.getChars(off, (off + len), cbuf, 0); write(cbuf, 0, len); over an Implementation which doesn't do that? Fabian On Sat, Jul 30, 2016 at 1:23 AM, Brent Christian wrote: > Hi, > > This idea has been brought up before [1]. > > I concur with Pavel's assessment. I would add that now that latin-1 Strings > are stored in a more compact form in JDK 9 ("Compact Strings" [2]), the > performance profile of string data is further complicated. > > Thanks, > -Brent > > 1. https://bugs.openjdk.java.net/browse/JDK-6206838 > 2. https://bugs.openjdk.java.net/browse/JDK-8054307 > > On 07/29/2016 10:21 AM, Pavel Rappo wrote: >> >> Once again, while I agree in some places it could have been done a bit >> better >> probably, I would say it's good to a have a look at benchmarks first. >> >> If they show there's indeed a big difference between >> >> char[] copy = new chars[charSequence.length()]; >> String s = charSequence.toString(); >> s.getChars(0, s.length, copy, 0); >> >> and >> >> char[] copy = new chars[charSequence.length()]; >> charSequence.getChars(0, charSequence.length(), copy, 0); >> >> it could justify an increase in complexity of CharBuffer.append or >> introducing a >> new default method (getChars/fillInto) into CharSequence. Possibly. Or >> maybe >> not. Because there might be some nontrivial effects we are completely >> unaware of. >> >> Btw, what do you mean by "extract char[]" from StringBuilder? Do you want >> StringBuilder to give away a reference to its char[] outside? If not, than >> what's the difference between "extract char[]" from StringBuilder and "use >> String" in your algorithm? >> >> The bottom line is whatever you suggest would likely need a good >> justification. >> To me it's not immediately obvious that something like this >> >> public CharBuffer append(CharSequence csq) { >> if (csq == null) { >> put("null"); >> } else if (csq instanceof StringBuilder) { >> char[] chars = new char[csq.length()]; >> ((StringBuilder) csq).getChars(0, csq.length(), chars, 0); >> put(chars); >> } else if (csq instanceof StringBuffer) { >> char[] chars = new char[csq.length()]; >> ((StringBuffer) csq).getChars(0, csq.length(), chars, 0); >> put(chars); >> } else if (csq instanceof CharBuffer) { >> CharBuffer buffer = (CharBuffer) csq; >> int p = buffer.position(); >> put(buffer); >> buffer.position(p); >> } else { >> for (int i = 0; i < csq.length(); i++) { >> put(csq.charAt(i)); >> } >> } >> return this; >> } >> >> is better than this (what's there today) >> >> public CharBuffer append(CharSequence csq) { >> if (csq == null) >> return put("null"); >> else >> return put(csq.toString()); >> } >> >>> On 29 Jul 2016, at 15:12, ecki at zusammenkunft.net wrote: >>> >>> Hello, >>> >>> Have to agree with Fabian handling CharSequences (and special case >>> StringBuilder) is pretty weak, in CharBuffer.append(CharSequence) you see >>> the same toString. I would expect it to do: >>> - Instamceof String -> use it >>> - Instance of StringBuilder -> extract char[] and iterate >>> - Instance of CharBuffer -> handle >>> - Otherwise: Loop over charAt >>> >>> (the otherwise might be a tradeof between allocation and (not)inlined >>> bounds checks) >>> >>> Alternative would be a CharSequence.fillInto(char[]) >>> >>> BTW wouldn't it be create if char[] implements CharSequence? >>> >>> Gruss >>> Bernd >>> -- >>> http://bernd.eckenfels.net >>> From Win 10 Mobile >>> >>> Von: Fabian Lange >> >> > From pavel.rappo at oracle.com Sat Jul 30 13:31:28 2016 From: pavel.rappo at oracle.com (Pavel Rappo) Date: Sat, 30 Jul 2016 14:31:28 +0100 Subject: java.io.Writer uses CharSequence.toString() In-Reply-To: References: <579b6448.c3881c0a.c9f2f.1dee@mx.google.com> <195DCE76-918E-4859-91FB-9C7011E1D1AB@oracle.com> <579BE561.2020705@oracle.com> Message-ID: Could you please prototype what you suggest in code so we could discuss it more constructively? Otherwise I feel this discussion is getting too broad and as such may not achieve anything in particular. Thanks, -Pavel > On 30 Jul 2016, at 10:03, Fabian Lange wrote: > > Hi, > so why did you guys invent CharSequence as an API if it cannot be used. > I kind of understand why people use unsafe and come up with their own > character data implementations. > > So you prefer multi megabyte string allocations including their arraycopy, > (java.lang.StringBuilder.toString()) > > public String toString() { > // Create a copy, don't share the array > return new String(value, 0, count); > } > > which then will arraycopy again this multimegabyte char array > java.io.Writer.write(String, int, int) > > } else { // Don't permanently allocate very large buffers. > cbuf = new char[len]; > } > str.getChars(off, (off + len), cbuf, 0); > write(cbuf, 0, len); > > over an Implementation which doesn't do that? > > Fabian > > On Sat, Jul 30, 2016 at 1:23 AM, Brent Christian > wrote: >> Hi, >> >> This idea has been brought up before [1]. >> >> I concur with Pavel's assessment. I would add that now that latin-1 Strings >> are stored in a more compact form in JDK 9 ("Compact Strings" [2]), the >> performance profile of string data is further complicated. >> >> Thanks, >> -Brent >> >> 1. https://bugs.openjdk.java.net/browse/JDK-6206838 >> 2. https://bugs.openjdk.java.net/browse/JDK-8054307 >> >> On 07/29/2016 10:21 AM, Pavel Rappo wrote: >>> >>> Once again, while I agree in some places it could have been done a bit >>> better >>> probably, I would say it's good to a have a look at benchmarks first. >>> >>> If they show there's indeed a big difference between >>> >>> char[] copy = new chars[charSequence.length()]; >>> String s = charSequence.toString(); >>> s.getChars(0, s.length, copy, 0); >>> >>> and >>> >>> char[] copy = new chars[charSequence.length()]; >>> charSequence.getChars(0, charSequence.length(), copy, 0); >>> >>> it could justify an increase in complexity of CharBuffer.append or >>> introducing a >>> new default method (getChars/fillInto) into CharSequence. Possibly. Or >>> maybe >>> not. Because there might be some nontrivial effects we are completely >>> unaware of. >>> >>> Btw, what do you mean by "extract char[]" from StringBuilder? Do you want >>> StringBuilder to give away a reference to its char[] outside? If not, than >>> what's the difference between "extract char[]" from StringBuilder and "use >>> String" in your algorithm? >>> >>> The bottom line is whatever you suggest would likely need a good >>> justification. >>> To me it's not immediately obvious that something like this >>> >>> public CharBuffer append(CharSequence csq) { >>> if (csq == null) { >>> put("null"); >>> } else if (csq instanceof StringBuilder) { >>> char[] chars = new char[csq.length()]; >>> ((StringBuilder) csq).getChars(0, csq.length(), chars, 0); >>> put(chars); >>> } else if (csq instanceof StringBuffer) { >>> char[] chars = new char[csq.length()]; >>> ((StringBuffer) csq).getChars(0, csq.length(), chars, 0); >>> put(chars); >>> } else if (csq instanceof CharBuffer) { >>> CharBuffer buffer = (CharBuffer) csq; >>> int p = buffer.position(); >>> put(buffer); >>> buffer.position(p); >>> } else { >>> for (int i = 0; i < csq.length(); i++) { >>> put(csq.charAt(i)); >>> } >>> } >>> return this; >>> } >>> >>> is better than this (what's there today) >>> >>> public CharBuffer append(CharSequence csq) { >>> if (csq == null) >>> return put("null"); >>> else >>> return put(csq.toString()); >>> } >>> >>>> On 29 Jul 2016, at 15:12, ecki at zusammenkunft.net wrote: >>>> >>>> Hello, >>>> >>>> Have to agree with Fabian handling CharSequences (and special case >>>> StringBuilder) is pretty weak, in CharBuffer.append(CharSequence) you see >>>> the same toString. I would expect it to do: >>>> - Instamceof String -> use it >>>> - Instance of StringBuilder -> extract char[] and iterate >>>> - Instance of CharBuffer -> handle >>>> - Otherwise: Loop over charAt >>>> >>>> (the otherwise might be a tradeof between allocation and (not)inlined >>>> bounds checks) >>>> >>>> Alternative would be a CharSequence.fillInto(char[]) >>>> >>>> BTW wouldn't it be create if char[] implements CharSequence? >>>> >>>> Gruss >>>> Bernd >>>> -- >>>> http://bernd.eckenfels.net >>>> From Win 10 Mobile >>>> >>>> Von: Fabian Lange >>> >>> >> From christoph.langer at sap.com Sun Jul 31 21:25:23 2016 From: christoph.langer at sap.com (Langer, Christoph) Date: Sun, 31 Jul 2016 21:25:23 +0000 Subject: RFR (JAXP): 8162598 XSLTC transformer swallows empty namespace declaration which is needed to undeclare default namespace In-Reply-To: <579BBDB5.50505@oracle.com> References: <260fda07-53fb-5686-efb5-b95f746d9da5@oracle.com> <8b1eb92519b745c8b60c87f14076975f@DEWDFE13DE11.global.corp.sap> <579BBDB5.50505@oracle.com> Message-ID: Thanks, Joe. I added some documentation to checkNodeNS8162598 and pushed: http://hg.openjdk.java.net/jdk9/dev/jaxp/rev/e66cdc2de6b0 Would you agree to downport this to jdk8? Best regards Christoph From: Joe Wang [mailto:huizhe.wang at oracle.com] Sent: Freitag, 29. Juli 2016 22:34 To: Langer, Christoph Cc: Daniel Fuchs ; core-libs-dev at openjdk.java.net Subject: Re: RFR (JAXP): 8162598 XSLTC transformer swallows empty namespace declaration which is needed to undeclare default namespace Hi Christoph, All tests passed. Please add a note to the test on what's expected, or some javadoc to the method checkNodeNS8162598. Best, Joe On 7/29/16, 7:55 AM, Langer, Christoph wrote: Hi Joe, here is the webrev after merging: http://cr.openjdk.java.net/~clanger/webrevs/8162598.2/ Let me know when you have done your tests - then I'll push it. @Daniel: Thanks for your help regarding Stack. You were right, I could remove that "". Thanks & Best regards Christoph From: huizhe wang [mailto:huizhe.wang at oracle.com] Sent: Freitag, 29. Juli 2016 08:04 To: Langer, Christoph ; Daniel Fuchs Cc: core-libs-dev at openjdk.java.net Subject: Re: RFR (JAXP): 8162598 XSLTC transformer swallows empty namespace declaration which is needed to undeclare default namespace Hi Christoph, On 7/28/2016 6:10 AM, Langer, Christoph wrote: Hi, please review my change for the XSLT namespace issue. Webrev: http://cr.openjdk.java.net/~clanger/webrevs/8162598.1/ Bug: https://bugs.openjdk.java.net/browse/JDK-8162598 The issue has already been discussed in this thread: http://mail.openjdk.java.net/pipermail/core-libs-dev/2016-July/042525.html Apart from the real fix in LiteralElement.java, method translate(), I've done some further cleanups in a few places. @Joe: The cleanups collide with some places of your proposed change for https://bugs.openjdk.java.net/browse/JDK-8158084 where we'd like to do the same things. So we'll have to synchronize on pushing. My patch has just pushed. Could you merge the changes and re-generate webrev? The change looks to be sensitive. I'll build and run all other tests for you. Best, Joe I've also enhanced the test case "TransformerTest" and added a method which does a regression test for the bug reported. Thanks in advance for reviewing. Best regards Christoph From philipp at nowak-at.net Sun Jul 31 19:45:14 2016 From: philipp at nowak-at.net (Philipp Nowak) Date: Sun, 31 Jul 2016 21:45:14 +0200 Subject: Why is there no Math.ceilDiv? Message-ID: Hello, I hope this is the right place to ask this question. If it is not, I would kindly ask you to direct me to the correct place. I was wondering why there is no Math.ceilDiv() method, when a floorDiv() method got added in Java 8 through JDK-8023217 [1]. Is there any reason why such method did not get added with floorDiv(), and, if not, is there any process to request such a method? Best regards, Philipp Nowak ?[1] https://bugs.openjdk.java.net/browse/JDK-8023217?