Yeah.  I tried that but it gives what you expect:

Class A defined as follows:

package projects.test;
public class A
{
  public boolean y;
  public boolean $z;
}

REPL:

user=> (import '(projects.test A))
projects.test.A
user=> (def m (A.))
#'user/m
user=> (set! (. m y) true)
true
user=> (set! (. m $z) true)
java.lang.IllegalArgumentException: No matching field found:
_DOLLARSIGN_z for class projects.test.A
 (NO_SOURCE_FILE:0)
user=> (def klass (.getClass m))
#'user/klass
user=> (def fields (.getFields klass))
#'user/fields
user=> (.getName (aget fields 0))
"y"
user=> (.getName (aget fields 1))
"$z"
user=>

Just so everyone knows this isn't a trumped up example.  If I can make
this work then I can instantiate JavaFX classes directly without using
JavaFX reflection.  I'm exploring a Clojure cover library for JavaFX.
Incidently, some of you might be interested in this:

http://steveonjava.com/javafx-your-way-building-javafx-applications-with-alternative-languages/

Stephen Chin will presenting a talk at JavaOne about using other JVM
languages to call JavaFX.

On Sep 8, 8:05 pm, Sean Devlin <francoisdev...@gmail.com> wrote:
> Try using reflection to print out what the JVM thinks the field's name
> is.  This might help.
>
> On Sep 8, 1:23 am, Jon Seltzer <seltzer1...@gmail.com> wrote:
>
>
>
> > Suppose you have a class projects.test.A:
>
> > package projects.test;
>
> > public class A
> > {
> >   public A(){super();}
> >   public boolean y;
> >   public boolean $z;
>
> > }
>
> > and I want to use set to update both values:
>
> > user=> (def m (A.))     ; Create a ref m to new instance of A
> > #'user/m
>
> > user=> (set! (. m y) true)     ; No problems updating y.
> > true
>
> > user=> (set! (. m $z) true)
> > java.lang.IllegalArgumentException: No matching field found:
> > _DOLLARSIGN_z for class projects.test.A
> >  (NO_SOURCE_FILE:0)
>
> > Is there a special syntax for handling java members with $'s in their
> > names?- Hide quoted text -
>
> - Show quoted text -

-- 
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