Storyyeller / Krakatau

Java decompiler, assembler, and disassembler
GNU General Public License v3.0
1.95k stars 220 forks source link

.signature does not support wildcards or upper/lower bounds #89

Closed toddATavail closed 8 years ago

toddATavail commented 8 years ago

Either the .signature directive does not support wildcards and upper/lower bounds or it uses non-standard syntax. A specific case that I want to work is:

Ljava/util/Set<Lcom/mcp/hammurabi/StateVariable<*>;>;

It produces this error:

assemble.py  C_Age.j
Krakatau  Copyright (C) 2012-16  Robert Grosse
This program is provided as open source under the GNU General Public License.
See LICENSE.TXT for more details.

Processing file C_Age.j, 1/1 remaining
C_Age.j:9:16: error: Unexpected token
    .signature Ljava/util/Set<Lcom/mcp/hammurabi/StateVariable<*>;>;
               ^                                                     
Total time 0.00103116035461

I have verified that it is actually objecting to the <*> syntax. If I remove it, then Krakatau happily produces a class file.

I have also verified that upper and lower bounds do not working using the JVM's + and - syntax. Here are the signatures of contrived summation methods that do not work:

(Ljava/util/Set<+Ljava/lang/Integer;>;)I (Ljava/util/Set<-Ljava/lang/Integer;>;)I

Krakatau rejects both of these with a similar error (Unexpected token). Again, I have verified that if I remove the +/-, then Krakatau happily produces a class file.

I can live without these features working for the time being, but it would certainly be nice to have proper support, as it will provide better interoperation with JVM tools.

Storyyeller commented 8 years ago

If you want to use special characters like that, you have to enclose it in quotes.

Look at the requirements for "word" here: https://github.com/Storyyeller/Krakatau/blob/master/Documentation/assembler.txt

Storyyeller commented 8 years ago

I changed the assembler syntax so you can now specify these signature values without using quotes. Try it and tell me what you think.

toddATavail commented 8 years ago

Very nice, thank you! I have verified that it works for my use cases.