Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4939903

Should replace 'new Boolean' with Boolean.valueOf or Boolean.{TRUE,FALSE}

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P5 P5
    • 6
    • 5.0
    • client-libs
    • b15
    • generic
    • generic

      Minor performance enhancement.

      We should make this replacement. There are some notes from an email from
      ###@###.### to the desktop performance team on Oct 17, 2003
      in the Comments section.

      Here is the current list of client instances that need to be cleaned up.
      I did not include demo code or tests.

      echawkes@gradgrind:/net/jano/export/disk26/awt/echawkes/jdk15-22/src/share/classes/java/awt( 247 )% !!
      findrefs 'new Boolean('
      ./AWTEvent.java(431): arg = new Boolean(ie.getStateChange() == ItemEvent.SELECTED);
      ./font/TextAttribute.java(677): public static final Boolean STRIKETHROUGH_ON = new Boolean(true);
      ./font/TextAttribute.java(719): public static final Boolean RUN_DIRECTION_LTR = new Boolean(false);
      ./font/TextAttribute.java(725): public static final Boolean RUN_DIRECTION_RTL = new Boolean(true);
      ./font/TextAttribute.java(895): public static final Boolean SWAP_COLORS_ON = new Boolean(true);

      echawkes@gradgrind:/net/jano/export/disk26/awt/echawkes/jdk15-22/src/share/classes/sun/awt( 249 )% !246
      findrefs 'new Boolean('
      ./im/InputContext.java(504): new Boolean(clientWindowNotificationEnabled));
      ./im/InputContext.java(816): perInputMethodState.put(requester, new Boolean(enable));

      echawkes@gradgrind:/net/jano/export/disk26/awt/echawkes/jdk15-22/src/windows/classes/sun/awt/windows( 251 )% !246
      findrefs 'new Boolean('
      ./WDesktopProperties.java(120): map.put(key, new Boolean(value));
      ./WToolkit.java(787): return new Boolean(nativeDynamic);

      echawkes@gradgrind:/net/jano/export/disk26/awt/echawkes/jdk15-22/src/solaris/classes/sun/awt( 258 )% !246
      findrefs 'new Boolean('
      ./X11/XFramePeer.java(303): new Object[] {new Integer(state), new Integer(newState), new Boolean(iconic)});
      ./X11/XToolkit.java(1054): return new Boolean(isDynamicLayoutSupported());
      ./motif/MToolkit.java(545): return new Boolean(nativeDynamic);
      ./motif/MToolkit.java(561): //desktopProperties.put("awt.wheelMousePresent", new Boolean(false));
      ./X11SurfaceData.java(213): accelerationEnabled = new Boolean(prop);
      ./X11SurfaceData.java(216): accelerationEnabled = new Boolean(!isDgaAvailable());
      ./X11GraphicsEnvironment.java(767): xinerState = new Boolean(pRunningXinerama());


      In the case of TextAttribute.java, Boolean.TRUE or Boolean.FALSE
      should be used.

      There are more instances in the tests and the Swing and 2D demo code
      (see 4939913 for the swing demos). We may want to clean up the demos as well.

            son Oleg Sukhodolsky (Inactive)
            ehawkessunw Eric Hawkes (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: