Use platform-independent line separator in jspecify tests handler
This commit is contained in:
+1
-1
@@ -30,7 +30,7 @@ class JspecifyDiagnosticComplianceHandler(testServices: TestServices) : ClassicF
|
|||||||
val jspecifyMark = diagnosticsToJspecifyMarks.getValue(jspecifyMode)[metaInfo.diagnostic.factory] ?: continue
|
val jspecifyMark = diagnosticsToJspecifyMarks.getValue(jspecifyMode)[metaInfo.diagnostic.factory] ?: continue
|
||||||
val fileLines = ktFile.text.lines()
|
val fileLines = ktFile.text.lines()
|
||||||
val fileLinePositions =
|
val fileLinePositions =
|
||||||
fileLines.map { it.length }.runningReduce { sumLength, length -> sumLength + length + System.lineSeparator().length }
|
fileLines.map { it.length }.runningReduce { sumLength, length -> sumLength + length + 1 }
|
||||||
val lineIndexToPasteJspecifyMark = fileLinePositions.indexOfLast { it < metaInfo.start }
|
val lineIndexToPasteJspecifyMark = fileLinePositions.indexOfLast { it < metaInfo.start }
|
||||||
val positionToPasteJspecifyMark = fileLinePositions[lineIndexToPasteJspecifyMark]
|
val positionToPasteJspecifyMark = fileLinePositions[lineIndexToPasteJspecifyMark]
|
||||||
val offset = fileLines[lineIndexToPasteJspecifyMark + 1].takeWhile { it == ' ' }.length
|
val offset = fileLines[lineIndexToPasteJspecifyMark + 1].takeWhile { it == ' ' }.length
|
||||||
|
|||||||
+1
-1
@@ -14,6 +14,6 @@ class JspecifyMarksCleanupPreprocessor(testServices: TestServices) : SourceFileP
|
|||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
private val jspecifyMarks = diagnosticsToJspecifyMarks.values.map { it.values }.flatten().joinToString("|")
|
private val jspecifyMarks = diagnosticsToJspecifyMarks.values.map { it.values }.flatten().joinToString("|")
|
||||||
private val regexToCleanup = Regex("""[ ]*// ($jspecifyMarks)(, ($jspecifyMarks))*${System.lineSeparator()}""")
|
private val regexToCleanup = Regex("""[ ]*// ($jspecifyMarks)(, ($jspecifyMarks))*\n""")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -87,8 +87,8 @@ abstract class AbstractForeignAnnotationsTestBase : AbstractKotlinCompilerTest()
|
|||||||
}
|
}
|
||||||
|
|
||||||
forTestsMatching("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/*") {
|
forTestsMatching("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/jspecify/*") {
|
||||||
// useFrontendHandlers(::JspecifyDiagnosticComplianceHandler)
|
useFrontendHandlers(::JspecifyDiagnosticComplianceHandler)
|
||||||
// useSourcePreprocessor(::JspecifyMarksCleanupPreprocessor)
|
useSourcePreprocessor(::JspecifyMarksCleanupPreprocessor)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ object MockLibraryUtil {
|
|||||||
add("-d")
|
add("-d")
|
||||||
add(classesDir.path)
|
add(classesDir.path)
|
||||||
|
|
||||||
if (useJava9) {
|
if (useJava9 && extraModulepath.isNotEmpty()) {
|
||||||
add("--module-path")
|
add("--module-path")
|
||||||
add(extraModulepath.joinToString(File.pathSeparator))
|
add(extraModulepath.joinToString(File.pathSeparator))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user