diff --git a/build.gradle.kts b/build.gradle.kts index fabc885b7..82d297107 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -5,14 +5,14 @@ val semVer: String? by project val includeDokka: String? by project group = "org.jacodb" -version = semVer ?: "1.3-SNAPSHOT" +version = semVer ?: "1.4-SNAPSHOT" plugins { kotlin("jvm") version Versions.kotlin kotlin("plugin.allopen") version Versions.kotlin kotlin("plugin.serialization") version Versions.kotlin apply false - with(Plugins.Dokka) { id(id) version (version) } - with(Plugins.Licenser) { id(id) version (version) } + id(Plugins.Dokka) + id(Plugins.Licenser) `java-library` `java-test-fixtures` `maven-publish` @@ -96,6 +96,13 @@ allprojects { setup(jacocoTestReport) } + jar { + manifest { + attributes["Implementation-Title"] = project.name + attributes["Implementation-Version"] = archiveVersion + } + } + val lifecycleTest by creating(Test::class) { useJUnitPlatform { includeTags(Tests.lifecycleTag) diff --git a/buildSrc/src/main/kotlin/Dependencies.kt b/buildSrc/src/main/kotlin/Dependencies.kt index a8a9cb3af..be8aa92b5 100644 --- a/buildSrc/src/main/kotlin/Dependencies.kt +++ b/buildSrc/src/main/kotlin/Dependencies.kt @@ -1,12 +1,15 @@ @file:Suppress("PublicApiImplicitType", "MemberVisibilityCanBePrivate", "unused", "ConstPropertyName") +import org.gradle.plugin.use.PluginDependenciesSpec + + object Versions { const val asm = "9.5" const val dokka = "1.7.20" const val gradle_download = "5.3.0" const val gradle_versions = "0.47.0" - const val guava = "31.1-jre" const val hikaricp = "5.0.1" + const val guava = "31.1-jre" const val javax_activation = "1.1" const val javax_mail = "1.4.7" const val javax_servlet_api = "2.5" @@ -27,7 +30,6 @@ object Versions { const val kotlinx_serialization = "1.4.1" const val licenser = "0.6.1" const val mockito = "4.8.0" - const val postgresql = "42.5.1" const val shadow = "8.1.1" const val slf4j = "1.7.36" const val soot_utbot_fork = "4.4.0-FORK-2" @@ -157,13 +159,6 @@ object Libs { version = Versions.kotlinx_cli ) - // https://github.com/pgjdbc/pgjdbc - val postgresql = dep( - group = "org.postgresql", - name = "postgresql", - version = Versions.postgresql - ) - // https://github.com/brettwooldridge/HikariCP val hikaricp = dep( group = "com.zaxxer", @@ -283,39 +278,46 @@ object Libs { } object Plugins { + + abstract class ProjectPlugin(val version: String, val id: String) + // https://github.com/Kotlin/dokka - object Dokka { - const val version = Versions.dokka - const val id = "org.jetbrains.dokka" - } + object Dokka: ProjectPlugin( + version = Versions.dokka, + id = "org.jetbrains.dokka" + ) // https://github.com/michel-kraemer/gradle-download-task - object GradleDownload { - const val version = Versions.gradle_download - const val id = "de.undercouch.download" - } + object GradleDownload: ProjectPlugin( + version = Versions.gradle_download, + id = "de.undercouch.download" + ) // https://github.com/ben-manes/gradle-versions-plugin - object GradleVersions { - const val version = Versions.gradle_versions - const val id = "com.github.ben-manes.versions" - } + object GradleVersions: ProjectPlugin( + version = Versions.gradle_versions, + id = "com.github.ben-manes.versions" + ) // https://github.com/Kotlin/kotlinx-benchmark - object KotlinxBenchmark { - const val version = Versions.kotlinx_benchmark - const val id = "org.jetbrains.kotlinx.benchmark" - } + object KotlinxBenchmark : ProjectPlugin( + version = Versions.kotlinx_benchmark, + id = "org.jetbrains.kotlinx.benchmark" + ) // https://github.com/CadixDev/licenser - object Licenser { - const val version = Versions.licenser - const val id = "org.cadixdev.licenser" - } + object Licenser : ProjectPlugin( + version = Versions.licenser, + id = "org.cadixdev.licenser" + ) // https://github.com/johnrengelman/shadow - object Shadow { - const val version = Versions.shadow - const val id = "com.github.johnrengelman.shadow" - } + object Shadow : ProjectPlugin( + version = Versions.shadow, + id = "com.github.johnrengelman.shadow" + ) } + +fun PluginDependenciesSpec.id(plugin: Plugins.ProjectPlugin) { + id(plugin.id).version(plugin.version) +} \ No newline at end of file diff --git a/jacodb-api/src/main/kotlin/org/jacodb/api/Api.kt b/jacodb-api/src/main/kotlin/org/jacodb/api/Api.kt index 34f0836c3..67c444080 100644 --- a/jacodb-api/src/main/kotlin/org/jacodb/api/Api.kt +++ b/jacodb-api/src/main/kotlin/org/jacodb/api/Api.kt @@ -158,8 +158,6 @@ interface JcDatabasePersistence : Closeable { fun findClassSources(cp: JcClasspath, fullName: String): List fun createIndexes() {} - - fun getScript(name: String): String } interface RegisteredLocation { diff --git a/jacodb-benchmarks/build.gradle.kts b/jacodb-benchmarks/build.gradle.kts index 777d189d6..f5cb5206e 100644 --- a/jacodb-benchmarks/build.gradle.kts +++ b/jacodb-benchmarks/build.gradle.kts @@ -3,8 +3,8 @@ import kotlinx.benchmark.gradle.JvmBenchmarkTarget plugins { `java-test-fixtures` - with(Plugins.GradleDownload) { id(id) version (version) } - with(Plugins.KotlinxBenchmark) { id(id) version (version) } + id(Plugins.GradleDownload) + id(Plugins.KotlinxBenchmark) } dependencies { diff --git a/jacodb-benchmarks/src/test/kotlin/org/jacodb/testing/performance/TakeMemoryDump.kt b/jacodb-benchmarks/src/test/kotlin/org/jacodb/testing/performance/TakeMemoryDump.kt index e8fb4010b..606e2c42e 100644 --- a/jacodb-benchmarks/src/test/kotlin/org/jacodb/testing/performance/TakeMemoryDump.kt +++ b/jacodb-benchmarks/src/test/kotlin/org/jacodb/testing/performance/TakeMemoryDump.kt @@ -29,9 +29,9 @@ fun main() { runBlocking { val db = jacodb { loadByteCode(allClasspath) - persistent( - "d:\\work\\jacodb\\jacodb-classpath.db", - ) +// persistent( +// "d:\\work\\jacodb\\jacodb-classpath.db", +// ) installFeatures(InMemoryHierarchy, Usages, Builders) }.also { println("AWAITING db took ${System.currentTimeMillis() - start}ms") diff --git a/jacodb-core/build.gradle.kts b/jacodb-core/build.gradle.kts index a61159668..5eab623c7 100644 --- a/jacodb-core/build.gradle.kts +++ b/jacodb-core/build.gradle.kts @@ -1,9 +1,6 @@ import org.jooq.codegen.GenerationTool +import org.jooq.meta.jaxb.* import org.jooq.meta.jaxb.Configuration -import org.jooq.meta.jaxb.Database -import org.jooq.meta.jaxb.Generate -import org.jooq.meta.jaxb.Generator -import org.jooq.meta.jaxb.Jdbc import org.jooq.meta.jaxb.Target import java.nio.file.Paths @@ -18,7 +15,7 @@ buildscript { classpath(Libs.jooq_kotlin) // classpath(Libs.postgresql) // classpath(Libs.hikaricp) - // classpath(Libs.sqlite) + classpath(Libs.sqlite) } } @@ -38,15 +35,13 @@ dependencies { implementation(Libs.kotlinx_serialization_cbor) implementation(Libs.jdot) implementation(Libs.guava) - implementation(Libs.postgresql) - implementation(Libs.hikaricp) implementation(Libs.sqlite) testImplementation(Libs.javax_activation) testImplementation(Libs.javax_mail) testImplementation(Libs.joda_time) testImplementation(Libs.slf4j_simple) - // testImplementation(files("src/test/resources/samples")) + testImplementation(Libs.hikaricp) testFixturesImplementation(project(":jacodb-api")) testFixturesImplementation(kotlin("reflect")) @@ -58,10 +53,10 @@ dependencies { testFixturesImplementation(Libs.kotlinx_coroutines_core) } -tasks.register("generateSqlScheme") { - val databaseLocation = project.properties["database_location"] - if (databaseLocation != null) { - val url = "jdbc:sqlite:file:$databaseLocation" +tasks { + register("generateSqlScheme") { + val location = "src/main/resources/sqlite/empty.db" + val url = "jdbc:sqlite:file:$location" val driver = "org.sqlite.JDBC" GenerationTool.generate( Configuration() @@ -86,12 +81,18 @@ tasks.register("generateSqlScheme") { ) ) } -} -tasks.register("generateDocSvgs") { - dependsOn("testClasses") - mainClass.set("org.utbot.jcdb.impl.cfg.IRSvgGeneratorKt") - classpath = sourceSets.test.get().runtimeClasspath - val svgDocs = Paths.get(rootDir.absolutePath, "docs", "svg").toFile() - args = listOf(svgDocs.absolutePath) + register("generateDocSvgs") { + dependsOn("testClasses") + mainClass.set("org.utbot.jcdb.impl.cfg.IRSvgGeneratorKt") + classpath = sourceSets.test.get().runtimeClasspath + val svgDocs = Paths.get(rootDir.absolutePath, "docs", "svg").toFile() + args = listOf(svgDocs.absolutePath) + } + + processResources { + filesMatching("**/*.properties") { + expand("version" to project.version) + } + } } diff --git a/jacodb-core/src/main/jooq/org/jacodb/impl/storage/jooq/DefaultSchema.kt b/jacodb-core/src/main/jooq/org/jacodb/impl/storage/jooq/DefaultSchema.kt index 88d96519b..502fb08a8 100644 --- a/jacodb-core/src/main/jooq/org/jacodb/impl/storage/jooq/DefaultSchema.kt +++ b/jacodb-core/src/main/jooq/org/jacodb/impl/storage/jooq/DefaultSchema.kt @@ -20,24 +20,10 @@ package org.jacodb.impl.storage.jooq -import kotlin.collections.List - +import org.jacodb.impl.storage.jooq.tables.* import org.jooq.Catalog import org.jooq.Table import org.jooq.impl.SchemaImpl -import org.jacodb.impl.storage.jooq.tables.Annotations -import org.jacodb.impl.storage.jooq.tables.Annotationvalues -import org.jacodb.impl.storage.jooq.tables.Builders -import org.jacodb.impl.storage.jooq.tables.Bytecodelocations -import org.jacodb.impl.storage.jooq.tables.Calls -import org.jacodb.impl.storage.jooq.tables.Classes -import org.jacodb.impl.storage.jooq.tables.Classhierarchies -import org.jacodb.impl.storage.jooq.tables.Classinnerclasses -import org.jacodb.impl.storage.jooq.tables.Fields -import org.jacodb.impl.storage.jooq.tables.Methodparameters -import org.jacodb.impl.storage.jooq.tables.Methods -import org.jacodb.impl.storage.jooq.tables.Outerclasses -import org.jacodb.impl.storage.jooq.tables.Symbols /** @@ -63,6 +49,11 @@ open class DefaultSchema : SchemaImpl("", DefaultCatalog.DEFAULT_CATALOG) { */ val ANNOTATIONVALUES get() = Annotationvalues.ANNOTATIONVALUES + /** + * The table ApplicationMetadata. + */ + val APPLICATIONMETADATA get() = Applicationmetadata.APPLICATIONMETADATA + /** * The table Builders. */ @@ -113,6 +104,11 @@ open class DefaultSchema : SchemaImpl("", DefaultCatalog.DEFAULT_CATALOG) { */ val OUTERCLASSES get() = Outerclasses.OUTERCLASSES + /** + * The table Refactorings. + */ + val REFACTORINGS get() = Refactorings.REFACTORINGS + /** * The table Symbols. */ @@ -123,6 +119,7 @@ open class DefaultSchema : SchemaImpl("", DefaultCatalog.DEFAULT_CATALOG) { override fun getTables(): List> = listOf( Annotations.ANNOTATIONS, Annotationvalues.ANNOTATIONVALUES, + Applicationmetadata.APPLICATIONMETADATA, Builders.BUILDERS, Bytecodelocations.BYTECODELOCATIONS, Calls.CALLS, @@ -133,6 +130,7 @@ open class DefaultSchema : SchemaImpl("", DefaultCatalog.DEFAULT_CATALOG) { Methodparameters.METHODPARAMETERS, Methods.METHODS, Outerclasses.OUTERCLASSES, + Refactorings.REFACTORINGS, Symbols.SYMBOLS ) } diff --git a/jacodb-core/src/main/jooq/org/jacodb/impl/storage/jooq/indexes/Indexes.kt b/jacodb-core/src/main/jooq/org/jacodb/impl/storage/jooq/indexes/Indexes.kt index 4d21b7f74..b63176661 100644 --- a/jacodb-core/src/main/jooq/org/jacodb/impl/storage/jooq/indexes/Indexes.kt +++ b/jacodb-core/src/main/jooq/org/jacodb/impl/storage/jooq/indexes/Indexes.kt @@ -20,19 +20,36 @@ package org.jacodb.impl.storage.jooq.indexes +import org.jacodb.impl.storage.jooq.tables.* import org.jooq.Index import org.jooq.impl.DSL import org.jooq.impl.Internal -import org.jacodb.impl.storage.jooq.tables.Builders -import org.jacodb.impl.storage.jooq.tables.Calls - // ------------------------------------------------------------------------- // INDEX definitions // ------------------------------------------------------------------------- -val BUILDERSJOIN: Index = Internal.createIndex(DSL.name("BuildersJoin"), Builders.BUILDERS, arrayOf(Builders.BUILDERS.BUILDER_CLASS_SYMBOL_ID), false) -val BUILDERSSEARCH: Index = Internal.createIndex(DSL.name("BuildersSearch"), Builders.BUILDERS, arrayOf(Builders.BUILDERS.LOCATION_ID, Builders.BUILDERS.CLASS_SYMBOL_ID, Builders.BUILDERS.PRIORITY), false) +val ANNOTATIONS_CLASSID: Index = Internal.createIndex(DSL.name("Annotations_classId"), Annotations.ANNOTATIONS, arrayOf(Annotations.ANNOTATIONS.CLASS_ID), false) +val ANNOTATIONS_FIELDID: Index = Internal.createIndex(DSL.name("Annotations_fieldId"), Annotations.ANNOTATIONS, arrayOf(Annotations.ANNOTATIONS.FIELD_ID), false) +val ANNOTATIONS_METHODID: Index = Internal.createIndex(DSL.name("Annotations_methodId"), Annotations.ANNOTATIONS, arrayOf(Annotations.ANNOTATIONS.METHOD_ID), false) +val ANNOTATIONS_PARAMSID: Index = Internal.createIndex(DSL.name("Annotations_paramsId"), Annotations.ANNOTATIONS, arrayOf(Annotations.ANNOTATIONS.PARAM_ID), false) +val BUILDERSJOIN: Index = Internal.createIndex(DSL.name("BuildersJoin"), Builders.BUILDERS, arrayOf(Builders.BUILDERS.BUILDER_CLASS_NAME), false) +val BUILDERSSEARCH: Index = Internal.createIndex(DSL.name("BuildersSearch"), Builders.BUILDERS, arrayOf(Builders.BUILDERS.LOCATION_ID, Builders.BUILDERS.CLASS_NAME, Builders.BUILDERS.PRIORITY), false) val BUILDERSSORTING: Index = Internal.createIndex(DSL.name("BuildersSorting"), Builders.BUILDERS, arrayOf(Builders.BUILDERS.PRIORITY), false) -val CALLSSEARCH: Index = Internal.createIndex(DSL.name("CallsSearch"), Calls.CALLS, arrayOf(Calls.CALLS.OPCODE, Calls.CALLS.LOCATION_ID, Calls.CALLS.CALLEE_CLASS_SYMBOL_ID, Calls.CALLS.CALLEE_NAME_SYMBOL_ID, Calls.CALLS.CALLEE_DESC_HASH), false) +val BYTECODELOCATIONS_HASH: Index = Internal.createIndex(DSL.name("Bytecodelocations_hash"), Bytecodelocations.BYTECODELOCATIONS, arrayOf(Bytecodelocations.BYTECODELOCATIONS.UNIQUEID), true) +val CALLSSEARCH: Index = Internal.createIndex(DSL.name("CallsSearch"), Calls.CALLS, arrayOf(Calls.CALLS.OPCODE, Calls.CALLS.LOCATION_ID, Calls.CALLS.CALLEE_CLASS_NAME, Calls.CALLS.CALLEE_NAME, Calls.CALLS.CALLEE_DESC_HASH), false) +val `CLASS HIERARCHIES`: Index = Internal.createIndex(DSL.name("Class Hierarchies"), Classhierarchies.CLASSHIERARCHIES, arrayOf(Classhierarchies.CLASSHIERARCHIES.SUPER_ID), false) +val CLASSES_LOCATION: Index = Internal.createIndex(DSL.name("Classes_location"), Classes.CLASSES, arrayOf(Classes.CLASSES.LOCATION_ID), false) +val CLASSES_NAME: Index = Internal.createIndex(DSL.name("Classes_name"), Classes.CLASSES, arrayOf(Classes.CLASSES.NAME), false) +val CLASSES_OUTERMETHODID: Index = Internal.createIndex(DSL.name("Classes_outerMethodId"), Classes.CLASSES, arrayOf(Classes.CLASSES.OUTER_METHOD), false) +val CLASSHIERARCHIES_CLASSID: Index = Internal.createIndex(DSL.name("ClassHierarchies_classId"), Classhierarchies.CLASSHIERARCHIES, arrayOf(Classhierarchies.CLASSHIERARCHIES.CLASS_ID), false) +val CLASSHIERARCHIES_SUPERID: Index = Internal.createIndex(DSL.name("ClassHierarchies_superId"), Classhierarchies.CLASSHIERARCHIES, arrayOf(Classhierarchies.CLASSHIERARCHIES.SUPER_ID), false) +val CLASSINNERCLASSES_CLASSID: Index = Internal.createIndex(DSL.name("ClassInnerClasses_classId"), Classinnerclasses.CLASSINNERCLASSES, arrayOf(Classinnerclasses.CLASSINNERCLASSES.CLASS_ID), false) +val CLASSINNERCLASSES_INNERCLASSID: Index = Internal.createIndex(DSL.name("ClassInnerClasses_innerClassId"), Classinnerclasses.CLASSINNERCLASSES, arrayOf(Classinnerclasses.CLASSINNERCLASSES.INNER_CLASS_ID), false) +val FIELDS_CLASS_ID_NAME: Index = Internal.createIndex(DSL.name("Fields_class_id_name"), Fields.FIELDS, arrayOf(Fields.FIELDS.CLASS_ID, Fields.FIELDS.NAME), true) +val FIELDS_CLASSID: Index = Internal.createIndex(DSL.name("Fields_classId"), Fields.FIELDS, arrayOf(Fields.FIELDS.CLASS_ID), false) +val METHODPARAMETERS_METHODID: Index = Internal.createIndex(DSL.name("MethodParameters_methodId"), Methodparameters.METHODPARAMETERS, arrayOf(Methodparameters.METHODPARAMETERS.METHOD_ID), false) +val METHODS_CLASS_ID_NAME_DESC: Index = Internal.createIndex(DSL.name("Methods_class_id_name_desc"), Methods.METHODS, arrayOf(Methods.METHODS.CLASS_ID, Methods.METHODS.NAME, Methods.METHODS.DESC), true) +val METHODS_CLASSID: Index = Internal.createIndex(DSL.name("Methods_classId"), Methods.METHODS, arrayOf(Methods.METHODS.CLASS_ID), false) +val SYMBOLS_NAME: Index = Internal.createIndex(DSL.name("Symbols_name"), Symbols.SYMBOLS, arrayOf(Symbols.SYMBOLS.NAME), true) diff --git a/jacodb-core/src/main/jooq/org/jacodb/impl/storage/jooq/keys/Keys.kt b/jacodb-core/src/main/jooq/org/jacodb/impl/storage/jooq/keys/Keys.kt index 836b010ad..17477a8b4 100644 --- a/jacodb-core/src/main/jooq/org/jacodb/impl/storage/jooq/keys/Keys.kt +++ b/jacodb-core/src/main/jooq/org/jacodb/impl/storage/jooq/keys/Keys.kt @@ -20,31 +20,8 @@ package org.jacodb.impl.storage.jooq.keys -import org.jacodb.impl.storage.jooq.tables.Annotationvalues -import org.jacodb.impl.storage.jooq.tables.Builders -import org.jacodb.impl.storage.jooq.tables.Bytecodelocations -import org.jacodb.impl.storage.jooq.tables.Calls -import org.jacodb.impl.storage.jooq.tables.Classes -import org.jacodb.impl.storage.jooq.tables.Classhierarchies -import org.jacodb.impl.storage.jooq.tables.Classinnerclasses -import org.jacodb.impl.storage.jooq.tables.Fields -import org.jacodb.impl.storage.jooq.tables.Methodparameters -import org.jacodb.impl.storage.jooq.tables.Methods -import org.jacodb.impl.storage.jooq.tables.Outerclasses -import org.jacodb.impl.storage.jooq.tables.Symbols -import org.jacodb.impl.storage.jooq.tables.records.AnnotationsRecord -import org.jacodb.impl.storage.jooq.tables.records.AnnotationvaluesRecord -import org.jacodb.impl.storage.jooq.tables.records.BuildersRecord -import org.jacodb.impl.storage.jooq.tables.records.BytecodelocationsRecord -import org.jacodb.impl.storage.jooq.tables.records.CallsRecord -import org.jacodb.impl.storage.jooq.tables.records.ClassesRecord -import org.jacodb.impl.storage.jooq.tables.records.ClasshierarchiesRecord -import org.jacodb.impl.storage.jooq.tables.records.ClassinnerclassesRecord -import org.jacodb.impl.storage.jooq.tables.records.FieldsRecord -import org.jacodb.impl.storage.jooq.tables.records.MethodparametersRecord -import org.jacodb.impl.storage.jooq.tables.records.MethodsRecord -import org.jacodb.impl.storage.jooq.tables.records.OuterclassesRecord -import org.jacodb.impl.storage.jooq.tables.records.SymbolsRecord +import org.jacodb.impl.storage.jooq.tables.* +import org.jacodb.impl.storage.jooq.tables.records.* import org.jooq.ForeignKey import org.jooq.UniqueKey import org.jooq.impl.DSL @@ -55,9 +32,7 @@ import org.jooq.impl.Internal // UNIQUE and PRIMARY KEY definitions // ------------------------------------------------------------------------- -val PK_ANNOTATIONS: UniqueKey = Internal.createUniqueKey( - org.jacodb.impl.storage.jooq.tables.Annotations.ANNOTATIONS, DSL.name("pk_Annotations"), arrayOf( - org.jacodb.impl.storage.jooq.tables.Annotations.ANNOTATIONS.ID), true) +val PK_ANNOTATIONS: UniqueKey = Internal.createUniqueKey(Annotations.ANNOTATIONS, DSL.name("pk_Annotations"), arrayOf(Annotations.ANNOTATIONS.ID), true) val PK_ANNOTATIONVALUES: UniqueKey = Internal.createUniqueKey(Annotationvalues.ANNOTATIONVALUES, DSL.name("pk_AnnotationValues"), arrayOf(Annotationvalues.ANNOTATIONVALUES.ID), true) val PK_BYTECODELOCATIONS: UniqueKey = Internal.createUniqueKey(Bytecodelocations.BYTECODELOCATIONS, DSL.name("pk_BytecodeLocations"), arrayOf(Bytecodelocations.BYTECODELOCATIONS.ID), true) val PK_CLASSES: UniqueKey = Internal.createUniqueKey(Classes.CLASSES, DSL.name("pk_Classes"), arrayOf(Classes.CLASSES.ID), true) @@ -73,83 +48,34 @@ val PK_SYMBOLS: UniqueKey = Internal.createUniqueKey(Symbols.SYMB // FOREIGN KEY definitions // ------------------------------------------------------------------------- -val FK_ANNOTATIONS_ANNOTATIONS_1: ForeignKey = Internal.createForeignKey( - org.jacodb.impl.storage.jooq.tables.Annotations.ANNOTATIONS, DSL.name("fk_Annotations_Annotations_1"), arrayOf( - org.jacodb.impl.storage.jooq.tables.Annotations.ANNOTATIONS.PARENT_ANNOTATION), - org.jacodb.impl.storage.jooq.keys.PK_ANNOTATIONS, arrayOf(org.jacodb.impl.storage.jooq.tables.Annotations.ANNOTATIONS.ID), true) -val FK_ANNOTATIONS_CLASSES_1: ForeignKey = Internal.createForeignKey( - org.jacodb.impl.storage.jooq.tables.Annotations.ANNOTATIONS, DSL.name("fk_Annotations_Classes_1"), arrayOf( - org.jacodb.impl.storage.jooq.tables.Annotations.ANNOTATIONS.CLASS_ID), - org.jacodb.impl.storage.jooq.keys.PK_CLASSES, arrayOf(Classes.CLASSES.ID), true) -val FK_ANNOTATIONS_FIELDS_1: ForeignKey = Internal.createForeignKey( - org.jacodb.impl.storage.jooq.tables.Annotations.ANNOTATIONS, DSL.name("fk_Annotations_Fields_1"), arrayOf( - org.jacodb.impl.storage.jooq.tables.Annotations.ANNOTATIONS.FIELD_ID), - org.jacodb.impl.storage.jooq.keys.PK_FIELDS, arrayOf(Fields.FIELDS.ID), true) -val FK_ANNOTATIONS_METHODPARAMETERS_1: ForeignKey = Internal.createForeignKey( - org.jacodb.impl.storage.jooq.tables.Annotations.ANNOTATIONS, DSL.name("fk_Annotations_MethodParameters_1"), arrayOf( - org.jacodb.impl.storage.jooq.tables.Annotations.ANNOTATIONS.PARAM_ID), - org.jacodb.impl.storage.jooq.keys.PK_METHODPARAMETERS, arrayOf(Methodparameters.METHODPARAMETERS.ID), true) -val FK_ANNOTATIONS_METHODS_1: ForeignKey = Internal.createForeignKey( - org.jacodb.impl.storage.jooq.tables.Annotations.ANNOTATIONS, DSL.name("fk_Annotations_Methods_1"), arrayOf( - org.jacodb.impl.storage.jooq.tables.Annotations.ANNOTATIONS.METHOD_ID), - org.jacodb.impl.storage.jooq.keys.PK_METHODS, arrayOf(Methods.METHODS.ID), true) -val FK_ANNOTATIONS_SYMBOLS_1: ForeignKey = Internal.createForeignKey( - org.jacodb.impl.storage.jooq.tables.Annotations.ANNOTATIONS, DSL.name("fk_Annotations_Symbols_1"), arrayOf( - org.jacodb.impl.storage.jooq.tables.Annotations.ANNOTATIONS.ANNOTATION_NAME), - org.jacodb.impl.storage.jooq.keys.PK_SYMBOLS, arrayOf(Symbols.SYMBOLS.ID), true) -val FK_ANNOTATIONVALUES_ANNOTATIONS_1: ForeignKey = Internal.createForeignKey(Annotationvalues.ANNOTATIONVALUES, DSL.name("fk_AnnotationValues_Annotations_1"), arrayOf(Annotationvalues.ANNOTATIONVALUES.REF_ANNOTATION_ID), - org.jacodb.impl.storage.jooq.keys.PK_ANNOTATIONS, arrayOf(org.jacodb.impl.storage.jooq.tables.Annotations.ANNOTATIONS.ID), true) -val FK_ANNOTATIONVALUES_ANNOTATIONS_2: ForeignKey = Internal.createForeignKey(Annotationvalues.ANNOTATIONVALUES, DSL.name("fk_AnnotationValues_Annotations_2"), arrayOf(Annotationvalues.ANNOTATIONVALUES.ANNOTATION_ID), - org.jacodb.impl.storage.jooq.keys.PK_ANNOTATIONS, arrayOf(org.jacodb.impl.storage.jooq.tables.Annotations.ANNOTATIONS.ID), true) -val FK_ANNOTATIONVALUES_SYMBOLS_1: ForeignKey = Internal.createForeignKey(Annotationvalues.ANNOTATIONVALUES, DSL.name("fk_AnnotationValues_Symbols_1"), arrayOf(Annotationvalues.ANNOTATIONVALUES.CLASS_SYMBOL), - org.jacodb.impl.storage.jooq.keys.PK_SYMBOLS, arrayOf(Symbols.SYMBOLS.ID), true) -val FK_ANNOTATIONVALUES_SYMBOLS_2: ForeignKey = Internal.createForeignKey(Annotationvalues.ANNOTATIONVALUES, DSL.name("fk_AnnotationValues_Symbols_2"), arrayOf(Annotationvalues.ANNOTATIONVALUES.ENUM_VALUE), - org.jacodb.impl.storage.jooq.keys.PK_SYMBOLS, arrayOf(Symbols.SYMBOLS.ID), true) -val FK_BUILDERS_BYTECODELOCATIONS_1: ForeignKey = Internal.createForeignKey(Builders.BUILDERS, DSL.name("fk_Builders_BytecodeLocations_1"), arrayOf(Builders.BUILDERS.LOCATION_ID), - org.jacodb.impl.storage.jooq.keys.PK_BYTECODELOCATIONS, arrayOf(Bytecodelocations.BYTECODELOCATIONS.ID), true) -val FK_BUILDERS_SYMBOLS_1: ForeignKey = Internal.createForeignKey(Builders.BUILDERS, DSL.name("fk_Builders_Symbols_1"), arrayOf(Builders.BUILDERS.BUILDER_CLASS_SYMBOL_ID), - org.jacodb.impl.storage.jooq.keys.PK_SYMBOLS, arrayOf(Symbols.SYMBOLS.ID), true) -val FK_BUILDERS_SYMBOLS_2: ForeignKey = Internal.createForeignKey(Builders.BUILDERS, DSL.name("fk_Builders_Symbols_2"), arrayOf(Builders.BUILDERS.CLASS_SYMBOL_ID), - org.jacodb.impl.storage.jooq.keys.PK_SYMBOLS, arrayOf(Symbols.SYMBOLS.ID), true) -val FK_BYTECODELOCATIONS_BYTECODELOCATIONS_1: ForeignKey = Internal.createForeignKey(Bytecodelocations.BYTECODELOCATIONS, DSL.name("fk_BytecodeLocations_BytecodeLocations_1"), arrayOf(Bytecodelocations.BYTECODELOCATIONS.UPDATED_ID), - org.jacodb.impl.storage.jooq.keys.PK_BYTECODELOCATIONS, arrayOf(Bytecodelocations.BYTECODELOCATIONS.ID), true) -val FK_CALLS_BYTECODELOCATIONS_1: ForeignKey = Internal.createForeignKey(Calls.CALLS, DSL.name("fk_Calls_BytecodeLocations_1"), arrayOf(Calls.CALLS.LOCATION_ID), - org.jacodb.impl.storage.jooq.keys.PK_BYTECODELOCATIONS, arrayOf(Bytecodelocations.BYTECODELOCATIONS.ID), true) -val FK_CALLS_SYMBOLS_1: ForeignKey = Internal.createForeignKey(Calls.CALLS, DSL.name("fk_Calls_Symbols_1"), arrayOf(Calls.CALLS.CALLEE_CLASS_SYMBOL_ID), - org.jacodb.impl.storage.jooq.keys.PK_SYMBOLS, arrayOf(Symbols.SYMBOLS.ID), true) -val FK_CLASSES_BYTECODELOCATIONS_1: ForeignKey = Internal.createForeignKey(Classes.CLASSES, DSL.name("fk_Classes_BytecodeLocations_1"), arrayOf(Classes.CLASSES.LOCATION_ID), - org.jacodb.impl.storage.jooq.keys.PK_BYTECODELOCATIONS, arrayOf(Bytecodelocations.BYTECODELOCATIONS.ID), true) -val FK_CLASSES_METHODS_1: ForeignKey = Internal.createForeignKey(Classes.CLASSES, DSL.name("fk_Classes_Methods_1"), arrayOf(Classes.CLASSES.OUTER_METHOD), - org.jacodb.impl.storage.jooq.keys.PK_METHODS, arrayOf(Methods.METHODS.ID), true) -val FK_CLASSES_OUTERCLASSES_1: ForeignKey = Internal.createForeignKey(Classes.CLASSES, DSL.name("fk_Classes_OuterClasses_1"), arrayOf(Classes.CLASSES.OUTER_CLASS), - org.jacodb.impl.storage.jooq.keys.PK_OUTERCLASSES, arrayOf(Outerclasses.OUTERCLASSES.ID), true) -val FK_CLASSES_SYMBOLS_1: ForeignKey = Internal.createForeignKey(Classes.CLASSES, DSL.name("fk_Classes_Symbols_1"), arrayOf(Classes.CLASSES.PACKAGE_ID), - org.jacodb.impl.storage.jooq.keys.PK_SYMBOLS, arrayOf(Symbols.SYMBOLS.ID), true) -val FK_CLASSES_SYMBOLS_2: ForeignKey = Internal.createForeignKey(Classes.CLASSES, DSL.name("fk_Classes_Symbols_2"), arrayOf(Classes.CLASSES.NAME), - org.jacodb.impl.storage.jooq.keys.PK_SYMBOLS, arrayOf(Symbols.SYMBOLS.ID), true) -val FK_CLASSHIERARCHIES_CLASSES_1: ForeignKey = Internal.createForeignKey(Classhierarchies.CLASSHIERARCHIES, DSL.name("fk_ClassHierarchies_Classes_1"), arrayOf(Classhierarchies.CLASSHIERARCHIES.CLASS_ID), - org.jacodb.impl.storage.jooq.keys.PK_CLASSES, arrayOf(Classes.CLASSES.ID), true) -val FK_CLASSHIERARCHIES_SYMBOLS_1: ForeignKey = Internal.createForeignKey(Classhierarchies.CLASSHIERARCHIES, DSL.name("fk_ClassHierarchies_Symbols_1"), arrayOf(Classhierarchies.CLASSHIERARCHIES.SUPER_ID), - org.jacodb.impl.storage.jooq.keys.PK_SYMBOLS, arrayOf(Symbols.SYMBOLS.ID), true) -val FK_CLASSINNERCLASSES_CLASSES_1: ForeignKey = Internal.createForeignKey(Classinnerclasses.CLASSINNERCLASSES, DSL.name("fk_ClassInnerClasses_Classes_1"), arrayOf(Classinnerclasses.CLASSINNERCLASSES.CLASS_ID), - org.jacodb.impl.storage.jooq.keys.PK_CLASSES, arrayOf(Classes.CLASSES.ID), true) -val FK_CLASSINNERCLASSES_SYMBOLS_1: ForeignKey = Internal.createForeignKey(Classinnerclasses.CLASSINNERCLASSES, DSL.name("fk_ClassInnerClasses_Symbols_1"), arrayOf(Classinnerclasses.CLASSINNERCLASSES.INNER_CLASS_ID), - org.jacodb.impl.storage.jooq.keys.PK_SYMBOLS, arrayOf(Symbols.SYMBOLS.ID), true) -val FK_FIELDS_CLASSES_1: ForeignKey = Internal.createForeignKey(Fields.FIELDS, DSL.name("fk_Fields_Classes_1"), arrayOf(Fields.FIELDS.CLASS_ID), - org.jacodb.impl.storage.jooq.keys.PK_CLASSES, arrayOf(Classes.CLASSES.ID), true) -val FK_FIELDS_SYMBOLS_1: ForeignKey = Internal.createForeignKey(Fields.FIELDS, DSL.name("fk_Fields_Symbols_1"), arrayOf(Fields.FIELDS.FIELD_CLASS), - org.jacodb.impl.storage.jooq.keys.PK_SYMBOLS, arrayOf(Symbols.SYMBOLS.ID), true) -val FK_FIELDS_SYMBOLS_2: ForeignKey = Internal.createForeignKey(Fields.FIELDS, DSL.name("fk_Fields_Symbols_2"), arrayOf(Fields.FIELDS.NAME), - org.jacodb.impl.storage.jooq.keys.PK_SYMBOLS, arrayOf(Symbols.SYMBOLS.ID), true) -val FK_METHODPARAMETERS_METHODS_1: ForeignKey = Internal.createForeignKey(Methodparameters.METHODPARAMETERS, DSL.name("fk_MethodParameters_Methods_1"), arrayOf(Methodparameters.METHODPARAMETERS.METHOD_ID), - org.jacodb.impl.storage.jooq.keys.PK_METHODS, arrayOf(Methods.METHODS.ID), true) -val FK_METHODPARAMETERS_SYMBOLS_1: ForeignKey = Internal.createForeignKey(Methodparameters.METHODPARAMETERS, DSL.name("fk_MethodParameters_Symbols_1"), arrayOf(Methodparameters.METHODPARAMETERS.PARAMETER_CLASS), - org.jacodb.impl.storage.jooq.keys.PK_SYMBOLS, arrayOf(Symbols.SYMBOLS.ID), true) -val FK_METHODS_CLASSES_1: ForeignKey = Internal.createForeignKey(Methods.METHODS, DSL.name("fk_Methods_Classes_1"), arrayOf(Methods.METHODS.CLASS_ID), - org.jacodb.impl.storage.jooq.keys.PK_CLASSES, arrayOf(Classes.CLASSES.ID), true) -val FK_METHODS_SYMBOLS_1: ForeignKey = Internal.createForeignKey(Methods.METHODS, DSL.name("fk_Methods_Symbols_1"), arrayOf(Methods.METHODS.RETURN_CLASS), - org.jacodb.impl.storage.jooq.keys.PK_SYMBOLS, arrayOf(Symbols.SYMBOLS.ID), true) -val FK_METHODS_SYMBOLS_2: ForeignKey = Internal.createForeignKey(Methods.METHODS, DSL.name("fk_Methods_Symbols_2"), arrayOf(Methods.METHODS.NAME), - org.jacodb.impl.storage.jooq.keys.PK_SYMBOLS, arrayOf(Symbols.SYMBOLS.ID), true) -val FK_OUTERCLASSES_SYMBOLS_1: ForeignKey = Internal.createForeignKey(Outerclasses.OUTERCLASSES, DSL.name("fk_OuterClasses_Symbols_1"), arrayOf(Outerclasses.OUTERCLASSES.OUTER_CLASS_NAME_ID), - org.jacodb.impl.storage.jooq.keys.PK_SYMBOLS, arrayOf(Symbols.SYMBOLS.ID), true) +val FK_ANNOTATIONS_ANNOTATIONS_1: ForeignKey = Internal.createForeignKey(Annotations.ANNOTATIONS, DSL.name("fk_Annotations_Annotations_1"), arrayOf(Annotations.ANNOTATIONS.PARENT_ANNOTATION), org.jacodb.impl.storage.jooq.keys.PK_ANNOTATIONS, arrayOf(Annotations.ANNOTATIONS.ID), true) +val FK_ANNOTATIONS_CLASSES_1: ForeignKey = Internal.createForeignKey(Annotations.ANNOTATIONS, DSL.name("fk_Annotations_Classes_1"), arrayOf(Annotations.ANNOTATIONS.CLASS_ID), org.jacodb.impl.storage.jooq.keys.PK_CLASSES, arrayOf(Classes.CLASSES.ID), true) +val FK_ANNOTATIONS_FIELDS_1: ForeignKey = Internal.createForeignKey(Annotations.ANNOTATIONS, DSL.name("fk_Annotations_Fields_1"), arrayOf(Annotations.ANNOTATIONS.FIELD_ID), org.jacodb.impl.storage.jooq.keys.PK_FIELDS, arrayOf(Fields.FIELDS.ID), true) +val FK_ANNOTATIONS_METHODPARAMETERS_1: ForeignKey = Internal.createForeignKey(Annotations.ANNOTATIONS, DSL.name("fk_Annotations_MethodParameters_1"), arrayOf(Annotations.ANNOTATIONS.PARAM_ID), org.jacodb.impl.storage.jooq.keys.PK_METHODPARAMETERS, arrayOf(Methodparameters.METHODPARAMETERS.ID), true) +val FK_ANNOTATIONS_METHODS_1: ForeignKey = Internal.createForeignKey(Annotations.ANNOTATIONS, DSL.name("fk_Annotations_Methods_1"), arrayOf(Annotations.ANNOTATIONS.METHOD_ID), org.jacodb.impl.storage.jooq.keys.PK_METHODS, arrayOf(Methods.METHODS.ID), true) +val FK_ANNOTATIONS_SYMBOLS_1: ForeignKey = Internal.createForeignKey(Annotations.ANNOTATIONS, DSL.name("fk_Annotations_Symbols_1"), arrayOf(Annotations.ANNOTATIONS.ANNOTATION_NAME), org.jacodb.impl.storage.jooq.keys.PK_SYMBOLS, arrayOf(Symbols.SYMBOLS.ID), true) +val FK_ANNOTATIONVALUES_ANNOTATIONS_1: ForeignKey = Internal.createForeignKey(Annotationvalues.ANNOTATIONVALUES, DSL.name("fk_AnnotationValues_Annotations_1"), arrayOf(Annotationvalues.ANNOTATIONVALUES.REF_ANNOTATION_ID), org.jacodb.impl.storage.jooq.keys.PK_ANNOTATIONS, arrayOf(Annotations.ANNOTATIONS.ID), true) +val FK_ANNOTATIONVALUES_ANNOTATIONS_2: ForeignKey = Internal.createForeignKey(Annotationvalues.ANNOTATIONVALUES, DSL.name("fk_AnnotationValues_Annotations_2"), arrayOf(Annotationvalues.ANNOTATIONVALUES.ANNOTATION_ID), org.jacodb.impl.storage.jooq.keys.PK_ANNOTATIONS, arrayOf(Annotations.ANNOTATIONS.ID), true) +val FK_ANNOTATIONVALUES_SYMBOLS_1: ForeignKey = Internal.createForeignKey(Annotationvalues.ANNOTATIONVALUES, DSL.name("fk_AnnotationValues_Symbols_1"), arrayOf(Annotationvalues.ANNOTATIONVALUES.CLASS_SYMBOL), org.jacodb.impl.storage.jooq.keys.PK_SYMBOLS, arrayOf(Symbols.SYMBOLS.ID), true) +val FK_ANNOTATIONVALUES_SYMBOLS_2: ForeignKey = Internal.createForeignKey(Annotationvalues.ANNOTATIONVALUES, DSL.name("fk_AnnotationValues_Symbols_2"), arrayOf(Annotationvalues.ANNOTATIONVALUES.ENUM_VALUE), org.jacodb.impl.storage.jooq.keys.PK_SYMBOLS, arrayOf(Symbols.SYMBOLS.ID), true) +val FK_BUILDERS_BYTECODELOCATIONS_1: ForeignKey = Internal.createForeignKey(Builders.BUILDERS, DSL.name("fk_Builders_BytecodeLocations_1"), arrayOf(Builders.BUILDERS.LOCATION_ID), org.jacodb.impl.storage.jooq.keys.PK_BYTECODELOCATIONS, arrayOf(Bytecodelocations.BYTECODELOCATIONS.ID), true) +val FK_BYTECODELOCATIONS_BYTECODELOCATIONS_1: ForeignKey = Internal.createForeignKey(Bytecodelocations.BYTECODELOCATIONS, DSL.name("fk_BytecodeLocations_BytecodeLocations_1"), arrayOf(Bytecodelocations.BYTECODELOCATIONS.UPDATED_ID), org.jacodb.impl.storage.jooq.keys.PK_BYTECODELOCATIONS, arrayOf(Bytecodelocations.BYTECODELOCATIONS.ID), true) +val FK_CALLS_BYTECODELOCATIONS_1: ForeignKey = Internal.createForeignKey(Calls.CALLS, DSL.name("fk_Calls_BytecodeLocations_1"), arrayOf(Calls.CALLS.LOCATION_ID), org.jacodb.impl.storage.jooq.keys.PK_BYTECODELOCATIONS, arrayOf(Bytecodelocations.BYTECODELOCATIONS.ID), true) +val FK_CLASSES_BYTECODELOCATIONS_1: ForeignKey = Internal.createForeignKey(Classes.CLASSES, DSL.name("fk_Classes_BytecodeLocations_1"), arrayOf(Classes.CLASSES.LOCATION_ID), org.jacodb.impl.storage.jooq.keys.PK_BYTECODELOCATIONS, arrayOf(Bytecodelocations.BYTECODELOCATIONS.ID), true) +val FK_CLASSES_METHODS_1: ForeignKey = Internal.createForeignKey(Classes.CLASSES, DSL.name("fk_Classes_Methods_1"), arrayOf(Classes.CLASSES.OUTER_METHOD), org.jacodb.impl.storage.jooq.keys.PK_METHODS, arrayOf(Methods.METHODS.ID), true) +val FK_CLASSES_OUTERCLASSES_1: ForeignKey = Internal.createForeignKey(Classes.CLASSES, DSL.name("fk_Classes_OuterClasses_1"), arrayOf(Classes.CLASSES.OUTER_CLASS), org.jacodb.impl.storage.jooq.keys.PK_OUTERCLASSES, arrayOf(Outerclasses.OUTERCLASSES.ID), true) +val FK_CLASSES_SYMBOLS_1: ForeignKey = Internal.createForeignKey(Classes.CLASSES, DSL.name("fk_Classes_Symbols_1"), arrayOf(Classes.CLASSES.PACKAGE_ID), org.jacodb.impl.storage.jooq.keys.PK_SYMBOLS, arrayOf(Symbols.SYMBOLS.ID), true) +val FK_CLASSES_SYMBOLS_2: ForeignKey = Internal.createForeignKey(Classes.CLASSES, DSL.name("fk_Classes_Symbols_2"), arrayOf(Classes.CLASSES.NAME), org.jacodb.impl.storage.jooq.keys.PK_SYMBOLS, arrayOf(Symbols.SYMBOLS.ID), true) +val FK_CLASSHIERARCHIES_CLASSES_1: ForeignKey = Internal.createForeignKey(Classhierarchies.CLASSHIERARCHIES, DSL.name("fk_ClassHierarchies_Classes_1"), arrayOf(Classhierarchies.CLASSHIERARCHIES.CLASS_ID), org.jacodb.impl.storage.jooq.keys.PK_CLASSES, arrayOf(Classes.CLASSES.ID), true) +val FK_CLASSHIERARCHIES_SYMBOLS_1: ForeignKey = Internal.createForeignKey(Classhierarchies.CLASSHIERARCHIES, DSL.name("fk_ClassHierarchies_Symbols_1"), arrayOf(Classhierarchies.CLASSHIERARCHIES.SUPER_ID), org.jacodb.impl.storage.jooq.keys.PK_SYMBOLS, arrayOf(Symbols.SYMBOLS.ID), true) +val FK_CLASSINNERCLASSES_CLASSES_1: ForeignKey = Internal.createForeignKey(Classinnerclasses.CLASSINNERCLASSES, DSL.name("fk_ClassInnerClasses_Classes_1"), arrayOf(Classinnerclasses.CLASSINNERCLASSES.CLASS_ID), org.jacodb.impl.storage.jooq.keys.PK_CLASSES, arrayOf(Classes.CLASSES.ID), true) +val FK_CLASSINNERCLASSES_SYMBOLS_1: ForeignKey = Internal.createForeignKey(Classinnerclasses.CLASSINNERCLASSES, DSL.name("fk_ClassInnerClasses_Symbols_1"), arrayOf(Classinnerclasses.CLASSINNERCLASSES.INNER_CLASS_ID), org.jacodb.impl.storage.jooq.keys.PK_SYMBOLS, arrayOf(Symbols.SYMBOLS.ID), true) +val FK_FIELDS_CLASSES_1: ForeignKey = Internal.createForeignKey(Fields.FIELDS, DSL.name("fk_Fields_Classes_1"), arrayOf(Fields.FIELDS.CLASS_ID), org.jacodb.impl.storage.jooq.keys.PK_CLASSES, arrayOf(Classes.CLASSES.ID), true) +val FK_FIELDS_SYMBOLS_1: ForeignKey = Internal.createForeignKey(Fields.FIELDS, DSL.name("fk_Fields_Symbols_1"), arrayOf(Fields.FIELDS.FIELD_CLASS), org.jacodb.impl.storage.jooq.keys.PK_SYMBOLS, arrayOf(Symbols.SYMBOLS.ID), true) +val FK_FIELDS_SYMBOLS_2: ForeignKey = Internal.createForeignKey(Fields.FIELDS, DSL.name("fk_Fields_Symbols_2"), arrayOf(Fields.FIELDS.NAME), org.jacodb.impl.storage.jooq.keys.PK_SYMBOLS, arrayOf(Symbols.SYMBOLS.ID), true) +val FK_METHODPARAMETERS_METHODS_1: ForeignKey = Internal.createForeignKey(Methodparameters.METHODPARAMETERS, DSL.name("fk_MethodParameters_Methods_1"), arrayOf(Methodparameters.METHODPARAMETERS.METHOD_ID), org.jacodb.impl.storage.jooq.keys.PK_METHODS, arrayOf(Methods.METHODS.ID), true) +val FK_METHODPARAMETERS_SYMBOLS_1: ForeignKey = Internal.createForeignKey(Methodparameters.METHODPARAMETERS, DSL.name("fk_MethodParameters_Symbols_1"), arrayOf(Methodparameters.METHODPARAMETERS.PARAMETER_CLASS), org.jacodb.impl.storage.jooq.keys.PK_SYMBOLS, arrayOf(Symbols.SYMBOLS.ID), true) +val FK_METHODS_CLASSES_1: ForeignKey = Internal.createForeignKey(Methods.METHODS, DSL.name("fk_Methods_Classes_1"), arrayOf(Methods.METHODS.CLASS_ID), org.jacodb.impl.storage.jooq.keys.PK_CLASSES, arrayOf(Classes.CLASSES.ID), true) +val FK_METHODS_SYMBOLS_1: ForeignKey = Internal.createForeignKey(Methods.METHODS, DSL.name("fk_Methods_Symbols_1"), arrayOf(Methods.METHODS.RETURN_CLASS), org.jacodb.impl.storage.jooq.keys.PK_SYMBOLS, arrayOf(Symbols.SYMBOLS.ID), true) +val FK_METHODS_SYMBOLS_2: ForeignKey = Internal.createForeignKey(Methods.METHODS, DSL.name("fk_Methods_Symbols_2"), arrayOf(Methods.METHODS.NAME), org.jacodb.impl.storage.jooq.keys.PK_SYMBOLS, arrayOf(Symbols.SYMBOLS.ID), true) +val FK_OUTERCLASSES_SYMBOLS_1: ForeignKey = Internal.createForeignKey(Outerclasses.OUTERCLASSES, DSL.name("fk_OuterClasses_Symbols_1"), arrayOf(Outerclasses.OUTERCLASSES.OUTER_CLASS_NAME_ID), org.jacodb.impl.storage.jooq.keys.PK_SYMBOLS, arrayOf(Symbols.SYMBOLS.ID), true) diff --git a/jacodb-core/src/main/jooq/org/jacodb/impl/storage/jooq/tables/Annotations.kt b/jacodb-core/src/main/jooq/org/jacodb/impl/storage/jooq/tables/Annotations.kt index 097e768a8..dc3aff0c2 100644 --- a/jacodb-core/src/main/jooq/org/jacodb/impl/storage/jooq/tables/Annotations.kt +++ b/jacodb-core/src/main/jooq/org/jacodb/impl/storage/jooq/tables/Annotations.kt @@ -20,29 +20,18 @@ package org.jacodb.impl.storage.jooq.tables -import org.jooq.Field -import org.jooq.ForeignKey -import org.jooq.Name -import org.jooq.Record -import org.jooq.Row10 -import org.jooq.Schema -import org.jooq.Table -import org.jooq.TableField -import org.jooq.TableOptions -import org.jooq.UniqueKey +import org.jacodb.impl.storage.jooq.DefaultSchema +import org.jacodb.impl.storage.jooq.indexes.ANNOTATIONS_CLASSID +import org.jacodb.impl.storage.jooq.indexes.ANNOTATIONS_FIELDID +import org.jacodb.impl.storage.jooq.indexes.ANNOTATIONS_METHODID +import org.jacodb.impl.storage.jooq.indexes.ANNOTATIONS_PARAMSID +import org.jacodb.impl.storage.jooq.keys.* +import org.jacodb.impl.storage.jooq.tables.records.AnnotationsRecord +import org.jooq.* import org.jooq.impl.DSL import org.jooq.impl.Internal import org.jooq.impl.SQLDataType import org.jooq.impl.TableImpl -import org.jacodb.impl.storage.jooq.DefaultSchema -import org.jacodb.impl.storage.jooq.keys.FK_ANNOTATIONS_ANNOTATIONS_1 -import org.jacodb.impl.storage.jooq.keys.FK_ANNOTATIONS_CLASSES_1 -import org.jacodb.impl.storage.jooq.keys.FK_ANNOTATIONS_FIELDS_1 -import org.jacodb.impl.storage.jooq.keys.FK_ANNOTATIONS_METHODPARAMETERS_1 -import org.jacodb.impl.storage.jooq.keys.FK_ANNOTATIONS_METHODS_1 -import org.jacodb.impl.storage.jooq.keys.FK_ANNOTATIONS_SYMBOLS_1 -import org.jacodb.impl.storage.jooq.keys.PK_ANNOTATIONS -import org.jacodb.impl.storage.jooq.tables.records.AnnotationsRecord /** @@ -148,6 +137,7 @@ open class Annotations( constructor(child: Table, key: ForeignKey): this(Internal.createPathAlias(child, key), child, key, ANNOTATIONS, null) override fun getSchema(): Schema = DefaultSchema.DEFAULT_SCHEMA + override fun getIndexes(): List = listOf(ANNOTATIONS_CLASSID, ANNOTATIONS_FIELDID, ANNOTATIONS_METHODID, ANNOTATIONS_PARAMSID) override fun getPrimaryKey(): UniqueKey = PK_ANNOTATIONS override fun getKeys(): List> = listOf(PK_ANNOTATIONS) override fun getReferences(): List> = listOf(FK_ANNOTATIONS_SYMBOLS_1, FK_ANNOTATIONS_ANNOTATIONS_1, FK_ANNOTATIONS_CLASSES_1, FK_ANNOTATIONS_METHODS_1, FK_ANNOTATIONS_FIELDS_1, FK_ANNOTATIONS_METHODPARAMETERS_1) diff --git a/jacodb-core/src/main/jooq/org/jacodb/impl/storage/jooq/tables/Annotationvalues.kt b/jacodb-core/src/main/jooq/org/jacodb/impl/storage/jooq/tables/Annotationvalues.kt index 9fe0e4270..9aa7b74e9 100644 --- a/jacodb-core/src/main/jooq/org/jacodb/impl/storage/jooq/tables/Annotationvalues.kt +++ b/jacodb-core/src/main/jooq/org/jacodb/impl/storage/jooq/tables/Annotationvalues.kt @@ -20,27 +20,14 @@ package org.jacodb.impl.storage.jooq.tables -import org.jooq.Field -import org.jooq.ForeignKey -import org.jooq.Name -import org.jooq.Record -import org.jooq.Row8 -import org.jooq.Schema -import org.jooq.Table -import org.jooq.TableField -import org.jooq.TableOptions -import org.jooq.UniqueKey +import org.jacodb.impl.storage.jooq.DefaultSchema +import org.jacodb.impl.storage.jooq.keys.* +import org.jacodb.impl.storage.jooq.tables.records.AnnotationvaluesRecord +import org.jooq.* import org.jooq.impl.DSL import org.jooq.impl.Internal import org.jooq.impl.SQLDataType import org.jooq.impl.TableImpl -import org.jacodb.impl.storage.jooq.DefaultSchema -import org.jacodb.impl.storage.jooq.keys.FK_ANNOTATIONVALUES_ANNOTATIONS_1 -import org.jacodb.impl.storage.jooq.keys.FK_ANNOTATIONVALUES_ANNOTATIONS_2 -import org.jacodb.impl.storage.jooq.keys.FK_ANNOTATIONVALUES_SYMBOLS_1 -import org.jacodb.impl.storage.jooq.keys.FK_ANNOTATIONVALUES_SYMBOLS_2 -import org.jacodb.impl.storage.jooq.keys.PK_ANNOTATIONVALUES -import org.jacodb.impl.storage.jooq.tables.records.AnnotationvaluesRecord /** diff --git a/jacodb-core/src/main/jooq/org/jacodb/impl/storage/jooq/tables/Applicationmetadata.kt b/jacodb-core/src/main/jooq/org/jacodb/impl/storage/jooq/tables/Applicationmetadata.kt new file mode 100644 index 000000000..2de0c4091 --- /dev/null +++ b/jacodb-core/src/main/jooq/org/jacodb/impl/storage/jooq/tables/Applicationmetadata.kt @@ -0,0 +1,107 @@ +/* + * Copyright 2022 UnitTestBot contributors (utbot.org) + *

+ * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* + * This file is generated by jOOQ. + */ +package org.jacodb.impl.storage.jooq.tables + + +import org.jacodb.impl.storage.jooq.DefaultSchema +import org.jacodb.impl.storage.jooq.tables.records.ApplicationmetadataRecord +import org.jooq.* +import org.jooq.impl.DSL +import org.jooq.impl.Internal +import org.jooq.impl.SQLDataType +import org.jooq.impl.TableImpl + + +/** + * This class is generated by jOOQ. + */ +@Suppress("UNCHECKED_CAST") +open class Applicationmetadata( + alias: Name, + child: Table?, + path: ForeignKey?, + aliased: Table?, + parameters: Array?>? +): TableImpl( + alias, + DefaultSchema.DEFAULT_SCHEMA, + child, + path, + aliased, + parameters, + DSL.comment(""), + TableOptions.table() +) { + companion object { + + /** + * The reference instance of ApplicationMetadata + */ + val APPLICATIONMETADATA = Applicationmetadata() + } + + /** + * The class holding records for this type + */ + override fun getRecordType(): Class = ApplicationmetadataRecord::class.java + + /** + * The column ApplicationMetadata.version. + */ + val VERSION: TableField = createField(DSL.name("version"), SQLDataType.VARCHAR(1024).nullable(false), this, "") + + private constructor(alias: Name, aliased: Table?): this(alias, null, null, aliased, null) + private constructor(alias: Name, aliased: Table?, parameters: Array?>?): this(alias, null, null, aliased, parameters) + + /** + * Create an aliased ApplicationMetadata table reference + */ + constructor(alias: String): this(DSL.name(alias)) + + /** + * Create an aliased ApplicationMetadata table reference + */ + constructor(alias: Name): this(alias, null) + + /** + * Create a ApplicationMetadata table reference + */ + constructor(): this(DSL.name("ApplicationMetadata"), null) + + constructor(child: Table, key: ForeignKey): this(Internal.createPathAlias(child, key), child, key, APPLICATIONMETADATA, null) + override fun getSchema(): Schema = DefaultSchema.DEFAULT_SCHEMA + override fun `as`(alias: String): Applicationmetadata = Applicationmetadata(DSL.name(alias), this) + override fun `as`(alias: Name): Applicationmetadata = Applicationmetadata(alias, this) + + /** + * Rename this table + */ + override fun rename(name: String): Applicationmetadata = Applicationmetadata(DSL.name(name), null) + + /** + * Rename this table + */ + override fun rename(name: Name): Applicationmetadata = Applicationmetadata(name, null) + + // ------------------------------------------------------------------------- + // Row1 type methods + // ------------------------------------------------------------------------- + override fun fieldsRow(): Row1 = super.fieldsRow() as Row1 +} diff --git a/jacodb-core/src/main/jooq/org/jacodb/impl/storage/jooq/tables/Builders.kt b/jacodb-core/src/main/jooq/org/jacodb/impl/storage/jooq/tables/Builders.kt index 8a31f838e..172c2a9ee 100644 --- a/jacodb-core/src/main/jooq/org/jacodb/impl/storage/jooq/tables/Builders.kt +++ b/jacodb-core/src/main/jooq/org/jacodb/impl/storage/jooq/tables/Builders.kt @@ -20,30 +20,17 @@ package org.jacodb.impl.storage.jooq.tables -import kotlin.collections.List - -import org.jooq.Field -import org.jooq.ForeignKey -import org.jooq.Index -import org.jooq.Name -import org.jooq.Record -import org.jooq.Row5 -import org.jooq.Schema -import org.jooq.Table -import org.jooq.TableField -import org.jooq.TableOptions -import org.jooq.impl.DSL -import org.jooq.impl.Internal -import org.jooq.impl.SQLDataType -import org.jooq.impl.TableImpl import org.jacodb.impl.storage.jooq.DefaultSchema import org.jacodb.impl.storage.jooq.indexes.BUILDERSJOIN import org.jacodb.impl.storage.jooq.indexes.BUILDERSSEARCH import org.jacodb.impl.storage.jooq.indexes.BUILDERSSORTING import org.jacodb.impl.storage.jooq.keys.FK_BUILDERS_BYTECODELOCATIONS_1 -import org.jacodb.impl.storage.jooq.keys.FK_BUILDERS_SYMBOLS_1 -import org.jacodb.impl.storage.jooq.keys.FK_BUILDERS_SYMBOLS_2 import org.jacodb.impl.storage.jooq.tables.records.BuildersRecord +import org.jooq.* +import org.jooq.impl.DSL +import org.jooq.impl.Internal +import org.jooq.impl.SQLDataType +import org.jooq.impl.TableImpl /** @@ -80,14 +67,14 @@ open class Builders( override fun getRecordType(): Class = BuildersRecord::class.java /** - * The column Builders.class_symbol_id. + * The column Builders.class_name. */ - val CLASS_SYMBOL_ID: TableField = createField(DSL.name("class_symbol_id"), SQLDataType.BIGINT.nullable(false), this, "") + val CLASS_NAME: TableField = createField(DSL.name("class_name"), SQLDataType.VARCHAR(256).nullable(false), this, "") /** - * The column Builders.builder_class_symbol_id. + * The column Builders.builder_class_name. */ - val BUILDER_CLASS_SYMBOL_ID: TableField = createField(DSL.name("builder_class_symbol_id"), SQLDataType.BIGINT.nullable(false), this, "") + val BUILDER_CLASS_NAME: TableField = createField(DSL.name("builder_class_name"), SQLDataType.VARCHAR(256).nullable(false), this, "") /** * The column Builders.priority. @@ -125,23 +112,9 @@ open class Builders( constructor(child: Table, key: ForeignKey): this(Internal.createPathAlias(child, key), child, key, BUILDERS, null) override fun getSchema(): Schema = DefaultSchema.DEFAULT_SCHEMA override fun getIndexes(): List = listOf(BUILDERSJOIN, BUILDERSSEARCH, BUILDERSSORTING) - override fun getReferences(): List> = listOf(FK_BUILDERS_SYMBOLS_2, FK_BUILDERS_SYMBOLS_1, FK_BUILDERS_BYTECODELOCATIONS_1) + override fun getReferences(): List> = listOf(FK_BUILDERS_BYTECODELOCATIONS_1) - private lateinit var _fkBuildersSymbols_2: Symbols - private lateinit var _fkBuildersSymbols_1: Symbols private lateinit var _bytecodelocations: Bytecodelocations - fun fkBuildersSymbols_2(): Symbols { - if (!this::_fkBuildersSymbols_2.isInitialized) - _fkBuildersSymbols_2 = Symbols(this, FK_BUILDERS_SYMBOLS_2) - - return _fkBuildersSymbols_2; - } - fun fkBuildersSymbols_1(): Symbols { - if (!this::_fkBuildersSymbols_1.isInitialized) - _fkBuildersSymbols_1 = Symbols(this, FK_BUILDERS_SYMBOLS_1) - - return _fkBuildersSymbols_1; - } fun bytecodelocations(): Bytecodelocations { if (!this::_bytecodelocations.isInitialized) _bytecodelocations = Bytecodelocations(this, FK_BUILDERS_BYTECODELOCATIONS_1) @@ -164,5 +137,5 @@ open class Builders( // ------------------------------------------------------------------------- // Row5 type methods // ------------------------------------------------------------------------- - override fun fieldsRow(): Row5 = super.fieldsRow() as Row5 + override fun fieldsRow(): Row5 = super.fieldsRow() as Row5 } diff --git a/jacodb-core/src/main/jooq/org/jacodb/impl/storage/jooq/tables/Bytecodelocations.kt b/jacodb-core/src/main/jooq/org/jacodb/impl/storage/jooq/tables/Bytecodelocations.kt index 6bc73be62..6fc5ed3fd 100644 --- a/jacodb-core/src/main/jooq/org/jacodb/impl/storage/jooq/tables/Bytecodelocations.kt +++ b/jacodb-core/src/main/jooq/org/jacodb/impl/storage/jooq/tables/Bytecodelocations.kt @@ -20,24 +20,16 @@ package org.jacodb.impl.storage.jooq.tables -import org.jooq.Field -import org.jooq.ForeignKey -import org.jooq.Name -import org.jooq.Record -import org.jooq.Row6 -import org.jooq.Schema -import org.jooq.Table -import org.jooq.TableField -import org.jooq.TableOptions -import org.jooq.UniqueKey -import org.jooq.impl.DSL -import org.jooq.impl.Internal -import org.jooq.impl.SQLDataType -import org.jooq.impl.TableImpl import org.jacodb.impl.storage.jooq.DefaultSchema +import org.jacodb.impl.storage.jooq.indexes.BYTECODELOCATIONS_HASH import org.jacodb.impl.storage.jooq.keys.FK_BYTECODELOCATIONS_BYTECODELOCATIONS_1 import org.jacodb.impl.storage.jooq.keys.PK_BYTECODELOCATIONS import org.jacodb.impl.storage.jooq.tables.records.BytecodelocationsRecord +import org.jooq.* +import org.jooq.impl.DSL +import org.jooq.impl.Internal +import org.jooq.impl.SQLDataType +import org.jooq.impl.TableImpl /** @@ -123,6 +115,7 @@ open class Bytecodelocations( constructor(child: Table, key: ForeignKey): this(Internal.createPathAlias(child, key), child, key, BYTECODELOCATIONS, null) override fun getSchema(): Schema = DefaultSchema.DEFAULT_SCHEMA + override fun getIndexes(): List = listOf(BYTECODELOCATIONS_HASH) override fun getPrimaryKey(): UniqueKey = PK_BYTECODELOCATIONS override fun getKeys(): List> = listOf(PK_BYTECODELOCATIONS) override fun getReferences(): List> = listOf(FK_BYTECODELOCATIONS_BYTECODELOCATIONS_1) diff --git a/jacodb-core/src/main/jooq/org/jacodb/impl/storage/jooq/tables/Calls.kt b/jacodb-core/src/main/jooq/org/jacodb/impl/storage/jooq/tables/Calls.kt index 11587cc64..79e221a44 100644 --- a/jacodb-core/src/main/jooq/org/jacodb/impl/storage/jooq/tables/Calls.kt +++ b/jacodb-core/src/main/jooq/org/jacodb/impl/storage/jooq/tables/Calls.kt @@ -20,27 +20,15 @@ package org.jacodb.impl.storage.jooq.tables -import kotlin.collections.List - -import org.jooq.Field -import org.jooq.ForeignKey -import org.jooq.Index -import org.jooq.Name -import org.jooq.Record -import org.jooq.Row7 -import org.jooq.Schema -import org.jooq.Table -import org.jooq.TableField -import org.jooq.TableOptions -import org.jooq.impl.DSL -import org.jooq.impl.Internal -import org.jooq.impl.SQLDataType -import org.jooq.impl.TableImpl import org.jacodb.impl.storage.jooq.DefaultSchema import org.jacodb.impl.storage.jooq.indexes.CALLSSEARCH import org.jacodb.impl.storage.jooq.keys.FK_CALLS_BYTECODELOCATIONS_1 -import org.jacodb.impl.storage.jooq.keys.FK_CALLS_SYMBOLS_1 import org.jacodb.impl.storage.jooq.tables.records.CallsRecord +import org.jooq.* +import org.jooq.impl.DSL +import org.jooq.impl.Internal +import org.jooq.impl.SQLDataType +import org.jooq.impl.TableImpl /** @@ -77,14 +65,14 @@ open class Calls( override fun getRecordType(): Class = CallsRecord::class.java /** - * The column Calls.callee_class_symbol_id. + * The column Calls.callee_class_name. */ - val CALLEE_CLASS_SYMBOL_ID: TableField = createField(DSL.name("callee_class_symbol_id"), SQLDataType.BIGINT.nullable(false), this, "") + val CALLEE_CLASS_NAME: TableField = createField(DSL.name("callee_class_name"), SQLDataType.VARCHAR(256).nullable(false), this, "") /** - * The column Calls.callee_name_symbol_id. + * The column Calls.callee_name. */ - val CALLEE_NAME_SYMBOL_ID: TableField = createField(DSL.name("callee_name_symbol_id"), SQLDataType.BIGINT.nullable(false), this, "") + val CALLEE_NAME: TableField = createField(DSL.name("callee_name"), SQLDataType.VARCHAR(256).nullable(false), this, "") /** * The column Calls.callee_desc_hash. @@ -97,9 +85,9 @@ open class Calls( val OPCODE: TableField = createField(DSL.name("opcode"), SQLDataType.INTEGER, this, "") /** - * The column Calls.caller_class_symbol_id. + * The column Calls.caller_class_name. */ - val CALLER_CLASS_SYMBOL_ID: TableField = createField(DSL.name("caller_class_symbol_id"), SQLDataType.BIGINT.nullable(false), this, "") + val CALLER_CLASS_NAME: TableField = createField(DSL.name("caller_class_name"), SQLDataType.VARCHAR(256).nullable(false), this, "") /** * The column Calls.caller_method_offsets. @@ -132,16 +120,9 @@ open class Calls( constructor(child: Table, key: ForeignKey): this(Internal.createPathAlias(child, key), child, key, CALLS, null) override fun getSchema(): Schema = DefaultSchema.DEFAULT_SCHEMA override fun getIndexes(): List = listOf(CALLSSEARCH) - override fun getReferences(): List> = listOf(FK_CALLS_SYMBOLS_1, FK_CALLS_BYTECODELOCATIONS_1) + override fun getReferences(): List> = listOf(FK_CALLS_BYTECODELOCATIONS_1) - private lateinit var _symbols: Symbols private lateinit var _bytecodelocations: Bytecodelocations - fun symbols(): Symbols { - if (!this::_symbols.isInitialized) - _symbols = Symbols(this, FK_CALLS_SYMBOLS_1) - - return _symbols; - } fun bytecodelocations(): Bytecodelocations { if (!this::_bytecodelocations.isInitialized) _bytecodelocations = Bytecodelocations(this, FK_CALLS_BYTECODELOCATIONS_1) @@ -164,5 +145,5 @@ open class Calls( // ------------------------------------------------------------------------- // Row7 type methods // ------------------------------------------------------------------------- - override fun fieldsRow(): Row7 = super.fieldsRow() as Row7 + override fun fieldsRow(): Row7 = super.fieldsRow() as Row7 } diff --git a/jacodb-core/src/main/jooq/org/jacodb/impl/storage/jooq/tables/Classes.kt b/jacodb-core/src/main/jooq/org/jacodb/impl/storage/jooq/tables/Classes.kt index cf66f49b3..66c087a8f 100644 --- a/jacodb-core/src/main/jooq/org/jacodb/impl/storage/jooq/tables/Classes.kt +++ b/jacodb-core/src/main/jooq/org/jacodb/impl/storage/jooq/tables/Classes.kt @@ -20,28 +20,17 @@ package org.jacodb.impl.storage.jooq.tables -import org.jooq.Field -import org.jooq.ForeignKey -import org.jooq.Name -import org.jooq.Record -import org.jooq.Row9 -import org.jooq.Schema -import org.jooq.Table -import org.jooq.TableField -import org.jooq.TableOptions -import org.jooq.UniqueKey +import org.jacodb.impl.storage.jooq.DefaultSchema +import org.jacodb.impl.storage.jooq.indexes.CLASSES_LOCATION +import org.jacodb.impl.storage.jooq.indexes.CLASSES_NAME +import org.jacodb.impl.storage.jooq.indexes.CLASSES_OUTERMETHODID +import org.jacodb.impl.storage.jooq.keys.* +import org.jacodb.impl.storage.jooq.tables.records.ClassesRecord +import org.jooq.* import org.jooq.impl.DSL import org.jooq.impl.Internal import org.jooq.impl.SQLDataType import org.jooq.impl.TableImpl -import org.jacodb.impl.storage.jooq.DefaultSchema -import org.jacodb.impl.storage.jooq.keys.FK_CLASSES_BYTECODELOCATIONS_1 -import org.jacodb.impl.storage.jooq.keys.FK_CLASSES_METHODS_1 -import org.jacodb.impl.storage.jooq.keys.FK_CLASSES_OUTERCLASSES_1 -import org.jacodb.impl.storage.jooq.keys.FK_CLASSES_SYMBOLS_1 -import org.jacodb.impl.storage.jooq.keys.FK_CLASSES_SYMBOLS_2 -import org.jacodb.impl.storage.jooq.keys.PK_CLASSES -import org.jacodb.impl.storage.jooq.tables.records.ClassesRecord /** @@ -142,6 +131,7 @@ open class Classes( constructor(child: Table, key: ForeignKey): this(Internal.createPathAlias(child, key), child, key, CLASSES, null) override fun getSchema(): Schema = DefaultSchema.DEFAULT_SCHEMA + override fun getIndexes(): List = listOf(CLASSES_LOCATION, CLASSES_NAME, CLASSES_OUTERMETHODID) override fun getPrimaryKey(): UniqueKey = PK_CLASSES override fun getKeys(): List> = listOf(PK_CLASSES) override fun getReferences(): List> = listOf(FK_CLASSES_SYMBOLS_2, FK_CLASSES_BYTECODELOCATIONS_1, FK_CLASSES_SYMBOLS_1, FK_CLASSES_OUTERCLASSES_1, FK_CLASSES_METHODS_1) diff --git a/jacodb-core/src/main/jooq/org/jacodb/impl/storage/jooq/tables/Classhierarchies.kt b/jacodb-core/src/main/jooq/org/jacodb/impl/storage/jooq/tables/Classhierarchies.kt index ad8e520b8..09ce49da6 100644 --- a/jacodb-core/src/main/jooq/org/jacodb/impl/storage/jooq/tables/Classhierarchies.kt +++ b/jacodb-core/src/main/jooq/org/jacodb/impl/storage/jooq/tables/Classhierarchies.kt @@ -20,25 +20,18 @@ package org.jacodb.impl.storage.jooq.tables -import org.jooq.Field -import org.jooq.ForeignKey -import org.jooq.Name -import org.jooq.Record -import org.jooq.Row4 -import org.jooq.Schema -import org.jooq.Table -import org.jooq.TableField -import org.jooq.TableOptions -import org.jooq.UniqueKey -import org.jooq.impl.DSL -import org.jooq.impl.Internal -import org.jooq.impl.SQLDataType -import org.jooq.impl.TableImpl import org.jacodb.impl.storage.jooq.DefaultSchema +import org.jacodb.impl.storage.jooq.indexes.CLASSHIERARCHIES_CLASSID +import org.jacodb.impl.storage.jooq.indexes.CLASSHIERARCHIES_SUPERID import org.jacodb.impl.storage.jooq.keys.FK_CLASSHIERARCHIES_CLASSES_1 import org.jacodb.impl.storage.jooq.keys.FK_CLASSHIERARCHIES_SYMBOLS_1 import org.jacodb.impl.storage.jooq.keys.PK_CLASSHIERARCHIES import org.jacodb.impl.storage.jooq.tables.records.ClasshierarchiesRecord +import org.jooq.* +import org.jooq.impl.DSL +import org.jooq.impl.Internal +import org.jooq.impl.SQLDataType +import org.jooq.impl.TableImpl /** @@ -114,6 +107,7 @@ open class Classhierarchies( constructor(child: Table, key: ForeignKey): this(Internal.createPathAlias(child, key), child, key, CLASSHIERARCHIES, null) override fun getSchema(): Schema = DefaultSchema.DEFAULT_SCHEMA + override fun getIndexes(): List = listOf(org.jacodb.impl.storage.jooq.indexes.`CLASS HIERARCHIES`, CLASSHIERARCHIES_CLASSID, CLASSHIERARCHIES_SUPERID) override fun getPrimaryKey(): UniqueKey = PK_CLASSHIERARCHIES override fun getKeys(): List> = listOf(PK_CLASSHIERARCHIES) override fun getReferences(): List> = listOf(FK_CLASSHIERARCHIES_CLASSES_1, FK_CLASSHIERARCHIES_SYMBOLS_1) diff --git a/jacodb-core/src/main/jooq/org/jacodb/impl/storage/jooq/tables/Classinnerclasses.kt b/jacodb-core/src/main/jooq/org/jacodb/impl/storage/jooq/tables/Classinnerclasses.kt index ff030b0df..ebcc3b48d 100644 --- a/jacodb-core/src/main/jooq/org/jacodb/impl/storage/jooq/tables/Classinnerclasses.kt +++ b/jacodb-core/src/main/jooq/org/jacodb/impl/storage/jooq/tables/Classinnerclasses.kt @@ -20,25 +20,18 @@ package org.jacodb.impl.storage.jooq.tables -import org.jooq.Field -import org.jooq.ForeignKey -import org.jooq.Name -import org.jooq.Record -import org.jooq.Row3 -import org.jooq.Schema -import org.jooq.Table -import org.jooq.TableField -import org.jooq.TableOptions -import org.jooq.UniqueKey -import org.jooq.impl.DSL -import org.jooq.impl.Internal -import org.jooq.impl.SQLDataType -import org.jooq.impl.TableImpl import org.jacodb.impl.storage.jooq.DefaultSchema +import org.jacodb.impl.storage.jooq.indexes.CLASSINNERCLASSES_CLASSID +import org.jacodb.impl.storage.jooq.indexes.CLASSINNERCLASSES_INNERCLASSID import org.jacodb.impl.storage.jooq.keys.FK_CLASSINNERCLASSES_CLASSES_1 import org.jacodb.impl.storage.jooq.keys.FK_CLASSINNERCLASSES_SYMBOLS_1 import org.jacodb.impl.storage.jooq.keys.PK_CLASSINNERCLASSES import org.jacodb.impl.storage.jooq.tables.records.ClassinnerclassesRecord +import org.jooq.* +import org.jooq.impl.DSL +import org.jooq.impl.Internal +import org.jooq.impl.SQLDataType +import org.jooq.impl.TableImpl /** @@ -109,6 +102,7 @@ open class Classinnerclasses( constructor(child: Table, key: ForeignKey): this(Internal.createPathAlias(child, key), child, key, CLASSINNERCLASSES, null) override fun getSchema(): Schema = DefaultSchema.DEFAULT_SCHEMA + override fun getIndexes(): List = listOf(CLASSINNERCLASSES_CLASSID, CLASSINNERCLASSES_INNERCLASSID) override fun getPrimaryKey(): UniqueKey = PK_CLASSINNERCLASSES override fun getKeys(): List> = listOf(PK_CLASSINNERCLASSES) override fun getReferences(): List> = listOf(FK_CLASSINNERCLASSES_CLASSES_1, FK_CLASSINNERCLASSES_SYMBOLS_1) diff --git a/jacodb-core/src/main/jooq/org/jacodb/impl/storage/jooq/tables/Fields.kt b/jacodb-core/src/main/jooq/org/jacodb/impl/storage/jooq/tables/Fields.kt index 67fefcac8..205df1b47 100644 --- a/jacodb-core/src/main/jooq/org/jacodb/impl/storage/jooq/tables/Fields.kt +++ b/jacodb-core/src/main/jooq/org/jacodb/impl/storage/jooq/tables/Fields.kt @@ -20,26 +20,19 @@ package org.jacodb.impl.storage.jooq.tables -import org.jooq.Field -import org.jooq.ForeignKey -import org.jooq.Name -import org.jooq.Record -import org.jooq.Row6 -import org.jooq.Schema -import org.jooq.Table -import org.jooq.TableField -import org.jooq.TableOptions -import org.jooq.UniqueKey -import org.jooq.impl.DSL -import org.jooq.impl.Internal -import org.jooq.impl.SQLDataType -import org.jooq.impl.TableImpl import org.jacodb.impl.storage.jooq.DefaultSchema +import org.jacodb.impl.storage.jooq.indexes.FIELDS_CLASSID +import org.jacodb.impl.storage.jooq.indexes.FIELDS_CLASS_ID_NAME import org.jacodb.impl.storage.jooq.keys.FK_FIELDS_CLASSES_1 import org.jacodb.impl.storage.jooq.keys.FK_FIELDS_SYMBOLS_1 import org.jacodb.impl.storage.jooq.keys.FK_FIELDS_SYMBOLS_2 import org.jacodb.impl.storage.jooq.keys.PK_FIELDS import org.jacodb.impl.storage.jooq.tables.records.FieldsRecord +import org.jooq.* +import org.jooq.impl.DSL +import org.jooq.impl.Internal +import org.jooq.impl.SQLDataType +import org.jooq.impl.TableImpl /** @@ -125,6 +118,7 @@ open class Fields( constructor(child: Table, key: ForeignKey): this(Internal.createPathAlias(child, key), child, key, FIELDS, null) override fun getSchema(): Schema = DefaultSchema.DEFAULT_SCHEMA + override fun getIndexes(): List = listOf(FIELDS_CLASS_ID_NAME, FIELDS_CLASSID) override fun getPrimaryKey(): UniqueKey = PK_FIELDS override fun getKeys(): List> = listOf(PK_FIELDS) override fun getReferences(): List> = listOf(FK_FIELDS_SYMBOLS_2, FK_FIELDS_SYMBOLS_1, FK_FIELDS_CLASSES_1) diff --git a/jacodb-core/src/main/jooq/org/jacodb/impl/storage/jooq/tables/Methodparameters.kt b/jacodb-core/src/main/jooq/org/jacodb/impl/storage/jooq/tables/Methodparameters.kt index 22f1d666e..06886c164 100644 --- a/jacodb-core/src/main/jooq/org/jacodb/impl/storage/jooq/tables/Methodparameters.kt +++ b/jacodb-core/src/main/jooq/org/jacodb/impl/storage/jooq/tables/Methodparameters.kt @@ -20,27 +20,17 @@ package org.jacodb.impl.storage.jooq.tables -import kotlin.collections.List - -import org.jooq.Field -import org.jooq.ForeignKey -import org.jooq.Name -import org.jooq.Record -import org.jooq.Row6 -import org.jooq.Schema -import org.jooq.Table -import org.jooq.TableField -import org.jooq.TableOptions -import org.jooq.UniqueKey -import org.jooq.impl.DSL -import org.jooq.impl.Internal -import org.jooq.impl.SQLDataType -import org.jooq.impl.TableImpl import org.jacodb.impl.storage.jooq.DefaultSchema +import org.jacodb.impl.storage.jooq.indexes.METHODPARAMETERS_METHODID import org.jacodb.impl.storage.jooq.keys.FK_METHODPARAMETERS_METHODS_1 import org.jacodb.impl.storage.jooq.keys.FK_METHODPARAMETERS_SYMBOLS_1 import org.jacodb.impl.storage.jooq.keys.PK_METHODPARAMETERS import org.jacodb.impl.storage.jooq.tables.records.MethodparametersRecord +import org.jooq.* +import org.jooq.impl.DSL +import org.jooq.impl.Internal +import org.jooq.impl.SQLDataType +import org.jooq.impl.TableImpl /** @@ -126,6 +116,7 @@ open class Methodparameters( constructor(child: Table, key: ForeignKey): this(Internal.createPathAlias(child, key), child, key, METHODPARAMETERS, null) override fun getSchema(): Schema = DefaultSchema.DEFAULT_SCHEMA + override fun getIndexes(): List = listOf(METHODPARAMETERS_METHODID) override fun getPrimaryKey(): UniqueKey = PK_METHODPARAMETERS override fun getKeys(): List> = listOf(PK_METHODPARAMETERS) override fun getReferences(): List> = listOf(FK_METHODPARAMETERS_SYMBOLS_1, FK_METHODPARAMETERS_METHODS_1) diff --git a/jacodb-core/src/main/jooq/org/jacodb/impl/storage/jooq/tables/Methods.kt b/jacodb-core/src/main/jooq/org/jacodb/impl/storage/jooq/tables/Methods.kt index 9f3de38bd..7d6bf3179 100644 --- a/jacodb-core/src/main/jooq/org/jacodb/impl/storage/jooq/tables/Methods.kt +++ b/jacodb-core/src/main/jooq/org/jacodb/impl/storage/jooq/tables/Methods.kt @@ -20,26 +20,19 @@ package org.jacodb.impl.storage.jooq.tables -import org.jooq.Field -import org.jooq.ForeignKey -import org.jooq.Name -import org.jooq.Record -import org.jooq.Row7 -import org.jooq.Schema -import org.jooq.Table -import org.jooq.TableField -import org.jooq.TableOptions -import org.jooq.UniqueKey -import org.jooq.impl.DSL -import org.jooq.impl.Internal -import org.jooq.impl.SQLDataType -import org.jooq.impl.TableImpl import org.jacodb.impl.storage.jooq.DefaultSchema +import org.jacodb.impl.storage.jooq.indexes.METHODS_CLASSID +import org.jacodb.impl.storage.jooq.indexes.METHODS_CLASS_ID_NAME_DESC import org.jacodb.impl.storage.jooq.keys.FK_METHODS_CLASSES_1 import org.jacodb.impl.storage.jooq.keys.FK_METHODS_SYMBOLS_1 import org.jacodb.impl.storage.jooq.keys.FK_METHODS_SYMBOLS_2 import org.jacodb.impl.storage.jooq.keys.PK_METHODS import org.jacodb.impl.storage.jooq.tables.records.MethodsRecord +import org.jooq.* +import org.jooq.impl.DSL +import org.jooq.impl.Internal +import org.jooq.impl.SQLDataType +import org.jooq.impl.TableImpl /** @@ -130,6 +123,7 @@ open class Methods( constructor(child: Table, key: ForeignKey): this(Internal.createPathAlias(child, key), child, key, METHODS, null) override fun getSchema(): Schema = DefaultSchema.DEFAULT_SCHEMA + override fun getIndexes(): List = listOf(METHODS_CLASS_ID_NAME_DESC, METHODS_CLASSID) override fun getPrimaryKey(): UniqueKey = PK_METHODS override fun getKeys(): List> = listOf(PK_METHODS) override fun getReferences(): List> = listOf(FK_METHODS_SYMBOLS_2, FK_METHODS_SYMBOLS_1, FK_METHODS_CLASSES_1) diff --git a/jacodb-core/src/main/jooq/org/jacodb/impl/storage/jooq/tables/Outerclasses.kt b/jacodb-core/src/main/jooq/org/jacodb/impl/storage/jooq/tables/Outerclasses.kt index 37ee34288..9c821c203 100644 --- a/jacodb-core/src/main/jooq/org/jacodb/impl/storage/jooq/tables/Outerclasses.kt +++ b/jacodb-core/src/main/jooq/org/jacodb/impl/storage/jooq/tables/Outerclasses.kt @@ -20,26 +20,15 @@ package org.jacodb.impl.storage.jooq.tables -import kotlin.collections.List - -import org.jooq.Field -import org.jooq.ForeignKey -import org.jooq.Name -import org.jooq.Record -import org.jooq.Row5 -import org.jooq.Schema -import org.jooq.Table -import org.jooq.TableField -import org.jooq.TableOptions -import org.jooq.UniqueKey -import org.jooq.impl.DSL -import org.jooq.impl.Internal -import org.jooq.impl.SQLDataType -import org.jooq.impl.TableImpl import org.jacodb.impl.storage.jooq.DefaultSchema import org.jacodb.impl.storage.jooq.keys.FK_OUTERCLASSES_SYMBOLS_1 import org.jacodb.impl.storage.jooq.keys.PK_OUTERCLASSES import org.jacodb.impl.storage.jooq.tables.records.OuterclassesRecord +import org.jooq.* +import org.jooq.impl.DSL +import org.jooq.impl.Internal +import org.jooq.impl.SQLDataType +import org.jooq.impl.TableImpl /** diff --git a/jacodb-core/src/main/jooq/org/jacodb/impl/storage/jooq/tables/Refactorings.kt b/jacodb-core/src/main/jooq/org/jacodb/impl/storage/jooq/tables/Refactorings.kt new file mode 100644 index 000000000..c0982da6d --- /dev/null +++ b/jacodb-core/src/main/jooq/org/jacodb/impl/storage/jooq/tables/Refactorings.kt @@ -0,0 +1,107 @@ +/* + * Copyright 2022 UnitTestBot contributors (utbot.org) + *

+ * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* + * This file is generated by jOOQ. + */ +package org.jacodb.impl.storage.jooq.tables + + +import org.jacodb.impl.storage.jooq.DefaultSchema +import org.jacodb.impl.storage.jooq.tables.records.RefactoringsRecord +import org.jooq.* +import org.jooq.impl.DSL +import org.jooq.impl.Internal +import org.jooq.impl.SQLDataType +import org.jooq.impl.TableImpl + + +/** + * This class is generated by jOOQ. + */ +@Suppress("UNCHECKED_CAST") +open class Refactorings( + alias: Name, + child: Table?, + path: ForeignKey?, + aliased: Table?, + parameters: Array?>? +): TableImpl( + alias, + DefaultSchema.DEFAULT_SCHEMA, + child, + path, + aliased, + parameters, + DSL.comment(""), + TableOptions.table() +) { + companion object { + + /** + * The reference instance of Refactorings + */ + val REFACTORINGS = Refactorings() + } + + /** + * The class holding records for this type + */ + override fun getRecordType(): Class = RefactoringsRecord::class.java + + /** + * The column Refactorings.name. + */ + val NAME: TableField = createField(DSL.name("name"), SQLDataType.VARCHAR(1024).nullable(false), this, "") + + private constructor(alias: Name, aliased: Table?): this(alias, null, null, aliased, null) + private constructor(alias: Name, aliased: Table?, parameters: Array?>?): this(alias, null, null, aliased, parameters) + + /** + * Create an aliased Refactorings table reference + */ + constructor(alias: String): this(DSL.name(alias)) + + /** + * Create an aliased Refactorings table reference + */ + constructor(alias: Name): this(alias, null) + + /** + * Create a Refactorings table reference + */ + constructor(): this(DSL.name("Refactorings"), null) + + constructor(child: Table, key: ForeignKey): this(Internal.createPathAlias(child, key), child, key, REFACTORINGS, null) + override fun getSchema(): Schema = DefaultSchema.DEFAULT_SCHEMA + override fun `as`(alias: String): Refactorings = Refactorings(DSL.name(alias), this) + override fun `as`(alias: Name): Refactorings = Refactorings(alias, this) + + /** + * Rename this table + */ + override fun rename(name: String): Refactorings = Refactorings(DSL.name(name), null) + + /** + * Rename this table + */ + override fun rename(name: Name): Refactorings = Refactorings(name, null) + + // ------------------------------------------------------------------------- + // Row1 type methods + // ------------------------------------------------------------------------- + override fun fieldsRow(): Row1 = super.fieldsRow() as Row1 +} diff --git a/jacodb-core/src/main/jooq/org/jacodb/impl/storage/jooq/tables/Symbols.kt b/jacodb-core/src/main/jooq/org/jacodb/impl/storage/jooq/tables/Symbols.kt index 1def8e6e9..3d1265723 100644 --- a/jacodb-core/src/main/jooq/org/jacodb/impl/storage/jooq/tables/Symbols.kt +++ b/jacodb-core/src/main/jooq/org/jacodb/impl/storage/jooq/tables/Symbols.kt @@ -20,23 +20,15 @@ package org.jacodb.impl.storage.jooq.tables -import org.jooq.Field -import org.jooq.ForeignKey -import org.jooq.Name -import org.jooq.Record -import org.jooq.Row2 -import org.jooq.Schema -import org.jooq.Table -import org.jooq.TableField -import org.jooq.TableOptions -import org.jooq.UniqueKey +import org.jacodb.impl.storage.jooq.DefaultSchema +import org.jacodb.impl.storage.jooq.indexes.SYMBOLS_NAME +import org.jacodb.impl.storage.jooq.keys.PK_SYMBOLS +import org.jacodb.impl.storage.jooq.tables.records.SymbolsRecord +import org.jooq.* import org.jooq.impl.DSL import org.jooq.impl.Internal import org.jooq.impl.SQLDataType import org.jooq.impl.TableImpl -import org.jacodb.impl.storage.jooq.DefaultSchema -import org.jacodb.impl.storage.jooq.keys.PK_SYMBOLS -import org.jacodb.impl.storage.jooq.tables.records.SymbolsRecord /** @@ -102,6 +94,7 @@ open class Symbols( constructor(child: Table, key: ForeignKey): this(Internal.createPathAlias(child, key), child, key, SYMBOLS, null) override fun getSchema(): Schema = DefaultSchema.DEFAULT_SCHEMA + override fun getIndexes(): List = listOf(SYMBOLS_NAME) override fun getPrimaryKey(): UniqueKey = PK_SYMBOLS override fun getKeys(): List> = listOf(PK_SYMBOLS) override fun `as`(alias: String): Symbols = Symbols(DSL.name(alias), this) diff --git a/jacodb-core/src/main/jooq/org/jacodb/impl/storage/jooq/tables/records/AnnotationsRecord.kt b/jacodb-core/src/main/jooq/org/jacodb/impl/storage/jooq/tables/records/AnnotationsRecord.kt index 6205283a7..c33e0d48a 100644 --- a/jacodb-core/src/main/jooq/org/jacodb/impl/storage/jooq/tables/records/AnnotationsRecord.kt +++ b/jacodb-core/src/main/jooq/org/jacodb/impl/storage/jooq/tables/records/AnnotationsRecord.kt @@ -20,12 +20,12 @@ package org.jacodb.impl.storage.jooq.tables.records +import org.jacodb.impl.storage.jooq.tables.Annotations import org.jooq.Field import org.jooq.Record1 import org.jooq.Record10 import org.jooq.Row10 import org.jooq.impl.UpdatableRecordImpl -import org.jacodb.impl.storage.jooq.tables.Annotations /** diff --git a/jacodb-core/src/main/jooq/org/jacodb/impl/storage/jooq/tables/records/ApplicationmetadataRecord.kt b/jacodb-core/src/main/jooq/org/jacodb/impl/storage/jooq/tables/records/ApplicationmetadataRecord.kt new file mode 100644 index 000000000..4817213f8 --- /dev/null +++ b/jacodb-core/src/main/jooq/org/jacodb/impl/storage/jooq/tables/records/ApplicationmetadataRecord.kt @@ -0,0 +1,66 @@ +/* + * Copyright 2022 UnitTestBot contributors (utbot.org) + *

+ * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* + * This file is generated by jOOQ. + */ +package org.jacodb.impl.storage.jooq.tables.records + + +import org.jacodb.impl.storage.jooq.tables.Applicationmetadata +import org.jooq.Field +import org.jooq.Record1 +import org.jooq.Row1 +import org.jooq.impl.TableRecordImpl + + +/** + * This class is generated by jOOQ. + */ +@Suppress("UNCHECKED_CAST") +open class ApplicationmetadataRecord() : TableRecordImpl(Applicationmetadata.APPLICATIONMETADATA), Record1 { + + var version: String? + set(value) = set(0, value) + get() = get(0) as String? + + // ------------------------------------------------------------------------- + // Record1 type implementation + // ------------------------------------------------------------------------- + + override fun fieldsRow(): Row1 = super.fieldsRow() as Row1 + override fun valuesRow(): Row1 = super.valuesRow() as Row1 + override fun field1(): Field = Applicationmetadata.APPLICATIONMETADATA.VERSION + override fun component1(): String? = version + override fun value1(): String? = version + + override fun value1(value: String?): ApplicationmetadataRecord { + this.version = value + return this + } + + override fun values(value1: String?): ApplicationmetadataRecord { + this.value1(value1) + return this + } + + /** + * Create a detached, initialised ApplicationmetadataRecord + */ + constructor(version: String? = null): this() { + this.version = version + } +} diff --git a/jacodb-core/src/main/jooq/org/jacodb/impl/storage/jooq/tables/records/BuildersRecord.kt b/jacodb-core/src/main/jooq/org/jacodb/impl/storage/jooq/tables/records/BuildersRecord.kt index 94b0207bb..0f495ad17 100644 --- a/jacodb-core/src/main/jooq/org/jacodb/impl/storage/jooq/tables/records/BuildersRecord.kt +++ b/jacodb-core/src/main/jooq/org/jacodb/impl/storage/jooq/tables/records/BuildersRecord.kt @@ -31,15 +31,15 @@ import org.jooq.impl.TableRecordImpl * This class is generated by jOOQ. */ @Suppress("UNCHECKED_CAST") -open class BuildersRecord() : TableRecordImpl(Builders.BUILDERS), Record5 { +open class BuildersRecord() : TableRecordImpl(Builders.BUILDERS), Record5 { - var classSymbolId: Long? + var className: String? set(value) = set(0, value) - get() = get(0) as Long? + get() = get(0) as String? - var builderClassSymbolId: Long? + var builderClassName: String? set(value) = set(1, value) - get() = get(1) as Long? + get() = get(1) as String? var priority: Int? set(value) = set(2, value) @@ -57,31 +57,31 @@ open class BuildersRecord() : TableRecordImpl(Builders.BUILDERS) // Record5 type implementation // ------------------------------------------------------------------------- - override fun fieldsRow(): Row5 = super.fieldsRow() as Row5 - override fun valuesRow(): Row5 = super.valuesRow() as Row5 - override fun field1(): Field = Builders.BUILDERS.CLASS_SYMBOL_ID - override fun field2(): Field = Builders.BUILDERS.BUILDER_CLASS_SYMBOL_ID + override fun fieldsRow(): Row5 = super.fieldsRow() as Row5 + override fun valuesRow(): Row5 = super.valuesRow() as Row5 + override fun field1(): Field = Builders.BUILDERS.CLASS_NAME + override fun field2(): Field = Builders.BUILDERS.BUILDER_CLASS_NAME override fun field3(): Field = Builders.BUILDERS.PRIORITY override fun field4(): Field = Builders.BUILDERS.OFFSET override fun field5(): Field = Builders.BUILDERS.LOCATION_ID - override fun component1(): Long? = classSymbolId - override fun component2(): Long? = builderClassSymbolId + override fun component1(): String? = className + override fun component2(): String? = builderClassName override fun component3(): Int? = priority override fun component4(): Int? = offset override fun component5(): Long? = locationId - override fun value1(): Long? = classSymbolId - override fun value2(): Long? = builderClassSymbolId + override fun value1(): String? = className + override fun value2(): String? = builderClassName override fun value3(): Int? = priority override fun value4(): Int? = offset override fun value5(): Long? = locationId - override fun value1(value: Long?): BuildersRecord { - this.classSymbolId = value + override fun value1(value: String?): BuildersRecord { + this.className = value return this } - override fun value2(value: Long?): BuildersRecord { - this.builderClassSymbolId = value + override fun value2(value: String?): BuildersRecord { + this.builderClassName = value return this } @@ -100,7 +100,7 @@ open class BuildersRecord() : TableRecordImpl(Builders.BUILDERS) return this } - override fun values(value1: Long?, value2: Long?, value3: Int?, value4: Int?, value5: Long?): BuildersRecord { + override fun values(value1: String?, value2: String?, value3: Int?, value4: Int?, value5: Long?): BuildersRecord { this.value1(value1) this.value2(value2) this.value3(value3) @@ -112,9 +112,9 @@ open class BuildersRecord() : TableRecordImpl(Builders.BUILDERS) /** * Create a detached, initialised BuildersRecord */ - constructor(classSymbolId: Long? = null, builderClassSymbolId: Long? = null, priority: Int? = null, offset: Int? = null, locationId: Long? = null): this() { - this.classSymbolId = classSymbolId - this.builderClassSymbolId = builderClassSymbolId + constructor(className: String? = null, builderClassName: String? = null, priority: Int? = null, offset: Int? = null, locationId: Long? = null): this() { + this.className = className + this.builderClassName = builderClassName this.priority = priority this.offset = offset this.locationId = locationId diff --git a/jacodb-core/src/main/jooq/org/jacodb/impl/storage/jooq/tables/records/CallsRecord.kt b/jacodb-core/src/main/jooq/org/jacodb/impl/storage/jooq/tables/records/CallsRecord.kt index 989380153..a2c908925 100644 --- a/jacodb-core/src/main/jooq/org/jacodb/impl/storage/jooq/tables/records/CallsRecord.kt +++ b/jacodb-core/src/main/jooq/org/jacodb/impl/storage/jooq/tables/records/CallsRecord.kt @@ -31,15 +31,15 @@ import org.jooq.impl.TableRecordImpl * This class is generated by jOOQ. */ @Suppress("UNCHECKED_CAST") -open class CallsRecord() : TableRecordImpl(Calls.CALLS), Record7 { +open class CallsRecord() : TableRecordImpl(Calls.CALLS), Record7 { - var calleeClassSymbolId: Long? + var calleeClassName: String? set(value) = set(0, value) - get() = get(0) as Long? + get() = get(0) as String? - var calleeNameSymbolId: Long? + var calleeName: String? set(value) = set(1, value) - get() = get(1) as Long? + get() = get(1) as String? var calleeDescHash: Long? set(value) = set(2, value) @@ -49,9 +49,9 @@ open class CallsRecord() : TableRecordImpl(Calls.CALLS), Record7(Calls.CALLS), Record7 = super.fieldsRow() as Row7 - override fun valuesRow(): Row7 = super.valuesRow() as Row7 - override fun field1(): Field = Calls.CALLS.CALLEE_CLASS_SYMBOL_ID - override fun field2(): Field = Calls.CALLS.CALLEE_NAME_SYMBOL_ID + override fun fieldsRow(): Row7 = super.fieldsRow() as Row7 + override fun valuesRow(): Row7 = super.valuesRow() as Row7 + override fun field1(): Field = Calls.CALLS.CALLEE_CLASS_NAME + override fun field2(): Field = Calls.CALLS.CALLEE_NAME override fun field3(): Field = Calls.CALLS.CALLEE_DESC_HASH override fun field4(): Field = Calls.CALLS.OPCODE - override fun field5(): Field = Calls.CALLS.CALLER_CLASS_SYMBOL_ID + override fun field5(): Field = Calls.CALLS.CALLER_CLASS_NAME override fun field6(): Field = Calls.CALLS.CALLER_METHOD_OFFSETS override fun field7(): Field = Calls.CALLS.LOCATION_ID - override fun component1(): Long? = calleeClassSymbolId - override fun component2(): Long? = calleeNameSymbolId + override fun component1(): String? = calleeClassName + override fun component2(): String? = calleeName override fun component3(): Long? = calleeDescHash override fun component4(): Int? = opcode - override fun component5(): Long? = callerClassSymbolId + override fun component5(): String? = callerClassName override fun component6(): ByteArray? = callerMethodOffsets override fun component7(): Long? = locationId - override fun value1(): Long? = calleeClassSymbolId - override fun value2(): Long? = calleeNameSymbolId + override fun value1(): String? = calleeClassName + override fun value2(): String? = calleeName override fun value3(): Long? = calleeDescHash override fun value4(): Int? = opcode - override fun value5(): Long? = callerClassSymbolId + override fun value5(): String? = callerClassName override fun value6(): ByteArray? = callerMethodOffsets override fun value7(): Long? = locationId - override fun value1(value: Long?): CallsRecord { - this.calleeClassSymbolId = value + override fun value1(value: String?): CallsRecord { + this.calleeClassName = value return this } - override fun value2(value: Long?): CallsRecord { - this.calleeNameSymbolId = value + override fun value2(value: String?): CallsRecord { + this.calleeName = value return this } @@ -109,8 +109,8 @@ open class CallsRecord() : TableRecordImpl(Calls.CALLS), Record7(Calls.CALLS), Record7(Calls.CALLS), Record7 + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* + * This file is generated by jOOQ. + */ +package org.jacodb.impl.storage.jooq.tables.records + + +import org.jacodb.impl.storage.jooq.tables.Refactorings +import org.jooq.Field +import org.jooq.Record1 +import org.jooq.Row1 +import org.jooq.impl.TableRecordImpl + + +/** + * This class is generated by jOOQ. + */ +@Suppress("UNCHECKED_CAST") +open class RefactoringsRecord() : TableRecordImpl(Refactorings.REFACTORINGS), Record1 { + + var name: String? + set(value) = set(0, value) + get() = get(0) as String? + + // ------------------------------------------------------------------------- + // Record1 type implementation + // ------------------------------------------------------------------------- + + override fun fieldsRow(): Row1 = super.fieldsRow() as Row1 + override fun valuesRow(): Row1 = super.valuesRow() as Row1 + override fun field1(): Field = Refactorings.REFACTORINGS.NAME + override fun component1(): String? = name + override fun value1(): String? = name + + override fun value1(value: String?): RefactoringsRecord { + this.name = value + return this + } + + override fun values(value1: String?): RefactoringsRecord { + this.value1(value1) + return this + } + + /** + * Create a detached, initialised RefactoringsRecord + */ + constructor(name: String? = null): this() { + this.name = name + } +} diff --git a/jacodb-core/src/main/jooq/org/jacodb/impl/storage/jooq/tables/references/Tables.kt b/jacodb-core/src/main/jooq/org/jacodb/impl/storage/jooq/tables/references/Tables.kt index c014f1d23..5595f6b4c 100644 --- a/jacodb-core/src/main/jooq/org/jacodb/impl/storage/jooq/tables/references/Tables.kt +++ b/jacodb-core/src/main/jooq/org/jacodb/impl/storage/jooq/tables/references/Tables.kt @@ -20,30 +20,24 @@ package org.jacodb.impl.storage.jooq.tables.references -import org.jacodb.impl.storage.jooq.tables.Annotationvalues -import org.jacodb.impl.storage.jooq.tables.Builders -import org.jacodb.impl.storage.jooq.tables.Bytecodelocations -import org.jacodb.impl.storage.jooq.tables.Calls -import org.jacodb.impl.storage.jooq.tables.Classes -import org.jacodb.impl.storage.jooq.tables.Classhierarchies -import org.jacodb.impl.storage.jooq.tables.Classinnerclasses -import org.jacodb.impl.storage.jooq.tables.Fields -import org.jacodb.impl.storage.jooq.tables.Methodparameters -import org.jacodb.impl.storage.jooq.tables.Methods -import org.jacodb.impl.storage.jooq.tables.Outerclasses -import org.jacodb.impl.storage.jooq.tables.Symbols +import org.jacodb.impl.storage.jooq.tables.* /** * The table Annotations. */ -val ANNOTATIONS = org.jacodb.impl.storage.jooq.tables.Annotations.ANNOTATIONS +val ANNOTATIONS = Annotations.ANNOTATIONS /** * The table AnnotationValues. */ val ANNOTATIONVALUES = Annotationvalues.ANNOTATIONVALUES +/** + * The table ApplicationMetadata. + */ +val APPLICATIONMETADATA = Applicationmetadata.APPLICATIONMETADATA + /** * The table Builders. */ @@ -94,6 +88,11 @@ val METHODS = Methods.METHODS */ val OUTERCLASSES = Outerclasses.OUTERCLASSES +/** + * The table Refactorings. + */ +val REFACTORINGS = Refactorings.REFACTORINGS + /** * The table Symbols. */ diff --git a/jacodb-core/src/main/kotlin/org/jacodb/impl/JcSettings.kt b/jacodb-core/src/main/kotlin/org/jacodb/impl/JcSettings.kt index 10e4cb34f..f1fd4e29e 100644 --- a/jacodb-core/src/main/kotlin/org/jacodb/impl/JcSettings.kt +++ b/jacodb-core/src/main/kotlin/org/jacodb/impl/JcSettings.kt @@ -23,7 +23,6 @@ import org.jacodb.api.JcDatabase import org.jacodb.api.JcDatabasePersistence import org.jacodb.api.JcFeature import org.jacodb.impl.fs.JavaRuntime -import org.jacodb.impl.storage.PostgresPersistenceImpl import org.jacodb.impl.storage.SQLitePersistenceImpl import java.io.File import java.time.Duration @@ -178,22 +177,7 @@ enum class PredefinedPersistenceType : JcPersistenceType { clearOnStart = settings.persistentClearOnStart ?: false ) } - }, - POSTGRES { - override fun newPersistence( - runtime: JavaRuntime, - featuresRegistry: FeaturesRegistry, - settings: JcSettings - ): JcDatabasePersistence { - return PostgresPersistenceImpl( - javaRuntime = runtime, - featuresRegistry = featuresRegistry, - jcdbUrl = settings.persistentLocation, - clearOnStart = settings.persistentClearOnStart ?: false - ) - } - }; - + } } class JcByteCodeCache(val prefixes: List = persistentListOf("java.", "javax.", "kotlinx.", "kotlin.")) @@ -225,9 +209,11 @@ class JcCacheSettings { } @JvmOverloads - fun rawInstLists(maxSize: Long, expiration: Duration, valueStoreType: ValueStoreType = ValueStoreType.STRONG) = apply { - rawInstLists = JcCacheSegmentSettings(maxSize = maxSize, expiration = expiration, valueStoreType = valueStoreType) - } + fun rawInstLists(maxSize: Long, expiration: Duration, valueStoreType: ValueStoreType = ValueStoreType.STRONG) = + apply { + rawInstLists = + JcCacheSegmentSettings(maxSize = maxSize, expiration = expiration, valueStoreType = valueStoreType) + } @JvmOverloads fun instLists(maxSize: Long, expiration: Duration, valueStoreType: ValueStoreType = ValueStoreType.STRONG) = apply { @@ -235,8 +221,10 @@ class JcCacheSettings { } @JvmOverloads - fun flowGraphs(maxSize: Long, expiration: Duration, valueStoreType: ValueStoreType = ValueStoreType.STRONG) = apply { - flowGraphs = JcCacheSegmentSettings(maxSize = maxSize, expiration = expiration, valueStoreType = valueStoreType) - } + fun flowGraphs(maxSize: Long, expiration: Duration, valueStoreType: ValueStoreType = ValueStoreType.STRONG) = + apply { + flowGraphs = + JcCacheSegmentSettings(maxSize = maxSize, expiration = expiration, valueStoreType = valueStoreType) + } } diff --git a/jacodb-core/src/main/kotlin/org/jacodb/impl/features/Builders.kt b/jacodb-core/src/main/kotlin/org/jacodb/impl/features/Builders.kt index cc4278822..3ffe1ebf6 100644 --- a/jacodb-core/src/main/kotlin/org/jacodb/impl/features/Builders.kt +++ b/jacodb-core/src/main/kotlin/org/jacodb/impl/features/Builders.kt @@ -16,14 +16,7 @@ package org.jacodb.impl.features -import org.jacodb.api.ByteCodeIndexer -import org.jacodb.api.ClassSource -import org.jacodb.api.JcClasspath -import org.jacodb.api.JcDatabase -import org.jacodb.api.JcDatabasePersistence -import org.jacodb.api.JcFeature -import org.jacodb.api.JcSignal -import org.jacodb.api.RegisteredLocation +import org.jacodb.api.* import org.jacodb.api.ext.jvmPrimitiveNames import org.jacodb.impl.fs.PersistenceClassSource import org.jacodb.impl.fs.className @@ -92,12 +85,12 @@ class BuildersIndexer(val persistence: JcDatabasePersistence, private val locati jooq.withoutAutoCommit { conn -> conn.runBatch(BUILDERS) { potentialBuilders.forEach { (calleeClass, builders) -> - val calleeId = calleeClass.className.symbolId + val calleeId = calleeClass.className builders.forEach { val (callerClass, offset, priority) = it - val callerId = callerClass.className.symbolId - setLong(1, calleeId) - setLong(2, callerId) + val callerId = callerClass.className + setString(1, calleeId) + setString(2, callerId) setInt(3, priority) setInt(4, offset) setLong(5, location.id) @@ -108,8 +101,6 @@ class BuildersIndexer(val persistence: JcDatabasePersistence, private val locati } } - private inline val String.symbolId - get() = persistence.findSymbolId(this) ?: throw IllegalStateException("Id not found for name: $this") } data class BuildersResponse( @@ -120,23 +111,28 @@ data class BuildersResponse( object Builders : JcFeature, BuildersResponse> { + fun create(jooq: DSLContext, drop: Boolean) { + if (drop) { + jooq.executeQueries(dropScheme) + } + jooq.executeQueries(createScheme) + } + private val createScheme = """ CREATE TABLE IF NOT EXISTS "Builders"( - "class_symbol_id" BIGINT NOT NULL, - "builder_class_symbol_id" BIGINT NOT NULL, + "class_name" VARCHAR(256) NOT NULL, + "builder_class_name" VARCHAR(256) NOT NULL, "priority" INTEGER NOT NULL, "offset" INTEGER NOT NULL, "location_id" BIGINT NOT NULL, - CONSTRAINT "fk_class_symbol_id" FOREIGN KEY ("class_symbol_id") REFERENCES "Symbols" ("id") ON DELETE CASCADE, - CONSTRAINT "fk_builder_class_symbol_id" FOREIGN KEY ("builder_class_symbol_id") REFERENCES "Symbols" ("id") ON DELETE CASCADE, - CONSTRAINT "fk_location_id" FOREIGN KEY ("location_id") REFERENCES "BytecodeLocations" ("id") ON DELETE CASCADE + CONSTRAINT "fk_location_id" FOREIGN KEY ("location_id") REFERENCES "BytecodeLocations" ("id") ON DELETE CASCADE ); """.trimIndent() private val createIndex = """ - CREATE INDEX IF NOT EXISTS "BuildersSearch" ON "Builders"(location_id, class_symbol_id, priority); + CREATE INDEX IF NOT EXISTS "BuildersSearch" ON "Builders"(location_id, class_name, priority); CREATE INDEX IF NOT EXISTS "BuildersSorting" ON "Builders"(priority); - CREATE INDEX IF NOT EXISTS "BuildersJoin" ON "Builders"(builder_class_symbol_id); + CREATE INDEX IF NOT EXISTS "BuildersJoin" ON "Builders"(builder_class_name); """.trimIndent() private val dropScheme = """ @@ -186,15 +182,16 @@ object Builders : JcFeature, BuildersResponse> { fun syncQuery(classpath: JcClasspath, req: Set): Sequence { val locationIds = classpath.registeredLocations.map { it.id } val persistence = classpath.db.persistence - val classNameIds = req.map { persistence.findSymbolId(it) } return sequence { val result = persistence.read { jooq -> jooq.select(BUILDERS.OFFSET, SYMBOLS.NAME, CLASSES.ID, CLASSES.LOCATION_ID, BUILDERS.PRIORITY) .from(BUILDERS) - .join(SYMBOLS).on(SYMBOLS.ID.eq(BUILDERS.BUILDER_CLASS_SYMBOL_ID)) - .join(CLASSES).on(CLASSES.NAME.eq(BUILDERS.BUILDER_CLASS_SYMBOL_ID).and(BUILDERS.LOCATION_ID.eq(CLASSES.LOCATION_ID))) + .join(SYMBOLS).on(SYMBOLS.NAME.eq(BUILDERS.BUILDER_CLASS_NAME)) + .join(CLASSES).on(CLASSES.NAME.eq(SYMBOLS.ID).and(BUILDERS.LOCATION_ID.eq(CLASSES.LOCATION_ID))) .where( - BUILDERS.CLASS_SYMBOL_ID.`in`(classNameIds).and(BUILDERS.LOCATION_ID.`in`(locationIds)) + BUILDERS.CLASS_NAME.`in`(req).and(BUILDERS.LOCATION_ID.`in`(locationIds)) + + ) .limit(100) .fetch() diff --git a/jacodb-core/src/main/kotlin/org/jacodb/impl/features/Usages.kt b/jacodb-core/src/main/kotlin/org/jacodb/impl/features/Usages.kt index de85b1eb9..a868aa3fc 100644 --- a/jacodb-core/src/main/kotlin/org/jacodb/impl/features/Usages.kt +++ b/jacodb-core/src/main/kotlin/org/jacodb/impl/features/Usages.kt @@ -16,26 +16,13 @@ package org.jacodb.impl.features -import org.jacodb.api.ByteCodeIndexer -import org.jacodb.api.JcClasspath -import org.jacodb.api.JcDatabase -import org.jacodb.api.JcDatabasePersistence -import org.jacodb.api.JcFeature -import org.jacodb.api.JcSignal -import org.jacodb.api.RegisteredLocation +import org.jacodb.api.* import org.jacodb.impl.fs.PersistenceClassSource import org.jacodb.impl.fs.className -import org.jacodb.impl.storage.BatchedSequence -import org.jacodb.impl.storage.defaultBatchSize -import org.jacodb.impl.storage.eqOrNull -import org.jacodb.impl.storage.executeQueries +import org.jacodb.impl.storage.* import org.jacodb.impl.storage.jooq.tables.references.CALLS import org.jacodb.impl.storage.jooq.tables.references.CLASSES import org.jacodb.impl.storage.jooq.tables.references.SYMBOLS -import org.jacodb.impl.storage.longHash -import org.jacodb.impl.storage.runBatch -import org.jacodb.impl.storage.setNullableLong -import org.jacodb.impl.storage.withoutAutoCommit import org.jooq.DSLContext import org.objectweb.asm.Type import org.objectweb.asm.tree.ClassNode @@ -77,12 +64,11 @@ private class MethodMap(size: Int) { } } -class UsagesIndexer(persistence: JcDatabasePersistence, private val location: RegisteredLocation) : +class UsagesIndexer(private val location: RegisteredLocation) : ByteCodeIndexer { // callee_class -> (callee_name, callee_desc, opcode) -> caller private val usages = hashMapOf, HashMap>>() - private val interner = persistence.symbolInterner override fun index(classNode: ClassNode) { val callerClass = Type.getObjectType(classNode.name).className @@ -122,23 +108,19 @@ class UsagesIndexer(persistence: JcDatabasePersistence, private val location: Re } } } - names.forEach { - interner.findOrNew(it) - } + jooq.withoutAutoCommit { conn -> - interner.flush(conn) conn.runBatch(CALLS) { usages.forEach { (calleeClass, calleeEntry) -> - val calleeId = calleeClass.className.symbolId + val calleeId = calleeClass.className calleeEntry.forEach { (info, callers) -> val (calleeName, calleeDesc, opcode) = info callers.forEach { (caller, offsets) -> - val callerId = if (calleeClass == caller) calleeId else caller.symbolId - setLong(1, calleeId) - setLong(2, calleeName.symbolId) + setString(1, calleeId) + setString(2, calleeName) setNullableLong(3, calleeDesc?.longHash) setInt(4, opcode) - setLong(5, callerId) + setString(5, caller) setBytes(6, offsets.result()) setLong(7, location.id) addBatch() @@ -148,41 +130,38 @@ class UsagesIndexer(persistence: JcDatabasePersistence, private val location: Re } } } - - private inline val String.symbolId get() = interner.findOrNew(this) } object Usages : JcFeature { + fun create(jooq: DSLContext, drop: Boolean) { + if (drop) { + jooq.executeQueries("usages/drop-schema.sql".sqlScript()) + } + jooq.executeQueries("usages/create-schema.sql".sqlScript()) + } + override fun onSignal(signal: JcSignal) { val jcdb = signal.jcdb when (signal) { - is JcSignal.BeforeIndexing -> { - jcdb.persistence.write { - if (signal.clearOnStart) { - it.executeQueries(jcdb.persistence.getScript("usages/drop-schema.sql")) - } - it.executeQueries(jcdb.persistence.getScript("usages/create-schema.sql")) + is JcSignal.BeforeIndexing -> jcdb.persistence.write { + if (signal.clearOnStart) { + it.executeQueries("usages/drop-schema.sql".sqlScript()) } + it.executeQueries("usages/create-schema.sql".sqlScript()) } - is JcSignal.LocationRemoved -> { - jcdb.persistence.write { - it.deleteFrom(CALLS).where(CALLS.LOCATION_ID.eq(signal.location.id)).execute() - } + is JcSignal.LocationRemoved -> jcdb.persistence.write { + it.deleteFrom(CALLS).where(CALLS.LOCATION_ID.eq(signal.location.id)).execute() } - is JcSignal.AfterIndexing -> { - jcdb.persistence.write { - it.executeQueries(jcdb.persistence.getScript("usages/add-indexes.sql")) - } + is JcSignal.AfterIndexing -> jcdb.persistence.write { + it.executeQueries("usages/add-indexes.sql".sqlScript()) } - is JcSignal.Drop -> { - jcdb.persistence.write { - it.deleteFrom(CALLS).execute() - } + is JcSignal.Drop -> jcdb.persistence.write { + it.deleteFrom(CALLS).execute() } else -> Unit @@ -196,18 +175,19 @@ object Usages : JcFeature { fun syncQuery(classpath: JcClasspath, req: UsageFeatureRequest): Sequence { val locationIds = classpath.registeredLocations.map { it.id } val persistence = classpath.db.persistence - val name = (req.methodName ?: req.field).let { persistence.findSymbolId(it!!) } + val name = req.methodName ?: req.field val desc = req.description?.longHash - val className = req.className.map { persistence.findSymbolId(it) } + val className = req.className val calls = persistence.read { jooq -> jooq.select(CLASSES.ID, CALLS.CALLER_METHOD_OFFSETS, SYMBOLS.NAME, CLASSES.LOCATION_ID) .from(CALLS) .join(SYMBOLS).on(SYMBOLS.ID.eq(CLASSES.NAME)) - .join(CLASSES).on(CLASSES.NAME.eq(CALLS.CALLER_CLASS_SYMBOL_ID).and(CLASSES.LOCATION_ID.eq(CALLS.LOCATION_ID))) + .join(CLASSES) + .on(SYMBOLS.NAME.eq(CALLS.CALLER_CLASS_NAME).and(CLASSES.LOCATION_ID.eq(CALLS.LOCATION_ID))) .where( - CALLS.CALLEE_CLASS_SYMBOL_ID.`in`(className) - .and(CALLS.CALLEE_NAME_SYMBOL_ID.eq(name)) + CALLS.CALLEE_CLASS_NAME.`in`(className) + .and(CALLS.CALLEE_NAME.eq(name)) .and(CALLS.CALLEE_DESC_HASH.eqOrNull(desc)) .and(CALLS.OPCODE.`in`(req.opcodes)) .and(CALLS.LOCATION_ID.`in`(locationIds)) @@ -245,8 +225,7 @@ object Usages : JcFeature { } } - override fun newIndexer(jcdb: JcDatabase, location: RegisteredLocation) = UsagesIndexer(jcdb.persistence, location) - + override fun newIndexer(jcdb: JcDatabase, location: RegisteredLocation) = UsagesIndexer(location) private fun ByteArray.toShortArray(): ShortArray { val byteArray = this diff --git a/jacodb-core/src/main/kotlin/org/jacodb/impl/storage/JcRefactoring.kt b/jacodb-core/src/main/kotlin/org/jacodb/impl/storage/JcRefactoring.kt new file mode 100644 index 000000000..59716f905 --- /dev/null +++ b/jacodb-core/src/main/kotlin/org/jacodb/impl/storage/JcRefactoring.kt @@ -0,0 +1,87 @@ +/* + * Copyright 2022 UnitTestBot contributors (utbot.org) + *

+ * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.jacodb.impl.storage + +import mu.KLogging +import org.jacodb.impl.features.Builders +import org.jacodb.impl.features.Usages +import org.jacodb.impl.storage.jooq.tables.references.APPLICATIONMETADATA +import org.jacodb.impl.storage.jooq.tables.references.REFACTORINGS +import org.jooq.DSLContext +import kotlin.time.ExperimentalTime +import kotlin.time.measureTime + +abstract class JcRefactoring { + + val name: String = javaClass.name + + /** + * executed inside transaction + */ + abstract fun run(jooq: DSLContext) + +} + +class JcRefactoringChain(private val chain: List) { + + companion object : KLogging() + + private val applied = hashSetOf() + + @OptIn(ExperimentalTime::class) + fun execute(jooq: DSLContext) { + try { + applied.addAll(jooq.select(REFACTORINGS.NAME).from(REFACTORINGS).fetchArray(REFACTORINGS.NAME)) + } catch (e: Exception) { + logger.info("fail to fetch applied refactorings") + } + + chain.forEach { ref -> + jooq.connection { + if (!applied.contains(ref.name)) { + val time = measureTime { + ref.run(jooq) + jooq.insertInto(REFACTORINGS).set(REFACTORINGS.NAME, ref.name).execute() + } + logger.info("Refactoring ${ref.name} took $time msc") + } + } + } + } + +} + +class AddAppmetadataAndRefactoring : JcRefactoring() { + + override fun run(jooq: DSLContext) { + jooq.createTableIfNotExists(APPLICATIONMETADATA) + .column(APPLICATIONMETADATA.VERSION) + .execute() + + jooq.createTableIfNotExists(REFACTORINGS) + .column(REFACTORINGS.NAME) + .execute() + } +} + +class UpdateUsageAndBuildersSchemeRefactoring : JcRefactoring() { + + override fun run(jooq: DSLContext) { + Usages.create(jooq, true) + Builders.create(jooq, true) + } +} diff --git a/jacodb-core/src/main/kotlin/org/jacodb/impl/storage/PersistenceService.kt b/jacodb-core/src/main/kotlin/org/jacodb/impl/storage/PersistenceService.kt index 3c12fcafc..4ce029d71 100644 --- a/jacodb-core/src/main/kotlin/org/jacodb/impl/storage/PersistenceService.kt +++ b/jacodb-core/src/main/kotlin/org/jacodb/impl/storage/PersistenceService.kt @@ -16,42 +16,76 @@ package org.jacodb.impl.storage +import mu.KLogging import org.jacodb.api.JCDBSymbolsInterner import org.jacodb.api.RegisteredLocation -import org.jacodb.impl.storage.jooq.tables.references.ANNOTATIONS -import org.jacodb.impl.storage.jooq.tables.references.ANNOTATIONVALUES -import org.jacodb.impl.storage.jooq.tables.references.CLASSES -import org.jacodb.impl.storage.jooq.tables.references.CLASSHIERARCHIES -import org.jacodb.impl.storage.jooq.tables.references.CLASSINNERCLASSES -import org.jacodb.impl.storage.jooq.tables.references.FIELDS -import org.jacodb.impl.storage.jooq.tables.references.METHODPARAMETERS -import org.jacodb.impl.storage.jooq.tables.references.METHODS -import org.jacodb.impl.storage.jooq.tables.references.OUTERCLASSES -import org.jacodb.impl.storage.jooq.tables.references.SYMBOLS -import org.jacodb.impl.types.AnnotationInfo -import org.jacodb.impl.types.AnnotationValue -import org.jacodb.impl.types.AnnotationValueList -import org.jacodb.impl.types.ClassInfo -import org.jacodb.impl.types.ClassRef -import org.jacodb.impl.types.EnumRef -import org.jacodb.impl.types.FieldInfo -import org.jacodb.impl.types.MethodInfo -import org.jacodb.impl.types.ParameterInfo -import org.jacodb.impl.types.PrimitiveValue +import org.jacodb.impl.storage.jooq.tables.references.* +import org.jacodb.impl.types.* import org.jooq.DSLContext import org.jooq.TableField import java.io.Closeable import java.sql.Connection import java.sql.Types +import java.util.* import java.util.concurrent.ConcurrentHashMap import java.util.concurrent.atomic.AtomicLong import kotlin.collections.component1 import kotlin.collections.component2 import kotlin.collections.set +data class AppVersion(val major: Int, val minor: Int) : Comparable { + + companion object { + + val current: AppVersion + get() { + val clazz = PersistenceService::class.java + val pack = clazz.`package` + val version = pack.implementationVersion ?: Properties().also { + it.load(clazz.getResourceAsStream("/jacodb.properties")) + }.getProperty("jacodb.version") + val last = version.indexOfLast { it == '.' || it.isDigit() } + val clearVersion = version.substring(0, last + 1) + return parse(clearVersion) + } + + fun parse(version: String): AppVersion { + val ints = version.split(".") + return AppVersion(ints[0].toInt(), ints[1].toInt()) + } + } + + override fun compareTo(other: AppVersion): Int { + return when { + major > other.major -> 1 + major == other.major -> minor - other.minor + else -> -1 + } + } + + val presentation get() = "$major.$minor" + + override fun toString(): String { + return "[$major.$minor]" + } +} + class PersistenceService(private val persistence: AbstractJcDatabasePersistenceImpl) { - private val classIdGen = AtomicLong() + companion object : KLogging() + + private val refactorings = JcRefactoringChain( + listOf( + AddAppmetadataAndRefactoring(), + UpdateUsageAndBuildersSchemeRefactoring() + ) + ) + + private val currentAppVersion = AppVersion.current + + private lateinit var version: AppVersion + + val classIdGen = AtomicLong() private val symbolsIdGen = AtomicLong() private val methodIdGen = AtomicLong() private val fieldIdGen = AtomicLong() @@ -62,6 +96,15 @@ class PersistenceService(private val persistence: AbstractJcDatabasePersistenceI fun setup() { persistence.read { + logger.info("Starting app version $currentAppVersion") + version = try { + val appVersion = it.selectFrom(APPLICATIONMETADATA).fetch().first() + logger.info("Restored app version is ${appVersion.version}") + AppVersion.parse(appVersion.version!!) + } catch (e: Exception) { + logger.info("fail to restore app version. Use [1.3] as fallback") + AppVersion(1, 3) + } classIdGen.set(CLASSES.ID.maxId ?: 0) symbolsIdGen.set(SYMBOLS.ID.maxId ?: 0) methodIdGen.set(METHODS.ID.maxId ?: 0) @@ -71,6 +114,19 @@ class PersistenceService(private val persistence: AbstractJcDatabasePersistenceI annotationValueIdGen.set(ANNOTATIONVALUES.ID.maxId ?: 0) outerClassIdGen.set(OUTERCLASSES.ID.maxId ?: 0) } + when { + version > currentAppVersion -> throw IllegalStateException("Can't start $currentAppVersion on $version database") + version == currentAppVersion -> {} + else -> persistence.write { + refactorings.execute(it) + } + } + persistence.write { + it.deleteFrom(APPLICATIONMETADATA).execute() + it.insertInto(APPLICATIONMETADATA) + .set(APPLICATIONMETADATA.VERSION, currentAppVersion.presentation) + .execute() + } } fun persist(location: RegisteredLocation, classes: List) = synchronized(this) { diff --git a/jacodb-core/src/main/kotlin/org/jacodb/impl/storage/PostgresPersistenceImpl.kt b/jacodb-core/src/main/kotlin/org/jacodb/impl/storage/PostgresPersistenceImpl.kt deleted file mode 100644 index adf18f12f..000000000 --- a/jacodb-core/src/main/kotlin/org/jacodb/impl/storage/PostgresPersistenceImpl.kt +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright 2022 UnitTestBot contributors (utbot.org) - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.jacodb.impl.storage - -import com.zaxxer.hikari.HikariDataSource -import org.jacodb.impl.FeaturesRegistry -import org.jacodb.impl.fs.JavaRuntime -import org.jooq.DSLContext -import org.jooq.SQLDialect -import org.jooq.conf.Settings -import org.jooq.impl.DSL - -class PostgresPersistenceImpl( - javaRuntime: JavaRuntime, - featuresRegistry: FeaturesRegistry, - jcdbUrl: String? = null, - private val clearOnStart: Boolean -) : AbstractJcDatabasePersistenceImpl(javaRuntime, featuresRegistry, clearOnStart) { - - override val jooq: DSLContext - private val dataSource: HikariDataSource - - init { - dataSource = HikariDataSource().also { - it.maximumPoolSize = 20 - it.jdbcUrl = jcdbUrl - } - jooq = DSL.using(dataSource, SQLDialect.POSTGRES, Settings().withExecuteLogging(false)) - write { - if (clearOnStart) { - jooq.executeQueries(getScript("drop-schema.sql")) - } - jooq.executeQueries(getScript("create-schema.sql")) - } - } - - override fun close() { - super.close() - dataSource.close() - } - - override fun write(action: (DSLContext) -> T): T { - return action(jooq) - } - - override fun createIndexes() { - jooq.executeQueries("create-constraint-function.sql", asSingle = true) - jooq.executeQueries("add-indexes.sql") - } - - override fun getScript(name: String): String { - return javaClass.classLoader.getResourceAsStream("postgres/$name")?.reader()?.readText() - ?: throw IllegalStateException("no sql script for postgres/$name found") - } - -} \ No newline at end of file diff --git a/jacodb-core/src/main/kotlin/org/jacodb/impl/storage/SQLitePersistenceImpl.kt b/jacodb-core/src/main/kotlin/org/jacodb/impl/storage/SQLitePersistenceImpl.kt index eb5de19f0..4faa52327 100644 --- a/jacodb-core/src/main/kotlin/org/jacodb/impl/storage/SQLitePersistenceImpl.kt +++ b/jacodb-core/src/main/kotlin/org/jacodb/impl/storage/SQLitePersistenceImpl.kt @@ -102,12 +102,12 @@ class SQLitePersistenceImpl( } } - override fun getScript(name: String): String { - return javaClass.classLoader.getResourceAsStream("sqlite/$name")?.reader()?.readText() - ?: throw IllegalStateException("no sql script for sqlite/$name found") - } - override fun createIndexes() { - jooq.executeQueries(getScript("add-indexes.sql")) + jooq.executeQueries("add-indexes.sql".sqlScript()) } -} \ No newline at end of file +} + +fun String.sqlScript(): String { + return SQLitePersistenceImpl::class.java.classLoader.getResourceAsStream("sqlite/${this}")?.reader()?.readText() + ?: throw IllegalStateException("no sql script for sqlite/${this} found") +} diff --git a/jacodb-core/src/main/resources/jacodb.properties b/jacodb-core/src/main/resources/jacodb.properties new file mode 100644 index 000000000..3c4a1b5db --- /dev/null +++ b/jacodb-core/src/main/resources/jacodb.properties @@ -0,0 +1 @@ +jacodb.version=${version} \ No newline at end of file diff --git a/jacodb-core/src/main/resources/postgres/add-indexes.sql b/jacodb-core/src/main/resources/postgres/add-indexes.sql deleted file mode 100644 index 7144e5648..000000000 --- a/jacodb-core/src/main/resources/postgres/add-indexes.sql +++ /dev/null @@ -1,43 +0,0 @@ -SELECT CREATE_CONSTRAINT('Classes', 'fk_Classes_outer_method__id', 'ALTER TABLE "Classes" ADD CONSTRAINT "fk_Classes_outer_method__id" FOREIGN KEY ("outer_method") REFERENCES "Methods" (id) ON DELETE CASCADE ON UPDATE RESTRICT'); -SELECT CREATE_CONSTRAINT('Classes', 'fk_Classes_name__id', 'ALTER TABLE "Classes" ADD CONSTRAINT "fk_Classes_name__id" FOREIGN KEY ("name") REFERENCES "Symbols" ("id") ON DELETE RESTRICT ON UPDATE RESTRICT'); -SELECT CREATE_CONSTRAINT('Classes', 'fk_Classes_package_id__id', 'ALTER TABLE "Classes" ADD CONSTRAINT "fk_Classes_package_id__id" FOREIGN KEY ("package_id") REFERENCES "Symbols" ("id") ON DELETE CASCADE ON UPDATE RESTRICT'); -SELECT CREATE_CONSTRAINT('Classes', 'fk_Classes_location_id__id', 'ALTER TABLE "Classes" ADD CONSTRAINT "fk_Classes_location_id__id" FOREIGN KEY ("location_id") REFERENCES "BytecodeLocations" ("id") ON DELETE CASCADE ON UPDATE RESTRICT'); -SELECT CREATE_CONSTRAINT('Classes', 'fk_Classes_outer_class__id', 'ALTER TABLE "Classes" ADD CONSTRAINT "fk_Classes_outer_class__id" FOREIGN KEY ("outer_class") REFERENCES "OuterClasses" ("id") ON DELETE CASCADE ON UPDATE RESTRICT'); - -SELECT CREATE_CONSTRAINT('Methods', 'fk_Methods_class_id__id', 'ALTER TABLE "Methods" ADD CONSTRAINT "fk_Methods_class_id__id" FOREIGN KEY ("class_id") REFERENCES "Classes" ("id") ON DELETE CASCADE ON UPDATE RESTRICT'); -SELECT CREATE_CONSTRAINT('Methods', 'fk_Methods_name__id', 'ALTER TABLE "Methods" ADD CONSTRAINT "fk_Methods_name__id" FOREIGN KEY ("name") REFERENCES "Symbols" ("id") ON DELETE CASCADE ON UPDATE RESTRICT'); -SELECT CREATE_CONSTRAINT('Methods', 'fk_Methods_return_class__id', 'ALTER TABLE "Methods" ADD CONSTRAINT "fk_Methods_return_class__id" FOREIGN KEY ("return_class") REFERENCES "Symbols" ("id") ON DELETE CASCADE ON UPDATE RESTRICT'); - -SELECT CREATE_CONSTRAINT('ClassHierarchies', 'fk_ClassHierarchies_super_id__id', 'ALTER TABLE "ClassHierarchies" ADD CONSTRAINT "fk_ClassHierarchies_super_id__id" FOREIGN KEY ("super_id") REFERENCES "Symbols" ("id") ON DELETE CASCADE ON UPDATE RESTRICT'); -SELECT CREATE_CONSTRAINT('ClassHierarchies', 'fk_ClassHierarchies_class_id__id', 'ALTER TABLE "ClassHierarchies" ADD CONSTRAINT "fk_ClassHierarchies_class_id__id" FOREIGN KEY ("class_id") REFERENCES "Classes" ("id") ON DELETE CASCADE ON UPDATE RESTRICT'); - -SELECT CREATE_CONSTRAINT('OuterClasses', 'fk_OuterClasses_outer_class_name_id__id', 'ALTER TABLE "OuterClasses" ADD CONSTRAINT "fk_OuterClasses_outer_class_name_id__id" FOREIGN KEY ("outer_class_name_id") REFERENCES "Symbols" ("id") ON DELETE CASCADE ON UPDATE RESTRICT'); - -SELECT CREATE_CONSTRAINT('ClassInnerClasses', 'fk_ClassInnerClasses_inner_class_id__id', 'ALTER TABLE "ClassInnerClasses" ADD CONSTRAINT "fk_ClassInnerClasses_inner_class_id__id" FOREIGN KEY ("inner_class_id") REFERENCES "Symbols" ("id") ON DELETE CASCADE ON UPDATE RESTRICT'); -SELECT CREATE_CONSTRAINT('ClassInnerClasses', 'fk_ClassInnerClasses_class_id__id', 'ALTER TABLE "ClassInnerClasses" ADD CONSTRAINT "fk_ClassInnerClasses_class_id__id" FOREIGN KEY ("class_id") REFERENCES "Classes" ("id") ON DELETE CASCADE ON UPDATE RESTRICT'); - -SELECT CREATE_CONSTRAINT('MethodParameters', 'fk_MethodParameters_method_id__id', 'ALTER TABLE "MethodParameters" ADD CONSTRAINT "fk_MethodParameters_method_id__id" FOREIGN KEY ("method_id") REFERENCES "Methods" ("id") ON DELETE CASCADE ON UPDATE RESTRICT'); -SELECT CREATE_CONSTRAINT('MethodParameters', 'fk_MethodParameters_parameter_class__id', 'ALTER TABLE "MethodParameters" ADD CONSTRAINT "fk_MethodParameters_parameter_class__id" FOREIGN KEY ("parameter_class") REFERENCES "Symbols" ("id") ON DELETE CASCADE ON UPDATE RESTRICT'); - -SELECT CREATE_CONSTRAINT('Fields', 'fk_Fields_name__id', 'ALTER TABLE "Fields" ADD CONSTRAINT "fk_Fields_name__id" FOREIGN KEY ("name") REFERENCES "Symbols" ("id") ON DELETE CASCADE ON UPDATE RESTRICT'); -SELECT CREATE_CONSTRAINT('Fields', 'fk_Fields_field_class__id', 'ALTER TABLE "Fields" ADD CONSTRAINT "fk_Fields_field_class__id" FOREIGN KEY ("field_class") REFERENCES "Symbols" ("id") ON DELETE CASCADE ON UPDATE RESTRICT'); -SELECT CREATE_CONSTRAINT('Fields', 'fk_Fields_class_id__id', 'ALTER TABLE "Fields" ADD CONSTRAINT "fk_Fields_class_id__id" FOREIGN KEY ("class_id") REFERENCES "Classes" ("id") ON DELETE CASCADE ON UPDATE RESTRICT'); - -SELECT CREATE_CONSTRAINT('Annotations', 'fk_Annotations_param_id__id', 'ALTER TABLE "Annotations" ADD CONSTRAINT "fk_Annotations_param_id__id" FOREIGN KEY ("param_id") REFERENCES "MethodParameters" ("id") ON DELETE CASCADE ON UPDATE RESTRICT'); -SELECT CREATE_CONSTRAINT('Annotations', 'fk_Annotations_class_id__id', 'ALTER TABLE "Annotations" ADD CONSTRAINT "fk_Annotations_class_id__id" FOREIGN KEY ("class_id") REFERENCES "Classes" ("id") ON DELETE CASCADE ON UPDATE RESTRICT'); -SELECT CREATE_CONSTRAINT('Annotations', 'fk_Annotations_field_id__id', 'ALTER TABLE "Annotations" ADD CONSTRAINT "fk_Annotations_field_id__id" FOREIGN KEY ("field_id") REFERENCES "Fields" ("id") ON DELETE CASCADE ON UPDATE RESTRICT'); -SELECT CREATE_CONSTRAINT('Annotations', 'fk_Annotations_annotation_name__id', 'ALTER TABLE "Annotations" ADD CONSTRAINT "fk_Annotations_annotation_name__id" FOREIGN KEY ("annotation_name") REFERENCES "Symbols" ("id") ON DELETE CASCADE ON UPDATE RESTRICT'); -SELECT CREATE_CONSTRAINT('Annotations', 'fk_Annotations_method_id__id', 'ALTER TABLE "Annotations" ADD CONSTRAINT "fk_Annotations_method_id__id" FOREIGN KEY ("method_id") REFERENCES "Methods" ("id") ON DELETE CASCADE ON UPDATE RESTRICT'); -SELECT CREATE_CONSTRAINT('Annotations', 'fk_Annotations_parent_annotation__id', 'ALTER TABLE "Annotations" ADD CONSTRAINT "fk_Annotations_parent_annotation__id" FOREIGN KEY ("parent_annotation") REFERENCES "Annotations" ("id") ON DELETE CASCADE ON UPDATE RESTRICT'); - -SELECT CREATE_CONSTRAINT('AnnotationValues', 'fk_AnnotationValues_annotation_id__id', 'ALTER TABLE "AnnotationValues" ADD CONSTRAINT "fk_AnnotationValues_annotation_id__id" FOREIGN KEY ("annotation_id") REFERENCES "Annotations" ("id") ON DELETE CASCADE ON UPDATE RESTRICT'); -SELECT CREATE_CONSTRAINT('AnnotationValues', 'fk_AnnotationValues_enum_value__id', 'ALTER TABLE "AnnotationValues" ADD CONSTRAINT "fk_AnnotationValues_enum_value__id" FOREIGN KEY ("enum_value") REFERENCES "Symbols" ("id") ON DELETE CASCADE ON UPDATE RESTRICT'); -SELECT CREATE_CONSTRAINT('AnnotationValues', 'fk_AnnotationValues_ref_annotation_id__id', 'ALTER TABLE "AnnotationValues" ADD CONSTRAINT "fk_AnnotationValues_ref_annotation_id__id" FOREIGN KEY ("ref_annotation_id") REFERENCES "Annotations" ("id") ON DELETE CASCADE ON UPDATE RESTRICT'); -SELECT CREATE_CONSTRAINT('AnnotationValues', 'fk_AnnotationValues_class_symbol__id', 'ALTER TABLE "AnnotationValues" ADD CONSTRAINT "fk_AnnotationValues_class_symbol__id" FOREIGN KEY ("class_symbol") REFERENCES "Symbols" ("id") ON DELETE CASCADE ON UPDATE RESTRICT'); - -CREATE INDEX IF NOT EXISTS "Classes_name" ON "Classes" ("name"); -CREATE UNIQUE INDEX IF NOT EXISTS "Symbols_name" ON "Symbols" ("name"); -CREATE UNIQUE INDEX IF NOT EXISTS "Bytecodelocations_hash" ON "BytecodeLocations" ("uniqueId"); -CREATE UNIQUE INDEX IF NOT EXISTS "Methods_class_id_name_desc" ON "Methods" ("class_id", "name", "desc"); -CREATE UNIQUE INDEX IF NOT EXISTS "Fields_class_id_name" ON "Fields" ("class_id", "name"); -CREATE INDEX IF NOT EXISTS "Class Hierarchies" on "ClassHierarchies" ("super_id"); diff --git a/jacodb-core/src/main/resources/postgres/create-constraint-function.sql b/jacodb-core/src/main/resources/postgres/create-constraint-function.sql deleted file mode 100644 index 003d7e054..000000000 --- a/jacodb-core/src/main/resources/postgres/create-constraint-function.sql +++ /dev/null @@ -1,16 +0,0 @@ -CREATE OR REPLACE FUNCTION CREATE_CONSTRAINT( - t_name text, c_name text, constraint_sql text -) -returns void AS -$$ -BEGIN - IF NOT EXISTS ( - SELECT con.conname, rel.relname FROM pg_catalog.pg_constraint con - INNER JOIN pg_catalog.pg_class rel ON rel.oid = con.conrelid - INNER JOIN pg_catalog.pg_namespace nsp ON nsp.oid = connamespace - WHERE rel.relname = t_name and conname = c_name - ) THEN - execute constraint_sql; - END IF; -END; -$$ language 'plpgsql' \ No newline at end of file diff --git a/jacodb-core/src/main/resources/postgres/create-schema.sql b/jacodb-core/src/main/resources/postgres/create-schema.sql deleted file mode 100644 index 2f99ea1ff..000000000 --- a/jacodb-core/src/main/resources/postgres/create-schema.sql +++ /dev/null @@ -1,98 +0,0 @@ -CREATE UNLOGGED TABLE IF NOT EXISTS "BytecodeLocations"( - "id" BIGINT PRIMARY KEY, - "path" VARCHAR(1024) NOT NULL, - "uniqueId" VARCHAR(1024) NOT NULL, - "runtime" BOOLEAN NOT NULL DEFAULT false, - "state" INT NOT NULL DEFAULT 0, - "updated_id" BIGINT, - CONSTRAINT "fk_BytecodeLocations_updated_id__id" FOREIGN KEY ("updated_id") REFERENCES "BytecodeLocations" ("id") ON DELETE RESTRICT ON UPDATE RESTRICT -) WITH (autovacuum_enabled=false); - -CREATE UNLOGGED TABLE IF NOT EXISTS "Symbols"( - "id" BIGINT PRIMARY KEY, - "name" VARCHAR(256) NOT NULL -) WITH (autovacuum_enabled=false); - -CREATE UNLOGGED TABLE IF NOT EXISTS "OuterClasses"( - "id" BIGINT PRIMARY KEY, - "outer_class_name_id" BIGINT NOT NULL, - "name" VARCHAR(256), - "method_name" TEXT, - "method_desc" TEXT -) WITH (autovacuum_enabled=false); - -CREATE UNLOGGED TABLE IF NOT EXISTS "Classes"( - "id" BIGINT PRIMARY KEY, - "access" INT NOT NULL, - "name" BIGINT NOT NULL, - "signature" TEXT, - "bytecode" BYTEA NOT NULL, - "location_id" BIGINT NOT NULL, - "package_id" BIGINT NOT NULL, - "outer_class" BIGINT, - "outer_method" BIGINT -) WITH (autovacuum_enabled=false); - -CREATE UNLOGGED TABLE IF NOT EXISTS "Methods"( - "id" BIGINT PRIMARY KEY, - "access" INT NOT NULL, - "name" BIGINT NOT NULL, - "signature" TEXT, - "desc" TEXT, - "return_class" BIGINT, - "class_id" BIGINT NOT NULL -) WITH (autovacuum_enabled=false); - - -CREATE UNLOGGED TABLE IF NOT EXISTS "ClassHierarchies"( - "id" SERIAL PRIMARY KEY, - "class_id" BIGINT NOT NULL, - "super_id" BIGINT NOT NULL, - "is_class_ref" BOOLEAN NOT NULL -) WITH (autovacuum_enabled=false); - -CREATE UNLOGGED TABLE IF NOT EXISTS "ClassInnerClasses"( - "id" SERIAL PRIMARY KEY, - "class_id" BIGINT NOT NULL, - "inner_class_id" BIGINT NOT NULL -) WITH (autovacuum_enabled=false); - -CREATE UNLOGGED TABLE IF NOT EXISTS "MethodParameters"( - "id" BIGINT PRIMARY KEY, - "access" INT NOT NULL, - "index" INT NOT NULL, - "name" VARCHAR(256), - "parameter_class" BIGINT NOT NULL, - "method_id" BIGINT NOT NULL -) WITH (autovacuum_enabled=false); - -CREATE UNLOGGED TABLE IF NOT EXISTS "Fields"( - "id" BIGINT PRIMARY KEY, - "access" INT NOT NULL, - "name" BIGINT NOT NULL, - "signature" TEXT, - "field_class" BIGINT NOT NULL, - "class_id" BIGINT NOT NULL -) WITH (autovacuum_enabled=false); - -CREATE UNLOGGED TABLE IF NOT EXISTS "Annotations"( - "id" BIGINT PRIMARY KEY, - "annotation_name" BIGINT NOT NULL, - "visible" BOOLEAN NOT NULL, - "parent_annotation" BIGINT, - "class_id" BIGINT, - "method_id" BIGINT, - "field_id" BIGINT, - "param_id" BIGINT -) WITH (autovacuum_enabled=false); - -CREATE UNLOGGED TABLE IF NOT EXISTS "AnnotationValues"( - "id" BIGINT PRIMARY KEY, - "annotation_id" BIGINT NOT NULL, - "name" VARCHAR(256) NOT NULL, - "ref_annotation_id" BIGINT, - "kind" INT, - "value" TEXT, - "class_symbol" BIGINT, - "enum_value" BIGINT -) WITH (autovacuum_enabled=false); diff --git a/jacodb-core/src/main/resources/postgres/drop-schema.sql b/jacodb-core/src/main/resources/postgres/drop-schema.sql deleted file mode 100644 index b108fd442..000000000 --- a/jacodb-core/src/main/resources/postgres/drop-schema.sql +++ /dev/null @@ -1,16 +0,0 @@ -DROP TABLE IF EXISTS "BytecodeLocations" CASCADE; -DROP TABLE IF EXISTS "Symbols" CASCADE; -DROP TABLE IF EXISTS "OuterClasses" CASCADE; -DROP TABLE IF EXISTS "Methods" CASCADE; -DROP TABLE IF EXISTS "Classes" CASCADE; -DROP TABLE IF EXISTS "ClassHierarchies" CASCADE; -DROP TABLE IF EXISTS "ClassInnerClasses" CASCADE; -DROP TABLE IF EXISTS "MethodParameters" CASCADE; -DROP TABLE IF EXISTS "Fields" CASCADE; -DROP TABLE IF EXISTS "Annotations" CASCADE; -DROP TABLE IF EXISTS "AnnotationValues" CASCADE; -DROP INDEX IF EXISTS "Symbols_name"; -DROP INDEX IF EXISTS "Classes_name"; -DROP INDEX IF EXISTS "Methods_class_id_name_desc"; -DROP INDEX IF EXISTS "Fields_class_id_name"; -DROP INDEX IF EXISTS "Class Hierarchies"; diff --git a/jacodb-core/src/main/resources/postgres/usages/add-indexes.sql b/jacodb-core/src/main/resources/postgres/usages/add-indexes.sql deleted file mode 100644 index 0b20fea59..000000000 --- a/jacodb-core/src/main/resources/postgres/usages/add-indexes.sql +++ /dev/null @@ -1,4 +0,0 @@ -SELECT CREATE_CONSTRAINT('Calls', 'fk_callee_class_symbol_id', 'ALTER TABLE "Calls" ADD CONSTRAINT "fk_callee_class_symbol_id" FOREIGN KEY ("callee_class_symbol_id") REFERENCES "Symbols" ("id") ON DELETE CASCADE'); -SELECT CREATE_CONSTRAINT('Calls', 'fk_location_id', 'ALTER TABLE "Calls" ADD CONSTRAINT "fk_location_id" FOREIGN KEY ("location_id") REFERENCES "BytecodeLocations" ("id") ON DELETE CASCADE ON UPDATE RESTRICT'); - -CREATE INDEX IF NOT EXISTS "CallsSearch" ON "Calls"(opcode, location_id, callee_class_symbol_id, callee_name_symbol_id, callee_desc_hash) diff --git a/jacodb-core/src/main/resources/postgres/usages/create-schema.sql b/jacodb-core/src/main/resources/postgres/usages/create-schema.sql deleted file mode 100644 index 19521947c..000000000 --- a/jacodb-core/src/main/resources/postgres/usages/create-schema.sql +++ /dev/null @@ -1,9 +0,0 @@ -CREATE UNLOGGED TABLE IF NOT EXISTS "Calls"( - "callee_class_symbol_id" BIGINT NOT NULL, - "callee_name_symbol_id" BIGINT NOT NULL, - "callee_desc_hash" BIGINT, - "opcode" INTEGER, - "caller_class_symbol_id" BIGINT NOT NULL, - "caller_method_offsets" BYTEA, - "location_id" BIGINT NOT NULL -) WITH (autovacuum_enabled=false); \ No newline at end of file diff --git a/jacodb-core/src/main/resources/postgres/usages/drop-schema.sql b/jacodb-core/src/main/resources/postgres/usages/drop-schema.sql deleted file mode 100644 index 8c8897911..000000000 --- a/jacodb-core/src/main/resources/postgres/usages/drop-schema.sql +++ /dev/null @@ -1,2 +0,0 @@ -DROP TABLE IF EXISTS "Calls" CASCADE; -DROP INDEX IF EXISTS "CallsSearch"; \ No newline at end of file diff --git a/jacodb-core/src/main/resources/sqlite/create-schema.sql b/jacodb-core/src/main/resources/sqlite/create-schema.sql index 128b12f2f..3b4243d07 100644 --- a/jacodb-core/src/main/resources/sqlite/create-schema.sql +++ b/jacodb-core/src/main/resources/sqlite/create-schema.sql @@ -1,3 +1,11 @@ +CREATE TABLE IF NOT EXISTS "Applicationmetadata"( + version VARCHAR(64) +); + +CREATE TABLE IF NOT EXISTS "Refactorings"( + name VARCHAR(64) +); + CREATE TABLE IF NOT EXISTS "BytecodeLocations"( "id" BIGINT PRIMARY KEY, "path" VARCHAR(1024) NOT NULL, diff --git a/jacodb-core/src/main/resources/sqlite/empty.db b/jacodb-core/src/main/resources/sqlite/empty.db new file mode 100644 index 000000000..3c0cc7a20 Binary files /dev/null and b/jacodb-core/src/main/resources/sqlite/empty.db differ diff --git a/jacodb-core/src/main/resources/sqlite/usages/add-indexes.sql b/jacodb-core/src/main/resources/sqlite/usages/add-indexes.sql index 64c563e42..d67d458ca 100644 --- a/jacodb-core/src/main/resources/sqlite/usages/add-indexes.sql +++ b/jacodb-core/src/main/resources/sqlite/usages/add-indexes.sql @@ -1 +1 @@ -CREATE INDEX IF NOT EXISTS 'CallsSearch' ON Calls(opcode, location_id, callee_class_symbol_id, callee_name_symbol_id, callee_desc_hash); +CREATE INDEX IF NOT EXISTS 'CallsSearch' ON Calls(opcode, location_id, callee_class_name, callee_name, callee_desc_hash); diff --git a/jacodb-core/src/main/resources/sqlite/usages/create-schema.sql b/jacodb-core/src/main/resources/sqlite/usages/create-schema.sql index 786aac945..85f86e603 100644 --- a/jacodb-core/src/main/resources/sqlite/usages/create-schema.sql +++ b/jacodb-core/src/main/resources/sqlite/usages/create-schema.sql @@ -1,11 +1,10 @@ CREATE TABLE IF NOT EXISTS "Calls"( - "callee_class_symbol_id" BIGINT NOT NULL, - "callee_name_symbol_id" BIGINT NOT NULL, + "callee_class_name" VARCHAR(256) NOT NULL, + "callee_name" VARCHAR(256) NOT NULL, "callee_desc_hash" BIGINT, "opcode" INTEGER, - "caller_class_symbol_id" BIGINT NOT NULL, + "caller_class_name" VARCHAR(256) NOT NULL, "caller_method_offsets" BLOB, "location_id" BIGINT NOT NULL, - CONSTRAINT "fk_callee_class_symbol_id" FOREIGN KEY ("callee_class_symbol_id") REFERENCES "Symbols" ("id") ON DELETE CASCADE, CONSTRAINT "fk_location_id" FOREIGN KEY ("location_id") REFERENCES "BytecodeLocations" ("id") ON DELETE CASCADE ON UPDATE RESTRICT ); \ No newline at end of file