Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JDK 8 compatibility broken with wide character support #560

Closed
lread opened this issue Mar 14, 2024 · 0 comments
Closed

JDK 8 compatibility broken with wide character support #560

lread opened this issue Mar 14, 2024 · 0 comments

Comments

@lread
Copy link
Collaborator

lread commented Mar 14, 2024

Version
Current master (as of this writing 17f2f23)

Platform
All JDK v8

Symptom
Throws java.lang.ClassCastException when attempting to fill input.

Reproduction

(require '[etaoin.api :as e])

(def driver (e/firefox))

(e/go driver "https://google.com")

(e/fill driver :active "hello")

Actual behavior
throws exception when calling fill:

user> *e
;; => #error {
 :cause "java.lang.Integer cannot be cast to java.lang.Character"
 :via
 [{:type java.lang.ClassCastException
   :message "java.lang.Integer cannot be cast to java.lang.Character"
   :at [etaoin.api$codepoints$fn__16937 invoke "api.clj" 2821]}]
 :trace
 [[etaoin.api$codepoints$fn__16937 invoke "api.clj" 2821]
  [clojure.core$map$fn__5587 invoke "core.clj" 2745]
  [clojure.lang.LazySeq sval "LazySeq.java" 40]
  [clojure.lang.LazySeq seq "LazySeq.java" 49]
  [clojure.lang.RT seq "RT.java" 528]
  [clojure.core$seq__5124 invokeStatic "core.clj" 137]
  [clojure.core$apply invokeStatic "core.clj" 652]
  [clojure.string$join invokeStatic "string.clj" 180]
  [clojure.string$join invoke "string.clj" 180]
  [etaoin.api$eval16954$fn__16955 doInvoke "api.clj" 2858]
  [clojure.lang.RestFn invoke "RestFn.java" 445]
  [clojure.lang.MultiFn invoke "MultiFn.java" 238]
  [clojure.lang.AFn applyToHelper "AFn.java" 160]
  [clojure.lang.AFn applyTo "AFn.java" 144]
  [clojure.core$apply invokeStatic "core.clj" 663]
  [clojure.core$apply invoke "core.clj" 652]
  [etaoin.api$fill invokeStatic "api.clj" 2894]
  [etaoin.api$fill doInvoke "api.clj" 2883]
  [clojure.lang.RestFn invoke "RestFn.java" 445]
  [user$eval17744 invokeStatic "NO_SOURCE_FILE" 7]
  [user$eval17744 invoke "NO_SOURCE_FILE" 7]
  [clojure.lang.Compiler eval "Compiler.java" 7062]
  [clojure.lang.Compiler eval "Compiler.java" 7025]
  [clojure.core$eval invokeStatic "core.clj" 3206]
  [clojure.core$eval invoke "core.clj" 3202]
  [nrepl.middleware.interruptible_eval$evaluate$fn__1363$fn__1364 invoke "interruptible_eval.clj" 87]
  [clojure.lang.AFn applyToHelper "AFn.java" 152]
  [clojure.lang.AFn applyTo "AFn.java" 144]
  [clojure.core$apply invokeStatic "core.clj" 657]
  [clojure.core$with_bindings_STAR_ invokeStatic "core.clj" 1965]
  [clojure.core$with_bindings_STAR_ doInvoke "core.clj" 1965]
  [clojure.lang.RestFn invoke "RestFn.java" 425]
  [nrepl.middleware.interruptible_eval$evaluate$fn__1363 invoke "interruptible_eval.clj" 87]
  [clojure.main$repl$read_eval_print__8572$fn__8575 invoke "main.clj" 243]
  [clojure.main$repl$read_eval_print__8572 invoke "main.clj" 243]
  [clojure.main$repl$fn__8581 invoke "main.clj" 261]
  [clojure.main$repl invokeStatic "main.clj" 261]
  [clojure.main$repl doInvoke "main.clj" 177]
  [clojure.lang.RestFn invoke "RestFn.java" 1523]
  [nrepl.middleware.interruptible_eval$evaluate invokeStatic "interruptible_eval.clj" 84]
  [nrepl.middleware.interruptible_eval$evaluate invoke "interruptible_eval.clj" 56]
  [nrepl.middleware.interruptible_eval$interruptible_eval$fn__1396$fn__1400 invoke "interruptible_eval.clj" 152]
  [clojure.lang.AFn run "AFn.java" 22]
  [nrepl.middleware.session$session_exec$main_loop__1465$fn__1469 invoke "session.clj" 218]
  [nrepl.middleware.session$session_exec$main_loop__1465 invoke "session.clj" 217]
  [clojure.lang.AFn run "AFn.java" 22]
  [java.lang.Thread run "Thread.java" 750]]}

Expected behavior
Fills the field

Diagnosis
In #552, we used (Character/toString int codepoint), a signature introduced in jdk11.

Action
I'll follow up:

  • Find a jdk8-compatible technique to achieve the same effect.
  • CI testing should exercise jdk8 (but we don't need to exercise each supported jdk under all browser/OS combos, that would be too many flakey CI jobs)

Failing that, will bump min jdk to 11.

@lread lread closed this as completed in 0e3a11e Mar 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant