Complete Kotlin Migration 🚀 🚀 #12312
Conversation
|
Just remembered this: an issue to replace all usages of TextUtils.isEmpty with kotlin methods can be created now And remember to remove the wiki page about kotlin migration and Java code style |
|
As some JvmStatic and JvmName will have to stay, like on protected static methods, and someone will have to go through each case, it would be nice to add comments on the code explaining why each annotation was kept |
No longer necessary. API has been converted to Kotlin
No longer necessary. Anki-Android has been converted to Kotlin
No more Java in project PreferIsEmptyOverSizeCheck is now an IDE Lint
reason: No more Java in project * (Java)NonPublicNonStaticJavaFieldDetector: - Lint: NonPublicNonStaticFieldName * ConstantJavaFieldDetector: - Lint: ConstantFieldName
* Remove `InconsistentAnnotationUsage` + Tests * Remove unnecessary `@NonNull` and `@Nullable` annotations No longer needed as everything is in Kotlin
No longer necessary: all files are in Kotlin
32faa88 to
5418774
Compare
Added this in the PR, it actually goes further. If we remove all Android references from a class (of which This gets better, as translations are the major cause, and I plan for these to go from Android -> Rust at some point |
This comment was marked as resolved.
This comment was marked as resolved.
3cce257 to
479783c
Compare
This comment was marked as resolved.
This comment was marked as resolved.
|
I'd prefer this one was rebased - some of the changes ( |
Arthur-Milchior
left a comment
There was a problem hiding this comment.
Good to go as far as code change go. Maybe would love slightly more explanation, but not blocking
| JUnitNullAssertionDetector.ISSUE, | ||
| KotlinMigrationBrokenEmails.ISSUE, | ||
| KotlinMigrationFixLineBreaks.ISSUE, | ||
| PreferIsEmptyOverSizeCheck.ISSUE, |
There was a problem hiding this comment.
If it's in IDE, I guess it won't be detected by the linter we use in CI, or did I understand it wrongly?
Fine to remove it anyway, assuming that it'll still be seen by people when writing code
There was a problem hiding this comment.
This is code that we wrote ourselves for Java only. This has nothing to do with the IDE lint which will still run
There was a problem hiding this comment.
Oh, I missed that it was java only anyway. So clearly, no reason to keep it.
My remark about IDE was an answer to the commit message, if I recall correctly, mentionning taht IDE detects this error in Kotlin.
I wonder whether it's right that it's only detected by IDE and not by the CI, but at least that's not a new problem then
There was a problem hiding this comment.
Oh, I missed that it was java only anyway. So clearly, no reason to keep it.
My remark about IDE was an answer to the commit message, if I recall correctly, mentionning taht IDE detects this error in Kotlin.
I wonder whether it's right that it's only detected by IDE and not by the CI, but at least that's not a new problem then
| @@ -1,243 +0,0 @@ | |||
| #!/bin/bash | |||
There was a problem hiding this comment.
Oops, I forgot to give it a licence.
Too late.
It's strange to see it go. Probably the only part where I was proactive in this migration.
First time ever I create a tool whose usage was not either a single day or expected to be a long future, but with a clear end.
| AnnotationTarget.VALUE_PARAMETER, AnnotationTarget.EXPRESSION, | ||
| AnnotationTarget.FIELD, AnnotationTarget.PROPERTY, AnnotationTarget.LOCAL_VARIABLE, | ||
| AnnotationTarget.CONSTRUCTOR | ||
| AnnotationTarget.CONSTRUCTOR, AnnotationTarget.FILE |
There was a problem hiding this comment.
If I get this properly, it means that KotlinCleanup can now apply at the file level.
How does it relate to the plan to remove @JvmStatic. I assume it's because you are adding the @file: above. But I don't understand what is the point to applying this KotlinCleanup to current file. If it's just a todo list for the whole project, I don't believe annotation adds anything compared to just having a standard text file/wiki with a todo list
There was a problem hiding this comment.
It's a to-do that means we can't remove KotlinCleanup before we handle the issue.
We could then tie each instance of file:KotlinCleanup to an issue on GitHub, but it's probably best to do them in one PR per annotation rather than waste time on overheard.
JvmOverloads wasn't hard to remove
There was a problem hiding this comment.
I think things won't crash, ao LGTM
I'd prefer this one was rebased - some of the changes (JvmOverloads have introduced issues which I fixed in testing, and would want a targeted revert if more issues appear, rather than reverting it all)
Agreed. If I were to squash something, it would be the docs: plan X commits, implementer's choice.
My comments are just notes. Do resolve them at will
479783c to
9cee3c1
Compare
This is no longer necessary (besides the API and a few preferences, where a Java XML inflater is used to call the constructor) Fixed a couple of cleanup comments referring to the annotation
**TextUtils** Once TextUtils is removed from a class, we may have no references to Android A non-Android class does not need AndroidJUnit, speeding up tests **JvmField/JvmStatic** Now all files are Kotlin, we only need a few `JvmField/JvmStatic` annotations for APIs which use Java reflection, the rest can go.
We no longer have Java files in the project
9cee3c1 to
bc55f58
Compare
done, commit message for re-review |

Pull Request template
Purpose / Description
I wanted to get this one in for discussion - still blocked on a 3 files, which cause a CI break:
Fixes
We don't have an issue for this
Approach
@JvmOverloads@NonNull/@Nullable+ lint rule@JvmStaticand@JvmFieldHow Has This Been Tested?
CI only
Learning (optional, can help others)
Checklist
Please, go through these checks before submitting the PR.