[RFC] netx: search for main method in superclasses of the main class

Omair Majid omajid at redhat.com
Thu Aug 5 14:55:30 PDT 2010

On 08/05/2010 10:17 AM, Deepak Bhole wrote:
> * Omair Majid<omajid at redhat.com>  [2010-08-05 09:55]:
>> On 08/05/2010 07:30 AM, Dr Andrew John Hughes wrote:
>>> On 17:46 Wed 04 Aug     , Omair Majid wrote:
>>>> Hi,
>>>> The attached patch makes netx search for the main method in the
>>>> superclasses of the main class. This patch allows JOSM [1] to work with
>>>> Netx.
>>>> Some applications like JOSM declare a main class which does not contain
>>>> a main method - the main method is declared in a superclass instead. The
>>>> tar file attached contains a simple example of such an application. With
>>>> the current version of netx, it throws an exception, saying that the
>>>> main method can not be found. The attached patch moves some the method
>>>> lookup code into a findMainMethod() which also loops through the
>>>> superclasses looking for the main method if it is not found in the
>>>> declared main class.
>>>> Any comments or concerns?
>>>> Cheers,
>>>> Omair
>>>> [1] http://josm.openstreetmap.de/download/josm.jnlp
>>> Using getMethod rather than getDeclaredMethod:
>>> http://download.oracle.com/javase/6/docs/api/java/lang/Class.html#getMethod%28java.lang.String,%20java.lang.Class...%29
>>> would perform the looping over the superclasses and superinterfaces;
>>> 'Let C be the class represented by this object:
>>>     1. C is searched for any matching methods. If no matching method is found, the algorithm of step 1 is invoked recursively on the superclass of C.
>>>     2. If no method was found in step 1 above, the superinterfaces of C are searched for a matching method. If any such method is found, it is reflected.'
>> Thanks, that makes the patch alot simpler :) Attaching the updated patch.
> Hah! :) Approved for commit into 1.7, 1.8 and HEAD.

Pushed as:
changeset e9de4114620e in /hg/icedtea6
changeset c2fdeca9dbb7 in /hg/release/icedtea6-1.8
changeset c5c7cfebb101 in /hg/release/icedtea6-1.7


More information about the distro-pkg-dev mailing list