mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-03-22 06:50:54 +07:00
IDEA-368449 Modify NPE message in console for Java 30th anniversary - fixes for review IJ-CR-157699
(cherry picked from commit 7d4bedd084b8e0f4ea21f2d604f42303fdc08513) GitOrigin-RevId: cf7435633522f9d259608c07869f4fb56dbe41c3
This commit is contained in:
committed by
intellij-monorepo-bot
parent
b809011bac
commit
f7f0e69ecc
@@ -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<PsiClass?>,
|
||||
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)
|
||||
|
||||
@@ -427,6 +427,7 @@
|
||||
<virtualFileSystem implementationClass="com.intellij.openapi.vfs.impl.jrt.JrtFileSystemImpl" key="jrt" physical="true"/>
|
||||
|
||||
<registryKey key="use.jdk.vendor.in.suggested.jdk.name" defaultValue="true" description="Include Vendor name in suggested SDK names"/>
|
||||
<registryKey key="java.exceptions.anniversary.banner" defaultValue="[on*|off|force]" description="Show the java anniversary banner in the console"/>
|
||||
|
||||
<sdkType implementation="com.intellij.openapi.projectRoots.impl.JavaSdkImpl"/>
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user