Skip to content

Commit 7eec988

Browse files
committed
XML.qll: Remove abstract from class hierarchy.
1 parent cafe55f commit 7eec988

File tree

5 files changed

+25
-15
lines changed
  • cpp/ql/src/semmle/code/cpp
  • csharp/ql/src/semmle/code/csharp
  • javascript/ql/src/semmle/javascript
  • java/ql/src/semmle/code/xml
  • python/ql/src/semmle/python/xml

5 files changed

+25
-15
lines changed

cpp/ql/src/semmle/code/cpp/XML.qll

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@
44

55
import semmle.files.FileSystem
66

7+
private class TXMLLocatable = @xmldtd or @xmlelement or @xmlattribute or @xmlnamespace or @xmlcomment or @xmlcharacters;
8+
79
/** An XML element that has a location. */
8-
abstract class XMLLocatable extends @xmllocatable {
10+
class XMLLocatable extends @xmllocatable, TXMLLocatable {
911
/** Gets the source location for this element. */
1012
Location getLocation() { xmllocations(this, result) }
1113

@@ -33,7 +35,7 @@ abstract class XMLLocatable extends @xmllocatable {
3335
}
3436

3537
/** Gets a textual representation of this element. */
36-
abstract string toString();
38+
string toString() { none() } // overridden in subclasses
3739
}
3840

3941
/**
@@ -51,7 +53,7 @@ class XMLParent extends @xmlparent {
5153
* Gets a printable representation of this XML parent.
5254
* (Intended to be overridden in subclasses.)
5355
*/
54-
abstract string getName();
56+
string getName() { none() } // overridden in subclasses
5557

5658
/** Gets the file to which this XML parent belongs. */
5759
XMLFile getFile() { result = this or xmlElements(this, _, _, _, result) }

csharp/ql/src/semmle/code/csharp/XML.qll

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@
44

55
import semmle.files.FileSystem
66

7+
private class TXMLLocatable = @xmldtd or @xmlelement or @xmlattribute or @xmlnamespace or @xmlcomment or @xmlcharacters;
8+
79
/** An XML element that has a location. */
8-
abstract class XMLLocatable extends @xmllocatable {
10+
class XMLLocatable extends @xmllocatable, TXMLLocatable {
911
/** Gets the source location for this element. */
1012
Location getLocation() { xmllocations(this, result) }
1113

@@ -33,7 +35,7 @@ abstract class XMLLocatable extends @xmllocatable {
3335
}
3436

3537
/** Gets a textual representation of this element. */
36-
abstract string toString();
38+
string toString() { none() } // overridden in subclasses
3739
}
3840

3941
/**
@@ -51,7 +53,7 @@ class XMLParent extends @xmlparent {
5153
* Gets a printable representation of this XML parent.
5254
* (Intended to be overridden in subclasses.)
5355
*/
54-
abstract string getName();
56+
string getName() { none() } // overridden in subclasses
5557

5658
/** Gets the file to which this XML parent belongs. */
5759
XMLFile getFile() { result = this or xmlElements(this, _, _, _, result) }

java/ql/src/semmle/code/xml/XML.qll

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@
44

55
import semmle.files.FileSystem
66

7+
private class TXMLLocatable = @xmldtd or @xmlelement or @xmlattribute or @xmlnamespace or @xmlcomment or @xmlcharacters;
8+
79
/** An XML element that has a location. */
8-
abstract class XMLLocatable extends @xmllocatable {
10+
class XMLLocatable extends @xmllocatable, TXMLLocatable {
911
/** Gets the source location for this element. */
1012
Location getLocation() { xmllocations(this, result) }
1113

@@ -33,7 +35,7 @@ abstract class XMLLocatable extends @xmllocatable {
3335
}
3436

3537
/** Gets a textual representation of this element. */
36-
abstract string toString();
38+
string toString() { none() } // overridden in subclasses
3739
}
3840

3941
/**
@@ -51,7 +53,7 @@ class XMLParent extends @xmlparent {
5153
* Gets a printable representation of this XML parent.
5254
* (Intended to be overridden in subclasses.)
5355
*/
54-
abstract string getName();
56+
string getName() { none() } // overridden in subclasses
5557

5658
/** Gets the file to which this XML parent belongs. */
5759
XMLFile getFile() { result = this or xmlElements(this, _, _, _, result) }

javascript/ql/src/semmle/javascript/XML.qll

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@
44

55
import semmle.files.FileSystem
66

7+
private class TXMLLocatable = @xmldtd or @xmlelement or @xmlattribute or @xmlnamespace or @xmlcomment or @xmlcharacters;
8+
79
/** An XML element that has a location. */
8-
abstract class XMLLocatable extends @xmllocatable {
10+
class XMLLocatable extends @xmllocatable, TXMLLocatable {
911
/** Gets the source location for this element. */
1012
Location getLocation() { xmllocations(this, result) }
1113

@@ -33,7 +35,7 @@ abstract class XMLLocatable extends @xmllocatable {
3335
}
3436

3537
/** Gets a textual representation of this element. */
36-
abstract string toString();
38+
string toString() { none() } // overridden in subclasses
3739
}
3840

3941
/**
@@ -51,7 +53,7 @@ class XMLParent extends @xmlparent {
5153
* Gets a printable representation of this XML parent.
5254
* (Intended to be overridden in subclasses.)
5355
*/
54-
abstract string getName();
56+
string getName() { none() } // overridden in subclasses
5557

5658
/** Gets the file to which this XML parent belongs. */
5759
XMLFile getFile() { result = this or xmlElements(this, _, _, _, result) }

python/ql/src/semmle/python/xml/XML.qll

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@
44

55
import semmle.files.FileSystem
66

7+
private class TXMLLocatable = @xmldtd or @xmlelement or @xmlattribute or @xmlnamespace or @xmlcomment or @xmlcharacters;
8+
79
/** An XML element that has a location. */
8-
abstract class XMLLocatable extends @xmllocatable {
10+
class XMLLocatable extends @xmllocatable, TXMLLocatable {
911
/** Gets the source location for this element. */
1012
Location getLocation() { xmllocations(this, result) }
1113

@@ -33,7 +35,7 @@ abstract class XMLLocatable extends @xmllocatable {
3335
}
3436

3537
/** Gets a textual representation of this element. */
36-
abstract string toString();
38+
string toString() { none() } // overridden in subclasses
3739
}
3840

3941
/**
@@ -51,7 +53,7 @@ class XMLParent extends @xmlparent {
5153
* Gets a printable representation of this XML parent.
5254
* (Intended to be overridden in subclasses.)
5355
*/
54-
abstract string getName();
56+
string getName() { none() } // overridden in subclasses
5557

5658
/** Gets the file to which this XML parent belongs. */
5759
XMLFile getFile() { result = this or xmlElements(this, _, _, _, result) }

0 commit comments

Comments
 (0)