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

GroovyEclipse RunAs Groovy doesn't check for a main method with the wrong kind of arguments

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.0-JSR-6
    • Fix Version/s: 1.0-JSR-6
    • Component/s: None
    • Labels:
      None

      Description

      GroovyEclipse tries to run:

      class MyClass {
      static void main()

      { println "I am running" }

      }

      And then fails with:
      java.lang.NoSuchMethodError: main
      Exception in thread "main"

      Both the commandline and GroovyJ have a more meaningful message:
      Caught: groovy.lang.GroovyRuntimeException: This script or class could not be run.
      It should either:

      • have a main method,
      • be a class extending GroovyTestCase,
      • or implement the Runnable interface.

      GroovyJ also lets you select this class as a runnable class when
      setting up a run configuration. This class should be weeded out of
      the list of available classes.

      The main reason behind this is that EclipsePlugin is doing a partial
      check look for main and then static (and currently also incorrectly void - See Groovy-1394)
      but doesn't check for Object[] args.

        Attachments

          Activity

            People

            • Assignee:
              jshickey Scott Hickey
              Reporter:
              paulk Paul King
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: