Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-5340

AbstractQueryCommand constructor should be protected for subclassing

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 1.8.4, 2.0-beta-2
    • 2.0-beta-3, 1.8.7
    • SQL processing
    • None

    Description

      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.

      Attachments

        Activity

          People

            paulk Paul King
            spannjp Markus Spann
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: