Skip to content

How to find subclasses of an abstract CodeQL class #16746

Answered by smowton
ayosten asked this question in Q&A
Discussion options

You must be logged in to vote

The problem is that all the all the subclasses are private. For example, in Allocation.qll we have

private class NewAllocationExpr extends AllocationExpr, NewExpr { ... }

A private class like that can contribute to the abstract type AllocationExpr without itself being a publicly-accessible (and therefore documented) subtype of AllocationExpr.

It isn't even necessary for the other classes brought into AllocationExpr to be mentioned in the extends line-- for example, I could have

private class SomeExprs extends AllocationExpr {

  SomeExprs() { this.toString() = "Hello world" }

}

That would bring any expression (the supertype of AllocationExpr) that happens to stringify to "Hello world" …

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@ayosten
Comment options

@smowton
Comment options

Answer selected by ayosten
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants