From 7eec988fb5f9c026ac35fab1450b51e78e4a0442 Mon Sep 17 00:00:00 2001 From: Cornelius Riemenschneider Date: Wed, 25 Nov 2020 17:22:03 +0100 Subject: [PATCH 1/2] XML.qll: Remove abstract from class hierarchy. --- cpp/ql/src/semmle/code/cpp/XML.qll | 8 +++++--- csharp/ql/src/semmle/code/csharp/XML.qll | 8 +++++--- java/ql/src/semmle/code/xml/XML.qll | 8 +++++--- javascript/ql/src/semmle/javascript/XML.qll | 8 +++++--- python/ql/src/semmle/python/xml/XML.qll | 8 +++++--- 5 files changed, 25 insertions(+), 15 deletions(-) diff --git a/cpp/ql/src/semmle/code/cpp/XML.qll b/cpp/ql/src/semmle/code/cpp/XML.qll index 713903b63e6..caeb321b792 100755 --- a/cpp/ql/src/semmle/code/cpp/XML.qll +++ b/cpp/ql/src/semmle/code/cpp/XML.qll @@ -4,8 +4,10 @@ import semmle.files.FileSystem +private class TXMLLocatable = @xmldtd or @xmlelement or @xmlattribute or @xmlnamespace or @xmlcomment or @xmlcharacters; + /** An XML element that has a location. */ -abstract class XMLLocatable extends @xmllocatable { +class XMLLocatable extends @xmllocatable, TXMLLocatable { /** Gets the source location for this element. */ Location getLocation() { xmllocations(this, result) } @@ -33,7 +35,7 @@ abstract class XMLLocatable extends @xmllocatable { } /** Gets a textual representation of this element. */ - abstract string toString(); + string toString() { none() } // overridden in subclasses } /** @@ -51,7 +53,7 @@ class XMLParent extends @xmlparent { * Gets a printable representation of this XML parent. * (Intended to be overridden in subclasses.) */ - abstract string getName(); + string getName() { none() } // overridden in subclasses /** Gets the file to which this XML parent belongs. */ XMLFile getFile() { result = this or xmlElements(this, _, _, _, result) } diff --git a/csharp/ql/src/semmle/code/csharp/XML.qll b/csharp/ql/src/semmle/code/csharp/XML.qll index 713903b63e6..caeb321b792 100755 --- a/csharp/ql/src/semmle/code/csharp/XML.qll +++ b/csharp/ql/src/semmle/code/csharp/XML.qll @@ -4,8 +4,10 @@ import semmle.files.FileSystem +private class TXMLLocatable = @xmldtd or @xmlelement or @xmlattribute or @xmlnamespace or @xmlcomment or @xmlcharacters; + /** An XML element that has a location. */ -abstract class XMLLocatable extends @xmllocatable { +class XMLLocatable extends @xmllocatable, TXMLLocatable { /** Gets the source location for this element. */ Location getLocation() { xmllocations(this, result) } @@ -33,7 +35,7 @@ abstract class XMLLocatable extends @xmllocatable { } /** Gets a textual representation of this element. */ - abstract string toString(); + string toString() { none() } // overridden in subclasses } /** @@ -51,7 +53,7 @@ class XMLParent extends @xmlparent { * Gets a printable representation of this XML parent. * (Intended to be overridden in subclasses.) */ - abstract string getName(); + string getName() { none() } // overridden in subclasses /** Gets the file to which this XML parent belongs. */ XMLFile getFile() { result = this or xmlElements(this, _, _, _, result) } diff --git a/java/ql/src/semmle/code/xml/XML.qll b/java/ql/src/semmle/code/xml/XML.qll index 713903b63e6..caeb321b792 100755 --- a/java/ql/src/semmle/code/xml/XML.qll +++ b/java/ql/src/semmle/code/xml/XML.qll @@ -4,8 +4,10 @@ import semmle.files.FileSystem +private class TXMLLocatable = @xmldtd or @xmlelement or @xmlattribute or @xmlnamespace or @xmlcomment or @xmlcharacters; + /** An XML element that has a location. */ -abstract class XMLLocatable extends @xmllocatable { +class XMLLocatable extends @xmllocatable, TXMLLocatable { /** Gets the source location for this element. */ Location getLocation() { xmllocations(this, result) } @@ -33,7 +35,7 @@ abstract class XMLLocatable extends @xmllocatable { } /** Gets a textual representation of this element. */ - abstract string toString(); + string toString() { none() } // overridden in subclasses } /** @@ -51,7 +53,7 @@ class XMLParent extends @xmlparent { * Gets a printable representation of this XML parent. * (Intended to be overridden in subclasses.) */ - abstract string getName(); + string getName() { none() } // overridden in subclasses /** Gets the file to which this XML parent belongs. */ XMLFile getFile() { result = this or xmlElements(this, _, _, _, result) } diff --git a/javascript/ql/src/semmle/javascript/XML.qll b/javascript/ql/src/semmle/javascript/XML.qll index 713903b63e6..caeb321b792 100755 --- a/javascript/ql/src/semmle/javascript/XML.qll +++ b/javascript/ql/src/semmle/javascript/XML.qll @@ -4,8 +4,10 @@ import semmle.files.FileSystem +private class TXMLLocatable = @xmldtd or @xmlelement or @xmlattribute or @xmlnamespace or @xmlcomment or @xmlcharacters; + /** An XML element that has a location. */ -abstract class XMLLocatable extends @xmllocatable { +class XMLLocatable extends @xmllocatable, TXMLLocatable { /** Gets the source location for this element. */ Location getLocation() { xmllocations(this, result) } @@ -33,7 +35,7 @@ abstract class XMLLocatable extends @xmllocatable { } /** Gets a textual representation of this element. */ - abstract string toString(); + string toString() { none() } // overridden in subclasses } /** @@ -51,7 +53,7 @@ class XMLParent extends @xmlparent { * Gets a printable representation of this XML parent. * (Intended to be overridden in subclasses.) */ - abstract string getName(); + string getName() { none() } // overridden in subclasses /** Gets the file to which this XML parent belongs. */ XMLFile getFile() { result = this or xmlElements(this, _, _, _, result) } diff --git a/python/ql/src/semmle/python/xml/XML.qll b/python/ql/src/semmle/python/xml/XML.qll index 713903b63e6..caeb321b792 100755 --- a/python/ql/src/semmle/python/xml/XML.qll +++ b/python/ql/src/semmle/python/xml/XML.qll @@ -4,8 +4,10 @@ import semmle.files.FileSystem +private class TXMLLocatable = @xmldtd or @xmlelement or @xmlattribute or @xmlnamespace or @xmlcomment or @xmlcharacters; + /** An XML element that has a location. */ -abstract class XMLLocatable extends @xmllocatable { +class XMLLocatable extends @xmllocatable, TXMLLocatable { /** Gets the source location for this element. */ Location getLocation() { xmllocations(this, result) } @@ -33,7 +35,7 @@ abstract class XMLLocatable extends @xmllocatable { } /** Gets a textual representation of this element. */ - abstract string toString(); + string toString() { none() } // overridden in subclasses } /** @@ -51,7 +53,7 @@ class XMLParent extends @xmlparent { * Gets a printable representation of this XML parent. * (Intended to be overridden in subclasses.) */ - abstract string getName(); + string getName() { none() } // overridden in subclasses /** Gets the file to which this XML parent belongs. */ XMLFile getFile() { result = this or xmlElements(this, _, _, _, result) } From 3bfb398516b1d4c5e86f936432fda5b2696e8c26 Mon Sep 17 00:00:00 2001 From: Cornelius Riemenschneider Date: Wed, 25 Nov 2020 18:20:50 +0100 Subject: [PATCH 2/2] Autoformat XML.qll. --- cpp/ql/src/semmle/code/cpp/XML.qll | 3 ++- csharp/ql/src/semmle/code/csharp/XML.qll | 3 ++- java/ql/src/semmle/code/xml/XML.qll | 3 ++- javascript/ql/src/semmle/javascript/XML.qll | 3 ++- python/ql/src/semmle/python/xml/XML.qll | 3 ++- 5 files changed, 10 insertions(+), 5 deletions(-) diff --git a/cpp/ql/src/semmle/code/cpp/XML.qll b/cpp/ql/src/semmle/code/cpp/XML.qll index caeb321b792..5871fed0ddd 100755 --- a/cpp/ql/src/semmle/code/cpp/XML.qll +++ b/cpp/ql/src/semmle/code/cpp/XML.qll @@ -4,7 +4,8 @@ import semmle.files.FileSystem -private class TXMLLocatable = @xmldtd or @xmlelement or @xmlattribute or @xmlnamespace or @xmlcomment or @xmlcharacters; +private class TXMLLocatable = + @xmldtd or @xmlelement or @xmlattribute or @xmlnamespace or @xmlcomment or @xmlcharacters; /** An XML element that has a location. */ class XMLLocatable extends @xmllocatable, TXMLLocatable { diff --git a/csharp/ql/src/semmle/code/csharp/XML.qll b/csharp/ql/src/semmle/code/csharp/XML.qll index caeb321b792..5871fed0ddd 100755 --- a/csharp/ql/src/semmle/code/csharp/XML.qll +++ b/csharp/ql/src/semmle/code/csharp/XML.qll @@ -4,7 +4,8 @@ import semmle.files.FileSystem -private class TXMLLocatable = @xmldtd or @xmlelement or @xmlattribute or @xmlnamespace or @xmlcomment or @xmlcharacters; +private class TXMLLocatable = + @xmldtd or @xmlelement or @xmlattribute or @xmlnamespace or @xmlcomment or @xmlcharacters; /** An XML element that has a location. */ class XMLLocatable extends @xmllocatable, TXMLLocatable { diff --git a/java/ql/src/semmle/code/xml/XML.qll b/java/ql/src/semmle/code/xml/XML.qll index caeb321b792..5871fed0ddd 100755 --- a/java/ql/src/semmle/code/xml/XML.qll +++ b/java/ql/src/semmle/code/xml/XML.qll @@ -4,7 +4,8 @@ import semmle.files.FileSystem -private class TXMLLocatable = @xmldtd or @xmlelement or @xmlattribute or @xmlnamespace or @xmlcomment or @xmlcharacters; +private class TXMLLocatable = + @xmldtd or @xmlelement or @xmlattribute or @xmlnamespace or @xmlcomment or @xmlcharacters; /** An XML element that has a location. */ class XMLLocatable extends @xmllocatable, TXMLLocatable { diff --git a/javascript/ql/src/semmle/javascript/XML.qll b/javascript/ql/src/semmle/javascript/XML.qll index caeb321b792..5871fed0ddd 100755 --- a/javascript/ql/src/semmle/javascript/XML.qll +++ b/javascript/ql/src/semmle/javascript/XML.qll @@ -4,7 +4,8 @@ import semmle.files.FileSystem -private class TXMLLocatable = @xmldtd or @xmlelement or @xmlattribute or @xmlnamespace or @xmlcomment or @xmlcharacters; +private class TXMLLocatable = + @xmldtd or @xmlelement or @xmlattribute or @xmlnamespace or @xmlcomment or @xmlcharacters; /** An XML element that has a location. */ class XMLLocatable extends @xmllocatable, TXMLLocatable { diff --git a/python/ql/src/semmle/python/xml/XML.qll b/python/ql/src/semmle/python/xml/XML.qll index caeb321b792..5871fed0ddd 100755 --- a/python/ql/src/semmle/python/xml/XML.qll +++ b/python/ql/src/semmle/python/xml/XML.qll @@ -4,7 +4,8 @@ import semmle.files.FileSystem -private class TXMLLocatable = @xmldtd or @xmlelement or @xmlattribute or @xmlnamespace or @xmlcomment or @xmlcharacters; +private class TXMLLocatable = + @xmldtd or @xmlelement or @xmlattribute or @xmlnamespace or @xmlcomment or @xmlcharacters; /** An XML element that has a location. */ class XMLLocatable extends @xmllocatable, TXMLLocatable {