Commits

Anonymous committed 11cff88

Update.

  • Participants
  • Parent commits 7be2e95

Comments (0)

Files changed (5)

src/META-INF/upgrade/j.l.String.new.hint

-new String($str) :: $str instanceof java.lang.String && matchesAny($str, "$other.substring($i)", "$other.substring($i, $l)")
+new String($str) :: $str instanceof java.lang.String &&
+                    matchesAny($str, "$other.substring($i)", "$other.substring($i, $l)")
 =>
 $str
 ;;

src/META-INF/upgrade/j.l.Thread.sleep.hint

 import javax.lang.model.element.Modifier;
 ?>
 
-'Thread.sleep in synchronized context':
 Thread.sleep($time) :: inSynchronizedContext($_);;
 
 <?
+    //custom condition:
     private boolean inSynchronizedContext(Variable current) {
         while (current != null) {
             //current is synchronized block:

src/META-INF/upgrade/j.s.ImageIcon.hint

-new javax.swing.ImageIcon($image)
+Xnew javax.swing.ImageIcon($image)
 =>
 org.openide.util.ImageUtilities.image2Icon($image)
 ;;

src/META-INF/upgrade/j.u.c.l.Lock.hint

 $lock.lock();
 $statements$;
 $lock.unlock(); :: $lock instanceof java.util.concurrent.locks.Lock
+
 =>
+
 $lock.lock();
 try {
     $statements$;

src/demo/ImgIcon.java

 package demo;
 
-import java.net.URL;
+import java.awt.Image;
 import javax.swing.Icon;
 import javax.swing.ImageIcon;
 import org.openide.util.ImageUtilities;
 
 public class ImgIcon {
 
+    private final Image iconImage= ImageUtilities.loadImage("/icon/location.png");
+    
     public Icon getIcon1() {
-        return new ImageIcon(ImageUtilities.loadImage("/icon/location.png"));
+        return new ImageIcon(iconImage);
     }
     
     public Icon getIcon2() {
+        return ImageUtilities.image2Icon(iconImage);
+    }
+    
+    public Icon getIcon3() {
         return new ImageIcon("/icon/location.png");
     }