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

Groovyshell.runMainOrTestOrRunnable

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.0-beta-6
    • 1.0-beta-7
    • None
    • None

    Description

      should have detect the main method first before running it. otherwise any missing method error (not just missing main() method) will confuse the program.

      Something like:

      Method meth = null;
      try {
      meth = scriptClass.getDeclaredMethod("main", new Class[]

      {String[].class}

      );
      } catch (NoSuchMethodException e) {
      try {
      meth = scriptClass.getDeclaredMethod("main", new Class[]

      {Object[].class}

      );
      } catch (NoSuchMethodException e1) {
      try {
      meth = scriptClass.getDeclaredMethod("main", new Class[]

      {Object.class}

      );
      } catch (NoSuchMethodException e2) {
      }
      }
      }

      if(meth != null) {
      InvokerHelper.invokeMethod(scriptClass, "main", new Object[]

      { args }

      );
      }
      else {
      //

      Attachments

        Activity

          People

            guillaume Guillaume Sauthier
            bingran Bing Ran
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: