This is the mail archive of the kawa@sources.redhat.com mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Subclasses and protected methods


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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]