code cleanup: core modules

This commit is contained in:
Dmitry Jemerov
2015-07-21 15:41:57 +02:00
parent 6a6f369e5d
commit aa1f6f2252
37 changed files with 62 additions and 65 deletions
@@ -24,7 +24,7 @@ import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.resolve.scopes.JetScope
import org.jetbrains.kotlin.types.JetType
public trait SamConversionResolver {
public interface SamConversionResolver {
public companion object EMPTY : SamConversionResolver {
override fun <D : FunctionDescriptor> resolveSamAdapter(original: D) = null
override fun resolveSamConstructor(name: Name, scope: JetScope) = null
@@ -23,7 +23,7 @@ import org.jetbrains.kotlin.descriptors.ClassDescriptor
import kotlin.properties.Delegates
import javax.inject.Inject
public trait ModuleClassResolver {
public interface ModuleClassResolver {
public fun resolveClass(javaClass: JavaClass): ClassDescriptor?
}
@@ -16,16 +16,15 @@
package org.jetbrains.kotlin.load.java.lazy.descriptors
import org.jetbrains.kotlin.descriptors.impl.PackageFragmentDescriptorImpl
import org.jetbrains.kotlin.load.java.lazy.LazyJavaResolverContext
import org.jetbrains.kotlin.load.java.structure.JavaPackage
import org.jetbrains.kotlin.descriptors.impl.PackageFragmentDescriptorImpl
import kotlin.properties.Delegates
class LazyJavaPackageFragment(
private val c: LazyJavaResolverContext,
private val jPackage: JavaPackage
) : PackageFragmentDescriptorImpl(c.module, jPackage.getFqName()) {
private val scope by Delegates.lazy { LazyPackageFragmentScopeForJavaPackage(c, jPackage, this) }
private val scope by lazy { LazyPackageFragmentScopeForJavaPackage(c, jPackage, this) }
override fun getMemberScope() = scope
@@ -22,7 +22,7 @@ import org.jetbrains.kotlin.load.java.components.DescriptorResolverUtils
import org.jetbrains.kotlin.utils.valuesToMap
import java.util.HashSet
trait MemberIndex {
interface MemberIndex {
fun findMethodsByName(name: Name): Collection<JavaMethod>
fun getMethodNames(nameFilter: (Name) -> Boolean): Collection<Name>
@@ -29,11 +29,11 @@ import org.jetbrains.kotlin.name.ClassId
import org.jetbrains.kotlin.utils.mapToIndex
//TODO: (module refactoring) usages of this interface should be replaced by ModuleClassResolver
trait LazyJavaClassResolver {
interface LazyJavaClassResolver {
fun resolveClass(javaClass: JavaClass): ClassDescriptor?
}
trait TypeParameterResolver {
interface TypeParameterResolver {
object EMPTY : TypeParameterResolver {
override fun resolveTypeParameter(javaTypeParameter: JavaTypeParameter): TypeParameterDescriptor? = null
}
@@ -347,7 +347,7 @@ class LazyJavaTypeResolver(
}
trait JavaTypeAttributes {
interface JavaTypeAttributes {
val howThisTypeIsUsed: TypeUsage
val howThisTypeIsUsedAccordingToAnnotations: TypeUsage
val isMarkedNotNull: Boolean
@@ -19,10 +19,10 @@ package org.jetbrains.kotlin.load.java.sources
import org.jetbrains.kotlin.load.java.structure.JavaElement
import org.jetbrains.kotlin.descriptors.SourceElement
public trait JavaSourceElementFactory {
public interface JavaSourceElementFactory {
public fun source(javaElement: JavaElement): JavaSourceElement
}
public trait JavaSourceElement: SourceElement {
public interface JavaSourceElement: SourceElement {
public val javaElement: JavaElement
}
@@ -19,7 +19,7 @@ package org.jetbrains.kotlin.load.java.structure
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.name.Name
public trait JavaPackage : JavaElement {
public interface JavaPackage : JavaElement {
public fun getClasses(nameFilter: (Name) -> Boolean): Collection<JavaClass>
public fun getSubPackages(): Collection<JavaPackage>
@@ -18,26 +18,26 @@ package org.jetbrains.kotlin.load.java.structure
import org.jetbrains.kotlin.name.Name
public trait JavaAnnotationArgument {
public interface JavaAnnotationArgument {
public val name: Name?
}
public trait JavaLiteralAnnotationArgument : JavaAnnotationArgument {
public interface JavaLiteralAnnotationArgument : JavaAnnotationArgument {
public val value: Any?
}
public trait JavaArrayAnnotationArgument : JavaAnnotationArgument {
public interface JavaArrayAnnotationArgument : JavaAnnotationArgument {
public fun getElements(): List<JavaAnnotationArgument>
}
public trait JavaEnumValueAnnotationArgument : JavaAnnotationArgument {
public interface JavaEnumValueAnnotationArgument : JavaAnnotationArgument {
public fun resolve(): JavaField?
}
public trait JavaClassObjectAnnotationArgument : JavaAnnotationArgument {
public interface JavaClassObjectAnnotationArgument : JavaAnnotationArgument {
public fun getReferencedType(): JavaType
}
public trait JavaAnnotationAsAnnotationArgument : JavaAnnotationArgument {
public interface JavaAnnotationAsAnnotationArgument : JavaAnnotationArgument {
public fun getAnnotation(): JavaAnnotation
}
@@ -19,7 +19,7 @@ package org.jetbrains.kotlin.load.kotlin
import org.jetbrains.kotlin.load.java.structure.JavaClass
import org.jetbrains.kotlin.name.ClassId
public trait KotlinClassFinder {
public interface KotlinClassFinder {
public fun findKotlinClass(classId: ClassId): KotlinJvmBinaryClass?
public fun findKotlinClass(javaClass: JavaClass): KotlinJvmBinaryClass?