working with package statement improved
This commit is contained in:
@@ -19,10 +19,15 @@ public class Converter {
|
|||||||
@NotNull
|
@NotNull
|
||||||
public static File fileToFile(PsiJavaFile javaFile) {
|
public static File fileToFile(PsiJavaFile javaFile) {
|
||||||
final PsiImportList importList = javaFile.getImportList();
|
final PsiImportList importList = javaFile.getImportList();
|
||||||
List<Import> imports = importList == null ?
|
List<Import> imports = importList == null ? Collections.<Import>emptyList() : importsToImportList(importList.getAllImportStatements());
|
||||||
new LinkedList<Import>() :
|
return new File(getPackageName(javaFile.getPackageName()), imports, classesToClassList(javaFile.getClasses()));
|
||||||
importsToImportList(importList.getAllImportStatements());
|
}
|
||||||
return new File(javaFile.getPackageName(), imports, classesToClassList(javaFile.getClasses())); // TODO: use identifier
|
|
||||||
|
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
|
@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