From 59855baf7d591eb17b437c4bd61223b64bd14e38 Mon Sep 17 00:00:00 2001 From: Alexander Udalov Date: Mon, 16 Feb 2015 22:25:09 +0300 Subject: [PATCH] Revert "Fixed compilation. Some class files generated by kotlinc may have no annotation (that should be fixed later)." This reverts commit aa412c72fcfe4ec90d4106bdf157737b7015a070. This workaround is not needed anymore after the fix in c24688c Original commit: 02171218145f6c8d31b03a53fde07d2a7da21f41 --- .../jetbrains/kotlin/jps/build/KotlinBuilder.kt | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/jps/jps-plugin/src/org/jetbrains/kotlin/jps/build/KotlinBuilder.kt b/jps/jps-plugin/src/org/jetbrains/kotlin/jps/build/KotlinBuilder.kt index fd61616281f..7bdca13a063 100644 --- a/jps/jps-plugin/src/org/jetbrains/kotlin/jps/build/KotlinBuilder.kt +++ b/jps/jps-plugin/src/org/jetbrains/kotlin/jps/build/KotlinBuilder.kt @@ -264,7 +264,7 @@ public class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR if (!generatedClass.outputFile.getName().endsWith(PackageClassUtils.PACKAGE_CLASS_NAME_SUFFIX + ".class")) return emptySet() val kotlinClass = generatedClass.outputClass - if (kotlinClass == null || !kotlinClass.getClassHeader().isCompatiblePackageFacadeKind()) return emptySet() + if (!kotlinClass.getClassHeader().isCompatiblePackageFacadeKind()) return emptySet() val classInternalName = JvmClassName.byClassId(kotlinClass.getClassId()).getInternalName() val oldClassSources = previousMappings.getClassSources(previousMappings.getName(classInternalName)) @@ -288,14 +288,13 @@ public class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR for (generatedClass in generatedClasses) { val outputFile = generatedClass.outputFile val outputClass = generatedClass.outputClass - val outputClassContents = if (outputClass != null) outputClass.getFileContents() else outputFile.readBytes() // For package facade classes: we need to report all source files for it, not only currently compiled val allSourcesIncludingOld = getOldSourceFiles(generatedClass, previousMappings) + generatedClass.sourceFiles callback.associate(FileUtil.toSystemIndependentName(outputFile.getAbsolutePath()), allSourcesIncludingOld.map { FileUtil.toSystemIndependentName(it.getAbsolutePath()) }, - ClassReader(outputClassContents) + ClassReader(outputClass.getFileContents()) ) } @@ -321,10 +320,7 @@ public class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR var recompilationDecision = DO_NOTHING for (generatedClass in generatedClasses) { - val outputClass = generatedClass.outputClass - if (outputClass == null) continue - - val newDecision = incrementalCaches[generatedClass.target]!!.saveFileToCache(generatedClass.sourceFiles, outputClass) + val newDecision = incrementalCaches[generatedClass.target]!!.saveFileToCache(generatedClass.sourceFiles, generatedClass.outputClass) recompilationDecision = recompilationDecision.merge(newDecision) } @@ -518,5 +514,6 @@ private class GeneratedJvmClass ( sourceFiles: Collection, outputFile: File ) : GeneratedFile(target, sourceFiles, outputFile) { - val outputClass = LocalFileKotlinClass.create(outputFile) -} \ No newline at end of file + val outputClass = LocalFileKotlinClass.create(outputFile).sure( + "Couldn't load KotlinClass from $outputFile; it may happen because class doesn't have valid Kotlin annotations") +}