Create instance of generic class at runtime, supplying specializer?
alanruttenberg at gmail.com
Tue Jul 21 15:04:54 UTC 2020
So I need to subclass first, and then instantiate that new class? Can I to
do that with the provided support? I've used jnew-runtime-class
jnew-runtime-class (class-name super-name interfaces constructors methods
fields &optional filename)
Not sure how I would provide the specializing class(es) here. The type
information may be "erased" but methods can still differ by specialization,
For JSS syntax I would probably just accept a list class argument to new.
(new '(InferredObjectPropertyAxiomGenerator OWLObjectSubPropertyAxiom) ...)
Presumably keep a cache of the created subclasses indexed by that list.
It would be nice to be able to find by reflection that
InferredObjectPropertyAxiomGenerator is a generic and how many class
arguments there are.
On Tue, Jul 21, 2020 at 7:06 AM Alessio Stalla <alessiostalla at gmail.com>
> Oh, the class is abstract, so you're meant to provide A by subclassing it,
> not by instantiating. In that case, the value of A *is* retained at runtime
> and is available for reflection, even if method signatures are still erased
> to Object.
> In ABCL there used to be some runtime-class machinery that was just a
> sketch... I don't know if it's still there and has enough plumbing to allow
> you to subclass a generic class providing type specifiers.
> On Mon, 20 Jul 2020 at 18:49, Mark Evenson <evenson at panix.com> wrote:
>> > On Jul 16, 2020, at 04:30, Alan Ruttenberg <alanruttenberg at gmail.com>
>> > For instance in
>> > It says:
>> > Type Parameters:
>> > A - the axiom type
>> > Question is: how do I supply the axiom type when creating an instance.
>> Can you point me to some code that does the setup? Somewhere in lsw2?
>> Alessio is correct that the compiler erases types, but I have sucessfully
>> created instances that switch such methods over the years working on
>> so I should be able to get this to work for you. Unfortunately the
>> margin is
>> too small to contain a proof of this statement without further annotation…
>> "A screaming comes across the sky. It has happened before but there is
>> to compare to it now."
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the armedbear-devel