@@ -18,6 +18,7 @@ package org.jacodb.impl.cfg
1818
1919import org.jacodb.api.*
2020import org.jacodb.api.cfg.*
21+ import org.jacodb.api.ext.findType
2122import org.jacodb.api.ext.jvmName
2223import org.jacodb.impl.cfg.util.typeName
2324import org.jacodb.impl.softLazy
@@ -76,7 +77,7 @@ abstract class MethodSignatureRef(
7677 }
7778
7879 fun JcType.throwNotFoundException (): Nothing {
79- throw IllegalStateException (this .methodNotFoundMessage)
80+ throw MethodNotFoundException (this .methodNotFoundMessage)
8081 }
8182
8283}
@@ -89,14 +90,14 @@ class TypedStaticMethodRefImpl(
8990) : MethodSignatureRef(type, name, argTypes, returnType) {
9091
9192 constructor (classpath: JcClasspath , raw: JcRawStaticCallExpr ) : this (
92- classpath.findTypeOrNull (raw.declaringClass.typeName) as JcClassType ,
93+ classpath.findType (raw.declaringClass.typeName) as JcClassType ,
9394 raw.methodName,
9495 raw.argumentTypes,
9596 raw.returnType
9697 )
9798
9899 override val method: JcTypedMethod by weakLazy {
99- type.lookup.staticMethod(name, description) ? : throw IllegalStateException (methodNotFoundMessage )
100+ type.lookup.staticMethod(name, description) ? : type.throwNotFoundException( )
100101 }
101102}
102103
@@ -108,7 +109,7 @@ class TypedSpecialMethodRefImpl(
108109) : MethodSignatureRef(type, name, argTypes, returnType) {
109110
110111 constructor (classpath: JcClasspath , raw: JcRawSpecialCallExpr ) : this (
111- classpath.findTypeOrNull (raw.declaringClass.typeName) as JcClassType ,
112+ classpath.findType (raw.declaringClass.typeName) as JcClassType ,
112113 raw.methodName,
113114 raw.argumentTypes,
114115 raw.returnType
@@ -130,7 +131,7 @@ class VirtualMethodRefImpl(
130131
131132 companion object {
132133 private fun JcRawCallExpr.resolvedType (classpath : JcClasspath ): Pair <JcClassType , JcClassType > {
133- val declared = classpath.findTypeOrNull (declaringClass.typeName) as JcClassType
134+ val declared = classpath.findType (declaringClass.typeName) as JcClassType
134135 if (this is JcRawInstanceExpr ) {
135136 val instance = instance
136137 if (instance is JcRawLocal ) {
@@ -182,7 +183,7 @@ class TypedMethodRefImpl(
182183) : MethodSignatureRef(type, name, argTypes, returnType) {
183184
184185 constructor (classpath: JcClasspath , raw: JcRawCallExpr ) : this (
185- classpath.findTypeOrNull (raw.declaringClass.typeName) as JcClassType ,
186+ classpath.findType (raw.declaringClass.typeName) as JcClassType ,
186187 raw.methodName,
187188 raw.argumentTypes,
188189 raw.returnType
0 commit comments