Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[native-image] ClassCastException when using java.awt.TrayIcon #6659

Closed
n1kub opened this issue May 22, 2023 · 18 comments
Closed

[native-image] ClassCastException when using java.awt.TrayIcon #6659

n1kub opened this issue May 22, 2023 · 18 comments
Assignees

Comments

@n1kub
Copy link

n1kub commented May 22, 2023

Describe the issue
Getting ClassCastException when using a SystemTray icon.

Steps to reproduce the issue
Sample code:

package org.example;

import java.awt.AWTException;
import java.awt.Desktop;
import java.awt.Image;
import java.awt.MenuItem;
import java.awt.PopupMenu;
import java.awt.SystemTray;
import java.awt.TrayIcon;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;

public class Application {

    public static void main(String[] args) {
        String folderPath = System.getProperty("user.home");
        createTrayMenu(folderPath);
    }

    public static void createTrayMenu(String applicationFolderPath) {
        if (SystemTray.isSupported()) {
            // Create a popup menu
            PopupMenu popup = new PopupMenu();

            MenuItem openLogsFolder = new MenuItem("Open log folder");
            openLogsFolder.addActionListener(new ActionListener() {
                                                 @Override
                                                 public void actionPerformed(ActionEvent e) {
                                                     Desktop desktop = Desktop.getDesktop();
                                                     try {
                                                         File dirToOpen = new File(applicationFolderPath);
                                                         desktop.open(dirToOpen);
                                                     } catch (IOException ex) {
                                                         try {
                                                             Files.createDirectories(Path.of(applicationFolderPath));
                                                         } catch (IOException IOe) {
                                                             IOe.printStackTrace();
                                                             System.out.println("Unknown file error");
                                                         }
                                                     }
                                                 }
                                             }

            );
            popup.add(openLogsFolder);

            MenuItem exitItem = new MenuItem("Exit");
            exitItem.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    System.exit(0);
                }
            });
            popup.add(exitItem);
            Image image = new BufferedImage(16, 16, BufferedImage.TYPE_INT_ARGB);
            final TrayIcon trayIcon = new TrayIcon(image, "Sample", popup);
            trayIcon.setImageAutoSize(true);
            trayIcon.setToolTip("Sample");

            try {

                SystemTray.getSystemTray().add(trayIcon);
            } catch (AWTException e) {
                System.err.println("TrayIcon could not be added.");
            } catch (ClassCastException ignored) {
            }
        } else {
            System.err.println("System tray not supported!");
        }

    }

}

Describe GraalVM and your environment:

  • GraalVM version: 22.3.1
  • JDK major version: 17
  • OS: Windows 10
  • Architecture: AMD64

More details
Exception:

Exception in thread "AWT-Windows": java.lang.ClassCastException
java.lang.ClassCastException: java.awt.TrayIcon cannot be cast to java.awt.Component
        at [email protected]/sun.awt.windows.WToolkit.eventLoop(WToolkit.java)
        at [email protected]/sun.awt.windows.WToolkit.run(WToolkit.java:365)
        at [email protected]/java.lang.Thread.run(Thread.java:833)
        at com.oracle.svm.core.thread.PlatformThreads.threadStartRoutine(PlatformThreads.java:775)
        at com.oracle.svm.core.windows.WindowsPlatformThreads.osThreadStartRoutine(WindowsPlatformThreads.java:178)
@n1kub
Copy link
Author

n1kub commented May 22, 2023

Dirty hack found by @pquiring to solve this mentioned in #3414
But it there any other solutions to avoid ClassCastException?

@pquiring
Copy link

pquiring commented May 22, 2023

The only proper way to fix this is to make java.awt.TrayIcon extend java.awt.Component.
But that opens a large can of worms.
I've opened numerous issues with the JDK but that team doesn't seem to care about Graal.
They just want to close issues assigned to them asap (I can relate to that).

@n1kub
Copy link
Author

n1kub commented May 23, 2023

As far as I understand, it was extended until ~2005-2007, but then they removed it. So I think there should be some other solution for this.

@n1kub
Copy link
Author

n1kub commented May 23, 2023

I'm not sure, but this issue seems to be related to JDK-2162580

@oubidar-Abderrahim oubidar-Abderrahim self-assigned this May 26, 2023
@oubidar-Abderrahim
Copy link
Member

Thank you for reaching out about this.

@oubidar-Abderrahim
Copy link
Member

@pejovica do you think we can do something about this issue from Graal's side?

@n1kub
Copy link
Author

n1kub commented May 26, 2023

@oubidar-Abderrahim that seems to be native-image error, because nothing raised if run jar with graalvm
Maybe some configs are missed while compiling awt.dll or something like that

@n1kub
Copy link
Author

n1kub commented May 26, 2023

BTW I was trying to add as much awt classes as I can to reflect-config and jni-config, but it doesn't help

@n1kub
Copy link
Author

n1kub commented May 26, 2023

Here is my last attempt. I tried to insert it to both reflect-config and jni-config

{
    "name": "java.awt.AWTEvent",
    "allDeclaredFields": true,
    "allDeclaredConstructors": true,
    "allPublicConstructors": true,
    "allDeclaredMethods": true,
    "allPublicMethods": true
  },
  {
    "name": "java.awt.AlphaComposite",
    "allDeclaredFields": true,
    "allDeclaredConstructors": true,
    "allPublicConstructors": true,
    "allDeclaredMethods": true,
    "allPublicMethods": true
  },
  {
    "name": "java.awt.Color",
    "allDeclaredFields": true,
    "allDeclaredConstructors": true,
    "allPublicConstructors": true,
    "allDeclaredMethods": true,
    "allPublicMethods": true
  },
  {
    "name": "java.awt.Component",
    "allDeclaredFields": true,
    "allDeclaredConstructors": true,
    "allPublicConstructors": true,
    "allDeclaredMethods": true,
    "allPublicMethods": true
  },
  {
    "name": "java.awt.Container",
    "allDeclaredFields": true,
    "allDeclaredConstructors": true,
    "allPublicConstructors": true,
    "allDeclaredMethods": true,
    "allPublicMethods": true
  },
  {
    "name": "java.awt.Cursor",
    "allDeclaredFields": true,
    "allDeclaredConstructors": true,
    "allPublicConstructors": true,
    "allDeclaredMethods": true,
    "allPublicMethods": true
  },
  {
    "name": "java.awt.Event",
    "allDeclaredFields": true,
    "allDeclaredConstructors": true,
    "allPublicConstructors": true,
    "allDeclaredMethods": true,
    "allPublicMethods": true
  },
  {
    "name": "java.awt.Font",
    "allDeclaredFields": true,
    "allDeclaredConstructors": true,
    "allPublicConstructors": true,
    "allDeclaredMethods": true,
    "allPublicMethods": true
  },
  {
    "name": "java.awt.FontMetrics",
    "allDeclaredFields": true,
    "allDeclaredConstructors": true,
    "allPublicConstructors": true,
    "allDeclaredMethods": true,
    "allPublicMethods": true
  },
  {
    "name": "java.awt.Frame",
    "allDeclaredFields": true,
    "allDeclaredConstructors": true,
    "allPublicConstructors": true,
    "allDeclaredMethods": true,
    "allPublicMethods": true
  },
  {
    "name": "java.awt.Insets",
    "allDeclaredFields": true,
    "allDeclaredConstructors": true,
    "allPublicConstructors": true,
    "allDeclaredMethods": true,
    "allPublicMethods": true
  },
  {
    "name": "java.awt.Menu",
    "allDeclaredFields": true,
    "allDeclaredConstructors": true,
    "allPublicConstructors": true,
    "allDeclaredMethods": true,
    "allPublicMethods": true
  },
  {
    "name": "java.awt.MenuComponent",
    "allDeclaredFields": true,
    "allDeclaredConstructors": true,
    "allPublicConstructors": true,
    "allDeclaredMethods": true,
    "allPublicMethods": true
  },
  {
    "name": "java.awt.MenuItem",
    "allDeclaredFields": true,
    "allDeclaredConstructors": true,
    "allPublicConstructors": true,
    "allDeclaredMethods": true,
    "allPublicMethods": true
  },
  {
    "name": "java.awt.Point",
    "allDeclaredFields": true,
    "allDeclaredConstructors": true,
    "allPublicConstructors": true,
    "allDeclaredMethods": true,
    "allPublicMethods": true
  },
  {
    "name": "java.awt.PopupMenu",
    "allDeclaredFields": true,
    "allDeclaredConstructors": true,
    "allPublicConstructors": true,
    "allDeclaredMethods": true,
    "allPublicMethods": true
  },
  {
    "name": "java.awt.Rectangle",
    "allDeclaredFields": true,
    "allDeclaredConstructors": true,
    "allPublicConstructors": true,
    "allDeclaredMethods": true,
    "allPublicMethods": true
  },
  {
    "name": "java.awt.SequencedEvent",
    "allDeclaredFields": true,
    "allDeclaredConstructors": true,
    "allPublicConstructors": true,
    "allDeclaredMethods": true,
    "allPublicMethods": true
  },
  {
    "name": "java.awt.Toolkit",
    "allDeclaredFields": true,
    "allDeclaredConstructors": true,
    "allPublicConstructors": true,
    "allDeclaredMethods": true,
    "allPublicMethods": true
  },
  {
    "name": "java.awt.TrayIcon",
    "allDeclaredFields": true,
    "allDeclaredConstructors": true,
    "allPublicConstructors": true,
    "allDeclaredMethods": true,
    "allPublicMethods": true
  },
  {
    "name": "java.awt.Window",
    "allDeclaredFields": true,
    "allDeclaredConstructors": true,
    "allPublicConstructors": true,
    "allDeclaredMethods": true,
    "allPublicMethods": true
  },
  {
    "name": "java.awt.Window$Type",
    "allDeclaredFields": true,
    "allDeclaredConstructors": true,
    "allPublicConstructors": true,
    "allDeclaredMethods": true,
    "allPublicMethods": true
  },
  {
    "name": "java.awt.desktop.UserSessionEvent$Reason",
    "allDeclaredFields": true,
    "allDeclaredConstructors": true,
    "allPublicConstructors": true,
    "allDeclaredMethods": true,
    "allPublicMethods": true
  },
  {
    "name": "java.awt.event.ComponentEvent",
    "allDeclaredFields": true,
    "allDeclaredConstructors": true,
    "allPublicConstructors": true,
    "allDeclaredMethods": true,
    "allPublicMethods": true
  },
  {
    "name": "java.awt.event.InputEvent",
    "allDeclaredFields": true,
    "allDeclaredConstructors": true,
    "allPublicConstructors": true,
    "allDeclaredMethods": true,
    "allPublicMethods": true
  },
  {
    "name": "java.awt.event.MouseEvent",
    "allDeclaredFields": true,
    "allDeclaredConstructors": true,
    "allPublicConstructors": true,
    "allDeclaredMethods": true,
    "allPublicMethods": true
  },
  {
    "name": "java.awt.geom.AffineTransform",
    "allDeclaredFields": true,
    "allDeclaredConstructors": true,
    "allPublicConstructors": true,
    "allDeclaredMethods": true,
    "allPublicMethods": true
  },
  {
    "name": "java.awt.geom.GeneralPath",
    "allDeclaredFields": true,
    "allDeclaredConstructors": true,
    "allPublicConstructors": true,
    "allDeclaredMethods": true,
    "allPublicMethods": true
  },
  {
    "name": "java.awt.geom.Path2D",
    "allDeclaredFields": true,
    "allDeclaredConstructors": true,
    "allPublicConstructors": true,
    "allDeclaredMethods": true,
    "allPublicMethods": true
  },
  {
    "name": "java.awt.geom.Path2D$Float",
    "allDeclaredFields": true,
    "allDeclaredConstructors": true,
    "allPublicConstructors": true,
    "allDeclaredMethods": true,
    "allPublicMethods": true
  },
  {
    "name": "java.awt.geom.Point2D$Float",
    "allDeclaredFields": true,
    "allDeclaredConstructors": true,
    "allPublicConstructors": true,
    "allDeclaredMethods": true,
    "allPublicMethods": true
  },
  {
    "name": "java.awt.geom.Rectangle2D$Float",
    "allDeclaredFields": true,
    "allDeclaredConstructors": true,
    "allPublicConstructors": true,
    "allDeclaredMethods": true,
    "allPublicMethods": true
  },
  {
    "name": "java.awt.image.BufferedImage",
    "allDeclaredFields": true,
    "allDeclaredConstructors": true,
    "allPublicConstructors": true,
    "allDeclaredMethods": true,
    "allPublicMethods": true
  },
  {
    "name": "java.awt.image.ColorModel",
    "allDeclaredFields": true,
    "allDeclaredConstructors": true,
    "allPublicConstructors": true,
    "allDeclaredMethods": true,
    "allPublicMethods": true
  },
  {
    "name": "java.awt.image.DirectColorModel",
    "allDeclaredFields": true,
    "allDeclaredConstructors": true,
    "allPublicConstructors": true,
    "allDeclaredMethods": true,
    "allPublicMethods": true
  },
  {
    "name": "java.awt.image.IndexColorModel",
    "allDeclaredFields": true,
    "allDeclaredConstructors": true,
    "allPublicConstructors": true,
    "allDeclaredMethods": true,
    "allPublicMethods": true
  },
  {
    "name": "java.awt.image.Raster",
    "allDeclaredFields": true,
    "allDeclaredConstructors": true,
    "allPublicConstructors": true,
    "allDeclaredMethods": true,
    "allPublicMethods": true
  },
  {
    "name": "java.awt.image.SampleModel",
    "allDeclaredFields": true,
    "allDeclaredConstructors": true,
    "allPublicConstructors": true,
    "allDeclaredMethods": true,
    "allPublicMethods": true
  },
  {
    "name": "java.awt.image.SinglePixelPackedSampleModel",
    "allDeclaredFields": true,
    "allDeclaredConstructors": true,
    "allPublicConstructors": true,
    "allDeclaredMethods": true,
    "allPublicMethods": true
  },
  {
    "name": "sun.awt.AWTAutoShutdown",
    "allDeclaredFields": true,
    "allDeclaredConstructors": true,
    "allPublicConstructors": true,
    "allDeclaredMethods": true,
    "allPublicMethods": true
  },
  {
    "name": "sun.awt.EmbeddedFrame",
    "allDeclaredFields": true,
    "allDeclaredConstructors": true,
    "allPublicConstructors": true,
    "allDeclaredMethods": true,
    "allPublicMethods": true
  },
  {
    "name": "sun.awt.ExtendedKeyCodes",
    "allDeclaredFields": true,
    "allDeclaredConstructors": true,
    "allPublicConstructors": true,
    "allDeclaredMethods": true,
    "allPublicMethods": true
  },
  {
    "name": "sun.awt.FontDescriptor",
    "allDeclaredFields": true,
    "allDeclaredConstructors": true,
    "allPublicConstructors": true,
    "allDeclaredMethods": true,
    "allPublicMethods": true
  },
  {
    "name": "sun.awt.LightweightFrame",
    "allDeclaredFields": true,
    "allDeclaredConstructors": true,
    "allPublicConstructors": true,
    "allDeclaredMethods": true,
    "allPublicMethods": true
  },
  {
    "name": "sun.awt.PlatformFont",
    "allDeclaredFields": true,
    "allDeclaredConstructors": true,
    "allPublicConstructors": true,
    "allDeclaredMethods": true,
    "allPublicMethods": true
  },
  {
    "name": "sun.awt.SunHints",
    "allDeclaredFields": true,
    "allDeclaredConstructors": true,
    "allPublicConstructors": true,
    "allDeclaredMethods": true,
    "allPublicMethods": true
  },
  {
    "name": "sun.awt.SunToolkit",
    "allDeclaredFields": true,
    "allDeclaredConstructors": true,
    "allPublicConstructors": true,
    "allDeclaredMethods": true,
    "allPublicMethods": true
  },
  {
    "name": "sun.awt.TimedWindowEvent",
    "allDeclaredFields": true,
    "allDeclaredConstructors": true,
    "allPublicConstructors": true,
    "allDeclaredMethods": true,
    "allPublicMethods": true
  },
  {
    "name": "sun.awt.Win32GraphicsConfig",
    "allDeclaredFields": true,
    "allDeclaredConstructors": true,
    "allPublicConstructors": true,
    "allDeclaredMethods": true,
    "allPublicMethods": true
  },
  {
    "name": "sun.awt.Win32GraphicsDevice",
    "allDeclaredFields": true,
    "allDeclaredConstructors": true,
    "allPublicConstructors": true,
    "allDeclaredMethods": true,
    "allPublicMethods": true
  },
  {
    "name": "sun.awt.Win32GraphicsEnvironment",
    "allDeclaredFields": true,
    "allDeclaredConstructors": true,
    "allPublicConstructors": true,
    "allDeclaredMethods": true,
    "allPublicMethods": true
  },
  {
    "name": "sun.awt.im.InputMethodWindow",
    "allDeclaredFields": true,
    "allDeclaredConstructors": true,
    "allPublicConstructors": true,
    "allDeclaredMethods": true,
    "allPublicMethods": true
  },
  {
    "name": "sun.awt.image.BufImgSurfaceData$ICMColorData",
    "allDeclaredFields": true,
    "allDeclaredConstructors": true,
    "allPublicConstructors": true,
    "allDeclaredMethods": true,
    "allPublicMethods": true
  },
  {
    "name": "sun.awt.image.ImageRepresentation",
    "allDeclaredFields": true,
    "allDeclaredConstructors": true,
    "allPublicConstructors": true,
    "allDeclaredMethods": true,
    "allPublicMethods": true
  },
  {
    "name": "sun.awt.image.IntegerComponentRaster",
    "allDeclaredFields": true,
    "allDeclaredConstructors": true,
    "allPublicConstructors": true,
    "allDeclaredMethods": true,
    "allPublicMethods": true
  },
  {
    "name": "sun.awt.image.SunVolatileImage",
    "allDeclaredFields": true,
    "allDeclaredConstructors": true,
    "allPublicConstructors": true,
    "allDeclaredMethods": true,
    "allPublicMethods": true
  },
  {
    "name": "sun.awt.image.VolatileSurfaceManager",
    "allDeclaredFields": true,
    "allDeclaredConstructors": true,
    "allPublicConstructors": true,
    "allDeclaredMethods": true,
    "allPublicMethods": true
  },
  {
    "name": "sun.awt.windows.WComponentPeer",
    "allDeclaredFields": true,
    "allDeclaredConstructors": true,
    "allPublicConstructors": true,
    "allDeclaredMethods": true,
    "allPublicMethods": true
  },
  {
    "name": "sun.awt.windows.WDesktopPeer",
    "allDeclaredFields": true,
    "allDeclaredConstructors": true,
    "allPublicConstructors": true,
    "allDeclaredMethods": true,
    "allPublicMethods": true
  },
  {
    "name": "sun.awt.windows.WFontPeer",
    "allDeclaredFields": true,
    "allDeclaredConstructors": true,
    "allPublicConstructors": true,
    "allDeclaredMethods": true,
    "allPublicMethods": true
  },
  {
    "name": "sun.awt.windows.WFramePeer",
    "allDeclaredFields": true,
    "allDeclaredConstructors": true,
    "allPublicConstructors": true,
    "allDeclaredMethods": true,
    "allPublicMethods": true
  },
  {
    "name": "sun.awt.windows.WMenuItemPeer",
    "allDeclaredFields": true,
    "allDeclaredConstructors": true,
    "allPublicConstructors": true,
    "allDeclaredMethods": true,
    "allPublicMethods": true
  },
  {
    "name": "sun.awt.windows.WObjectPeer",
    "allDeclaredFields": true,
    "allDeclaredConstructors": true,
    "allPublicConstructors": true,
    "allDeclaredMethods": true,
    "allPublicMethods": true
  },
  {
    "name": "sun.awt.windows.WPanelPeer",
    "allDeclaredFields": true,
    "allDeclaredConstructors": true,
    "allPublicConstructors": true,
    "allDeclaredMethods": true,
    "allPublicMethods": true
  },
  {
    "name": "sun.awt.windows.WToolkit",
    "allDeclaredFields": true,
    "allDeclaredConstructors": true,
    "allPublicConstructors": true,
    "allDeclaredMethods": true,
    "allPublicMethods": true
  },
  {
    "name": "sun.awt.windows.WTrayIconPeer",
    "allDeclaredFields": true,
    "allDeclaredConstructors": true,
    "allPublicConstructors": true,
    "allDeclaredMethods": true,
    "allPublicMethods": true
  },
  {
    "name": "sun.awt.windows.WWindowPeer",
    "allDeclaredFields": true,
    "allDeclaredConstructors": true,
    "allPublicConstructors": true,
    "allDeclaredMethods": true,
    "allPublicMethods": true
  },
  {
    "name": "sun.font.CharToGlyphMapper",
    "allDeclaredFields": true,
    "allDeclaredConstructors": true,
    "allPublicConstructors": true,
    "allDeclaredMethods": true,
    "allPublicMethods": true
  },
  {
    "name": "sun.font.Font2D",
    "allDeclaredFields": true,
    "allDeclaredConstructors": true,
    "allPublicConstructors": true,
    "allDeclaredMethods": true,
    "allPublicMethods": true
  },
  {
    "name": "sun.font.FontDesignMetrics",
    "allDeclaredFields": true,
    "allDeclaredConstructors": true,
    "allPublicConstructors": true,
    "allDeclaredMethods": true,
    "allPublicMethods": true
  },
  {
    "name": "sun.font.FontStrike",
    "allDeclaredFields": true,
    "allDeclaredConstructors": true,
    "allPublicConstructors": true,
    "allDeclaredMethods": true,
    "allPublicMethods": true
  },
  {
    "name": "sun.font.FreetypeFontScaler",
    "allDeclaredFields": true,
    "allDeclaredConstructors": true,
    "allPublicConstructors": true,
    "allDeclaredMethods": true,
    "allPublicMethods": true
  },
  {
    "name": "sun.font.GlyphList",
    "allDeclaredFields": true,
    "allDeclaredConstructors": true,
    "allPublicConstructors": true,
    "allDeclaredMethods": true,
    "allPublicMethods": true
  },
  {
    "name": "sun.font.PhysicalStrike",
    "allDeclaredFields": true,
    "allDeclaredConstructors": true,
    "allPublicConstructors": true,
    "allDeclaredMethods": true,
    "allPublicMethods": true
  },
  {
    "name": "sun.font.StrikeMetrics",
    "allDeclaredFields": true,
    "allDeclaredConstructors": true,
    "allPublicConstructors": true,
    "allDeclaredMethods": true,
    "allPublicMethods": true
  },
  {
    "name": "sun.font.TrueTypeFont",
    "allDeclaredFields": true,
    "allDeclaredConstructors": true,
    "allPublicConstructors": true,
    "allDeclaredMethods": true,
    "allPublicMethods": true
  },
  {
    "name": "sun.font.Type1Font",
    "allDeclaredFields": true,
    "allDeclaredConstructors": true,
    "allPublicConstructors": true,
    "allDeclaredMethods": true,
    "allPublicMethods": true
  },
  {
    "name": "sun.java2d.Disposer",
    "allDeclaredFields": true,
    "allDeclaredConstructors": true,
    "allPublicConstructors": true,
    "allDeclaredMethods": true,
    "allPublicMethods": true
  },
  {
    "name": "sun.java2d.InvalidPipeException",
    "allDeclaredFields": true,
    "allDeclaredConstructors": true,
    "allPublicConstructors": true,
    "allDeclaredMethods": true,
    "allPublicMethods": true
  },
  {
    "name": "sun.java2d.NullSurfaceData",
    "allDeclaredFields": true,
    "allDeclaredConstructors": true,
    "allPublicConstructors": true,
    "allDeclaredMethods": true,
    "allPublicMethods": true
  },
  {
    "name": "sun.java2d.SunGraphics2D",
    "allDeclaredFields": true,
    "allDeclaredConstructors": true,
    "allPublicConstructors": true,
    "allDeclaredMethods": true,
    "allPublicMethods": true
  },
  {
    "name": "sun.java2d.SurfaceData",
    "allDeclaredFields": true,
    "allDeclaredConstructors": true,
    "allPublicConstructors": true,
    "allDeclaredMethods": true,
    "allPublicMethods": true
  },
  {
    "name": "sun.java2d.d3d.D3DGraphicsDevice$1",
    "allDeclaredFields": true,
    "allDeclaredConstructors": true,
    "allPublicConstructors": true,
    "allDeclaredMethods": true,
    "allPublicMethods": true
  },
  {
    "name": "sun.java2d.d3d.D3DRenderQueue$1",
    "allDeclaredFields": true,
    "allDeclaredConstructors": true,
    "allPublicConstructors": true,
    "allDeclaredMethods": true,
    "allPublicMethods": true
  },
  {
    "name": "sun.java2d.loops.Blit",
    "allDeclaredFields": true,
    "allDeclaredConstructors": true,
    "allPublicConstructors": true,
    "allDeclaredMethods": true,
    "allPublicMethods": true
  },
  {
    "name": "sun.java2d.loops.BlitBg",
    "allDeclaredFields": true,
    "allDeclaredConstructors": true,
    "allPublicConstructors": true,
    "allDeclaredMethods": true,
    "allPublicMethods": true
  },
  {
    "name": "sun.java2d.loops.CompositeType",
    "allDeclaredFields": true,
    "allDeclaredConstructors": true,
    "allPublicConstructors": true,
    "allDeclaredMethods": true,
    "allPublicMethods": true
  },
  {
    "name": "sun.java2d.loops.DrawGlyphList",
    "allDeclaredFields": true,
    "allDeclaredConstructors": true,
    "allPublicConstructors": true,
    "allDeclaredMethods": true,
    "allPublicMethods": true
  },
  {
    "name": "sun.java2d.loops.DrawGlyphListAA",
    "allDeclaredFields": true,
    "allDeclaredConstructors": true,
    "allPublicConstructors": true,
    "allDeclaredMethods": true,
    "allPublicMethods": true
  },
  {
    "name": "sun.java2d.loops.DrawGlyphListLCD",
    "allDeclaredFields": true,
    "allDeclaredConstructors": true,
    "allPublicConstructors": true,
    "allDeclaredMethods": true,
    "allPublicMethods": true
  },
  {
    "name": "sun.java2d.loops.DrawLine",
    "allDeclaredFields": true,
    "allDeclaredConstructors": true,
    "allPublicConstructors": true,
    "allDeclaredMethods": true,
    "allPublicMethods": true
  },
  {
    "name": "sun.java2d.loops.DrawParallelogram",
    "allDeclaredFields": true,
    "allDeclaredConstructors": true,
    "allPublicConstructors": true,
    "allDeclaredMethods": true,
    "allPublicMethods": true
  },
  {
    "name": "sun.java2d.loops.DrawPath",
    "allDeclaredFields": true,
    "allDeclaredConstructors": true,
    "allPublicConstructors": true,
    "allDeclaredMethods": true,
    "allPublicMethods": true
  },
  {
    "name": "sun.java2d.loops.DrawPolygons",
    "allDeclaredFields": true,
    "allDeclaredConstructors": true,
    "allPublicConstructors": true,
    "allDeclaredMethods": true,
    "allPublicMethods": true
  },
  {
    "name": "sun.java2d.loops.DrawRect",
    "allDeclaredFields": true,
    "allDeclaredConstructors": true,
    "allPublicConstructors": true,
    "allDeclaredMethods": true,
    "allPublicMethods": true
  },
  {
    "name": "sun.java2d.loops.FillParallelogram",
    "allDeclaredFields": true,
    "allDeclaredConstructors": true,
    "allPublicConstructors": true,
    "allDeclaredMethods": true,
    "allPublicMethods": true
  },
  {
    "name": "sun.java2d.loops.FillPath",
    "allDeclaredFields": true,
    "allDeclaredConstructors": true,
    "allPublicConstructors": true,
    "allDeclaredMethods": true,
    "allPublicMethods": true
  },
  {
    "name": "sun.java2d.loops.FillRect",
    "allDeclaredFields": true,
    "allDeclaredConstructors": true,
    "allPublicConstructors": true,
    "allDeclaredMethods": true,
    "allPublicMethods": true
  },
  {
    "name": "sun.java2d.loops.FillSpans",
    "allDeclaredFields": true,
    "allDeclaredConstructors": true,
    "allPublicConstructors": true,
    "allDeclaredMethods": true,
    "allPublicMethods": true
  },
  {
    "name": "sun.java2d.loops.GraphicsPrimitive",
    "allDeclaredFields": true,
    "allDeclaredConstructors": true,
    "allPublicConstructors": true,
    "allDeclaredMethods": true,
    "allPublicMethods": true
  },
  {
    "name": "sun.java2d.loops.GraphicsPrimitiveMgr",
    "allDeclaredFields": true,
    "allDeclaredConstructors": true,
    "allPublicConstructors": true,
    "allDeclaredMethods": true,
    "allPublicMethods": true
  },
  {
    "name": "sun.java2d.loops.MaskBlit",
    "allDeclaredFields": true,
    "allDeclaredConstructors": true,
    "allPublicConstructors": true,
    "allDeclaredMethods": true,
    "allPublicMethods": true
  },
  {
    "name": "sun.java2d.loops.MaskFill",
    "allDeclaredFields": true,
    "allDeclaredConstructors": true,
    "allPublicConstructors": true,
    "allDeclaredMethods": true,
    "allPublicMethods": true
  },
  {
    "name": "sun.java2d.loops.ScaledBlit",
    "allDeclaredFields": true,
    "allDeclaredConstructors": true,
    "allPublicConstructors": true,
    "allDeclaredMethods": true,
    "allPublicMethods": true
  },
  {
    "name": "sun.java2d.loops.SurfaceType",
    "allDeclaredFields": true,
    "allDeclaredConstructors": true,
    "allPublicConstructors": true,
    "allDeclaredMethods": true,
    "allPublicMethods": true
  },
  {
    "name": "sun.java2d.loops.TransformHelper",
    "allDeclaredFields": true,
    "allDeclaredConstructors": true,
    "allPublicConstructors": true,
    "allDeclaredMethods": true,
    "allPublicMethods": true
  },
  {
    "name": "sun.java2d.loops.XORComposite",
    "allDeclaredFields": true,
    "allDeclaredConstructors": true,
    "allPublicConstructors": true,
    "allDeclaredMethods": true,
    "allPublicMethods": true
  },
  {
    "name": "sun.java2d.pipe.Region",
    "allDeclaredFields": true,
    "allDeclaredConstructors": true,
    "allPublicConstructors": true,
    "allDeclaredMethods": true,
    "allPublicMethods": true
  },
  {
    "name": "sun.java2d.pipe.RegionIterator",
    "allDeclaredFields": true,
    "allDeclaredConstructors": true,
    "allPublicConstructors": true,
    "allDeclaredMethods": true,
    "allPublicMethods": true
  },
  {
    "name": "sun.java2d.windows.WindowsFlags",
    "allDeclaredFields": true,
    "allDeclaredConstructors": true,
    "allPublicConstructors": true,
    "allDeclaredMethods": true,
    "allPublicMethods": true
  }

@pquiring
Copy link

@oubidar-Abderrahim that seems to be native-image error, because nothing raised if run jar with graalvm Maybe some configs are missed while compiling awt.dll or something like that

It doesn't happen when run with normal JVM because the native code just ignores the exception. But Graal handles exceptions in native code differently.

@n1kub
Copy link
Author

n1kub commented May 30, 2023

It doesn't happen when run with normal JVM because the native code just ignores the exception. But Graal handles exceptions in native code differently

@pquiring so why can't we handle it and ignore in graal way? Do you have any idea about how graal does it?
@oubidar-Abderrahim as far as I understand, exception is raised here, @pquiring correct me if I'am wrong

@pquiring
Copy link

I'm not sure if graal can be made to ignore native exceptions, best to ask graal devs.

@n1kub
Copy link
Author

n1kub commented May 31, 2023

That's question to @pejovica and @oubidar-Abderrahim though

@pejovica
Copy link
Member

This has actually already been fixed on master by #6524.

@n1kub
Copy link
Author

n1kub commented Jun 15, 2023

@pejovica @oubidar-Abderrahim still facing the same issue with latest graalvm 23.0.0
Should I build graalvm from master by myself? Has #6524 been included into 23.0.0?

@pquiring
Copy link

You could download a nightly build at https://github.com/graalvm/graalvm-ce-dev-builds/releases

@pquiring
Copy link

The latest graal 23.1.0 dev builds have fixed this issue. See #6524

@n1kub
Copy link
Author

n1kub commented Aug 4, 2023

related to #4921

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants