This is the mail archive of the
kawa@sources.redhat.com
mailing list for the Kawa project.
Re: Subclasses and protected methods
- From: Per Bothner <per at bothner dot com>
- To: Adam Warner <lists at consulting dot net dot nz>
- Cc: Kawa Mailing List <kawa at sources dot redhat dot com>
- Date: Mon, 03 May 2004 12:00:58 -0700
- Subject: Re: Subclasses and protected methods
- References: <1083591572.13063.43.camel@work.consulting.net.nz>
Adam Warner wrote:
A java.lang.NoSuchMethodException for
org.eclipse.jface.window.ApplicationWindow.addStatusLine() is thrown
because addStatusLine is a protected method. I may only access it within
a subclass of ApplicationWindow.
Have you tried the latest version of Kawa in CVS? It should have better
support for calling (and defining) protected methods.
A second complication is that addStatusLine should be constructed at the
time of initialising the window ("This method must be called before this
window's shell is created") and I have learned that Kawa doesn't support
constructor syntax in define-simple-class.
There isn't support for passing parameters to constructors (including
superclass constructors), but there is a mechanism to evaluate
expressions at object constructor time. See this example in the
CVS version of the Kawa manual:
(define-simple-class <my-class> ()
(allocation: 'class
init: (perform-actions-when-the-class-is-initizalized))
(x init: 10)
(init: (if (some-condition) (set! x (* x 2)))))
--
--Per Bothner
per@bothner.com http://per.bothner.com/