2015-02-27 17:30 GMT+01:00 Dave Ray <dave...@gmail.com>: > (let [^JEditorPane html-table (editor-pane ...)] ...) should fix it. Or > just set the caret position in the create function: > > (editor-pane :caret-position 0) >
This one I find the the best option. You only need to do it after the :text option. > or use config: > > (config! editor-pane :caret-position 0) > > On Fri, Feb 27, 2015 at 4:07 AM, Cecil Westerhof <cldwester...@gmail.com> > wrote: > >> >> 2015-02-27 11:34 GMT+01:00 Gary Verhaegen <gary.verhae...@gmail.com>: >> >>> It means the Clojure compiler cannot emit the efficient bytecode >>> directly, so it emits bytecode that calls the method reflexively. >>> >>> This only impacts performance, so if that code is not used much, it is >>> not a problem. >>> >> >> It is not used much, so it should not be a real problem. >> >> >> >> >>> The underlying problem is that jvm bytecode is typed, so ideally the >>> bytecode should be able to say "call method M of type T on object O". Here, >>> the Clojure Compiler cannot infer a type for html-table, so instead the >>> emitted bytecode is more along the lines of "ask object O to give a list of >>> all of its types, then look into each of these types to find if one has a >>> method that matches M in terms of name and number of arguments, and then >>> look at that method's signature and check if the arguments can be cast to >>> the types of the formal parameters; if there is a type with such a method, >>> invoke that method". >>> >>> This is not 100% technically accurate (in particular, i have no idea >>> what reflection does about the arguments and their types in this case), but >>> it should be roughly correct and you can easily see why that would be much >>> slower. >>> >>> If you want to remove that warning, you can annotate the html-table >>> variable, but the place where you must do that will depend on a little more >>> context than what you've given here. It is usually done at the level of var >>> declaration or in function argument lists. >>> >> >> This is the code: >> (let [html-table (editor-pane >> :content-type "text/html" >> :text (str html-start >> html-records >> html-end)) >> ] >> (.setCaretPosition html-table 0) >> >> So html-table is a JEditorPane. Should Clojure not be able to determine >> that? >> >> >> Just to satisfy my curiosity: how can I get rid of the warning? >> >> >> >> On Friday, 27 February 2015, Cecil Westerhof <cldwester...@gmail.com> >> wrote: >> >>> On a editor-pane I use: >>>> (.setCaretPosition html-table 0) >>>> >>>> And it does what it should do. But when I run: >>>> lein check >>>> >>>> I get: >>>> Reflection warning, quotes/core.clj:98:42 - call to method >>>> setCaretPosition can't be resolved (target class is unknown). >>>> >>>> Is that something to worry about? >>>> >>>> By the way, I get also some on jdbc and seesaw. >>>> >>> >> Strange enough I only get the warnings on my own code now. >> > -- Cecil Westerhof -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.