Groovy
  1. Groovy
  2. GROOVY-3233

The main(args) entry point cannot be found when a class file has multiple classes and the first class extends another class.

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.6-rc-1
    • Fix Version/s: 2.5.0-beta-1
    • Component/s: Compiler
    • Labels:
      None
    • Environment:
      Groovy Version: 1.6-RC-1 JVM: 1.6.0_11. WinXP

      Description

      Running the classes shown below results in:
      groovy -cp ..\main\groovy ..\main\groovy\MainInvokeSub.groovy
      Caught: groovy.lang.GroovyRuntimeException: This script or class could not be run.
      It should either:

      • have a main method,
      • be a JUnit test, TestNG test or extend GroovyTestCase,
      • or implement the Runnable interface.

      However, if the 'extends MainInvokeBase' is removed or if the second class is commented out, it does run.
      The only "spec" I could find about the expected behavior is in the GINA book.

      file: MainInvokeBase.groovy
      class MainInvokeBase {
      }

      file: MainInvokeSub.groovy
      class MainInvokeSub extends MainInvokeBase{
      static main(args)

      { println "Hello world!" }


      }

      def class SecondClass{
      }

        Activity

        josef betancourt created issue -
        Jochen Theodorou made changes -
        Field Original Value New Value
        Fix Version/s 1.5.8 [ 14630 ]
        Fix Version/s 1.7-beta-1 [ 14014 ]
        Guillaume Delcroix made changes -
        Fix Version/s 1.5.8 [ 14630 ]
        Fix Version/s 1.6.2 [ 15151 ]
        Guillaume Delcroix made changes -
        Fix Version/s 1.6.3 [ 15251 ]
        Fix Version/s 1.6.2 [ 15151 ]
        Guillaume Delcroix made changes -
        Fix Version/s 1.6.3 [ 15251 ]
        Guillaume Delcroix made changes -
        Fix Version/s 1.7-beta-1 [ 14014 ]
        Fix Version/s 1.7-beta-x [ 15538 ]
        Jochen Theodorou made changes -
        Fix Version/s 1.7.x [ 15538 ]
        Fix Version/s 1.8.x [ 15750 ]
        Fix Version/s 2.x [ 17013 ]
        Pascal Schumacher made changes -
        Fix Version/s 1.8.x [ 15750 ]
        Fix Version/s 2.x [ 17013 ]
        Jochen Theodorou made changes -
        Component/s Compiler [ 13529 ]
        Mark Thomas made changes -
        Project Import Sun Apr 05 13:32:57 UTC 2015 [ 1428240777691 ]
        Mark Thomas made changes -
        Workflow jira [ 12732230 ] Default workflow, editable Closed status [ 12744048 ]
        Mark Thomas made changes -
        Project Import Mon Apr 06 02:11:23 UTC 2015 [ 1428286283443 ]
        Mark Thomas made changes -
        Workflow jira [ 12973575 ] Default workflow, editable Closed status [ 12980746 ]
        Pascal Schumacher made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Fix Version/s 2.5.0-beta-1 [ 12331949 ]
        Resolution Fixed [ 1 ]

          People

          • Assignee:
            Unassigned
            Reporter:
            josef betancourt
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development