Re: RFR: 8177086: java.lang.reflect.AccessibleObject::canAccess should share access cache with internal method ::checkAccess

2017-03-20 Thread Alan Bateman
On 19/03/2017 22:47, Jochen Theodorou wrote: not wanting to hijack the thread, but why is there no canAccess method that takes a class argument to check if that class can access? Why always depending so much on caller sensitive methods? This method is intended to be used in conjunction with

RFR [9]: 8177036: Class.checkMemberAccess throws NPE when calling Class methods via JNI

2017-03-20 Thread Claes Redestad
Hi, please review this fix to avoid NPEs when calling certain Class methods via JNI: Bug: https://bugs.openjdk.java.net/browse/JDK-8177036 Webrev: http://cr.openjdk.java.net/~redestad/8177036/jdk.01/ Thanks! /Claes

Re: RFR: 8177086: java.lang.reflect.AccessibleObject::canAccess should share access cache with internal method ::checkAccess

2017-03-20 Thread Peter Levart
On 03/19/2017 11:42 PM, Peter Levart wrote: No problem. Here it is (against tip of jake/jdk): http://cr.openjdk.java.net/~plevart/jdk9-jake/AccessibleObject.canAccess_caching/webrev.02/ This patch changes a little when the stacktrace requested by sun.reflect.debugModuleAccessChecks system p

Re: RFR [9]: 8177036: Class.checkMemberAccess throws NPE when calling Class methods via JNI

2017-03-20 Thread Alan Bateman
On 20/03/2017 09:19, Claes Redestad wrote: Hi, please review this fix to avoid NPEs when calling certain Class methods via JNI: Bug: https://bugs.openjdk.java.net/browse/JDK-8177036 Webrev: http://cr.openjdk.java.net/~redestad/8177036/jdk.01/ This looks okay. At some point then we need to se

Re: RFR [9]: 8177036: Class.checkMemberAccess throws NPE when calling Class methods via JNI

2017-03-20 Thread Peter Levart
On 03/20/2017 11:41 AM, Alan Bateman wrote: On 20/03/2017 09:19, Claes Redestad wrote: Hi, please review this fix to avoid NPEs when calling certain Class methods via JNI: Bug: https://bugs.openjdk.java.net/browse/JDK-8177036 Webrev: http://cr.openjdk.java.net/~redestad/8177036/jdk.01/ Th

Re: RFR [9]: 8177036: Class.checkMemberAccess throws NPE when calling Class methods via JNI

2017-03-20 Thread Alan Bateman
On 20/03/2017 11:42, Peter Levart wrote: I guess that when only the ClassLoader of the caller is checked in logic of @CS method, such calls should behave as though the caller was some class loaded by bootstrap ClassLoader. But what about @CS methods that inspect the caller class more deeply

Re: RFR [9]: 8177036: Class.checkMemberAccess throws NPE when calling Class methods via JNI

2017-03-20 Thread Peter Levart
On 03/20/2017 12:42 PM, Peter Levart wrote: Currently core reflection throws InternalError (because of the check in Reflection::ensureMemberAccess). But jake repo already contains changes that remove this check and NPE is thrown later on in verifyModuleAccess... Regards, Peter ...it is a

Runtime.Version spec

2017-03-20 Thread Pavel Rappo
I have a couple of questions on the spec wording. 1. * {@code $BUILD}, matching {@code * (0|[1-9][0-9]*)} --- The build number, incremented for each promoted * build. {@code $BUILD} is reset to {@code 1} when any portion of {@code * $VNUM} is incremented. If the build number i

Re: RFR [9]: 8177036: Class.checkMemberAccess throws NPE when calling Class methods via JNI

2017-03-20 Thread Peter Levart
On 03/20/2017 12:54 PM, Peter Levart wrote: On 03/20/2017 12:42 PM, Peter Levart wrote: Currently core reflection throws InternalError (because of the check in Reflection::ensureMemberAccess). But jake repo already contains changes that remove this check and NPE is thrown later on in verif

