[java] IDEA-354964 Migrate standard descriptors like JAVA_21 to TYPE_USE annotations

- extract tests, which require old annotations
- return old name to method to add annotations

GitOrigin-RevId: c559cea10f942f72d5a19176d3ee808d46ad5dd2
This commit is contained in:
Mikhail Pyltsin
2024-06-27 13:46:56 +02:00
committed by intellij-monorepo-bot
parent 02a2f7bc86
commit 092062f856
13 changed files with 111 additions and 58 deletions

View File

@@ -98,7 +98,7 @@ public abstract class LightJavaCodeInsightTestCase extends LightPlatformCodeInsi
@Override
protected void configureModule(@NotNull Module module, @NotNull ModifiableRootModel model, @NotNull ContentEntry contentEntry) {
if (languageLevel.isAtLeast(LanguageLevel.JDK_1_8)) {
DefaultLightProjectDescriptor.addJetBrainsAnnotationsJava8AndHigher(model);
DefaultLightProjectDescriptor.addJetBrainsAnnotationsWithTypeUse(model);
}
else {
DefaultLightProjectDescriptor.addJetBrainsAnnotations(model);

View File

@@ -73,11 +73,11 @@ public class DefaultLightProjectDescriptor extends LightProjectDescriptor {
return withRepositoryLibrary(JETBRAINS_ANNOTATIONS_COORDINATES);
}
public DefaultLightProjectDescriptor withJetBrainsAnnotationsJava8AndHigher() {
public DefaultLightProjectDescriptor withJetBrainsAnnotationsWithTypeUse() {
return withRepositoryLibrary(JETBRAINS_ANNOTATIONS_COORDINATES_JAVA_8);
}
public static void addJetBrainsAnnotationsJava8AndHigher(ModifiableRootModel model) {
public static void addJetBrainsAnnotationsWithTypeUse(ModifiableRootModel model) {
MavenDependencyUtil.addFromMaven(model, JETBRAINS_ANNOTATIONS_COORDINATES_JAVA_8);
}

View File

@@ -63,7 +63,7 @@ public abstract class LightJavaCodeInsightFixtureTestCase extends UsefulTestCase
public void configureModule(@NotNull Module module, @NotNull ModifiableRootModel model, @NotNull ContentEntry contentEntry) {
model.getModuleExtension(LanguageLevelModuleExtension.class).setLanguageLevel(myLanguageLevel);
if (myLanguageLevel.isAtLeast(LanguageLevel.JDK_1_8)) {
addJetBrainsAnnotationsJava8AndHigher(model);
addJetBrainsAnnotationsWithTypeUse(model);
}
else {
addJetBrainsAnnotations(model);