Fix minor naming/formatting issues after review
This commit is contained in:
@@ -54,8 +54,6 @@ public class IncrementalCacheImpl(
|
||||
private val target: ModuleBuildTarget
|
||||
) : BasicMapsOwner(), IncrementalCache {
|
||||
companion object {
|
||||
val CACHE_EXTENSION = ".tab"
|
||||
|
||||
val PROTO_MAP = "proto"
|
||||
val CONSTANTS_MAP = "constants"
|
||||
val INLINE_FUNCTIONS = "inline-functions"
|
||||
@@ -73,7 +71,7 @@ public class IncrementalCacheImpl(
|
||||
private val baseDir = File(targetDataRoot, CACHE_DIRECTORY_NAME)
|
||||
|
||||
private val String.storageFile: File
|
||||
get() = File(baseDir, this + CACHE_EXTENSION)
|
||||
get() = File(baseDir, this + "." + CACHE_EXTENSION)
|
||||
|
||||
private val protoMap = registerMap(ProtoMap(PROTO_MAP.storageFile))
|
||||
private val constantsMap = registerMap(ConstantsMap(CONSTANTS_MAP.storageFile))
|
||||
@@ -273,7 +271,7 @@ public class IncrementalCacheImpl(
|
||||
cacheFormatVersion.clean()
|
||||
}
|
||||
|
||||
private inner class ProtoMap(storageFile: File) : BasicStringMap<ProtoMapValue>(storageFile, PROTO_MAP_VALUE_EXTERNALIZER) {
|
||||
private inner class ProtoMap(storageFile: File) : BasicStringMap<ProtoMapValue>(storageFile, ProtoMapValueExternalizer) {
|
||||
|
||||
public fun process(kotlinClass: LocalFileKotlinClass, isPackage: Boolean, checkChangesIsOpenPart: Boolean = true): ChangesInfo {
|
||||
val header = kotlinClass.classHeader
|
||||
@@ -319,7 +317,7 @@ public class IncrementalCacheImpl(
|
||||
}
|
||||
}
|
||||
|
||||
private inner class ConstantsMap(storageFile: File) : BasicStringMap<Map<String, Any>>(storageFile, CONSTANTS_MAP_EXTERNALIZER) {
|
||||
private inner class ConstantsMap(storageFile: File) : BasicStringMap<Map<String, Any>>(storageFile, ConstantsMapExternalizer) {
|
||||
private fun getConstantsMap(bytes: ByteArray): Map<String, Any>? {
|
||||
val result = HashMap<String, Any>()
|
||||
|
||||
@@ -367,7 +365,7 @@ public class IncrementalCacheImpl(
|
||||
value.dumpMap(Any::toString)
|
||||
}
|
||||
|
||||
private inner class InlineFunctionsMap(storageFile: File) : BasicStringMap<Map<String, Long>>(storageFile, STRING_TO_LONG_MAP_EXTERNALIZER) {
|
||||
private inner class InlineFunctionsMap(storageFile: File) : BasicStringMap<Map<String, Long>>(storageFile, StringToLongMapExternalizer) {
|
||||
private fun getInlineFunctionsMap(bytes: ByteArray): Map<String, Long> {
|
||||
val result = HashMap<String, Long>()
|
||||
|
||||
@@ -453,7 +451,7 @@ public class IncrementalCacheImpl(
|
||||
override fun dumpValue(value: Boolean) = ""
|
||||
}
|
||||
|
||||
private inner class MultifileClassFacadeMap(storageFile: File) : BasicStringMap<List<String>>(storageFile, STRING_LIST_EXTERNALIZER) {
|
||||
private inner class MultifileClassFacadeMap(storageFile: File) : BasicStringMap<List<String>>(storageFile, StringListExternalizer) {
|
||||
public fun add(facadeName: JvmClassName, partNames: List<String>) {
|
||||
storage[facadeName.internalName] = partNames
|
||||
}
|
||||
@@ -483,7 +481,7 @@ public class IncrementalCacheImpl(
|
||||
override fun dumpValue(value: String): String = value
|
||||
}
|
||||
|
||||
private inner class SourceToClassesMap(storageFile: File) : BasicStringMap<List<String>>(storageFile, PathStringDescriptor.INSTANCE, STRING_LIST_EXTERNALIZER) {
|
||||
private inner class SourceToClassesMap(storageFile: File) : BasicStringMap<List<String>>(storageFile, PathStringDescriptor.INSTANCE, StringListExternalizer) {
|
||||
public fun clearOutputsForSource(sourceFile: File) {
|
||||
remove(sourceFile.absolutePath)
|
||||
}
|
||||
@@ -525,7 +523,7 @@ public class IncrementalCacheImpl(
|
||||
override fun dumpValue(value: Boolean) = ""
|
||||
}
|
||||
|
||||
private inner class DirtyInlineFunctionsMap(storageFile: File) : BasicStringMap<List<String>>(storageFile, STRING_LIST_EXTERNALIZER) {
|
||||
private inner class DirtyInlineFunctionsMap(storageFile: File) : BasicStringMap<List<String>>(storageFile, StringListExternalizer) {
|
||||
public fun getEntries(): Map<JvmClassName, List<String>> =
|
||||
storage.keys.toMap(JvmClassName::byInternalName) { storage[it]!! }
|
||||
|
||||
@@ -546,7 +544,7 @@ public class IncrementalCacheImpl(
|
||||
* * inlineFunction - jvmSignature of some inline function in source file
|
||||
* * target files - collection of files inlineFunction has been inlined to
|
||||
*/
|
||||
private inner class InlineFunctionsFilesMap(storageFile: File) : BasicMap<PathFunctionPair, Collection<String>>(storageFile, PATH_FUNCTION_PAIR_KEY_DESCRIPTOR, PATH_COLLECTION_EXTERNALIZER) {
|
||||
private inner class InlineFunctionsFilesMap(storageFile: File) : BasicMap<PathFunctionPair, Collection<String>>(storageFile, PathFunctionPairKeyDescriptor, PathCollectionExternalizer) {
|
||||
public fun add(sourcePath: String, jvmSignature: String, targetPath: String) {
|
||||
val key = PathFunctionPair(sourcePath, jvmSignature)
|
||||
storage.append(key) { out ->
|
||||
|
||||
@@ -47,7 +47,7 @@ class LookupTrackerImpl(private val targetDataDir: File) : BasicMapsOwner(), Loo
|
||||
}
|
||||
|
||||
private val String.storageFile: File
|
||||
get() = File(targetDataDir, this + IncrementalCacheImpl.CACHE_EXTENSION)
|
||||
get() = File(targetDataDir, this + "." + CACHE_EXTENSION)
|
||||
|
||||
private val countersFile = "counters".storageFile
|
||||
private val idToFile = registerMap(IdToFileMap("id-to-file".storageFile))
|
||||
@@ -108,7 +108,7 @@ class LookupTrackerImpl(private val targetDataDir: File) : BasicMapsOwner(), Loo
|
||||
private fun removeGarbageIfNeeded() {
|
||||
if (size <= MINIMUM_GARBAGE_COLLECTIBLE_SIZE && deletedCount.toDouble() / size <= DELETED_TO_SIZE_TRESHOLD) return
|
||||
|
||||
for (hash in lookupMap.lookupHashes) {
|
||||
for (hash in lookupMap.keys) {
|
||||
lookupMap[hash] = lookupMap[hash]!!.filter { it in idToFile }.toSet()
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,6 @@ public sealed class DifferenceKind() {
|
||||
public class MEMBERS(val names: Collection<String>): DifferenceKind()
|
||||
}
|
||||
|
||||
|
||||
public fun difference(oldData: ProtoMapValue, newData: ProtoMapValue): DifferenceKind {
|
||||
if (oldData.isPackageFacade != newData.isPackageFacade) return DifferenceKind.CLASS_SIGNATURE
|
||||
|
||||
|
||||
@@ -22,6 +22,10 @@ import org.jetbrains.jps.incremental.storage.StorageOwner
|
||||
open class BasicMapsOwner : StorageOwner {
|
||||
private val maps = arrayListOf<BasicMap<*, *>>()
|
||||
|
||||
companion object {
|
||||
val CACHE_EXTENSION = "tab"
|
||||
}
|
||||
|
||||
protected fun <K, V, M : BasicMap<K, V>> registerMap(map: M): M {
|
||||
maps.add(map)
|
||||
return map
|
||||
|
||||
@@ -18,7 +18,7 @@ package org.jetbrains.kotlin.jps.incremental.storage
|
||||
|
||||
import java.io.File
|
||||
|
||||
class FileToIdMap(file: File) : BasicMap<File, Int>(file, FILE_KEY_DESCRIPTOR, INT_EXTERNALIZER) {
|
||||
class FileToIdMap(file: File) : BasicMap<File, Int>(file, FileKeyDescriptor, IntExternalizer) {
|
||||
override fun dumpKey(key: File): String = key.toString()
|
||||
|
||||
override fun dumpValue(value: Int): String = value.toString()
|
||||
|
||||
@@ -19,7 +19,7 @@ package org.jetbrains.kotlin.jps.incremental.storage
|
||||
import com.intellij.util.io.ExternalIntegerKeyDescriptor
|
||||
import java.io.File
|
||||
|
||||
class IdToFileMap(file: File) : BasicMap<Int, File>(file, ExternalIntegerKeyDescriptor(), FILE_EXTERNALIZER) {
|
||||
class IdToFileMap(file: File) : BasicMap<Int, File>(file, ExternalIntegerKeyDescriptor(), FileKeyDescriptor) {
|
||||
override fun dumpKey(key: Int): String = key.toString()
|
||||
|
||||
override fun dumpValue(value: File): String = value.toString()
|
||||
|
||||
@@ -18,23 +18,21 @@ package org.jetbrains.kotlin.jps.incremental.storage
|
||||
|
||||
import java.io.File
|
||||
|
||||
class LookupMap(storage: File) : BasicMap<IntPair, Set<Int>>(storage, INT_PAIR_KEY_DESCRIPTOR, INT_SET_EXTERNALIZER) {
|
||||
override fun dumpKey(key: IntPair): String = key.toString()
|
||||
class LookupMap(storage: File) : BasicMap<LookupHashPair, Set<Int>>(storage, LookupHashPairKeyDescriptor, IntSetExternalizer) {
|
||||
override fun dumpKey(key: LookupHashPair): String = key.toString()
|
||||
|
||||
override fun dumpValue(value: Set<Int>): String = value.toString()
|
||||
|
||||
public fun add(name: String, scope: String, fileId: Int) {
|
||||
storage.append(HashPair(name, scope)) { out -> out.writeInt(fileId) }
|
||||
storage.append(LookupHashPair(name, scope)) { out -> out.writeInt(fileId) }
|
||||
}
|
||||
|
||||
public operator fun get(name: String, scope: String): Set<Int>? = storage[HashPair(name, scope)]
|
||||
public operator fun get(lookupHash: LookupHashPair): Set<Int>? = storage[lookupHash]
|
||||
|
||||
public operator fun get(lookupHash: IntPair): Set<Int>? = storage[lookupHash]
|
||||
|
||||
public operator fun set(key: IntPair, fileIds: Set<Int>) {
|
||||
public operator fun set(key: LookupHashPair, fileIds: Set<Int>) {
|
||||
storage.set(key, fileIds)
|
||||
}
|
||||
|
||||
public val lookupHashes: Collection<IntPair>
|
||||
public val keys: Collection<LookupHashPair>
|
||||
get() = storage.keys
|
||||
}
|
||||
|
||||
@@ -29,86 +29,84 @@ import java.io.DataOutput
|
||||
import java.io.File
|
||||
import java.util.*
|
||||
|
||||
object INT_PAIR_KEY_DESCRIPTOR : KeyDescriptor<IntPair> {
|
||||
override fun read(`in`: DataInput): IntPair {
|
||||
val first = `in`.readInt()
|
||||
val second = `in`.readInt()
|
||||
return IntPair(first, second)
|
||||
object LookupHashPairKeyDescriptor : KeyDescriptor<LookupHashPair> {
|
||||
override fun read(input: DataInput): LookupHashPair {
|
||||
val first = input.readInt()
|
||||
val second = input.readInt()
|
||||
|
||||
return LookupHashPair(first, second)
|
||||
}
|
||||
|
||||
override fun save(out: DataOutput, value: IntPair?) {
|
||||
if (value == null) return
|
||||
|
||||
out.writeInt(value.first)
|
||||
out.writeInt(value.second)
|
||||
override fun save(output: DataOutput, value: LookupHashPair) {
|
||||
output.writeInt(value.nameHash)
|
||||
output.writeInt(value.scopeHash)
|
||||
}
|
||||
|
||||
override fun getHashCode(value: IntPair?): Int = value?.hashCode() ?: 0
|
||||
override fun getHashCode(value: LookupHashPair): Int = value.hashCode()
|
||||
|
||||
override fun isEqual(val1: IntPair?, val2: IntPair?): Boolean = val1 == val2
|
||||
override fun isEqual(val1: LookupHashPair, val2: LookupHashPair): Boolean = val1 == val2
|
||||
}
|
||||
|
||||
|
||||
object PATH_FUNCTION_PAIR_KEY_DESCRIPTOR : KeyDescriptor<PathFunctionPair> {
|
||||
override fun getHashCode(value: PathFunctionPair): Int =
|
||||
value.hashCode()
|
||||
|
||||
override fun isEqual(val1: PathFunctionPair, val2: PathFunctionPair): Boolean =
|
||||
val1 == val2
|
||||
|
||||
override fun read(`in`: DataInput): PathFunctionPair {
|
||||
val path = IOUtil.readUTF(`in`)
|
||||
val function = IOUtil.readUTF(`in`)
|
||||
object PathFunctionPairKeyDescriptor : KeyDescriptor<PathFunctionPair> {
|
||||
override fun read(input: DataInput): PathFunctionPair {
|
||||
val path = IOUtil.readUTF(input)
|
||||
val function = IOUtil.readUTF(input)
|
||||
return PathFunctionPair(path, function)
|
||||
}
|
||||
|
||||
override fun save(out: DataOutput, value: PathFunctionPair) {
|
||||
IOUtil.writeUTF(out, value.path)
|
||||
IOUtil.writeUTF(out, value.function)
|
||||
override fun save(output: DataOutput, value: PathFunctionPair) {
|
||||
IOUtil.writeUTF(output, value.path)
|
||||
IOUtil.writeUTF(output, value.function)
|
||||
}
|
||||
|
||||
override fun getHashCode(value: PathFunctionPair): Int = value.hashCode()
|
||||
|
||||
override fun isEqual(val1: PathFunctionPair, val2: PathFunctionPair): Boolean = val1 == val2
|
||||
}
|
||||
|
||||
|
||||
object PROTO_MAP_VALUE_EXTERNALIZER : DataExternalizer<ProtoMapValue> {
|
||||
override fun save(out: DataOutput, value: ProtoMapValue) {
|
||||
out.writeBoolean(value.isPackageFacade)
|
||||
out.writeInt(value.bytes.size())
|
||||
out.write(value.bytes)
|
||||
out.writeInt(value.strings.size())
|
||||
object ProtoMapValueExternalizer : DataExternalizer<ProtoMapValue> {
|
||||
override fun save(output: DataOutput, value: ProtoMapValue) {
|
||||
output.writeBoolean(value.isPackageFacade)
|
||||
output.writeInt(value.bytes.size())
|
||||
output.write(value.bytes)
|
||||
output.writeInt(value.strings.size())
|
||||
|
||||
for (string in value.strings) {
|
||||
out.writeUTF(string)
|
||||
output.writeUTF(string)
|
||||
}
|
||||
}
|
||||
|
||||
override fun read(`in`: DataInput): ProtoMapValue {
|
||||
val isPackageFacade = `in`.readBoolean()
|
||||
val bytesLength = `in`.readInt()
|
||||
override fun read(input: DataInput): ProtoMapValue {
|
||||
val isPackageFacade = input.readBoolean()
|
||||
val bytesLength = input.readInt()
|
||||
val bytes = ByteArray(bytesLength)
|
||||
`in`.readFully(bytes, 0, bytesLength)
|
||||
val stringsLength = `in`.readInt()
|
||||
val strings = Array<String>(stringsLength) { `in`.readUTF() }
|
||||
input.readFully(bytes, 0, bytesLength)
|
||||
val stringsLength = input.readInt()
|
||||
val strings = Array<String>(stringsLength) { input.readUTF() }
|
||||
return ProtoMapValue(isPackageFacade, bytes, strings)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
abstract class StringMapExternalizer<T> : DataExternalizer<Map<String, T>> {
|
||||
override fun save(out: DataOutput, map: Map<String, T>?) {
|
||||
out.writeInt(map!!.size())
|
||||
override fun save(output: DataOutput, map: Map<String, T>?) {
|
||||
output.writeInt(map!!.size())
|
||||
|
||||
for ((key, value) in map.entrySet()) {
|
||||
IOUtil.writeString(key, out)
|
||||
writeValue(out, value)
|
||||
IOUtil.writeString(key, output)
|
||||
writeValue(output, value)
|
||||
}
|
||||
}
|
||||
|
||||
override fun read(`in`: DataInput): Map<String, T>? {
|
||||
val size = `in`.readInt()
|
||||
override fun read(input: DataInput): Map<String, T>? {
|
||||
val size = input.readInt()
|
||||
val map = HashMap<String, T>(size)
|
||||
|
||||
repeat(size) {
|
||||
val name = IOUtil.readString(`in`)!!
|
||||
map[name] = readValue(`in`)
|
||||
val name = IOUtil.readString(input)!!
|
||||
map[name] = readValue(input)
|
||||
}
|
||||
|
||||
return map
|
||||
@@ -119,9 +117,8 @@ abstract class StringMapExternalizer<T> : DataExternalizer<Map<String, T>> {
|
||||
}
|
||||
|
||||
|
||||
object STRING_TO_LONG_MAP_EXTERNALIZER : StringMapExternalizer<Long>() {
|
||||
override fun readValue(input: DataInput): Long =
|
||||
input.readLong()
|
||||
object StringToLongMapExternalizer : StringMapExternalizer<Long>() {
|
||||
override fun readValue(input: DataInput): Long = input.readLong()
|
||||
|
||||
override fun writeValue(output: DataOutput, value: Long) {
|
||||
output.writeLong(value)
|
||||
@@ -129,86 +126,91 @@ object STRING_TO_LONG_MAP_EXTERNALIZER : StringMapExternalizer<Long>() {
|
||||
}
|
||||
|
||||
|
||||
object STRING_LIST_EXTERNALIZER : DataExternalizer<List<String>> {
|
||||
override fun save(out: DataOutput, value: List<String>) {
|
||||
value.forEach { IOUtil.writeUTF(out, it) }
|
||||
object StringListExternalizer : DataExternalizer<List<String>> {
|
||||
override fun save(output: DataOutput, value: List<String>) {
|
||||
value.forEach { IOUtil.writeUTF(output, it) }
|
||||
}
|
||||
|
||||
override fun read(`in`: DataInput): List<String> {
|
||||
override fun read(input: DataInput): List<String> {
|
||||
val result = ArrayList<String>()
|
||||
while ((`in` as DataInputStream).available() > 0) {
|
||||
result.add(IOUtil.readUTF(`in`))
|
||||
|
||||
while ((input as DataInputStream).available() > 0) {
|
||||
result.add(IOUtil.readUTF(input))
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
object PATH_COLLECTION_EXTERNALIZER : DataExternalizer<Collection<String>> {
|
||||
override fun save(out: DataOutput, value: Collection<String>) {
|
||||
object PathCollectionExternalizer : DataExternalizer<Collection<String>> {
|
||||
override fun save(output: DataOutput, value: Collection<String>) {
|
||||
for (str in value) {
|
||||
IOUtil.writeUTF(out, str)
|
||||
IOUtil.writeUTF(output, str)
|
||||
}
|
||||
}
|
||||
|
||||
override fun read(`in`: DataInput): Collection<String> {
|
||||
override fun read(input: DataInput): Collection<String> {
|
||||
val result = THashSet(FileUtil.PATH_HASHING_STRATEGY)
|
||||
val stream = `in` as DataInputStream
|
||||
val stream = input as DataInputStream
|
||||
|
||||
while (stream.available() > 0) {
|
||||
val str = IOUtil.readUTF(stream)
|
||||
result.add(str)
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
object CONSTANTS_MAP_EXTERNALIZER : DataExternalizer<Map<String, Any>> {
|
||||
override fun save(out: DataOutput, map: Map<String, Any>?) {
|
||||
out.writeInt(map!!.size())
|
||||
object ConstantsMapExternalizer : DataExternalizer<Map<String, Any>> {
|
||||
override fun save(output: DataOutput, map: Map<String, Any>?) {
|
||||
output.writeInt(map!!.size())
|
||||
for (name in map.keySet().sorted()) {
|
||||
IOUtil.writeString(name, out)
|
||||
IOUtil.writeString(name, output)
|
||||
val value = map[name]!!
|
||||
when (value) {
|
||||
is Int -> {
|
||||
out.writeByte(Kind.INT.ordinal())
|
||||
out.writeInt(value)
|
||||
output.writeByte(Kind.INT.ordinal())
|
||||
output.writeInt(value)
|
||||
}
|
||||
is Float -> {
|
||||
out.writeByte(Kind.FLOAT.ordinal())
|
||||
out.writeFloat(value)
|
||||
output.writeByte(Kind.FLOAT.ordinal())
|
||||
output.writeFloat(value)
|
||||
}
|
||||
is Long -> {
|
||||
out.writeByte(Kind.LONG.ordinal())
|
||||
out.writeLong(value)
|
||||
output.writeByte(Kind.LONG.ordinal())
|
||||
output.writeLong(value)
|
||||
}
|
||||
is Double -> {
|
||||
out.writeByte(Kind.DOUBLE.ordinal())
|
||||
out.writeDouble(value)
|
||||
output.writeByte(Kind.DOUBLE.ordinal())
|
||||
output.writeDouble(value)
|
||||
}
|
||||
is String -> {
|
||||
out.writeByte(Kind.STRING.ordinal())
|
||||
IOUtil.writeString(value, out)
|
||||
output.writeByte(Kind.STRING.ordinal())
|
||||
IOUtil.writeString(value, output)
|
||||
}
|
||||
else -> throw IllegalStateException("Unexpected constant class: ${value.javaClass}")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun read(`in`: DataInput): Map<String, Any>? {
|
||||
val size = `in`.readInt()
|
||||
override fun read(input: DataInput): Map<String, Any>? {
|
||||
val size = input.readInt()
|
||||
val map = HashMap<String, Any>(size)
|
||||
|
||||
repeat(size) {
|
||||
val name = IOUtil.readString(`in`)!!
|
||||
val name = IOUtil.readString(input)!!
|
||||
val kind = Kind.values()[input.readByte().toInt()]
|
||||
|
||||
val kind = Kind.values()[`in`.readByte().toInt()]
|
||||
val value = when (kind) {
|
||||
Kind.INT -> `in`.readInt()
|
||||
Kind.FLOAT -> `in`.readFloat()
|
||||
Kind.LONG -> `in`.readLong()
|
||||
Kind.DOUBLE -> `in`.readDouble()
|
||||
Kind.STRING -> IOUtil.readString(`in`)!!
|
||||
val value: Any = when (kind) {
|
||||
Kind.INT -> input.readInt()
|
||||
Kind.FLOAT -> input.readFloat()
|
||||
Kind.LONG -> input.readLong()
|
||||
Kind.DOUBLE -> input.readDouble()
|
||||
Kind.STRING -> IOUtil.readString(input)!!
|
||||
}
|
||||
|
||||
map[name] = value
|
||||
}
|
||||
|
||||
@@ -221,14 +223,14 @@ object CONSTANTS_MAP_EXTERNALIZER : DataExternalizer<Map<String, Any>> {
|
||||
}
|
||||
|
||||
|
||||
object INT_SET_EXTERNALIZER : DataExternalizer<Set<Int>> {
|
||||
override fun save(out: DataOutput, value: Set<Int>) {
|
||||
value.forEach { out.writeInt(it) }
|
||||
object IntSetExternalizer : DataExternalizer<Set<Int>> {
|
||||
override fun save(output: DataOutput, value: Set<Int>) {
|
||||
value.forEach { output.writeInt(it) }
|
||||
}
|
||||
|
||||
override fun read(`in`: DataInput): Set<Int> {
|
||||
override fun read(input: DataInput): Set<Int> {
|
||||
val result = TIntHashSet()
|
||||
val stream = `in` as DataInputStream
|
||||
val stream = input as DataInputStream
|
||||
|
||||
while (stream.available() > 0) {
|
||||
val str = stream.readInt()
|
||||
@@ -239,27 +241,19 @@ object INT_SET_EXTERNALIZER : DataExternalizer<Set<Int>> {
|
||||
}
|
||||
}
|
||||
|
||||
object INT_EXTERNALIZER : DataExternalizer<Int> {
|
||||
override fun read(`in`: DataInput): Int = `in`.readInt()
|
||||
object IntExternalizer : DataExternalizer<Int> {
|
||||
override fun read(input: DataInput): Int = input.readInt()
|
||||
|
||||
override fun save(out: DataOutput, value: Int) {
|
||||
out.writeInt(value)
|
||||
override fun save(output: DataOutput, value: Int) {
|
||||
output.writeInt(value)
|
||||
}
|
||||
}
|
||||
|
||||
object FILE_EXTERNALIZER : DataExternalizer<File> {
|
||||
override fun read(`in`: DataInput): File = File(`in`.readUTF())
|
||||
object FileKeyDescriptor : KeyDescriptor<File> {
|
||||
override fun read(input: DataInput): File = File(input.readUTF())
|
||||
|
||||
override fun save(out: DataOutput, value: File) {
|
||||
out.writeUTF(value.canonicalPath)
|
||||
}
|
||||
}
|
||||
|
||||
object FILE_KEY_DESCRIPTOR : KeyDescriptor<File> {
|
||||
override fun read(`in`: DataInput): File = File(`in`.readUTF())
|
||||
|
||||
override fun save(out: DataOutput, value: File) {
|
||||
out.writeUTF(value.canonicalPath)
|
||||
override fun save(output: DataOutput, value: File) {
|
||||
output.writeUTF(value.canonicalPath)
|
||||
}
|
||||
|
||||
override fun getHashCode(value: File?): Int =
|
||||
|
||||
@@ -18,18 +18,18 @@ package org.jetbrains.kotlin.jps.incremental.storage
|
||||
|
||||
import com.intellij.openapi.util.io.FileUtil
|
||||
|
||||
data class IntPair(val first: Int, val second: Int) : Comparable<IntPair> {
|
||||
override fun compareTo(other: IntPair): Int {
|
||||
val firstCmp = first.compareTo(other.first)
|
||||
data class LookupHashPair(val nameHash: Int, val scopeHash: Int) : Comparable<LookupHashPair> {
|
||||
public constructor(name: String, scope: String) : this(name.hashCode(), scope.hashCode())
|
||||
|
||||
if (firstCmp != 0) return firstCmp
|
||||
override fun compareTo(other: LookupHashPair): Int {
|
||||
val nameCmp = nameHash.compareTo(other.nameHash)
|
||||
|
||||
return second.compareTo(other.second)
|
||||
if (nameCmp != 0) return nameCmp
|
||||
|
||||
return scopeHash.compareTo(other.scopeHash)
|
||||
}
|
||||
}
|
||||
|
||||
fun HashPair(a: Any, b: Any): IntPair = IntPair(a.hashCode(), b.hashCode())
|
||||
|
||||
class PathFunctionPair(
|
||||
public val path: String,
|
||||
public val function: String
|
||||
|
||||
@@ -18,9 +18,9 @@ package org.jetbrains.kotlin.jps.build
|
||||
|
||||
import com.intellij.testFramework.UsefulTestCase
|
||||
import org.jetbrains.kotlin.config.IncrementalCompilation
|
||||
import org.jetbrains.kotlin.jps.incremental.IncrementalCacheImpl
|
||||
import org.jetbrains.kotlin.jps.incremental.getCacheDirectoryName
|
||||
import org.jetbrains.kotlin.jps.incremental.getKotlinCacheVersion
|
||||
import org.jetbrains.kotlin.jps.incremental.storage.BasicMapsOwner
|
||||
import org.jetbrains.kotlin.utils.Printer
|
||||
import java.io.File
|
||||
|
||||
@@ -96,7 +96,7 @@ public abstract class AbstractIncrementalLazyCachesTest : AbstractIncrementalJps
|
||||
val fileNames = cacheDir.list() ?: arrayOf()
|
||||
val cacheFiles = fileNames
|
||||
.map { File(cacheDir, it) }
|
||||
.filter { it.isFile && it.extension == IncrementalCacheImpl.CACHE_EXTENSION }
|
||||
.filter { it.isFile && it.extension == BasicMapsOwner.CACHE_EXTENSION }
|
||||
return cacheFiles.map { it.name }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user