-
Notifications
You must be signed in to change notification settings - Fork 30
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
Markdown: allow the use of an ImageCache with MarkdownComponent #114
base: master
Are you sure you want to change the base?
Markdown: allow the use of an ImageCache with MarkdownComponent #114
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this change should be backwards compatible.
It's not, that's why we have the explicit API file because otherwise it might not be obvious:
The constructor with the signature (Ljava/lang/String;Lgg/essential/elementa/markdown/MarkdownConfig;FLgg/essential/elementa/font/FontProvider;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
is gone now.
That is the constructor which Kotlin calls when you make use of default arguments (the final I
is a bit mask telling the constructor which arguments were passed (so it can differentiate between not-passed and passed-null) and the final DefaultConstructorMarker
is used to differentiate the constructor from an identical one with a real final I
argument (otherwise such a constructor would conflict with the Kotlin-generated one).
To add an argument to a constructor which has optional arguments, you need to take the exact constructor, make it a secondary constructor so it's still there, and then create a new primary one that has the extra argument.
src/main/kotlin/gg/essential/elementa/markdown/MarkdownComponent.kt
Outdated
Show resolved
Hide resolved
611f612
to
07d1a3f
Compare
07d1a3f
to
8144287
Compare
Thank you for the explanation, I wasn't aware this is how kotlin handles constructors. I think I have fixed it now. |
This pull request allows the use of an
ImageCache
withMarkdownComponent
, this change should be backwards compatible.