[jira] [Commented] (JCLOUDS-1542) Java 11 warns of illegal reflective access

2020-07-05 Thread ASF subversion and git services (Jira)


[ 
https://issues.apache.org/jira/browse/JCLOUDS-1542?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17151669#comment-17151669
 ] 

ASF subversion and git services commented on JCLOUDS-1542:
--

Commit 9e4c7a16daeb97f9b51b9077e40d12ce5343840f in jclouds's branch 
refs/heads/master from Jean-Noël Rouvignac
[ https://gitbox.apache.org/repos/asf?p=jclouds.git;h=9e4c7a1 ]

JCLOUDS-1542 follow-up: check whether isAccessible() is already set (#79)

AccessibleObject.canAccess() would be much much better,
but this API can only be used from Java 9 onward.

> Java 11 warns of illegal reflective access
> --
>
> Key: JCLOUDS-1542
> URL: https://issues.apache.org/jira/browse/JCLOUDS-1542
> Project: jclouds
>  Issue Type: Improvement
>  Components: jclouds-core
>Affects Versions: 2.2.0
>Reporter: ctranxuan
>Priority: Major
> Fix For: 2.3.0
>
>  Time Spent: 2h 20m
>  Remaining Estimate: 0h
>
> When using JClouds BlobStore for Google Cloud Storage with Java 11, some 
> warning are displayed by the JVM about illegal reflective access:
>  
> {quote}WARNING: An illegal reflective access operation has occurred
>  WARNING: Illegal reflective access by org.jclouds.reflect.Reflection2$1 
> ([file:/.../jclouds-core.jar|file:///.../jclouds-core.jar]) to constructor 
> java.lang.String(char[],int,int,java.lang.Void)
>  WARNING: Please consider reporting this to the maintainers of 
> org.jclouds.reflect.Reflection2$1
>  WARNING: Use --illegal-access=warn to enable warnings of further illegal 
> reflective access operations
>  WARNING: All illegal access operations will be denied in a future release
> {quote}
>  
> JClouds works but as stated, these illegal reflective accesses may be denied 
> in upper Java versions.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Commented] (JCLOUDS-1542) Java 11 warns of illegal reflective access

2020-06-26 Thread ASF subversion and git services (Jira)


[ 
https://issues.apache.org/jira/browse/JCLOUDS-1542?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17146545#comment-17146545
 ] 

ASF subversion and git services commented on JCLOUDS-1542:
--

Commit 238c97507816606a0aeca2fafd7a3196bfb7f1dc in jclouds's branch 
refs/heads/master from Jean-Noël Rouvignac
[ https://gitbox.apache.org/repos/asf?p=jclouds.git;h=238c975 ]

JCLOUDS-1542 Java 11 warns of illegal reflective access (#76)

With Java 11, an illegal reflective access is output for the google cloud 
storage blobstore.

WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.jclouds.reflect.Reflection2$1 
(file:/.../jclouds-core.jar) to constructor 
java.lang.String(char[],int,int,java.lang.Void)
WARNING: Please consider reporting this to the maintainers of 
org.jclouds.reflect.Reflection2$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal 
reflective access operations
WARNING: All illegal access operations will be denied in a future release

Indeed, JClouds calls `setAccessible(true)` on the package protected constructor
 `java.lang.String(char[],int,int,java.lang.Void)`.
Investigating the code, it turns out it is looking for constructors annotated 
with any of:
* java.beans.ConstructorProperties
* org.jclouds.json.SerializedNames
* com.google.inject.Inject

But `String` being defined in `java.base` module, it is impossible
 that it will be annotated with any of these annotation.

This commit is complementary to JClouds commit 
db4e4af931ef19f582b85f02efb93e50f1c5d01c .



Reflection2.java:
Do not call `setAccessible(true)` on core java constructors and methods.



For reference, here is the stacktrace of this illegal access warning:

java.lang.String.(String.java:3208)
java.lang.String.(String.java:251)
java.util.StringJoiner.compactElts(StringJoiner.java:250)
java.util.StringJoiner.toString(StringJoiner.java:173)

jdk.internal.module.IllegalAccessLogger.loudWarning(IllegalAccessLogger.java:339)
jdk.internal.module.IllegalAccessLogger.log(IllegalAccessLogger.java:288)
jdk.internal.module.IllegalAccessLogger.log(IllegalAccessLogger.java:261)

jdk.internal.module.IllegalAccessLogger.logIfOpenedForIllegalAccess(IllegalAccessLogger.java:226)

java.lang.reflect.AccessibleObject.logIfOpenedForIllegalAccess(AccessibleObject.java:366)

java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:325)

java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:280)
java.lang.reflect.Constructor.checkCanSetAccessible(Constructor.java:189)
java.lang.reflect.Constructor.setAccessible(Constructor.java:182)
org.jclouds.reflect.Reflection2$1.load(Reflection2$1.java:157)
org.jclouds.reflect.Reflection2$1.load(Reflection2$1.java:153)

com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache$LoadingValueReference.java:3529)

com.google.common.cache.LocalCache$Segment.loadSync(LocalCache$Segment.java:2278)

com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache$Segment.java:2155)
com.google.common.cache.LocalCache$Segment.get(LocalCache$Segment.java:2045)
com.google.common.cache.LocalCache.get(LocalCache.java:3953)
com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3976)

com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache$LocalLoadingCache.java:4960)
org.jclouds.reflect.Reflection2.get(Reflection2.java:346)
org.jclouds.reflect.Reflection2.constructors(Reflection2.java:100)

org.jclouds.json.internal.NamingStrategies$AnnotationConstructorNamingStrategy.getDeserializer(NamingStrategies$AnnotationConstructorNamingStrategy.java:271)

org.jclouds.json.internal.DeserializationConstructorAndReflectiveTypeAdapterFactory.create(DeserializationConstructorAndReflectiveTypeAdapterFactory.java:125)
com.google.gson.Gson.getAdapter(Gson.java:458)

org.jclouds.json.gson.internal.bind.ReflectiveTypeAdapterFactory.createBoundField(ReflectiveTypeAdapterFactory.java:117)

org.jclouds.json.gson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields(ReflectiveTypeAdapterFactory.java:166)

org.jclouds.json.gson.internal.bind.ReflectiveTypeAdapterFactory.create(ReflectiveTypeAdapterFactory.java:102)
com.google.gson.Gson.getAdapter(Gson.java:458)
com.google.gson.Gson.toJson(Gson.java:696)
com.google.gson.Gson.toJson(Gson.java:683)
com.google.gson.Gson.toJson(Gson.java:638)
com.google.gson.Gson.toJson(Gson.java:618)
org.jclouds.json.internal.GsonWrapper.toJson(GsonWrapper.java:65)

org.jclouds.oauth.v2.functions.ClaimsToAssertion.apply(ClaimsToAssertion.java:59)

org.jclouds.oauth.v2.functions.ClaimsToAssertion.apply(ClaimsToAssertion.java:43)