This is using a sledgehammer to drive in a nail, but you can use
java.lang.reflect.Method.setAccessible (http://java.sun.com/javase/7/
docs/api/java/lang/reflect/AccessibleObject.html#setAccessible
%28boolean%29) to make an otherwise protected method available for
public access.  It's a sledgehammer in the sense that it gives
*everyone* public access.

Bill Smith
Austin, TX

On Jan 24, 3:53 pm, "Steven E. Harris" <s...@panix.com> wrote:
> The documentation for the `proxy' macro mentions lack of access in the
> defined implementation to protected members:
>
> ,----[ proxy ]
> | Note that while method fns can be provided to override protected
> | methods, they have no other access to protected members, nor to super,
> | as these capabilities cannot be proxied.
> `----
>
> I just tried to define a proxy that overrides a protected method in the
> base class, and within that overridden method body attempts to call on
> some other protected method. It fails, reporting
>
> ,----[ IllegalArgumentException message prefix ]
> | No matching field found
> `----
>
> That confirms the warning in the documentation.
>
> Is there any other way within Clojure to define a class that does have
> access to the protected methods of its base class? My motivating
> example: Writing an AbstractQueuedSynchronizer implementation, which
> involves a lot of interplay among overridden protected methods and
> calling on protected methods.
>
> --
> Steven E. Harris

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to