Skip to content

Commit 7a219dc

Browse files
authored
Merge pull request #725 from Kotlin/rename-supported-format-classes
File and URL names are used in JDK / suggested in IDE auto-import. Rename our classes to avoid conflict
2 parents 53b996e + 6dac9cd commit 7a219dc

File tree

3 files changed

+10
-10
lines changed
  • core
    • generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/io
    • src/main/kotlin/org/jetbrains/kotlinx/dataframe/io
  • dataframe-openapi/src/main/kotlin/org/jetbrains/kotlinx/dataframe/io

3 files changed

+10
-10
lines changed

core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/io/guess.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ public sealed interface SupportedFormat {
3535
public sealed interface SupportedFormatSample {
3636

3737
@JvmInline
38-
public value class File(public val sampleFile: java.io.File) : SupportedFormatSample
38+
public value class DataFile(public val sampleFile: File) : SupportedFormatSample
3939

4040
@JvmInline
41-
public value class URL(public val sampleUrl: java.net.URL) : SupportedFormatSample
41+
public value class DataUrl(public val sampleUrl: URL) : SupportedFormatSample
4242

4343
@JvmInline
4444
public value class PathString(public val samplePath: String) : SupportedFormatSample
@@ -138,13 +138,13 @@ internal fun guessFormatForExtension(
138138
internal fun guessFormat(
139139
file: File,
140140
formats: List<SupportedFormat> = supportedFormats,
141-
sample: SupportedFormatSample.File? = SupportedFormatSample.File(file),
141+
sample: SupportedFormatSample.DataFile? = SupportedFormatSample.DataFile(file),
142142
): SupportedFormat? = guessFormatForExtension(file.extension.lowercase(), formats, sample = sample)
143143

144144
internal fun guessFormat(
145145
url: URL,
146146
formats: List<SupportedFormat> = supportedFormats,
147-
sample: SupportedFormatSample.URL? = SupportedFormatSample.URL(url),
147+
sample: SupportedFormatSample.DataUrl? = SupportedFormatSample.DataUrl(url),
148148
): SupportedFormat? = guessFormatForExtension(url.path.substringAfterLast("."), formats, sample = sample)
149149

150150
internal fun guessFormat(

core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/io/guess.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ public sealed interface SupportedFormat {
3535
public sealed interface SupportedFormatSample {
3636

3737
@JvmInline
38-
public value class File(public val sampleFile: java.io.File) : SupportedFormatSample
38+
public value class DataFile(public val sampleFile: File) : SupportedFormatSample
3939

4040
@JvmInline
41-
public value class URL(public val sampleUrl: java.net.URL) : SupportedFormatSample
41+
public value class DataUrl(public val sampleUrl: URL) : SupportedFormatSample
4242

4343
@JvmInline
4444
public value class PathString(public val samplePath: String) : SupportedFormatSample
@@ -138,13 +138,13 @@ internal fun guessFormatForExtension(
138138
internal fun guessFormat(
139139
file: File,
140140
formats: List<SupportedFormat> = supportedFormats,
141-
sample: SupportedFormatSample.File? = SupportedFormatSample.File(file),
141+
sample: SupportedFormatSample.DataFile? = SupportedFormatSample.DataFile(file),
142142
): SupportedFormat? = guessFormatForExtension(file.extension.lowercase(), formats, sample = sample)
143143

144144
internal fun guessFormat(
145145
url: URL,
146146
formats: List<SupportedFormat> = supportedFormats,
147-
sample: SupportedFormatSample.URL? = SupportedFormatSample.URL(url),
147+
sample: SupportedFormatSample.DataUrl? = SupportedFormatSample.DataUrl(url),
148148
): SupportedFormat? = guessFormatForExtension(url.path.substringAfterLast("."), formats, sample = sample)
149149

150150
internal fun guessFormat(

dataframe-openapi/src/main/kotlin/org/jetbrains/kotlinx/dataframe/io/OpenApi.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,9 @@ public class OpenApi : SupportedCodeGenerationFormat {
7575
override fun acceptsSample(sample: SupportedFormatSample): Boolean = try {
7676
when (sample) {
7777
is SupportedFormatSample.DataString -> isOpenApiStr(sample.sampleData)
78-
is SupportedFormatSample.File -> isOpenApi(sample.sampleFile)
78+
is SupportedFormatSample.DataFile -> isOpenApi(sample.sampleFile)
7979
is SupportedFormatSample.PathString -> isOpenApi(sample.samplePath)
80-
is SupportedFormatSample.URL -> isOpenApi(sample.sampleUrl)
80+
is SupportedFormatSample.DataUrl -> isOpenApi(sample.sampleUrl)
8181
}
8282
} catch (_: Exception) {
8383
false

0 commit comments

Comments
 (0)