example Java class with `@NotNull` annotation

instrumentation-debugging
Jakub Chrzanowski 2 months ago
parent 4db01633d9
commit 60bb09c852
No known key found for this signature in database
GPG Key ID: C39095BFD769862E

@ -0,0 +1,18 @@
package org.jetbrains.plugins.template.services;
import com.intellij.openapi.components.Service;
import org.jetbrains.annotations.NotNull;
@Service(Service.Level.PROJECT)
public final class JavaService {
public JavaService() {
System.out.println("FOO1");
getRandomNumber(null);
}
public String getRandomNumber(@NotNull String text) {
return text.replaceAll("[^0-9]", ""); // set a breakpoint here and debug the `runIde` task
}
}

@ -1,12 +1,17 @@
package org.jetbrains.plugins.template.listeners
import com.intellij.openapi.application.ApplicationActivationListener
import com.intellij.openapi.components.service
import com.intellij.openapi.diagnostic.thisLogger
import com.intellij.openapi.wm.IdeFrame
import org.jetbrains.plugins.template.services.JavaService
internal class MyApplicationActivationListener : ApplicationActivationListener {
override fun applicationActivated(ideFrame: IdeFrame) {
thisLogger().warn("Don't forget to remove all non-needed sample code files with their corresponding registration entries in `plugin.xml`.")
val service = ideFrame.project?.service<JavaService>()
println("service = ${service}")
}
}

Loading…
Cancel
Save