@VisibleForTesting Annotation
The com.intellij.openapi.editor.LogicalPosition class has getColumn() method.
From the plugin, I can access this method in 2024.* IDE versions very well without any warnings. When I access in 2023.* version, I face “NoSuchMethodError”.
By checking out the class, I could see that the method is annotated with @VisibleForTesting annotation and the LogicalPosition class exposes a public variable named column. By using the variable instead of method, I can get past the issue and access the column information.
A few questions…
1.) I guess this type of method/class unavailability issue is common and would've happened for users. Do you have any suggestions to get to know this well ahead Or, Do you think checking out the definition of classes before using helps resolve this issue? In that case, I wonder about the purpose of the annotation and its restrictions. Is there any information on VisibleForTesting annotation?
2.) If I try to check out a class definition, I can trace only at a higher level. All I can see is the .class file and I couldn't access the source. The “Download Documentation” does not download anything. When tried to Download Source of the .class file, it searches external website for the source, prompts me to choose the right app-client.jar. When chosen, it says “Sources for app-client.jar not found”. Is there any obvious right way to view the source of Open API classes from IDE?
Please sign in to leave a comment.
Hi,
Regarding 2), this sounds like a bug. Please create an issue at https://youtrack.jetbrains.com/issues/IJPL with Subsystem: DevKit and provide more details.
Regarding 1), we will get back to it. Please be patient.
Regarding 1), in this particular case, the getters were added for testing purpose only. Elements annotated with
@VisibleForTesting
should be considered as non-visible and must never be used by plugins. This annotation has the class retention policy, so it should be available in the compiled code and the warning should be shown when you try to use it.1. Thanks for getting back on this. I would like to share an update in this regard. Running the PluginVerifier helps uncover the compatibility problems like this. Similar to this method, the verifier highlighted one more compatibility problem (editor.getVirtualFile() which is a default method and said to be not available in older versions). I'm coming to a conclusion that I'll have to run the verifier after the build.
By the way, I started developing the plugin in 2024.2 IDE version. I was not and am not shown a warning in 2024 and 2023 as below.
2. I'll create one.