logic: added all previous java version to Java language standard selection

This commit is contained in:
mlangkabel
2017-11-06 18:49:29 +01:00
parent 595f918f4d
commit 6fad9eea84
12 changed files with 279 additions and 15 deletions
@@ -9,9 +9,11 @@ IndexerCommandJava::IndexerCommandJava(
const FilePath& sourceFilePath,
const std::set<FilePath>& indexedPaths,
const std::set<FilePath>& excludedPaths,
const std::string& languageStandard,
const std::vector<FilePath>& classPath
)
: IndexerCommand(sourceFilePath, indexedPaths, excludedPaths)
, m_languageStandard(languageStandard)
, m_classPath(classPath)
{
}
@@ -37,6 +39,11 @@ size_t IndexerCommandJava::getByteSize(size_t stringSize) const
return size;
}
std::string IndexerCommandJava::getLanguageStandard() const
{
return m_languageStandard;
}
std::vector<FilePath> IndexerCommandJava::getClassPath() const
{
return m_classPath;
@@ -17,15 +17,19 @@ public:
const FilePath& sourceFilePath,
const std::set<FilePath>& indexedPaths,
const std::set<FilePath>& excludedPaths,
const std::string& languageStandard,
const std::vector<FilePath>& classPath);
virtual ~IndexerCommandJava();
virtual IndexerCommandType getIndexerCommandType() const override;
virtual size_t getByteSize(size_t stringSize) const override;
std::string getLanguageStandard() const;
std::vector<FilePath> getClassPath() const;
private:
const std::string m_languageStandard;
std::vector<FilePath> m_classPath;
};
@@ -37,18 +37,19 @@ bool JavaEnvironment::callStaticVoidMethod(std::string className, std::string me
return false;
}
bool JavaEnvironment::callStaticVoidMethod(std::string className, std::string methodName, int arg1, std::string arg2, std::string arg3, std::string arg4, int arg5)
bool JavaEnvironment::callStaticVoidMethod(std::string className, std::string methodName, int arg1, std::string arg2, std::string arg3, std::string arg4, std::string arg5, int arg6)
{
jclass javaClass = getJavaClass(className);
jmethodID javaMethodId = getJavaStaticMethod(javaClass, methodName, "(ILjava/lang/String;Ljava/lang/String;Ljava/lang/String;I)V");
jmethodID javaMethodId = getJavaStaticMethod(javaClass, methodName, "(ILjava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;I)V");
if(javaMethodId != nullptr)
{
jint jarg1 = arg1;
jstring jarg2 = m_env->NewStringUTF(arg2.c_str());
jstring jarg3 = m_env->NewStringUTF(arg3.c_str());
jstring jarg4 = m_env->NewStringUTF(arg4.c_str());
jint jarg5 = arg5;
m_env->CallStaticVoidMethod(javaClass, javaMethodId, jarg1, jarg2, jarg3, jarg4, jarg5);
jstring jarg5 = m_env->NewStringUTF(arg5.c_str());
jint jarg6 = arg6;
m_env->CallStaticVoidMethod(javaClass, javaMethodId, jarg1, jarg2, jarg3, jarg4, jarg5, jarg6);
return true;
}
return false;
@@ -34,7 +34,7 @@ public:
~JavaEnvironment();
bool callStaticVoidMethod(std::string className, std::string methodName);
bool callStaticVoidMethod(std::string className, std::string methodName, const std::string& arg1, const std::string& arg2, const std::string& arg3);
bool callStaticVoidMethod(std::string className, std::string methodName, int arg1, std::string arg2, std::string arg3, std::string arg4, int arg5);
bool callStaticVoidMethod(std::string className, std::string methodName, int arg1, std::string arg2, std::string arg3, std::string arg4, std::string arg5, int arg6);
bool callStaticStringMethod(std::string className, std::string methodName, std::string& ret, const std::string& arg1);
bool callStaticStringMethod(std::string className, std::string methodName, std::string& ret, const std::string& arg1, const std::string& arg2);
+4 -2
View File
@@ -82,16 +82,17 @@ void JavaParser::buildIndex(std::shared_ptr<IndexerCommandJava> indexerCommand)
classPath += path.str() + ";";
}
buildIndex(indexerCommand->getSourceFilePath(), classPath, TextAccess::createFromFile(indexerCommand->getSourceFilePath()));
buildIndex(indexerCommand->getSourceFilePath(), indexerCommand->getLanguageStandard(), classPath, TextAccess::createFromFile(indexerCommand->getSourceFilePath()));
}
void JavaParser::buildIndex(const FilePath& filePath, std::shared_ptr<TextAccess> textAccess)
{
buildIndex(filePath, "", textAccess);
buildIndex(filePath, "8", "", textAccess);
}
void JavaParser::buildIndex(
const FilePath& sourceFilePath,
const std::string& languageStandard,
const std::string& classPath,
std::shared_ptr<TextAccess> textAccess)
{
@@ -113,6 +114,7 @@ void JavaParser::buildIndex(
m_id,
m_currentFilePath.str(),
fileContent,
languageStandard,
classPath,
verbose
);
+4 -1
View File
@@ -42,7 +42,10 @@ public:
private:
void buildIndex(
const FilePath& sourceFilePath, const std::string& classPath, std::shared_ptr<TextAccess> textAccess);
const FilePath& sourceFilePath,
const std::string& languageStandard,
const std::string& classPath,
std::shared_ptr<TextAccess> textAccess);
// This macro makes available a variable T, the passed-in t. blablabla TODO: write somethign real here
#define MAKE_PARAMS_0()
+3 -1
View File
@@ -33,6 +33,8 @@ bool SourceGroupJava::prepareIndexing()
std::vector<std::shared_ptr<IndexerCommand>> SourceGroupJava::getIndexerCommands(
std::set<FilePath>* filesToIndex, bool fullRefresh)
{
const std::string languageStandard = getSourceGroupSettingsJava()->getStandard();
std::vector<FilePath> classPath = getClassPath();
std::set<FilePath> indexedPaths;
@@ -61,7 +63,7 @@ std::vector<std::shared_ptr<IndexerCommand>> SourceGroupJava::getIndexerCommands
if (filesToIndex->find(sourcePath) != filesToIndex->end())
{
indexerCommands.push_back(
std::make_shared<IndexerCommandJava>(sourcePath, indexedPaths, excludedPaths, classPath));
std::make_shared<IndexerCommandJava>(sourcePath, indexedPaths, excludedPaths, languageStandard, classPath));
filesToIndex->erase(sourcePath);
}