diff --git a/idea/idea-native/src/org/jetbrains/kotlin/ide/konan/decompiler/KotlinNativeDecompiledFile.kt b/idea/idea-native/src/org/jetbrains/kotlin/ide/konan/decompiler/KotlinNativeDecompiledFile.kt index e7d0fb1f2fc..0700ba647cd 100644 --- a/idea/idea-native/src/org/jetbrains/kotlin/ide/konan/decompiler/KotlinNativeDecompiledFile.kt +++ b/idea/idea-native/src/org/jetbrains/kotlin/ide/konan/decompiler/KotlinNativeDecompiledFile.kt @@ -10,5 +10,7 @@ import org.jetbrains.kotlin.idea.decompiler.KotlinDecompiledFileViewProvider import org.jetbrains.kotlin.idea.decompiler.KtDecompiledFile import org.jetbrains.kotlin.idea.decompiler.textBuilder.DecompiledText -class KotlinNativeDecompiledFile(provider: KotlinDecompiledFileViewProvider, text: (VirtualFile) -> DecompiledText) : - KtDecompiledFile(provider, text) +class KotlinNativeDecompiledFile( + provider: KotlinDecompiledFileViewProvider, + text: (VirtualFile) -> DecompiledText +) : KtDecompiledFile(provider, text) diff --git a/idea/idea-native/src/org/jetbrains/kotlin/ide/konan/decompiler/KotlinNativeMetaBinary.kt b/idea/idea-native/src/org/jetbrains/kotlin/ide/konan/decompiler/KotlinNativeMetaBinary.kt index 7e9fc387aa4..c01b282e12b 100644 --- a/idea/idea-native/src/org/jetbrains/kotlin/ide/konan/decompiler/KotlinNativeMetaBinary.kt +++ b/idea/idea-native/src/org/jetbrains/kotlin/ide/konan/decompiler/KotlinNativeMetaBinary.kt @@ -2,13 +2,8 @@ * Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ +package org.jetbrains.kotlin.ide.konan.decompiler -package org.jetbrains.kotlin.ide.konan.decompiler; +import org.jetbrains.kotlin.idea.util.KotlinBinaryExtension -import org.jetbrains.kotlin.idea.util.KotlinBinaryExtension; - -public class KotlinNativeMetaBinary extends KotlinBinaryExtension { - public KotlinNativeMetaBinary() { - super(KotlinNativeMetaFileType.INSTANCE); - } -} +class KotlinNativeMetaBinary : KotlinBinaryExtension(KotlinNativeMetaFileType) diff --git a/idea/idea-native/src/org/jetbrains/kotlin/ide/konan/decompiler/KotlinNativeMetaFileType.kt b/idea/idea-native/src/org/jetbrains/kotlin/ide/konan/decompiler/KotlinNativeMetaFileType.kt new file mode 100644 index 00000000000..a2f81ae80a6 --- /dev/null +++ b/idea/idea-native/src/org/jetbrains/kotlin/ide/konan/decompiler/KotlinNativeMetaFileType.kt @@ -0,0 +1,22 @@ +/* + * Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.ide.konan.decompiler + +import com.intellij.openapi.fileTypes.FileType +import com.intellij.openapi.vfs.VirtualFile +import org.jetbrains.kotlin.library.KLIB_METADATA_FILE_EXTENSION + +object KotlinNativeMetaFileType : FileType { + override fun getName() = "KNM" + override fun getDescription() = "Kotlin/Native Metadata" + override fun getDefaultExtension() = KLIB_METADATA_FILE_EXTENSION + override fun getIcon(): Nothing? = null + override fun isBinary() = true + override fun isReadOnly() = true + override fun getCharset(file: VirtualFile, content: ByteArray): Nothing? = null + + const val STUB_VERSION = 2 +} diff --git a/idea/idea-native/src/org/jetbrains/kotlin/ide/konan/decompiler/KotlinNativeMetaFileTypeFactory.kt b/idea/idea-native/src/org/jetbrains/kotlin/ide/konan/decompiler/KotlinNativeMetaFileTypeFactory.kt new file mode 100644 index 00000000000..253a669bbd7 --- /dev/null +++ b/idea/idea-native/src/org/jetbrains/kotlin/ide/konan/decompiler/KotlinNativeMetaFileTypeFactory.kt @@ -0,0 +1,14 @@ +/* + * Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.ide.konan.decompiler + +import com.intellij.openapi.fileTypes.FileTypeConsumer +import com.intellij.openapi.fileTypes.FileTypeFactory + +class KotlinNativeMetaFileTypeFactory : FileTypeFactory() { + + override fun createFileTypes(consumer: FileTypeConsumer) = consumer.consume(KotlinNativeMetaFileType, KotlinNativeMetaFileType.defaultExtension) +} diff --git a/idea/idea-native/src/org/jetbrains/kotlin/ide/konan/decompiler/KotlinNativeMetadataDecompiler.kt b/idea/idea-native/src/org/jetbrains/kotlin/ide/konan/decompiler/KotlinNativeMetadataDecompiler.kt index 9fef4a0c29a..50caafe14c3 100644 --- a/idea/idea-native/src/org/jetbrains/kotlin/ide/konan/decompiler/KotlinNativeMetadataDecompiler.kt +++ b/idea/idea-native/src/org/jetbrains/kotlin/ide/konan/decompiler/KotlinNativeMetadataDecompiler.kt @@ -5,12 +5,8 @@ package org.jetbrains.kotlin.ide.konan.decompiler -import com.intellij.openapi.fileTypes.FileType -import com.intellij.openapi.fileTypes.FileTypeConsumer -import com.intellij.openapi.fileTypes.FileTypeFactory import com.intellij.openapi.vfs.VirtualFile import org.jetbrains.kotlin.backend.common.serialization.metadata.KlibMetadataVersion -import org.jetbrains.kotlin.library.KLIB_METADATA_FILE_EXTENSION import org.jetbrains.kotlin.library.metadata.KlibMetadataSerializerProtocol import org.jetbrains.kotlin.serialization.konan.NullFlexibleTypeDeserializer @@ -22,26 +18,8 @@ class KotlinNativeMetadataDecompiler : KotlinNativeMetadataDecompilerBase