### Sourcetrail C++ Project Configuration
Source: https://context7.com/coatisoftware/sourcetrail/llms.txt
An example XML configuration file (`.srctrlprj`) for setting up a C++ project in Sourcetrail. It specifies the path to the compilation database and includes settings for header paths and excluded files.
```xml
My C++ Project
enabled
build/compile_commands.json
src/
include/
**/test/**
8
```
--------------------------------
### C++ API Example for Custom Indexer in SourcetrailDB
Source: https://context7.com/coatisoftware/sourcetrail/llms.txt
This C++ code snippet demonstrates how to use the SourcetrailDB C++ API to build a custom indexer. It shows how to open a database, record files, symbols (classes, methods), references, and their source locations.
```cpp
// SourcetrailDB C++ API example for custom indexer
#include "SourcetrailDBWriter.h"
int main(int argc, char* argv[]) {
sourcetrail::SourcetrailDBWriter writer;
// Open the database
writer.open("/path/to/project.srctrldb");
writer.beginTransaction();
// Record a file
int fileId = writer.recordFile("/path/to/source.mylang");
writer.recordFileLanguage(fileId, "mylang");
// Record a class symbol
sourcetrail::NameHierarchy className;
className.nameElements.push_back({"MyClass", "", ""});
int classId = writer.recordSymbol(className);
writer.recordSymbolDefinitionKind(classId, sourcetrail::DEFINITION_EXPLICIT);
writer.recordSymbolKind(classId, sourcetrail::SYMBOL_CLASS);
// Record a method
sourcetrail::NameHierarchy methodName = className;
methodName.nameElements.push_back({"myMethod", "()", "void"});
int methodId = writer.recordSymbol(methodName);
writer.recordSymbolDefinitionKind(methodId, sourcetrail::DEFINITION_EXPLICIT);
writer.recordSymbolKind(methodId, sourcetrail::SYMBOL_METHOD);
// Record a reference (call edge)
int refId = writer.recordReference(
methodId, // context (caller)
classId, // referenced (callee)
sourcetrail::REFERENCE_CALL // reference type
);
// Record source location
writer.recordSymbolLocation(classId, fileId, 10, 1, 10, 10);
writer.recordSymbolScopeLocation(classId, fileId, 10, 1, 50, 1);
writer.commitTransaction();
writer.close();
return 0;
}
```
--------------------------------
### Sourcetrail Java Project Configuration
Source: https://context7.com/coatisoftware/sourcetrail/llms.txt
An example XML configuration file (`.srctrlprj`) for setting up a Java project in Sourcetrail. It defines source paths, Java standard version, class paths, and other settings required for indexing Java code.
```xml
My Java Project
enabled
12
src/main/java
**/test/**
.java
lib/dependency.jar
true
8
```
--------------------------------
### Java Indexer Example for Indexing a Java File
Source: https://context7.com/coatisoftware/sourcetrail/llms.txt
This Java code demonstrates how to use the ASTParser from the Eclipse JDT to parse a Java file and then use an AstVisitor to process the Abstract Syntax Tree. It configures the parser with necessary classpath and sourcepath information.
```java
import com.sourcetrail.*;
import org.eclipse.jdt.core.dom.*;
public class JavaIndexerExample {
public static void indexFile(File javaFile, AstVisitorClient client) {
// Read file content
String content = Files.readString(javaFile.toPath());
// Create AST parser
ASTParser parser = ASTParser.newParser(AST.JLS12);
parser.setKind(ASTParser.K_COMPILATION_UNIT);
parser.setSource(content.toCharArray());
parser.setResolveBindings(true);
// Configure classpath
parser.setEnvironment(
new String[]{"/path/to/libs"}, // classpath
new String[]{"/path/to/src"}, // sourcepath
null, true
);
// Parse and visit
CompilationUnit cu = (CompilationUnit) parser.createAST(null);
// Create and run the visitor
AstVisitor visitor = new AstVisitorImpl(client, javaFile, content, cu);
cu.accept(visitor);
}
}
```
--------------------------------
### Copy Qt Binaries and Plugins for Windows (CMake)
Source: https://github.com/coatisoftware/sourcetrail/blob/master/CMakeLists.txt
This CMake function, `COPY_QT_BINARIES`, is designed to copy necessary Qt DLLs and plugins to the build directory for Windows. It handles different build configurations (Debug/Release) and target types (application or test). Dependencies include Qt installation paths and CMAKE variables for build configuration.
```cmake
if (WIN32)
get_filename_component(QT_BINARY_DIR "${QT_MOC_EXECUTABLE}" PATH)
set(QT_PLUGINS_DIR "${QT_BINARY_DIR}/../plugins")
function(COPY_QT_BINARIES IS_DEBUG IS_APP)
set(SUFFIX "")
if (IS_DEBUG)
set(SUFFIX "d")
endif()
set(CONFIGURATION "Release")
if (IS_DEBUG)
set(CONFIGURATION "Debug")
endif()
if(CMAKE_CL_64)
set(BITS "64")
else()
set(BITS "32")
endif()
set(TARGET "test")
if (IS_APP)
set(TARGET "app")
file(GLOB MY_PUBLIC_HEADERS
"${CMAKE_SOURCE_DIR}/setup/dynamic_libraries/win${BITS}/app/${CONFIGURATION}/*"
)
file(COPY ${MY_PUBLIC_HEADERS} DESTINATION "${CMAKE_BINARY_DIR}/${CONFIGURATION}/${TARGET}/")
endif()
configure_file("${QT_BINARY_DIR}/Qt5Core${SUFFIX}.dll" "${CMAKE_BINARY_DIR}/${CONFIGURATION}/${TARGET}/Qt5Core${SUFFIX}.dll" COPYONLY)
configure_file("${QT_BINARY_DIR}/Qt5Gui${SUFFIX}.dll" "${CMAKE_BINARY_DIR}/${CONFIGURATION}/${TARGET}/Qt5Gui${SUFFIX}.dll" COPYONLY)
configure_file("${QT_BINARY_DIR}/Qt5Network${SUFFIX}.dll" "${CMAKE_BINARY_DIR}/${CONFIGURATION}/${TARGET}/Qt5Network${SUFFIX}.dll" COPYONLY)
configure_file("${QT_BINARY_DIR}/Qt5Svg${SUFFIX}.dll" "${CMAKE_BINARY_DIR}/${CONFIGURATION}/${TARGET}/Qt5Svg${SUFFIX}.dll" COPYONLY)
configure_file("${QT_BINARY_DIR}/Qt5Widgets${SUFFIX}.dll" "${CMAKE_BINARY_DIR}/${CONFIGURATION}/${TARGET}/Qt5Widgets${SUFFIX}.dll" COPYONLY)
configure_file("${QT_BINARY_DIR}/Qt5WinExtras${SUFFIX}.dll" "${CMAKE_BINARY_DIR}/${CONFIGURATION}/${TARGET}/Qt5WinExtras${SUFFIX}.dll" COPYONLY)
configure_file("${QT_PLUGINS_DIR}/platforms/qwindows${SUFFIX}.dll" "${CMAKE_BINARY_DIR}/${CONFIGURATION}/${TARGET}/platforms/qwindows${SUFFIX}.dll" COPYONLY)
configure_file("${QT_PLUGINS_DIR}/styles/qwindowsvistastyle${SUFFIX}.dll" "${CMAKE_BINARY_DIR}/${CONFIGURATION}/${TARGET}/styles/qwindowsvistastyle${SUFFIX}.dll" COPYONLY)
configure_file("${QT_PLUGINS_DIR}/imageformats/qgif${SUFFIX}.dll" "${CMAKE_BINARY_DIR}/${CONFIGURATION}/${TARGET}/imageformats/qgif${SUFFIX}.dll" COPYONLY)
configure_file("${QT_PLUGINS_DIR}/imageformats/qicns${SUFFIX}.dll" "${CMAKE_BINARY_DIR}/${CONFIGURATION}/${TARGET}/imageformats/qicns${SUFFIX}.dll" COPYONLY)
configure_file("${QT_PLUGINS_DIR}/imageformats/qico${SUFFIX}.dll" "${CMAKE_BINARY_DIR}/${CONFIGURATION}/${TARGET}/imageformats/qico${SUFFIX}.dll" COPYONLY)
configure_file("${QT_PLUGINS_DIR}/imageformats/qjpeg${SUFFIX}.dll" "${CMAKE_BINARY_DIR}/${CONFIGURATION}/${TARGET}/imageformats/qjpeg${SUFFIX}.dll" COPYONLY)
configure_file("${QT_PLUGINS_DIR}/imageformats/qsvg${SUFFIX}.dll" "${CMAKE_BINARY_DIR}/${CONFIGURATION}/${TARGET}/imageformats/qsvg${SUFFIX}.dll" COPYONLY)
configure_file("${QT_PLUGINS_DIR}/imageformats/qtga${SUFFIX}.dll" "${CMAKE_BINARY_DIR}/${CONFIGURATION}/${TARGET}/imageformats/qtga${SUFFIX}.dll" COPYONLY)
configure_file("${QT_PLUGINS_DIR}/imageformats/qtiff${SUFFIX}.dll" "${CMAKE_BINARY_DIR}/${CONFIGURATION}/${TARGET}/imageformats/qtiff${SUFFIX}.dll" COPYONLY)
configure_file("${QT_PLUGINS_DIR}/imageformats/qwbmp${SUFFIX}.dll" "${CMAKE_BINARY_DIR}/${CONFIGURATION}/${TARGET}/imageformats/qwbmp${SUFFIX}.dll" COPYONLY)
configure_file("${QT_PLUGINS_DIR}/imageformats/qwebp${SUFFIX}.dll" "${CMAKE_BINARY_DIR}/${CONFIGURATION}/${TARGET}/imageformats/qwebp${SUFFIX}.dll" COPYONLY)
endfunction(COPY_QT_BINARIES)
COPY_QT_BINARIES(True True)
COPY_QT_BINARIES(True False)
COPY_QT_BINARIES(False True)
COPY_QT_BINARIES(False False)
configure_file("${CMAKE_SOURCE_DIR}/setup/icon/windows/sourcetrail.ico" "${CMAKE_BINARY_DIR}/${CONFIGURATION}/sourcetrail.ico" COPYONLY)
endif()
```
--------------------------------
### Get Index of Element in List in Java
Source: https://github.com/coatisoftware/sourcetrail/blob/master/bin/test/data/JavaIndexSampleProjectsTestSuite/JavaSymbolSolver060/expected_output/java-symbol-solver-model_com_github_javaparser_symbolsolver_model_typesystem_ReferenceType.txt
Returns the index in this list of the first occurrence of the specified element, or -1 if this list does not contain the element. More formally, returns the lowest index i such that (o==null ? get(i)==null : o.equals(get(i))), or -1 if there is no such index.
```java
int java.util.List.indexOf(java.lang.Object)
```
--------------------------------
### Navigator and Facade Utilities
Source: https://github.com/coatisoftware/sourcetrail/blob/master/bin/test/data/JavaIndexSampleProjectsTestSuite/JavaSymbolSolver060/expected_output/java-symbol-solver-core_com_github_javaparser_symbolsolver_javaparsermodel_declarations_JavaParserFieldDeclaration.txt
Utility methods for navigating the AST and interacting with the JavaParser facade.
```APIDOC
## Navigator and Facade Utilities
### Description
Provides utility methods for navigating the Abstract Syntax Tree (AST) and interacting with the JavaParser facade for symbol resolution.
### Methods
#### `Navigator.findAncestor(Node, Class)`
- **Description**: Finds an ancestor node of a specified type.
- **Method**: GET
- **Endpoint**: N/A (Static utility method)
- **Parameters**:
- **Path Parameters**:
- `node` (com.github.javaparser.ast.Node) - Required - The starting node for the search.
- `clazz` (java.lang.Class) - Required - The type of ancestor to find.
#### `JavaParserFacade.getTypeDeclaration(TypeDeclaration>)`
- **Description**: Retrieves the type declaration from the JavaParser facade.
- **Method**: GET
- **Endpoint**: N/A (Static utility method)
- **Parameters**:
- **Path Parameters**:
- `typeDeclaration` (com.github.javaparser.ast.body.TypeDeclaration>) - Required - The type declaration to process.
### Related Symbols
- `com.github.javaparser.ast.Node`
- `com.github.javaparser.ast.body.TypeDeclaration`
- `com.github.javaparser.symbolsolver.javaparser.Navigator`
- `com.github.javaparser.symbolsolver.javaparsermodel.JavaParserFacade`
```
--------------------------------
### JavassistUtils Methods
Source: https://github.com/coatisoftware/sourcetrail/blob/master/bin/test/data/JavaIndexSampleProjectsTestSuite/JavaSymbolSolver060/expected_output/java-symbol-solver-core_com_github_javaparser_symbolsolver_javassistmodel_JavassistEnumDeclaration.txt
Utility methods for working with Javassist, including getting method usages.
```APIDOC
## POST /javassist/utils/get-method-usage
### Description
Retrieves the method usage for a given Javassist class and method name.
### Method
POST
### Endpoint
/javassist/utils/get-method-usage
### Parameters
#### Request Body
- **ctClass** (CtClass) - Required - The CtClass object representing the Java class.
- **methodName** (string) - Required - The name of the method.
- **parameterTypes** (List) - Required - The list of parameter types for the method.
- **typeSolver** (TypeSolver) - Required - The type solver to use.
- **context** (Context) - Required - The resolution context.
### Request Example
```json
{
"ctClass": {"name": "com.example.MyClass"},
"methodName": "execute",
"parameterTypes": [
{"type": "java.lang.String"}
],
"typeSolver": {},
"context": {}
}
```
### Response
#### Success Response (200)
- **methodUsage** (Optional) - An optional containing the method usage if found.
#### Response Example
```json
{
"methodUsage": {
"methodDeclaration": {
"name": "execute",
"returnType": {"type": "void"}
},
"returnType": {"type": "void"}
}
}
```
```
--------------------------------
### Reference Type Utilities
Source: https://github.com/coatisoftware/sourcetrail/blob/master/bin/test/data/JavaIndexSampleProjectsTestSuite/JavaSymbolSolver060/expected_output/java-symbol-solver-model_com_github_javaparser_symbolsolver_model_declarations_ReferenceTypeDeclaration.txt
Utilities for working with reference types, such as converting to a reference type or getting its declaration.
```APIDOC
## Reference Type Utilities
### Description
This section provides utility methods for `ReferenceType` objects, including obtaining the underlying type declaration and converting the type.
### Methods
#### Get Type Declaration
* **Method:** `getTypeDeclaration()`
* **Class:** `com.github.javaparser.symbolsolver.model.typesystem.ReferenceType`
* **Returns:** `com.github.javaparser.symbolsolver.model.declarations.ReferenceTypeDeclaration`
* **Description:** Retrieves the `ReferenceTypeDeclaration` associated with this `ReferenceType`.
#### As Reference Type
* **Method:** `asReferenceType()`
* **Class:** `com.github.javaparser.symbolsolver.model.typesystem.ReferenceType`
* **Returns:** `com.github.javaparser.symbolsolver.model.typesystem.ReferenceType`
* **Description:** Converts this type to a `ReferenceType`, if possible.
```
--------------------------------
### Index Sourcetrail Projects via Command Line
Source: https://context7.com/coatisoftware/sourcetrail/llms.txt
Provides instructions on how to use the Sourcetrail command-line interface (CLI) to index projects without launching the graphical user interface. It includes commands for basic indexing and for performing a full re-index.
```bash
# Index a project from the command line
sourcetrail index --project-file /path/to/project.srctrlprj
# Index with full refresh (reindex all files)
sourcetrail index --project-file /path/to/project.srctrlprj --full
```
--------------------------------
### Get Bound Type (Java)
Source: https://github.com/coatisoftware/sourcetrail/blob/master/bin/test/data/JavaIndexSampleProjectsTestSuite/JavaSymbolSolver060/expected_output/java-symbol-solver-core_com_github_javaparser_symbolsolver_javaparsermodel_contexts_MethodCallExprContext.txt
Retrieves the Type object from a TypeParameterDeclaration.Bound.
```Java
com.github.javaparser.symbolsolver.model.typesystem.Type com.github.javaparser.symbolsolver.model.declarations.TypeParameterDeclaration.Bound.getType()
```
--------------------------------
### Get Class Name - JavaParserEnumDeclaration
Source: https://github.com/coatisoftware/sourcetrail/blob/master/bin/test/data/JavaIndexSampleProjectsTestSuite/JavaSymbolSolver060/expected_output/java-symbol-solver-core_com_github_javaparser_symbolsolver_javaparsermodel_declarations_JavaParserEnumDeclaration.txt
Retrieves the class name of the JavaParserEnumDeclaration. This method is part of the JavaParser library for symbol resolution.
```Java
public java.lang.String com.github.javaparser.symbolsolver.javaparsermodel.declarations.JavaParserEnumDeclaration.getClassName()
```
--------------------------------
### Build Sourcetrail with CMake
Source: https://context7.com/coatisoftware/sourcetrail/llms.txt
Instructions for cloning the Sourcetrail repository, configuring the build with CMake, and compiling the application. It details how to enable optional language packages for C/C++, Java, and Python, along with their respective dependencies.
```bash
# Clone the repository
git clone https://github.com/CoatiSoftware/Sourcetrail.git
cd Sourcetrail
# Create build directory
mkdir -p build/Release
cd build/Release
# Configure with CMake (base application only)
cmake -DCMAKE_BUILD_TYPE="Release" \
-DBOOST_ROOT=/path/to/boost_1_67_0 \
-DQt5_DIR=/path/to/Qt/5.12.3/gcc_64/lib/cmake/Qt5 \
../..
# Enable C/C++ language support (requires LLVM/Clang 11.0.0)
cmake -DCMAKE_BUILD_TYPE="Release" \
-DBOOST_ROOT=/path/to/boost_1_67_0 \
-DQt5_DIR=/path/to/Qt/5.12.3/gcc_64/lib/cmake/Qt5 \
-DClang_DIR=/path/to/llvm_build/lib/cmake/clang \
-DBUILD_CXX_LANGUAGE_PACKAGE=ON \
../..
# Enable Java language support (requires JDK 1.8)
cmake -DCMAKE_BUILD_TYPE="Release" \
-DBOOST_ROOT=/path/to/boost_1_67_0 \
-DQt5_DIR=/path/to/Qt/5.12.3/gcc_64/lib/cmake/Qt5 \
-DBUILD_JAVA_LANGUAGE_PACKAGE=ON \
../..
# Enable Python language support
cmake -DCMAKE_BUILD_TYPE="Release" \
-DBOOST_ROOT=/path/to/boost_1_67_0 \
-DQt5_DIR=/path/to/Qt/5.12.3/gcc_64/lib/cmake/Qt5 \
-DBUILD_PYTHON_LANGUAGE_PACKAGE=ON \
../..
# Build the application
make Sourcetrail
# Run tests
cd bin/test
./Sourcetrail_test
```
--------------------------------
### Get Canonical Name of Class (Java)
Source: https://github.com/coatisoftware/sourcetrail/blob/master/bin/test/data/JavaIndexSampleProjectsTestSuite/JavaSymbolSolver060/expected_output/java-symbol-solver-core_com_github_javaparser_symbolsolver_javaparsermodel_declarations_JavaParserClassDeclaration.txt
Returns the canonical name of a Java class. This is the name returned by Class.getCanonicalName().
```java
java.lang.String java.lang.Class.getCanonicalName()
```
--------------------------------
### Build GUI Library Configuration (CMake)
Source: https://github.com/coatisoftware/sourcetrail/blob/master/CMakeLists.txt
Configures the build for the GUI library. It sets CMake to automatically run MOC, defines a custom target for versioning, adds the library, links necessary dependencies (including Qt5 modules), and sets include directories. It also configures versioning files and handles platform-specific include files.
```cmake
# Find includes in corresponding build directories
set(CMAKE_INCLUDE_CURRENT_DIR ON)
# Instruct CMake to run moc automatically when needed.
set(CMAKE_AUTOMOC ON)
# target for running versionnumber script
# workaround for running customcommand (ninja dependency cycle)
add_custom_target(
versionnumber ALL
)
add_library(${LIB_GUI_PROJECT_NAME} ${LIB_GUI_FILES} ${CMAKE_BINARY_DIR}/src/lib_gui/productVersion.h)
target_link_libraries(${LIB_GUI_PROJECT_NAME} ${LIB_UTILITY_PROJECT_NAME} ${LIB_PROJECT_NAME} Qt5::Widgets Qt5::Network Qt5::Svg)
if (WIN32)
target_link_libraries(${LIB_GUI_PROJECT_NAME} Qt5::WinExtras)
endif()
# command for versioning script
add_custom_command(
TARGET versionnumber
PRE_BUILD
COMMAND ${CMAKE_COMMAND} -DBINARY_DIR=${CMAKE_BINARY_DIR} -P ${CMAKE_SOURCE_DIR}/cmake/version.cmake
BYPRODUCTS ${CMAKE_BINARY_DIR}/src/lib_gui/productVersion.h
DEPENDS ${LIB_GUI_PROJECT_NAME}
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
COMMENT "check/update version number"
)
add_dependencies(${LIB_GUI_PROJECT_NAME} versionnumber)
create_source_groups(${LIB_GUI_FILES})
set_property(
TARGET ${LIB_GUI_PROJECT_NAME}
PROPERTY INCLUDE_DIRECTORIES
"${LIB_GUI_INCLUDE_PATHS}"
"${LIB_UTILITY_INCLUDE_PATHS}"
"${LIB_INCLUDE_PATHS}"
"${CMAKE_BINARY_DIR}/src/lib_gui"
"${CMAKE_BINARY_DIR}/src/lib"
$<$:${LIB_CXX_INCLUDE_PATHS}>
$<$:${LIB_JAVA_INCLUDE_PATHS}>
$<$:${LIB_PYTHON_INCLUDE_PATHS}>
)
# include external header without warnings
target_include_directories(${LIB_GUI_PROJECT_NAME} SYSTEM
PUBLIC ${Boost_INCLUDE_DIRS}
"${EXTERNAL_INCLUDE_PATHS}"
"${EXTERNAL_C_INCLUDE_PATHS}"
)
# configure platform specific include file
configure_file(
"${PROJECT_SOURCE_DIR}/src/lib_gui/platform_includes/includes.h.in"
"${PROJECT_BINARY_DIR}/src/lib_gui/includes.h"
)
#configure the versioning file
configure_file(
${CMAKE_SOURCE_DIR}/cmake/version.txt.in
${CMAKE_BINARY_DIR}/version.txt
)
configure_file(
${CMAKE_SOURCE_DIR}/cmake/productVersion.h.in
${CMAKE_BINARY_DIR}/src/lib_gui/productVersion.h
)
set_property(SOURCE ${CMAKE_BINARY_DIR}/src/lib_gui/productVersion.h PROPERTY SKIP_AUTOMOC ON)
set(CMAKE_AUTOMOC OFF)
```
--------------------------------
### JavaParserTypeVariableDeclaration Methods
Source: https://github.com/coatisoftware/sourcetrail/blob/master/bin/test/data/JavaIndexSampleProjectsTestSuite/JavaSymbolSolver060/expected_output/java-symbol-solver-core_com_github_javaparser_symbolsolver_javaparsermodel_declarations_JavaParserTypeVariableDeclaration.txt
This section details methods related to JavaParserTypeVariableDeclaration, including solving methods, getting usage, and checking type parameter status.
```APIDOC
## JavaParserTypeVariableDeclaration Methods
### Description
Provides methods for interacting with type variable declarations in JavaParser's symbol solver.
### Methods
#### `solveMethod`
* **Description**: Solves a method declaration for the given name and parameter types.
* **Method**: N/A (Internal method)
* **Endpoint**: N/A
* **Parameters**:
* `name` (String) - The name of the method to solve.
* `types` (List) - A list of types for the method parameters.
* **Return Type**: `SymbolReference`
#### `getUsage`
* **Description**: Gets the usage type of a given AST node.
* **Method**: N/A (Internal method)
* **Endpoint**: N/A
* **Parameters**:
* `node` (Node) - The AST node to get the usage for.
* **Return Type**: `Type`
#### `isTypeParameter`
* **Description**: Checks if this declaration represents a type parameter.
* **Method**: N/A (Internal method)
* **Endpoint**: N/A
* **Return Type**: `boolean`
#### `getField`
* **Description**: Retrieves a field declaration by its name.
* **Method**: N/A (Internal method)
* **Endpoint**: N/A
* **Parameters**:
* `name` (String) - The name of the field.
* **Return Type**: `FieldDeclaration`
#### `hasField`
* **Description**: Checks if a field with the given name exists.
* **Method**: N/A (Internal method)
* **Endpoint**: N/A
* **Parameters**:
* `name` (String) - The name of the field.
* **Return Type**: `boolean`
#### `getAllFields`
* **Description**: Retrieves all field declarations associated with this type.
* **Method**: N/A (Internal method)
* **Endpoint**: N/A
* **Return Type**: `List`
#### `getAncestors`
* **Description**: Retrieves the list of ancestor types.
* **Method**: N/A (Internal method)
* **Endpoint**: N/A
* **Return Type**: `List`
#### `getDeclaredMethods`
* **Description**: Retrieves all methods declared directly within this type.
* **Method**: N/A (Internal method)
* **Endpoint**: N/A
* **Return Type**: `Set`
#### `isField`
* **Description**: Checks if this declaration represents a field.
* **Method**: N/A (Internal method)
* **Endpoint**: N/A
* **Return Type**: `boolean`
#### `isParameter`
* **Description**: Checks if this declaration represents a parameter.
* **Method**: N/A (Internal method)
* **Endpoint**: N/A
* **Return Type**: `boolean`
```
--------------------------------
### Java Map Integration
Source: https://github.com/coatisoftware/sourcetrail/blob/master/bin/test/data/JavaIndexSampleProjectsTestSuite/JavaSymbolSolver060/expected_output/java-symbol-solver-model_com_github_javaparser_symbolsolver_model_typesystem_parametrization_TypeParametersMap.txt
Details methods that leverage standard Java `Map` interfaces for operations like `putAll` and `get`.
```APIDOC
## Java Map Integration
### Description
Methods that interact with or are based on the standard Java `Map` interface.
### Methods
#### `putAll(Map extends K, ? extends V>)`
- **Method**: void
- **Parameters**:
- `m` (Map) - Required - The map whose key-value mappings are to be added.
- **Description**: Copies all of the mappings from the specified map to this map.
#### `put(K, V)`
- **Method**: V
- **Parameters**:
- `k` (K) - Required - The key with which the specified value is to be associated.
- `v` (V) - Required - The value to be associated with the specified key.
- **Returns**: `V` - The previous value associated with key, or null if there was no mapping for key.
- **Description**: Associates the specified value with the specified key in this map.
#### `containsKey(Object)`
- **Method**: boolean
- **Parameters**:
- `key` (Object) - Required - The key whose presence in this map is to be tested.
- **Returns**: `boolean` - true if this map contains a mapping for the specified key.
- **Description**: Returns true if this map contains a mapping for the specified key.
#### `get(Object)`
- **Method**: V
- **Parameters**:
- `key` (Object) - Required - The key whose associated value is to be returned.
- **Returns**: `V` - The value to which the specified key is mapped, or null if this map contains no mapping for the key.
- **Description**: Returns the value to which the specified key is mapped, or null if this map does not contain the key.
```
--------------------------------
### Get Bounded Type of Wildcard (Java)
Source: https://github.com/coatisoftware/sourcetrail/blob/master/bin/test/data/JavaIndexSampleProjectsTestSuite/JavaSymbolSolver060/expected_output/java-symbol-solver-core_com_github_javaparser_symbolsolver_javaparsermodel_contexts_MethodCallExprContext.txt
Retrieves the type that the wildcard is bounded by (e.g., the 'T' in '? extends T' or '? super T').
```Java
com.github.javaparser.symbolsolver.model.typesystem.Type com.github.javaparser.symbolsolver.model.typesystem.Wildcard.getBoundedType()
```
--------------------------------
### ImmutableList Static Factory Methods
Source: https://github.com/coatisoftware/sourcetrail/blob/master/bin/test/data/JavaIndexSampleProjectsTestSuite/JavaSymbolSolver060/expected_output/java-symbol-solver-model_com_github_javaparser_symbolsolver_model_typesystem_PrimitiveType.txt
Details static factory methods for creating ImmutableList instances.
```APIDOC
## ImmutableList Static Factory Methods
### Description
Provides static methods to create immutable lists with a specified number of elements.
### Method
static ImmutableList of(E, E, E, E, E, E)
static ImmutableList of(E, E, E, E, E, E, E, E)
### Endpoint
N/A
### Parameters
- **E** (Type) - The type of elements in the list.
### Request Example
N/A
### Response
#### Success Response (200)
- **ImmutableList** - An immutable list containing the provided elements.
#### Response Example
N/A
```
--------------------------------
### CLI: Indexing Projects
Source: https://context7.com/coatisoftware/sourcetrail/llms.txt
Sourcetrail provides a command-line interface for indexing projects without needing the graphical user interface.
```APIDOC
## CLI: Indexing Projects
### Description
Sourcetrail provides a command-line interface for indexing projects without the GUI.
### Method
CLI Command
### Endpoint
`sourcetrail index`
### Parameters
#### Command Line Arguments
- `--project-file` (string) - Required - Path to the Sourcetrail project file (`.srctrlprj`).
- `--full` (boolean) - Optional - Flag to perform a full reindex of all files.
### Request Example
```bash
# Index a project from the command line
sourcetrail index --project-file /path/to/project.srctrlprj
# Index with full refresh (reindex all files)
sourcetrail index --project-file /path/to/project.srctrlprj --full
```
### Response
#### Success Response (0)
The command executes and indexes the specified project. Output will be displayed in the console.
```
--------------------------------
### Get Method Usage - JavaParserEnumDeclaration.ValuesMethod
Source: https://github.com/coatisoftware/sourcetrail/blob/master/bin/test/data/JavaIndexSampleProjectsTestSuite/JavaSymbolSolver060/expected_output/java-symbol-solver-core_com_github_javaparser_symbolsolver_javaparsermodel_declarations_JavaParserEnumDeclaration.txt
Retrieves the MethodUsage for the 'ValuesMethod' within a JavaParserEnumDeclaration. This is specific to handling enum values and their associated methods.
```Java
public com.github.javaparser.symbolsolver.model.methods.MethodUsage com.github.javaparser.symbolsolver.javaparsermodel.declarations.JavaParserEnumDeclaration.ValuesMethod.getUsage(com.github.javaparser.ast.Node)
```
--------------------------------
### Get TypeParameterDeclaration Name in Java
Source: https://github.com/coatisoftware/sourcetrail/blob/master/bin/test/data/JavaIndexSampleProjectsTestSuite/JavaSymbolSolver060/expected_output/java-symbol-solver-model_com_github_javaparser_symbolsolver_model_typesystem_ReferenceType.txt
Retrieves the name of a TypeParameterDeclaration. This is used to identify generic type parameters.
```java
java.lang.String com.github.javaparser.symbolsolver.model.declarations.TypeParameterDeclaration.getName()
```
--------------------------------
### Qt Utility and Compatibility Functions (C++)
Source: https://github.com/coatisoftware/sourcetrail/blob/master/src/lib_gui/CMakeLists.txt
Provides utility functions and Qt compatibility layers for the SourceTrail project. This includes context menus, scaled pixmaps, file dialogs, layout managers, and thread-safe function execution.
```cpp
#include "compatibilityQt.h"
#include "QtContextMenu.h"
#include "QtDeviceScaledPixmap.h"
#include "QtFileDialog.h"
#include "QtFilesAndDirectoriesDialog.h"
#include "QtFlowLayout.h"
#include "QtHelpButtonInfo.h"
#include "QtHighlighter.h"
#include "QtScrollSpeedChangeListener.h"
#include "QtThreadedFunctor.h"
#include "QtWindowsTaskbarButton.h"
#include "utilityQt.h"
```
--------------------------------
### DefaultVisitorAdapter Visit Methods
Source: https://github.com/coatisoftware/sourcetrail/blob/master/bin/test/data/JavaIndexSampleProjectsTestSuite/JavaSymbolSolver060/expected_output/java-symbol-solver-core_com_github_javaparser_symbolsolver_javaparsermodel_DefaultVisitorAdapter.txt
This section details the various visit methods implemented in the DefaultVisitorAdapter class for different AST nodes.
```APIDOC
## DefaultVisitorAdapter Visit Methods
### Description
Provides methods for visiting different Abstract Syntax Tree (AST) nodes within the JavaParser library, as implemented by the DefaultVisitorAdapter.
### Method
`public com.github.javaparser.symbolsolver.model.typesystem.Type com.github.javaparser.symbolsolver.javaparsermodel.DefaultVisitorAdapter.visit(com.github.javaparser.ast.stmt.ThrowStmt, java.lang.Boolean)`
### Endpoint
N/A (This is a Java method signature, not a REST endpoint)
### Parameters
#### Path Parameters
None
#### Query Parameters
None
#### Request Body
None
### Request Example
N/A
### Response
#### Success Response (200)
- **Type** (com.github.javaparser.symbolsolver.model.typesystem.Type) - The resolved type for the visited node.
#### Response Example
N/A
---
### Method
`public com.github.javaparser.symbolsolver.model.typesystem.Type com.github.javaparser.symbolsolver.javaparsermodel.DefaultVisitorAdapter.visit(com.github.javaparser.ast.stmt.SynchronizedStmt, java.lang.Boolean)`
### Endpoint
N/A
### Parameters
None
### Request Example
N/A
### Response
#### Success Response (200)
- **Type** (com.github.javaparser.symbolsolver.model.typesystem.Type) - The resolved type for the visited node.
#### Response Example
N/A
---
### Method
`public com.github.javaparser.symbolsolver.model.typesystem.Type com.github.javaparser.symbolsolver.javaparsermodel.DefaultVisitorAdapter.visit(com.github.javaparser.ast.stmt.TryStmt, java.lang.Boolean)`
### Endpoint
N/A
### Parameters
None
### Request Example
N/A
### Response
#### Success Response (200)
- **Type** (com.github.javaparser.symbolsolver.model.typesystem.Type) - The resolved type for the visited node.
#### Response Example
N/A
---
### Method
`public com.github.javaparser.symbolsolver.model.typesystem.Type com.github.javaparser.symbolsolver.javaparsermodel.DefaultVisitorAdapter.visit(com.github.javaparser.ast.stmt.CatchClause, java.lang.Boolean)`
### Endpoint
N/A
### Parameters
None
### Request Example
N/A
### Response
#### Success Response (200)
- **Type** (com.github.javaparser.symbolsolver.model.typesystem.Type) - The resolved type for the visited node.
#### Response Example
N/A
---
### Method
`public com.github.javaparser.symbolsolver.model.typesystem.Type com.github.javaparser.symbolsolver.javaparsermodel.DefaultVisitorAdapter.visit(com.github.javaparser.ast.expr.LambdaExpr, java.lang.Boolean)`
### Endpoint
N/A
### Parameters
None
### Request Example
N/A
### Response
#### Success Response (200)
- **Type** (com.github.javaparser.symbolsolver.model.typesystem.Type) - The resolved type for the visited node.
#### Response Example
N/A
---
### Method
`public com.github.javaparser.symbolsolver.model.typesystem.Type com.github.javaparser.symbolsolver.javaparsermodel.DefaultVisitorAdapter.visit(com.github.javaparser.ast.expr.MethodReferenceExpr, java.lang.Boolean)`
### Endpoint
N/A
### Parameters
None
### Request Example
N/A
### Response
#### Success Response (200)
- **Type** (com.github.javaparser.symbolsolver.model.typesystem.Type) - The resolved type for the visited node.
#### Response Example
N/A
---
### Method
`public com.github.javaparser.symbolsolver.model.typesystem.Type com.github.javaparser.symbolsolver.javaparsermodel.DefaultVisitorAdapter.visit(com.github.javaparser.ast.expr.TypeExpr, java.lang.Boolean)`
### Endpoint
N/A
### Parameters
None
### Request Example
N/A
### Response
#### Success Response (200)
- **Type** (com.github.javaparser.symbolsolver.model.typesystem.Type) - The resolved type for the visited node.
#### Response Example
N/A
---
### Method
`public com.github.javaparser.symbolsolver.model.typesystem.Type com.github.javaparser.symbolsolver.javaparsermodel.DefaultVisitorAdapter.visit(com.github.javaparser.ast.NodeList, java.lang.Boolean)`
### Endpoint
N/A
### Parameters
None
### Request Example
N/A
### Response
#### Success Response (200)
- **Type** (com.github.javaparser.symbolsolver.model.typesystem.Type) - The resolved type for the visited node.
#### Response Example
N/A
---
### Method
`public com.github.javaparser.symbolsolver.model.typesystem.Type com.github.javaparser.symbolsolver.javaparsermodel.DefaultVisitorAdapter.visit(com.github.javaparser.ast.expr.Name, java.lang.Boolean)`
### Endpoint
N/A
### Parameters
None
### Request Example
N/A
### Response
#### Success Response (200)
- **Type** (com.github.javaparser.symbolsolver.model.typesystem.Type) - The resolved type for the visited node.
#### Response Example
N/A
```
--------------------------------
### GET /moveCursor
Source: https://context7.com/coatisoftware/sourcetrail/llms.txt
Sourcetrail sends this message to request the IDE to navigate to a specific location. This is typically used when a user clicks on a symbol in Sourcetrail.
```APIDOC
## GET /moveCursor
### Description
Sourcetrail sends this message to request the IDE to navigate to a specific location.
### Method
GET (received by IDE plugin)
### Endpoint
`/moveCursor` (via TCP socket on port 6666)
### Parameters
#### Query Parameters
- **file_path** (string) - Required - The absolute path to the source file.
- **line** (integer) - Required - The line number to navigate to.
- **column** (integer) - Required - The column number to navigate to.
### Response Example
```python
# Python example: Listen for messages from Sourcetrail
import socket
def listen_for_sourcetrail(port=6666):
"""Listen for incoming messages from Sourcetrail."""
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as server:
server.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
server.bind(('localhost', port))
server.listen(1)
print(f"Listening on port {port}...")
while True:
conn, addr = server.accept()
with conn:
data = conn.recv(4096).decode('utf-8')
if data:
# Parse moveCursor message
# Format: moveCursor>>file_path>>line>>column
if data.startswith("moveCursor>>"):
parts = data.replace("", "").split(">>")
file_path = parts[1]
line = int(parts[2])
column = int(parts[3])
print(f"Navigate to: {file_path}:{line}:{column}")
# Open file in your IDE at the specified location
# Start listening
listen_for_sourcetrail()
```
### Response
#### Success Response (200)
This is a message sent from Sourcetrail to the IDE. The IDE should process this message to navigate its cursor.
```
--------------------------------
### Storage Migration Utilities (C++)
Source: https://github.com/coatisoftware/sourcetrail/blob/master/src/lib/CMakeLists.txt
Provides classes for managing storage migrations, specifically for SQLite databases. This includes base migrator classes and lambda-based migration implementations.
```cpp
#include "data/storage/migration/SqliteStorageMigration.h"
#include "data/storage/migration/SqliteStorageMigrationLambda.h"
#include "data/storage/migration/SqliteStorageMigrator.h"
// ... implementation details for storage migration
```
--------------------------------
### Get Type Parameter Bounds (Java)
Source: https://github.com/coatisoftware/sourcetrail/blob/master/bin/test/data/JavaIndexSampleProjectsTestSuite/JavaSymbolSolver060/expected_output/java-symbol-solver-core_com_github_javaparser_symbolsolver_javaparsermodel_contexts_MethodCallExprContext.txt
Retrieves the bounds of a type parameter declaration. This is relevant for generic types and methods.
```Java
java.util.List com.github.javaparser.symbolsolver.model.declarations.TypeParameterDeclaration.getBounds(com.github.javaparser.symbolsolver.model.resolution.TypeSolver typeSolver)
```
--------------------------------
### MethodUsage and Type Methods
Source: https://github.com/coatisoftware/sourcetrail/blob/master/bin/test/data/JavaIndexSampleProjectsTestSuite/JavaSymbolSolver060/expected_output/java-symbol-solver-core_com_github_javaparser_symbolsolver_declarations_common_MethodDeclarationCommonLogic.txt
Documentation for creating MethodUsage objects and checking/casting types.
```APIDOC
## MethodUsage and Type Methods
### Description
Provides functionalities for creating `MethodUsage` objects and performing operations on `Type` objects, such as checking if they are type variables or reference types, and converting them.
### Methods
#### `MethodUsage` Constructor
- **Method**: `SYMBOL_METHOD`
- **Signature**: `com.github.javaparser.symbolsolver.model.methods.MethodUsage.MethodUsage(com.github.javaparser.symbolsolver.model.declarations.MethodDeclaration, java.util.List, com.github.javaparser.symbolsolver.model.typesystem.Type)`
- **Description**: Constructs a `MethodUsage` object.
#### `isTypeVariable`
- **Method**: `SYMBOL_METHOD`
- **Signature**: `boolean com.github.javaparser.symbolsolver.model.typesystem.Type.isTypeVariable()`
- **Description**: Checks if the type is a type variable.
#### `asTypeParameter`
- **Method**: `SYMBOL_METHOD`
- **Signature**: `com.github.javaparser.symbolsolver.model.declarations.TypeParameterDeclaration com.github.javaparser.symbolsolver.model.typesystem.Type.asTypeParameter()`
- **Description**: Casts the type to a `TypeParameterDeclaration`.
#### `isReferenceType`
- **Method**: `SYMBOL_METHOD`
- **Signature**: `boolean com.github.javaparser.symbolsolver.model.typesystem.Type.isReferenceType()`
- **Description**: Checks if the type is a reference type.
#### `asReferenceType`
- **Method**: `SYMBOL_METHOD`
- **Signature**: `com.github.javaparser.symbolsolver.model.typesystem.ReferenceType com.github.javaparser.symbolsolver.model.typesystem.Type.asReferenceType()`
- **Description**: Casts the type to a `ReferenceType`.
#### `transformTypeParameters`
- **Method**: `SYMBOL_METHOD`
- **Signature**: `com.github.javaparser.symbolsolver.model.typesystem.Type com.github.javaparser.symbolsolver.model.typesystem.ReferenceType.transformTypeParameters(com.github.javaparser.symbolsolver.model.typesystem.TypeTransformer)`
- **Description**: Transforms the type parameters of a reference type.
```
--------------------------------
### Get Annotation Name (Java)
Source: https://github.com/coatisoftware/sourcetrail/blob/master/bin/test/data/JavaIndexSampleProjectsTestSuite/JavaSymbolSolver060/expected_output/java-symbol-solver-core_com_github_javaparser_symbolsolver_javaparsermodel_declarations_JavaParserClassDeclaration.txt
Retrieves the name of an annotation expression from the Java AST. This is useful for inspecting annotations applied to code elements.
```java
com.github.javaparser.ast.expr.Name com.github.javaparser.ast.expr.AnnotationExpr.getName()
```
--------------------------------
### Java List and Collection Utilities
Source: https://github.com/coatisoftware/sourcetrail/blob/master/bin/test/data/JavaIndexSampleProjectsTestSuite/JavaSymbolSolver060/expected_output/java-symbol-solver-core_com_github_javaparser_symbolsolver_javassistmodel_JavassistClassDeclaration.txt
Documentation for common methods available on Java's List and Collection interfaces.
```APIDOC
## Java List and Collection Utilities
### Description
This section outlines common methods provided by Java's List and Collection interfaces, used within the project.
### Methods
#### List Methods
- **Method:** `add(java.util.List.E)`
- **Description:** Adds an element to the list.
- **Class:** `java.util.List`
- **Method:** `addAll(java.util.Collection extends E>)`
- **Description:** Adds all elements from a collection to the list.
- **Class:** `java.util.List`
#### LinkedList Constructor
- **Method:** `LinkedList()`
- **Description:** Constructs an empty LinkedList.
- **Class:** `java.util.LinkedList`
#### ArrayList Constructor
- **Method:** `ArrayList()`
- **Description:** Constructs an empty ArrayList.
- **Class:** `java.util.ArrayList`
```
--------------------------------
### Get Corresponding Declaration from Symbol Reference (Java)
Source: https://github.com/coatisoftware/sourcetrail/blob/master/bin/test/data/JavaIndexSampleProjectsTestSuite/JavaSymbolSolver060/expected_output/java-symbol-solver-core_com_github_javaparser_symbolsolver_javaparsermodel_declarations_JavaParserClassDeclaration.txt
Retrieves the declaration corresponding to a symbol reference. This is used to navigate from a reference in the code to its definition.
```java
com.github.javaparser.symbolsolver.model.resolution.SymbolReference.S com.github.javaparser.symbolsolver.model.resolution.SymbolReference.getCorrespondingDeclaration()
```
--------------------------------
### Get All Ancestors of ReferenceTypeDeclaration in Java
Source: https://github.com/coatisoftware/sourcetrail/blob/master/bin/test/data/JavaIndexSampleProjectsTestSuite/JavaSymbolSolver060/expected_output/java-symbol-solver-model_com_github_javaparser_symbolsolver_model_typesystem_ReferenceType.txt
Retrieves all ancestor types for a ReferenceTypeDeclaration. This method is used to traverse the inheritance hierarchy of types.
```java
java.util.List com.github.javaparser.symbolsolver.model.declarations.ReferenceTypeDeclaration.getAllAncestors()
```
--------------------------------
### DefaultVisitorAdapter Visit Methods
Source: https://github.com/coatisoftware/sourcetrail/blob/master/bin/test/data/JavaIndexSampleProjectsTestSuite/JavaSymbolSolver060/expected_output/java-symbol-solver-core_com_github_javaparser_symbolsolver_javaparsermodel_DefaultVisitorAdapter.txt
This section outlines the visit methods implemented in the DefaultVisitorAdapter class, which are part of the symbol solver for Java.
```APIDOC
## DefaultVisitorAdapter Visit Methods
### Description
Implements visitor pattern methods for specific Java AST node types, returning symbol-solver types.
### Method
`visit`
### Endpoint
N/A (Internal Library Methods)
### Parameters
#### Path Parameters
None
#### Query Parameters
None
#### Request Body
None
### Request Example
None
### Response
#### Success Response (200)
- **Type** (com.github.javaparser.symbolsolver.model.typesystem.Type) - The resolved type for the visited node.
#### Response Example
```json
{
"example": "com.github.javaparser.symbolsolver.model.typesystem.Type"
}
```
```
--------------------------------
### HashMap Constructor
Source: https://github.com/coatisoftware/sourcetrail/blob/master/bin/test/data/JavaIndexSampleProjectsTestSuite/JavaSymbolSolver060/expected_output/java-symbol-solver-core_com_github_javaparser_symbolsolver_resolution_ConstructorResolutionLogic.txt
API endpoint for creating a new HashMap instance.
```APIDOC
## POST /api/collections/hashMap/constructor
### Description
Creates a new HashMap instance with default initial capacity (16) and load factor (0.75).
### Method
POST
### Endpoint
/api/collections/hashMap/constructor
### Parameters
No parameters required.
### Response
#### Success Response (200)
- **hashMap** (java.util.HashMap) - An empty HashMap.
#### Response Example
```json
{
"hashMap": {}
}
```
```
--------------------------------
### Get Type Declaration from Reference Type (Java)
Source: https://github.com/coatisoftware/sourcetrail/blob/master/bin/test/data/JavaIndexSampleProjectsTestSuite/JavaSymbolSolver060/expected_output/java-symbol-solver-core_com_github_javaparser_symbolsolver_javaparsermodel_contexts_MethodCallExprContext.txt
Retrieves the TypeDeclaration associated with a ReferenceType. This allows access to the underlying declaration of a reference type.
```Java
com.github.javaparser.symbolsolver.model.declarations.ReferenceTypeDeclaration com.github.javaparser.symbolsolver.model.typesystem.ReferenceType.getTypeDeclaration()
```
--------------------------------
### ValueDeclaration API
Source: https://github.com/coatisoftware/sourcetrail/blob/master/bin/test/data/JavaIndexSampleProjectsTestSuite/JavaSymbolSolver060/expected_output/java-symbol-solver-model_com_github_javaparser_symbolsolver_model_typesystem_ReferenceType.txt
Provides methods for inspecting Java ValueDeclarations.
```APIDOC
## GET /api/valuedeclaration/getType
### Description
Retrieves the type of a value declaration.
### Method
GET
### Endpoint
/api/valuedeclaration/{id}/getType
### Parameters
#### Path Parameters
- **id** (string) - Required - The unique identifier of the value declaration.
### Response
#### Success Response (200)
- **type** (object) - The type of the value declaration.
#### Response Example
```json
{
"type": {
"name": "java.lang.String",
"typeKind": "REFERENCE"
}
}
```
```
--------------------------------
### Java Class Component Type Retrieval
Source: https://github.com/coatisoftware/sourcetrail/blob/master/bin/test/data/JavaIndexSampleProjectsTestSuite/JavaSymbolSolver060/expected_output/java-symbol-solver-core_com_github_javaparser_symbolsolver_reflectionmodel_ReflectionFactory.txt
Retrieves the component type of a Java Class. This is particularly useful for array types to get the type of their elements.
```java
SYMBOL_METHOD: java.lang.Class> java.lang.Class.getComponentType()
```
--------------------------------
### Configure C++ Project with Compilation Database
Source: https://context7.com/coatisoftware/sourcetrail/llms.txt
Demonstrates how to generate a Clang JSON Compilation Database for C++ projects using CMake, which Sourcetrail uses for project import. The generated `compile_commands.json` file is then referenced in the Sourcetrail project configuration.
```bash
# Generate compilation database from CMake
cd your_project
mkdir build && cd build
cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON ..
# The compile_commands.json file is created in the build directory
# Use this file when setting up a Sourcetrail project
```
--------------------------------
### Get Class Name of Type Declaration (Java)
Source: https://github.com/coatisoftware/sourcetrail/blob/master/bin/test/data/JavaIndexSampleProjectsTestSuite/JavaSymbolSolver060/expected_output/java-symbol-solver-core_com_github_javaparser_symbolsolver_javaparsermodel_declarations_JavaParserClassDeclaration.txt
Retrieves the simple name of a class declaration. This method provides the base name of the class without its package.
```java
java.lang.String com.github.javaparser.symbolsolver.model.declarations.TypeDeclaration.getClassName()
```
```java
public java.lang.String com.github.javaparser.symbolsolver.javaparsermodel.declarations.JavaParserClassDeclaration.getClassName() [JavaParserClassDeclaration.java <207:5 <207:5 <208:19 208:30> 208:32> 210:5>]
```
```java
java.lang.String com.github.javaparser.symbolsolver.javaparsermodel.declarations.JavaParserTypeAdapter.getClassName()
```
--------------------------------
### Get Type Declaration from ReferenceType in Java
Source: https://github.com/coatisoftware/sourcetrail/blob/master/bin/test/data/JavaIndexSampleProjectsTestSuite/JavaSymbolSolver060/expected_output/java-symbol-solver-model_com_github_javaparser_symbolsolver_model_typesystem_ReferenceType.txt
Retrieves the type declaration associated with a ReferenceType. This allows access to the underlying declaration of a referenced type.
```java
public com.github.javaparser.symbolsolver.model.declarations.ReferenceTypeDeclaration com.github.javaparser.symbolsolver.model.typesystem.ReferenceType.getTypeDeclaration() [ReferenceType.java <310:1 <310:1 <310:43 310:60> 310:62> 312:5>]
```