diff --git a/java/execution/impl/src/com/intellij/execution/filters/JavaExceptionFilter.kt b/java/execution/impl/src/com/intellij/execution/filters/JavaExceptionFilter.kt index 104e47ea836f..df46dee89b73 100644 --- a/java/execution/impl/src/com/intellij/execution/filters/JavaExceptionFilter.kt +++ b/java/execution/impl/src/com/intellij/execution/filters/JavaExceptionFilter.kt @@ -6,19 +6,26 @@ import com.intellij.codeInsight.hints.presentation.PresentationRenderer import com.intellij.execution.filters.Filter.ResultItem import com.intellij.execution.impl.InlayProvider import com.intellij.icons.AllIcons +import com.intellij.ide.util.PropertiesComponent import com.intellij.openapi.editor.Editor import com.intellij.openapi.editor.EditorCustomElementRenderer import com.intellij.openapi.editor.Inlay import com.intellij.openapi.util.registry.Registry +import com.intellij.psi.CommonClassNames import com.intellij.psi.PsiClass import java.time.LocalDate +private const val JAVA_EXCEPTIONS_ANNIVERSARY_BANNER_SHOWN = "java.exceptions.anniversary.banner.shown" + class JavaExceptionFilter : JvmExceptionOccurrenceFilter { override fun applyFilter( exceptionClassName: String, classes: MutableList, exceptionStartOffset: Int, ): ResultItem? { + if (exceptionClassName != CommonClassNames.JAVA_LANG_NULL_POINTER_EXCEPTION) { + return null + } with(Registry.get("java.exceptions.anniversary.banner")) { if (isOptionEnabled("off")) { return null @@ -29,6 +36,11 @@ class JavaExceptionFilter : JvmExceptionOccurrenceFilter { if (LocalDate.now() !in startDate..endDate) { return null } + val counter = PropertiesComponent.getInstance().getInt(JAVA_EXCEPTIONS_ANNIVERSARY_BANNER_SHOWN, 0) + if (counter > 2) { + return null + } + PropertiesComponent.getInstance().setValue(JAVA_EXCEPTIONS_ANNIVERSARY_BANNER_SHOWN, counter + 1, 0) } } return CreateExceptionBreakpointResult(exceptionStartOffset, exceptionStartOffset + exceptionClassName.length) diff --git a/java/java-impl/src/META-INF/JavaPlugin.xml b/java/java-impl/src/META-INF/JavaPlugin.xml index b225c1c7b136..d923e511a03d 100644 --- a/java/java-impl/src/META-INF/JavaPlugin.xml +++ b/java/java-impl/src/META-INF/JavaPlugin.xml @@ -427,6 +427,7 @@ + diff --git a/platform/util/resources/misc/registry.properties b/platform/util/resources/misc/registry.properties index 63db04adf8d9..3974745f1e90 100644 --- a/platform/util/resources/misc/registry.properties +++ b/platform/util/resources/misc/registry.properties @@ -701,9 +701,6 @@ debugger.hotswap.floating.toolbar.description=Show a floating toolbar with a hot debugger.hotswap.show.ide.popup=false debugger.hotswap.show.ide.popup.description=Show hot swap successful notification as a popup, or regular notification otherwise -java.exceptions.anniversary.banner=[on*|off|force] -java.exceptions.anniversary.banner.description=Show the java anniversary banner in the console - index.run.configuration.jre=false index.run.configuration.jre.restartRequired=true index.run.configuration.jre.description=Index jre specified in run configuration for goto navigation etc.