mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-19 21:11:28 +07:00
[Java. Code Formatting] IDEA-168035 Treat jspecify annotations as type annotations in formatter
- Add module import for jetbrains annotations GitOrigin-RevId: c42016573959a8e9815b479d4517b3143a9bc2b2
This commit is contained in:
committed by
intellij-monorepo-bot
parent
718d7187f3
commit
8fb486f0c9
@@ -31,9 +31,10 @@ object DumbAwareAnnotationUtil {
|
||||
|
||||
/**
|
||||
* Represents a mapping from a fully qualified name of a module to a set of fully qualified names of annotations
|
||||
* that are treated as a type annotations and located in this module
|
||||
* that are treated as type annotations and located in this module
|
||||
*/
|
||||
private val KNOWN_MODULE_TO_ANNOTATIONS_MAP = mapOf(
|
||||
"org.jetbrains.annotations" to setOf(AnnotationUtil.NOT_NULL, AnnotationUtil.NULLABLE, AnnotationUtil.NON_NLS),
|
||||
"org.jspecify" to setOf(AnnotationUtil.J_SPECIFY_NON_NULL, AnnotationUtil.J_SPECIFY_NULLABLE)
|
||||
)
|
||||
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
package org.example;
|
||||
|
||||
import module org.jetbrains.annotations;
|
||||
|
||||
public class Formatter {
|
||||
@NotNull
|
||||
@Nullable
|
||||
String breakLineBetweenAnnotations() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@NotNull String breakLineBetweenTypeAndAnnotations() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable <T> String breakLineBetweenTypeParameterAndAnnotation() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@NotNull
|
||||
<T> String breakLineMixed() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package org.example;
|
||||
|
||||
import module org.jetbrains.annotations;
|
||||
|
||||
public class Formatter {
|
||||
@NotNull @Nullable String breakLineBetweenAnnotations() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Nullable @NotNull String breakLineBetweenTypeAndAnnotations() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable <T> String breakLineBetweenTypeParameterAndAnnotation() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable @NotNull <T> String breakLineMixed() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -60,6 +60,11 @@ class TypeAnnotationFormatterTest : LightJavaCodeInsightFixtureTestCase() {
|
||||
doTest()
|
||||
}
|
||||
|
||||
fun testModuleImport() {
|
||||
IdeaTestUtil.setModuleLanguageLevel(myFixture.module, LanguageLevel.JDK_25)
|
||||
doTest()
|
||||
}
|
||||
|
||||
private fun doTest() {
|
||||
val testName = getTestName(false)
|
||||
myFixture.configureByFile("$testName.java")
|
||||
|
||||
Reference in New Issue
Block a user