[jira] [Updated] (LANG-613) ConstructorUtils.getAccessibleConstructor() Does Not Check the Accessibility of Enclosing Classes

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Updated] (LANG-613) ConstructorUtils.getAccessibleConstructor() Does Not Check the Accessibility of Enclosing Classes

Alex D Herbert (Jira)

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

Ben Tels updated LANG-613:
--------------------------

    Attachment: LANG-613_Recursive_visibility_check_up_the_enclosing_tree.patch

I've uploaded a patch with a check that a constructor is either:
- For a normal, top-level class; or
- for an inner class that is a public, top-level class enclosed in a (set of) classes such that it is still visible.

For the visibility rule I have maintained the existing rule in ConstructorUtils that "visible" means "public". However, that is not quite correct in reality -- a constructor of an inner class can still be visible if it is contained within a class with default or protected visibility and the accessing code is in the right package. I'll leave the code this way as long as the Commons-Lang team does not decide to change the definition used.

> ConstructorUtils.getAccessibleConstructor() Does Not Check the Accessibility of Enclosing Classes
> -------------------------------------------------------------------------------------------------
>
>                 Key: LANG-613
>                 URL: https://issues.apache.org/jira/browse/LANG-613
>             Project: Commons Lang
>          Issue Type: Bug
>          Components: lang.reflect.*
>    Affects Versions: 3.0
>            Reporter: David M. Sledge
>            Priority: Minor
>             Fix For: 3.x
>
>         Attachments: LANG-613_Recursive_visibility_check_up_the_enclosing_tree.patch
>
>
> ConstructorUtils.getAccessibleConstructor() checks if the declaring class is public but not whether it's a top-level class or an enclosed one.  Consequently, with enclosed declaring classes, the method does not check if the enclosing class is public, or it's enclosing class, or it's enclosing class, etc...

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira