reflection - 如何键入提示消除此反射警告?

标签 reflection clojure

(set! *warn-on-reflection* true)
(proxy [javax.swing.JPanel] []
  (paintComponent [#^java.awt.Graphics g]
    (proxy-super paintComponent g)
    (.fillRect g 100 100 10 10)))

“反射警告,无法解析对paintComponent的调用”

最佳答案

因为 proxy-super 使用隐式 this

(let [^javax.swing.JPanel this this]
  (proxy-super paintComponent g))

关于reflection - 如何键入提示消除此反射警告?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1524614/

相关文章:

.net - 如何使用反射判断类/方法是否可访问?

Go 中的反射类型和值

clojure - 为什么 (int 10) 会产生一个 Long 实例?

clojure - 使用 compojure 从数据库提供二进制文件

Java匿名子类和常规(非匿名)子类的区别

reflection - 将字符串值转换为函数调用

clojure - 如何在运行时访问正在运行的 Clojure 应用程序的版本号?

jar - Leiningen:创建可执行 jar 以在没有 java -jar 的情况下运行

c# - 测试对象是否实现接口(interface)

emacs - Cider 有像 Cursive(IntelliJ IDEA) 那样的实时模板吗?