RFR: 8177136: Caller sensitive methods Logger.getLogger, Logger.getAnonymousLogger, and System.getLogger should throw IllegalCallerException if there is no caller on the stack.

2017-03-20 Thread Daniel Fuchs
Hi, Please find below a patch for: 8177136: Caller sensitive methods Logger.getLogger, Logger.getAnonymousLogger, and System.getLogger should throw IllegalCallerException if there is no caller on the stack. https://bugs.openjdk.java.net/browse/JDK-8177136 Caller sensitive methods Logger.getL

Re: RFR [9]: 8177036: Class.checkMemberAccess throws NPE when calling Class methods via JNI

2017-03-20 Thread Daniel Fuchs
Hi Peter, On 20/03/2017 12:01, Peter Levart wrote: Perhaps the best way to rectify those problems in one place would be for Reflection.getCallerClass() to return a special internal class in its own package, such as: jdk.internal.solitary.NoCaller ...when there is no caller. This would work cor

Re: RFR: 8177136: Caller sensitive methods Logger.getLogger, Logger.getAnonymousLogger, and System.getLogger should throw IllegalCallerException if there is no caller on the stack.

2017-03-20 Thread David Holmes
Sorry Daniel but I don't understand how calling a public method via JNI can be deemed an illegal call ??? This seems to be a hole in the notion of "caller sensitive" to me. Also see discussion re: "RFR [9]: 8177036: Class.checkMemberAccess throws NPE when calling Class methods via JNI" David

Re: RFR: 8177136: Caller sensitive methods Logger.getLogger, Logger.getAnonymousLogger, and System.getLogger should throw IllegalCallerException if there is no caller on the stack.

2017-03-20 Thread Daniel Fuchs
Hi David, On 20/03/2017 12:16, David Holmes wrote: Sorry Daniel but I don't understand how calling a public method via JNI can be deemed an illegal call ??? In the case of these methods, it's only illegal if there's no java frame on the stack as the caller's module cannot be determined. It's p

Re: RFR: 8177136: Caller sensitive methods Logger.getLogger, Logger.getAnonymousLogger, and System.getLogger should throw IllegalCallerException if there is no caller on the stack.

2017-03-20 Thread David Holmes
On 20/03/2017 10:29 PM, Daniel Fuchs wrote: Hi David, On 20/03/2017 12:16, David Holmes wrote: Sorry Daniel but I don't understand how calling a public method via JNI can be deemed an illegal call ??? In the case of these methods, it's only illegal if there's no java frame on the stack as the

Re: RFR: 8177136: Caller sensitive methods Logger.getLogger, Logger.getAnonymousLogger, and System.getLogger should throw IllegalCallerException if there is no caller on the stack.

2017-03-20 Thread Daniel Fuchs
On 20/03/2017 12:37, David Holmes wrote: What about those API's says there has to be a Java frame higher up. Why can't an attached thread request a reference to the logger? Hi David, Did you look at the webrev? 1582 * @throws IllegalCallerException if there is no caller frame, i.e. 1583

java.lang.ref.Finalizer locks

2017-03-20 Thread Milan Mimica
Hello Hope you can help me with an advice. I'm using a library, namely spring-jdbc, which implements java.lang.Object.finalize() in one static inner class which does get instantiated *a lot*. It creates significant contention on synchronized block in java.lang.ref.Finalizer from Object's constr

Re: java.lang.ref.Finalizer locks

2017-03-20 Thread Peter Levart
Hi Milan, On 03/20/2017 02:13 PM, Milan Mimica wrote: Hello Hope you can help me with an advice. I'm using a library, namely spring-jdbc, which implements java.lang.Object.finalize() in one static inner class which does get instantiated *a lot*. It creates significant contention on synchroniz

Re: java.lang.ref.Finalizer locks

2017-03-20 Thread Milan Mimica
Hello Peter I created them a task: https://jira.spring.io/browse/SPR-15363 You don't suppose it would be worth trying to play with RegisterFinalizersAtInit? Maybe it could help for some reason if the registration was moved a bit earlier. Milan Mimica, Senior Software Engineer / Division Lead

Re: RFR: 8177086: java.lang.reflect.AccessibleObject::canAccess should share access cache with internal method ::checkAccess

2017-03-20 Thread Jochen Theodorou
frankly I would migrate more from the normal reflection API to the MethodHandles API instead of extending the Reflection API further, but I see the use case and reasoning here. thanks. bye Jochen On 20.03.2017 10:04, Alan Bateman wrote: On 19/03/2017 22:47, Jochen Theodorou wrote: not want

Re: RFR: 8159523. Fix tests depending on absence of -limitmods in VM arguments.

2017-03-20 Thread Alexandre (Shura) Iline
Igor, let me capture our offline conversation. The design you are suggesting is aimed to allow to chain methods which check different outputs: stderr, stdout and other possible artifacts of a process execution. To that end, 1. the method which you call stdout(Consumer) should really the called

Re: RFR: 8177086: java.lang.reflect.AccessibleObject::canAccess should share access cache with internal method ::checkAccess

2017-03-20 Thread Mandy Chung
> On Mar 19, 2017, at 3:42 PM, Peter Levart wrote: > > Hi Alan, >> >> When integrating with the cache came up on jigsaw-dev a few work ago then I >> think Mandy wanted to defer to it to JDK 10. However since canAccess is new >> then having is be more efficient might be good, it just mightn't

Re: RFR: 8177086: java.lang.reflect.AccessibleObject::canAccess should share access cache with internal method ::checkAccess

2017-03-20 Thread Mandy Chung
> On Mar 20, 2017, at 2:58 AM, Peter Levart wrote: > > > > On 03/19/2017 11:42 PM, Peter Levart wrote: >> No problem. Here it is (against tip of jake/jdk): >> >> http://cr.openjdk.java.net/~plevart/jdk9-jake/AccessibleObject.canAccess_caching/webrev.02/ >> >> >> This patch changes a little

Re: RFR [9]: 8177036: Class.checkMemberAccess throws NPE when calling Class methods via JNI

2017-03-20 Thread Mandy Chung
> On Mar 20, 2017, at 5:15 AM, Daniel Fuchs wrote: > > Hi Peter, > > On 20/03/2017 12:01, Peter Levart wrote: >> Perhaps the best way to rectify those problems in one place would be for >> Reflection.getCallerClass() to return a special internal class in its >> own package, such as: >> >> jdk.

Re: RFR [9]: 8177036: Class.checkMemberAccess throws NPE when calling Class methods via JNI

2017-03-20 Thread Mandy Chung
> On Mar 20, 2017, at 2:19 AM, Claes Redestad wrote: > > Hi, > > please review this fix to avoid NPEs when calling certain Class methods via > JNI: > > Bug: https://bugs.openjdk.java.net/browse/JDK-8177036 > Webrev: http://cr.openjdk.java.net/~redestad/8177036/jdk.01/ Looks okay. I agree t

Re: java.lang.ref.Finalizer locks

2017-03-20 Thread Mandy Chung
> On Mar 20, 2017, at 6:37 AM, Peter Levart wrote: > > So the most productive way would be to ask Spring developers to remove > finalization and instead employ their own PhantomReference based cleanup > and/or adopt new JDK 9 Cleaner API when time comes… +1 Moving away from using finalizers

Re: RFR: 8177136: Caller sensitive methods Logger.getLogger, Logger.getAnonymousLogger, and System.getLogger should throw IllegalCallerException if there is no caller on the stack.

2017-03-20 Thread David Holmes
On 20/03/2017 10:56 PM, Daniel Fuchs wrote: On 20/03/2017 12:37, David Holmes wrote: What about those API's says there has to be a Java frame higher up. Why can't an attached thread request a reference to the logger? Hi David, Did you look at the webrev? 1582 * @throws IllegalCallerExce

Re: RFR [9]: 8177036: Class.checkMemberAccess throws NPE when calling Class methods via JNI

2017-03-20 Thread David Holmes
As I'm discussing in the RFR for "8177136: Caller sensitive methods Logger.getLogger, Logger.getAnonymousLogger, and System.getLogger should throw IllegalCallerException if there is no caller on the stack." I am quite concerned by this, seemingly sudden, problem that we have a whole bunch of

