<div dir="ltr">Hi Mark,<div><br></div><div>Thanks for pointing out getClass(), I should've thought of that myself...</div><div><br></div><div>And thanks for the JSS information, I'll have a look into that.</div><div><div class="gmail_extra"><br><div class="gmail_quote">On 8 July 2015 at 08:27, Mark Evenson <span dir="ltr"><<a href="mailto:evenson@panix.com" target="_blank">evenson@panix.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
> On 07 Jul 2015, at 22:24, John Pallister <<a href="mailto:john@synchromesh.com">john@synchromesh.com</a>> wrote:<br>
<br>
[…]<br>
<span class=""><br>
> Some of the tutorials have code like:<br>
><br>
>   context.addServlet(HelloServlet.class, "/");<br>
><br>
> Is it possible to get Class objects for Java classes I've made with JNEW-RUNTIME-CLASS (or indeed for any other Java class)?<br>
<br>
</span>Since all Java references to non-primitive types descend from java.lang.Object,<br>
one may always get a reference to the class object by [calling the “getClass()”<br>
method][1].<br>
<br>
[1]: <a href="http://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#getClass--" rel="noreferrer" target="_blank">http://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#getClass--</a><br>
<span class=""><br>
> I've been using "raw" JCLASS & JMETHOD etc. calls to experience just how<br>
> painful that really is, but I'm apprehensive about using JSS and paying the<br>
> runtime dynamic dispatch penalty, given that on GAE time is money. Something<br>
> more like a SLIME plug-in that looked up & cached classes, methods & fields at<br>
> editing time (perhaps also parsing Java expressions) and generated "statically<br>
> typed" code would be nice (possibly using code from e.g. JDEE and/or CEDET) -<br>
> has anyone else thought about this?<br>
<br>
<br>
</span>I wouldn’t necessarily be afraid of the “penalty" for using JSS, or at least, I<br>
might benchmark the difference in performance before shying away from JSS at<br>
the outset.<br>
<br>
JSS [already creates a cache of all classes that on the classpath][2].<br>
JSS:JAVA-CLASS-METHOD-NAMES provides a listing of all methods of a class, which<br>
is not currently cached, but could be.  Extending this to java fields would be<br>
useful.  I would welcome patches to JSS which extends these introspection<br>
facilities as the basis for the tooling you wish to build.<br>
<br>
[2]: <a href="http://abcl.org/trac/browser/trunk/abcl/contrib/jss/invoke.lisp#L299" rel="noreferrer" target="_blank">http://abcl.org/trac/browser/trunk/abcl/contrib/jss/invoke.lisp#L299</a><br>
[3]: <a href="http://abcl.org/trac/browser/trunk/abcl/contrib/jss/invoke.lisp#L469" rel="noreferrer" target="_blank">http://abcl.org/trac/browser/trunk/abcl/contrib/jss/invoke.lisp#L469</a></blockquote></div><br></div></div></div>