88import java .io .File ;
99
1010import com .intellij .codeInsight .completion .LightFixtureCompletionTestCase ;
11- import com .intellij .openapi .module .Module ;
12- import com .intellij .openapi .projectRoots .JavaSdk ;
13- import com .intellij .openapi .projectRoots .Sdk ;
14- import com .intellij .openapi .roots .ContentEntry ;
15- import com .intellij .openapi .roots .LanguageLevelModuleExtension ;
16- import com .intellij .openapi .roots .ModifiableRootModel ;
1711import com .intellij .openapi .util .text .StringUtil ;
1812import com .intellij .openapi .vfs .newvfs .impl .VfsRootAccess ;
19- import com .intellij .pom .java .LanguageLevel ;
2013import com .intellij .testFramework .LightProjectDescriptor ;
2114import com .intellij .testFramework .PsiTestUtil ;
22- import com .intellij .testFramework .fixtures .DefaultLightProjectDescriptor ;
2315import com .intellij .util .PathUtil ;
24- import com .intellij .util .lang .JavaVersion ;
2516import org .jetbrains .annotations .NotNull ;
2617
2718/**
3223public abstract class MapstructBaseCompletionTestCase extends LightFixtureCompletionTestCase {
3324
3425 private static final String BUILD_LIBS_DIRECTORY = "build/libs" ;
35- private static final String BUILD_MOCK_JDK_DIRECTORY = "build/mockJDK-" ;
3626
3727 @ Override
3828 protected void setUp () throws Exception {
@@ -56,33 +46,6 @@ protected void addDirectoryToProject(@NotNull String directory) {
5646 @ NotNull
5747 @ Override
5848 protected LightProjectDescriptor getProjectDescriptor () {
59- LanguageLevel languageLevel = getLanguageLevel ();
60- return new DefaultLightProjectDescriptor () {
61- @ Override
62- public Sdk getSdk () {
63- JavaVersion version = languageLevel .toJavaVersion ();
64- int mockJdk ;
65- if ( version .feature >= 11 ) {
66- mockJdk = 11 ;
67- }
68- else {
69- mockJdk = version .feature ;
70- }
71- String compilerOption = ( mockJdk < 11 ? "1." : "" ) + mockJdk ;
72- return JavaSdk .getInstance ()
73- .createJdk ( "java " + compilerOption , BUILD_MOCK_JDK_DIRECTORY + compilerOption , false );
74- }
75-
76- @ Override
77- public void configureModule (@ NotNull Module module , @ NotNull ModifiableRootModel model ,
78- @ NotNull ContentEntry contentEntry ) {
79- model .getModuleExtension ( LanguageLevelModuleExtension .class )
80- .setLanguageLevel ( languageLevel );
81- }
82- };
83- }
84-
85- protected LanguageLevel getLanguageLevel () {
86- return LanguageLevel .JDK_1_8 ;
49+ return JAVA_17 ;
8750 }
8851}
0 commit comments