summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRoman Shevchenko <roman.shevchenko@jetbrains.com>2014-05-26 20:03:22 +0400
committerRoman Shevchenko <roman.shevchenko@jetbrains.com>2014-05-26 20:03:22 +0400
commitf221cd1c554f42873f4a3b2230d56aaf0bfbbb78 (patch)
tree2ce9090f3ab2dda1db6a1ac419297954613cb0dd /src
parente5a9687c94171f0937113b6cb7280c64c15fd202 (diff)
downloadfernflower-f221cd1c554f42873f4a3b2230d56aaf0bfbbb78.tar
fernflower-f221cd1c554f42873f4a3b2230d56aaf0bfbbb78.tar.gz
fernflower-f221cd1c554f42873f4a3b2230d56aaf0bfbbb78.tar.lz
fernflower-f221cd1c554f42873f4a3b2230d56aaf0bfbbb78.tar.xz
fernflower-f221cd1c554f42873f4a3b2230d56aaf0bfbbb78.zip
single "extends Object" omitted for type parameters (ultimate fix)
- sole "extends Object" ignored - correct decompilation of <T extends I> vs. <T exends Object & I> cases
Diffstat (limited to 'src')
-rw-r--r--src/de/fernflower/main/ClassWriter.java16
-rw-r--r--src/de/fernflower/struct/gen/generics/GenericMain.java4
2 files changed, 10 insertions, 10 deletions
diff --git a/src/de/fernflower/main/ClassWriter.java b/src/de/fernflower/main/ClassWriter.java
index a500fa4..e0684ba 100644
--- a/src/de/fernflower/main/ClassWriter.java
+++ b/src/de/fernflower/main/ClassWriter.java
@@ -411,11 +411,11 @@ public class ClassWriter {
writer.write(descriptor.fparameters.get(i));
List<GenericType> lstBounds = descriptor.fbounds.get(i);
- int skip = InterpreterUtil.equalObjects(VarType.VARTYPE_OBJECT.value, lstBounds.get(0).value) ? 1 : 0;
- if(skip<lstBounds.size()) {
+ if (lstBounds.size() > 1 || !"java/lang/Object".equals(lstBounds.get(0).value)) {
writer.write(" extends ");
- writer.write(GenericMain.getGenericCastTypeName(lstBounds.get(skip)));
- for(int j=skip+1;j<lstBounds.size();j++) {
+ writer.write(GenericMain.getGenericCastTypeName(lstBounds.get(0)));
+
+ for(int j=1;j<lstBounds.size();j++) {
writer.write(" & " + GenericMain.getGenericCastTypeName(lstBounds.get(j)));
}
}
@@ -795,11 +795,11 @@ public class ClassWriter {
bufstrwriter.write(descriptor.fparameters.get(i));
List<GenericType> lstBounds = descriptor.fbounds.get(i);
- int skip = InterpreterUtil.equalObjects(VarType.VARTYPE_OBJECT.value, lstBounds.get(0).value) ? 1 : 0;
- if(skip<lstBounds.size()) {
+ if (lstBounds.size() > 1 || !"java/lang/Object".equals(lstBounds.get(0).value)) {
bufstrwriter.write(" extends ");
- bufstrwriter.write(GenericMain.getGenericCastTypeName(lstBounds.get(skip)));
- for(int j=skip+1;j<lstBounds.size();j++) {
+ bufstrwriter.write(GenericMain.getGenericCastTypeName(lstBounds.get(0)));
+
+ for(int j=1;j<lstBounds.size();j++) {
bufstrwriter.write(" & " + GenericMain.getGenericCastTypeName(lstBounds.get(j)));
}
}
diff --git a/src/de/fernflower/struct/gen/generics/GenericMain.java b/src/de/fernflower/struct/gen/generics/GenericMain.java
index 4a2dab7..cd81683 100644
--- a/src/de/fernflower/struct/gen/generics/GenericMain.java
+++ b/src/de/fernflower/struct/gen/generics/GenericMain.java
@@ -127,8 +127,8 @@ public class GenericMain {
List<GenericType> lstBounds = new ArrayList<GenericType>();
for(;;) {
- if(value.charAt(0) == ':') { // empty superclass
- lstBounds.add(new GenericType(CodeConstants.TYPE_OBJECT, 0, "java/lang/Object"));
+ if(value.charAt(0) == ':') {
+ // empty superclass, skip
value = value.substring(1);
}