Re: Can't call public method of non-public class

2010-03-25 Thread Mark J. Reed
That's the one. But the solution given by the bug reporter doesn't address the case that came up on this thread, since it's not the class of the invocant but the types of the parameters that prevent the match from being found. On Thu, Mar 25, 2010 at 7:06 AM, atucker wrote: > Is this it? > http:

Re: Can't call public method of non-public class

2010-03-25 Thread atucker
Is this it? http://www.assembla.com/spaces/clojure/tickets/259 On Mar 23, 8:26 pm, "Mark J. Reed" wrote: > As far as I can tell, you're doing nothing wrong and just hitting a > bug in Clojure.  Which is still in 1.2.0-master... > > > > On Tue, Mar 23, 2010 at 11:43 AM, Konstantin Barskiy > wrot

Re: Can't call public method of non-public class

2010-03-24 Thread Armando Blancas
You probably can't. I think hints only go in binding declarations. I'd use 'env', as you're probably doing already. But let's keep an eye on Mark's patch, as it'd be much better to avoid an explicit upcasting. On Mar 23, 7:38 pm, Konstantin Barskiy wrote: > Thanks a lot! > > Is there way to do th

Re: Can't call public method of non-public class

2010-03-24 Thread Konstantin Barskiy
Thanks a lot! Is there way to do the same thing using 'doto'? e.g. (doto (.environment pb) (.put "Var1" "myValue")) I can't figure out where to place #^Map hint... On Mar 24, 5:19 am, Armando Blancas wrote: > You want Clojure to treat 'env' as a Map instead of its implementation > class, which

Re: Can't call public method of non-public class

2010-03-24 Thread Mark J. Reed
As far as I can tell, you're doing nothing wrong and just hitting a bug in Clojure. Which is still in 1.2.0-master... On Tue, Mar 23, 2010 at 11:43 AM, Konstantin Barskiy wrote: > I'm trying to reproduce ProcessBuilder example from java documentation > http://java.sun.com/javase/6/docs/api/java/

Re: Can't call public method of non-public class

2010-03-24 Thread Mark J. Reed
This looks like the old type erasure problem - the returned map is of a private class, so clojure looks for a public version of the "put" method in one of the interfaces/base classes - but does an exact comparison on parameter types, so put(String, String) doesn't match put(Object, Object) and the

Re: Can't call public method of non-public class

2010-03-24 Thread Mark J. Reed
On Tue, Mar 23, 2010 at 7:38 PM, Stuart Campbell wrote: > From JDK docs > (http://java.sun.com/j2se/1.5.0/docs/api/java/lang/ProcessBuilder.html#environment%28%29): > >> The behavior of the returned map is system-dependent. A system may not >> allow modifications to environment variables or may fo

Re: Can't call public method of non-public class

2010-03-23 Thread Stuart Campbell
Whoops... I completely glazed over the fact that the equivalent Java code worked perfectly :( On 24 March 2010 11:19, Armando Blancas wrote: > You want Clojure to treat 'env' as a Map instead of its implementation > class, which is not public. Just add the type hint #^Map to 'env''s > def: > > u

Re: Can't call public method of non-public class

2010-03-23 Thread Armando Blancas
You want Clojure to treat 'env' as a Map instead of its implementation class, which is not public. Just add the type hint #^Map to 'env''s def: user=> (def pb (new ProcessBuilder ["myCommand" "myArg"])) #'user/pb user=> (def #^Map env (.environment pb)) #'user/env user=> (.put env "VAR1", "myValue

Re: Can't call public method of non-public class

2010-03-23 Thread Stuart Campbell
Hi Konstantin, >From JDK docs ( http://java.sun.com/j2se/1.5.0/docs/api/java/lang/ProcessBuilder.html#environment%28%29 ): The behavior of the returned map is system-dependent. A system may not allow > modifications to environment variables or may forbid certain variable names > or values. For th