diff --git a/cpg-core/src/main/kotlin/de/fraunhofer/aisec/cpg/frontends/Language.kt b/cpg-core/src/main/kotlin/de/fraunhofer/aisec/cpg/frontends/Language.kt index 4142c8ecb7..a5cce9f405 100644 --- a/cpg-core/src/main/kotlin/de/fraunhofer/aisec/cpg/frontends/Language.kt +++ b/cpg-core/src/main/kotlin/de/fraunhofer/aisec/cpg/frontends/Language.kt @@ -31,6 +31,7 @@ import com.fasterxml.jackson.databind.JsonSerializer import com.fasterxml.jackson.databind.SerializerProvider import com.fasterxml.jackson.databind.annotation.JsonSerialize import de.fraunhofer.aisec.cpg.* +import de.fraunhofer.aisec.cpg.graph.Name import de.fraunhofer.aisec.cpg.graph.Node import de.fraunhofer.aisec.cpg.graph.declarations.FunctionDeclaration import de.fraunhofer.aisec.cpg.graph.edges.ast.TemplateArguments @@ -42,7 +43,6 @@ import de.fraunhofer.aisec.cpg.passes.SymbolResolver import java.io.File import kotlin.reflect.KClass import kotlin.reflect.full.primaryConstructor -import org.apache.commons.lang3.builder.ToStringBuilder /** * [CastResult] is the result of the function [Language.tryCast] and describes whether a cast of one @@ -143,14 +143,9 @@ abstract class Language> : Node() { return result } - override fun toString(): String { - val builder = ToStringBuilder(this, TO_STRING_STYLE) - - if (name.isNotEmpty()) { - builder.append("name", name) - } - - return builder.toString() + init { + this.language = this + this::class.simpleName?.let { this.name = Name(it) } } private fun arithmeticOpTypePropagation(lhs: Type, rhs: Type): Type { @@ -365,10 +360,6 @@ abstract class Language> : Node() { Pair(list.toSet(), CallResolutionResult.SuccessKind.SUCCESSFUL) } } - - override var language: Language<*> - get() = this - set(_) {} } /**