mirror of
https://github.com/moparisthebest/fernflower
synced 2024-11-27 03:32:14 -05:00
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
This commit is contained in:
parent
e5a9687c94
commit
f221cd1c55
@ -411,11 +411,11 @@ public class ClassWriter {
|
|||||||
writer.write(descriptor.fparameters.get(i));
|
writer.write(descriptor.fparameters.get(i));
|
||||||
|
|
||||||
List<GenericType> lstBounds = descriptor.fbounds.get(i);
|
List<GenericType> lstBounds = descriptor.fbounds.get(i);
|
||||||
int skip = InterpreterUtil.equalObjects(VarType.VARTYPE_OBJECT.value, lstBounds.get(0).value) ? 1 : 0;
|
if (lstBounds.size() > 1 || !"java/lang/Object".equals(lstBounds.get(0).value)) {
|
||||||
if(skip<lstBounds.size()) {
|
|
||||||
writer.write(" extends ");
|
writer.write(" extends ");
|
||||||
writer.write(GenericMain.getGenericCastTypeName(lstBounds.get(skip)));
|
writer.write(GenericMain.getGenericCastTypeName(lstBounds.get(0)));
|
||||||
for(int j=skip+1;j<lstBounds.size();j++) {
|
|
||||||
|
for(int j=1;j<lstBounds.size();j++) {
|
||||||
writer.write(" & " + GenericMain.getGenericCastTypeName(lstBounds.get(j)));
|
writer.write(" & " + GenericMain.getGenericCastTypeName(lstBounds.get(j)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -795,11 +795,11 @@ public class ClassWriter {
|
|||||||
bufstrwriter.write(descriptor.fparameters.get(i));
|
bufstrwriter.write(descriptor.fparameters.get(i));
|
||||||
|
|
||||||
List<GenericType> lstBounds = descriptor.fbounds.get(i);
|
List<GenericType> lstBounds = descriptor.fbounds.get(i);
|
||||||
int skip = InterpreterUtil.equalObjects(VarType.VARTYPE_OBJECT.value, lstBounds.get(0).value) ? 1 : 0;
|
if (lstBounds.size() > 1 || !"java/lang/Object".equals(lstBounds.get(0).value)) {
|
||||||
if(skip<lstBounds.size()) {
|
|
||||||
bufstrwriter.write(" extends ");
|
bufstrwriter.write(" extends ");
|
||||||
bufstrwriter.write(GenericMain.getGenericCastTypeName(lstBounds.get(skip)));
|
bufstrwriter.write(GenericMain.getGenericCastTypeName(lstBounds.get(0)));
|
||||||
for(int j=skip+1;j<lstBounds.size();j++) {
|
|
||||||
|
for(int j=1;j<lstBounds.size();j++) {
|
||||||
bufstrwriter.write(" & " + GenericMain.getGenericCastTypeName(lstBounds.get(j)));
|
bufstrwriter.write(" & " + GenericMain.getGenericCastTypeName(lstBounds.get(j)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -127,8 +127,8 @@ public class GenericMain {
|
|||||||
List<GenericType> lstBounds = new ArrayList<GenericType>();
|
List<GenericType> lstBounds = new ArrayList<GenericType>();
|
||||||
|
|
||||||
for(;;) {
|
for(;;) {
|
||||||
if(value.charAt(0) == ':') { // empty superclass
|
if(value.charAt(0) == ':') {
|
||||||
lstBounds.add(new GenericType(CodeConstants.TYPE_OBJECT, 0, "java/lang/Object"));
|
// empty superclass, skip
|
||||||
value = value.substring(1);
|
value = value.substring(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user