[ 
https://issues.apache.org/jira/browse/STORM-554?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14227128#comment-14227128
 ] 

zhangjinlong commented on STORM-554:
------------------------------------

the type of real argument is "StormTopology", however the "get-task-object" 
function use a error type declaration "TopologyContext", clojure REPL will not 
raise error. 

you can see this example:

; SLIME 20100404
user> (defn get_date_time [^String date] (.getTime date))
#'user/get_date_time
user> (def today (java.util.Date.))
#'user/today
user> (get_date_time today)
1416187016658
user> (def ss (String. "today"))
#'user/ss
user> (get_date_time ss)
No matching field found: getTime for class java.lang.String
  [Thrown class java.lang.IllegalArgumentException]

the "get_date_time" function use a error type declaration "String" to param 
date, however, there is no “getTime” method in class “String”. in fact, the 
"getTime" method is defined by "java.util.Date". (get_date_time today), clojure 
REPL will not raise error; but (get_date_time ss), clojure REPL must raise 
error "No matching field found: getTime for class java.lang.String". the 
question of "get-task-object" function is same as "get_date_time".

because the type of real argument is "StormTopology", "get-task-object" calls 
"get_spouts" and "get_bolts" not raise error, but, if the type of real argument 
is "TopologyContext", "get-task-object" calls "get_spouts" and "get_bolts" must 
raise error. class TopologyContext do not have "get_spouts" and "get_bolts" 
method.

in such a situation, clojure REPL type check will not raise error.

> the "get-task-object" function in task.clj,the type of first param "topology" 
> should be ^StormTopology not ^TopologyContext
> ---------------------------------------------------------------------------------------------------------------------------
>
>                 Key: STORM-554
>                 URL: https://issues.apache.org/jira/browse/STORM-554
>             Project: Apache Storm
>          Issue Type: Bug
>    Affects Versions: 0.9.3-rc2
>            Reporter: zhangjinlong
>            Assignee: zhangjinlong
>             Fix For: 0.9.3-rc2
>
>
> the "get-task-object" function in task.clj,the type of first param "topology" 
> should be ^StormTopology not ^TopologyContext



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to