I found the following work-around since I have access to the java code I am
calling:
I had the package-visible ABC Bytes implement a (public) interface
declaring the toHexString method. This placated the compiler.
On Monday, March 4, 2013, Vladimir Tsichevski wrote:
> I think not. But upgrading to clojure 1.5 will do.
>
> On Friday, March 1, 2013 1:20:57 PM UTC+4, Marko Topolnik wrote:
>>
>> I'd say it's a bug. You are invoking a public class's method, which
>> happens to be inherited from a package-private class. Clojure's reflective
>> code accesses the superclass method directly so there's no distinction
>> between direct invocation and invocation through inheritance.
>>
>> If you are interseted in a workaround, type-hinting the code will work
>> (my guess).
>>
>> On Friday, March 1, 2013 10:13:57 AM UTC+1, bsmith.occs wrote:
>>>
>>> Simplified, from a more complex example:
>>>
>>> abstract class Bytes {
>>> public toHexString() { return "..."; }
>>> Bytes { }
>>> }
>>>
>>> public class Hash extends Bytes {
>>> public Hash() { super(); }
>>> }
>>>
>>> This works in Java:
>>>
>>> new Hash().toHexString();
>>>
>>> This fails in Clojure:
>>>
>>> (.toHexString (Hash.))
>>>
>>> IllegalArgumentException Can't call public method of non-public class:
>>> public final java.lang.String at.gv.brz.bjuvj.hashpass.**Bytes.toHexString()
>>> clojure.lang.Reflector.**invokeMatchingMethod (Reflector.java:88)
>>>
>>> Bug?
>>>
>>> // ben
>>>
>> --
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to
> [email protected]<javascript:_e({}, 'cvml',
> '[email protected]');>
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> [email protected] <javascript:_e({}, 'cvml',
> 'clojure%[email protected]');>
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected] <javascript:_e({}, 'cvml',
> 'clojure%[email protected]');>.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>
--
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.