To customize the behavior of groovy.sql.Sql we override "protected groovy.sql.Sql.createQueryCommand(String)". Next, we attempt to implement the inner class groovy.sql.Sql.AbstractQueryCommand. Its only constructor "AbstractQueryCommand(String sql)" is package-protected. therefore subclassing is impossible unless we put our code into package "groovy.sql" which is against best practice.
As a side note, AbstractQueryCommand is non-static, therefore requires an instance of groovy.sql.Sql for instantiation.
I guess one would only want to subclass AbstractQueryCommand after subclassing Sql first, so this won't be an issue. Still, an instance of Sql could be provided on the constructor explicitly and let the inner class be static.