When an SWT ``++Image++`` accesses a file directly, it holds the file handle for the life of the image. Do this many times, and the OS may run out of available file handles. At minimum, SWT ``++Image++``s which directly access files should not be ``++static++``. At best, they should access their files through ``++ImageDescriptors++``, which do not hold open file handles.


This rule looks for ``++org.eclipse.swt.graphics.Image++``s which both directly access a file on the file path and are ``++static++``.


== Noncompliant Code Example

----
import org.eclipse.swt.graphics.Image;

public class MyView {
  static Image myImage = new Image("path/to/file.png"); // Noncompliant
----


== Compliant Solution

----
import org.eclipse.swt.graphics.Image;
import org.eclipse.jface.resource.ImageDescriptor;

public class MyView {
  static ImageDescription myDescriptor = ImageDescriptor.createFromFile("path/to/file.png");  // Doesn't hold file handle open
  Image myImage = myDescriptor.getImage();
----

