Hello Rémi, On Mon, Nov 15, 2010 at 3:08 PM, Rémi Forax <[email protected]> wrote:
> Why you did not use ASM [1] ? > I planned to look at ASM for a long time now, but I didn't have the time. In short, it was faster for me to write a simple classfile parser (given that I already have code lying around that does that) than to learn a new Java library. I agree ASM is much more general, and taking the time to learn its workings may help me in the long run, but I must say I am not a big fan of the visitor pattern. > Or better provide a patch to javap to dump java5 signatures. > That would be desirable too, just that I see two problems: the next Java release is at least a year away, so I'd need to release my tool by some other means anyway. The second is that I prefer to use Scala when it comes to parsing. I must say I don't know how easy it is to contribute to the JDK, so maybe I am overly cautious and the process is simple and fast. thanks for your feedback, iulian > > 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]<jvm-languages%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/jvm-languages?hl=en. > -- « 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.
