Uploaded image for project: 'WildFly'
  1. WildFly
  2. WFLY-2493

EL cannot access public methods/fields of non-public classes

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • 8.1.0.CR1, 8.1.0.Final
    • JBoss AS7 7.2.0.Final
    • JSF
    • None

    Description

      When trying to access public method/field of non-public class that implements public interface via EL I get

      java.lang.IllegalAccessException: Class javax.el.BeanELResolver can not access a member of class X with modifiers "private"
      

      E.g. accessing Collections.unmodifiableList(..).size() via EL will throw the exception, because #unmodifiableList returns non-public implementation of List interface.
      This is apparently caused by JDK-4071957 [1], but since that is opened for over 16 years, it should be probably worth it to implement a workaround.
      Workaround for this issue is setting setAccessible(true) on the method before invoking it, thus suppress Java access checking.

      I have attached a simple reproducer app as well as a stack trace of the exception.

      [1] http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4071957

      Attachments

        Activity

          People

            Unassigned Unassigned
            rhn-support-jtrantin Jonáš Trantina (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: