use of org.jetbrains.kotlin.resolve.ImportPath in project kotlin by JetBrains.
the class KtImportDirective method getImportPath.
@Nullable
@IfNotParsed
public ImportPath getImportPath() {
FqName importFqn = getImportedFqName();
if (importFqn == null) {
return null;
}
Name alias = null;
String aliasName = getAliasName();
if (aliasName != null) {
alias = Name.identifier(aliasName);
}
return new ImportPath(importFqn, isAllUnder(), alias);
}
use of org.jetbrains.kotlin.resolve.ImportPath in project kotlin by JetBrains.
the class KtPsiUtilTest method testConvertToImportPath.
public void testConvertToImportPath() {
Assert.assertEquals(null, getImportPathFromParsed("import "));
Assert.assertEquals(new ImportPath(new FqName("some"), false), getImportPathFromParsed("import some."));
Assert.assertEquals(null, getImportPathFromParsed("import *"));
Assert.assertEquals(new ImportPath(new FqName("some.test"), true), getImportPathFromParsed("import some.test.* as SomeTest"));
Assert.assertEquals(new ImportPath(new FqName("some"), false), getImportPathFromParsed("import some?.Test"));
Assert.assertEquals(new ImportPath(new FqName("some"), false), getImportPathFromParsed("import some"));
Assert.assertEquals(new ImportPath(new FqName("some"), true), getImportPathFromParsed("import some.*"));
Assert.assertEquals(new ImportPath(new FqName("some.Test"), false), getImportPathFromParsed("import some.Test"));
Assert.assertEquals(new ImportPath(new FqName("some.test"), true), getImportPathFromParsed("import some.test.*"));
Assert.assertEquals(new ImportPath(new FqName("some.test"), false, Name.identifier("SomeTest")), getImportPathFromParsed("import some.test as SomeTest"));
Assert.assertEquals(new ImportPath(new FqName("some.Test"), false), getImportPathFromParsed("import some./* hello world */Test"));
Assert.assertEquals(new ImportPath(new FqName("some.Test"), false), getImportPathFromParsed("import some. Test"));
Assert.assertNotSame(new ImportPath(new FqName("some.test"), false), getImportPathFromParsed("import some.Test"));
}
Aggregations