From 86216d72311a082bd48019bb899d2c3eae07793e Mon Sep 17 00:00:00 2001 From: Dmitry Avdeev Date: Thu, 7 Oct 2021 17:38:10 +0300 Subject: [PATCH] IJP-1077 Inlay hints: new settings UI java annotations GitOrigin-RevId: 41b45d5bda07dccc15869e8269f58b7d6a3e9120 --- .../annotation.hints/external.annotations.java | 1 + .../annotation.hints/inferred.annotations.java | 1 + .../intellij/codeInsight/hints/AnnotationInlayProvider.kt | 5 +++++ java/openapi/resources/messages/JavaBundle.properties | 2 ++ 4 files changed, 9 insertions(+) create mode 100644 java/java-impl/resources/inlayProviders/annotation.hints/external.annotations.java create mode 100644 java/java-impl/resources/inlayProviders/annotation.hints/inferred.annotations.java diff --git a/java/java-impl/resources/inlayProviders/annotation.hints/external.annotations.java b/java/java-impl/resources/inlayProviders/annotation.hints/external.annotations.java new file mode 100644 index 000000000000..9841c61cdc97 --- /dev/null +++ b/java/java-impl/resources/inlayProviders/annotation.hints/external.annotations.java @@ -0,0 +1 @@ +@Deprecated public length(double x) \ No newline at end of file diff --git a/java/java-impl/resources/inlayProviders/annotation.hints/inferred.annotations.java b/java/java-impl/resources/inlayProviders/annotation.hints/inferred.annotations.java new file mode 100644 index 000000000000..3f4c9901883b --- /dev/null +++ b/java/java-impl/resources/inlayProviders/annotation.hints/inferred.annotations.java @@ -0,0 +1 @@ +public length (@NotNull double x) \ No newline at end of file diff --git a/java/java-impl/src/com/intellij/codeInsight/hints/AnnotationInlayProvider.kt b/java/java-impl/src/com/intellij/codeInsight/hints/AnnotationInlayProvider.kt index 55059326a615..c352aea6b066 100644 --- a/java/java-impl/src/com/intellij/codeInsight/hints/AnnotationInlayProvider.kt +++ b/java/java-impl/src/com/intellij/codeInsight/hints/AnnotationInlayProvider.kt @@ -162,6 +162,11 @@ class AnnotationInlayProvider : InlayHintsProvider get() = ourKey + + override fun getProperty(key: String): String { + return JavaBundle.message(key) + } + override val previewText: String? = null override fun createConfigurable(settings: Settings): ImmediateConfigurable { diff --git a/java/openapi/resources/messages/JavaBundle.properties b/java/openapi/resources/messages/JavaBundle.properties index db83ad4faf59..286523d2b9c1 100644 --- a/java/openapi/resources/messages/JavaBundle.properties +++ b/java/openapi/resources/messages/JavaBundle.properties @@ -1197,6 +1197,8 @@ inlay.JavaLens.usages=The number of usages of the class or method in the project inlay.JavaLens.inheritors=The number of descendants the class or interface has. Click the hint to navigate to the code that inherits from this class or interface. inlay.MethodChainsInlayProvider.description=Method return types in call chains. inlay.RelatedProblems.description=The number of problems in the project related to the class or member signature. For example: missing parameters, wrong return type, and so on.

The hint does not appear for the problems within the same file. +inlay.annotation.hints.inferred.annotations=Annotations that IntelliJ IDEA generates by scanning libraries and project code. These annotations help you understand code contracts and improve the capabilities of static analysis. They include:
@Contract
@Nullable
@NotNull
@Unmodifiable
@UnmodifiableView

Documentation +inlay.annotation.hints.external.annotations=Annotations that are stored outside your source code.
These annotations are useful when you need an annotation, but adding it to the source code is not an option (for example, when working with a library code).

Documentation show.import.popup.for.classes=&Classes show.import.popup.for.static.methods.and.fields=&Static methods and fields exclude.import.wildcard.comment=Use the * wildcard to exclude all members of a specified class or package