diff --git a/java_indexer/pom.xml b/java_indexer/pom.xml index 435d993ee..7d3cfa1da 100644 --- a/java_indexer/pom.xml +++ b/java_indexer/pom.xml @@ -144,7 +144,7 @@ org.eclipse.jdt org.eclipse.jdt.core - 3.24.0 + 3.35.0 org.eclipse.platform diff --git a/java_indexer/src/main/java/com/sourcetrail/JavaIndexer.java b/java_indexer/src/main/java/com/sourcetrail/JavaIndexer.java index ad7352e49..fcfc09fed 100644 --- a/java_indexer/src/main/java/com/sourcetrail/JavaIndexer.java +++ b/java_indexer/src/main/java/com/sourcetrail/JavaIndexer.java @@ -184,6 +184,7 @@ public static void clearCaches() private static String convertLanguageStandard(String s) { + // Must be in sync with 'SourceGroupSettingsWithJavaStandard::getAvailableJavaStandards' switch (s) { case "1": @@ -215,8 +216,18 @@ private static String convertLanguageStandard(String s) case "14": return JavaCore.VERSION_14; case "15": - default: return JavaCore.VERSION_15; + case "16": + return JavaCore.VERSION_16; + case "17": + return JavaCore.VERSION_17; + case "18": + return JavaCore.VERSION_18; + case "19": + return JavaCore.VERSION_19; + case "20": + default: + return JavaCore.VERSION_20; } } diff --git a/src/lib/settings/source_group/component/java/SourceGroupSettingsWithJavaStandard.cpp b/src/lib/settings/source_group/component/java/SourceGroupSettingsWithJavaStandard.cpp index 98248da22..59c347ff8 100644 --- a/src/lib/settings/source_group/component/java/SourceGroupSettingsWithJavaStandard.cpp +++ b/src/lib/settings/source_group/component/java/SourceGroupSettingsWithJavaStandard.cpp @@ -23,7 +23,13 @@ void SourceGroupSettingsWithJavaStandard::setJavaStandard(const std::wstring& st std::vector SourceGroupSettingsWithJavaStandard::getAvailableJavaStandards() const { + // Must be in sync with 'JavaIndexer.convertLanguageStandard'. return { + L"20", + L"19", + L"18", + L"17", + L"16", L"15", L"14", L"13", @@ -38,7 +44,8 @@ std::vector SourceGroupSettingsWithJavaStandard::getAvailableJavaS L"4", L"3", L"2", - L"1"}; + L"1" + }; } bool SourceGroupSettingsWithJavaStandard::equals(const SourceGroupSettingsBase* other) const diff --git a/src/lib_java/data/parser/java/JavaEnvironmentFactory.cpp b/src/lib_java/data/parser/java/JavaEnvironmentFactory.cpp index e677d26a6..e9e826065 100644 --- a/src/lib_java/data/parser/java/JavaEnvironmentFactory.cpp +++ b/src/lib_java/data/parser/java/JavaEnvironmentFactory.cpp @@ -47,34 +47,32 @@ void JavaEnvironmentFactory::createInstance(std::string classPath, std::string& s_classPath = classPath; - const int optionCount = 2; - JavaVM* jvm = nullptr; // Pointer to the JVM (Java Virtual Machine) JNIEnv* env = nullptr; // Pointer to native interface JavaVMInitArgs vm_args; // Initialization arguments - JavaVMOption* options = new JavaVMOption[optionCount]; // JVM invocation options + std::vector options; // JVM invocation options std::string classPathOption = "-Djava.class.path=" + classPath; - options[0].optionString = const_cast(classPathOption.c_str()); - options[1].optionString = const_cast("-Xms64m"); + options.push_back({ const_cast(classPathOption.c_str()) }); + options.push_back({ const_cast("-Xms64m") }); + // Use this option to allow attaching a debugger: + //options.push_back({ const_cast("-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=*:8000") }); + // // use these options to enable profiling in VisualVM - // options[2].optionString = const_cast("-Dcom.sun.management.jmxremote"); - // options[3].optionString = const_cast("-Dcom.sun.management.jmxremote.port=9010"); - // options[4].optionString = - // const_cast("-Dcom.sun.management.jmxremote.local.only=false"); options[5].optionString - // = const_cast("-Dcom.sun.management.jmxremote.authenticate=false"); - // options[6].optionString = const_cast("-Dcom.sun.management.jmxremote.ssl=false"); + //options.push_back({ const_cast("-Dcom.sun.management.jmxremote") }); + //options.push_back({ const_cast("-Dcom.sun.management.jmxremote.port=9010") }); + //options.push_back({ const_cast("-Dcom.sun.management.jmxremote.local.only=false") }); + //options.push_back({ const_cast("-Dcom.sun.management.jmxremote.authenticate=false") }); + //options.push_back({ const_cast("-Dcom.sun.management.jmxremote.ssl=false") }); vm_args.version = JNI_VERSION_1_8; - vm_args.nOptions = optionCount; - vm_args.options = options; + vm_args.nOptions = static_cast(options.size()); + vm_args.options = options.data(); vm_args.ignoreUnrecognized = false; // invalid options make the JVM init fail jint rc = createInstanceFunction(&jvm, (void**)&env, &vm_args); - delete[] options; - if (rc != JNI_OK) { if (rc == JNI_EVERSION)