Clojure

when unable to match a method, report arity caller was looking for

Details

  • Type: Enhancement Enhancement
  • Status: Open Open
  • Priority: Major Major
  • Resolution: Unresolved
  • Affects Version/s: Release 1.4
  • Fix Version/s: None
  • Component/s: None
  • Labels:
  • Patch:
    Code and Test
  • Approval:
    Vetted

Description

Original motivation: Incorrectly invoking a static method with 0 parameters yields a NoSuchFieldException:

user=> (Long/parseLong)
CompilerException java.lang.NoSuchFieldException: parseLong, compiling:(NO_SOURCE_PATH:1:1) 
user=> (Long/parseLong "5" 10 3)
CompilerException java.lang.IllegalArgumentException: No matching method: parseLong, compiling:(NO_SOURCE_PATH:2:1)

Incorrectly invoking an instance method with 0 parameters yields a message about fields as well:

user=> (.setTime (java.util.Date.))
IllegalArgumentException No matching field found: setTime for class java.util.Date  clojure.lang.Reflector.getInstanceField (Reflector.java:271)

Patch: clj-1130-v5.diff

Approach: Primum non nocere. Error reporting enhanced at the site the errors happen, compiler logic unchanged.

  1. clj-1130-v1.txt
    09/Sep/13 12:36 AM
    4 kB
    Andy Fingerhut
  2. clj-1130-v2.diff
    22/Oct/13 9:11 AM
    4 kB
    Alex Miller
  3. clj-1130-v2.txt
    04/Oct/13 3:56 PM
    4 kB
    Alex Miller
  4. clj-1130-v2-ignore-ws.diff
    04/Nov/13 8:35 AM
    3 kB
    Andy Fingerhut
  5. clj-1130-v3.diff
    06/Dec/13 9:19 PM
    5 kB
    Alex Miller
  6. clj-1130-v4.diff
    31/Jan/14 3:12 PM
    8 kB
    Stuart Halloway
  7. clj-1130-v5.diff
    31/Jan/14 3:18 PM
    4 kB
    Andy Fingerhut

Activity

People

Vote (0)
Watch (2)

Dates

  • Created:
    Updated: