Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update ODB Codegen to v2.100 #1725

Merged
merged 2 commits into from
Aug 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name := "codepropertygraph"

// parsed by project/Versions.scala, updated by updateDependencies.sh
val overflowdbVersion = "1.180"
val overflowdbCodegenVersion = "2.99"
val overflowdbCodegenVersion = "2.100"

inThisBuild(
List(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ runtime as it may depend on the type of an object (as is the case for virtual me
calls) or calculation of an offset. */
public static final overflowdb.PropertyKey<String> DISPATCH_TYPE = new overflowdb.PropertyKey<>("DISPATCH_TYPE");

/** Type hint for the dynamic type */
/** Type hint for the dynamic type. These are observed to be verifiable at runtime. */
public static final overflowdb.PropertyKey<scala.collection.IndexedSeq<String>> DYNAMIC_TYPE_HINT_FULL_NAME = new overflowdb.PropertyKey<>("DYNAMIC_TYPE_HINT_FULL_NAME");

/** For formal method input parameters, output parameters, and return parameters,
Expand Down Expand Up @@ -219,6 +219,9 @@ it is referenced but not defined in the code (applies both to insular
/** AST node type name emitted by parser. */
public static final overflowdb.PropertyKey<String> PARSER_TYPE_NAME = new overflowdb.PropertyKey<>("PARSER_TYPE_NAME");

/** Similar to `DYNAMIC_TYPE_HINT_FULL_NAME`, but that this makes no guarantee that types within this property are correct. This property is used to capture observations between node interactions during a 'may-analysis'. */
public static final overflowdb.PropertyKey<scala.collection.IndexedSeq<String>> POSSIBLE_TYPES = new overflowdb.PropertyKey<>("POSSIBLE_TYPES");

/** The path to the root directory of the source/binary this CPG is generated from. */
public static final overflowdb.PropertyKey<String> ROOT = new overflowdb.PropertyKey<>("ROOT");

Expand Down Expand Up @@ -301,6 +304,7 @@ it is referenced but not defined in the code (applies both to insular
add(OVERLAYS);
add(PACKAGE_NAME);
add(PARSER_TYPE_NAME);
add(POSSIBLE_TYPES);
add(ROOT);
add(SIGNATURE);
add(SYMBOL);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ runtime as it may depend on the type of an object (as is the case for virtual me
calls) or calculation of an offset. */
public static final String DISPATCH_TYPE = "DISPATCH_TYPE";

/** Type hint for the dynamic type */
/** Type hint for the dynamic type. These are observed to be verifiable at runtime. */
public static final String DYNAMIC_TYPE_HINT_FULL_NAME = "DYNAMIC_TYPE_HINT_FULL_NAME";

/** For formal method input parameters, output parameters, and return parameters,
Expand Down Expand Up @@ -219,6 +219,9 @@ it is referenced but not defined in the code (applies both to insular
/** AST node type name emitted by parser. */
public static final String PARSER_TYPE_NAME = "PARSER_TYPE_NAME";

/** Similar to `DYNAMIC_TYPE_HINT_FULL_NAME`, but that this makes no guarantee that types within this property are correct. This property is used to capture observations between node interactions during a 'may-analysis'. */
public static final String POSSIBLE_TYPES = "POSSIBLE_TYPES";

/** The path to the root directory of the source/binary this CPG is generated from. */
public static final String ROOT = "ROOT";

Expand Down Expand Up @@ -301,6 +304,7 @@ it is referenced but not defined in the code (applies both to insular
add(OVERLAYS);
add(PACKAGE_NAME);
add(PARSER_TYPE_NAME);
add(POSSIBLE_TYPES);
add(ROOT);
add(SIGNATURE);
add(SYMBOL);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,19 @@ object Block {
val DynamicTypeHintFullName = "DYNAMIC_TYPE_HINT_FULL_NAME"
val LineNumber = "LINE_NUMBER"
val Order = "ORDER"
val PossibleTypes = "POSSIBLE_TYPES"
val TypeFullName = "TYPE_FULL_NAME"
val all: Set[String] =
Set(ArgumentIndex, ArgumentName, Code, ColumnNumber, DynamicTypeHintFullName, LineNumber, Order, TypeFullName)
val all: Set[String] = Set(
ArgumentIndex,
ArgumentName,
Code,
ColumnNumber,
DynamicTypeHintFullName,
LineNumber,
Order,
PossibleTypes,
TypeFullName
)
val allAsJava: java.util.Set[String] = all.asJava
}

Expand All @@ -30,6 +40,7 @@ object Block {
val DynamicTypeHintFullName = new overflowdb.PropertyKey[IndexedSeq[String]]("DYNAMIC_TYPE_HINT_FULL_NAME")
val LineNumber = new overflowdb.PropertyKey[Integer]("LINE_NUMBER")
val Order = new overflowdb.PropertyKey[scala.Int]("ORDER")
val PossibleTypes = new overflowdb.PropertyKey[IndexedSeq[String]]("POSSIBLE_TYPES")
val TypeFullName = new overflowdb.PropertyKey[String]("TYPE_FULL_NAME")

}
Expand Down Expand Up @@ -106,6 +117,7 @@ trait BlockBase extends AbstractNode with ExpressionBase {
def dynamicTypeHintFullName: IndexedSeq[String]
def lineNumber: Option[Integer]
def order: scala.Int
def possibleTypes: IndexedSeq[String]
def typeFullName: String

}
Expand All @@ -122,6 +134,7 @@ class Block(graph_4762: Graph, id_4762: Long /*cf https://github.com/scala/bug/i
override def dynamicTypeHintFullName: IndexedSeq[String] = get().dynamicTypeHintFullName
override def lineNumber: Option[Integer] = get().lineNumber
override def order: scala.Int = get().order
override def possibleTypes: IndexedSeq[String] = get().possibleTypes
override def typeFullName: String = get().typeFullName
override def propertyDefaultValue(propertyKey: String) =
propertyKey match {
Expand Down Expand Up @@ -652,7 +665,8 @@ class Block(graph_4762: Graph, id_4762: Long /*cf https://github.com/scala/bug/i
case 5 => "dynamicTypeHintFullName"
case 6 => "lineNumber"
case 7 => "order"
case 8 => "typeFullName"
case 8 => "possibleTypes"
case 9 => "typeFullName"
}

override def productElement(n: Int): Any =
Expand All @@ -665,11 +679,12 @@ class Block(graph_4762: Graph, id_4762: Long /*cf https://github.com/scala/bug/i
case 5 => dynamicTypeHintFullName
case 6 => lineNumber
case 7 => order
case 8 => typeFullName
case 8 => possibleTypes
case 9 => typeFullName
}

override def productPrefix = "Block"
override def productArity = 9
override def productArity = 10
}

class BlockDb(ref: NodeRef[NodeDb]) extends NodeDb(ref) with StoredNode with Expression with BlockBase {
Expand All @@ -690,6 +705,8 @@ class BlockDb(ref: NodeRef[NodeDb]) extends NodeDb(ref) with StoredNode with Exp
def lineNumber: Option[Integer] = Option(_lineNumber)
private var _order: scala.Int = Block.PropertyDefaults.Order
def order: scala.Int = _order
private var _possibleTypes: IndexedSeq[String] = collection.immutable.ArraySeq.empty
def possibleTypes: IndexedSeq[String] = _possibleTypes
private var _typeFullName: String = Block.PropertyDefaults.TypeFullName
def typeFullName: String = _typeFullName

Expand All @@ -705,6 +722,7 @@ class BlockDb(ref: NodeRef[NodeDb]) extends NodeDb(ref) with StoredNode with Exp
}
lineNumber.map { value => properties.put("LINE_NUMBER", value) }
properties.put("ORDER", order)
if (this._possibleTypes != null && this._possibleTypes.nonEmpty) { properties.put("POSSIBLE_TYPES", possibleTypes) }
properties.put("TYPE_FULL_NAME", typeFullName)

properties
Expand All @@ -722,6 +740,7 @@ class BlockDb(ref: NodeRef[NodeDb]) extends NodeDb(ref) with StoredNode with Exp
}
lineNumber.map { value => properties.put("LINE_NUMBER", value) }
if (!((-1: Int) == order)) { properties.put("ORDER", order) }
if (this._possibleTypes != null && this._possibleTypes.nonEmpty) { properties.put("POSSIBLE_TYPES", possibleTypes) }
if (!(("<empty>") == typeFullName)) { properties.put("TYPE_FULL_NAME", typeFullName) }

properties
Expand Down Expand Up @@ -930,7 +949,8 @@ class BlockDb(ref: NodeRef[NodeDb]) extends NodeDb(ref) with StoredNode with Exp
case 5 => "dynamicTypeHintFullName"
case 6 => "lineNumber"
case 7 => "order"
case 8 => "typeFullName"
case 8 => "possibleTypes"
case 9 => "typeFullName"
}

override def productElement(n: Int): Any =
Expand All @@ -943,11 +963,12 @@ class BlockDb(ref: NodeRef[NodeDb]) extends NodeDb(ref) with StoredNode with Exp
case 5 => dynamicTypeHintFullName
case 6 => lineNumber
case 7 => order
case 8 => typeFullName
case 8 => possibleTypes
case 9 => typeFullName
}

override def productPrefix = "Block"
override def productArity = 9
override def productArity = 10

override def canEqual(that: Any): Boolean = that != null && that.isInstanceOf[BlockDb]

Expand All @@ -960,6 +981,7 @@ class BlockDb(ref: NodeRef[NodeDb]) extends NodeDb(ref) with StoredNode with Exp
case "DYNAMIC_TYPE_HINT_FULL_NAME" => this._dynamicTypeHintFullName
case "LINE_NUMBER" => this._lineNumber
case "ORDER" => this._order
case "POSSIBLE_TYPES" => this._possibleTypes
case "TYPE_FULL_NAME" => this._typeFullName

case _ => null
Expand Down Expand Up @@ -990,8 +1012,26 @@ class BlockDb(ref: NodeRef[NodeDb]) extends NodeDb(ref) with StoredNode with Exp
collection.immutable.ArraySeq.unsafeWrapArray(iter.asInstanceOf[Iterable[String]].toArray)
} else collection.immutable.ArraySeq.empty
}
case "LINE_NUMBER" => this._lineNumber = value.asInstanceOf[Integer]
case "ORDER" => this._order = value.asInstanceOf[scala.Int]
case "LINE_NUMBER" => this._lineNumber = value.asInstanceOf[Integer]
case "ORDER" => this._order = value.asInstanceOf[scala.Int]
case "POSSIBLE_TYPES" =>
this._possibleTypes = value match {
case null => collection.immutable.ArraySeq.empty
case singleValue: String => collection.immutable.ArraySeq(singleValue)
case coll: IterableOnce[Any] if coll.iterator.isEmpty => collection.immutable.ArraySeq.empty
case arr: Array[_] if arr.isEmpty => collection.immutable.ArraySeq.empty
case arr: Array[_] => collection.immutable.ArraySeq.unsafeWrapArray(arr).asInstanceOf[IndexedSeq[String]]
case jCollection: java.lang.Iterable[_] =>
if (jCollection.iterator.hasNext) {
collection.immutable.ArraySeq.unsafeWrapArray(
jCollection.asInstanceOf[java.util.Collection[String]].iterator.asScala.toArray
)
} else collection.immutable.ArraySeq.empty
case iter: Iterable[_] =>
if (iter.nonEmpty) {
collection.immutable.ArraySeq.unsafeWrapArray(iter.asInstanceOf[Iterable[String]].toArray)
} else collection.immutable.ArraySeq.empty
}
case "TYPE_FULL_NAME" => this._typeFullName = value.asInstanceOf[String]

case _ => PropertyErrorRegister.logPropertyErrorIfFirst(getClass, key)
Expand All @@ -1018,6 +1058,9 @@ class BlockDb(ref: NodeRef[NodeDb]) extends NodeDb(ref) with StoredNode with Exp
else collection.immutable.ArraySeq.empty
this._lineNumber = newNode.asInstanceOf[NewBlock].lineNumber.orNull
this._order = newNode.asInstanceOf[NewBlock].order
this._possibleTypes =
if (newNode.asInstanceOf[NewBlock].possibleTypes != null) newNode.asInstanceOf[NewBlock].possibleTypes
else collection.immutable.ArraySeq.empty
this._typeFullName = newNode.asInstanceOf[NewBlock].typeFullName

}
Expand Down
Loading
Loading