commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gary Gregory (JIRA)" <j...@apache.org>
Subject [jira] Created: (POOL-124) Access to enclosing constructor Foo.Bar() is emulated by a synthetic accessor method. Increasing its visibility will improve your performance.
Date Tue, 12 Feb 2008 15:49:08 GMT
Access to enclosing constructor Foo.Bar() is emulated by a synthetic accessor method. Increasing
its visibility will improve your performance.
----------------------------------------------------------------------------------------------------------------------------------------------

                 Key: POOL-124
                 URL: https://issues.apache.org/jira/browse/POOL-124
             Project: Commons Pool
          Issue Type: Improvement
    Affects Versions: 1.4
         Environment: Eclipse Compiler 3.3M5.
            Reporter: Gary Gregory
             Fix For: 2.0


Fix compiler warnings like: 
{quote}
Access to enclosing constructor GenericKeyedObjectPool.ObjectQueue() is emulated by a synthetic
accessor method. Increasing its visibility will improve your performance."
{quote}

By definition, when a class element is private, it cannot be seen from outside the scope of
the type that defines it. The compiler treats inner classes with some special processing though.

Here is Olivier Thomann's explanation [1]:

"You get this warning as soon as you access a private member (fields or
methods) of the enclosing class inside an inner class (anonymous, local or member classes).

The compiler uses a static access method to access the private member in order to workaround
the VM access violation. You cannot access directly a private member from another class. From
the VM point of view, an inner class is a different class and has no relation with its enclosing
class.

So doing this access to a private member you pay the price of a method invocation each time
you access the member at runtime. This is not the case if the member is package visible."

Gary

[1] http://dev.eclipse.org/mhonarc/lists/jdt-dev/msg00145.html


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message