Re: RFR [9]: 8177036: Class.checkMemberAccess throws NPE when calling Class methods via JNI

2017-03-20 Thread Mandy Chung
I saw the thread on JDK-8177136. I share your concern that throwing ICE does not seem a good choice. I’ll reply on that thread. It seems to me that it should default to the unnamed module if no caller frame rather than throwing an exception. For 8177036, no change in behavior. This actually

Re: RFR: 8177136: Caller sensitive methods Logger.getLogger, Logger.getAnonymousLogger, and System.getLogger should throw IllegalCallerException if there is no caller on the stack.

2017-03-20 Thread Alan Bateman
On 20/03/2017 20:22, David Holmes wrote: I see this as a basic hole in the whole notion of "current module". Surely if there is no module available then we should be in the unnamed-module? There isn't any notion of "current module". If there's no caller then you can't make any assumptions as

Re: RFR: 8177136: Caller sensitive methods Logger.getLogger, Logger.getAnonymousLogger, and System.getLogger should throw IllegalCallerException if there is no caller on the stack.

2017-03-20 Thread Mandy Chung
Hi Daniel, Have you considered default to the unnamed module when there is no caller frame on the stack? I don’t think we should make these APIs not callable from JNI attached thread even though very rarely be called from JNI (not sure any report on the current behavior throwing NPE). Mandy

Re: RFR: 8177136: Caller sensitive methods Logger.getLogger, Logger.getAnonymousLogger, and System.getLogger should throw IllegalCallerException if there is no caller on the stack.

2017-03-20 Thread Daniel Fuchs
Hi Mandy On 20/03/17 20:40, Mandy Chung wrote: Hi Daniel, Have you considered default to the unnamed module when there is no caller frame on the stack? I don’t think we should make these APIs not callable from JNI attached thread even though very rarely be called from JNI (not sure any repor

Re: RFR: 8177136: Caller sensitive methods Logger.getLogger, Logger.getAnonymousLogger, and System.getLogger should throw IllegalCallerException if there is no caller on the stack.

2017-03-20 Thread David Holmes
On 21/03/2017 6:56 AM, Daniel Fuchs wrote: Hi Mandy On 20/03/17 20:40, Mandy Chung wrote: Hi Daniel, Have you considered default to the unnamed module when there is no caller frame on the stack? I don’t think we should make these APIs not callable from JNI attached thread even though very rar

Re: RFR: 8177136: Caller sensitive methods Logger.getLogger, Logger.getAnonymousLogger, and System.getLogger should throw IllegalCallerException if there is no caller on the stack.

2017-03-20 Thread Daniel Fuchs
On 20/03/17 21:28, David Holmes wrote: If you are going to introduce an API with such a constraint then the constraint needs to be clearly documented and the alternatives also documented IMHO. System.getLogger relies on a notion of "current module". Yes: Instances returned by this method r

Possible error in PackTestZip64.java!?

2017-03-20 Thread Kharbas, Kishor
Hi! I came across an exception when running pack200 test PackTestZip64.java when I use a non-bundled zlib library with JDK8. This causes the test to fail. Upon examining the code, I believe the test fails incorrectly. The error is an side-effect of how new JarEntry's are created. Below is the de

Re: [9] RFR(L) 8158168: SIGSEGV: CollectedHeap::fill_with_objects(HeapWord*, unsigned long, bool)+0xa8

2017-03-20 Thread Xueming Shen
Hi Dean, Thanks for doing this. Though as I suggested last time personally I prefer to make minimum change to simply seal those holes in ASB at this late stage of JDK9. I'm fine with the webrev.2 and it looks better and reasonable to pull all UTF16 operations into StringUTF16.java. Just for

Compare a Path element to a string

2017-03-20 Thread Weijun Wang
Hi Alan I'm profiling the new FilePermission implementation and found a lot of time spending on comparing a Path to a string, and the path has only one element. Here are them: 1. Comparing with "-": Path lastName = npath.getFileName(); if (lastName != null && lastName.toString().equal