diff --git a/java/java-impl-inspections/src/com/intellij/codeInspection/preview/PreviewFeatureInspection.java b/java/java-impl-inspections/src/com/intellij/codeInspection/preview/PreviewFeatureInspection.java
index 84902f5018be..4c07e3ba9ec5 100644
--- a/java/java-impl-inspections/src/com/intellij/codeInspection/preview/PreviewFeatureInspection.java
+++ b/java/java-impl-inspections/src/com/intellij/codeInspection/preview/PreviewFeatureInspection.java
@@ -59,7 +59,7 @@ public final class PreviewFeatureInspection extends LocalInspectionTool {
String name = owner instanceof PsiClass cls ?
cls.getQualifiedName() :
Objects.requireNonNull(owner.getContainingClass()).getQualifiedName() + "#" + owner.getName();
- holder.registerProblem(element, JavaBundle.message("preview.api.usage", name));
+ holder.registerProblem(element, JavaBundle.message("preview.api.usage.old.jdk", name, level.feature()));
}
}
}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/previewfeature/warnings/UsingGathererOnOlderPreviewLevel.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/previewfeature/warnings/UsingGathererOnOlderPreviewLevel.java
index 922eeb750d7c..21ed1fb6a431 100644
--- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/previewfeature/warnings/UsingGathererOnOlderPreviewLevel.java
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/previewfeature/warnings/UsingGathererOnOlderPreviewLevel.java
@@ -1,8 +1,8 @@
-import java.util.stream.Gatherers;
+import java.util.stream.Gatherers;
import java.util.stream.Stream;
class Main {
public static void main(String[] args) {
- Stream.of(1, 2, 3).gather(Gatherers.windowFixed(3)).forEach(System.out::println);
+ Stream.of(1, 2, 3).gather(Gatherers.windowFixed(3)).forEach(System.out::println);
}
}
\ No newline at end of file
diff --git a/java/openapi/resources/messages/JavaBundle.properties b/java/openapi/resources/messages/JavaBundle.properties
index a57f94c3045d..94de57c2d1aa 100644
--- a/java/openapi/resources/messages/JavaBundle.properties
+++ b/java/openapi/resources/messages/JavaBundle.properties
@@ -1989,6 +1989,7 @@ java.test.sum.time=Sum time: {0}
error.no.annotation.class.found=No annotation class found
preview.api.usage={0} is a preview API and may be removed in a future release
+preview.api.usage.old.jdk={0} was in preview in JDK {1}
preview.api.usage.reflective={0} is a reflective preview API and may be removed in a future release
todo.0=todo "{0}"
todo.item=todo item