Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd64a936

Browse files
authored
Merge pull request#20088 from aschackmull/java/joinorders1
Java: Improve several join-orders
2 parentsf697511 +d9f47bd commitd64a936

File tree

3 files changed

+24
-9
lines changed

3 files changed

+24
-9
lines changed

‎java/ql/lib/semmle/code/java/Generics.qll

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,13 @@ private predicate unificationTargets(RefType t1, Type t2) {
521521
t2=a2.getComponentType()
522522
)
523523
or
524-
exists(ParameterizedTypept1,ParameterizedTypept2,intpos|
524+
unificationTargetsParameterized(_, _,t1,t2)
525+
}
526+
527+
privatepredicateunificationTargetsParameterized(
528+
ParameterizedTypept1,ParameterizedTypept2,RefTypet1,RefTypet2
529+
){
530+
exists(intpos|
525531
unificationTargets(pt1,pt2)and
526532
t1=pt1.getTypeArgument(pos)and
527533
t2=pt2.getTypeArgument(pos)
@@ -565,10 +571,12 @@ private predicate hasParameterSubstitution(
565571
GenericTypeg1,ParameterizedTypept1,GenericTypeg2,ParameterizedTypept2,TypeVariablev,
566572
RefTypesubst
567573
){
568-
unificationTargets(pt1,pt2)and
569-
exists(intpos|hasSubstitution(pt1.getTypeArgument(pos),pt2.getTypeArgument(pos),v,subst))and
570-
g1=pt1.getGenericType()and
571-
g2=pt2.getGenericType()
574+
exists(RefTypet1,RefTypet2|
575+
unificationTargetsParameterized(pt1,pt2,t1,t2)and
576+
hasSubstitution(t1,t2,v,subst)and
577+
g1=pt1.getGenericType()and
578+
g2=pt2.getGenericType()
579+
)
572580
}
573581

574582
/**

‎java/ql/lib/semmle/code/java/Type.qll

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1261,14 +1261,21 @@ private Type erase(Type t) {
12611261
*
12621262
* For the definition of the notion of *erasure* see JLS v8, section 4.6 (Type Erasure).
12631263
*/
1264+
bindingset[t1, t2]
12641265
overlay[caller?]
1265-
pragma[inline]
1266+
pragma[inline_late]
12661267
predicatehaveIntersection(RefTypet1,RefTypet2){
12671268
exists(RefTypee1,RefTypee2|e1=erase(t1)ande2=erase(t2)|
1268-
erasedHaveIntersection(e1,e2)
1269+
erasedHaveIntersectionFilter(e1,e2)
12691270
)
12701271
}
12711272

1273+
bindingset[t1, t2]
1274+
pragma[inline_late]
1275+
privatepredicateerasedHaveIntersectionFilter(RefTypet1,RefTypet2){
1276+
erasedHaveIntersection(t1,t2)
1277+
}
1278+
12721279
/**
12731280
* Holds if there is no common (reflexive, transitive) subtype of the erasures
12741281
* of types `t1` and `t2`.

‎java/ql/src/Likely Bugs/Collections/ContainsTypeMismatch.ql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,8 @@ class MismatchedContainerAccess extends MethodCall {
103103
|
104104
this.getCallee()
105105
.getDeclaringType()
106-
.getASourceSupertype*()
107106
.getSourceDeclaration()
107+
.getASourceSupertype*()
108108
.hasQualifiedName(package,type)and
109109
this.getCallee().getParameter(i).getType()instanceofTypeObject
110110
)
@@ -119,7 +119,7 @@ class MismatchedContainerAccess extends MethodCall {
119119
containerAccess(package,type,p,this.getCallee().getSignature(),i)
120120
|
121121
t=this.getCallee().getDeclaringType()and
122-
t.getASourceSupertype*().getSourceDeclaration()=gand
122+
t.getSourceDeclaration().getASourceSupertype*()=gand
123123
g.hasQualifiedName(package,type)and
124124
indirectlyInstantiates(t,g,p,result)
125125
)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp