Skip to content

Commit c1fd247

Browse files
committed
Java: Fix issue with getting best type for model and make sure that lift always returns best candidate.
1 parent dc4604f commit c1fd247

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

java/ql/src/utils/modelgenerator/internal/CaptureModelsSpecific.qll

+8-3
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,18 @@ class TargetApiSpecific extends Callable {
7474
isRelevantForModels(this)
7575
}
7676

77+
/** Gets a super implementation from source, if any. */
78+
private Method getSuperImpl() {
79+
exists(Method m | m = superImpl(this) and m.fromSource() | result = m)
80+
}
81+
7782
/**
78-
* Gets the callable that a model will be lifted to, if any.
83+
* Gets the callable that a model will be lifted to.
7984
*/
8085
Callable lift() {
81-
exists(Method m | m = superImpl(this) and m.fromSource() | result = m)
86+
result = this.getSuperImpl()
8287
or
83-
not exists(superImpl(this)) and result = this
88+
not exists(this.getSuperImpl()) and result = this
8489
}
8590
}
8691

0 commit comments

Comments
 (0)