code cleanup: ant, backend modules

This commit is contained in:
Dmitry Jemerov
2015-07-21 14:43:32 +02:00
parent af722c8acd
commit 7db1650149
6 changed files with 10 additions and 11 deletions
@@ -21,12 +21,11 @@ import org.jetbrains.kotlin.preloading.ClassPreloadingUtils
import java.io.File import java.io.File
import java.lang.ref.SoftReference import java.lang.ref.SoftReference
import java.net.JarURLConnection import java.net.JarURLConnection
import kotlin.properties.Delegates
object KotlinAntTaskUtil { object KotlinAntTaskUtil {
private var classLoaderRef = SoftReference<ClassLoader?>(null) private var classLoaderRef = SoftReference<ClassLoader?>(null)
private val libPath: File by Delegates.lazy { private val libPath: File by lazy {
// Find path of kotlin-ant.jar in the filesystem and find kotlin-compiler.jar in the same directory // Find path of kotlin-ant.jar in the filesystem and find kotlin-compiler.jar in the same directory
val resourcePath = "/" + javaClass.getName().replace('.', '/') + ".class" val resourcePath = "/" + javaClass.getName().replace('.', '/') + ".class"
val jarConnection = javaClass.getResource(resourcePath).openConnection() as? JarURLConnection val jarConnection = javaClass.getResource(resourcePath).openConnection() as? JarURLConnection
@@ -36,11 +35,11 @@ object KotlinAntTaskUtil {
antTaskJarPath.getParentFile() antTaskJarPath.getParentFile()
} }
val compilerJar: File by Delegates.lazy { val compilerJar: File by lazy {
File(libPath, "kotlin-compiler.jar").assertExists() File(libPath, "kotlin-compiler.jar").assertExists()
} }
val runtimeJar: File by Delegates.lazy { val runtimeJar: File by lazy {
File(libPath, "kotlin-runtime.jar").assertExists() File(libPath, "kotlin-runtime.jar").assertExists()
} }
@@ -20,7 +20,7 @@ import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall
import org.jetbrains.org.objectweb.asm.Type import org.jetbrains.org.objectweb.asm.Type
import org.jetbrains.org.objectweb.asm.commons.InstructionAdapter import org.jetbrains.org.objectweb.asm.commons.InstructionAdapter
public trait Callable { public interface Callable {
public val owner: Type public val owner: Type
public val dispatchReceiverType: Type? public val dispatchReceiverType: Type?
@@ -21,7 +21,7 @@ import org.jetbrains.kotlin.diagnostics.DiagnosticSink
import org.jetbrains.kotlin.extensions.ProjectExtensionDescriptor import org.jetbrains.kotlin.extensions.ProjectExtensionDescriptor
import org.jetbrains.kotlin.resolve.BindingContext import org.jetbrains.kotlin.resolve.BindingContext
public trait ClassBuilderInterceptorExtension { public interface ClassBuilderInterceptorExtension {
companion object : ProjectExtensionDescriptor<ClassBuilderInterceptorExtension>( companion object : ProjectExtensionDescriptor<ClassBuilderInterceptorExtension>(
"org.jetbrains.kotlin.classBuilderFactoryInterceptorExtension", javaClass<ClassBuilderInterceptorExtension>()) "org.jetbrains.kotlin.classBuilderFactoryInterceptorExtension", javaClass<ClassBuilderInterceptorExtension>())
@@ -27,7 +27,7 @@ import org.jetbrains.kotlin.psi.JetClassOrObject
import org.jetbrains.kotlin.descriptors.* import org.jetbrains.kotlin.descriptors.*
import org.jetbrains.kotlin.resolve.* import org.jetbrains.kotlin.resolve.*
public trait ExpressionCodegenExtension { public interface ExpressionCodegenExtension {
companion object : ProjectExtensionDescriptor<ExpressionCodegenExtension>("org.jetbrains.kotlin.expressionCodegenExtension", javaClass<ExpressionCodegenExtension>()) companion object : ProjectExtensionDescriptor<ExpressionCodegenExtension>("org.jetbrains.kotlin.expressionCodegenExtension", javaClass<ExpressionCodegenExtension>())
public class Context( public class Context(
@@ -122,7 +122,7 @@ public open class InlineLambdaSourceMapper(parent: SourceMapper, smap: SMAPAndMe
} }
} }
trait SourceMapper { interface SourceMapper {
val resultMappings: List<FileMapping> val resultMappings: List<FileMapping>
val parent: SourceMapper? val parent: SourceMapper?
@@ -30,7 +30,7 @@ public class SplitPair<T: Interval>(val patchedPart: T, val newPart: T)
class SimpleInterval(override val startLabel: LabelNode, override val endLabel: LabelNode ) : Interval class SimpleInterval(override val startLabel: LabelNode, override val endLabel: LabelNode ) : Interval
trait Interval { interface Interval {
val startLabel: LabelNode val startLabel: LabelNode
val endLabel: LabelNode val endLabel: LabelNode
@@ -39,12 +39,12 @@ trait Interval {
} }
trait SplittableInterval<T: Interval> : Interval { interface SplittableInterval<T: Interval> : Interval {
fun split(splitBy: Interval, keepStart: Boolean): SplitPair<T> fun split(splitBy: Interval, keepStart: Boolean): SplitPair<T>
} }
trait IntervalWithHandler : Interval { interface IntervalWithHandler : Interval {
val handler: LabelNode val handler: LabelNode
val type: String? val type: String?
} }