Re: AccessbileObject setAccessible array version vs non-array version
On 10.12.2016 13:08, Alan Bateman wrote: On 10/12/2016 09:13, Jochen Theodorou wrote: Hi all, motivated by the recent "Java 9 build 148 causes trouble in Apache Lucene/Solr/Elasticsearch" thead, I thought I ask... there is AcccessibleObject#setAccessible(boolean), which will ask the SecurityManager for permissions and then make itself accessible according to the boolean flag. the array version takes an array of AccessibleObjects, asks the security manager *once* and then makes all of them accessible. So if you are in need to make a lot of objects accessible the array version is superior in performance. Now with jigsaw it is no longer a all or nothing for the class, now single methods or fields may no longer be made accessible, even without security manager. That means that even without a security manager set using the array version on File for example will fail with an exception (unless the module is opened from the command line, but we should leave that out for now) My question now basically is the following... why is this method not made deprecated? It is kind of useless now, even misleading I would say. I'm not sure that I understand your mail. The permission check when running with a security manager has not changed. If you use the array version then there is one permission check. Maybe you mean that the array version will fail when the array contains at least one element where the access check cannot be suppressed? That is possible of course. You mentioned File and maybe you mean you the array has a mix of public methods and non-public members and fields? yes. You will not need to set them to accessible for public members after all bye Jochen
Re: AccessbileObject setAccessible array version vs non-array version
On 10/12/2016 09:13, Jochen Theodorou wrote: Hi all, motivated by the recent "Java 9 build 148 causes trouble in Apache Lucene/Solr/Elasticsearch" thead, I thought I ask... there is AcccessibleObject#setAccessible(boolean), which will ask the SecurityManager for permissions and then make itself accessible according to the boolean flag. the array version takes an array of AccessibleObjects, asks the security manager *once* and then makes all of them accessible. So if you are in need to make a lot of objects accessible the array version is superior in performance. Now with jigsaw it is no longer a all or nothing for the class, now single methods or fields may no longer be made accessible, even without security manager. That means that even without a security manager set using the array version on File for example will fail with an exception (unless the module is opened from the command line, but we should leave that out for now) My question now basically is the following... why is this method not made deprecated? It is kind of useless now, even misleading I would say. I'm not sure that I understand your mail. The permission check when running with a security manager has not changed. If you use the array version then there is one permission check. Maybe you mean that the array version will fail when the array contains at least one element where the access check cannot be suppressed? That is possible of course. You mentioned File and maybe you mean you the array has a mix of public methods and non-public members and fields? -Alan.