tools.analyzer

emit-form completely omits some metadata that causes reflection warning if eval'd

Details

  • Type: Defect Defect
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Completed
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None

Description

To reproduce, do 'lein new reflection' and replace contents of src/reflection/core.clj with the following:

(ns reflection.core
  (:import [java.net URL]))

(set! *warn-on-reflection* true)

;; copied from namespace clojurewerkz.neocons.rest.helpers

(defn extract-id
  [^String location]
  (let [url (URL. location)]
    (Long/valueOf ^String (first (re-seq #"\d+$" (.getPath url))))))

Update to the latest Eastwood master, install, make sure eastwood version 0.1.1-SNAPSHOT is in your ~/.lein/profiles.clj, and run this command:

lein eastwood '{:debug #{:eval}}'

It should show each form that will be eval'd, starting with the not-analyzed ns form, followed by the 2 other forms that are each analyzed and are the result of emit-form, shown with metadata.

When I do that, I see the arg to Long/valueOf with no metadata at all (no String tag), which causes eval in Eastwood to generate a reflection warning. There is no reflection warning with 'lein check'.

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: