false signatures consistency warning on enums

master
Roman Shevchenko 11 years ago
parent ed04ea2d69
commit 6e303d8592
  1. 31
      src/de/fernflower/main/ClassWriter.java

@ -747,18 +747,6 @@ public class ClassWriter {
bufstrwriter.write("default ");
}
GenericMethodDescriptor descriptor = null;
if(DecompilerContext.getOption(IFernflowerPreferences.DECOMPILE_GENERIC_SIGNATURES)) {
StructGenericSignatureAttribute attr = (StructGenericSignatureAttribute)mt.getAttributes().getWithKey("Signature");
if(attr != null) {
descriptor = GenericMain.parseMethodSignature(attr.getSignature());
if(md.params.length != descriptor.params.size()) {
DecompilerContext.getLogger().writeMessage("Inconsistent generic signature in method "+mt.getName()+" "+mt.getDescriptor(), IFernflowerLogger.WARNING);
descriptor = null;
}
}
}
String name = mt.getName();
if("<init>".equals(name)) {
if(node.type == ClassNode.CLASS_ANONYMOUS) {
@ -773,6 +761,20 @@ public class ClassWriter {
clinit = true;
}
GenericMethodDescriptor descriptor = null;
if(DecompilerContext.getOption(IFernflowerPreferences.DECOMPILE_GENERIC_SIGNATURES)) {
StructGenericSignatureAttribute attr = (StructGenericSignatureAttribute)mt.getAttributes().getWithKey("Signature");
if(attr != null) {
descriptor = GenericMain.parseMethodSignature(attr.getSignature());
int actualParams = md.params.length;
if(isEnum && init) actualParams -= 2;
if(actualParams != descriptor.params.size()) {
DecompilerContext.getLogger().writeMessage("Inconsistent generic signature in method "+mt.getName()+" "+mt.getDescriptor(), IFernflowerLogger.WARNING);
descriptor = null;
}
}
}
boolean throwsExceptions = false;
int param_count_explicit = 0;
@ -830,8 +832,9 @@ public class ClassWriter {
boolean firstpar = true;
int index = isEnum && init ? 3 : thisvar ? 1 : 0;
int start = isEnum && init ? 2 : 0;
for(int i=start;i<md.params.length;i++) {
int start = isEnum && init && descriptor == null ? 2 : 0;
int params = descriptor == null ? md.params.length : descriptor.params.size();
for(int i=start;i<params;i++) {
if(signFields == null || signFields.get(i) == null) {
if(!firstpar) {

Loading…
Cancel
Save