-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix #116 : Java 16 support for ReflectionUtils #123
Fix #116 : Java 16 support for ReflectionUtils #123
Conversation
cad7c2a
to
0fbb275
Compare
@@ -218,6 +219,14 @@ private static void gatherVariablesAndValuesIncludingSuperclasses( Object object | |||
|
|||
Class<?> clazz = object.getClass(); | |||
|
|||
if ( Integer.parseInt( System.getProperty( "java.specification.version" ).split( "\\." )[0] ) >= 11 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't we have anything better in place here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't we have anything better in place here?
Float.parseFloat( System.getProperty( "java.specification.version" ) )
But Runtime.Version
(doc) cannot be used, exist since Java 9 (plexus-utils
always compatible with Java 7). And without adding some third-part tooling as dependencies, I don't see another way 😢.
I will update commit with Float instead Integer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will update commit with Float instead Integer.
Done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@michael-o : Or did you want a better implementation around System.getProperty( "java.specification.version" )
if value is null/blanck/notParsable ?
0fbb275
to
0fa66d5
Compare
Is this PR not relevant ? 😢 |
@@ -1,5 +1,7 @@ | |||
package org.codehaus.plexus.util; | |||
|
|||
import java.lang.reflect.AccessibleObject; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure why this import has been moved here?
I guess we do not have much choice.. |
No opinion, go ahead. |
@axel3rd yes it is still relevant. Just please fix the import and we're good to go! Thanks |
…va 11 no warning)
0fa66d5
to
4e4c88a
Compare
Good catch for the import 😕, done. |
Proposal for #116. It is more a workaround, could break backward compatibility.
If updating fields accessibility becomes really forbidden in Java 16 for "Class", the usage of Reflection should be updated according that.
Functionally, the impact would be minor. Generally the usage of Reflection is on "personal / business" classes, not for concrete use case directly on "Class".