Calling Inner Class

Per Bothner per@bothner.com
Thu May 7 16:49:14 GMT 2020


On 5/7/20 8:06 AM, Andy Zhang via Kawa wrote:
> If I were to call a non-static inner class from a Java outer class in kawa, what would the syntax look like? I have tried
> (outerclass-instance:innerclass args)

That looks like the correct syntax.


> but this gives me the error
> 
> class gnu.bytecode.ClassType cannot be cast to class gnu.expr.PairClassType (gnu.bytecode.ClassType and gnu.expr.PairClassType are in unnamed module of loader 'app')

It is possible this isn't supported.  However, the reference to PairClassType suggests
"pair class" is either being generated or expected.  A "pair class" is a pair
of a class and an interface used to implement true multiple inheritance.

See the inetrface: property in:
https://www.gnu.org/software/kawa/Defining-new-classes.html

If you're using define-class you might try using define-simple-class or
explicitly setting the "interface:" class property.

It is also possible Kawa is confused in expecting a PairClassType.
-- 
	--Per Bothner
per@bothner.com   http://per.bothner.com/


More information about the Kawa mailing list