Hi,
I'm trying to create a class, instances of which need to access protected
fields of the superclass's superclass. But, I am failing so far. Is this a
bug or am I doing something wrong:
java:
package com.example;
public class Example {
protected static String PROTECTED_FIELD = "this is a field";
public void asdf() { }
}
clojure:
(ns test.example
(:import (com.example Example)))
(gen-class
:name test.Example
:extends com.example.Example
:main false
:exposes {PROTECTED_FIELD {:get getProtectedField :set setProtectedField}}
:methods [[fieldInfo [] void]])
(defn -fieldInfo [this]
(println (.getProtectedField this)))
java:
Example e = new Example();
e.fieldInfo();
results in:
Exception in thread "main" java.lang.IllegalArgumentException: No matching
field found: getProtectedField for class test.Example
at clojure.lang.Reflector.getInstanceField(Reflector.java:271)
at clojure.lang.Reflector.invokeNoArgInstanceMember(Reflector.java:300)
at test.example$_fieldInfo.invoke(example.clj:16)
at test.Example.fieldInfo(Unknown Source)
at tests.Tests.main(Tests.java:47)
Oddly also, this:
System.out.println(e.getProtectedField());
prints the field.
I've tried numerous variations on this.
Do you have any ideas before I file a bug? (aside from make a wrapper
class).
--
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