Groovy
  1. Groovy
  2. GROOVY-3793

unable to resolve class when multiple classes in the same script

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Not A Problem
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Environment:
      Linux 2.6.9-78.0.0.0.1.ELsmp #1 SMP Fri Jul 25 14:41:56 EDT 2008 i686 i686 i386 GNU/Linux

      Description

      Sdklib.groovy :

      package odilib
      public class Sdklib extends Framework {
      def test() {
      throw new ObjectAlreadyExists ('some text')
      }
      }
      public class ObjectAlreadyExists extends Exception {}
      =========================================

      my_script.groovy :

      import odilib.*
      def x = new Sdklib ()
      try

      { x.test() }

      catch (ObjectAlreadyExists e) {}

      Run as :

      groovy my_script.groovy

      Error :

      org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed, my_script.groovy: xx: unable to resolve class ObjectAlreadyExists
      @ line xx, column 5.
      } catch (ObjectAlreadyExists e) {
      ^

      1 error

      As you could see, Sdklib.groovy has 2 classes that belong to package odilib, the second one defines exception.
      From the outside script the first class named after the script Sdklib is visible, but not the second one corresponding to the exception.

        Issue Links

          Activity

            People

            • Assignee:
              Jochen Theodorou
              Reporter:
              Boris Kock
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development