What does JetBrains prefer to see from Plugin Verifier: Deprecated or Experimental?
Answered
I give up and defer to your preferences:
/**
* @deprecated please use {@link HyperlinkLabel#setTextWithHyperlink(String) with "beforeLinkText<hyperlink>linkText</hyperlink>" instead}
*/
@Deprecated
public void setHyperlinkText(@LinkLabel String beforeLinkText, @LinkLabel String linkText, @LinkLabel String afterLinkText) {
doSetHyperLinkText(beforeLinkText, linkText, afterLinkText);
}
@ApiStatus.Experimental
public void setTextWithHyperlink(@NotNull @LinkLabel String text) {
int startTagOffset = text.indexOf(startTag);
if (startTagOffset == -1){
LOG.error("Text \"" + text + "\" doesn't contain <hyperlink> tag");
return;
}
int finishTagOffset = text.indexOf(finishTag);
if (finishTagOffset == -1) {
LOG.error("Text \"" + text + "\" doesn't contain </hyperlink> tag");
return;
}
String beforeLinkText = StringUtil.unescapeXmlEntities(text.substring(0, startTagOffset));
String linkText = StringUtil.unescapeXmlEntities(text.substring(startTagOffset + startTag.length(), finishTagOffset));
String afterLinkText = StringUtil.unescapeXmlEntities(text.substring(finishTagOffset + finishTag.length()));
doSetHyperLinkText(beforeLinkText, linkText, afterLinkText);
}
I aim to please, within the constraints provided.
Please sign in to leave a comment.
Mind you, both these functions are thin layers, through doSetHyperlinkText(), wrapping the implementation that has not changed since 2017.
IMHO, both should be left in the code, with the annotations removed, but that's just me.
Here is the other thin wrapper:
Experimental API status for
com.intellij.ui.HyperlinkLabel#setTextWithHyperlink
has been removed some time ago in06dfe643c812960b7f48937e1edcbcfc93287641
and is safe to use.Thank you for pointing this out. I am now using intellij-community latest sources when I am working out the plugin verifier results to make sure I am looking at up to date sources.
BTW, the comment for the deprecated method should be updated to use < and > instead of <> for the hyperlink.
Otherwise the documentation in read mode looks confusing. I didn't clue into the issue immediately.
instead of:
BTW, is there a reason to deprecate the 3 argument version? In my code I wind up having to code prefix+"<hyperlink>+message+"</hyperlink>+suffix, just to have the method parse it back to 3 arguments.
Thanks, I'll fix that javadoc issue. If you have suggestions on how to improve API, best way is to submit PR as described here https://plugins.jetbrains.com/docs/intellij/platform-contributions.html#submit-a-patch so responsible developer can directly comment on it.
Yann,
Thank you for the link and the PR suggestion but I used to submit PR's, until a one line patch to fix a bug that broke my plugin settings savings, which was introduced in an EAP release, was ignored for many, many months and releases, until finally getting fixed. https://youtrack.jetbrains.com/issue/IDEA-184506. I reported the bug immediately and submitted a PR about two weeks later. What good did that do? I still had users complain about a broken plugin for months and had to resort to patching JetBrains IDEs for my use because the bug broke what I needed for my work.
That experience made me realize that it is a crap-shoot depending on the developer in charge. Some are just amazing to deal with, others are good, some are a complete waste of time and I might as well find my own workaround, because I will waste a lot of time on communications without making any progress. In the end, I will have to find the workaround anyway, so why waste my time going through "official" channels?
Here is a more recent example of exactly the same experience: ProjectPlainTextFileTypeManager.getFiles() is deprecated, replacement PersistentFileSetManager.getFiles() is package private, after a long tirade on explaining the simple problem, it was kicked down the road. Are you taking bets on how long it will take for the issue to be addressed in FileTypeIndex module? I am not, and even if it is fixed, I still have to find a workaround for all the intervening releases.
Like the french say: Plus ça change, plus ça reste le même.