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

Move to Kotlin #76

Merged
merged 20 commits into from
Jan 20, 2022
Merged

Move to Kotlin #76

merged 20 commits into from
Jan 20, 2022

Conversation

erwinw
Copy link
Member

@erwinw erwinw commented Jan 19, 2022

Move to Kotlin

Move the existing Java implementation to Kotlin

Breaking changes: any breaking changes EXCEPT one: fixing the package for JacksonParserFactory (it was mistakenly put as .guice instead of .jackson).

Comment on lines 57 to 58
# v2.7.0 is giving issues
uses: cycjimmy/semantic-release-action@v2.6.0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What issues? I'm using it without issue in jwt-kt 🤔

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As you can see in this run, it fails without any useful info.

Copy link
Contributor

@andersfischernielsen andersfischernielsen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Initial quick look looks good to me - this is quite a big one to review, so I'm trusting you semi-blindly here @erwinw ❤️‍🔥

build.gradle Outdated Show resolved Hide resolved
Comment on lines 20 to 22
// Static properties can't change. No callbacks.
override fun addCallback(callback: Runnable) {}
override fun removeAllCallbacks() {}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add this comment so it's visible in engineers' editor? Unsure if this is JavaDoc or how IntelliJ pulls out that information - WDYT? Could limit engineers being unpleasantly surprised

@erwinw erwinw marked this pull request as ready for review January 19, 2022 14:17
@erwinw erwinw requested review from a team and removed request for a team January 19, 2022 14:17
@erwinw
Copy link
Member Author

erwinw commented Jan 19, 2022

Initial quick look looks good to me - this is quite a big one to review, so I'm trusting you semi-blindly here @erwinw ❤️‍🔥

Trust is good, testing is better -- I've tested this locally by using it with JVM Commons and building & testing it.

Copy link
Contributor

@andriygg andriygg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job, E!

}

repositories {
mavenLocal()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it worth to include only jvm-commons here, like:

        mavenLocal {
            content {
                // this repository *only* contains artifacts with group "pleo-io.jvm-commons"
                includeGroup "pleo-io.jvm-commons"
            }
        }

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Eh no; Prop is a public repo and does not rely on JVM Commons!

val parser = parserFactory.createParserForType(type)
try {
val annotation = parameter.getAnnotation(Default::class.java)
println("ANNOTATION: $annotation")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this guy should be removed I think

val parameter = parameters[dependency.parameterIndex]
PropResult(parameterToProp(parameter, key))
} catch (ex: RuntimeException) {
PropResult(ex)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

interesting, how does it work if PropResult will be an exception?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In a follow-up PR I'm replacing this with the more idiomatic Kotlin Result.

.map(Default::value)
.map(parser::apply)
.orElse(null)
println("DEF: $defaultValue")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, and this one


private fun getNamedAnnotationValue(annotations: List<Annotation>, key: Key<*>): String =
annotations.mapNotNull(::annotationValueIfNamed).lastOrNull().also {
println("?? $it")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one more print to be either removed or logger used

is com.google.inject.name.Named -> annotation.value
else -> null
}?.ifEmpty { null }.also {
println(">> $it")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

this.error = error
}

fun isError() = error != null
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, now I see how it works! 👍

@erwinw erwinw merged commit f506e74 into master Jan 20, 2022
@erwinw erwinw deleted the chore/move-to-kotlin branch January 20, 2022 10:11
This was referenced Jan 20, 2022
@github-actions
Copy link

🎉 This PR is included in version 4.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

None yet

3 participants