fix: correct use of class names for inner types (#1340)
This commit is contained in:
@@ -537,14 +537,18 @@ public class ClassGen {
|
||||
ArgType innerType = baseType.getInnerType();
|
||||
ArgType outerType = innerType.getOuterType();
|
||||
if (outerType != null) {
|
||||
useClass(code, outerType);
|
||||
useClassWithShortName(code, baseType, outerType);
|
||||
code.add('.');
|
||||
addInnerType(code, innerType);
|
||||
return;
|
||||
}
|
||||
useClassWithShortName(code, baseType, innerType);
|
||||
}
|
||||
|
||||
private void useClassWithShortName(ICodeWriter code, ArgType baseType, ArgType type) {
|
||||
String fullNameObj;
|
||||
if (innerType.getObject().contains(".")) {
|
||||
fullNameObj = innerType.getObject();
|
||||
if (type.getObject().contains(".")) {
|
||||
fullNameObj = type.getObject();
|
||||
} else {
|
||||
fullNameObj = baseType.getObject();
|
||||
}
|
||||
@@ -554,7 +558,7 @@ public class ClassGen {
|
||||
code.attachAnnotation(classNode);
|
||||
}
|
||||
code.add(classInfo.getAliasShortName());
|
||||
addGenerics(code, innerType);
|
||||
addGenerics(code, type);
|
||||
}
|
||||
|
||||
private void addGenerics(ICodeWriter code, ArgType type) {
|
||||
|
||||
@@ -40,4 +40,12 @@ public class TestGenericsInFullInnerCls extends SmaliTest {
|
||||
loadFromSmaliFiles();
|
||||
// compilation should pass
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWithFullNames() {
|
||||
getArgs().setUseImports(false);
|
||||
getArgs().setCommentsLevel(CommentsLevel.WARN);
|
||||
loadFromSmaliFiles();
|
||||
// compilation should pass
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user