working with package statement improved
This commit is contained in:
@@ -19,10 +19,15 @@ public class Converter {
|
||||
@NotNull
|
||||
public static File fileToFile(PsiJavaFile javaFile) {
|
||||
final PsiImportList importList = javaFile.getImportList();
|
||||
List<Import> imports = importList == null ?
|
||||
new LinkedList<Import>() :
|
||||
importsToImportList(importList.getAllImportStatements());
|
||||
return new File(javaFile.getPackageName(), imports, classesToClassList(javaFile.getClasses())); // TODO: use identifier
|
||||
List<Import> imports = importList == null ? Collections.<Import>emptyList() : importsToImportList(importList.getAllImportStatements());
|
||||
return new File(getPackageName(javaFile.getPackageName()), imports, classesToClassList(javaFile.getClasses()));
|
||||
}
|
||||
|
||||
private static String getPackageName(String packageName) {
|
||||
List<String> result = new LinkedList<String>();
|
||||
for (String part : packageName.split("\\."))
|
||||
result.add(new IdentifierImpl(part).toKotlin());
|
||||
return AstUtil.join(result, ".");
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
package org.jetbrains.jet.j2k.in;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class Converter {}
|
||||
@@ -0,0 +1,6 @@
|
||||
namespace org.jetbrains.jet.j2k.`in` {
|
||||
import org.jetbrains.annotations.NotNull
|
||||
import org.jetbrains.annotations.Nullable
|
||||
public open class Converter() {
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user