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

Spellchecking

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 1.7-beta-1
    • 1.7-rc-1
    • None
    • None
    • any

    Description

      Ages ago i wrote a spell checker for groovy, that gives more helpful information in case a MissingMethodExeption or Missing Property Exception is thrown.
      I recently picked it up and finished the patch.
      It uses reflection to find missing methods with a low edit distance relative to the requested method. It also use the edit distance
      as a method to rank the method so that the most probable solution is displayed first.
      The performance impact is isolated to exception.getMessage for properties and Methods, but not for constructors.
      I don't know of a case where this should impact a working program but it should be taken into consideration.

      The unit tests are only partial(they era complete for the string/array metrics) but the other coverage is currently weak.
      Missing method ================================================================
      groovy:000> Integer.vallueOf("10")
      ERROR groovy.lang.MissingMethodException: No signature of method: static java.lang.Integer.vallueOf() is applicable for argument types: (java.lang.String) values: [10]
      Possible solutions: valueOf(java.lang.String), valueOf(java.lang.String, int), valueOf(int)
      at groovysh_evaluate.run (groovysh_evaluate:2)
      ...
      groovy:000>

      Missing Constructor ================================================================
      new Integer(new Object())
      ERROR groovy.lang.GroovyRuntimeException: Could not find matching constructor for: java.lang.Integer(java.lang.Object)
      Possible solutions: java.lang.Integer(int), java.lang.Integer(java.lang.String)
      at groovysh_evaluate.run (groovysh_evaluate:2)
      ...

      Missing Constructor ================================================================
      new java.awt.Point().xy
      ERROR groovy.lang.MissingPropertyException: No such property: xy for class: java.awt.Point
      Possible solutions: x, y
      at groovysh_evaluate.run (groovysh_evaluate:2)
      ...

      Attachments

        Activity

          People

            blackdrag Jochen Theodorou
            hjalmare Hjalmar Ekengren
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: