The code below crashes on Unix:
import java.awt.GraphicsConfiguration;
import java.awt.GraphicsDevice;
import java.awt.Robot;
public class CrashRobot {
public static void main(final String[] args) throws Exception {
final GraphicsDevice gd = new GraphicsDevice() {
@Override
public int getType() {
return TYPE_RASTER_SCREEN;
}
@Override
public String getIDstring() {
return "Custom screen device";
}
@Override
public GraphicsConfiguration[] getConfigurations() {
return new GraphicsConfiguration[0];
}
@Override
public GraphicsConfiguration getDefaultConfiguration() {
return null;
}
};
final Robot r = new Robot(gd);
r.getPixelColor(0, 0);
}
}
On macOS the java.lang.ClassCastException is occured.