Why you did not use ASM [1] ?
Or better provide a patch to javap to dump java5 signatures.

Rémi
[1] http://asm.ow2.org/


Le 15/11/2010 14:59, iulian dragos a écrit :
Did you ever want to dump Java 5 signatures from existing classfiles? Did you ever want to find duplicate methods/fields in a classfile?

Probably not, but for those 2 other people who want to do that, I wrote this awesome tool:

dupcheck [-d|-p] /path/to/Foo.class

-d Find duplicate methods/fields
-p Print raw information in classfiles (member descriptors and Java 5 signatures).

It saved me a lot of time when chasing pesky bugs like #3973 <http://lampsvn.epfl.ch/trac/scala/ticket/3973>, #3828 <http://lampsvn.epfl.ch/trac/scala/ticket/3973>, #2754 <http://lampsvn.epfl.ch/trac/scala/ticket/2754>, especially when they're regressions (the exit code is non-zero when duplicates are found, so it can work with git bisect). It always annoyed me that javap does not understand 'Signature' attributes, so I added the functionality to look at them.

Here's how it looks:

dra...@dragos-imac scala (master) $ dupcheck -p build/quick/classes/library/scala/Function1.class class scala.Function1 extends java.lang.Object with scala.ScalaObject { <T1:Ljava/lang/Object;R:Ljava/lang/Object;>Ljava/lang/Object;Lscala/ScalaObject;


  public abstract def apply: (Ljava.lang.Object;)Ljava.lang.Object;
(TT1;)TR;
  public abstract def toString: ()Ljava.lang.String;
  public abstract def compose: (Lscala.Function1;)Lscala.Function1;
<A:Ljava/lang/Object;>(Lscala/Function1<TA;TT1;>;)Lscala/Function1<TA;TR;>;
  public abstract def andThen: (Lscala.Function1;)Lscala.Function1;
<A:Ljava/lang/Object;>(Lscala/Function1<TR;TA;>;)Lscala/Function1<TT1;TA;>;
public abstract def unlift: (Lscala.Predef$$less$colon$less;)Lscala.PartialFunction;
<R1:Ljava/lang/Object;>(Lscala/Predef$$less$colon$less<TR;Lscala/Option<TR1;>;>;)Lscala/PartialFunction<TT1;TR1;>;
  public abstract def apply$mcVI$sp: (I)V
..

I know it can be improved tremendously, so I put it up on github. You can check it out or download pre-built binaries at https://github.com/dragos/dupcheck.

One idea was to add a parser for Java 5 signatures and beautify them (right now they are printed as raw strings). Then support for EnclosingMethod and InnerClasses.

iulian


--
« Je déteste la montagne, ça cache le paysage »
Alphonse Allais

--
« Je déteste la montagne, ça cache le paysage »
Alphonse Allais
--
You received this message because you are subscribed to the Google Groups "JVM Languages" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/jvm-languages?hl=en.

--
You received this message because you are subscribed to the Google Groups "JVM 
Languages" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/jvm-languages?hl=en.

Reply via email to