groovy
  1. groovy
  2. GROOVY-5340

AbstractQueryCommand constructor should be protected for subclassing

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.8.4, 2.0-beta-2
    • Fix Version/s: 2.0-beta-3, 1.8.7
    • Component/s: SQL processing
    • Labels:
      None
    • Number of attachments :
      0

      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.

        Activity

          People

          • Assignee:
            Paul King
            Reporter:
            Markus Spann
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: