Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-467

method invocation should be able to choose between int and float types

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.0-beta-6
    • 1.0-beta-7
    • None
    • None

    Description

      The following script

      http://jroller.com/comments/jurberg/Weblog/not_so_groovy

      fails since drawString() has methods which can take int or float. The MetaClass should choose the one with ints if the difference between the two is purely numerical precision.

      import java.awt.*
      import javax.swing.*

      class TestPanel extends JComponent {
      property text = "Testing"

      TestPanel()

      { setBackground(Color.black) }

      void paintComponent(Graphics g)

      { r = this.getBounds() g.setColor(Color.black) // TODO remove the Integer! g.fillRect(0, 0, (Integer) r.width, (Integer) r.height) g.setColor(Color.white) g.drawString(text, 50, 50) }

      static main(args) {
      cv = new TestPanel()
      fr = new JFrame(title:"Groovy Test Panel", size:[260, 200])
      fr.windowClosing =

      { e | System.exit(0) }

      fr.getContentPane().add(cv)
      fr.show()
      cv.repaint()
      }
      }

      Attachments

        Activity

          People

            jez Jeremy Rayner
            jstrachan James Strachan
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: