Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I typehint away this reflection warning?

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

"Reflection warning, call to paintComponent can't be resolved"

like image 521
Timothy Pratley Avatar asked Oct 06 '09 09:10

Timothy Pratley


2 Answers

Because proxy-super use implicit this.

(let [^javax.swing.JPanel this this]
  (proxy-super paintComponent g))
like image 168
Yaocl Avatar answered Oct 22 '22 21:10

Yaocl


It looks like the warning is for the line

(proxy-super paintComponent g)

Does the parent class of javax.swing.JPanel have a paintComponent method?

Removing that line works for me.

like image 31
chollida Avatar answered Sep 18 '22 15:09

chollida