Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Usage of explicitApi() #96

Merged
merged 83 commits into from
May 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
6a6a3d4
Added language=XML comment to enabled IDEA syntax highlighting
StefanOltmann May 2, 2024
00f72a5
TiffElement: Use OffsetComparator
StefanOltmann May 2, 2024
34888b9
IptcRecord: Prefer Comparable over Comparator
StefanOltmann May 2, 2024
685491f
Made TiffOutputField Comparable
StefanOltmann May 2, 2024
741b234
TiffElement: Prefer Comparable over Comparator
StefanOltmann May 2, 2024
0fb1c58
TiffOutputDirectory: fields are sorted where they need to be
StefanOltmann May 2, 2024
6d7c3a0
TiffWriterBase: Remove sorted()
StefanOltmann May 2, 2024
e8baa71
More idiomatic Kotlin
StefanOltmann May 2, 2024
71b986b
Use method references
StefanOltmann May 2, 2024
47e258d
RewritableSpaceRange is Comparable
StefanOltmann May 2, 2024
a349361
Create Pair objects with the infix "to"
StefanOltmann May 2, 2024
72215e4
Apply the sort directly in calcRewritableSpaceRanges()
StefanOltmann May 2, 2024
cec7f75
calcRewritableSpaceRanges(): If the input elements are sorted, the re…
StefanOltmann May 2, 2024
98eac5f
Added comment
StefanOltmann May 2, 2024
6405efa
Update to XMP Core v1.3.0
StefanOltmann May 2, 2024
09186f7
Update to XMP Core v1.3.0
StefanOltmann May 2, 2024
82a9629
Use method references
StefanOltmann May 2, 2024
21b2430
ByteReader methods moved to ByteReaderExtensions.kt
StefanOltmann May 2, 2024
04937ae
ByteWriter methods moved to ByteWriterExtensions.kt
StefanOltmann May 2, 2024
1ff98f2
Explicit visibility
StefanOltmann May 2, 2024
30e52e8
Explicit visibility
StefanOltmann May 2, 2024
eb80537
Set some explicit visibility
StefanOltmann May 2, 2024
1529176
Set some explicit visibility
StefanOltmann May 2, 2024
861738a
Set some explicit visibility
StefanOltmann May 2, 2024
3e910ba
Set some explicit visibility
StefanOltmann May 2, 2024
e25eab4
Set some explicit visibility
StefanOltmann May 2, 2024
561cb58
Set some explicit visibility
StefanOltmann May 2, 2024
e667a5c
Activate explicitApiWarning()
StefanOltmann May 2, 2024
e21cbdd
Changed to HTTPS
StefanOltmann May 4, 2024
24fa51a
Suppress
StefanOltmann May 4, 2024
e2ae972
Explicit visibility
StefanOltmann May 4, 2024
e141596
Explicit visibility
StefanOltmann May 4, 2024
351c098
Explicit visibility
StefanOltmann May 4, 2024
9badb32
Explicit visibility
StefanOltmann May 4, 2024
ff2e409
Explicit visibility
StefanOltmann May 4, 2024
2e886c4
Explicit visibility
StefanOltmann May 4, 2024
a3bfed8
Explicit types
StefanOltmann May 4, 2024
79c1e21
Explicit types
StefanOltmann May 4, 2024
88ac3a8
Explicit types
StefanOltmann May 4, 2024
0e8eef6
Explicit types
StefanOltmann May 4, 2024
97381c0
Explicit types
StefanOltmann May 4, 2024
e897b64
Explicit types
StefanOltmann May 4, 2024
51772b3
Explicit visibility
StefanOltmann May 4, 2024
86182e8
Explicit visibility
StefanOltmann May 4, 2024
b355ab5
Enabled explicitApi()
StefanOltmann May 4, 2024
625e54d
formatted
StefanOltmann May 4, 2024
fe17742
Removed debug println() calls
StefanOltmann May 4, 2024
7e73151
Fixed Detekt issue
StefanOltmann May 4, 2024
3190d6a
GPSInfo does not need private constructor
StefanOltmann May 4, 2024
85cdb48
Replaced null-check with safe-call
StefanOltmann May 4, 2024
44d6415
Removed redundant constructs
StefanOltmann May 4, 2024
bd37561
TiffOutputSet.findField() simplified
StefanOltmann May 4, 2024
6f710c8
Use safe-call to avoid !!
StefanOltmann May 4, 2024
86981e5
Usage of string template
StefanOltmann May 4, 2024
d12eac7
Code style improved
StefanOltmann May 4, 2024
3f70218
Lifted assignment out of if
StefanOltmann May 4, 2024
508bdbb
Replaced map.put
StefanOltmann May 4, 2024
560d0b1
Joined declaration and assignment
StefanOltmann May 4, 2024
3d2e037
Folded if
StefanOltmann May 4, 2024
b78f263
Fixed code style issues
StefanOltmann May 4, 2024
0c97f96
Fixed code style issues
StefanOltmann May 4, 2024
ab04a96
Fixed code style issues
StefanOltmann May 4, 2024
b77b586
Sorted
StefanOltmann May 4, 2024
f76864b
ByteConversions.kt reworked
StefanOltmann May 4, 2024
817c320
ByteConversions.kt reworked
StefanOltmann May 4, 2024
112b053
Made Byte.toUInt8() internal
StefanOltmann May 4, 2024
214ef50
Inlined some functions
StefanOltmann May 4, 2024
c9d8486
Inlined some functions
StefanOltmann May 4, 2024
90ffb21
Inlined some functions
StefanOltmann May 4, 2024
4f927f8
ByteArray.toRationals() improved
StefanOltmann May 4, 2024
cb7ea38
ByteConversions.kt improved
StefanOltmann May 4, 2024
b3ea0b5
ByteConversions.kt improved
StefanOltmann May 4, 2024
6478b3f
ByteConversions.kt improved
StefanOltmann May 4, 2024
3323f9a
ByteConversions.kt improved
StefanOltmann May 4, 2024
21eba6b
Changed signature
StefanOltmann May 4, 2024
b279ec8
Removed unused code
StefanOltmann May 4, 2024
71ed042
Tuned visibility
StefanOltmann May 4, 2024
e105efa
Tuned visibility
StefanOltmann May 4, 2024
3dcc2c1
Usage of new Kotlin Text HexFormat
StefanOltmann May 4, 2024
7491622
Fixed code style issues
StefanOltmann May 4, 2024
624c451
Bump version number
StefanOltmann May 4, 2024
0d0a554
Optimized imports
StefanOltmann May 4, 2024
40aa96a
Optimized imports
StefanOltmann May 4, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
/.idea/deploymentTargetDropDown.xml
/.idea/gradle.xml
/.idea/jarRepositories.xml
/.idea/kim.iml
/.idea/kotlinScripting.xml
/.idea/kotlinc.xml
/.idea/libraries/
Expand All @@ -23,5 +24,4 @@
/.idea/workspace.xml
/build/
/local.properties
/.idea/kim.iml
/src/commonTest/resources/com/ashampoo/kim/testdata/full/*.html
1,018 changes: 793 additions & 225 deletions .idea/inspectionProfiles/Project_Default.xml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ of Ashampoo Photo Organizer, which, in turn, is driven by user community feedbac
## Installation

```
implementation("com.ashampoo:kim:0.17.7")
implementation("com.ashampoo:kim:0.18")
```

For the targets `wasmJs` & `js` you also need to specify this:
Expand Down
15 changes: 9 additions & 6 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ repositories {
mavenCentral()
}

val productName = "Ashampoo Kim"
val productName: String = "Ashampoo Kim"

val ktorVersion: String = "2.3.10"
val xmpCoreVersion: String = "1.2.2"
val xmpCoreVersion: String = "1.3.0"
val dateTimeVersion: String = "0.5.0"
val testRessourcesVersion: String = "0.4.0"
val kotlinxIoVersion: String = "0.3.3"
Expand Down Expand Up @@ -115,6 +115,8 @@ dependencies {

kotlin {

explicitApi()

androidTarget {

compilations.all {
Expand Down Expand Up @@ -333,6 +335,7 @@ kotlin {
macosArm64Test.dependsOn(this)
}

@Suppress("UnusedPrivateMember", "UNUSED_VARIABLE") // False positive
val jsMain by sourceSets.getting {

dependsOn(commonMain)
Expand Down Expand Up @@ -360,7 +363,7 @@ kotlin {
}

// region Writing version.txt for GitHub Actions
val writeVersion = tasks.register("writeVersion") {
val writeVersion: TaskProvider<Task> = tasks.register("writeVersion") {
doLast {
File("build/version.txt").writeText(project.version.toString())
}
Expand Down Expand Up @@ -404,7 +407,7 @@ ext["signing.secretKeyRingFile"] = "secring.pgp"
ext["ossrhUsername"] = System.getenv("OSSRH_USERNAME")
ext["ossrhPassword"] = System.getenv("OSSRH_PASSWORD")

val javadocJar by tasks.registering(Jar::class) {
val javadocJar: TaskProvider<Jar> by tasks.registering(Jar::class) {
archiveClassifier.set("javadoc")
}

Expand Down Expand Up @@ -485,7 +488,7 @@ afterEvaluate {
}
}

fun getExtraString(name: String) = ext[name]?.toString()
fun getExtraString(name: String): String? = ext[name]?.toString()

publishing {
publications {
Expand Down Expand Up @@ -515,7 +518,7 @@ publishing {
licenses {
license {
name.set("The Apache License, Version 2.0")
url.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
url.set("https://www.apache.org/licenses/LICENSE-2.0.txt")
}
}

Expand Down
2 changes: 1 addition & 1 deletion detekt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,7 @@ style:
RedundantHigherOrderMapUsage:
active: true
RedundantVisibilityModifierRule:
active: true
active: false # explicitApi
ReturnCount:
active: false # results in bad style
max: 2
Expand Down
2 changes: 1 addition & 1 deletion examples/kim-java-sample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ repositories {
}

dependencies {
implementation 'com.ashampoo:kim:0.17.7'
implementation 'com.ashampoo:kim:0.18'
}

// Needed to make it work for the Gradle java plugin
Expand Down
2 changes: 1 addition & 1 deletion examples/kim-java-sample/src/main/java/Main.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import com.ashampoo.kim.Kim;
import com.ashampoo.kim.jvm.KimJvm;
import com.ashampoo.kim.format.ImageMetadata;
import com.ashampoo.kim.input.ByteReader;
import com.ashampoo.kim.input.JvmInputStreamByteReader;
import com.ashampoo.kim.jvm.KimJvm;
import com.ashampoo.kim.model.MetadataUpdate;
import com.ashampoo.kim.output.ByteArrayByteWriter;

Expand Down
2 changes: 1 addition & 1 deletion examples/kim-kotlin-jvm-sample/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ repositories {
}

dependencies {
implementation("com.ashampoo:kim:0.17.7")
implementation("com.ashampoo:kim:0.18")
}
1 change: 0 additions & 1 deletion examples/kim-kotlin-jvm-sample/src/main/kotlin/Main.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import com.ashampoo.kim.input.JvmInputStreamByteReader
import com.ashampoo.kim.input.KotlinIoSourceByteReader
import com.ashampoo.kim.input.use
import com.ashampoo.kim.jvm.readMetadata
import com.ashampoo.kim.kotlinx.KimKotlinx
import com.ashampoo.kim.model.MetadataUpdate
import com.ashampoo.kim.output.ByteArrayByteWriter
import com.ashampoo.kim.output.OutputStreamByteWriter
Expand Down
14 changes: 7 additions & 7 deletions src/androidMain/kotlin/com/ashampoo/kim/android/KimAndroid.kt
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,21 @@ import java.io.InputStream
/**
* Extra object to have a nicer API for Java projects
*/
object KimAndroid {
public object KimAndroid {

@JvmStatic
@Throws(ImageReadException::class)
fun readMetadata(inputStream: InputStream, length: Long): ImageMetadata? =
public fun readMetadata(inputStream: InputStream, length: Long): ImageMetadata? =
Kim.readMetadata(AndroidInputStreamByteReader(inputStream, length))

@JvmStatic
@Throws(ImageReadException::class)
fun readMetadata(path: String): ImageMetadata? =
public fun readMetadata(path: String): ImageMetadata? =
readMetadata(File(path))

@JvmStatic
@Throws(ImageReadException::class)
fun readMetadata(file: File): ImageMetadata? {
public fun readMetadata(file: File): ImageMetadata? {

check(file.exists()) { "File does not exist: $file" }

Expand All @@ -48,13 +48,13 @@ object KimAndroid {
}

@Throws(ImageReadException::class)
fun Kim.readMetadata(inputStream: InputStream, length: Long): ImageMetadata? =
public fun Kim.readMetadata(inputStream: InputStream, length: Long): ImageMetadata? =
KimAndroid.readMetadata(inputStream, length)

@Throws(ImageReadException::class)
fun Kim.readMetadata(path: String): ImageMetadata? =
public fun Kim.readMetadata(path: String): ImageMetadata? =
KimAndroid.readMetadata(path)

@Throws(ImageReadException::class)
fun Kim.readMetadata(file: File): ImageMetadata? =
public fun Kim.readMetadata(file: File): ImageMetadata? =
KimAndroid.readMetadata(file)
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import java.util.zip.Inflater

private const val ZLIB_BUFFER_SIZE: Int = 1024

actual fun compress(input: String): ByteArray {
internal actual fun compress(input: String): ByteArray {

val deflater = Deflater()
val inputBytes = input.toByteArray()
Expand All @@ -45,7 +45,7 @@ actual fun compress(input: String): ByteArray {
return outputStream.toByteArray()
}

actual fun decompress(byteArray: ByteArray): String {
internal actual fun decompress(byteArray: ByteArray): String {

val inflater = Inflater()
val outputStream = ByteArrayOutputStream()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import java.io.InputStream
* Provides way to read from Android ContentReolver that
* should work on all versions.
*/
open class AndroidInputStreamByteReader(
public open class AndroidInputStreamByteReader(
private val inputStream: InputStream,
override val contentLength: Long
) : ByteReader {
Expand Down Expand Up @@ -54,6 +54,6 @@ open class AndroidInputStreamByteReader(
buffer.slice(startIndex = 0, count = count)
}

override fun close() =
override fun close(): Unit =
inputStream.close()
}
10 changes: 5 additions & 5 deletions src/appleMain/kotlin/com/ashampoo/kim/apple/KimApple.kt
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ import platform.posix.memcpy
/**
* Extra object to be aligned with the other modules.
*/
object KimApple {
public object KimApple {

@Throws(ImageReadException::class)
fun readMetadata(data: NSData): ImageMetadata? =
public fun readMetadata(data: NSData): ImageMetadata? =
Kim.readMetadata(ByteArrayByteReader(convertDataToByteArray(data)))

@Throws(ImageReadException::class)
fun readMetadata(path: String): ImageMetadata? {
public fun readMetadata(path: String): ImageMetadata? {

val fileBytes = readFileAsByteArray(path) ?: return null

Expand All @@ -45,11 +45,11 @@ object KimApple {
}

@Throws(ImageReadException::class)
fun Kim.readMetadata(data: NSData): ImageMetadata? =
public fun Kim.readMetadata(data: NSData): ImageMetadata? =
KimApple.readMetadata(data)

@Throws(ImageReadException::class)
fun Kim.readMetadata(path: String): ImageMetadata? =
public fun Kim.readMetadata(path: String): ImageMetadata? =
KimApple.readMetadata(path)

@OptIn(ExperimentalForeignApi::class)
Expand Down
20 changes: 10 additions & 10 deletions src/commonMain/kotlin/com/ashampoo/kim/Kim.kt
Original file line number Diff line number Diff line change
Expand Up @@ -45,21 +45,21 @@ import com.ashampoo.kim.model.MetadataUpdate
import com.ashampoo.kim.output.ByteArrayByteWriter
import com.ashampoo.kim.output.ByteWriter

object Kim {
public object Kim {

var underUnitTesting: Boolean = false
internal var underUnitTesting: Boolean = false

@kotlin.jvm.JvmStatic
@Throws(ImageReadException::class)
fun readMetadata(bytes: ByteArray): ImageMetadata? =
public fun readMetadata(bytes: ByteArray): ImageMetadata? =
if (bytes.isEmpty())
null
else
readMetadata(ByteArrayByteReader(bytes))

@kotlin.jvm.JvmStatic
@Throws(ImageReadException::class)
fun readMetadata(
public fun readMetadata(
byteReader: ByteReader
): ImageMetadata? = tryWithImageReadException {

Expand Down Expand Up @@ -93,7 +93,7 @@ object Kim {
*/
@kotlin.jvm.JvmStatic
@Throws(ImageReadException::class)
fun extractMetadataBytes(
public fun extractMetadataBytes(
byteReader: ByteReader
): Pair<ImageFormat?, ByteArray> = tryWithImageReadException {

Expand All @@ -116,7 +116,7 @@ object Kim {

@kotlin.jvm.JvmStatic
@Throws(ImageReadException::class)
fun extractPreviewImage(
public fun extractPreviewImage(
byteReader: ByteReader
): ByteArray? = tryWithImageReadException {

Expand Down Expand Up @@ -166,7 +166,7 @@ object Kim {
*/
@kotlin.jvm.JvmStatic
@Throws(ImageWriteException::class)
fun update(
public fun update(
bytes: ByteArray,
update: MetadataUpdate
): ByteArray = tryWithImageWriteException {
Expand All @@ -192,11 +192,11 @@ object Kim {
*/
@kotlin.jvm.JvmStatic
@Throws(ImageWriteException::class)
fun update(
public fun update(
byteReader: ByteReader,
byteWriter: ByteWriter,
update: MetadataUpdate
) = tryWithImageWriteException {
): Unit = tryWithImageWriteException {

val headerBytes = byteReader.readBytes(ImageFormat.REQUIRED_HEADER_BYTE_COUNT_FOR_DETECTION)

Expand All @@ -216,7 +216,7 @@ object Kim {

@kotlin.jvm.JvmStatic
@Throws(ImageWriteException::class)
fun updateThumbnail(
public fun updateThumbnail(
bytes: ByteArray,
thumbnailBytes: ByteArray
): ByteArray = tryWithImageWriteException {
Expand Down
Loading
Loading