Code clean
This commit is contained in:
@@ -469,7 +469,7 @@ public abstract class MemberCodegen<T extends JetElement/* TODO: & JetDeclaratio
|
||||
|
||||
v.aconst(thisAsmType);
|
||||
if (factory.getArgumentTypes().length == 2) {
|
||||
v.aconst(JvmCodegenUtil.getModuleName(state.getModule()));
|
||||
v.aconst(state.getModuleName());
|
||||
}
|
||||
v.invokestatic(REFLECTION, factory.getName(), factory.getDescriptor(), false);
|
||||
v.putstatic(thisAsmType.getInternalName(), fieldName, type);
|
||||
|
||||
+1
-1
@@ -92,7 +92,7 @@ public class BuiltInsSerializer(private val dependOnOldBuiltIns: Boolean) {
|
||||
{ ModuleContent(files, GlobalSearchScope.EMPTY_SCOPE) },
|
||||
JvmPlatformParameters { throw IllegalStateException() },
|
||||
CompilerEnvironment,
|
||||
packagePartProviderFactory = { a, b -> JvmPackagePartProvider(environment) }
|
||||
packagePartProviderFactory = { module, content -> JvmPackagePartProvider(environment) }
|
||||
)
|
||||
|
||||
val moduleDescriptor = resolver.descriptorForModule(builtInModule)
|
||||
|
||||
@@ -242,10 +242,6 @@ public class KotlinCoreEnvironment private constructor(
|
||||
messageCollector.report(severity, message, CompilerMessageLocation.NO_LOCATION)
|
||||
}
|
||||
|
||||
public fun getJavaRoots() : List<JavaRoot> {
|
||||
return javaRoots
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
||||
private val APPLICATION_LOCK = Object()
|
||||
|
||||
@@ -130,7 +130,7 @@ public abstract class AnalyzerFacade<in P : PlatformAnalysisParameters> {
|
||||
platformParameters: P,
|
||||
targetEnvironment: TargetEnvironment,
|
||||
delegateResolver: ResolverForProject<M> = EmptyResolverForProject(),
|
||||
packagePartProviderFactory: (M, ModuleContent) -> PackagePartProvider = { (m, c) -> PackagePartProvider.EMPTY }
|
||||
packagePartProviderFactory: (M, ModuleContent) -> PackagePartProvider = { module, content -> PackagePartProvider.EMPTY }
|
||||
): ResolverForProject<M> {
|
||||
val storageManager = projectContext.storageManager
|
||||
fun createResolverForProject(): ResolverForProjectImpl<M> {
|
||||
|
||||
@@ -55,7 +55,6 @@ public class KotlinPackageAnnotationTest extends CodegenTestCase {
|
||||
|
||||
Class<? extends Annotation> annotationClass = loadAnnotationClassQuietly(JvmAnnotationNames.KOTLIN_PACKAGE.asString());
|
||||
assertTrue(aClass.isAnnotationPresent(annotationClass));
|
||||
assertTrue(aClass.isAnnotationPresent(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());
|
||||
assertTrue(aClass.isAnnotationPresent(annotationClass));
|
||||
assertTrue(aClass.isAnnotationPresent(annotationClass));
|
||||
|
||||
Annotation kotlinPackage = aClass.getAnnotation(annotationClass);
|
||||
|
||||
|
||||
-1
@@ -69,7 +69,6 @@ public final class DeserializedDescriptorResolver {
|
||||
|
||||
@Nullable
|
||||
public JetScope createKotlinPackageScope(@NotNull PackageFragmentDescriptor descriptor, @NotNull KotlinJvmBinaryClass kotlinClass) {
|
||||
//TODO add assertion from readData(kotlinClass, CLASS);
|
||||
String[] data = readData(kotlinClass, KotlinClassHeader.Kind.FILE_FACADE);
|
||||
if (data != null) {
|
||||
//all classes are included in java scope
|
||||
|
||||
@@ -51,31 +51,11 @@ public class PackageParts(val packageFqName: String) {
|
||||
|
||||
val parts = linkedSetOf<String>()
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (other !is PackageParts) {
|
||||
return false;
|
||||
}
|
||||
override fun equals(other: Any?) =
|
||||
other is PackageParts && other.packageFqName == packageFqName && other.parts == parts
|
||||
|
||||
if (other.packageFqName != packageFqName) {
|
||||
return false;
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
override fun hashCode() =
|
||||
packageFqName.hashCode() * 31 + parts.hashCode()
|
||||
|
||||
companion object {
|
||||
@jvmStatic public fun PackageParts.serialize(builder : JvmPackageTable.PackageTable.Builder) {
|
||||
|
||||
@@ -19,7 +19,7 @@ package org.jetbrains.kotlin.descriptors
|
||||
interface PackagePartProvider {
|
||||
|
||||
/**
|
||||
* return packagepart simple names
|
||||
* return package part simple names
|
||||
*/
|
||||
fun findPackageParts(packageFqName: String): List<String>
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ public class ReflectionFactoryImpl extends ReflectionFactory {
|
||||
|
||||
@Override
|
||||
public KPackage createKotlinPackage(Class javaClass) {
|
||||
return createKotlinPackage(javaClass, "undefined");
|
||||
return createKotlinPackage(javaClass, "main");
|
||||
}
|
||||
|
||||
@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)
|
||||
* 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?
|
||||
get() = if (getSimpleName().endsWith("Package") &&
|
||||
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> {
|
||||
override fun read(`in`: DataInput): PackageParts? {
|
||||
val packageFqName = `in`.readUTF()
|
||||
val facades = PackageParts(packageFqName)
|
||||
val parts = PackageParts(packageFqName)
|
||||
val size = `in`.readInt()
|
||||
(1..size).forEach {
|
||||
facades.parts.add(`in`.readUTF())
|
||||
parts.parts.add(`in`.readUTF())
|
||||
}
|
||||
|
||||
return facades
|
||||
return parts
|
||||
}
|
||||
|
||||
override fun save(out: DataOutput, value: PackageParts?) {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
[INFO] Compiling Kotlin sources from [/src/main/kotlin]
|
||||
[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] ModuleName is test-project
|
||||
[INFO] Module name is test-project
|
||||
[INFO] PERF: INIT: Compiler initialized in LLL ms
|
||||
[INFO] PERF: ANALYZE: 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);
|
||||
|
||||
arguments.moduleName = moduleName;
|
||||
getLog().info("ModuleName is " + moduleName);
|
||||
getLog().info("Module name is " + moduleName);
|
||||
|
||||
try {
|
||||
Args.parse(arguments, ArrayUtil.toStringArray(args));
|
||||
|
||||
Reference in New Issue
Block a user