未验证 提交 b8c84886 编写于 作者: S Skylot

fix: correct use of class names for inner types (#1340)

上级 45021389
......@@ -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
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册