Hi all,
since the JVM now prints warnings if you call setAccssible there was the
advise to move to trySetAccessible to prvent these warnings. Now I am
told those warnings appear here as well.
Now my question would be about what the intended behaviour here is. in
what mode is a
Sent: Sunday, July 9, 2017 7:17 PM
To: jigsaw-dev@openjdk.java.net
Subject: trySetAccessible
Hi all,
since the JVM now prints warnings if you call setAccssible there was the advise
to move to trySetAccessible to prvent these warnings. Now I am told those
warnings appear here as well.
N
On 10/07/2017 00:16, Jochen Theodorou wrote:
Hi all,
since the JVM now prints warnings if you call setAccssible there was
the advise to move to trySetAccessible to prvent these warnings.
The motivation for trySetAccessible is to avoid using exceptions for
control flow. I don't recal
On 10/07/2017 03:28, Stephen Felts wrote:
:
com.sun.xml.bind.v2.runtime.reflect.opt.Injector
com.sun.xml.ws.model.Injector
From what I can tell, these two aren't using tryAccessible. Instead
they seem to use setAccessible to attempt to get at a non-public
ClassLoader.defineClass method. It s
Hi Alan,
I was trying to fix Groovy to use trySetAccessible() instead of setAccessible()
and this did not change any warnings at all: The code can be found here:
https://github.com/apache/groovy/compare/master...uschindler:java9/trySetAccessible
It did not change anything. In fact, the code
I second Uwe's comment here: I was surprised as well, I expected the
semantics of `trySetAccessible` to be: "let me know if I can do this,
respecting the semantics of modules, and if not, return false"
2017-07-10 10:43 GMT+02:00 Uwe Schindler :
> Hi Alan,
>
> I was try
On 10.07.2017 10:49, Cédric Champeau wrote:
I second Uwe's comment here: I was surprised as well, I expected the
semantics of `trySetAccessible` to be: "let me know if I can do this,
respecting the semantics of modules, and if not, return false"
I suspect canAccess is supp
On 10.07.2017 10:07, Alan Bateman wrote:
[...]
Remember the purpose of the warnings is to make you or your users aware
that the code will behave differently when access to JDK internals, or
other so-called illegal access, is denied.
In the past we did create a MetaClass, which contains all th
On 10/07/2017 09:49, Cédric Champeau wrote:
I second Uwe's comment here: I was surprised as well, I expected the
semantics of `trySetAccessible` to be: "let me know if I can do this,
respecting the semantics of modules, and if not, return false"
For the example, trySetAcce
Right.
We need an API that returns false with no warning.
-Original Message-
From: Alan Bateman
Sent: Monday, July 10, 2017 5:56 AM
To: Cédric Champeau
Cc: jigsaw-dev
Subject: Re: trySetAccessible
On 10/07/2017 09:49, Cédric Champeau wrote:
> I second Uwe's comment her
;
>> I second Uwe's comment here: I was surprised as well, I expected the
>> semantics of `trySetAccessible` to be: "let me know if I can do this,
>> respecting the semantics of modules, and if not, return false"
>>
> For the example, trySetAccessible succeed
On 10/07/2017 09:43, Uwe Schindler wrote:
Hi Alan,
I was trying to fix Groovy to use trySetAccessible() instead of setAccessible()
and this did not change any warnings at all: The code can be found here:
https://github.com/apache/groovy/compare/master...uschindler:java9/trySetAccessible
It
On 10/07/2017 10:59, Cédric Champeau wrote:
This is not really practical. Basically it means that for every Gradle
build script on earth, we would either choose to make them fail on JDK
9, or be bloated with warnings, that are actually handled.
My mail was just explaining why it returns `true`.
On 10.07.2017 12:06, Alan Bateman wrote:
On 10/07/2017 10:59, Cédric Champeau wrote:
This is not really practical. Basically it means that for every Gradle
build script on earth, we would either choose to make them fail on JDK
9, or be bloated with warnings, that are actually handled.
My mail
On 10/07/2017 10:44, Jochen Theodorou wrote:
:
Example:
module A:
class Foo {
protected void foo(){}
}
Groovy program:
class X extends Foo {
def bar() {return {foo()}}
}
if Foo is in an exported package, then it is legal for X to call foo,
even though it is protected. But bar() does no
y applied to the "old" setAccessible API, but new Java 9 APIs would behave
in the new way. Because of this I understood Mark Reinhold's original proposal
mail like this: old-style setAccessible still works with warning, all new APIs
(trySetAccessible and Module metadata still say
On 10/07/2017 16:31, Uwe Schindler wrote:
Hi Alan,
we understand all this. But what you say is also not true. I started a second
approach to fix the issue by using canAccess() and also checking the module
stuff. For that I executed the following code on the Groovy unnamed module:
import org.c
Moin,
> > we understand all this. But what you say is also not true. I started a
> > second
> approach to fix the issue by using canAccess() and also checking the module
> stuff. For that I executed the following code on the Groovy unnamed
> module:
> >
> > import org.codehaus.groovy.reflection.C
On 11/07/2017 10:16, Uwe Schindler wrote:
:
Sorry, I mixed up the parameters. So basically the "correct" code to check if
something like java.lang.String is open to Groovy would be:
Module groovyModule = CachedClass.class.getModule(); //
org.codehaus.groovy.reflection.CachedClass;
Class clazz
On 11.07.2017 12:11, Alan Bateman wrote:
On 11/07/2017 10:16, Uwe Schindler wrote:
[...]
But now it is impossible for us to check, if something is not open by
default.
Module::getDescriptor will return the module descriptor for named
modules. So in this case, Object.class.getModule().getDes
On 11/07/2017 15:37, Jochen Theodorou wrote:
:
we need that on the level of a class member. Not every method in a
class from an exported package is accessible or has been made
accessible via runtime mechanisms.
The CLI options don't change the class or member modifiers so you should
be able t
I am clearly missing something, here. Using build 180, I have variables:
Method method, Class callingClass.
I evaluate:
callingClass.getModule() -
-> java.lang.Module@2940 “unnamed module @f973499”
method.getDeclaringClass()
-> java.lang.Class “class java.io.Obj
As described in the javadoc [1], Module::isOpen(String pn) returns true
if this module has opened a package unconditionally. It returns true
only if the module declares "opens pn;" unconditionally in
module-info.java. Since java.base does not open "java.io"
unconditionally, so isOpen("java.io”
On 16/08/2017 02:09, Russell Gold wrote:
:
but:
method.getDeclaringClass().getModule().isOpen("java.io",
callingClass.getModule())
-> true // which seems to say that it IS open to that
particular unnamed module ?!
As Mandy points out, isOpen(String) is used to test if a pac
> On Aug 23, 2017, at 1:49 AM, Alan Bateman wrote:
>
> On 16/08/2017 02:09, Russell Gold wrote:
>> :
>>
>> but:
>>
>> method.getDeclaringClass().getModule().isOpen("java.io",
>> callingClass.getModule())
>> -> true // which seems to say that it IS open to that
>> particular unna
On 27/08/2017 05:00, Russell Gold wrote:
When you say it is open to all unnamed modules, do you mean open with
warnings? How do you declare a module open? I don’t see that in the
current module documentation. Why is it only open to unnamed modules,
and how can we detect that a warning would b
> On Aug 27, 2017, at 4:07 PM, Alan Bateman wrote:
>
> On 27/08/2017 05:00, Russell Gold wrote:
>>
>> When you say it is open to all unnamed modules, do you mean open with
>> warnings? How do you declare a module open? I don’t see that in the current
>> module documentation. Why is it only op
On 28/08/2017 13:02, Russell Gold wrote:
That’s unfortunate; I had hoped that one of the real advantages of the
warning system was to allow us to degrade gracefully, putting in code
that would continue to work the old way in JDK8 but use new mechanisms
only when required.
The purpose of the w
Changeset: 335657c73d0b
Author:mchung
Date: 2017-02-04 15:41 -0800
URL: http://hg.openjdk.java.net/jigsaw/jake/jdk/rev/335657c73d0b
Add AccessibleObject::canAccess and trySetAccessible
! src/java.base/share/classes/java/lang/SecurityManager.java
! src/java.base/share/classes/java
k/rev/335657c73d0b
Add AccessibleObject::canAccess and trySetAccessible
! src/java.base/share/classes/java/lang/SecurityManager.java
! src/java.base/share/classes/java/lang/System.java
! src/java.base/share/classes/java/lang/invoke/MethodHandles.java
! src/java.base/share/classes/java/lang/re
>> URL: http://hg.openjdk.java.net/jigsaw/jake/jdk/rev/335657c73d0b
>>
>> Add AccessibleObject::canAccess and trySetAccessible
>>
>> ! src/java.base/share/classes/java/lang/SecurityManager.java
>> ! src/java.base/share/classes/java/lang/System.java
31 matches
Mail list logo