diff --git a/CMakeLists.txt b/CMakeLists.txt
index cee66c70..027b2856 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -755,6 +755,8 @@ if (WIN32)
COMMAND cd $(ProjectDir)../../bin/test/\n$(OutDir)$(TargetName)$(TargetExt)
COMMENT "Running unittest code"
)
+
+ set_target_properties(${TEST_PROJECT_NAME} PROPERTIES COMPILE_FLAGS "/bigobj")
elseif (UNIX)
diff --git a/deployment/windows/wixSetup/installDir.wxs b/deployment/windows/wixSetup/installDir.wxs
index 5dd16c54..b6b33a99 100644
--- a/deployment/windows/wixSetup/installDir.wxs
+++ b/deployment/windows/wixSetup/installDir.wxs
@@ -898,7 +898,7 @@
-
+
diff --git a/java_indexer/pom.xml b/java_indexer/pom.xml
index 1369c44d..f543985b 100644
--- a/java_indexer/pom.xml
+++ b/java_indexer/pom.xml
@@ -41,7 +41,7 @@
org.eclipse.jdt
org.eclipse.jdt.core
- 3.13.0
+ 3.13.102
diff --git a/java_indexer/src/main/java/com/sourcetrail/JavaIndexer.java b/java_indexer/src/main/java/com/sourcetrail/JavaIndexer.java
index 73c744d9..3655f1ad 100644
--- a/java_indexer/src/main/java/com/sourcetrail/JavaIndexer.java
+++ b/java_indexer/src/main/java/com/sourcetrail/JavaIndexer.java
@@ -41,7 +41,7 @@ public class JavaIndexer
Path path = Paths.get(filePath);
- ASTParser parser = ASTParser.newParser(AST.JLS8);
+ ASTParser parser = ASTParser.newParser(AST.JLS10);
parser.setResolveBindings(true); // solve "bindings" like the declatarion of the type used in a var decl
parser.setKind(ASTParser.K_COMPILATION_UNIT); // specify to parse the entire compilation unit
@@ -134,7 +134,7 @@ public class JavaIndexer
{
String packageName = "";
- ASTParser parser = ASTParser.newParser(AST.JLS8);
+ ASTParser parser = ASTParser.newParser(AST.JLS10);
parser.setKind(ASTParser.K_COMPILATION_UNIT); // specify to parse the entire compilation unit
parser.setSource(fileContent.toCharArray());
CompilationUnit cu = (CompilationUnit) parser.createAST(null);
@@ -170,8 +170,12 @@ public class JavaIndexer
case "7":
return JavaCore.VERSION_1_7;
case "8":
- default:
return JavaCore.VERSION_1_8;
+ case "9":
+ return JavaCore.VERSION_9;
+ case "10":
+ default:
+ return JavaCore.VERSION_10;
}
}
diff --git a/src/lib/settings/SourceGroupSettingsJava.cpp b/src/lib/settings/SourceGroupSettingsJava.cpp
index 6b440704..b8e6203f 100644
--- a/src/lib/settings/SourceGroupSettingsJava.cpp
+++ b/src/lib/settings/SourceGroupSettingsJava.cpp
@@ -10,7 +10,7 @@ void SourceGroupSettingsJava::load(std::shared_ptr config)
SourceGroupSettings::load(config);
const std::string key = s_keyPrefix + getId();
-
+
SourceGroupSettingsWithSourceExtensions::load(config, key);
SourceGroupSettingsWithExcludeFilters::load(config, key);
SourceGroupSettingsWithJavaStandard::load(config, key);
@@ -36,7 +36,7 @@ bool SourceGroupSettingsJava::equals(std::shared_ptr other)
SourceGroupSettings::equals(other) &&
SourceGroupSettingsWithSourceExtensions::equals(otherJava) &&
SourceGroupSettingsWithExcludeFilters::equals(otherJava) &&
- SourceGroupSettingsWithJavaStandard::equals(otherJava)
+ SourceGroupSettingsWithJavaStandard::equals(otherJava)
);
}
diff --git a/src/lib/settings/SourceGroupSettingsJavaEmpty.cpp b/src/lib/settings/SourceGroupSettingsJavaEmpty.cpp
index 52852d31..34dfeee4 100644
--- a/src/lib/settings/SourceGroupSettingsJavaEmpty.cpp
+++ b/src/lib/settings/SourceGroupSettingsJavaEmpty.cpp
@@ -12,7 +12,7 @@ std::shared_ptr SourceGroupSettingsJavaEmpty::createCopy()
void SourceGroupSettingsJavaEmpty::load(std::shared_ptr config)
{
- SourceGroupSettings::load(config);
+ SourceGroupSettingsJava::load(config);
const std::string key = s_keyPrefix + getId();
@@ -22,7 +22,7 @@ void SourceGroupSettingsJavaEmpty::load(std::shared_ptr con
void SourceGroupSettingsJavaEmpty::save(std::shared_ptr config)
{
- SourceGroupSettings::save(config);
+ SourceGroupSettingsJava::save(config);
const std::string key = s_keyPrefix + getId();
diff --git a/src/lib/settings/SourceGroupSettingsWithJavaStandard.cpp b/src/lib/settings/SourceGroupSettingsWithJavaStandard.cpp
index 841cb866..ac1defb4 100644
--- a/src/lib/settings/SourceGroupSettingsWithJavaStandard.cpp
+++ b/src/lib/settings/SourceGroupSettingsWithJavaStandard.cpp
@@ -41,7 +41,7 @@ void SourceGroupSettingsWithJavaStandard::setJavaStandard(const std::string& sta
std::vector SourceGroupSettingsWithJavaStandard::getAvailableJavaStandards() const
{
- return {"1", "2", "3", "4", "5", "6", "7", "8"};
+ return {"1", "2", "3", "4", "5", "6", "7", "8", "9", "10"};
}
std::string SourceGroupSettingsWithJavaStandard::getDefaultJavaStandard() const
diff --git a/src/lib_java/data/parser/java/JavaParser.cpp b/src/lib_java/data/parser/java/JavaParser.cpp
index 38b64943..1508829c 100644
--- a/src/lib_java/data/parser/java/JavaParser.cpp
+++ b/src/lib_java/data/parser/java/JavaParser.cpp
@@ -87,7 +87,7 @@ void JavaParser::buildIndex(std::shared_ptr indexerCommand)
void JavaParser::buildIndex(const FilePath& filePath, std::shared_ptr textAccess)
{
- buildIndex(filePath, "8", "", textAccess);
+ buildIndex(filePath, "10", "", textAccess);
}
void JavaParser::buildIndex(
@@ -264,7 +264,7 @@ void JavaParser::doRecordError(
m_client->recordError(
ParseLocation(m_currentFilePath, beginLine, beginColumn, endLine, endColumn),
utility::decodeFromUtf8(m_javaEnvironment->toStdString(jMessage)),
- fatal,
+ fatal,
indexed,
FilePath()
);
diff --git a/src/lib_java/utility/utilityJava.cpp b/src/lib_java/utility/utilityJava.cpp
index 33df762c..a01cbe56 100644
--- a/src/lib_java/utility/utilityJava.cpp
+++ b/src/lib_java/utility/utilityJava.cpp
@@ -31,7 +31,7 @@ namespace utility
L"org.eclipse.equinox.common-3.10.0.jar",
L"org.eclipse.equinox.preferences-3.7.100.jar",
L"org.eclipse.equinox.registry-3.8.0.jar",
- L"org.eclipse.jdt.core-3.13.0.jar",
+ L"org.eclipse.jdt.core-3.13.102.jar",
L"org.eclipse.osgi-3.13.0.jar",
L"org.eclipse.text-3.6.300.jar",
L"slf4j-api-1.7.10.jar",
diff --git a/src/test/JavaParserTestSuite.h b/src/test/JavaParserTestSuite.h
index 66186473..28f805ff 100644
--- a/src/test/JavaParserTestSuite.h
+++ b/src/test/JavaParserTestSuite.h
@@ -34,7 +34,9 @@ public:
ApplicationSettings::getInstance()->setJavaPath(javaPaths[0]);
}
- setupJavaEnvironmentFactory();
+ const std::string errorString = setupJavaEnvironmentFactory();
+
+ TS_ASSERT_EQUALS("", errorString);
// if this one fails, maybe your java_path in the test settings is wrong.
TS_ASSERT_LESS_THAN_EQUALS(1, JavaEnvironmentFactory::getInstance().use_count());
@@ -727,7 +729,7 @@ public:
client->qualifiers, L"A.B <17:20 17:20>"
));
}
-
+
void test_java_parser_finds_qualifier_location_of_super_method_reference()
{
std::shared_ptr client = parseCode(
@@ -838,6 +840,22 @@ public:
));
}
+ void test_java_parser_finds_usage_of_string_for_var_type()
+ {
+ std::shared_ptr client = parseCode(
+ "public class A\n"
+ "{\n"
+ " public void foo(){\n"
+ " var a = \"test\";\n"
+ " }\n"
+ "}\n"
+ );
+
+ TS_ASSERT(utility::containsElement(
+ client->typeUses, L"void A.foo() -> java.lang.String <4:3 4:5>"
+ ));
+ }
+
void test_java_parser_finds_type_parameter_in_signature_of_method()
{
std::shared_ptr client = parseCode(
@@ -945,7 +963,7 @@ public:
client->calls, L"foo.Bar.Bar(int) -> foo.Bar.Bar() <10:3 10:6>"
));
}
-
+
void test_java_parser_finds_super_constructor_invocation()
{
std::shared_ptr client = parseCode(
@@ -1115,7 +1133,7 @@ public:
));
}
- void test_java_parser_finds_no_method_usage_for_type_method_reference()
+ void test_java_parser_finds_no_method_usage_for_type_method_reference()
{
std::shared_ptr client = parseCode(
"public class A {\n"
@@ -1478,7 +1496,7 @@ public:
private:
- void setupJavaEnvironmentFactory()
+ std::string setupJavaEnvironmentFactory()
{
if (!JavaEnvironmentFactory::getInstance())
{
@@ -1505,7 +1523,11 @@ private:
classPath,
errorString
);
+
+ return errorString;
}
+
+ return "";
}
std::shared_ptr parseCode(std::string code, bool logErrors = true)