Java: Deprecate ParExpr.

This commit is contained in:
Anders Schack-Mulligen
2020-01-29 15:52:07 +01:00
parent c4d2163321
commit 75c549baa1
48 changed files with 87 additions and 172 deletions

View File

@@ -15,7 +15,7 @@ import java
predicate usefulUpcast(CastExpr e) {
// Upcasts that may be performed to affect resolution of methods or constructors.
exists(Call c, int i, Callable target |
c.getArgument(i).getProperExpr() = e and
c.getArgument(i) = e and
target = c.getCallee() and
// An upcast to the type of the corresponding parameter.
e.getType() = target.getParameterType(i)
@@ -31,13 +31,13 @@ predicate usefulUpcast(CastExpr e) {
)
or
// Upcasts of a varargs argument.
exists(Call c, int iArg, int iParam | c.getArgument(iArg).getProperExpr() = e |
exists(Call c, int iArg, int iParam | c.getArgument(iArg) = e |
c.getCallee().getParameter(iParam).isVarargs() and iArg >= iParam
)
or
// Upcasts that are performed on an operand of a ternary expression.
exists(ConditionalExpr ce |
e = ce.getTrueExpr().getProperExpr() or e = ce.getFalseExpr().getProperExpr()
e = ce.getTrueExpr() or e = ce.getFalseExpr()
)
or
// Upcasts to raw types.
@@ -46,12 +46,12 @@ predicate usefulUpcast(CastExpr e) {
e.getType().(Array).getElementType() instanceof RawType
or
// Upcasts that are performed to affect field, private method, or static method resolution.
exists(FieldAccess fa | e = fa.getQualifier().getProperExpr() |
exists(FieldAccess fa | e = fa.getQualifier() |
not e.getExpr().getType().(RefType).inherits(fa.getField())
)
or
exists(MethodAccess ma, Method m |
e = ma.getQualifier().getProperExpr() and
e = ma.getQualifier() and
m = ma.getMethod() and
(m.isStatic() or m.isPrivate())
|