summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoman Shevchenko <roman.shevchenko@jetbrains.com>2014-06-25 12:40:11 +0200
committerRoman Shevchenko <roman.shevchenko@jetbrains.com>2014-06-25 12:40:11 +0200
commit6e303d859231a57051ffff8fc25be72e79ff0d26 (patch)
tree167c3bd4db5bfe3612fe7cc6db4a239322f7902f
parented04ea2d690ccc161c13c8e6336f3ee5c2c50e08 (diff)
downloadfernflower-6e303d859231a57051ffff8fc25be72e79ff0d26.tar
fernflower-6e303d859231a57051ffff8fc25be72e79ff0d26.tar.gz
fernflower-6e303d859231a57051ffff8fc25be72e79ff0d26.tar.lz
fernflower-6e303d859231a57051ffff8fc25be72e79ff0d26.tar.xz
fernflower-6e303d859231a57051ffff8fc25be72e79ff0d26.zip
false signatures consistency warning on enums
-rw-r--r--src/de/fernflower/main/ClassWriter.java39
1 files changed, 21 insertions, 18 deletions
diff --git a/src/de/fernflower/main/ClassWriter.java b/src/de/fernflower/main/ClassWriter.java
index eec8611..72dcf97 100644
--- a/src/de/fernflower/main/ClassWriter.java
+++ b/src/de/fernflower/main/ClassWriter.java
@@ -747,32 +747,34 @@ public class ClassWriter {
bufstrwriter.write("default ");
}
+ String name = mt.getName();
+ if("<init>".equals(name)) {
+ if(node.type == ClassNode.CLASS_ANONYMOUS) {
+ name = "";
+ dinit = true;
+ } else {
+ name = node.simpleName;
+ init = true;
+ }
+ } else if("<clinit>".equals(name)) {
+ name = "";
+ 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());
- if(md.params.length != descriptor.params.size()) {
+ 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;
}
}
}
- String name = mt.getName();
- if("<init>".equals(name)) {
- if(node.type == ClassNode.CLASS_ANONYMOUS) {
- name = "";
- dinit = true;
- } else {
- name = node.simpleName;
- init = true;
- }
- } else if("<clinit>".equals(name)) {
- name = "";
- clinit = true;
- }
-
boolean throwsExceptions = false;
int param_count_explicit = 0;
@@ -780,7 +782,7 @@ public class ClassWriter {
if(!clinit && !dinit) {
boolean thisvar = (mt.getAccessFlags() & CodeConstants.ACC_STATIC) == 0;
-
+
// formal type parameters
if(descriptor != null && !descriptor.fparameters.isEmpty()) {
bufstrwriter.write("<");
@@ -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) {