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

Deprecate declaringClass in favor of referencedClass in JcRawCallExpr and JcRawFieldRef #221

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
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
26 changes: 26 additions & 0 deletions jacodb-api/src/main/kotlin/org/jacodb/api/cfg/JcRawInst.kt
Original file line number Diff line number Diff line change
Expand Up @@ -643,12 +643,25 @@ data class JcRawInstanceOfExpr(
}

sealed interface JcRawCallExpr : JcRawExpr {
@Deprecated(
"This property contains the name of the class via which the method is referenced, "
+ "the method is declared in either directly that class or one of its superclasses. "
+ "This property is deprecated in favor of a better named `referencedClass` property."
)
val declaringClass: TypeName
val methodName: String
val argumentTypes: List<TypeName>
val returnType: TypeName
val args: List<JcRawValue>

/**
* Name of the class via which the method is referenced.
*
* Referenced class may be a subclass of a class that actually declares the method,
* since static members can be accessed via subclasses.
*/
val referencedClass get() = declaringClass

override val typeName get() = returnType

override val operands: List<JcRawValue>
Expand Down Expand Up @@ -878,6 +891,11 @@ sealed interface JcRawComplexValue : JcRawValue

data class JcRawFieldRef(
val instance: JcRawValue?,
@Deprecated(
"This property contains the name of the class via which the field is referenced, "
+ "the field is declared in either directly that class or one of its superclasses. "
+ "This property is deprecated in favor of a better named `referencedClass` property."
)
val declaringClass: TypeName,
val fieldName: String,
override val typeName: TypeName
Expand All @@ -889,6 +907,14 @@ data class JcRawFieldRef(
typeName
)

/**
* Name of the class via which the field is referenced.
*
* Referenced class may be a subclass of a class that actually declares the field,
* since static members can be accessed via subclasses.
*/
val referencedClass: TypeName get() = declaringClass

override fun toString(): String = "${instance ?: declaringClass}.$fieldName"

override fun <T> accept(visitor: JcRawExprVisitor<T>): T {
Expand Down
Loading