This discussion is archived
10 Replies Latest reply: May 8, 2012 9:10 AM by gimbal2 RSS

Bad PropertyDescriptior Performance on Java7

wzberger Newbie
Currently Being Moderated
The test case below takes around 100ms with Java6 and around 5000ms with Java7 - is this a known Java7 bug?
public class PropertyDescriptorTest
{
  public static void main(String[] args)
  {
    JComponent c = new JPanel();
    String name = "name";
    long start = System.currentTimeMillis();
    try
    {
      for (int i=0; i<1000; i++)
        new PropertyDescriptor(name, c.getClass()).getReadMethod().invoke(c);
    }  
    catch (Exception e)
    {
      e.printStackTrace();
    }
    long stop = System.currentTimeMillis();
    System.err.println(stop-start);
  }
}

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points