Code clean
This commit is contained in:
@@ -469,7 +469,7 @@ public abstract class MemberCodegen<T extends JetElement/* TODO: & JetDeclaratio
|
|||||||
|
|
||||||
v.aconst(thisAsmType);
|
v.aconst(thisAsmType);
|
||||||
if (factory.getArgumentTypes().length == 2) {
|
if (factory.getArgumentTypes().length == 2) {
|
||||||
v.aconst(JvmCodegenUtil.getModuleName(state.getModule()));
|
v.aconst(state.getModuleName());
|
||||||
}
|
}
|
||||||
v.invokestatic(REFLECTION, factory.getName(), factory.getDescriptor(), false);
|
v.invokestatic(REFLECTION, factory.getName(), factory.getDescriptor(), false);
|
||||||
v.putstatic(thisAsmType.getInternalName(), fieldName, type);
|
v.putstatic(thisAsmType.getInternalName(), fieldName, type);
|
||||||
|
|||||||
+1
-1
@@ -92,7 +92,7 @@ public class BuiltInsSerializer(private val dependOnOldBuiltIns: Boolean) {
|
|||||||
{ ModuleContent(files, GlobalSearchScope.EMPTY_SCOPE) },
|
{ ModuleContent(files, GlobalSearchScope.EMPTY_SCOPE) },
|
||||||
JvmPlatformParameters { throw IllegalStateException() },
|
JvmPlatformParameters { throw IllegalStateException() },
|
||||||
CompilerEnvironment,
|
CompilerEnvironment,
|
||||||
packagePartProviderFactory = { a, b -> JvmPackagePartProvider(environment) }
|
packagePartProviderFactory = { module, content -> JvmPackagePartProvider(environment) }
|
||||||
)
|
)
|
||||||
|
|
||||||
val moduleDescriptor = resolver.descriptorForModule(builtInModule)
|
val moduleDescriptor = resolver.descriptorForModule(builtInModule)
|
||||||
|
|||||||
@@ -242,10 +242,6 @@ public class KotlinCoreEnvironment private constructor(
|
|||||||
messageCollector.report(severity, message, CompilerMessageLocation.NO_LOCATION)
|
messageCollector.report(severity, message, CompilerMessageLocation.NO_LOCATION)
|
||||||
}
|
}
|
||||||
|
|
||||||
public fun getJavaRoots() : List<JavaRoot> {
|
|
||||||
return javaRoots
|
|
||||||
}
|
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
|
||||||
private val APPLICATION_LOCK = Object()
|
private val APPLICATION_LOCK = Object()
|
||||||
|
|||||||
@@ -130,7 +130,7 @@ public abstract class AnalyzerFacade<in P : PlatformAnalysisParameters> {
|
|||||||
platformParameters: P,
|
platformParameters: P,
|
||||||
targetEnvironment: TargetEnvironment,
|
targetEnvironment: TargetEnvironment,
|
||||||
delegateResolver: ResolverForProject<M> = EmptyResolverForProject(),
|
delegateResolver: ResolverForProject<M> = EmptyResolverForProject(),
|
||||||
packagePartProviderFactory: (M, ModuleContent) -> PackagePartProvider = { (m, c) -> PackagePartProvider.EMPTY }
|
packagePartProviderFactory: (M, ModuleContent) -> PackagePartProvider = { module, content -> PackagePartProvider.EMPTY }
|
||||||
): ResolverForProject<M> {
|
): ResolverForProject<M> {
|
||||||
val storageManager = projectContext.storageManager
|
val storageManager = projectContext.storageManager
|
||||||
fun createResolverForProject(): ResolverForProjectImpl<M> {
|
fun createResolverForProject(): ResolverForProjectImpl<M> {
|
||||||
|
|||||||
@@ -55,7 +55,6 @@ public class KotlinPackageAnnotationTest extends CodegenTestCase {
|
|||||||
|
|
||||||
Class<? extends Annotation> annotationClass = loadAnnotationClassQuietly(JvmAnnotationNames.KOTLIN_PACKAGE.asString());
|
Class<? extends Annotation> annotationClass = loadAnnotationClassQuietly(JvmAnnotationNames.KOTLIN_PACKAGE.asString());
|
||||||
assertTrue(aClass.isAnnotationPresent(annotationClass));
|
assertTrue(aClass.isAnnotationPresent(annotationClass));
|
||||||
assertTrue(aClass.isAnnotationPresent(annotationClass));
|
|
||||||
|
|
||||||
Annotation kotlinPackage = aClass.getAnnotation(annotationClass);
|
Annotation kotlinPackage = aClass.getAnnotation(annotationClass);
|
||||||
|
|
||||||
@@ -80,7 +79,6 @@ public class KotlinPackageAnnotationTest extends CodegenTestCase {
|
|||||||
|
|
||||||
Class<? extends Annotation> annotationClass = loadAnnotationClassQuietly(JvmAnnotationNames.KOTLIN_FILE_FACADE.asString());
|
Class<? extends Annotation> annotationClass = loadAnnotationClassQuietly(JvmAnnotationNames.KOTLIN_FILE_FACADE.asString());
|
||||||
assertTrue(aClass.isAnnotationPresent(annotationClass));
|
assertTrue(aClass.isAnnotationPresent(annotationClass));
|
||||||
assertTrue(aClass.isAnnotationPresent(annotationClass));
|
|
||||||
|
|
||||||
Annotation kotlinPackage = aClass.getAnnotation(annotationClass);
|
Annotation kotlinPackage = aClass.getAnnotation(annotationClass);
|
||||||
|
|
||||||
|
|||||||
-1
@@ -69,7 +69,6 @@ public final class DeserializedDescriptorResolver {
|
|||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public JetScope createKotlinPackageScope(@NotNull PackageFragmentDescriptor descriptor, @NotNull KotlinJvmBinaryClass kotlinClass) {
|
public JetScope createKotlinPackageScope(@NotNull PackageFragmentDescriptor descriptor, @NotNull KotlinJvmBinaryClass kotlinClass) {
|
||||||
//TODO add assertion from readData(kotlinClass, CLASS);
|
|
||||||
String[] data = readData(kotlinClass, KotlinClassHeader.Kind.FILE_FACADE);
|
String[] data = readData(kotlinClass, KotlinClassHeader.Kind.FILE_FACADE);
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
//all classes are included in java scope
|
//all classes are included in java scope
|
||||||
|
|||||||
@@ -51,31 +51,11 @@ public class PackageParts(val packageFqName: String) {
|
|||||||
|
|
||||||
val parts = linkedSetOf<String>()
|
val parts = linkedSetOf<String>()
|
||||||
|
|
||||||
override fun equals(other: Any?): Boolean {
|
override fun equals(other: Any?) =
|
||||||
if (other !is PackageParts) {
|
other is PackageParts && other.packageFqName == packageFqName && other.parts == parts
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (other.packageFqName != packageFqName) {
|
override fun hashCode() =
|
||||||
return false;
|
packageFqName.hashCode() * 31 + parts.hashCode()
|
||||||
}
|
|
||||||
|
|
||||||
if (other.parts.size() != parts.size()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (part in other.parts) {
|
|
||||||
if (!parts.contains(part)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun hashCode(): Int {
|
|
||||||
return packageFqName.hashCode() / 3 + parts.size() / 3 + (parts.firstOrNull()?.hashCode() ?: 0) / 3
|
|
||||||
}
|
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
@jvmStatic public fun PackageParts.serialize(builder : JvmPackageTable.PackageTable.Builder) {
|
@jvmStatic public fun PackageParts.serialize(builder : JvmPackageTable.PackageTable.Builder) {
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ package org.jetbrains.kotlin.descriptors
|
|||||||
interface PackagePartProvider {
|
interface PackagePartProvider {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* return packagepart simple names
|
* return package part simple names
|
||||||
*/
|
*/
|
||||||
fun findPackageParts(packageFqName: String): List<String>
|
fun findPackageParts(packageFqName: String): List<String>
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ public class ReflectionFactoryImpl extends ReflectionFactory {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public KPackage createKotlinPackage(Class javaClass) {
|
public KPackage createKotlinPackage(Class javaClass) {
|
||||||
return createKotlinPackage(javaClass, "undefined");
|
return createKotlinPackage(javaClass, "main");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ public val KType.javaType: Type
|
|||||||
* See the [Kotlin language documentation](http://kotlinlang.org/docs/reference/java-interop.html#package-level-functions)
|
* See the [Kotlin language documentation](http://kotlinlang.org/docs/reference/java-interop.html#package-level-functions)
|
||||||
* for more information.
|
* for more information.
|
||||||
*/
|
*/
|
||||||
@deprecated("After package refactoring it would be impossible to retrieve package by class")
|
@deprecated("After dropping old package facades it would be impossible to retrieve package by java class")
|
||||||
public val Class<*>.kotlinPackage: KPackage?
|
public val Class<*>.kotlinPackage: KPackage?
|
||||||
get() = if (getSimpleName().endsWith("Package") &&
|
get() = if (getSimpleName().endsWith("Package") &&
|
||||||
getAnnotation(javaClass<kotlin.jvm.internal.KotlinPackage>()) != null) {
|
getAnnotation(javaClass<kotlin.jvm.internal.KotlinPackage>()) != null) {
|
||||||
|
|||||||
+3
-3
@@ -44,13 +44,13 @@ public object KotlinModuleMappingIndex : FileBasedIndexExtension<String, Package
|
|||||||
private val VALUE_EXTERNALIZER = object : DataExternalizer<PackageParts> {
|
private val VALUE_EXTERNALIZER = object : DataExternalizer<PackageParts> {
|
||||||
override fun read(`in`: DataInput): PackageParts? {
|
override fun read(`in`: DataInput): PackageParts? {
|
||||||
val packageFqName = `in`.readUTF()
|
val packageFqName = `in`.readUTF()
|
||||||
val facades = PackageParts(packageFqName)
|
val parts = PackageParts(packageFqName)
|
||||||
val size = `in`.readInt()
|
val size = `in`.readInt()
|
||||||
(1..size).forEach {
|
(1..size).forEach {
|
||||||
facades.parts.add(`in`.readUTF())
|
parts.parts.add(`in`.readUTF())
|
||||||
}
|
}
|
||||||
|
|
||||||
return facades
|
return parts
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun save(out: DataOutput, value: PackageParts?) {
|
override fun save(out: DataOutput, value: PackageParts?) {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
[INFO] Compiling Kotlin sources from [/src/main/kotlin]
|
[INFO] Compiling Kotlin sources from [/src/main/kotlin]
|
||||||
[INFO] Classes directory is /target/classes
|
[INFO] Classes directory is /target/classes
|
||||||
[INFO] Using kotlin annotations from /local-repo/org/jetbrains/kotlin/kotlin-jdk-annotations/0.1-SNAPSHOT/kotlin-jdk-annotations-0.1-SNAPSHOT.jar
|
[INFO] Using kotlin annotations from /local-repo/org/jetbrains/kotlin/kotlin-jdk-annotations/0.1-SNAPSHOT/kotlin-jdk-annotations-0.1-SNAPSHOT.jar
|
||||||
[INFO] ModuleName is test-project
|
[INFO] Module name is test-project
|
||||||
[INFO] PERF: INIT: Compiler initialized in LLL ms
|
[INFO] PERF: INIT: Compiler initialized in LLL ms
|
||||||
[INFO] PERF: ANALYZE: 1 files (2 lines) in LLL ms
|
[INFO] PERF: ANALYZE: 1 files (2 lines) in LLL ms
|
||||||
[INFO] PERF: GENERATE: 1 files (2 lines) in LLL ms
|
[INFO] PERF: GENERATE: 1 files (2 lines) in LLL ms
|
||||||
+1
-1
@@ -119,7 +119,7 @@ public class K2JVMCompileMojo extends KotlinCompileMojoBase<K2JVMCompilerArgumen
|
|||||||
getLog().info("Using kotlin annotations from " + arguments.annotations);
|
getLog().info("Using kotlin annotations from " + arguments.annotations);
|
||||||
|
|
||||||
arguments.moduleName = moduleName;
|
arguments.moduleName = moduleName;
|
||||||
getLog().info("ModuleName is " + moduleName);
|
getLog().info("Module name is " + moduleName);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Args.parse(arguments, ArrayUtil.toStringArray(args));
|
Args.parse(arguments, ArrayUtil.toStringArray(args));
|
||||||
|
|||||||
Reference in New Issue
Block a user