You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Brian Schack (JIRA)" <ji...@apache.org> on 2018/03/02 21:23:00 UTC

[jira] [Updated] (LANG-1383) Illegal Reflective Access Operation

     [ https://issues.apache.org/jira/browse/LANG-1383?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Brian Schack updated LANG-1383:
-------------------------------
    Description: 
ReflectionToStringBuilder::toString prints an illegal access warning to System.err. The warning suggests to report this issue to the Apache Commons maintainers.

Boolean.TRUE is such a simple value that I don't really need ReflectionToStringBuilder. But more complex types (such as HashMap) print the same warning. I chose Boolean.TRUE in order to simplify this example.

When I searched for this warning message, I found a StackOverflow answer which suggested to report it to the package maintainers ([JDK9: An illegal reflective access operation has occurred. org.python.core.PySystemState|https://stackoverflow.com/questions/46230413/jdk9-an-illegal-reflective-access-operation-has-occurred-org-python-core-pysys/46230678]).

I also asked my own StackOverflow question about how to throw an exception for this warning ([How can I throw an exception for an illegal reflective access warning?|https://stackoverflow.com/questions/49076972/how-can-i-throw-an-exception-for-an-illegal-reflective-access-warning]).

I will try to change my code to avoid this warning, but it also seems that Apache Commons should not cause the warning. Perhaps it could use different methods to get the values of the fields, or skip the private fields, or throw an exception? The warning message suggests that the Java maintainers want the Apache Commons maintainers to avoid this warning. And when they disable this illegal access in the future, then it could impact Apache Commons.

Code:

{{import org.apache.commons.lang3.builder.*;}}
 {{class Test {}}

{{public static void main(String[] args) {}}

{{System.out.println(ReflectionToStringBuilder.toString(Boolean.TRUE));}}

{{}}}

{{}}}

Output:

{{WARNING: An illegal reflective access operation has occurred}}
 {{ WARNING: Illegal reflective access by org.apache.commons.lang3.builder.ReflectionToStringBuilder ([file:/Users/brianschack/eclipse-workspace/User%20Libraries/com|file:///Users/brianschack/eclipse-workspace/User%20Libraries/com]}}
 \{{ mons-lang3-3.7/commons-lang3-3.7.jar) to field java.lang.Boolean.value}}
 \{{ WARNING: Please consider reporting this to the maintainers of org.apache.commons.lang3.builder.ReflectionToStringBuilder}}
 \{{ 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}}

  was:
ReflectionToStringBuilder::toString prints an illegal access warning to System.err. The warning suggests to report this issue to the Apache Commons maintainers.

Boolean.TRUE is such a simple value that I don't really need ReflectionToStringBuilder. But more complex types (such as HashMap) print the same warning. I chose Boolean.TRUE in order to simplify this example.

When I searched for this warning message, I found a StackOverflow answer which suggested to report it to the package maintainers ([JDK9: An illegal reflective access operation has occurred. org.python.core.PySystemState|https://stackoverflow.com/questions/46230413/jdk9-an-illegal-reflective-access-operation-has-occurred-org-python-core-pysys/46230678]).

I also asked my own StackOverflow question about how to throw an exception for this warning ([How can I throw an exception for an illegal reflective access warning?|https://stackoverflow.com/questions/49076972/how-can-i-throw-an-exception-for-an-illegal-reflective-access-warning]).
{{}}

I will try to change my code to avoid this warning, but it also seems that Apache Commons should not cause the warning. Perhaps it could use different methods to get the values of the fields, or skip the private fields, or throw an exception? The warning message suggests that the Java maintainers want the Apache Commons maintainers to avoid this warning. And when they disable this illegal access in the future, then it could impact Apache Commons.

Code:

{{import org.apache.commons.lang3.builder.*;}}
{{class Test {}}

{{public static void main(String[] args) {}}

{{System.out.println(ReflectionToStringBuilder.toString(Boolean.TRUE));}}

{{}}}

{{}}}

Output:

{{WARNING: An illegal reflective access operation has occurred}}
{{ WARNING: Illegal reflective access by org.apache.commons.lang3.builder.ReflectionToStringBuilder ([file:/Users/brianschack/eclipse-workspace/User%20Libraries/com|file:///Users/brianschack/eclipse-workspace/User%20Libraries/com]}}
{{ mons-lang3-3.7/commons-lang3-3.7.jar) to field java.lang.Boolean.value}}
{{ WARNING: Please consider reporting this to the maintainers of org.apache.commons.lang3.builder.ReflectionToStringBuilder}}
{{ 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}}


> Illegal Reflective Access Operation
> -----------------------------------
>
>                 Key: LANG-1383
>                 URL: https://issues.apache.org/jira/browse/LANG-1383
>             Project: Commons Lang
>          Issue Type: Bug
>          Components: lang.builder.*
>    Affects Versions: 3.7
>            Reporter: Brian Schack
>            Priority: Major
>         Attachments: Test.java
>
>
> ReflectionToStringBuilder::toString prints an illegal access warning to System.err. The warning suggests to report this issue to the Apache Commons maintainers.
> Boolean.TRUE is such a simple value that I don't really need ReflectionToStringBuilder. But more complex types (such as HashMap) print the same warning. I chose Boolean.TRUE in order to simplify this example.
> When I searched for this warning message, I found a StackOverflow answer which suggested to report it to the package maintainers ([JDK9: An illegal reflective access operation has occurred. org.python.core.PySystemState|https://stackoverflow.com/questions/46230413/jdk9-an-illegal-reflective-access-operation-has-occurred-org-python-core-pysys/46230678]).
> I also asked my own StackOverflow question about how to throw an exception for this warning ([How can I throw an exception for an illegal reflective access warning?|https://stackoverflow.com/questions/49076972/how-can-i-throw-an-exception-for-an-illegal-reflective-access-warning]).
> I will try to change my code to avoid this warning, but it also seems that Apache Commons should not cause the warning. Perhaps it could use different methods to get the values of the fields, or skip the private fields, or throw an exception? The warning message suggests that the Java maintainers want the Apache Commons maintainers to avoid this warning. And when they disable this illegal access in the future, then it could impact Apache Commons.
> Code:
> {{import org.apache.commons.lang3.builder.*;}}
>  {{class Test {}}
> {{public static void main(String[] args) {}}
> {{System.out.println(ReflectionToStringBuilder.toString(Boolean.TRUE));}}
> {{}}}
> {{}}}
> Output:
> {{WARNING: An illegal reflective access operation has occurred}}
>  {{ WARNING: Illegal reflective access by org.apache.commons.lang3.builder.ReflectionToStringBuilder ([file:/Users/brianschack/eclipse-workspace/User%20Libraries/com|file:///Users/brianschack/eclipse-workspace/User%20Libraries/com]}}
>  \{{ mons-lang3-3.7/commons-lang3-3.7.jar) to field java.lang.Boolean.value}}
>  \{{ WARNING: Please consider reporting this to the maintainers of org.apache.commons.lang3.builder.ReflectionToStringBuilder}}
>  \{{ 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}}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)