japitools-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Fw: [Japi] stacktraces running japitools on harmony


From: Jeroen Frijters
Subject: RE: Fw: [Japi] stacktraces running japitools on harmony
Date: Thu, 16 Nov 2006 08:09:33 +0100

Stuart Ballard wrote:
> On 11/15/06, Stuart Ballard <address@hidden> wrote:
> > This does indeed look like a Japi bug. I don't have time to diagnose
> > it completely but it definitely seems that what Japitools 
> is claiming
> > - that the constructor doesn't have a BasicSwingTestCase parameter -
> > is outright false.
> 
> I did look further but I'm still stumped so I'm going to have to call
> in the heavy artillery.
> 
> Jeroen, help?
> 
> The error message is coming from the code I added a while back in
> ClassFile.MethodInfoItem.getParameterTypes().
> 
> As far as I can see the parameterTypes field for the
> ExceptionalCase(String, Class<?>) constructor is coming back without a
> BasicSwingTestCase parameter, but javap is very clear that it does in
> fact have one.

Oh man, this is lame. Check this out:

import java.lang.reflect.*;

public class test {
  public class inner {
    public inner(Class<?> c) {}
  }

  public static void main(String[] args) throws Exception {
    Constructor con = inner.class.getConstructor(test.class,
Class.class);

    System.out.println("Parameter types:");
    for (Object obj : con.getParameterTypes()) System.out.println(obj);

    System.out.println("Generic parameter types:");
    for (Object obj : con.getGenericParameterTypes())
System.out.println(obj);
  }
}

The generic signature does not include the implicit first parameter, so
it is indeed a Japi bug, because I assumed that the Signature attribute
would always match with the real method signature. I guess the easiest
fix would be to add the first parameter type from the real signature, if
the real signature contains an additional element.

Regards,
Jeroen




reply via email to

[Prev in Thread] Current Thread [Next in Thread]