Skip to content

Commit

Permalink
⬆️ Upgrade CPG - adapt to changes in overflowdb-codegen (#67)
Browse files Browse the repository at this point in the history
* Upgrade CPG - adapt to changes in overflowdb-codegen

* Refactored test methods

* Added new control structure property

Co-authored-by: David Baker Effendi <[email protected]>
  • Loading branch information
fabsx00 and DavidBakerEffendi authored Feb 12, 2021
1 parent 3b014e4 commit 7ee7f37
Show file tree
Hide file tree
Showing 14 changed files with 415 additions and 413 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jgVersion=0.5.3
neo4jDriverVersion=4.2.0
khttpVersion=1.0.0
jacksonVersion=2.12.0
shiftleftVersion=1.3.62
shiftleftVersion=1.3.67
sootVersion=4.2.1
lz4Version=1.7.1

Expand Down
4 changes: 2 additions & 2 deletions plume/src/main/kotlin/io/github/plume/oss/Extractor.kt
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ class Extractor(val driver: IDriver) {
}
// Connect type decls to their modifiers
obtainModifiersFromTypeDeclVert(t).forEachIndexed { i, m ->
driver.addEdge(t, NewModifierBuilder().modifiertype(m).order(i + 1), AST)
driver.addEdge(t, NewModifierBuilder().modifierType(m).order(i + 1), AST)
}
}
}
Expand Down Expand Up @@ -397,7 +397,7 @@ class Extractor(val driver: IDriver) {
val typeDecl = buildTypeDeclaration(cls.type, false)
driver.addEdge(typeDecl, file, SOURCE_FILE)
determineModifiers(cls.modifiers)
.mapIndexed { i, m -> NewModifierBuilder().modifiertype(m).order(i + 1) }
.mapIndexed { i, m -> NewModifierBuilder().modifierType(m).order(i + 1) }
.forEach { driver.addEdge(typeDecl, it, AST) }
addSootToPlumeAssociation(cls, typeDecl)
cls.fields.forEachIndexed { i, field ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,49 +59,49 @@ object VertexMapper {
.order(map["ORDER"] as Int)
.id(map["id"] as Long)
Method.Label() -> NewMethodBuilder()
.astparentfullname(map["AST_PARENT_FULL_NAME"] as String)
.astparenttype(map["AST_PARENT_TYPE"] as String)
.astParentFullName(map["AST_PARENT_FULL_NAME"] as String)
.astParentType(map["AST_PARENT_TYPE"] as String)
.name(map["NAME"] as String)
.code(map["CODE"] as String)
.fullname(map["FULL_NAME"] as String)
.fullName(map["FULL_NAME"] as String)
.signature(map["SIGNATURE"] as String)
.linenumber(Option.apply(map["LINE_NUMBER"] as Int))
.columnnumber(Option.apply(map["COLUMN_NUMBER"] as Int))
.lineNumber(Option.apply(map["LINE_NUMBER"] as Int))
.columnNumber(Option.apply(map["COLUMN_NUMBER"] as Int))
.order(map["ORDER"] as Int)
.id(map["id"] as Long)
MethodParameterIn.Label() -> NewMethodParameterInBuilder()
.code(map["CODE"] as String)
.name(map["NAME"] as String)
.evaluationstrategy(map["EVALUATION_STRATEGY"] as String)
.typefullname(map["TYPE_FULL_NAME"] as String)
.linenumber(Option.apply(map["LINE_NUMBER"] as Int))
.columnnumber(Option.apply(map["COLUMN_NUMBER"] as Int))
.evaluationStrategy(map["EVALUATION_STRATEGY"] as String)
.typeFullName(map["TYPE_FULL_NAME"] as String)
.lineNumber(Option.apply(map["LINE_NUMBER"] as Int))
.columnNumber(Option.apply(map["COLUMN_NUMBER"] as Int))
.order(map["ORDER"] as Int)
.id(map["id"] as Long)
MethodReturn.Label() -> NewMethodReturnBuilder()
.code(map["CODE"] as String)
.evaluationstrategy(map["EVALUATION_STRATEGY"] as String)
.typefullname(map["TYPE_FULL_NAME"] as String)
.linenumber(Option.apply(map["LINE_NUMBER"] as Int))
.columnnumber(Option.apply(map["COLUMN_NUMBER"] as Int))
.evaluationStrategy(map["EVALUATION_STRATEGY"] as String)
.typeFullName(map["TYPE_FULL_NAME"] as String)
.lineNumber(Option.apply(map["LINE_NUMBER"] as Int))
.columnNumber(Option.apply(map["COLUMN_NUMBER"] as Int))
.order(map["ORDER"] as Int)
.id(map["id"] as Long)
Modifier.Label() -> NewModifierBuilder()
.modifiertype(map["MODIFIER_TYPE"] as String)
.modifierType(map["MODIFIER_TYPE"] as String)
.order(map["ORDER"] as Int)
.id(map["id"] as Long)
Type.Label() -> NewTypeBuilder()
.name(map["NAME"] as String)
.fullname(map["FULL_NAME"] as String)
.typedeclfullname(map["TYPE_DECL_FULL_NAME"] as String)
.fullName(map["FULL_NAME"] as String)
.typeDeclFullName(map["TYPE_DECL_FULL_NAME"] as String)
.id(map["id"] as Long)
TypeDecl.Label() -> NewTypeDeclBuilder()
.astparentfullname(map["AST_PARENT_FULL_NAME"] as String)
.astparenttype(map["AST_PARENT_TYPE"] as String)
.astParentFullName(map["AST_PARENT_FULL_NAME"] as String)
.astParentType(map["AST_PARENT_TYPE"] as String)
.name(map["NAME"] as String)
.fullname(map["FULL_NAME"] as String)
.fullName(map["FULL_NAME"] as String)
.order(map["ORDER"] as Int)
.isexternal(map["IS_EXTERNAL"] as Boolean)
.isExternal(map["IS_EXTERNAL"] as Boolean)
.id(map["id"] as Long)
TypeParameter.Label() -> NewTypeParameterBuilder()
.name(map["NAME"] as String)
Expand All @@ -111,37 +111,37 @@ object VertexMapper {
.order(map["ORDER"] as Int)
.id(map["id"] as Long)
Member.Label() -> NewMemberBuilder()
.typefullname(map["TYPE_FULL_NAME"] as String)
.typeFullName(map["TYPE_FULL_NAME"] as String)
.code(map["CODE"] as String)
.name(map["NAME"] as String)
.order(map["ORDER"] as Int)
.id(map["id"] as Long)
NamespaceBlock.Label() -> NewNamespaceBlockBuilder()
.fullname(map["FULL_NAME"] as String)
.fullName(map["FULL_NAME"] as String)
.filename(map["FILENAME"] as String)
.name(map["NAME"] as String)
.order(map["ORDER"] as Int)
.id(map["id"] as Long)
Literal.Label() -> NewLiteralBuilder()
.typefullname(map["TYPE_FULL_NAME"] as String)
.typeFullName(map["TYPE_FULL_NAME"] as String)
.code(map["CODE"] as String)
.order(map["ORDER"] as Int)
.linenumber(Option.apply(map["LINE_NUMBER"] as Int))
.columnnumber(Option.apply(map["COLUMN_NUMBER"] as Int))
.argumentindex(map["ARGUMENT_INDEX"] as Int)
.lineNumber(Option.apply(map["LINE_NUMBER"] as Int))
.columnNumber(Option.apply(map["COLUMN_NUMBER"] as Int))
.argumentIndex(map["ARGUMENT_INDEX"] as Int)
.id(map["id"] as Long)
Call.Label() -> NewCallBuilder()
.typefullname(map["TYPE_FULL_NAME"] as String)
.typeFullName(map["TYPE_FULL_NAME"] as String)
.code(map["CODE"] as String)
.name(map["NAME"] as String)
.order(map["ORDER"] as Int)
.linenumber(Option.apply(map["LINE_NUMBER"] as Int))
.columnnumber(Option.apply(map["COLUMN_NUMBER"] as Int))
.argumentindex(map["ARGUMENT_INDEX"] as Int)
.lineNumber(Option.apply(map["LINE_NUMBER"] as Int))
.columnNumber(Option.apply(map["COLUMN_NUMBER"] as Int))
.argumentIndex(map["ARGUMENT_INDEX"] as Int)
.signature(map["SIGNATURE"] as String)
.dispatchtype(map["DISPATCH_TYPE"] as String)
.methodfullname(map["METHOD_FULL_NAME"] as String)
.dynamictypehintfullname(
.dispatchType(map["DISPATCH_TYPE"] as String)
.methodFullName(map["METHOD_FULL_NAME"] as String)
.dynamicTypeHintFullName(
when (map["DYNAMIC_TYPE_HINT_FULL_NAME"]) {
is String -> createScalaList(map["DYNAMIC_TYPE_HINT_FULL_NAME"] as String)
is `$colon$colon`<*> -> createScalaList((map["DYNAMIC_TYPE_HINT_FULL_NAME"] as `$colon$colon`<*>).head() as String)
Expand All @@ -150,57 +150,57 @@ object VertexMapper {
)
.id(map["id"] as Long)
Local.Label() -> NewLocalBuilder()
.typefullname(map["TYPE_FULL_NAME"] as String)
.typeFullName(map["TYPE_FULL_NAME"] as String)
.code(map["CODE"] as String)
.name(map["NAME"] as String)
.order(map["ORDER"] as Int)
.linenumber(Option.apply(map["LINE_NUMBER"] as Int))
.columnnumber(Option.apply(map["COLUMN_NUMBER"] as Int))
.lineNumber(Option.apply(map["LINE_NUMBER"] as Int))
.columnNumber(Option.apply(map["COLUMN_NUMBER"] as Int))
.id(map["id"] as Long)
Identifier.Label() -> NewIdentifierBuilder()
.typefullname(map["TYPE_FULL_NAME"] as String)
.typeFullName(map["TYPE_FULL_NAME"] as String)
.code(map["CODE"] as String)
.name(map["NAME"] as String)
.order(map["ORDER"] as Int)
.linenumber(Option.apply(map["LINE_NUMBER"] as Int))
.columnnumber(Option.apply(map["COLUMN_NUMBER"] as Int))
.argumentindex(map["ARGUMENT_INDEX"] as Int)
.lineNumber(Option.apply(map["LINE_NUMBER"] as Int))
.columnNumber(Option.apply(map["COLUMN_NUMBER"] as Int))
.argumentIndex(map["ARGUMENT_INDEX"] as Int)
.id(map["id"] as Long)
FieldIdentifier.Label() -> NewFieldIdentifierBuilder()
.canonicalname(map["CANONICAL_NAME"] as String)
.canonicalName(map["CANONICAL_NAME"] as String)
.code(map["CODE"] as String)
.order(map["ORDER"] as Int)
.linenumber(Option.apply(map["LINE_NUMBER"] as Int))
.columnnumber(Option.apply(map["COLUMN_NUMBER"] as Int))
.argumentindex(map["ARGUMENT_INDEX"] as Int)
.lineNumber(Option.apply(map["LINE_NUMBER"] as Int))
.columnNumber(Option.apply(map["COLUMN_NUMBER"] as Int))
.argumentIndex(map["ARGUMENT_INDEX"] as Int)
.id(map["id"] as Long)
Return.Label() -> NewReturnBuilder()
.code(map["CODE"] as String)
.order(map["ORDER"] as Int)
.linenumber(Option.apply(map["LINE_NUMBER"] as Int))
.columnnumber(Option.apply(map["COLUMN_NUMBER"] as Int))
.argumentindex(map["ARGUMENT_INDEX"] as Int)
.lineNumber(Option.apply(map["LINE_NUMBER"] as Int))
.columnNumber(Option.apply(map["COLUMN_NUMBER"] as Int))
.argumentIndex(map["ARGUMENT_INDEX"] as Int)
.id(map["id"] as Long)
Block.Label() -> NewBlockBuilder()
.typefullname(map["TYPE_FULL_NAME"] as String)
.typeFullName(map["TYPE_FULL_NAME"] as String)
.code(map["CODE"] as String)
.order(map["ORDER"] as Int)
.linenumber(Option.apply(map["LINE_NUMBER"] as Int))
.columnnumber(Option.apply(map["COLUMN_NUMBER"] as Int))
.argumentindex(map["ARGUMENT_INDEX"] as Int)
.lineNumber(Option.apply(map["LINE_NUMBER"] as Int))
.columnNumber(Option.apply(map["COLUMN_NUMBER"] as Int))
.argumentIndex(map["ARGUMENT_INDEX"] as Int)
.id(map["id"] as Long)
MethodRef.Label() -> NewMethodRefBuilder()
.code(map["CODE"] as String)
.order(map["ORDER"] as Int)
.methodfullname(map["METHOD_FULL_NAME"] as String)
.methodinstfullname(Option.apply(map["METHOD_INST_FULL_NAME"] as String))
.linenumber(Option.apply(map["LINE_NUMBER"] as Int))
.columnnumber(Option.apply(map["COLUMN_NUMBER"] as Int))
.argumentindex(map["ARGUMENT_INDEX"] as Int)
.methodFullName(map["METHOD_FULL_NAME"] as String)
.methodInstFullName(Option.apply(map["METHOD_INST_FULL_NAME"] as String))
.lineNumber(Option.apply(map["LINE_NUMBER"] as Int))
.columnNumber(Option.apply(map["COLUMN_NUMBER"] as Int))
.argumentIndex(map["ARGUMENT_INDEX"] as Int)
.id(map["id"] as Long)
TypeRef.Label() -> NewTypeRefBuilder()
.typefullname(map["TYPE_FULL_NAME"] as String)
.dynamictypehintfullname(
.typeFullName(map["TYPE_FULL_NAME"] as String)
.dynamicTypeHintFullName(
when (map["DYNAMIC_TYPE_HINT_FULL_NAME"]) {
is String -> createScalaList(map["DYNAMIC_TYPE_HINT_FULL_NAME"] as String)
is `$colon$colon`<*> -> createScalaList((map["DYNAMIC_TYPE_HINT_FULL_NAME"] as `$colon$colon`<*>).head() as String)
Expand All @@ -209,32 +209,32 @@ object VertexMapper {
)
.code(map["CODE"] as String)
.order(map["ORDER"] as Int)
.linenumber(Option.apply(map["LINE_NUMBER"] as Int))
.columnnumber(Option.apply(map["COLUMN_NUMBER"] as Int))
.argumentindex(map["ARGUMENT_INDEX"] as Int)
.lineNumber(Option.apply(map["LINE_NUMBER"] as Int))
.columnNumber(Option.apply(map["COLUMN_NUMBER"] as Int))
.argumentIndex(map["ARGUMENT_INDEX"] as Int)
.id(map["id"] as Long)
JumpTarget.Label() -> NewJumpTargetBuilder()
.code(map["CODE"] as String)
.order(map["ORDER"] as Int)
.linenumber(Option.apply(map["LINE_NUMBER"] as Int))
.columnnumber(Option.apply(map["COLUMN_NUMBER"] as Int))
.argumentindex(map["ARGUMENT_INDEX"] as Int)
.lineNumber(Option.apply(map["LINE_NUMBER"] as Int))
.columnNumber(Option.apply(map["COLUMN_NUMBER"] as Int))
.argumentIndex(map["ARGUMENT_INDEX"] as Int)
.name(map["NAME"] as String)
.id(map["id"] as Long)
ControlStructure.Label() -> NewControlStructureBuilder()
.code(map["CODE"] as String)
.order(map["ORDER"] as Int)
.linenumber(Option.apply(map["LINE_NUMBER"] as Int))
.columnnumber(Option.apply(map["COLUMN_NUMBER"] as Int))
.argumentindex(map["ARGUMENT_INDEX"] as Int)
.lineNumber(Option.apply(map["LINE_NUMBER"] as Int))
.columnNumber(Option.apply(map["COLUMN_NUMBER"] as Int))
.argumentIndex(map["ARGUMENT_INDEX"] as Int)
.id(map["id"] as Long)
else -> NewUnknownBuilder()
.code(map["CODE"] as String)
.order(map["ORDER"] as Int)
.argumentindex(map["ARGUMENT_INDEX"] as Int)
.typefullname(map["TYPE_FULL_NAME"] as String)
.linenumber(Option.apply(map["LINE_NUMBER"] as Int))
.columnnumber(Option.apply(map["COLUMN_NUMBER"] as Int))
.argumentIndex(map["ARGUMENT_INDEX"] as Int)
.typeFullName(map["TYPE_FULL_NAME"] as String)
.lineNumber(Option.apply(map["LINE_NUMBER"] as Int))
.columnNumber(Option.apply(map["COLUMN_NUMBER"] as Int))
.id(map["id"] as Long)
}
}
Expand Down
Loading

0 comments on commit 7ee7f37

Please sign in to comment.