diff --git a/csharp/ql/examples/snippets/catch_exception.ql b/csharp/ql/examples/snippets/catch_exception.ql index eff10ed9ba1..b01ef55da14 100644 --- a/csharp/ql/examples/snippets/catch_exception.ql +++ b/csharp/ql/examples/snippets/catch_exception.ql @@ -10,5 +10,5 @@ import csharp from CatchClause catch -where catch.getCaughtExceptionType().hasQualifiedName("System.IO.IOException") +where catch.getCaughtExceptionType().hasQualifiedName("System.IO", "IOException") select catch diff --git a/csharp/ql/examples/snippets/constructor_call.ql b/csharp/ql/examples/snippets/constructor_call.ql index 0329b13169e..62adb46fbb9 100644 --- a/csharp/ql/examples/snippets/constructor_call.ql +++ b/csharp/ql/examples/snippets/constructor_call.ql @@ -10,5 +10,5 @@ import csharp from ObjectCreation new -where new.getObjectType().hasQualifiedName("System.Exception") +where new.getObjectType().hasQualifiedName("System", "Exception") select new diff --git a/csharp/ql/examples/snippets/extend_class.ql b/csharp/ql/examples/snippets/extend_class.ql index 40a2eeb20d3..00d062b8978 100644 --- a/csharp/ql/examples/snippets/extend_class.ql +++ b/csharp/ql/examples/snippets/extend_class.ql @@ -13,5 +13,5 @@ import csharp from RefType type -where type.getABaseType+().hasQualifiedName("System.Collections.IEnumerator") +where type.getABaseType+().hasQualifiedName("System.Collections", "IEnumerator") select type diff --git a/csharp/ql/examples/snippets/field_read.ql b/csharp/ql/examples/snippets/field_read.ql index e36c92aadf9..ee7dbe17d75 100644 --- a/csharp/ql/examples/snippets/field_read.ql +++ b/csharp/ql/examples/snippets/field_read.ql @@ -11,6 +11,6 @@ import csharp from Field f, FieldRead read where f.hasName("VirtualAddress") and - f.getDeclaringType().hasQualifiedName("Mono.Cecil.PE.Section") and + f.getDeclaringType().hasQualifiedName("Mono.Cecil.PE", "Section") and f = read.getTarget() select read diff --git a/csharp/ql/examples/snippets/method_call.ql b/csharp/ql/examples/snippets/method_call.ql index 8ae3c8d3fb0..723efc8ecb6 100644 --- a/csharp/ql/examples/snippets/method_call.ql +++ b/csharp/ql/examples/snippets/method_call.ql @@ -12,5 +12,5 @@ from MethodCall call, Method method where call.getTarget() = method and method.hasName("MethodName") and - method.getDeclaringType().hasQualifiedName("Company.Class") + method.getDeclaringType().hasQualifiedName("Company", "Class") select call diff --git a/csharp/ql/examples/snippets/null_argument.ql b/csharp/ql/examples/snippets/null_argument.ql index ca1e1516c34..78a6d3c39eb 100644 --- a/csharp/ql/examples/snippets/null_argument.ql +++ b/csharp/ql/examples/snippets/null_argument.ql @@ -17,6 +17,6 @@ where add.hasName("Add") and add.getDeclaringType() .getUnboundDeclaration() - .hasQualifiedName("System.Collections.Generic.ICollection<>") and + .hasQualifiedName("System.Collections.Generic", "ICollection<>") and call.getAnArgument() instanceof NullLiteral select call diff --git a/csharp/ql/examples/snippets/override_method.ql b/csharp/ql/examples/snippets/override_method.ql index ea5c2126f6a..c93b43ace64 100644 --- a/csharp/ql/examples/snippets/override_method.ql +++ b/csharp/ql/examples/snippets/override_method.ql @@ -11,6 +11,6 @@ import csharp from Method override, Method base where base.hasName("ToString") and - base.getDeclaringType().hasQualifiedName("System.Object") and + base.getDeclaringType().hasQualifiedName("System", "Object") and base.getAnOverrider() = override select override diff --git a/csharp/ql/examples/snippets/throw_exception.ql b/csharp/ql/examples/snippets/throw_exception.ql index 94c1615fd21..b737863225b 100644 --- a/csharp/ql/examples/snippets/throw_exception.ql +++ b/csharp/ql/examples/snippets/throw_exception.ql @@ -9,5 +9,5 @@ import csharp from ThrowStmt throw -where throw.getThrownExceptionType().getBaseClass*().hasQualifiedName("System.IO.IOException") +where throw.getThrownExceptionType().getBaseClass*().hasQualifiedName("System.IO", "IOException") select throw diff --git a/csharp/ql/lib/Linq/Helpers.qll b/csharp/ql/lib/Linq/Helpers.qll index a3c5667c8bb..f0dda07e882 100644 --- a/csharp/ql/lib/Linq/Helpers.qll +++ b/csharp/ql/lib/Linq/Helpers.qll @@ -19,7 +19,7 @@ private int numStmts(ForeachStmt fes) { } /** Holds if the type's qualified name is "System.Linq.Enumerable" */ -predicate isEnumerableType(ValueOrRefType t) { t.hasQualifiedName("System.Linq.Enumerable") } +predicate isEnumerableType(ValueOrRefType t) { t.hasQualifiedName("System.Linq", "Enumerable") } /** Holds if the type's qualified name starts with "System.Collections.Generic.IEnumerable" */ predicate isIEnumerableType(ValueOrRefType t) { diff --git a/csharp/ql/lib/semmle/code/csharp/Stmt.qll b/csharp/ql/lib/semmle/code/csharp/Stmt.qll index 3ed9468a8d8..6bf826c675d 100644 --- a/csharp/ql/lib/semmle/code/csharp/Stmt.qll +++ b/csharp/ql/lib/semmle/code/csharp/Stmt.qll @@ -75,7 +75,7 @@ class BlockStmt extends Stmt, @block_stmt { /** Holds if this block is the container of the global statements. */ predicate isGlobalStatementContainer() { - this.getEnclosingCallable().hasQualifiedName("Program.
$") + this.getEnclosingCallable().hasQualifiedName("Program", "
$") } override Stmt stripSingletonBlocks() { diff --git a/csharp/ql/lib/semmle/code/csharp/Type.qll b/csharp/ql/lib/semmle/code/csharp/Type.qll index d475442f886..022bd12af23 100644 --- a/csharp/ql/lib/semmle/code/csharp/Type.qll +++ b/csharp/ql/lib/semmle/code/csharp/Type.qll @@ -825,7 +825,7 @@ class AnonymousClass extends Class { * The `object` type, `System.Object`. */ class ObjectType extends Class { - ObjectType() { this.hasQualifiedName("System.Object") } + ObjectType() { this.hasQualifiedName("System", "Object") } override string toStringWithTypes() { result = "object" } @@ -836,7 +836,7 @@ class ObjectType extends Class { * The `string` type, `System.String`. */ class StringType extends Class { - StringType() { this.hasQualifiedName("System.String") } + StringType() { this.hasQualifiedName("System", "String") } override string toStringWithTypes() { result = "string" } diff --git a/csharp/ql/lib/semmle/code/csharp/commons/Util.qll b/csharp/ql/lib/semmle/code/csharp/commons/Util.qll index 342ab2afd4e..91903a9109b 100644 --- a/csharp/ql/lib/semmle/code/csharp/commons/Util.qll +++ b/csharp/ql/lib/semmle/code/csharp/commons/Util.qll @@ -8,7 +8,7 @@ class MainMethod extends Method { ( this.hasName("Main") or - this.hasQualifiedName("Program.
$") + this.hasQualifiedName("Program", "
$") ) and this.isStatic() and (this.getReturnType() instanceof VoidType or this.getReturnType() instanceof IntType) and diff --git a/csharp/ql/lib/semmle/code/csharp/controlflow/internal/ControlFlowGraphImpl.qll b/csharp/ql/lib/semmle/code/csharp/controlflow/internal/ControlFlowGraphImpl.qll index 6bd0d5d033f..37fc97903e6 100644 --- a/csharp/ql/lib/semmle/code/csharp/controlflow/internal/ControlFlowGraphImpl.qll +++ b/csharp/ql/lib/semmle/code/csharp/controlflow/internal/ControlFlowGraphImpl.qll @@ -768,7 +768,7 @@ module Expressions { nc.getOuterCompletion() .(ThrowCompletion) .getExceptionClass() - .hasQualifiedName("System.InvalidOperationException") + .hasQualifiedName("System", "InvalidOperationException") ) ) } diff --git a/csharp/ql/lib/semmle/code/csharp/controlflow/internal/NonReturning.qll b/csharp/ql/lib/semmle/code/csharp/controlflow/internal/NonReturning.qll index fe9f1148a6d..1f00343e08a 100644 --- a/csharp/ql/lib/semmle/code/csharp/controlflow/internal/NonReturning.qll +++ b/csharp/ql/lib/semmle/code/csharp/controlflow/internal/NonReturning.qll @@ -51,7 +51,7 @@ private class ThrowingCall extends NonReturningCall { this = any(MethodCall mc | mc.getTarget() - .hasQualifiedName("System.Runtime.ExceptionServices.ExceptionDispatchInfo", "Throw") and + .hasQualifiedName("System.Runtime.ExceptionServices", "ExceptionDispatchInfo", "Throw") and ( mc.hasNoArguments() and c.getExceptionClass() instanceof SystemExceptionClass @@ -85,8 +85,8 @@ private class DirectlyExitingCallable extends ExitingCallable { DirectlyExitingCallable() { this = any(Method m | - m.hasQualifiedName("System.Environment", "Exit") or - m.hasQualifiedName("System.Windows.Forms.Application", "Exit") + m.hasQualifiedName("System", "Environment", "Exit") or + m.hasQualifiedName("System.Windows.Forms", "Application", "Exit") ) } } diff --git a/csharp/ql/lib/semmle/code/csharp/dataflow/internal/rangeanalysis/ConstantUtils.qll b/csharp/ql/lib/semmle/code/csharp/dataflow/internal/rangeanalysis/ConstantUtils.qll index c067e29d320..e3f5deb9898 100644 --- a/csharp/ql/lib/semmle/code/csharp/dataflow/internal/rangeanalysis/ConstantUtils.qll +++ b/csharp/ql/lib/semmle/code/csharp/dataflow/internal/rangeanalysis/ConstantUtils.qll @@ -13,7 +13,7 @@ private class ExprNode = ControlFlow::Nodes::ExprNode; * Holds if `pa` is an access to the `Length` property of an array. */ predicate systemArrayLengthAccess(PropertyAccess pa) { - propertyOverrides(pa.getTarget(), "System.Array", "Length") + propertyOverrides(pa.getTarget(), "System", "Array", "Length") } /** diff --git a/csharp/ql/lib/semmle/code/csharp/dataflow/internal/rangeanalysis/RangeUtils.qll b/csharp/ql/lib/semmle/code/csharp/dataflow/internal/rangeanalysis/RangeUtils.qll index 067a9b94f45..ce7637ccd92 100644 --- a/csharp/ql/lib/semmle/code/csharp/dataflow/internal/rangeanalysis/RangeUtils.qll +++ b/csharp/ql/lib/semmle/code/csharp/dataflow/internal/rangeanalysis/RangeUtils.qll @@ -150,9 +150,9 @@ private module Impl { /** * Holds if property `p` matches `property` in `baseClass` or any overrides. */ - predicate propertyOverrides(Property p, string baseClass, string property) { + predicate propertyOverrides(Property p, string namespace, string baseClass, string property) { exists(Property p2 | - p2.getUnboundDeclaration().getDeclaringType().hasQualifiedName(baseClass) and + p2.getUnboundDeclaration().getDeclaringType().hasQualifiedName(namespace, baseClass) and p2.hasName(property) | p.overridesOrImplementsOrEquals(p2) diff --git a/csharp/ql/lib/semmle/code/csharp/dataflow/internal/rangeanalysis/SignAnalysisSpecific.qll b/csharp/ql/lib/semmle/code/csharp/dataflow/internal/rangeanalysis/SignAnalysisSpecific.qll index 04d0816a683..9102bf29131 100644 --- a/csharp/ql/lib/semmle/code/csharp/dataflow/internal/rangeanalysis/SignAnalysisSpecific.qll +++ b/csharp/ql/lib/semmle/code/csharp/dataflow/internal/rangeanalysis/SignAnalysisSpecific.qll @@ -83,10 +83,10 @@ private module Impl { */ predicate containerSizeAccess(ExprNode e) { exists(Property p | p = e.getExpr().(PropertyAccess).getTarget() | - propertyOverrides(p, "System.Collections.Generic.IEnumerable<>", "Count") or - propertyOverrides(p, "System.Collections.ICollection", "Count") or - propertyOverrides(p, "System.String", "Length") or - propertyOverrides(p, "System.Array", "Length") + propertyOverrides(p, "System.Collections.Generic", "IEnumerable<>", "Count") or + propertyOverrides(p, "System.Collections", "ICollection", "Count") or + propertyOverrides(p, "System", "String", "Length") or + propertyOverrides(p, "System", "Array", "Length") ) or e.getExpr() instanceof CountCall diff --git a/csharp/ql/lib/semmle/code/csharp/frameworks/Dapper.qll b/csharp/ql/lib/semmle/code/csharp/frameworks/Dapper.qll index 3d25f4389fd..4455da25ac7 100644 --- a/csharp/ql/lib/semmle/code/csharp/frameworks/Dapper.qll +++ b/csharp/ql/lib/semmle/code/csharp/frameworks/Dapper.qll @@ -9,7 +9,7 @@ private import semmle.code.csharp.frameworks.system.Data module Dapper { /** The namespace `Dapper`. */ class DapperNamespace extends Namespace { - DapperNamespace() { this.hasQualifiedName("Dapper") } + DapperNamespace() { this.hasQualifiedName("", "Dapper") } } /** A class in `Dapper`. */ diff --git a/csharp/ql/lib/semmle/code/csharp/frameworks/EntityFramework.qll b/csharp/ql/lib/semmle/code/csharp/frameworks/EntityFramework.qll index 946ba0b9e2d..ce63f139367 100644 --- a/csharp/ql/lib/semmle/code/csharp/frameworks/EntityFramework.qll +++ b/csharp/ql/lib/semmle/code/csharp/frameworks/EntityFramework.qll @@ -20,7 +20,7 @@ module DataAnnotations { class NotMappedAttribute extends Attribute { NotMappedAttribute() { this.getType() - .hasQualifiedName("System.ComponentModel.DataAnnotations.Schema.NotMappedAttribute") + .hasQualifiedName("System.ComponentModel.DataAnnotations.Schema", "NotMappedAttribute") } } } diff --git a/csharp/ql/lib/semmle/code/csharp/frameworks/Format.qll b/csharp/ql/lib/semmle/code/csharp/frameworks/Format.qll index 373194ef366..7a7166baea1 100644 --- a/csharp/ql/lib/semmle/code/csharp/frameworks/Format.qll +++ b/csharp/ql/lib/semmle/code/csharp/frameworks/Format.qll @@ -27,15 +27,15 @@ class FormatMethod extends Method { or (this.hasName("Write") or this.hasName("WriteLine")) and ( - declType.hasQualifiedName("System.Console") + declType.hasQualifiedName("System", "Console") or - declType.hasQualifiedName("System.IO.TextWriter") + declType.hasQualifiedName("System.IO", "TextWriter") or - declType.hasQualifiedName("System.Diagnostics.Debug") and + declType.hasQualifiedName("System.Diagnostics", "Debug") and this.getParameter(1).getType() instanceof ArrayType ) or - declType.hasQualifiedName("System.Diagnostics.Trace") and + declType.hasQualifiedName("System.Diagnostics", "Trace") and ( this.hasName("TraceError") or this.hasName("TraceInformation") or @@ -43,14 +43,14 @@ class FormatMethod extends Method { ) or this.hasName("TraceInformation") and - declType.hasQualifiedName("System.Diagnostics.TraceSource") + declType.hasQualifiedName("System.Diagnostics", "TraceSource") or this.hasName("Print") and - declType.hasQualifiedName("System.Diagnostics.Debug") + declType.hasQualifiedName("System.Diagnostics", "Debug") ) or this.hasName("Assert") and - declType.hasQualifiedName("System.Diagnostics.Debug") and + declType.hasQualifiedName("System.Diagnostics", "Debug") and this.getNumberOfParameters() = 4 ) } @@ -65,7 +65,7 @@ class FormatMethod extends Method { else if this.hasName("Assert") and - this.getDeclaringType().hasQualifiedName("System.Diagnostics.Debug") + this.getDeclaringType().hasQualifiedName("System.Diagnostics", "Debug") then result = 2 else result = 0 } diff --git a/csharp/ql/lib/semmle/code/csharp/frameworks/JsonNET.qll b/csharp/ql/lib/semmle/code/csharp/frameworks/JsonNET.qll index bbadee3d5c9..a56d711eabf 100644 --- a/csharp/ql/lib/semmle/code/csharp/frameworks/JsonNET.qll +++ b/csharp/ql/lib/semmle/code/csharp/frameworks/JsonNET.qll @@ -8,7 +8,7 @@ import csharp module JsonNET { /** The namespace `Newtonsoft.Json`. */ class JsonNETNamespace extends Namespace { - JsonNETNamespace() { this.hasQualifiedName("Newtonsoft.Json") } + JsonNETNamespace() { this.hasQualifiedName("Newtonsoft", "Json") } } /** A class in `Newtonsoft.Json`. */ diff --git a/csharp/ql/lib/semmle/code/csharp/frameworks/Moq.qll b/csharp/ql/lib/semmle/code/csharp/frameworks/Moq.qll index e0705ac7d98..7c19908f7be 100644 --- a/csharp/ql/lib/semmle/code/csharp/frameworks/Moq.qll +++ b/csharp/ql/lib/semmle/code/csharp/frameworks/Moq.qll @@ -4,7 +4,7 @@ import csharp /** The `Moq.Language` Namespace. */ class MoqLanguageNamespace extends Namespace { - MoqLanguageNamespace() { this.hasQualifiedName("Moq.Language") } + MoqLanguageNamespace() { this.hasQualifiedName("Moq", "Language") } } /** diff --git a/csharp/ql/lib/semmle/code/csharp/frameworks/NHibernate.qll b/csharp/ql/lib/semmle/code/csharp/frameworks/NHibernate.qll index c416d6f6849..a0b90cb9146 100644 --- a/csharp/ql/lib/semmle/code/csharp/frameworks/NHibernate.qll +++ b/csharp/ql/lib/semmle/code/csharp/frameworks/NHibernate.qll @@ -14,7 +14,7 @@ module NHibernate { /** The interface `NHibernamte.ISession`. */ class ISessionInterface extends Interface { - ISessionInterface() { this.hasQualifiedName("NHibernate.ISession") } + ISessionInterface() { this.hasQualifiedName("NHibernate", "ISession") } /** Gets a parameter that uses a mapped object. */ Parameter getAMappedObjectParameter() { diff --git a/csharp/ql/lib/semmle/code/csharp/frameworks/Sql.qll b/csharp/ql/lib/semmle/code/csharp/frameworks/Sql.qll index 3d643934b5f..f50f601b45f 100644 --- a/csharp/ql/lib/semmle/code/csharp/frameworks/Sql.qll +++ b/csharp/ql/lib/semmle/code/csharp/frameworks/Sql.qll @@ -34,13 +34,14 @@ class IDbCommandConstructionSqlExpr extends SqlExpr, ObjectCreation { exists(InstanceConstructor ic | ic = this.getTarget() | ic.getDeclaringType().getABaseType*() instanceof SystemDataIDbCommandInterface and ic.getParameter(0).getType() instanceof StringType and - not ic.getDeclaringType() - .hasQualifiedName([ - // Known sealed classes: - "System.Data.SqlClient.SqlCommand", "System.Data.Odbc.OdbcCommand", - "System.Data.OleDb.OleDbCommand", "System.Data.EntityClient.EntityCommand", - "System.Data.SQLite.SQLiteCommand" - ]) + not exists(Type t | t = ic.getDeclaringType() | + // Known sealed classes: + t.hasQualifiedName("System.Data.SqlClient", "SqlCommand") or + t.hasQualifiedName("System.Data.Odbc", "OdbcCommand") or + t.hasQualifiedName("System.Data.OleDb", "OleDbCommand") or + t.hasQualifiedName("System.Data.EntityClient", "EntityCommand") or + t.hasQualifiedName("System.Data.SQLite", "SQLiteCommand") + ) ) } diff --git a/csharp/ql/lib/semmle/code/csharp/frameworks/microsoft/AspNetCore.qll b/csharp/ql/lib/semmle/code/csharp/frameworks/microsoft/AspNetCore.qll index d9624b60dcc..f4cfb19a354 100644 --- a/csharp/ql/lib/semmle/code/csharp/frameworks/microsoft/AspNetCore.qll +++ b/csharp/ql/lib/semmle/code/csharp/frameworks/microsoft/AspNetCore.qll @@ -217,7 +217,7 @@ class MicrosoftAspNetCoreMvcController extends Class { .getType() .getABaseType*() // ApiControllerAttribute is derived from ControllerAttribute - .hasQualifiedName("Microsoft.AspNetCore.Mvc.ControllerAttribute") + .hasQualifiedName("Microsoft.AspNetCore.Mvc", "ControllerAttribute") ) and not this.getABaseType*().getAnAttribute() instanceof MicrosoftAspNetCoreMvcNonControllerAttribute @@ -288,7 +288,7 @@ class MicrosoftAspNetCoreHttpHttpResponse extends Class { /** An interface that is a wrapper around the collection of cookies in the response. */ class MicrosoftAspNetCoreHttpResponseCookies extends Interface { MicrosoftAspNetCoreHttpResponseCookies() { - this.hasQualifiedName("Microsoft.AspNetCore.Http.IResponseCookies") + this.hasQualifiedName("Microsoft.AspNetCore.Http", "IResponseCookies") } /** Gets the `Append` method. */ diff --git a/csharp/ql/lib/semmle/code/csharp/frameworks/system/security/cryptography/SymmetricAlgorithm.qll b/csharp/ql/lib/semmle/code/csharp/frameworks/system/security/cryptography/SymmetricAlgorithm.qll index d0b9c2e5239..7a307db2fa5 100644 --- a/csharp/ql/lib/semmle/code/csharp/frameworks/system/security/cryptography/SymmetricAlgorithm.qll +++ b/csharp/ql/lib/semmle/code/csharp/frameworks/system/security/cryptography/SymmetricAlgorithm.qll @@ -5,32 +5,33 @@ import csharp /** - * Holds if the object creation `oc` is the creation of the reference type with the specified `qualifiedName`, or a class derived from - * the class with the specified `qualifiedName`. + * Holds if the object creation `oc` is the creation of the reference type with the specified `namespace` and `type`, or a class derived from + * the class with the specified `namespace` and `type`. */ -private predicate isCreatingObject(ObjectCreation oc, string qualifiedName) { - exists(RefType t | t = oc.getType() | t.getBaseClass*().hasQualifiedName(qualifiedName)) +private predicate isCreatingObject(ObjectCreation oc, string namespace, string type) { + exists(RefType t | t = oc.getType() | t.getBaseClass*().hasQualifiedName(namespace, type)) } /** - * Holds if the method call `mc` is returning the reference type with the specified `qualifiedName`. + * Holds if the method call `mc` is returning the reference type with the specified `namespace` and `type`. * and the target of the method call is a library method. */ -private predicate isReturningObject(MethodCall mc, string qualifiedName) { +private predicate isReturningObject(MethodCall mc, string namespace, string type) { mc.getTarget().fromLibrary() and - exists(RefType t | t = mc.getType() | t.hasQualifiedName(qualifiedName)) + exists(RefType t | t = mc.getType() | t.hasQualifiedName(namespace, type)) } /** - * Holds if the method call `mc` is a call on the library method target with the specified `qualifiedName` and `methodName`, and an argument at + * Holds if the method call `mc` is a call on the library method target with the specified `namespace`, `type` and `methodName`, and an argument at * index `argumentIndex` has the specified value `argumentValue` (case-insensitive). */ bindingset[argumentValue] private predicate isMethodCalledWithArg( - MethodCall mc, string qualifiedName, string methodName, int argumentIndex, string argumentValue + MethodCall mc, string namespace, string type, string methodName, int argumentIndex, + string argumentValue ) { mc.getTarget().fromLibrary() and - mc.getTarget().hasQualifiedName(qualifiedName, methodName) and + mc.getTarget().hasQualifiedName(namespace, type, methodName) and mc.getArgument(argumentIndex).getValue().toUpperCase() = argumentValue.toUpperCase() } @@ -60,13 +61,14 @@ class SymmetricAlgorithm extends Class { * Note: not all of the class names are supported on all platforms. */ predicate isCreatingDES(Expr e) { - isCreatingObject(e, "System.Security.Cryptography.DES") or - isReturningObject(e, "System.Security.Cryptography.DES") or - isMethodCalledWithArg(e, "System.Security.Cryptography.SymmetricAlgorithm", "Create", 0, "DES") or - isMethodCalledWithArg(e, "System.Security.Cryptography.SymmetricAlgorithm", "Create", 0, + isCreatingObject(e, "System.Security.Cryptography", "DES") or + isReturningObject(e, "System.Security.Cryptography", "DES") or + isMethodCalledWithArg(e, "System.Security.Cryptography", "SymmetricAlgorithm", "Create", 0, "DES") or + isMethodCalledWithArg(e, "System.Security.Cryptography", "SymmetricAlgorithm", "Create", 0, "System.Security.Cryptography.DES") or - isMethodCalledWithArg(e, "System.Security.Cryptography.CryptoConfig", "CreateFromName", 0, "DES") or - isMethodCalledWithArg(e, "System.Security.Cryptography.CryptoConfig", "CreateFromName", 0, + isMethodCalledWithArg(e, "System.Security.Cryptography", "CryptoConfig", "CreateFromName", 0, + "DES") or + isMethodCalledWithArg(e, "System.Security.Cryptography", "CryptoConfig", "CreateFromName", 0, "System.Security.Cryptography.DES") } @@ -75,21 +77,22 @@ predicate isCreatingDES(Expr e) { * Note: not all of the class names are supported on all platforms. */ predicate isCreatingTripleDES(Expr e) { - isCreatingObject(e, "System.Security.Cryptography.TripleDES") or - isReturningObject(e, "System.Security.Cryptography.TripleDES") or - isMethodCalledWithArg(e, "System.Security.Cryptography.SymmetricAlgorithm", "Create", 0, + isCreatingObject(e, "System.Security.Cryptography", "TripleDES") or + isReturningObject(e, "System.Security.Cryptography", "TripleDES") or + isMethodCalledWithArg(e, "System.Security.Cryptography", "SymmetricAlgorithm", "Create", 0, "TripleDES") or - isMethodCalledWithArg(e, "System.Security.Cryptography.SymmetricAlgorithm", "Create", 0, "3DES") or - isMethodCalledWithArg(e, "System.Security.Cryptography.SymmetricAlgorithm", "Create", 0, + isMethodCalledWithArg(e, "System.Security.Cryptography", "SymmetricAlgorithm", "Create", 0, "3DES") or + isMethodCalledWithArg(e, "System.Security.Cryptography", "SymmetricAlgorithm", "Create", 0, "Triple DES") or - isMethodCalledWithArg(e, "System.Security.Cryptography.SymmetricAlgorithm", "Create", 0, + isMethodCalledWithArg(e, "System.Security.Cryptography", "SymmetricAlgorithm", "Create", 0, "System.Security.Cryptography.TripleDES") or - isMethodCalledWithArg(e, "System.Security.Cryptography.CryptoConfig", "CreateFromName", 0, + isMethodCalledWithArg(e, "System.Security.Cryptography", "CryptoConfig", "CreateFromName", 0, "TripleDES") or - isMethodCalledWithArg(e, "System.Security.Cryptography.CryptoConfig", "CreateFromName", 0, "3DES") or - isMethodCalledWithArg(e, "System.Security.Cryptography.CryptoConfig", "CreateFromName", 0, + isMethodCalledWithArg(e, "System.Security.Cryptography", "CryptoConfig", "CreateFromName", 0, + "3DES") or + isMethodCalledWithArg(e, "System.Security.Cryptography", "CryptoConfig", "CreateFromName", 0, "Triple DES") or - isMethodCalledWithArg(e, "System.Security.Cryptography.CryptoConfig", "CreateFromName", 0, + isMethodCalledWithArg(e, "System.Security.Cryptography", "CryptoConfig", "CreateFromName", 0, "System.Security.Cryptography.TripleDES") } @@ -98,13 +101,14 @@ predicate isCreatingTripleDES(Expr e) { * Note: not all of the class names are supported on all platforms. */ predicate isCreatingRC2(Expr e) { - isCreatingObject(e, "System.Security.Cryptography.RC2") or - isReturningObject(e, "System.Security.Cryptography.RC2") or - isMethodCalledWithArg(e, "System.Security.Cryptography.SymmetricAlgorithm", "Create", 0, "RC2") or - isMethodCalledWithArg(e, "System.Security.Cryptography.SymmetricAlgorithm", "Create", 0, + isCreatingObject(e, "System.Security.Cryptography", "RC2") or + isReturningObject(e, "System.Security.Cryptography", "RC2") or + isMethodCalledWithArg(e, "System.Security.Cryptography", "SymmetricAlgorithm", "Create", 0, "RC2") or + isMethodCalledWithArg(e, "System.Security.Cryptography", "SymmetricAlgorithm", "Create", 0, "System.Security.Cryptography.RC2") or - isMethodCalledWithArg(e, "System.Security.Cryptography.CryptoConfig", "CreateFromName", 0, "RC2") or - isMethodCalledWithArg(e, "System.Security.Cryptography.CryptoConfig", "CreateFromName", 0, + isMethodCalledWithArg(e, "System.Security.Cryptography", "CryptoConfig", "CreateFromName", 0, + "RC2") or + isMethodCalledWithArg(e, "System.Security.Cryptography", "CryptoConfig", "CreateFromName", 0, "System.Security.Cryptography.RC2") } @@ -112,26 +116,26 @@ predicate isCreatingRC2(Expr e) { * Holds if the expression 'e' creates Rijndael symmetric algorithm. */ predicate isCreatingRijndael(Expr e) { - isCreatingObject(e, "System.Security.Cryptography.Rijndael") or - isReturningObject(e, "System.Security.Cryptography.Rijndael") or - isMethodCalledWithArg(e, "System.Security.Cryptography.SymmetricAlgorithm", "Create", 0, + isCreatingObject(e, "System.Security.Cryptography", "Rijndael") or + isReturningObject(e, "System.Security.Cryptography", "Rijndael") or + isMethodCalledWithArg(e, "System.Security.Cryptography", "SymmetricAlgorithm", "Create", 0, "Rijndael") or - isMethodCalledWithArg(e, "System.Security.Cryptography.SymmetricAlgorithm", "Create", 0, + isMethodCalledWithArg(e, "System.Security.Cryptography", "SymmetricAlgorithm", "Create", 0, "RijndaelManaged") or - isMethodCalledWithArg(e, "System.Security.Cryptography.SymmetricAlgorithm", "Create", 0, + isMethodCalledWithArg(e, "System.Security.Cryptography", "SymmetricAlgorithm", "Create", 0, "System.Security.Cryptography.Rijndael") or - isMethodCalledWithArg(e, "System.Security.Cryptography.SymmetricAlgorithm", "Create", 0, + isMethodCalledWithArg(e, "System.Security.Cryptography", "SymmetricAlgorithm", "Create", 0, "System.Security.Cryptography.RijndaelManaged") or - isMethodCalledWithArg(e, "System.Security.Cryptography.SymmetricAlgorithm", "Create", 0, + isMethodCalledWithArg(e, "System.Security.Cryptography", "SymmetricAlgorithm", "Create", 0, "System.Security.Cryptography.SymmetricAlgorithm") or // this creates Rijndael - isMethodCalledWithArg(e, "System.Security.Cryptography.CryptoConfig", "CreateFromName", 0, + isMethodCalledWithArg(e, "System.Security.Cryptography", "CryptoConfig", "CreateFromName", 0, "Rijndael") or - isMethodCalledWithArg(e, "System.Security.Cryptography.CryptoConfig", "CreateFromName", 0, + isMethodCalledWithArg(e, "System.Security.Cryptography", "CryptoConfig", "CreateFromName", 0, "System.Security.Cryptography.Rijndael") or - isMethodCalledWithArg(e, "System.Security.Cryptography.CryptoConfig", "CreateFromName", 0, + isMethodCalledWithArg(e, "System.Security.Cryptography", "CryptoConfig", "CreateFromName", 0, "RijndaelManaged") or - isMethodCalledWithArg(e, "System.Security.Cryptography.CryptoConfig", "CreateFromName", 0, + isMethodCalledWithArg(e, "System.Security.Cryptography", "CryptoConfig", "CreateFromName", 0, "System.Security.Cryptography.RijndaelManaged") or - isMethodCalledWithArg(e, "System.Security.Cryptography.CryptoConfig", "CreateFromName", 0, + isMethodCalledWithArg(e, "System.Security.Cryptography", "CryptoConfig", "CreateFromName", 0, "System.Security.Cryptography.SymmetricAlgorithm") // this creates Rijndael } diff --git a/csharp/ql/lib/semmle/code/csharp/frameworks/system/text/RegularExpressions.qll b/csharp/ql/lib/semmle/code/csharp/frameworks/system/text/RegularExpressions.qll index 531fa6ef721..cba035d28d3 100644 --- a/csharp/ql/lib/semmle/code/csharp/frameworks/system/text/RegularExpressions.qll +++ b/csharp/ql/lib/semmle/code/csharp/frameworks/system/text/RegularExpressions.qll @@ -36,7 +36,7 @@ class SystemTextRegularExpressionsRegexClass extends SystemTextRegularExpression */ class RegexGlobalTimeout extends MethodCall { RegexGlobalTimeout() { - this.getTarget().hasQualifiedName("System.AppDomain.SetData") and + this.getTarget().hasQualifiedName("System.AppDomain", "SetData") and this.getArgumentForName("name").getValue() = "REGEX_DEFAULT_MATCH_TIMEOUT" } } diff --git a/csharp/ql/lib/semmle/code/csharp/frameworks/test/NUnit.qll b/csharp/ql/lib/semmle/code/csharp/frameworks/test/NUnit.qll index ee6c50b2c8e..7148e7159d4 100644 --- a/csharp/ql/lib/semmle/code/csharp/frameworks/test/NUnit.qll +++ b/csharp/ql/lib/semmle/code/csharp/frameworks/test/NUnit.qll @@ -14,6 +14,19 @@ class NUnitFixture extends TestClass { } } +private string getNameSplitter() { result = "(.*)\\.([^\\.]+)$" } + +bindingset[name] +private predicate splitExceptionName(string name, string namespace, string type) { + if name.regexpMatch(getNameSplitter()) + then + namespace = name.regexpCapture(getNameSplitter(), 1) and + type = name.regexpCapture(getNameSplitter(), 2) + else ( + namespace = "" and type = name + ) +} + /** An NUnit test method. */ class NUnitTestMethod extends TestMethod { NUnitTestMethod() { @@ -38,7 +51,11 @@ class NUnitTestMethod extends TestMethod { expected.getTarget() = this | if expected.getArgument(0).getType() instanceof StringType - then result.hasQualifiedName(expected.getArgument(0).getValue()) + then + exists(string namespace, string type | + result.hasQualifiedName(namespace, type) and + splitExceptionName(expected.getArgument(0).getValue(), namespace, type) + ) else result = expected.getArgument(0).(TypeofExpr).getTypeAccess().getTarget() ) } @@ -56,11 +73,13 @@ class NUnitFile extends TestFile { /** An attribute of type `NUnit.Framework.ValueSourceAttribute`. */ class ValueSourceAttribute extends Attribute { - ValueSourceAttribute() { this.getType().hasQualifiedName("NUnit.Framework.ValueSourceAttribute") } + ValueSourceAttribute() { + this.getType().hasQualifiedName("NUnit.Framework", "ValueSourceAttribute") + } /** Holds if the first argument is the target type. */ private predicate typeSpecified() { - this.getArgument(0).getType().(Class).hasQualifiedName("System.Type") and + this.getArgument(0).getType().(Class).hasQualifiedName("System", "Type") and this.getArgument(1).getType() instanceof StringType } @@ -88,12 +107,12 @@ class ValueSourceAttribute extends Attribute { /** An attribute of type `NUnit.Framework.TestCaseSourceAttribute`. */ class TestCaseSourceAttribute extends Attribute { TestCaseSourceAttribute() { - this.getType().hasQualifiedName("NUnit.Framework.TestCaseSourceAttribute") + this.getType().hasQualifiedName("NUnit.Framework", "TestCaseSourceAttribute") } /** Holds if the first argument is the target type. */ private predicate typeSpecified() { - this.getArgument(0).getType().(Class).hasQualifiedName("System.Type") and + this.getArgument(0).getType().(Class).hasQualifiedName("System", "Type") and this.getArgument(1).getType() instanceof StringType } @@ -120,7 +139,7 @@ class TestCaseSourceAttribute extends Attribute { /** The `NUnit.Framework.Assert` class. */ class NUnitAssertClass extends Class { - NUnitAssertClass() { this.hasQualifiedName("NUnit.Framework.Assert") } + NUnitAssertClass() { this.hasQualifiedName("NUnit.Framework", "Assert") } /** Gets a `Null(object, ...)` method. */ Method getANullMethod() { @@ -179,5 +198,5 @@ class NUnitAssertClass extends Class { /** The `NUnit.Framework.AssertionException` class. */ class AssertionExceptionClass extends Class { - AssertionExceptionClass() { this.hasQualifiedName("NUnit.Framework.AssertionException") } + AssertionExceptionClass() { this.hasQualifiedName("NUnit.Framework", "AssertionException") } } diff --git a/csharp/ql/lib/semmle/code/csharp/frameworks/test/VisualStudio.qll b/csharp/ql/lib/semmle/code/csharp/frameworks/test/VisualStudio.qll index 16f05cd7834..cd8864d0c9d 100644 --- a/csharp/ql/lib/semmle/code/csharp/frameworks/test/VisualStudio.qll +++ b/csharp/ql/lib/semmle/code/csharp/frameworks/test/VisualStudio.qll @@ -5,7 +5,7 @@ import semmle.code.csharp.frameworks.Test /** The `Microsoft.VisualStudio.TestTools.UnitTesting` namespace. */ class VSTestNamespace extends Namespace { - VSTestNamespace() { this.hasQualifiedName("Microsoft.VisualStudio.TestTools.UnitTesting") } + VSTestNamespace() { this.hasQualifiedName("Microsoft.VisualStudio.TestTools", "UnitTesting") } } /** A class that contains test methods. */ diff --git a/csharp/ql/lib/semmle/code/csharp/frameworks/test/XUnit.qll b/csharp/ql/lib/semmle/code/csharp/frameworks/test/XUnit.qll index 0d229ad53ce..629a5c91ec6 100644 --- a/csharp/ql/lib/semmle/code/csharp/frameworks/test/XUnit.qll +++ b/csharp/ql/lib/semmle/code/csharp/frameworks/test/XUnit.qll @@ -5,7 +5,7 @@ import semmle.code.csharp.frameworks.Test /** The `Xunit` namespace. */ class XUnitNamespace extends Namespace { - XUnitNamespace() { this.hasQualifiedName("Xunit") } + XUnitNamespace() { this.hasQualifiedName("", "Xunit") } } /** An xUnit test attribute. */ diff --git a/csharp/ql/lib/semmle/code/csharp/security/dataflow/UnsafeDeserializationQuery.qll b/csharp/ql/lib/semmle/code/csharp/security/dataflow/UnsafeDeserializationQuery.qll index 6f75a712386..73b23acfb29 100644 --- a/csharp/ql/lib/semmle/code/csharp/security/dataflow/UnsafeDeserializationQuery.qll +++ b/csharp/ql/lib/semmle/code/csharp/security/dataflow/UnsafeDeserializationQuery.qll @@ -162,7 +162,7 @@ class TaintToObjectTypeTrackingConfig extends TaintTracking2::Configuration { override predicate isAdditionalTaintStep(DataFlow::Node n1, DataFlow::Node n2) { exists(MethodCall mc, Method m | m = mc.getTarget() and - m.getDeclaringType().hasQualifiedName("System.Type") and + m.getDeclaringType().hasQualifiedName("System", "Type") and m.hasName("GetType") and m.isStatic() and n1.asExpr() = mc.getArgument(0) and diff --git a/csharp/ql/lib/semmle/code/csharp/security/dataflow/ZipSlipQuery.qll b/csharp/ql/lib/semmle/code/csharp/security/dataflow/ZipSlipQuery.qll index 99f001eb115..de5a5bbd837 100644 --- a/csharp/ql/lib/semmle/code/csharp/security/dataflow/ZipSlipQuery.qll +++ b/csharp/ql/lib/semmle/code/csharp/security/dataflow/ZipSlipQuery.qll @@ -46,7 +46,7 @@ class TaintTrackingConfiguration extends TaintTracking::Configuration { class ArchiveFullNameSource extends Source { ArchiveFullNameSource() { exists(PropertyAccess pa | this.asExpr() = pa | - pa.getTarget().getDeclaringType().hasQualifiedName("System.IO.Compression.ZipArchiveEntry") and + pa.getTarget().getDeclaringType().hasQualifiedName("System.IO.Compression", "ZipArchiveEntry") and pa.getTarget().getName() = "FullName" ) } @@ -56,7 +56,7 @@ class ArchiveFullNameSource extends Source { class ExtractToFileArgSink extends Sink { ExtractToFileArgSink() { exists(MethodCall mc | - mc.getTarget().hasQualifiedName("System.IO.Compression.ZipFileExtensions", "ExtractToFile") and + mc.getTarget().hasQualifiedName("System.IO.Compression", "ZipFileExtensions", "ExtractToFile") and this.asExpr() = mc.getArgumentForName("destinationFileName") ) } @@ -66,9 +66,9 @@ class ExtractToFileArgSink extends Sink { class FileOpenArgSink extends Sink { FileOpenArgSink() { exists(MethodCall mc | - mc.getTarget().hasQualifiedName("System.IO.File", "Open") or - mc.getTarget().hasQualifiedName("System.IO.File", "OpenWrite") or - mc.getTarget().hasQualifiedName("System.IO.File", "Create") + mc.getTarget().hasQualifiedName("System.IO", "File", "Open") or + mc.getTarget().hasQualifiedName("System.IO", "File", "OpenWrite") or + mc.getTarget().hasQualifiedName("System.IO", "File", "Create") | this.asExpr() = mc.getArgumentForName("path") ) @@ -79,7 +79,7 @@ class FileOpenArgSink extends Sink { class FileStreamArgSink extends Sink { FileStreamArgSink() { exists(ObjectCreation oc | - oc.getTarget().getDeclaringType().hasQualifiedName("System.IO.FileStream") + oc.getTarget().getDeclaringType().hasQualifiedName("System.IO", "FileStream") | this.asExpr() = oc.getArgumentForName("path") ) @@ -94,7 +94,7 @@ class FileStreamArgSink extends Sink { class FileInfoArgSink extends Sink { FileInfoArgSink() { exists(ObjectCreation oc | - oc.getTarget().getDeclaringType().hasQualifiedName("System.IO.FileInfo") + oc.getTarget().getDeclaringType().hasQualifiedName("System.IO", "FileInfo") | this.asExpr() = oc.getArgumentForName("fileName") ) @@ -108,7 +108,7 @@ class FileInfoArgSink extends Sink { */ class GetFileNameSanitizer extends Sanitizer { GetFileNameSanitizer() { - exists(MethodCall mc | mc.getTarget().hasQualifiedName("System.IO.Path", "GetFileName") | + exists(MethodCall mc | mc.getTarget().hasQualifiedName("System.IO", "Path", "GetFileName") | this.asExpr() = mc ) } @@ -122,19 +122,19 @@ class GetFileNameSanitizer extends Sanitizer { */ class SubstringSanitizer extends Sanitizer { SubstringSanitizer() { - exists(MethodCall mc | mc.getTarget().hasQualifiedName("System.String", "Substring") | + exists(MethodCall mc | mc.getTarget().hasQualifiedName("System", "String", "Substring") | this.asExpr() = mc ) } } private predicate stringCheckGuard(Guard g, Expr e, AbstractValue v) { - g.(MethodCall).getTarget().hasQualifiedName("System.String", "StartsWith") and + g.(MethodCall).getTarget().hasQualifiedName("System", "String", "StartsWith") and g.(MethodCall).getQualifier() = e and // A StartsWith check against Path.Combine is not sufficient, because the ".." elements have // not yet been resolved. not exists(MethodCall combineCall | - combineCall.getTarget().hasQualifiedName("System.IO.Path", "Combine") and + combineCall.getTarget().hasQualifiedName("System.IO", "Path", "Combine") and DataFlow::localExprFlow(combineCall, e) ) and v.(AbstractValues::BooleanValue).getValue() = true diff --git a/csharp/ql/lib/semmle/code/csharp/security/xml/InsecureXMLQuery.qll b/csharp/ql/lib/semmle/code/csharp/security/xml/InsecureXMLQuery.qll index 53fe605b963..d1330bcb97d 100644 --- a/csharp/ql/lib/semmle/code/csharp/security/xml/InsecureXMLQuery.qll +++ b/csharp/ql/lib/semmle/code/csharp/security/xml/InsecureXMLQuery.qll @@ -47,7 +47,7 @@ abstract class InsecureXmlProcessing extends Call { */ private predicate isSafeXmlResolver(Expr e) { e instanceof NullLiteral or - e.getType().(RefType).hasQualifiedName("System.Xml.XmlSecureResolver") + e.getType().(RefType).hasQualifiedName("System.Xml", "XmlSecureResolver") } /** @@ -145,14 +145,16 @@ module XmlReader { private import semmle.code.csharp.dataflow.DataFlow2 private class InsecureXmlReaderCreate extends InsecureXmlProcessing, MethodCall { - InsecureXmlReaderCreate() { this.getTarget().hasQualifiedName("System.Xml.XmlReader.Create") } + InsecureXmlReaderCreate() { + this.getTarget().hasQualifiedName("System.Xml.XmlReader", "Create") + } /** * Gets the `XmlReaderSettings` argument to to this call, if any. */ Expr getSettings() { result = this.getAnArgument() and - result.getType().(RefType).getABaseType*().hasQualifiedName("System.Xml.XmlReaderSettings") + result.getType().(RefType).getABaseType*().hasQualifiedName("System.Xml", "XmlReaderSettings") } override predicate isUnsafe(string reason) { @@ -197,7 +199,7 @@ module XmlReader { .getType() .(RefType) .getABaseType*() - .hasQualifiedName("System.Xml.XmlReaderSettings") + .hasQualifiedName("System.Xml", "XmlReaderSettings") } override predicate isSink(DataFlow::Node sink) { @@ -209,7 +211,7 @@ module XmlReader { /** Provides predicates related to `System.Xml.XmlTextReader`. */ module XmlTextReader { private class InsecureXmlTextReader extends InsecureXmlProcessing, ObjectCreation { - InsecureXmlTextReader() { this.getObjectType().hasQualifiedName("System.Xml.XmlTextReader") } + InsecureXmlTextReader() { this.getObjectType().hasQualifiedName("System.Xml", "XmlTextReader") } override predicate isUnsafe(string reason) { not exists(Expr xmlResolverVal | @@ -244,8 +246,8 @@ module XmlDocument { */ class InsecureXmlDocument extends InsecureXmlProcessing, MethodCall { InsecureXmlDocument() { - this.getTarget().hasQualifiedName("System.Xml.XmlDocument.Load") or - this.getTarget().hasQualifiedName("System.Xml.XmlDocument.LoadXml") + this.getTarget().hasQualifiedName("System.Xml", "XmlDocument", "Load") or + this.getTarget().hasQualifiedName("System.Xml", "XmlDocument", "LoadXml") } override predicate isUnsafe(string reason) { diff --git a/csharp/ql/lib/semmle/code/csharp/serialization/Deserializers.qll b/csharp/ql/lib/semmle/code/csharp/serialization/Deserializers.qll index 8e026f03a0f..af3cdfc28bb 100644 --- a/csharp/ql/lib/semmle/code/csharp/serialization/Deserializers.qll +++ b/csharp/ql/lib/semmle/code/csharp/serialization/Deserializers.qll @@ -90,7 +90,7 @@ private class WrapperDeserializer extends UnsafeDeserializer { /** BinaryFormatter */ private class BinaryFormatterClass extends Class { BinaryFormatterClass() { - this.hasQualifiedName("System.Runtime.Serialization.Formatters.Binary.BinaryFormatter") + this.hasQualifiedName("System.Runtime.Serialization.Formatters.Binary", "BinaryFormatter") } } @@ -121,7 +121,7 @@ class BinaryFormatterUnsafeDeserializeMethodResponseMethod extends Method, Unsaf /** SoapFormatter */ private class SoapFormatterClass extends Class { SoapFormatterClass() { - this.hasQualifiedName("System.Runtime.Serialization.Formatters.Soap.SoapFormatter") + this.hasQualifiedName("System.Runtime.Serialization.Formatters.Soap", "SoapFormatter") } } @@ -135,7 +135,7 @@ class SoapFormatterDeserializeMethod extends Method, UnsafeDeserializer { /** ObjectStateFormatter */ private class ObjectStateFormatterClass extends Class { - ObjectStateFormatterClass() { this.hasQualifiedName("System.Web.UI.ObjectStateFormatter") } + ObjectStateFormatterClass() { this.hasQualifiedName("System.Web.UI", "ObjectStateFormatter") } } /** `System.Web.UI.ObjectStateFormatter.Deserialize` method */ @@ -149,7 +149,7 @@ class ObjectStateFormatterDeserializeMethod extends Method, UnsafeDeserializer { /** NetDataContractSerializer */ class NetDataContractSerializerClass extends Class { NetDataContractSerializerClass() { - this.hasQualifiedName("System.Runtime.Serialization.NetDataContractSerializer") + this.hasQualifiedName("System.Runtime.Serialization", "NetDataContractSerializer") } } @@ -172,7 +172,7 @@ class NetDataContractSerializerReadObjectMethod extends Method, UnsafeDeserializ /** DataContractJsonSerializer */ class DataContractJsonSerializerClass extends Class { DataContractJsonSerializerClass() { - this.hasQualifiedName("System.Runtime.Serialization.Json.DataContractJsonSerializer") + this.hasQualifiedName("System.Runtime.Serialization.Json", "DataContractJsonSerializer") } } @@ -187,7 +187,7 @@ class DataContractJsonSerializerReadObjectMethod extends Method, UnsafeDeseriali /** JavaScriptSerializer */ class JavaScriptSerializerClass extends Class { JavaScriptSerializerClass() { - this.hasQualifiedName("System.Web.Script.Serialization.JavaScriptSerializer") + this.hasQualifiedName("System.Web.Script.Serialization", "JavaScriptSerializer") } } @@ -210,7 +210,7 @@ class JavaScriptSerializerClassDeserializeObjectMethod extends Method, UnsafeDes /** XmlObjectSerializer */ class XmlObjectSerializerClass extends Class { XmlObjectSerializerClass() { - this.hasQualifiedName("System.Runtime.Serialization.XmlObjectSerializer") + this.hasQualifiedName("System.Runtime.Serialization", "XmlObjectSerializer") } } @@ -224,7 +224,7 @@ class XmlObjectSerializerReadObjectMethod extends Method, UnsafeDeserializer { /** XmlSerializer */ class XmlSerializerClass extends Class { - XmlSerializerClass() { this.hasQualifiedName("System.Xml.Serialization.XmlSerializer") } + XmlSerializerClass() { this.hasQualifiedName("System.Xml.Serialization", "XmlSerializer") } } /** `System.Xml.Serialization.XmlSerializer.Deserialize` method */ @@ -238,7 +238,7 @@ class XmlSerializerDeserializeMethod extends Method, UnsafeDeserializer { /** DataContractSerializer */ class DataContractSerializerClass extends Class { DataContractSerializerClass() { - this.hasQualifiedName("System.Runtime.Serialization.DataContractSerializer") + this.hasQualifiedName("System.Runtime.Serialization", "DataContractSerializer") } } @@ -252,7 +252,7 @@ class DataContractSerializerReadObjectMethod extends Method, UnsafeDeserializer /** XmlMessageFormatter */ class XmlMessageFormatterClass extends Class { - XmlMessageFormatterClass() { this.hasQualifiedName("System.Messaging.XmlMessageFormatter") } + XmlMessageFormatterClass() { this.hasQualifiedName("System.Messaging", "XmlMessageFormatter") } } /** `System.Messaging.XmlMessageFormatter.Read` method */ @@ -265,7 +265,7 @@ class XmlMessageFormatterReadMethod extends Method, UnsafeDeserializer { /** LosFormatter */ private class LosFormatterClass extends Class { - LosFormatterClass() { this.hasQualifiedName("System.Web.UI.LosFormatter") } + LosFormatterClass() { this.hasQualifiedName("System.Web.UI", "LosFormatter") } } /** `System.Web.UI.LosFormatter.Deserialize` method */ @@ -278,7 +278,7 @@ class LosFormatterDeserializeMethod extends Method, UnsafeDeserializer { /** fastJSON */ private class FastJsonClass extends Class { - FastJsonClass() { this.hasQualifiedName("fastJSON.JSON") } + FastJsonClass() { this.hasQualifiedName("fastJSON", "JSON") } } /** `fastJSON.JSON.ToObject` method */ @@ -292,7 +292,7 @@ class FastJsonClassToObjectMethod extends Method, UnsafeDeserializer { /** Activity */ private class ActivityClass extends Class { - ActivityClass() { this.hasQualifiedName("System.Workflow.ComponentModel.Activity") } + ActivityClass() { this.hasQualifiedName("System.Workflow.ComponentModel", "Activity") } } /** `System.Workflow.ComponentModel.Activity.Load` method */ @@ -305,7 +305,7 @@ class ActivityLoadMethod extends Method, UnsafeDeserializer { /** ResourceReader */ private class ResourceReaderClass extends Class { - ResourceReaderClass() { this.hasQualifiedName("System.Resources.ResourceReader") } + ResourceReaderClass() { this.hasQualifiedName("System.Resources", "ResourceReader") } } /** `System.Resources.ResourceReader` constructor */ @@ -318,7 +318,9 @@ class ResourceReaderConstructor extends Constructor, UnsafeDeserializer { /** BinaryMessageFormatter */ private class BinaryMessageFormatterClass extends Class { - BinaryMessageFormatterClass() { this.hasQualifiedName("System.Messaging.BinaryMessageFormatter") } + BinaryMessageFormatterClass() { + this.hasQualifiedName("System.Messaging", "BinaryMessageFormatter") + } } /** `System.Messaging.BinaryMessageFormatter.Read` method */ @@ -331,7 +333,7 @@ class BinaryMessageFormatterReadMethod extends Method, UnsafeDeserializer { /** XamlReader */ private class XamlReaderClass extends Class { - XamlReaderClass() { this.hasQualifiedName("System.Windows.Markup.XamlReader") } + XamlReaderClass() { this.hasQualifiedName("System.Windows.Markup", "XamlReader") } } /** `System.Windows.Markup.XamlReader.Parse` method */ @@ -362,7 +364,7 @@ class XamlReaderLoadAsyncMethod extends Method, UnsafeDeserializer { /** ProxyObject */ private class ProxyObjectClass extends Class { - ProxyObjectClass() { this.hasQualifiedName("Microsoft.Web.Design.Remote.ProxyObject") } + ProxyObjectClass() { this.hasQualifiedName("Microsoft.Web.Design.Remote", "ProxyObject") } } /** `Microsoft.Web.Design.Remote.ProxyObject.DecodeValue` method */ @@ -383,7 +385,7 @@ class ProxyObjectDecodeSerializedObjectMethod extends Method, UnsafeDeserializer /** SweetJayson */ private class JaysonConverterClass extends Class { - JaysonConverterClass() { this.hasQualifiedName("Sweet.Jayson.JaysonConverter") } + JaysonConverterClass() { this.hasQualifiedName("Sweet.Jayson", "JaysonConverter") } } /** `Sweet.Jayson.JaysonConverter.ToObject` method */ @@ -398,7 +400,7 @@ class JaysonConverterToObjectMethod extends Method, UnsafeDeserializer { /** ServiceStack.Text.JsonSerializer */ private class ServiceStackTextJsonSerializerClass extends Class { ServiceStackTextJsonSerializerClass() { - this.hasQualifiedName("ServiceStack.Text.JsonSerializer") + this.hasQualifiedName("ServiceStack.Text", "JsonSerializer") } } @@ -432,7 +434,7 @@ class ServiceStackTextJsonSerializerDeserializeFromStreamMethod extends Method, /** ServiceStack.Text.TypeSerializer */ private class ServiceStackTextTypeSerializerClass extends Class { ServiceStackTextTypeSerializerClass() { - this.hasQualifiedName("ServiceStack.Text.TypeSerializer") + this.hasQualifiedName("ServiceStack.Text", "TypeSerializer") } } @@ -465,7 +467,9 @@ class ServiceStackTextTypeSerializerDeserializeFromStreamMethod extends Method, /** ServiceStack.Text.CsvSerializer */ private class ServiceStackTextCsvSerializerClass extends Class { - ServiceStackTextCsvSerializerClass() { this.hasQualifiedName("ServiceStack.Text.CsvSerializer") } + ServiceStackTextCsvSerializerClass() { + this.hasQualifiedName("ServiceStack.Text", "CsvSerializer") + } } /** `ServiceStack.Text.CsvSerializer.DeserializeFromString` method */ @@ -497,7 +501,9 @@ class ServiceStackTextCsvSerializerDeserializeFromStreamMethod extends Method, U /** ServiceStack.Text.XmlSerializer */ private class ServiceStackTextXmlSerializerClass extends Class { - ServiceStackTextXmlSerializerClass() { this.hasQualifiedName("ServiceStack.Text.XmlSerializer") } + ServiceStackTextXmlSerializerClass() { + this.hasQualifiedName("ServiceStack.Text", "XmlSerializer") + } } /** `ServiceStack.Text.XmlSerializer.DeserializeFromString` method */ @@ -529,7 +535,7 @@ class ServiceStackTextXmlSerializerDeserializeFromStreamMethod extends Method, U /** MBrace.FsPickler.FsPicklerSerializer */ private class FsPicklerSerializerClass extends Class { - FsPicklerSerializerClass() { this.hasQualifiedName("MBrace.FsPickler.FsPicklerSerializer") } + FsPicklerSerializerClass() { this.hasQualifiedName("MBrace.FsPickler", "FsPicklerSerializer") } } /** `MBrace.FsPickler.FsPicklerSerializer.Deserialize` method */ @@ -598,7 +604,7 @@ class FsPicklerSerializerClassUnPickleUntypedMethod extends Method, UnsafeDeseri /** MBrace.CsPickler.CsPicklerSerializer */ private class CsPicklerSerializerClass extends Class { - CsPicklerSerializerClass() { this.hasQualifiedName("MBrace.CsPickler.CsPicklerSerializer") } + CsPicklerSerializerClass() { this.hasQualifiedName("MBrace.CsPickler", "CsPicklerSerializer") } } /** `MBrace.FsPickler.CsPicklerSerializer.Deserialize` method */ @@ -620,7 +626,7 @@ class CsPicklerSerializerClassUnPickleMethod extends Method, UnsafeDeserializer /** MBrace.CsPickler.CsPicklerTextSerializer */ private class CsPicklerTextSerializerClass extends Class { CsPicklerTextSerializerClass() { - this.hasQualifiedName("MBrace.CsPickler.CsPicklerTextSerializer") + this.hasQualifiedName("MBrace.CsPickler", "CsPicklerTextSerializer") } } @@ -634,7 +640,7 @@ class CsPicklerSerializerClassUnPickleOfStringMethod extends Method, UnsafeDeser /** Polenter.Serialization.SharpSerializer */ private class SharpSerializerClass extends Class { - SharpSerializerClass() { this.hasQualifiedName("Polenter.Serialization.SharpSerializer") } + SharpSerializerClass() { this.hasQualifiedName("Polenter.Serialization", "SharpSerializer") } } /** `Polenter.Serialization.SharpSerializer.Deserialize` method */ @@ -647,7 +653,9 @@ class SharpSerializerClassDeserializeMethod extends Method, UnsafeDeserializer { /** YamlDotNet.Serialization.Deserializer */ private class YamlDotNetDeserializerClass extends Class { - YamlDotNetDeserializerClass() { this.hasQualifiedName("YamlDotNet.Serialization.Deserializer") } + YamlDotNetDeserializerClass() { + this.hasQualifiedName("YamlDotNet.Serialization", "Deserializer") + } } /** `YamlDotNet.Serialization.Deserializer.Deserialize` method */ diff --git a/csharp/ql/src/API Abuse/CallToGCCollect.ql b/csharp/ql/src/API Abuse/CallToGCCollect.ql index 4ffef9caa0a..a10e7dd238f 100644 --- a/csharp/ql/src/API Abuse/CallToGCCollect.ql +++ b/csharp/ql/src/API Abuse/CallToGCCollect.ql @@ -16,5 +16,5 @@ where c.getTarget() = gcCollect and gcCollect.hasName("Collect") and gcCollect.hasNoParameters() and - gcCollect.getDeclaringType().hasQualifiedName("System.GC") + gcCollect.getDeclaringType().hasQualifiedName("System", "GC") select c, "Call to 'GC.Collect()'." diff --git a/csharp/ql/src/Bad Practices/LeftoverDebugCode.ql b/csharp/ql/src/Bad Practices/LeftoverDebugCode.ql index c4fdee86eb8..d2cee805c04 100644 --- a/csharp/ql/src/Bad Practices/LeftoverDebugCode.ql +++ b/csharp/ql/src/Bad Practices/LeftoverDebugCode.ql @@ -19,6 +19,6 @@ where m.fromSource() and exists(UsingNamespaceDirective u | u.getFile() = m.getFile() and - u.getImportedNamespace().hasQualifiedName("System.Web") + u.getImportedNamespace().hasQualifiedName("System", "Web") ) select m, "Remove debug code if your ASP.NET application is in production." diff --git a/csharp/ql/src/Bad Practices/Naming Conventions/DefaultControlNames.ql b/csharp/ql/src/Bad Practices/Naming Conventions/DefaultControlNames.ql index 2bf51653d99..53660128959 100644 --- a/csharp/ql/src/Bad Practices/Naming Conventions/DefaultControlNames.ql +++ b/csharp/ql/src/Bad Practices/Naming Conventions/DefaultControlNames.ql @@ -29,7 +29,7 @@ predicate usedInHumanWrittenCode(Field f) { from Field field, ValueOrRefType widget, string prefix where - widget.getABaseType*().hasQualifiedName("System.Windows.Forms.Control") and + widget.getABaseType*().hasQualifiedName("System.Windows.Forms", "Control") and field.getType() = widget and field.getName().regexpMatch(prefix + "[0-9]+") and controlName(prefix) and diff --git a/csharp/ql/src/Bad Practices/UseOfSystemOutputStream.ql b/csharp/ql/src/Bad Practices/UseOfSystemOutputStream.ql index 05424066c41..fbf9ea069ea 100644 --- a/csharp/ql/src/Bad Practices/UseOfSystemOutputStream.ql +++ b/csharp/ql/src/Bad Practices/UseOfSystemOutputStream.ql @@ -14,30 +14,30 @@ import semmle.code.csharp.commons.Util predicate isConsoleOutRedefinedSomewhere() { exists(MethodCall mc | mc.getTarget().hasName("SetOut") and - mc.getTarget().getDeclaringType().hasQualifiedName("System.Console") + mc.getTarget().getDeclaringType().hasQualifiedName("System", "Console") ) } predicate isConsoleErrorRedefinedSomewhere() { exists(MethodCall mc | mc.getTarget().hasName("SetError") and - mc.getTarget().getDeclaringType().hasQualifiedName("System.Console") + mc.getTarget().getDeclaringType().hasQualifiedName("System", "Console") ) } predicate isCallToConsoleWrite(MethodCall mc) { mc.getTarget().getName().matches("Write%") and - mc.getTarget().getDeclaringType().hasQualifiedName("System.Console") + mc.getTarget().getDeclaringType().hasQualifiedName("System", "Console") } predicate isAccessToConsoleOut(PropertyAccess pa) { pa.getTarget().hasName("Out") and - pa.getTarget().getDeclaringType().hasQualifiedName("System.Console") + pa.getTarget().getDeclaringType().hasQualifiedName("System", "Console") } predicate isAccessToConsoleError(PropertyAccess pa) { pa.getTarget().hasName("Error") and - pa.getTarget().getDeclaringType().hasQualifiedName("System.Console") + pa.getTarget().getDeclaringType().hasQualifiedName("System", "Console") } from Expr e diff --git a/csharp/ql/src/Concurrency/Concurrency.qll b/csharp/ql/src/Concurrency/Concurrency.qll index b2d5e97f28e..da14cfdb8e5 100644 --- a/csharp/ql/src/Concurrency/Concurrency.qll +++ b/csharp/ql/src/Concurrency/Concurrency.qll @@ -5,7 +5,7 @@ import csharp private class WaitCall extends MethodCall { WaitCall() { this.getTarget().hasName("Wait") and - this.getTarget().getDeclaringType().hasQualifiedName("System.Threading.Monitor") + this.getTarget().getDeclaringType().hasQualifiedName("System.Threading", "Monitor") } Expr getExpr() { result = this.getArgument(0) } @@ -30,12 +30,12 @@ class WaitStmt extends ExprStmt { private class SynchronizedMethodAttribute extends Attribute { SynchronizedMethodAttribute() { - this.getType().hasQualifiedName("System.Runtime.CompilerServices.MethodImplAttribute") and + this.getType().hasQualifiedName("System.Runtime.CompilerServices", "MethodImplAttribute") and exists(MemberConstantAccess a, MemberConstant mc | a = this.getArgument(0) and a.getTarget() = mc and mc.hasName("Synchronized") and - mc.getDeclaringType().hasQualifiedName("System.Runtime.CompilerServices.MethodImplOptions") + mc.getDeclaringType().hasQualifiedName("System.Runtime.CompilerServices", "MethodImplOptions") ) } } diff --git a/csharp/ql/src/Dead Code/DeadCode.qll b/csharp/ql/src/Dead Code/DeadCode.qll index dd0f6104e31..0718312867f 100644 --- a/csharp/ql/src/Dead Code/DeadCode.qll +++ b/csharp/ql/src/Dead Code/DeadCode.qll @@ -26,7 +26,7 @@ Expr getAnAccessByDynamicCall(Method m) { exists(MethodCall mc, Method target | target = mc.getTarget() and target.hasName("InvokeMember") and - target.getDeclaringType().hasQualifiedName("System.Type") and + target.getDeclaringType().hasQualifiedName("System", "Type") and mc.getArgument(0).(StringLiteral).getValue() = m.getName() and mc.getArgument(3).getType().(RefType).hasMethod(m) and result = mc @@ -42,7 +42,7 @@ Expr getAMethodAccess(Method m) { predicate potentiallyAccessedByForEach(Method m) { m.hasName("GetEnumerator") and - m.getDeclaringType().getABaseType+().hasQualifiedName("System.Collections.IEnumerable") + m.getDeclaringType().getABaseType+().hasQualifiedName("System.Collections", "IEnumerable") or foreach_stmt_desugar(_, m, 1) } diff --git a/csharp/ql/src/Dead Code/DeadRefTypes.ql b/csharp/ql/src/Dead Code/DeadRefTypes.ql index f3949891271..4ff5809167c 100644 --- a/csharp/ql/src/Dead Code/DeadRefTypes.ql +++ b/csharp/ql/src/Dead Code/DeadRefTypes.ql @@ -24,7 +24,7 @@ predicate potentiallyUsedFromXaml(RefType t) { class ExportAttribute extends Attribute { ExportAttribute() { - getType().hasQualifiedName("System.ComponentModel.Composition.ExportAttribute") + getType().hasQualifiedName("System.ComponentModel.Composition", "ExportAttribute") } } diff --git a/csharp/ql/src/Documentation/XmldocMissingException.ql b/csharp/ql/src/Documentation/XmldocMissingException.ql index a5c06c598c7..f336868bf12 100644 --- a/csharp/ql/src/Documentation/XmldocMissingException.ql +++ b/csharp/ql/src/Documentation/XmldocMissingException.ql @@ -11,6 +11,14 @@ import Documentation +private string getNameSplitter() { result = "(.*)\\.([^\\.]+)$" } + +bindingset[name] +private predicate splitExceptionName(string name, string namespace, string type) { + namespace = name.regexpCapture(getNameSplitter(), 1) and + type = name.regexpCapture(getNameSplitter(), 2) +} + from SourceMethodOrConstructor m, ThrowElement throw, RefType throwType where declarationHasXmlComment(m) and @@ -20,8 +28,15 @@ where comment = getADeclarationXmlComment(m) and exceptionName = comment.getCref(offset) and throwType.getABaseType*() = throwBaseType and - (throwBaseType.hasName(exceptionName) or throwBaseType.hasQualifiedName(exceptionName)) - // and comment.hasBody(offset) // Too slow + ( + throwBaseType.hasName(exceptionName) + or + exists(string namespace, string type | + splitExceptionName(exceptionName, namespace, type) and + throwBaseType.hasQualifiedName(namespace, type) + ) + // and comment.hasBody(offset) // Too slow + ) ) and not getADeclarationXmlComment(m) instanceof InheritDocXmlComment select m, "Exception $@ should be documented.", throw, throw.getExpr().getType().getName() diff --git a/csharp/ql/src/Likely Bugs/Collections/ContainerSizeCmpZero.ql b/csharp/ql/src/Likely Bugs/Collections/ContainerSizeCmpZero.ql index 23f786be49a..9ee37583eb7 100644 --- a/csharp/ql/src/Likely Bugs/Collections/ContainerSizeCmpZero.ql +++ b/csharp/ql/src/Likely Bugs/Collections/ContainerSizeCmpZero.ql @@ -13,9 +13,9 @@ import csharp import semmle.code.csharp.commons.Assertions -private predicate propertyOverrides(Property p, string baseClass, string property) { +private predicate propertyOverrides(Property p, string namespace, string baseClass, string property) { exists(Property p2 | - p2.getUnboundDeclaration().getDeclaringType().hasQualifiedName(baseClass) and + p2.getUnboundDeclaration().getDeclaringType().hasQualifiedName(namespace, baseClass) and p2.hasName(property) | p.overridesOrImplementsOrEquals(p2) @@ -24,16 +24,16 @@ private predicate propertyOverrides(Property p, string baseClass, string propert private predicate containerSizeAccess(PropertyAccess pa, string containerKind) { ( - propertyOverrides(pa.getTarget(), "System.Collections.Generic.ICollection<>", "Count") or - propertyOverrides(pa.getTarget(), "System.Collections.Generic.IReadOnlyCollection<>", "Count") or - propertyOverrides(pa.getTarget(), "System.Collections.ICollection", "Count") + propertyOverrides(pa.getTarget(), "System.Collections.Generic", "ICollection<>", "Count") or + propertyOverrides(pa.getTarget(), "System.Collections.Generic", "IReadOnlyCollection<>", "Count") or + propertyOverrides(pa.getTarget(), "System.Collections", "ICollection", "Count") ) and containerKind = "a collection" or ( - propertyOverrides(pa.getTarget(), "System.String", "Length") and containerKind = "a string" + propertyOverrides(pa.getTarget(), "System", "String", "Length") and containerKind = "a string" or - propertyOverrides(pa.getTarget(), "System.Array", "Length") and containerKind = "an array" + propertyOverrides(pa.getTarget(), "System", "Array", "Length") and containerKind = "an array" ) } diff --git a/csharp/ql/src/Likely Bugs/LeapYear/UnsafeYearConstruction.ql b/csharp/ql/src/Likely Bugs/LeapYear/UnsafeYearConstruction.ql index 838406ab82e..814ccd99e4e 100644 --- a/csharp/ql/src/Likely Bugs/LeapYear/UnsafeYearConstruction.ql +++ b/csharp/ql/src/Likely Bugs/LeapYear/UnsafeYearConstruction.ql @@ -20,14 +20,14 @@ class UnsafeYearCreationFromArithmeticConfiguration extends TaintTracking::Confi override predicate isSource(DataFlow::Node source) { exists(ArithmeticOperation ao, PropertyAccess pa | ao = source.asExpr() | pa = ao.getAChild*() and - pa.getProperty().hasQualifiedName("System.DateTime.Year") + pa.getProperty().hasQualifiedName("System.DateTime", "Year") ) } override predicate isSink(DataFlow::Node sink) { exists(ObjectCreation oc | sink.asExpr() = oc.getArgumentForName("year") and - oc.getObjectType().getABaseType*().hasQualifiedName("System.DateTime") + oc.getObjectType().getABaseType*().hasQualifiedName("System", "DateTime") ) } } diff --git a/csharp/ql/src/Likely Bugs/MishandlingJapaneseEra.ql b/csharp/ql/src/Likely Bugs/MishandlingJapaneseEra.ql index 0f4c5f0d1a0..6699f863631 100644 --- a/csharp/ql/src/Likely Bugs/MishandlingJapaneseEra.ql +++ b/csharp/ql/src/Likely Bugs/MishandlingJapaneseEra.ql @@ -23,8 +23,8 @@ predicate isEraStart(int year, int month, int day) { predicate isExactEraStartDateCreation(ObjectCreation cr) { ( - cr.getType().hasQualifiedName("System.DateTime") or - cr.getType().hasQualifiedName("System.DateTimeOffset") + cr.getType().hasQualifiedName("System", "DateTime") or + cr.getType().hasQualifiedName("System", "DateTimeOffset") ) and isEraStart(cr.getArgument(0).getValue().toInt(), cr.getArgument(1).getValue().toInt(), cr.getArgument(2).getValue().toInt()) @@ -32,8 +32,10 @@ predicate isExactEraStartDateCreation(ObjectCreation cr) { predicate isDateFromJapaneseCalendarToDateTime(MethodCall mc) { ( - mc.getQualifier().getType().hasQualifiedName("System.Globalization.JapaneseCalendar") or - mc.getQualifier().getType().hasQualifiedName("System.Globalization.JapaneseLunisolarCalendar") + mc.getQualifier().getType().hasQualifiedName("System.Globalization", "JapaneseCalendar") or + mc.getQualifier() + .getType() + .hasQualifiedName("System.Globalization", "JapaneseLunisolarCalendar") ) and mc.getTarget().hasName("ToDateTime") and mc.getArgument(0).hasValue() and @@ -47,16 +49,16 @@ predicate isDateFromJapaneseCalendarToDateTime(MethodCall mc) { predicate isDateFromJapaneseCalendarCreation(ObjectCreation cr) { ( - cr.getType().hasQualifiedName("System.DateTime") or - cr.getType().hasQualifiedName("System.DateTimeOffset") + cr.getType().hasQualifiedName("System", "DateTime") or + cr.getType().hasQualifiedName("System", "DateTimeOffset") ) and ( cr.getArgumentForName("calendar") .getType() - .hasQualifiedName("System.Globalization.JapaneseCalendar") or + .hasQualifiedName("System.Globalization", "JapaneseCalendar") or cr.getArgumentForName("calendar") .getType() - .hasQualifiedName("System.Globalization.JapaneseLunisolarCalendar") + .hasQualifiedName("System.Globalization", "JapaneseLunisolarCalendar") ) and cr.getArgumentForName("year").hasValue() } diff --git a/csharp/ql/src/Security Features/CWE-091/XMLInjection.ql b/csharp/ql/src/Security Features/CWE-091/XMLInjection.ql index 038dc267d14..c537a85c1f1 100644 --- a/csharp/ql/src/Security Features/CWE-091/XMLInjection.ql +++ b/csharp/ql/src/Security Features/CWE-091/XMLInjection.ql @@ -27,7 +27,7 @@ class TaintTrackingConfiguration extends TaintTracking::Configuration { override predicate isSink(DataFlow::Node sink) { exists(MethodCall mc | mc.getTarget().hasName("WriteRaw") and - mc.getTarget().getDeclaringType().getABaseType*().hasQualifiedName("System.Xml.XmlWriter") + mc.getTarget().getDeclaringType().getABaseType*().hasQualifiedName("System.Xml", "XmlWriter") | mc.getArgument(0) = sink.asExpr() ) @@ -39,7 +39,7 @@ class TaintTrackingConfiguration extends TaintTracking::Configuration { mc.getTarget() .getDeclaringType() .getABaseType*() - .hasQualifiedName("System.Security.SecurityElement") + .hasQualifiedName("System.Security", "SecurityElement") | mc = node.asExpr() ) diff --git a/csharp/ql/src/Security Features/CWE-114/AssemblyPathInjection.ql b/csharp/ql/src/Security Features/CWE-114/AssemblyPathInjection.ql index 3705ece0e72..c0990112188 100644 --- a/csharp/ql/src/Security Features/CWE-114/AssemblyPathInjection.ql +++ b/csharp/ql/src/Security Features/CWE-114/AssemblyPathInjection.ql @@ -34,7 +34,7 @@ class TaintTrackingConfiguration extends TaintTracking::Configuration { mc.getTarget() .getDeclaringType() .getABaseType*() - .hasQualifiedName("System.Reflection.Assembly") and + .hasQualifiedName("System.Reflection", "Assembly") and mc.getArgument(arg) = sink.asExpr() | name = "LoadFrom" and arg = 0 and mc.getNumberOfArguments() = [1 .. 2] diff --git a/csharp/ql/src/Security Features/CWE-327/DontInstallRootCert.ql b/csharp/ql/src/Security Features/CWE-327/DontInstallRootCert.ql index 4f7e04f1175..fefd27727ec 100644 --- a/csharp/ql/src/Security Features/CWE-327/DontInstallRootCert.ql +++ b/csharp/ql/src/Security Features/CWE-327/DontInstallRootCert.ql @@ -21,7 +21,7 @@ class AddCertToRootStoreConfig extends DataFlow::Configuration { exists(ObjectCreation oc | oc = source.asExpr() | oc.getType() .(RefType) - .hasQualifiedName("System.Security.Cryptography.X509Certificates.X509Store") and + .hasQualifiedName("System.Security.Cryptography.X509Certificates", "X509Store") and oc.getArgument(0).(Access).getTarget().hasName("Root") ) } @@ -30,9 +30,10 @@ class AddCertToRootStoreConfig extends DataFlow::Configuration { exists(MethodCall mc | ( mc.getTarget() - .hasQualifiedName("System.Security.Cryptography.X509Certificates.X509Store", "Add") or + .hasQualifiedName("System.Security.Cryptography.X509Certificates", "X509Store", "Add") or mc.getTarget() - .hasQualifiedName("System.Security.Cryptography.X509Certificates.X509Store", "AddRange") + .hasQualifiedName("System.Security.Cryptography.X509Certificates", "X509Store", + "AddRange") ) and sink.asExpr() = mc.getQualifier() ) diff --git a/csharp/ql/src/Security Features/CWE-384/AbandonSession.ql b/csharp/ql/src/Security Features/CWE-384/AbandonSession.ql index ffdb7220f01..e158ac6b366 100644 --- a/csharp/ql/src/Security Features/CWE-384/AbandonSession.ql +++ b/csharp/ql/src/Security Features/CWE-384/AbandonSession.ql @@ -30,7 +30,7 @@ predicate loginMethod(Method m, ControlFlow::SuccessorType flowFrom) { /** The `System.Web.SessionState.HttpSessionState` class. */ class SystemWebSessionStateHttpSessionStateClass extends Class { SystemWebSessionStateHttpSessionStateClass() { - this.hasQualifiedName("System.Web.SessionState.HttpSessionState") + this.hasQualifiedName("System.Web.SessionState", "HttpSessionState") } /** Gets the `Abandon` method. */ diff --git a/csharp/ql/src/experimental/CWE-918/RequestForgery.qll b/csharp/ql/src/experimental/CWE-918/RequestForgery.qll index fd08734fb5f..9dc3fbdf2b9 100644 --- a/csharp/ql/src/experimental/CWE-918/RequestForgery.qll +++ b/csharp/ql/src/experimental/CWE-918/RequestForgery.qll @@ -68,7 +68,7 @@ module RequestForgery { */ private class SystemWebHttpRequestMessageSink extends Sink { SystemWebHttpRequestMessageSink() { - exists(Class c | c.hasQualifiedName("System.Net.Http.HttpRequestMessage") | + exists(Class c | c.hasQualifiedName("System.Net.Http", "HttpRequestMessage") | c.getAConstructor().getACall().getArgument(1) = this.asExpr() ) } @@ -81,7 +81,7 @@ module RequestForgery { private class SystemNetWebRequestCreateSink extends Sink { SystemNetWebRequestCreateSink() { exists(Method m | - m.getDeclaringType().hasQualifiedName("System.Net.WebRequest") and m.hasName("Create") + m.getDeclaringType().hasQualifiedName("System.Net", "WebRequest") and m.hasName("Create") | m.getACall().getArgument(0) = this.asExpr() ) @@ -95,7 +95,7 @@ module RequestForgery { private class SystemNetHttpClientSink extends Sink { SystemNetHttpClientSink() { exists(Method m | - m.getDeclaringType().hasQualifiedName("System.Net.Http.HttpClient") and + m.getDeclaringType().hasQualifiedName("System.Net.Http", "HttpClient") and m.hasName([ "DeleteAsync", "GetAsync", "GetByteArrayAsync", "GetStreamAsync", "GetStringAsync", "PatchAsync", "PostAsync", "PutAsync" @@ -112,10 +112,13 @@ module RequestForgery { */ private class SystemNetClientBaseAddressSink extends Sink { SystemNetClientBaseAddressSink() { - exists(Property p | + exists(Property p, Type t | p.hasName("BaseAddress") and - p.getDeclaringType() - .hasQualifiedName(["System.Net.WebClient", "System.Net.Http.HttpClient"]) + t = p.getDeclaringType() and + ( + t.hasQualifiedName("System.Net", "WebClient") or + t.hasQualifiedName("System.Net.Http", "HttpClient") + ) | p.getAnAssignedValue() = this.asExpr() ) @@ -128,7 +131,7 @@ module RequestForgery { * This guard considers all checks as valid. */ private predicate baseUriGuard(Guard g, Expr e, AbstractValue v) { - g.(MethodCall).getTarget().hasQualifiedName("System.Uri", "IsBaseOf") and + g.(MethodCall).getTarget().hasQualifiedName("System", "Uri", "IsBaseOf") and // we consider any checks against the tainted value to sainitize the taint. // This implies any check such as shown below block the taint flow. // Uri url = new Uri("whitelist.com") @@ -147,7 +150,7 @@ module RequestForgery { * This guard considers all checks as valid. */ private predicate stringStartsWithGuard(Guard g, Expr e, AbstractValue v) { - g.(MethodCall).getTarget().hasQualifiedName("System.String", "StartsWith") and + g.(MethodCall).getTarget().hasQualifiedName("System", "String", "StartsWith") and // Any check such as the ones shown below // "https://myurl.com/".startsWith(`taint`) // `taint`.startsWith("https://myurl.com/") @@ -168,7 +171,7 @@ module RequestForgery { private predicate pathCombineStep(DataFlow::Node prev, DataFlow::Node succ) { exists(MethodCall combineCall | - combineCall.getTarget().hasQualifiedName("System.IO.Path", "Combine") and + combineCall.getTarget().hasQualifiedName("System.IO", "Path", "Combine") and combineCall.getArgument(0) = prev.asExpr() and combineCall = succ.asExpr() ) @@ -176,7 +179,7 @@ module RequestForgery { private predicate uriCreationStep(DataFlow::Node prev, DataFlow::Node succ) { exists(ObjectCreation oc | - oc.getTarget().getDeclaringType().hasQualifiedName("System.Uri") and + oc.getTarget().getDeclaringType().hasQualifiedName("System", "Uri") and oc.getArgument(0) = prev.asExpr() and oc = succ.asExpr() ) @@ -217,7 +220,7 @@ module RequestForgery { private predicate formatConvertStep(DataFlow::Node prev, DataFlow::Node succ) { exists(Method m | - m.hasQualifiedName("System.Convert", + m.hasQualifiedName("System", "Convert", ["FromBase64String", "FromHexString", "FromBase64CharArray"]) and m.getParameter(0) = prev.asParameter() and succ.asExpr() = m.getACall() diff --git a/csharp/ql/src/experimental/Security Features/CWE-327/Azure/UnsafeUsageOfClientSideEncryptionVersion.ql b/csharp/ql/src/experimental/Security Features/CWE-327/Azure/UnsafeUsageOfClientSideEncryptionVersion.ql index eb1cb673ed2..be503fe31d1 100644 --- a/csharp/ql/src/experimental/Security Features/CWE-327/Azure/UnsafeUsageOfClientSideEncryptionVersion.ql +++ b/csharp/ql/src/experimental/Security Features/CWE-327/Azure/UnsafeUsageOfClientSideEncryptionVersion.ql @@ -18,7 +18,7 @@ import csharp */ predicate isCreatingAzureClientSideEncryptionObject(ObjectCreation oc, Class c, Expr e) { exists(Parameter p | p.hasName("version") | - c.hasQualifiedName("Azure.Storage.ClientSideEncryptionOptions") and + c.hasQualifiedName("Azure.Storage", "ClientSideEncryptionOptions") and oc.getTarget() = c.getAConstructor() and e = oc.getArgumentForParameter(p) ) @@ -28,7 +28,7 @@ predicate isCreatingAzureClientSideEncryptionObject(ObjectCreation oc, Class c, * Holds if `oc` is an object creation of the outdated type `c` = `Microsoft.Azure.Storage.Blob.BlobEncryptionPolicy` */ predicate isCreatingOutdatedAzureClientSideEncryptionObject(ObjectCreation oc, Class c) { - c.hasQualifiedName("Microsoft.Azure.Storage.Blob.BlobEncryptionPolicy") and + c.hasQualifiedName("Microsoft.Azure.Storage.Blob", "BlobEncryptionPolicy") and oc.getTarget() = c.getAConstructor() } @@ -62,7 +62,7 @@ predicate isObjectCreationArgumentSafeAndUsingSafeVersionOfAssembly(Expr version */ predicate isExprAnAccessToSafeClientSideEncryptionVersionValue(Expr e) { exists(EnumConstant ec | - ec.hasQualifiedName("Azure.Storage.ClientSideEncryptionVersion.V2_0") and + ec.hasQualifiedName("Azure.Storage.ClientSideEncryptionVersion", "V2_0") and ec.getAnAccess() = e ) } diff --git a/csharp/ql/src/experimental/Security Features/CWE-759/HashWithoutSalt.ql b/csharp/ql/src/experimental/Security Features/CWE-759/HashWithoutSalt.ql index edcbf425497..a833ac79898 100644 --- a/csharp/ql/src/experimental/Security Features/CWE-759/HashWithoutSalt.ql +++ b/csharp/ql/src/experimental/Security Features/CWE-759/HashWithoutSalt.ql @@ -96,10 +96,10 @@ predicate hasAnotherHashCall(MethodCall mc) { predicate hasFurtherProcessing(MethodCall mc) { mc.getTarget().fromLibrary() and ( - mc.getTarget().hasQualifiedName("System.Array", "Copy") or // Array.Copy(passwordHash, 0, password.Length), 0, key, 0, keyLen); - mc.getTarget().hasQualifiedName("System.String", "Concat") or // string.Concat(passwordHash, saltkey) - mc.getTarget().hasQualifiedName("System.Buffer", "BlockCopy") or // Buffer.BlockCopy(passwordHash, 0, allBytes, 0, 20) - mc.getTarget().hasQualifiedName("System.String", "Format") // String.Format("{0}:{1}:{2}", username, salt, password) + mc.getTarget().hasQualifiedName("System", "Array", "Copy") or // Array.Copy(passwordHash, 0, password.Length), 0, key, 0, keyLen); + mc.getTarget().hasQualifiedName("System", "String", "Concat") or // string.Concat(passwordHash, saltkey) + mc.getTarget().hasQualifiedName("System", "Buffer", "BlockCopy") or // Buffer.BlockCopy(passwordHash, 0, allBytes, 0, 20) + mc.getTarget().hasQualifiedName("System", "String", "Format") // String.Format("{0}:{1}:{2}", username, salt, password) ) } @@ -150,7 +150,7 @@ class HashWithoutSaltConfiguration extends TaintTracking::Configuration { override predicate isAdditionalTaintStep(DataFlow::Node node1, DataFlow::Node node2) { exists(MethodCall mc | mc.getTarget() - .hasQualifiedName("Windows.Security.Cryptography.CryptographicBuffer", + .hasQualifiedName("Windows.Security.Cryptography", "CryptographicBuffer", "ConvertStringToBinary") and mc.getArgument(0) = node1.asExpr() and mc = node2.asExpr() diff --git a/csharp/ql/src/experimental/Security Features/JsonWebTokenHandler/JsonWebTokenHandlerLib.qll b/csharp/ql/src/experimental/Security Features/JsonWebTokenHandler/JsonWebTokenHandlerLib.qll index bf9df3e5184..636400ceb33 100644 --- a/csharp/ql/src/experimental/Security Features/JsonWebTokenHandler/JsonWebTokenHandlerLib.qll +++ b/csharp/ql/src/experimental/Security Features/JsonWebTokenHandler/JsonWebTokenHandlerLib.qll @@ -7,7 +7,7 @@ import DataFlow class TokenValidationParametersPropertySensitiveValidation extends Property { TokenValidationParametersPropertySensitiveValidation() { exists(Class c | - c.hasQualifiedName("Microsoft.IdentityModel.Tokens.TokenValidationParameters") + c.hasQualifiedName("Microsoft.IdentityModel.Tokens", "TokenValidationParameters") | c.getAProperty() = this and this.getName() in [ @@ -52,8 +52,10 @@ predicate isAssemblyOlderVersion(string assemblyName, string ver) { */ class JsonWebTokenHandlerValidateTokenMethod extends Method { JsonWebTokenHandlerValidateTokenMethod() { - this.hasQualifiedName("Microsoft.IdentityModel.JsonWebTokens.JsonWebTokenHandler.ValidateToken") or - this.hasQualifiedName("Microsoft.AzureAD.DeviceIdentification.Common.Tokens.JwtValidator.ValidateEncryptedToken") + this.hasQualifiedName("Microsoft.IdentityModel.JsonWebTokens", "JsonWebTokenHandler", + "ValidateToken") or + this.hasQualifiedName("Microsoft.AzureAD.DeviceIdentification.Common.Tokens", "JwtValidator", + "ValidateEncryptedToken") } } @@ -99,7 +101,7 @@ private class FlowsToTokenValidationResultIsValidCall extends DataFlow::Configur class TokenValidationParametersProperty extends Property { TokenValidationParametersProperty() { exists(Class c | - c.hasQualifiedName("Microsoft.IdentityModel.Tokens.TokenValidationParameters") + c.hasQualifiedName("Microsoft.IdentityModel.Tokens", "TokenValidationParameters") | c.getAProperty() = this and this.getName() in [ @@ -158,7 +160,7 @@ class CallableAlwaysReturnsTrue extends Callable { */ predicate callableOnlyThrowsArgumentNullException(Callable c) { forall(ThrowElement thre | c = thre.getEnclosingCallable() | - thre.getThrownExceptionType().hasQualifiedName("System.ArgumentNullException") + thre.getThrownExceptionType().hasQualifiedName("System", "ArgumentNullException") ) } diff --git a/csharp/ql/src/experimental/Security Features/Serialization/UnsafeTypeUsedDataContractSerializer.ql b/csharp/ql/src/experimental/Security Features/Serialization/UnsafeTypeUsedDataContractSerializer.ql index f3a83b67926..5907e4be311 100644 --- a/csharp/ql/src/experimental/Security Features/Serialization/UnsafeTypeUsedDataContractSerializer.ql +++ b/csharp/ql/src/experimental/Security Features/Serialization/UnsafeTypeUsedDataContractSerializer.ql @@ -14,7 +14,9 @@ import DataSetSerialization predicate xmlSerializerConstructorArgument(Expr e) { exists(ObjectCreation oc, Constructor c | e = oc.getArgument(0) | c = oc.getTarget() and - c.getDeclaringType().getABaseType*().hasQualifiedName("System.Xml.Serialization.XmlSerializer") + c.getDeclaringType() + .getABaseType*() + .hasQualifiedName("System.Xml.Serialization", "XmlSerializer") ) } diff --git a/csharp/ql/test/library-tests/assemblies/assemblies.ql b/csharp/ql/test/library-tests/assemblies/assemblies.ql index 9c072f0d51e..70d9c419d5a 100644 --- a/csharp/ql/test/library-tests/assemblies/assemblies.ql +++ b/csharp/ql/test/library-tests/assemblies/assemblies.ql @@ -20,7 +20,7 @@ from Class class1, MissingType class2, MissingType class3, MissingType class4, MissingType class5, MissingType del2, Field a, Method b, Method c, Method d, Method e, Method f, Method g where - class1.hasQualifiedName("Assembly1.Class1") and + class1.hasQualifiedName("Assembly1", "Class1") and class2.hasName("Class2") and class3.hasName("Class3") and class4.hasName("Class4") and diff --git a/csharp/ql/test/library-tests/assemblies/locations.ql b/csharp/ql/test/library-tests/assemblies/locations.ql index df22a55ca3c..0e368fd4792 100644 --- a/csharp/ql/test/library-tests/assemblies/locations.ql +++ b/csharp/ql/test/library-tests/assemblies/locations.ql @@ -2,7 +2,7 @@ import csharp from Element e, Class c, Method m, Parameter p where - c.hasQualifiedName("Locations.Test") and + c.hasQualifiedName("Locations", "Test") and m.getDeclaringType() = c and m.getAParameter() = p and (e = c or e = m or e = p) diff --git a/csharp/ql/test/library-tests/cil/dataflow/TrivialProperties.ql b/csharp/ql/test/library-tests/cil/dataflow/TrivialProperties.ql index edca7e6cb4b..2f165c8ae55 100644 --- a/csharp/ql/test/library-tests/cil/dataflow/TrivialProperties.ql +++ b/csharp/ql/test/library-tests/cil/dataflow/TrivialProperties.ql @@ -2,9 +2,9 @@ import csharp from TrivialProperty prop where - prop.getDeclaringType().hasQualifiedName("System.Reflection.AssemblyName") + prop.getDeclaringType().hasQualifiedName("System.Reflection", "AssemblyName") or - prop.getDeclaringType().hasQualifiedName("System.Collections.DictionaryEntry") + prop.getDeclaringType().hasQualifiedName("System.Collections", "DictionaryEntry") or - prop.getDeclaringType().hasQualifiedName("Dataflow.Properties") + prop.getDeclaringType().hasQualifiedName("Dataflow", "Properties") select prop.getQualifiedName() diff --git a/csharp/ql/test/library-tests/csharp10/fileScopedNamespace.ql b/csharp/ql/test/library-tests/csharp10/fileScopedNamespace.ql index 5b955bdafcd..c4ca6874987 100644 --- a/csharp/ql/test/library-tests/csharp10/fileScopedNamespace.ql +++ b/csharp/ql/test/library-tests/csharp10/fileScopedNamespace.ql @@ -1,7 +1,7 @@ import csharp query predicate fileScopedNamespace(Namespace n, Member m) { - n.hasQualifiedName("MyFileScopedNamespace") and + n.hasQualifiedName("", "MyFileScopedNamespace") and exists(Class c | c.getNamespace() = n and c.hasMember(m) and diff --git a/csharp/ql/test/library-tests/dataflow/async/Async.ql b/csharp/ql/test/library-tests/dataflow/async/Async.ql index 71799e22f8a..aef928038e1 100644 --- a/csharp/ql/test/library-tests/dataflow/async/Async.ql +++ b/csharp/ql/test/library-tests/dataflow/async/Async.ql @@ -14,7 +14,7 @@ class MySink extends DataFlow::ExprNode { class MySource extends DataFlow::ParameterNode { MySource() { exists(Parameter p | p = this.getParameter() | - p = any(Class c | c.hasQualifiedName("Test")).getAMethod().getAParameter() + p = any(Class c | c.hasQualifiedName("", "Test")).getAMethod().getAParameter() ) } } diff --git a/csharp/ql/test/library-tests/delegates/Delegates2.ql b/csharp/ql/test/library-tests/delegates/Delegates2.ql index 951c7ab9724..1ce83492659 100644 --- a/csharp/ql/test/library-tests/delegates/Delegates2.ql +++ b/csharp/ql/test/library-tests/delegates/Delegates2.ql @@ -6,7 +6,7 @@ import csharp from DelegateType d where - d.hasQualifiedName("Delegates.FooDelegate") and + d.hasQualifiedName("Delegates", "FooDelegate") and d.getReturnType() instanceof DoubleType and d.getParameter(0).hasName("param") and d.getParameter(0).isRef() and diff --git a/csharp/ql/test/library-tests/delegates/Delegates3.ql b/csharp/ql/test/library-tests/delegates/Delegates3.ql index 88c019b3067..08fc413249c 100644 --- a/csharp/ql/test/library-tests/delegates/Delegates3.ql +++ b/csharp/ql/test/library-tests/delegates/Delegates3.ql @@ -6,7 +6,7 @@ import csharp from DelegateType d where - d.hasQualifiedName("System.Threading.ContextCallback") and + d.hasQualifiedName("System.Threading", "ContextCallback") and d.getNumberOfParameters() = 1 and d.getParameter(0).hasName("state") and d.getParameter(0).isValue() and diff --git a/csharp/ql/test/library-tests/enums/Enums1.ql b/csharp/ql/test/library-tests/enums/Enums1.ql index f9978014487..ede536a2695 100644 --- a/csharp/ql/test/library-tests/enums/Enums1.ql +++ b/csharp/ql/test/library-tests/enums/Enums1.ql @@ -7,5 +7,5 @@ import csharp from EnumConstant c where c.getName() = "Red" and - c.getDeclaringType().hasQualifiedName("Enums.Color") + c.getDeclaringType().hasQualifiedName("Enums", "Color") select c, c.getType() diff --git a/csharp/ql/test/library-tests/enums/Enums10.ql b/csharp/ql/test/library-tests/enums/Enums10.ql index 21bb8019785..ced6b3709f9 100644 --- a/csharp/ql/test/library-tests/enums/Enums10.ql +++ b/csharp/ql/test/library-tests/enums/Enums10.ql @@ -8,7 +8,7 @@ from EnumConstant c, EnumConstant d where c.getName() = "Blue" and d.hasName("AnotherBlue") and - c.getDeclaringType().hasQualifiedName("Enums.SparseColor") and + c.getDeclaringType().hasQualifiedName("Enums", "SparseColor") and c.getType() = c.getDeclaringType() and c.getType() = d.getType() and c.getValue() = "11" and diff --git a/csharp/ql/test/library-tests/enums/Enums2.ql b/csharp/ql/test/library-tests/enums/Enums2.ql index eda8843c3c8..97c68efd774 100644 --- a/csharp/ql/test/library-tests/enums/Enums2.ql +++ b/csharp/ql/test/library-tests/enums/Enums2.ql @@ -7,7 +7,7 @@ import csharp from EnumConstant c where c.getName() = "Green" and - c.getDeclaringType().hasQualifiedName("Enums.Color") and + c.getDeclaringType().hasQualifiedName("Enums", "Color") and c.getType() = c.getDeclaringType() and c.getUnderlyingType() instanceof IntType select c diff --git a/csharp/ql/test/library-tests/enums/Enums3.ql b/csharp/ql/test/library-tests/enums/Enums3.ql index 4cbb3e65e4d..4e497154ee5 100644 --- a/csharp/ql/test/library-tests/enums/Enums3.ql +++ b/csharp/ql/test/library-tests/enums/Enums3.ql @@ -7,7 +7,7 @@ import csharp from EnumConstant c where c.getName() = "Green" and - c.getDeclaringType().hasQualifiedName("Enums.LongColor") and + c.getDeclaringType().hasQualifiedName("Enums", "LongColor") and c.getType() = c.getDeclaringType() and c.getValue() = "1" select c, c.getDeclaringType().getBaseClass().getQualifiedName() diff --git a/csharp/ql/test/library-tests/enums/Enums4.ql b/csharp/ql/test/library-tests/enums/Enums4.ql index 087c6b1f576..5a16ffb7c4c 100644 --- a/csharp/ql/test/library-tests/enums/Enums4.ql +++ b/csharp/ql/test/library-tests/enums/Enums4.ql @@ -4,5 +4,5 @@ import csharp -where forall(Enum e | e.getBaseClass().hasQualifiedName("System.Enum")) +where forall(Enum e | e.getBaseClass().hasQualifiedName("System", "Enum")) select 1 diff --git a/csharp/ql/test/library-tests/enums/Enums6.ql b/csharp/ql/test/library-tests/enums/Enums6.ql index 93e03a3e787..3e9332e2890 100644 --- a/csharp/ql/test/library-tests/enums/Enums6.ql +++ b/csharp/ql/test/library-tests/enums/Enums6.ql @@ -7,7 +7,7 @@ import csharp from EnumConstant c where c.getName() = "FourBlue" and - c.getDeclaringType().hasQualifiedName("Enums.ValueColor") and + c.getDeclaringType().hasQualifiedName("Enums", "ValueColor") and c.getType() = c.getDeclaringType() and c.getValue() = "4" and c.getUnderlyingType() instanceof UIntType diff --git a/csharp/ql/test/library-tests/enums/Enums7.ql b/csharp/ql/test/library-tests/enums/Enums7.ql index 93e03a3e787..3e9332e2890 100644 --- a/csharp/ql/test/library-tests/enums/Enums7.ql +++ b/csharp/ql/test/library-tests/enums/Enums7.ql @@ -7,7 +7,7 @@ import csharp from EnumConstant c where c.getName() = "FourBlue" and - c.getDeclaringType().hasQualifiedName("Enums.ValueColor") and + c.getDeclaringType().hasQualifiedName("Enums", "ValueColor") and c.getType() = c.getDeclaringType() and c.getValue() = "4" and c.getUnderlyingType() instanceof UIntType diff --git a/csharp/ql/test/library-tests/enums/Enums8.ql b/csharp/ql/test/library-tests/enums/Enums8.ql index 26ac31db457..03086265795 100644 --- a/csharp/ql/test/library-tests/enums/Enums8.ql +++ b/csharp/ql/test/library-tests/enums/Enums8.ql @@ -7,7 +7,7 @@ import csharp from EnumConstant c where c.getName() = "Red" and - c.getDeclaringType().hasQualifiedName("Enums.SparseColor") and + c.getDeclaringType().hasQualifiedName("Enums", "SparseColor") and c.getType() = c.getDeclaringType() and c.getValue() = "0" and c.getUnderlyingType() instanceof IntType and diff --git a/csharp/ql/test/library-tests/enums/Enums9.ql b/csharp/ql/test/library-tests/enums/Enums9.ql index 895764920f7..b1ad791b758 100644 --- a/csharp/ql/test/library-tests/enums/Enums9.ql +++ b/csharp/ql/test/library-tests/enums/Enums9.ql @@ -7,7 +7,7 @@ import csharp from EnumConstant c where c.getName() = "Green" and - c.getDeclaringType().hasQualifiedName("Enums.SparseColor") and + c.getDeclaringType().hasQualifiedName("Enums", "SparseColor") and c.getType() = c.getDeclaringType() and c.getValue() = "10" and c.getUnderlyingType() instanceof IntType and diff --git a/csharp/ql/test/library-tests/events/Events1.ql b/csharp/ql/test/library-tests/events/Events1.ql index 5be331349b1..39cd0365a19 100644 --- a/csharp/ql/test/library-tests/events/Events1.ql +++ b/csharp/ql/test/library-tests/events/Events1.ql @@ -7,6 +7,6 @@ import csharp from Event e where e.getName() = "Click" and - e.getDeclaringType().hasQualifiedName("Events.Button") and + e.getDeclaringType().hasQualifiedName("Events", "Button") and e.isPublic() select e, e.getType() diff --git a/csharp/ql/test/library-tests/events/Events2.ql b/csharp/ql/test/library-tests/events/Events2.ql index 3ff06e1a4d4..ef5a08d1f8f 100644 --- a/csharp/ql/test/library-tests/events/Events2.ql +++ b/csharp/ql/test/library-tests/events/Events2.ql @@ -7,6 +7,6 @@ import csharp from Event e where e.getName() = "Click" and - e.getDeclaringType().hasQualifiedName("Events.Button") and + e.getDeclaringType().hasQualifiedName("Events", "Button") and e.isFieldLike() select e, e.getType() diff --git a/csharp/ql/test/library-tests/events/Events3.ql b/csharp/ql/test/library-tests/events/Events3.ql index b90a358b43a..97a03e97ecb 100644 --- a/csharp/ql/test/library-tests/events/Events3.ql +++ b/csharp/ql/test/library-tests/events/Events3.ql @@ -7,6 +7,6 @@ import csharp from Event e where e.getName() = "Click" and - e.getDeclaringType().hasQualifiedName("Events.Button") and + e.getDeclaringType().hasQualifiedName("Events", "Button") and e.getType().hasName("EventHandler") select e, e.getType() diff --git a/csharp/ql/test/library-tests/events/Events4.ql b/csharp/ql/test/library-tests/events/Events4.ql index 7250c0b2c1c..3213e28b03b 100644 --- a/csharp/ql/test/library-tests/events/Events4.ql +++ b/csharp/ql/test/library-tests/events/Events4.ql @@ -7,7 +7,7 @@ import csharp from Event e where e.getName() = "MouseUp" and - e.getDeclaringType().hasQualifiedName("Events.Control") and + e.getDeclaringType().hasQualifiedName("Events", "Control") and e.getType().hasName("EventHandler") and e.isPublic() select e, e.getType() diff --git a/csharp/ql/test/library-tests/events/Events5.ql b/csharp/ql/test/library-tests/events/Events5.ql index 259ac14966d..3aed44b4f6d 100644 --- a/csharp/ql/test/library-tests/events/Events5.ql +++ b/csharp/ql/test/library-tests/events/Events5.ql @@ -6,7 +6,7 @@ import csharp where count(Event e | - e.getDeclaringType().hasQualifiedName("Events.Control") and + e.getDeclaringType().hasQualifiedName("Events", "Control") and e.getType().hasName("EventHandler") and e.isPublic() ) = 2 diff --git a/csharp/ql/test/library-tests/events/Events7.ql b/csharp/ql/test/library-tests/events/Events7.ql index 407d69be06d..0d6c31630b8 100644 --- a/csharp/ql/test/library-tests/events/Events7.ql +++ b/csharp/ql/test/library-tests/events/Events7.ql @@ -7,6 +7,6 @@ import csharp from Event e where e.getName() = "MouseUp" and - e.getDeclaringType().hasQualifiedName("Events.Control") and + e.getDeclaringType().hasQualifiedName("Events", "Control") and not e.isFieldLike() select e, e.getType() diff --git a/csharp/ql/test/library-tests/expressions/As1.ql b/csharp/ql/test/library-tests/expressions/As1.ql index 6c436883d13..451a6c3c099 100644 --- a/csharp/ql/test/library-tests/expressions/As1.ql +++ b/csharp/ql/test/library-tests/expressions/As1.ql @@ -9,6 +9,6 @@ where m.hasName("MainIsAsCast") and e.getEnclosingCallable() = m and e.getExpr().(ParameterAccess).getTarget().getName() = "o" and - e.getTargetType().(Class).hasQualifiedName("Expressions.Class") and + e.getTargetType().(Class).hasQualifiedName("Expressions", "Class") and e.getEnclosingStmt().getParent().getParent() instanceof IfStmt select m, e diff --git a/csharp/ql/test/library-tests/expressions/Cast1.ql b/csharp/ql/test/library-tests/expressions/Cast1.ql index d7f812326ef..5233c6066c3 100644 --- a/csharp/ql/test/library-tests/expressions/Cast1.ql +++ b/csharp/ql/test/library-tests/expressions/Cast1.ql @@ -9,6 +9,6 @@ where m.hasName("MainIsAsCast") and e.getEnclosingCallable() = m and e.getExpr().(ParameterAccess).getTarget().getName() = "p" and - e.getTargetType().(Class).hasQualifiedName("Expressions.Class") and + e.getTargetType().(Class).hasQualifiedName("Expressions", "Class") and e.getEnclosingStmt().getParent().getParent() instanceof IfStmt select m, e diff --git a/csharp/ql/test/library-tests/expressions/DelegateCall3.ql b/csharp/ql/test/library-tests/expressions/DelegateCall3.ql index b68b35dde45..af7cf0bba16 100644 --- a/csharp/ql/test/library-tests/expressions/DelegateCall3.ql +++ b/csharp/ql/test/library-tests/expressions/DelegateCall3.ql @@ -10,5 +10,5 @@ where e.getEnclosingCallable() = m and e.getExpr() = a and a.getTarget().hasName("cd7") and - a.getTarget().getType().(DelegateType).hasQualifiedName("Expressions.D") + a.getTarget().getType().(DelegateType).hasQualifiedName("Expressions", "D") select m, e, a diff --git a/csharp/ql/test/library-tests/expressions/Is1.ql b/csharp/ql/test/library-tests/expressions/Is1.ql index 705b7a98ad4..baa85f62da2 100644 --- a/csharp/ql/test/library-tests/expressions/Is1.ql +++ b/csharp/ql/test/library-tests/expressions/Is1.ql @@ -10,5 +10,5 @@ where e.getEnclosingCallable() = m and e.getExpr().(ParameterAccess).getTarget().getName() = "o" and tpe = e.getPattern() and - tpe.getCheckedType().(Class).hasQualifiedName("Expressions.Class") + tpe.getCheckedType().(Class).hasQualifiedName("Expressions", "Class") select m, e diff --git a/csharp/ql/test/library-tests/fields/Constants1.ql b/csharp/ql/test/library-tests/fields/Constants1.ql index 587a38b5731..9759e49893e 100644 --- a/csharp/ql/test/library-tests/fields/Constants1.ql +++ b/csharp/ql/test/library-tests/fields/Constants1.ql @@ -7,7 +7,7 @@ import csharp from MemberConstant c where c.getName() = "X" and - c.getDeclaringType().hasQualifiedName("Constants.A") and + c.getDeclaringType().hasQualifiedName("Constants", "A") and c.getType() instanceof IntType and c.getInitializer() instanceof BinaryOperation and c.isPublic() and diff --git a/csharp/ql/test/library-tests/fields/Constants2.ql b/csharp/ql/test/library-tests/fields/Constants2.ql index 908c1f7c5c9..ec28d999150 100644 --- a/csharp/ql/test/library-tests/fields/Constants2.ql +++ b/csharp/ql/test/library-tests/fields/Constants2.ql @@ -7,7 +7,7 @@ import csharp from MemberConstant c where c.getName() = "Y" and - c.getDeclaringType().hasQualifiedName("Constants.A") and + c.getDeclaringType().hasQualifiedName("Constants", "A") and c.getType() instanceof IntType and c.getInitializer() instanceof IntLiteral and c.isPublic() and diff --git a/csharp/ql/test/library-tests/fields/Constants3.ql b/csharp/ql/test/library-tests/fields/Constants3.ql index e2bb2d9e34a..38af03d0676 100644 --- a/csharp/ql/test/library-tests/fields/Constants3.ql +++ b/csharp/ql/test/library-tests/fields/Constants3.ql @@ -7,7 +7,7 @@ import csharp from MemberConstant c where c.getName() = "Z" and - c.getDeclaringType().hasQualifiedName("Constants.B") and + c.getDeclaringType().hasQualifiedName("Constants", "B") and c.getType() instanceof IntType and c.getInitializer() instanceof BinaryOperation and c.isPublic() and diff --git a/csharp/ql/test/library-tests/fields/Fields1.ql b/csharp/ql/test/library-tests/fields/Fields1.ql index 7e7c5dfbc95..dd85903934c 100644 --- a/csharp/ql/test/library-tests/fields/Fields1.ql +++ b/csharp/ql/test/library-tests/fields/Fields1.ql @@ -7,7 +7,7 @@ import csharp from Field f where f.getName() = "X" and - f.getDeclaringType().hasQualifiedName("Fields.A") and + f.getDeclaringType().hasQualifiedName("Fields", "A") and f.getType() instanceof IntType and f.getInitializer().(IntLiteral).getValue() = "1" and f.isPublic() and diff --git a/csharp/ql/test/library-tests/fields/Fields10.ql b/csharp/ql/test/library-tests/fields/Fields10.ql index fa17e74d69b..5b5bbf7d808 100644 --- a/csharp/ql/test/library-tests/fields/Fields10.ql +++ b/csharp/ql/test/library-tests/fields/Fields10.ql @@ -8,6 +8,6 @@ from Field f, SimpleType t where f.getName() = "MaxValue" and f.getDeclaringType() = t and - t.hasQualifiedName("System.Decimal") and + t.hasQualifiedName("System", "Decimal") and f.isPublic() select f.toString(), f.getDeclaringType().toString() diff --git a/csharp/ql/test/library-tests/fields/Fields2.ql b/csharp/ql/test/library-tests/fields/Fields2.ql index 9a970e1eed9..ef4e737a635 100644 --- a/csharp/ql/test/library-tests/fields/Fields2.ql +++ b/csharp/ql/test/library-tests/fields/Fields2.ql @@ -7,7 +7,7 @@ import csharp from Field f where f.getName() = "Y" and - f.getDeclaringType().hasQualifiedName("Fields.A") and + f.getDeclaringType().hasQualifiedName("Fields", "A") and f.getType() instanceof IntType and not exists(f.getInitializer()) and f.isPublic() and diff --git a/csharp/ql/test/library-tests/fields/Fields3.ql b/csharp/ql/test/library-tests/fields/Fields3.ql index a6a4fade742..2bfdc558d08 100644 --- a/csharp/ql/test/library-tests/fields/Fields3.ql +++ b/csharp/ql/test/library-tests/fields/Fields3.ql @@ -7,7 +7,7 @@ import csharp from Field f where f.getName() = "Z" and - f.getDeclaringType().hasQualifiedName("Fields.A") and + f.getDeclaringType().hasQualifiedName("Fields", "A") and f.getType() instanceof IntType and f.getInitializer().(IntLiteral).getValue() = "100" and f.isPublic() and diff --git a/csharp/ql/test/library-tests/fields/Fields4.ql b/csharp/ql/test/library-tests/fields/Fields4.ql index f6c01e4e322..96c88c178cf 100644 --- a/csharp/ql/test/library-tests/fields/Fields4.ql +++ b/csharp/ql/test/library-tests/fields/Fields4.ql @@ -7,7 +7,7 @@ import csharp from Field f where f.getName() = "X" and - f.getDeclaringType().hasQualifiedName("Fields.B") and + f.getDeclaringType().hasQualifiedName("Fields", "B") and f.getType() instanceof IntType and f.getInitializer().(IntLiteral).getValue() = "1" and f.isPublic() and diff --git a/csharp/ql/test/library-tests/fields/Fields5.ql b/csharp/ql/test/library-tests/fields/Fields5.ql index eeaf4996e0c..2ff6d63581c 100644 --- a/csharp/ql/test/library-tests/fields/Fields5.ql +++ b/csharp/ql/test/library-tests/fields/Fields5.ql @@ -7,7 +7,7 @@ import csharp from Field f where f.getName() = "Y" and - f.getDeclaringType().hasQualifiedName("Fields.B") and + f.getDeclaringType().hasQualifiedName("Fields", "B") and f.getType() instanceof IntType and not exists(f.getInitializer()) and f.isPublic() and diff --git a/csharp/ql/test/library-tests/fields/Fields6.ql b/csharp/ql/test/library-tests/fields/Fields6.ql index 8706c829205..8967586b86b 100644 --- a/csharp/ql/test/library-tests/fields/Fields6.ql +++ b/csharp/ql/test/library-tests/fields/Fields6.ql @@ -7,7 +7,7 @@ import csharp from Field f where f.getName() = "finished" and - f.getDeclaringType().hasQualifiedName("Fields.Application") and + f.getDeclaringType().hasQualifiedName("Fields", "Application") and f.getType() instanceof BoolType and not exists(f.getInitializer()) and f.isPublic() and diff --git a/csharp/ql/test/library-tests/fields/Fields7.ql b/csharp/ql/test/library-tests/fields/Fields7.ql index 5097de7923f..3c031831ab6 100644 --- a/csharp/ql/test/library-tests/fields/Fields7.ql +++ b/csharp/ql/test/library-tests/fields/Fields7.ql @@ -8,7 +8,7 @@ from Field f, UnboundGenericClass c where f.getName() = "count" and f.getDeclaringType() = c and - c.hasQualifiedName("Fields.C<>") and + c.hasQualifiedName("Fields", "C<>") and f.getType() instanceof IntType and f.isStatic() select f, f.getDeclaringType() diff --git a/csharp/ql/test/library-tests/fields/Fields8.ql b/csharp/ql/test/library-tests/fields/Fields8.ql index 5097de7923f..3c031831ab6 100644 --- a/csharp/ql/test/library-tests/fields/Fields8.ql +++ b/csharp/ql/test/library-tests/fields/Fields8.ql @@ -8,7 +8,7 @@ from Field f, UnboundGenericClass c where f.getName() = "count" and f.getDeclaringType() = c and - c.hasQualifiedName("Fields.C<>") and + c.hasQualifiedName("Fields", "C<>") and f.getType() instanceof IntType and f.isStatic() select f, f.getDeclaringType() diff --git a/csharp/ql/test/library-tests/fields/Fields9.ql b/csharp/ql/test/library-tests/fields/Fields9.ql index 24a601da86a..9bb87878ee3 100644 --- a/csharp/ql/test/library-tests/fields/Fields9.ql +++ b/csharp/ql/test/library-tests/fields/Fields9.ql @@ -8,7 +8,7 @@ from Field f, Class c where f.getName() = "Black" and f.getDeclaringType() = c and - c.hasQualifiedName("Fields.Color") and + c.hasQualifiedName("Fields", "Color") and f.getType() = c and f.isStatic() and f.isPublic() and diff --git a/csharp/ql/test/library-tests/indexers/Indexers10.ql b/csharp/ql/test/library-tests/indexers/Indexers10.ql index a8329523315..2d1c7aee3a7 100644 --- a/csharp/ql/test/library-tests/indexers/Indexers10.ql +++ b/csharp/ql/test/library-tests/indexers/Indexers10.ql @@ -6,7 +6,7 @@ import csharp from Indexer i where - i.getDeclaringType().hasQualifiedName("Indexers.Grid") and + i.getDeclaringType().hasQualifiedName("Indexers", "Grid") and i.getType() instanceof IntType and i.isPublic() and i.isReadWrite() diff --git a/csharp/ql/test/library-tests/indexers/Indexers2.ql b/csharp/ql/test/library-tests/indexers/Indexers2.ql index 6065ae9abb8..ef470e73bad 100644 --- a/csharp/ql/test/library-tests/indexers/Indexers2.ql +++ b/csharp/ql/test/library-tests/indexers/Indexers2.ql @@ -6,7 +6,7 @@ import csharp from Indexer i where - i.getDeclaringType().hasQualifiedName("Indexers.BitArray") and + i.getDeclaringType().hasQualifiedName("Indexers", "BitArray") and i.getType() instanceof BoolType and i.getDimension() = 1 select i diff --git a/csharp/ql/test/library-tests/indexers/Indexers3.ql b/csharp/ql/test/library-tests/indexers/Indexers3.ql index 9b38e6f6751..f6f116ab70d 100644 --- a/csharp/ql/test/library-tests/indexers/Indexers3.ql +++ b/csharp/ql/test/library-tests/indexers/Indexers3.ql @@ -6,7 +6,7 @@ import csharp from Indexer i where - i.getDeclaringType().hasQualifiedName("Indexers.BitArray") and + i.getDeclaringType().hasQualifiedName("Indexers", "BitArray") and i.getType() instanceof BoolType and i.getParameter(0).getName() = "index" and i.getParameter(0).getType() instanceof IntType diff --git a/csharp/ql/test/library-tests/indexers/Indexers4.ql b/csharp/ql/test/library-tests/indexers/Indexers4.ql index 5eeb3808a53..08d693e9489 100644 --- a/csharp/ql/test/library-tests/indexers/Indexers4.ql +++ b/csharp/ql/test/library-tests/indexers/Indexers4.ql @@ -6,6 +6,6 @@ import csharp from Class c where - c.hasQualifiedName("Indexers.BitArray") and + c.hasQualifiedName("Indexers", "BitArray") and count(Indexer i | i.getDeclaringType() = c) = 1 select c diff --git a/csharp/ql/test/library-tests/indexers/Indexers5.ql b/csharp/ql/test/library-tests/indexers/Indexers5.ql index f264e130711..3e21cdd53cc 100644 --- a/csharp/ql/test/library-tests/indexers/Indexers5.ql +++ b/csharp/ql/test/library-tests/indexers/Indexers5.ql @@ -6,7 +6,7 @@ import csharp from Indexer i where - i.getDeclaringType().hasQualifiedName("Indexers.BitArray") and + i.getDeclaringType().hasQualifiedName("Indexers", "BitArray") and i.getType() instanceof BoolType and i.isPublic() and i.isReadWrite() diff --git a/csharp/ql/test/library-tests/indexers/Indexers6.ql b/csharp/ql/test/library-tests/indexers/Indexers6.ql index 148a896e515..9b33dd67126 100644 --- a/csharp/ql/test/library-tests/indexers/Indexers6.ql +++ b/csharp/ql/test/library-tests/indexers/Indexers6.ql @@ -6,7 +6,7 @@ import csharp from Indexer i where - i.getDeclaringType().hasQualifiedName("Indexers.BitArray") and + i.getDeclaringType().hasQualifiedName("Indexers", "BitArray") and i.getType() instanceof BoolType and i.getGetter().hasBody() and i.getSetter().hasBody() diff --git a/csharp/ql/test/library-tests/indexers/Indexers7.ql b/csharp/ql/test/library-tests/indexers/Indexers7.ql index 74dc80fa624..3c93f94ef9a 100644 --- a/csharp/ql/test/library-tests/indexers/Indexers7.ql +++ b/csharp/ql/test/library-tests/indexers/Indexers7.ql @@ -6,7 +6,7 @@ import csharp from Indexer i where - i.getDeclaringType().hasQualifiedName("Indexers.Grid") and + i.getDeclaringType().hasQualifiedName("Indexers", "Grid") and i.getType() instanceof IntType and i.getDimension() = 2 select i diff --git a/csharp/ql/test/library-tests/indexers/Indexers8.ql b/csharp/ql/test/library-tests/indexers/Indexers8.ql index abaf258fafe..f3fdfa9b0fe 100644 --- a/csharp/ql/test/library-tests/indexers/Indexers8.ql +++ b/csharp/ql/test/library-tests/indexers/Indexers8.ql @@ -6,7 +6,7 @@ import csharp from Indexer i where - i.getDeclaringType().hasQualifiedName("Indexers.Grid") and + i.getDeclaringType().hasQualifiedName("Indexers", "Grid") and i.getType() instanceof IntType and i.getParameter(0).getName() = "c" and i.getParameter(0).getType() instanceof CharType diff --git a/csharp/ql/test/library-tests/indexers/Indexers9.ql b/csharp/ql/test/library-tests/indexers/Indexers9.ql index a50719af912..5999bd14791 100644 --- a/csharp/ql/test/library-tests/indexers/Indexers9.ql +++ b/csharp/ql/test/library-tests/indexers/Indexers9.ql @@ -6,7 +6,7 @@ import csharp from Indexer i where - i.getDeclaringType().hasQualifiedName("Indexers.Grid") and + i.getDeclaringType().hasQualifiedName("Indexers", "Grid") and i.getType() instanceof IntType and i.getParameter(1).getName() = "col" and i.getParameter(1).getType() instanceof IntType diff --git a/csharp/ql/test/library-tests/methods/Parameters1.ql b/csharp/ql/test/library-tests/methods/Parameters1.ql index d4b1939bfe7..c28a724198c 100644 --- a/csharp/ql/test/library-tests/methods/Parameters1.ql +++ b/csharp/ql/test/library-tests/methods/Parameters1.ql @@ -7,7 +7,7 @@ import csharp from Method m where m.hasName("Swap") and - m.getDeclaringType().hasQualifiedName("Methods.TestRef") and + m.getDeclaringType().hasQualifiedName("Methods", "TestRef") and m.getParameter(0).isRef() and m.getParameter(0).hasName("x") and m.getParameter(0).getType() instanceof IntType and diff --git a/csharp/ql/test/library-tests/methods/Parameters2.ql b/csharp/ql/test/library-tests/methods/Parameters2.ql index eb992f2c7f0..15b1471f1c5 100644 --- a/csharp/ql/test/library-tests/methods/Parameters2.ql +++ b/csharp/ql/test/library-tests/methods/Parameters2.ql @@ -7,7 +7,7 @@ import csharp from Method m where m.hasName("Divide") and - m.getDeclaringType().hasQualifiedName("Methods.TestOut") and + m.getDeclaringType().hasQualifiedName("Methods", "TestOut") and m.getParameter(0).isValue() and m.getParameter(0).hasName("x") and m.getParameter(0).getType() instanceof IntType and diff --git a/csharp/ql/test/library-tests/methods/Parameters3.ql b/csharp/ql/test/library-tests/methods/Parameters3.ql index 0c69218be58..8f286d7ee7e 100644 --- a/csharp/ql/test/library-tests/methods/Parameters3.ql +++ b/csharp/ql/test/library-tests/methods/Parameters3.ql @@ -7,7 +7,7 @@ import csharp from Method m where m.hasName("Write") and - m.getDeclaringType().hasQualifiedName("Methods.Console") and + m.getDeclaringType().hasQualifiedName("Methods", "Console") and m.getParameter(0).isValue() and m.getParameter(0).hasName("fmt") and m.getParameter(0).getType() instanceof StringType and diff --git a/csharp/ql/test/library-tests/namespaces/Namespaces1.ql b/csharp/ql/test/library-tests/namespaces/Namespaces1.ql index 0a1e1e965b7..92fe438894b 100644 --- a/csharp/ql/test/library-tests/namespaces/Namespaces1.ql +++ b/csharp/ql/test/library-tests/namespaces/Namespaces1.ql @@ -6,7 +6,7 @@ import csharp from Namespace n where - n.hasQualifiedName("N1.N2") and + n.hasQualifiedName("N1", "N2") and n.getAClass().hasName("A") and n.getAClass().hasName("B") select n diff --git a/csharp/ql/test/library-tests/namespaces/Namespaces10.ql b/csharp/ql/test/library-tests/namespaces/Namespaces10.ql index c45a49cbd39..135067040a4 100644 --- a/csharp/ql/test/library-tests/namespaces/Namespaces10.ql +++ b/csharp/ql/test/library-tests/namespaces/Namespaces10.ql @@ -6,11 +6,11 @@ import csharp from Namespace n, UnboundGenericClass ga, Class a where - n.hasQualifiedName("R1") and + n.hasQualifiedName("", "R1") and ga.hasQualifiedName("R1", "A<>") and ga.getATypeParameter().hasName("T") and ga.getNamespace() = n and - a.hasQualifiedName("R1.A") and + a.hasQualifiedName("R1", "A") and n.getAClass() = a and n.getAClass() = ga select n, ga, a diff --git a/csharp/ql/test/library-tests/namespaces/Namespaces11.ql b/csharp/ql/test/library-tests/namespaces/Namespaces11.ql index 3aea83ac0cf..8f8453ad18e 100644 --- a/csharp/ql/test/library-tests/namespaces/Namespaces11.ql +++ b/csharp/ql/test/library-tests/namespaces/Namespaces11.ql @@ -6,7 +6,7 @@ import csharp from UsingNamespaceDirective u where - u.getParentNamespaceDeclaration().getNamespace().hasQualifiedName("S3") and - u.getImportedNamespace().hasQualifiedName("S1.S2") and + u.getParentNamespaceDeclaration().getNamespace().hasQualifiedName("", "S3") and + u.getImportedNamespace().hasQualifiedName("S1", "S2") and u.getFile().getBaseName() = "namespaces.cs" select u diff --git a/csharp/ql/test/library-tests/namespaces/Namespaces12.ql b/csharp/ql/test/library-tests/namespaces/Namespaces12.ql index 73d66435b9d..5cc9dd3e643 100644 --- a/csharp/ql/test/library-tests/namespaces/Namespaces12.ql +++ b/csharp/ql/test/library-tests/namespaces/Namespaces12.ql @@ -7,6 +7,6 @@ import csharp from UsingNamespaceDirective u where u.getFile().getBaseName() = "namespaces.cs" and - u.getImportedNamespace().hasQualifiedName("System.Collections.Generic") and + u.getImportedNamespace().hasQualifiedName("System.Collections", "Generic") and not exists(u.getParentNamespaceDeclaration()) select u diff --git a/csharp/ql/test/library-tests/namespaces/Namespaces2.ql b/csharp/ql/test/library-tests/namespaces/Namespaces2.ql index f176ad89d3d..0cebeb2eb7b 100644 --- a/csharp/ql/test/library-tests/namespaces/Namespaces2.ql +++ b/csharp/ql/test/library-tests/namespaces/Namespaces2.ql @@ -6,7 +6,7 @@ import csharp from Namespace n where - n.hasQualifiedName("M1.M2") and + n.hasQualifiedName("M1", "M2") and n.getAClass().hasName("A") and n.getAClass().hasName("B") select n diff --git a/csharp/ql/test/library-tests/namespaces/Namespaces3.ql b/csharp/ql/test/library-tests/namespaces/Namespaces3.ql index 60acfc8bce5..0ecf971f3fe 100644 --- a/csharp/ql/test/library-tests/namespaces/Namespaces3.ql +++ b/csharp/ql/test/library-tests/namespaces/Namespaces3.ql @@ -6,7 +6,7 @@ import csharp from Namespace n where - n.hasQualifiedName("P1.P2") and + n.hasQualifiedName("P1", "P2") and n.getAClass().hasName("A") and n.getAClass().hasName("B") and n.getAStruct().hasName("S") and diff --git a/csharp/ql/test/library-tests/namespaces/Namespaces4.ql b/csharp/ql/test/library-tests/namespaces/Namespaces4.ql index 81313001412..738a4c1966f 100644 --- a/csharp/ql/test/library-tests/namespaces/Namespaces4.ql +++ b/csharp/ql/test/library-tests/namespaces/Namespaces4.ql @@ -6,7 +6,7 @@ import csharp from Namespace n, Class a, Class b where - n.hasQualifiedName("M1.M2") and + n.hasQualifiedName("M1", "M2") and a = n.getAClass() and a.hasName("A") and a.isPublic() and diff --git a/csharp/ql/test/library-tests/namespaces/Namespaces5.ql b/csharp/ql/test/library-tests/namespaces/Namespaces5.ql index 95c51ca1e37..aae2d671b2b 100644 --- a/csharp/ql/test/library-tests/namespaces/Namespaces5.ql +++ b/csharp/ql/test/library-tests/namespaces/Namespaces5.ql @@ -6,6 +6,6 @@ import csharp from Namespace n where - n.hasQualifiedName("Empty") and + n.hasQualifiedName("", "Empty") and not exists(n.getATypeDeclaration()) select n diff --git a/csharp/ql/test/library-tests/namespaces/Namespaces6.ql b/csharp/ql/test/library-tests/namespaces/Namespaces6.ql index d89e2a998fa..27539b59f7e 100644 --- a/csharp/ql/test/library-tests/namespaces/Namespaces6.ql +++ b/csharp/ql/test/library-tests/namespaces/Namespaces6.ql @@ -6,9 +6,9 @@ import csharp from Namespace n, Namespace p where - n.hasQualifiedName("Q1.Q2") and + n.hasQualifiedName("Q1", "Q2") and n.hasName("Q2") and p = n.getParentNamespace() and p.hasName("Q1") and - p.hasQualifiedName("Q1") + p.hasQualifiedName("", "Q1") select p, n diff --git a/csharp/ql/test/library-tests/namespaces/Namespaces7.ql b/csharp/ql/test/library-tests/namespaces/Namespaces7.ql index 4593ddef8c4..6822aacf1ef 100644 --- a/csharp/ql/test/library-tests/namespaces/Namespaces7.ql +++ b/csharp/ql/test/library-tests/namespaces/Namespaces7.ql @@ -6,7 +6,7 @@ import csharp from Namespace n, Class b, Class a where - n.hasQualifiedName("Q3") and + n.hasQualifiedName("", "Q3") and a.hasQualifiedName("Q1.Q2", "A") and b.hasName("B") and b.getNamespace() = n and diff --git a/csharp/ql/test/library-tests/namespaces/Namespaces8.ql b/csharp/ql/test/library-tests/namespaces/Namespaces8.ql index 870f0c397b1..312fb960c91 100644 --- a/csharp/ql/test/library-tests/namespaces/Namespaces8.ql +++ b/csharp/ql/test/library-tests/namespaces/Namespaces8.ql @@ -6,7 +6,7 @@ import csharp from Namespace n, Class c, Class a where - n.hasQualifiedName("Q3") and + n.hasQualifiedName("", "Q3") and a.hasQualifiedName("Q1.Q2", "A") and c.hasName("C") and c.getNamespace() = n and diff --git a/csharp/ql/test/library-tests/namespaces/Namespaces9.ql b/csharp/ql/test/library-tests/namespaces/Namespaces9.ql index 253e74ddfd6..ec380123d61 100644 --- a/csharp/ql/test/library-tests/namespaces/Namespaces9.ql +++ b/csharp/ql/test/library-tests/namespaces/Namespaces9.ql @@ -10,5 +10,5 @@ where a.getATypeParameter().hasName("T") and a.getANestedType() = b and b.getName() = "B" and - b.hasQualifiedName("R1.A<>+B") + b.hasQualifiedName("R1", "A<>+B") select a, b diff --git a/csharp/ql/test/library-tests/nestedtypes/NestedTypes1.ql b/csharp/ql/test/library-tests/nestedtypes/NestedTypes1.ql index 411ff0b664f..57b667876a5 100644 --- a/csharp/ql/test/library-tests/nestedtypes/NestedTypes1.ql +++ b/csharp/ql/test/library-tests/nestedtypes/NestedTypes1.ql @@ -6,8 +6,8 @@ import csharp from Class c, Struct s where - c.hasQualifiedName("NestedTypes.Base") and - s.hasQualifiedName("NestedTypes.Base+S") and + c.hasQualifiedName("NestedTypes", "Base") and + s.hasQualifiedName("NestedTypes", "Base+S") and s = c.getANestedType() and s.(NestedType).isProtected() and c.isPublic() diff --git a/csharp/ql/test/library-tests/nestedtypes/NestedTypes2.ql b/csharp/ql/test/library-tests/nestedtypes/NestedTypes2.ql index 0432b5e4303..b3be4723dff 100644 --- a/csharp/ql/test/library-tests/nestedtypes/NestedTypes2.ql +++ b/csharp/ql/test/library-tests/nestedtypes/NestedTypes2.ql @@ -6,8 +6,8 @@ import csharp from Class c, Interface i where - c.hasQualifiedName("NestedTypes.Base") and - i.hasQualifiedName("NestedTypes.Base+I") and + c.hasQualifiedName("NestedTypes", "Base") and + i.hasQualifiedName("NestedTypes", "Base+I") and i.(NestedType).isPrivate() and i = c.getANestedType() select c, i diff --git a/csharp/ql/test/library-tests/nestedtypes/NestedTypes3.ql b/csharp/ql/test/library-tests/nestedtypes/NestedTypes3.ql index d636c18b6d3..c3b216e23a2 100644 --- a/csharp/ql/test/library-tests/nestedtypes/NestedTypes3.ql +++ b/csharp/ql/test/library-tests/nestedtypes/NestedTypes3.ql @@ -6,8 +6,8 @@ import csharp from Class c, DelegateType d where - c.hasQualifiedName("NestedTypes.Base") and - d.hasQualifiedName("NestedTypes.Base+MyDelegate") and + c.hasQualifiedName("NestedTypes", "Base") and + d.hasQualifiedName("NestedTypes", "Base+MyDelegate") and d.(NestedType).isPrivate() and d = c.getANestedType() select c, d diff --git a/csharp/ql/test/library-tests/nestedtypes/NestedTypes4.ql b/csharp/ql/test/library-tests/nestedtypes/NestedTypes4.ql index e52c9149db1..bfdb3a441e4 100644 --- a/csharp/ql/test/library-tests/nestedtypes/NestedTypes4.ql +++ b/csharp/ql/test/library-tests/nestedtypes/NestedTypes4.ql @@ -6,9 +6,9 @@ import csharp from Class base, Class derived, Class nested where - base.hasQualifiedName("NestedTypes.Base") and - derived.hasQualifiedName("NestedTypes.Derived") and - nested.hasQualifiedName("NestedTypes.Derived+Nested") and + base.hasQualifiedName("NestedTypes", "Base") and + derived.hasQualifiedName("NestedTypes", "Derived") and + nested.hasQualifiedName("NestedTypes", "Derived+Nested") and nested.getNamespace().hasName("NestedTypes") and derived.getBaseClass() = base and derived.isInternal() and diff --git a/csharp/ql/test/library-tests/nestedtypes/NestedTypes5.ql b/csharp/ql/test/library-tests/nestedtypes/NestedTypes5.ql index d7a71757724..7585b923594 100644 --- a/csharp/ql/test/library-tests/nestedtypes/NestedTypes5.ql +++ b/csharp/ql/test/library-tests/nestedtypes/NestedTypes5.ql @@ -6,9 +6,9 @@ import csharp from Class base, Class derived, Class nested where - base.hasQualifiedName("NestedTypes.Base") and - derived.hasQualifiedName("NestedTypes.Derived") and - nested.hasQualifiedName("NestedTypes.Derived+Nested") and + base.hasQualifiedName("NestedTypes", "Base") and + derived.hasQualifiedName("NestedTypes", "Derived") and + nested.hasQualifiedName("NestedTypes", "Derived+Nested") and nested.getNamespace().hasName("NestedTypes") and nested.getDeclaringType() = derived select base, derived, nested diff --git a/csharp/ql/test/library-tests/nestedtypes/NestedTypes6.ql b/csharp/ql/test/library-tests/nestedtypes/NestedTypes6.ql index 40c3337d643..ca2c3aadb89 100644 --- a/csharp/ql/test/library-tests/nestedtypes/NestedTypes6.ql +++ b/csharp/ql/test/library-tests/nestedtypes/NestedTypes6.ql @@ -6,7 +6,7 @@ import csharp from UnboundGenericClass o, UnboundGenericClass i where - o.hasQualifiedName("NestedTypes.Outer<>") and - i.hasQualifiedName("NestedTypes.Outer<>+Inner<>") and + o.hasQualifiedName("NestedTypes", "Outer<>") and + i.hasQualifiedName("NestedTypes", "Outer<>+Inner<>") and i = o.getANestedType() select o, i diff --git a/csharp/ql/test/library-tests/nestedtypes/NestedTypes7.ql b/csharp/ql/test/library-tests/nestedtypes/NestedTypes7.ql index b8a58417789..750e2c72b01 100644 --- a/csharp/ql/test/library-tests/nestedtypes/NestedTypes7.ql +++ b/csharp/ql/test/library-tests/nestedtypes/NestedTypes7.ql @@ -6,8 +6,8 @@ import csharp from UnboundGenericClass o, UnboundGenericClass i where - o.hasQualifiedName("NestedTypes.Outer2<>") and - i.hasQualifiedName("NestedTypes.Outer2<>+Inner2<>") and + o.hasQualifiedName("NestedTypes", "Outer2<>") and + i.hasQualifiedName("NestedTypes", "Outer2<>+Inner2<>") and i = o.getANestedType() and i.getTypeParameter(0).getName() = o.getTypeParameter(0).getName() select o, i diff --git a/csharp/ql/test/library-tests/nestedtypes/NestedTypes8.ql b/csharp/ql/test/library-tests/nestedtypes/NestedTypes8.ql index b854068b1e9..cc7fe1475a1 100644 --- a/csharp/ql/test/library-tests/nestedtypes/NestedTypes8.ql +++ b/csharp/ql/test/library-tests/nestedtypes/NestedTypes8.ql @@ -6,8 +6,8 @@ import csharp from ConstructedClass o, ConstructedClass i where - o.hasQualifiedName("NestedTypes.Outer") and - i.hasQualifiedName("NestedTypes.Outer+Inner") and + o.hasQualifiedName("NestedTypes", "Outer") and + i.hasQualifiedName("NestedTypes", "Outer+Inner") and i = o.getANestedType() and o.getTypeArgument(0) instanceof IntType and i.getTypeArgument(0) instanceof StringType diff --git a/csharp/ql/test/library-tests/nestedtypes/NestedTypes9.ql b/csharp/ql/test/library-tests/nestedtypes/NestedTypes9.ql index 2b926ce8ec6..75874018b87 100644 --- a/csharp/ql/test/library-tests/nestedtypes/NestedTypes9.ql +++ b/csharp/ql/test/library-tests/nestedtypes/NestedTypes9.ql @@ -6,8 +6,8 @@ import csharp from UnboundGenericClass o, ConstructedClass i where - o.hasQualifiedName("NestedTypes.Outer<>") and - i.hasQualifiedName("NestedTypes.Outer<>+Inner") and + o.hasQualifiedName("NestedTypes", "Outer<>") and + i.hasQualifiedName("NestedTypes", "Outer<>+Inner") and i.getUnboundGeneric() = o.getANestedType() and i.getTypeArgument(0) instanceof StringType select o, i diff --git a/csharp/ql/test/library-tests/properties/Properties10.ql b/csharp/ql/test/library-tests/properties/Properties10.ql index 7f2fae74da5..b2f0ca08da2 100644 --- a/csharp/ql/test/library-tests/properties/Properties10.ql +++ b/csharp/ql/test/library-tests/properties/Properties10.ql @@ -7,7 +7,7 @@ import csharp from Property p where p.hasName("Y") and - p.getDeclaringType().hasQualifiedName("Properties.A") and + p.getDeclaringType().hasQualifiedName("Properties", "A") and p.isReadWrite() and not p.isAutoImplemented() and p.isVirtual() and diff --git a/csharp/ql/test/library-tests/properties/Properties11.ql b/csharp/ql/test/library-tests/properties/Properties11.ql index ca1696d6152..10c25532a36 100644 --- a/csharp/ql/test/library-tests/properties/Properties11.ql +++ b/csharp/ql/test/library-tests/properties/Properties11.ql @@ -7,7 +7,7 @@ import csharp from Property p where p.hasName("Y") and - p.getDeclaringType().hasQualifiedName("Properties.B") and + p.getDeclaringType().hasQualifiedName("Properties", "B") and p.isReadWrite() and // overrides a property that is readwrite not p.isAutoImplemented() and p.isOverride() and diff --git a/csharp/ql/test/library-tests/properties/Properties12.ql b/csharp/ql/test/library-tests/properties/Properties12.ql index a8334485efc..a23d9d1d87c 100644 --- a/csharp/ql/test/library-tests/properties/Properties12.ql +++ b/csharp/ql/test/library-tests/properties/Properties12.ql @@ -7,7 +7,7 @@ import csharp from Property p where p.hasName("X") and - p.getDeclaringType().hasQualifiedName("Properties.B") and + p.getDeclaringType().hasQualifiedName("Properties", "B") and p.isReadOnly() and not p.isAutoImplemented() and p.isOverride() and diff --git a/csharp/ql/test/library-tests/properties/Properties13.ql b/csharp/ql/test/library-tests/properties/Properties13.ql index f0bf658d1f9..97f6139ecb0 100644 --- a/csharp/ql/test/library-tests/properties/Properties13.ql +++ b/csharp/ql/test/library-tests/properties/Properties13.ql @@ -7,7 +7,7 @@ import csharp from Property p where p.hasName("Z") and - p.getDeclaringType().hasQualifiedName("Properties.B") and + p.getDeclaringType().hasQualifiedName("Properties", "B") and p.isReadWrite() and not p.isAutoImplemented() and p.isOverride() and diff --git a/csharp/ql/test/library-tests/properties/Properties14.ql b/csharp/ql/test/library-tests/properties/Properties14.ql index c6c3568e1b8..226dc003f18 100644 --- a/csharp/ql/test/library-tests/properties/Properties14.ql +++ b/csharp/ql/test/library-tests/properties/Properties14.ql @@ -7,7 +7,7 @@ import csharp from Property p where p.hasName("Count") and - p.getDeclaringType().hasQualifiedName("System.Collections.Generic.List<>") and + p.getDeclaringType().hasQualifiedName("System.Collections.Generic", "List<>") and not p.isAutoImplemented() and not p.isStatic() and p.isPublic() and diff --git a/csharp/ql/test/library-tests/properties/Properties15.ql b/csharp/ql/test/library-tests/properties/Properties15.ql index af729d49275..2f71f77aec7 100644 --- a/csharp/ql/test/library-tests/properties/Properties15.ql +++ b/csharp/ql/test/library-tests/properties/Properties15.ql @@ -7,7 +7,7 @@ import csharp from Property p where p.hasName("Init") and - p.getDeclaringType().hasQualifiedName("Properties.Test") and + p.getDeclaringType().hasQualifiedName("Properties", "Test") and p.isWriteOnly() and not p.isAutoImplemented() and p.isStatic() and diff --git a/csharp/ql/test/library-tests/properties/Properties16.ql b/csharp/ql/test/library-tests/properties/Properties16.ql index 4ef2776d39f..5cf64128372 100644 --- a/csharp/ql/test/library-tests/properties/Properties16.ql +++ b/csharp/ql/test/library-tests/properties/Properties16.ql @@ -7,7 +7,7 @@ import csharp from Property p where p.hasName("Init") and - p.getDeclaringType().hasQualifiedName("Properties.Test") and + p.getDeclaringType().hasQualifiedName("Properties", "Test") and p.getSetter().getNumberOfParameters() = 1 and p.getSetter().getParameter(0) instanceof ImplicitAccessorParameter select p, p.getSetter().getParameter(0) diff --git a/csharp/ql/test/library-tests/properties/Properties4.ql b/csharp/ql/test/library-tests/properties/Properties4.ql index 89a0b03f5b4..ad8055a45f4 100644 --- a/csharp/ql/test/library-tests/properties/Properties4.ql +++ b/csharp/ql/test/library-tests/properties/Properties4.ql @@ -10,6 +10,6 @@ where p.isReadOnly() and p.isPublic() and p.getGetter().hasBody() and - p.getDeclaringType().hasQualifiedName("Properties.Counter") and + p.getDeclaringType().hasQualifiedName("Properties", "Counter") and not exists(p.getSetter()) select p, p.getGetter() diff --git a/csharp/ql/test/library-tests/properties/Properties5.ql b/csharp/ql/test/library-tests/properties/Properties5.ql index 7c86e26a5c4..0e5291ae236 100644 --- a/csharp/ql/test/library-tests/properties/Properties5.ql +++ b/csharp/ql/test/library-tests/properties/Properties5.ql @@ -7,7 +7,7 @@ import csharp from Property p where p.hasName("X") and - p.getDeclaringType().hasQualifiedName("Properties.Point") and + p.getDeclaringType().hasQualifiedName("Properties", "Point") and p.isReadWrite() and p.isPublic() and exists(p.getGetter()) and diff --git a/csharp/ql/test/library-tests/properties/Properties6.ql b/csharp/ql/test/library-tests/properties/Properties6.ql index 3e81cdc04e2..5ede824b59e 100644 --- a/csharp/ql/test/library-tests/properties/Properties6.ql +++ b/csharp/ql/test/library-tests/properties/Properties6.ql @@ -7,7 +7,7 @@ import csharp from Property p where p.hasName("Y") and - p.getDeclaringType().hasQualifiedName("Properties.Point") and + p.getDeclaringType().hasQualifiedName("Properties", "Point") and p.isReadWrite() and p.isPublic() and p.isAutoImplemented() diff --git a/csharp/ql/test/library-tests/properties/Properties7.ql b/csharp/ql/test/library-tests/properties/Properties7.ql index 8ad1f8a37e3..f31c29d1ec8 100644 --- a/csharp/ql/test/library-tests/properties/Properties7.ql +++ b/csharp/ql/test/library-tests/properties/Properties7.ql @@ -7,7 +7,7 @@ import csharp from Property p where p.hasName("X") and - p.getDeclaringType().hasQualifiedName("Properties.ReadOnlyPoint") and + p.getDeclaringType().hasQualifiedName("Properties", "ReadOnlyPoint") and p.isReadWrite() and p.isPublic() and p.isAutoImplemented() and diff --git a/csharp/ql/test/library-tests/properties/Properties8.ql b/csharp/ql/test/library-tests/properties/Properties8.ql index eeb6bd41dc2..4033ea92484 100644 --- a/csharp/ql/test/library-tests/properties/Properties8.ql +++ b/csharp/ql/test/library-tests/properties/Properties8.ql @@ -7,7 +7,7 @@ import csharp from Property p where p.hasName("X") and - p.getDeclaringType().hasQualifiedName("Properties.A") and + p.getDeclaringType().hasQualifiedName("Properties", "A") and p.isReadOnly() and p.isVirtual() select p diff --git a/csharp/ql/test/library-tests/properties/Properties9.ql b/csharp/ql/test/library-tests/properties/Properties9.ql index 5b22b9d5394..e55ffafa131 100644 --- a/csharp/ql/test/library-tests/properties/Properties9.ql +++ b/csharp/ql/test/library-tests/properties/Properties9.ql @@ -7,7 +7,7 @@ import csharp from Property p where p.hasName("Z") and - p.getDeclaringType().hasQualifiedName("Properties.A") and + p.getDeclaringType().hasQualifiedName("Properties", "A") and p.isReadWrite() and not p.isAutoImplemented() and p.isAbstract() and diff --git a/csharp/ql/test/library-tests/types/Types36.ql b/csharp/ql/test/library-tests/types/Types36.ql index cf9c897996b..f8462097802 100644 --- a/csharp/ql/test/library-tests/types/Types36.ql +++ b/csharp/ql/test/library-tests/types/Types36.ql @@ -1,5 +1,5 @@ import csharp from Interface i -where i.hasQualifiedName("System.Collections.IEnumerable") +where i.hasQualifiedName("System.Collections", "IEnumerable") select i.getQualifiedName()