diff --git a/src/java.desktop/unix/classes/sun/awt/wl/FullFrameDecorationHelper.java b/src/java.desktop/unix/classes/sun/awt/wl/FullFrameDecorationHelper.java index 115dad02e100..f1373f4658bb 100644 --- a/src/java.desktop/unix/classes/sun/awt/wl/FullFrameDecorationHelper.java +++ b/src/java.desktop/unix/classes/sun/awt/wl/FullFrameDecorationHelper.java @@ -164,7 +164,7 @@ public abstract class FullFrameDecorationHelper extends FrameDecoration { @Override public void paint(Graphics g) { - assert isRepaintNeeded(); + assert isRepaintNeeded() : "paint() called when no repaint needed"; int width = peer.getWidth(); int height = peer.getHeight(); @@ -196,7 +196,7 @@ public abstract class FullFrameDecorationHelper extends FrameDecoration { } private boolean isSignificantDrag(Point p) { - assert EventQueue.isDispatchThread(); + assert EventQueue.isDispatchThread() : "Method must only be invoked on EDT"; Objects.requireNonNull(p); return pressedLocation != null && isSignificantDragDistance(pressedLocation, p); @@ -208,7 +208,7 @@ public abstract class FullFrameDecorationHelper extends FrameDecoration { @Override boolean processMouseEvent(MouseEvent e) { - assert EventQueue.isDispatchThread(); + assert EventQueue.isDispatchThread() : "Method must only be invoked on EDT"; if (super.processMouseEvent(e)) return true; @@ -326,7 +326,7 @@ public abstract class FullFrameDecorationHelper extends FrameDecoration { } private boolean processMouseEvent(MouseEvent e) { - assert EventQueue.isDispatchThread(); + assert EventQueue.isDispatchThread() : "Method must only be invoked on EDT"; Rectangle buttonBounds = bounds.get(); boolean ourLocation = buttonBounds != null && e.getID() != MouseEvent.MOUSE_EXITED && diff --git a/src/java.desktop/unix/classes/sun/awt/wl/GtkFrameDecoration.java b/src/java.desktop/unix/classes/sun/awt/wl/GtkFrameDecoration.java index ab1a1b582a71..1f525f16f82d 100644 --- a/src/java.desktop/unix/classes/sun/awt/wl/GtkFrameDecoration.java +++ b/src/java.desktop/unix/classes/sun/awt/wl/GtkFrameDecoration.java @@ -68,7 +68,7 @@ public class GtkFrameDecoration extends FullFrameDecorationHelper { public GtkFrameDecoration(WLDecoratedPeer peer, boolean showMinimize, boolean showMaximize) { super(peer, showMinimize, showMaximize); nativePtr = nativeCreateDecoration(showMinimize, showMaximize, isDarkTheme()); - assert nativePtr != 0; + assert nativePtr != 0 : "Failed to create the native part of the decoration"; int t = nativeGetIntProperty(nativePtr, "gtk-dnd-drag-threshold"); dndThreshold = t > 0 ? t : 4; } @@ -87,8 +87,8 @@ public class GtkFrameDecoration extends FullFrameDecorationHelper { int width = peer.getWidth(); int height = titleBarHeight; - assert width >= titleBarMinWidth; - assert peer.getHeight() >= titleBarHeight; + assert width >= titleBarMinWidth : "The frame width is too small to display the title bar"; + assert peer.getHeight() >= titleBarHeight : "The frame height is too small to display the title bar"; double scale = ((WLGraphicsConfig) peer.getGraphicsConfiguration()).getEffectiveScale(); g2d.setBackground(new Color(0, true)); diff --git a/src/java.desktop/unix/classes/sun/awt/wl/ServerSideFrameDecoration.java b/src/java.desktop/unix/classes/sun/awt/wl/ServerSideFrameDecoration.java index 446561173a49..3e64f09cd243 100644 --- a/src/java.desktop/unix/classes/sun/awt/wl/ServerSideFrameDecoration.java +++ b/src/java.desktop/unix/classes/sun/awt/wl/ServerSideFrameDecoration.java @@ -96,7 +96,7 @@ public class ServerSideFrameDecoration extends FrameDecoration { @Override public void dispose() { // Native resources must have been already disposed when the window was hidden - assert nativeDecorPtr == 0; + assert nativeDecorPtr == 0 : "Native resources must have been already disposed"; } private native long createToplevelDecorationImpl(long nativeFramePtr); diff --git a/src/java.desktop/unix/classes/sun/awt/wl/WLComponentPeer.java b/src/java.desktop/unix/classes/sun/awt/wl/WLComponentPeer.java index ffb73d476a3d..b40eda578f02 100644 --- a/src/java.desktop/unix/classes/sun/awt/wl/WLComponentPeer.java +++ b/src/java.desktop/unix/classes/sun/awt/wl/WLComponentPeer.java @@ -320,7 +320,7 @@ public class WLComponentPeer implements ComponentPeer, WLSurfaceSizeListener { if (what.getMinY() >= where.getMaxY()) { what.y -= what.getMinY() - where.getMaxY(); } - assert what.intersects(where); + assert what.intersects(where) : String.format("Failed to move %s to overlap %s", what, where); } Point nativeLocationForPopup(Window popup, Component popupParent, Window toplevel) { @@ -387,7 +387,7 @@ public class WLComponentPeer implements ComponentPeer, WLSurfaceSizeListener { boolean isUnconstrained = isPopupPositionUnconstrained(); performLocked(() -> { - assert wlSurface == null; + assert wlSurface == null : "Invisible window already has a Wayland surface attached"; wlSurface = new WLMainSurface((WLWindowPeer) this); long wlSurfacePtr = wlSurface.getWlSurfacePtr(); if (isWlPopup) { @@ -477,7 +477,7 @@ public class WLComponentPeer implements ComponentPeer, WLSurfaceSizeListener { @Override public void updateSurfaceSize() { - assert SunToolkit.isAWTLockHeldByCurrentThread(); + assert SunToolkit.isAWTLockHeldByCurrentThread() : "This method must be invoked while holding the AWT lock"; // Note: must be called after a buffer of proper size has been attached to the surface, // but the surface has not yet been committed. Otherwise, the sizes will get out of sync, // which may result in visual artifacts. @@ -910,7 +910,7 @@ public class WLComponentPeer implements ComponentPeer, WLSurfaceSizeListener { // a button press, key press, or touch down event." // So 'serial' must appertain to such an event. - assert serial != 0; + assert serial != 0 : "The serial number of the event requesting the window menu must be non-zero"; int xNative = javaUnitsToSurfaceUnits(x); int yNative = javaUnitsToSurfaceUnits(y); @@ -970,7 +970,7 @@ public class WLComponentPeer implements ComponentPeer, WLSurfaceSizeListener { WLToolkit.targetDisposedPeer(target, this); performLocked(() -> { - assert !isVisible(); + assert !isVisible() : "Disposed window must have been already hidden"; nativeDisposeFrame(nativePtr); nativePtr = 0; @@ -1373,7 +1373,8 @@ public class WLComponentPeer implements ComponentPeer, WLSurfaceSizeListener { } if (verticalMWERoundRotations != 0 || verticalMWEPreciseRotations != 0) { - assert(verticalMWEScrollAmount > 0); + assert verticalMWEScrollAmount > 0 + : String.format("Vertical scrolling event has negative scroll amount: %d", verticalMWEScrollAmount); final MouseEvent mouseEvent = new MouseWheelEvent(getTarget(), MouseEvent.MOUSE_WHEEL, @@ -1392,7 +1393,8 @@ public class WLComponentPeer implements ComponentPeer, WLSurfaceSizeListener { } if (horizontalMWERoundRotations != 0 || horizontalMWEPreciseRotations != 0) { - assert(horizontalMWEScrollAmount > 0); + assert horizontalMWEScrollAmount > 0 + : String.format("Horizontal scrolling event has negative scroll amount: %d", horizontalMWEScrollAmount);; final MouseEvent mouseEvent = new MouseWheelEvent(getTarget(), MouseEvent.MOUSE_WHEEL, @@ -1603,7 +1605,7 @@ public class WLComponentPeer implements ComponentPeer, WLSurfaceSizeListener { // "This request must be used in response to some sort of user action like a button press, // key press, or touch down event. The passed serial is used to determine the type // of interactive move (touch, pointer, etc)." - assert serial != 0; + assert serial != 0 : "The serial number of the event requesting the drag must be non-zero"; performLocked(() -> nativeStartDrag(serial, nativePtr)); } @@ -1612,7 +1614,7 @@ public class WLComponentPeer implements ComponentPeer, WLSurfaceSizeListener { // "This request must be used in response to some sort of user action like a button press, // key press, or touch down event. The passed serial is used to determine the type // of interactive resize (touch, pointer, etc)." - assert serial != 0; + assert serial != 0 : "The serial number of the event requesting the resize must be non-zero"; performLocked(() -> nativeStartResize(serial, nativePtr, edges)); } @@ -1692,7 +1694,7 @@ public class WLComponentPeer implements ComponentPeer, WLSurfaceSizeListener { void notifyConfigured(int newSurfaceX, int newSurfaceY, int newSurfaceWidth, int newSurfaceHeight, boolean active, boolean maximized, boolean fullscreen) { - assert SunToolkit.isAWTLockHeldByCurrentThread(); + assert SunToolkit.isAWTLockHeldByCurrentThread() : "This method must be invoked while holding the AWT lock"; // NB: The width and height, as well as X and Y arguments, specify the size and the location // of the window in surface-local coordinates. @@ -1773,12 +1775,12 @@ public class WLComponentPeer implements ComponentPeer, WLSurfaceSizeListener { } void notifyPopupDone() { - assert(targetIsWlPopup()); + assert targetIsWlPopup() : "This method must be invoked only for popups"; target.setVisible(false); } void checkIfOnNewScreen() { - assert SunToolkit.isAWTLockHeldByCurrentThread(); + assert SunToolkit.isAWTLockHeldByCurrentThread() : "This method must be invoked while holding the AWT lock"; if (wlSurface == null) return; final WLGraphicsDevice newDevice = wlSurface.getGraphicsDevice(); @@ -2023,7 +2025,7 @@ public class WLComponentPeer implements ComponentPeer, WLSurfaceSizeListener { @Override public void updateSurfaceSize() { - assert SunToolkit.isAWTLockHeldByCurrentThread(); + assert SunToolkit.isAWTLockHeldByCurrentThread() : "This method must be invoked while holding the AWT lock"; shadowSurface.updateSurfaceSize(shadowWlSize.getSurfaceWidth(), shadowWlSize.getSurfaceHeight()); } @@ -2035,8 +2037,8 @@ public class WLComponentPeer implements ComponentPeer, WLSurfaceSizeListener { } public void createSurface() { - assert shadowSurface == null; - assert SunToolkit.isAWTLockHeldByCurrentThread(); + assert shadowSurface == null : "The shadow surface must not be created twice"; + assert SunToolkit.isAWTLockHeldByCurrentThread() : "This method must be invoked while holding the AWT lock"; int shadowOffset = -javaUnitsToSurfaceUnits(shadowSize); shadowSurface = new WLSubSurface(wlSurface, shadowOffset, shadowOffset); @@ -2044,13 +2046,13 @@ public class WLComponentPeer implements ComponentPeer, WLSurfaceSizeListener { public void commitSurface() { assert shadowSurface != null; - assert SunToolkit.isAWTLockHeldByCurrentThread(); + assert SunToolkit.isAWTLockHeldByCurrentThread() : "This method must be invoked while holding the AWT lock"; shadowSurface.commit(); } public void dispose() { - assert SunToolkit.isAWTLockHeldByCurrentThread(); + assert SunToolkit.isAWTLockHeldByCurrentThread() : "This method must be invoked while holding the AWT lock"; if (shadowSurface != null) { shadowSurface.dispose(); @@ -2065,7 +2067,7 @@ public class WLComponentPeer implements ComponentPeer, WLSurfaceSizeListener { } public void hide() { - assert SunToolkit.isAWTLockHeldByCurrentThread(); + assert SunToolkit.isAWTLockHeldByCurrentThread() : "This method must be invoked while holding the AWT lock"; if (shadowSurface != null) { shadowSurface.dispose(); @@ -2074,7 +2076,7 @@ public class WLComponentPeer implements ComponentPeer, WLSurfaceSizeListener { } public void updateSurfaceData() { - assert SunToolkit.isAWTLockHeldByCurrentThread(); + assert SunToolkit.isAWTLockHeldByCurrentThread() : "This method must be invoked while holding the AWT lock"; needsRepaint = true; SurfaceData.convertTo(WLSurfaceDataExt.class, shadowSurfaceData).revalidate( @@ -2082,7 +2084,7 @@ public class WLComponentPeer implements ComponentPeer, WLSurfaceSizeListener { } public void paint() { - assert SunToolkit.isAWTLockHeldByCurrentThread(); + assert SunToolkit.isAWTLockHeldByCurrentThread() : "This method must be invoked while holding the AWT lock"; if (!needsRepaint) { return; @@ -2108,7 +2110,7 @@ public class WLComponentPeer implements ComponentPeer, WLSurfaceSizeListener { public void notifyConfigured(boolean active, boolean maximized, boolean fullscreen) { assert shadowSurface != null; - assert SunToolkit.isAWTLockHeldByCurrentThread(); + assert SunToolkit.isAWTLockHeldByCurrentThread() : "This method must be invoked while holding the AWT lock"; needsRepaint |= active ^ isActive; diff --git a/src/java.desktop/unix/classes/sun/awt/wl/WLDataOffer.java b/src/java.desktop/unix/classes/sun/awt/wl/WLDataOffer.java index 2ccc37d0efb6..2cbc8fbdb438 100644 --- a/src/java.desktop/unix/classes/sun/awt/wl/WLDataOffer.java +++ b/src/java.desktop/unix/classes/sun/awt/wl/WLDataOffer.java @@ -77,7 +77,8 @@ public class WLDataOffer { fd = openReceivePipe(nativePtr, mime); - assert(fd != -1); // Otherwise an exception should be thrown from native code + // Otherwise an exception should be thrown from native code + assert fd != -1 : "An invalid file descriptor received from the native code"; FileDescriptor javaFD = new FileDescriptor(); jdk.internal.access.SharedSecrets.getJavaIOFileDescriptorAccess().set(javaFD, fd); diff --git a/src/java.desktop/unix/classes/sun/awt/wl/WLDataSource.java b/src/java.desktop/unix/classes/sun/awt/wl/WLDataSource.java index 46881f39c0e0..32da39dd1cc0 100644 --- a/src/java.desktop/unix/classes/sun/awt/wl/WLDataSource.java +++ b/src/java.desktop/unix/classes/sun/awt/wl/WLDataSource.java @@ -53,7 +53,7 @@ public class WLDataSource { var wlDataTransferer = (WLDataTransferer) WLDataTransferer.getInstance(); nativePtr = initNative(dataDevice.getNativePtr(), protocol); - assert nativePtr != 0; // should've already thrown in native + assert nativePtr != 0 : "Failed to initialize the native part of the source"; // should've already thrown in native this.data = data; try { diff --git a/src/java.desktop/unix/classes/sun/awt/wl/WLGraphicsDevice.java b/src/java.desktop/unix/classes/sun/awt/wl/WLGraphicsDevice.java index e50ad84d9763..0045a6e4c0bd 100644 --- a/src/java.desktop/unix/classes/sun/awt/wl/WLGraphicsDevice.java +++ b/src/java.desktop/unix/classes/sun/awt/wl/WLGraphicsDevice.java @@ -128,10 +128,10 @@ public class WLGraphicsDevice extends GraphicsDevice { int widthLogical, int heightLogical, int widthMm, int heightMm, int displayScale) { - assert width > 0 && height > 0; - assert widthLogical > 0 && heightLogical > 0; - assert widthMm > 0 && heightMm > 0; - assert displayScale > 0; + assert width > 0 && height > 0 : String.format("Invalid device size: %dx%d", width, height); + assert widthLogical > 0 && heightLogical > 0 : String.format("Invalid logical device size: %dx%d", widthLogical, heightLogical); + assert widthMm > 0 && heightMm > 0 : String.format("Invalid physical device size: %dx%d", widthMm, heightMm); + assert displayScale > 0 : String.format("Invalid display scale: %d", displayScale); this.wlID = id; this.name = name; @@ -176,10 +176,10 @@ public class WLGraphicsDevice extends GraphicsDevice { int widthLogical, int heightLogical, int widthMm, int heightMm, int scale) { - assert width > 0 && height > 0; - assert widthLogical > 0 && heightLogical > 0; - assert widthMm > 0 && heightMm > 0; - assert scale > 0; + assert width > 0 && height > 0 : String.format("Invalid device size: %dx%d", width, height); + assert widthLogical > 0 && heightLogical > 0 : String.format("Invalid logical device size: %dx%d", widthLogical, heightLogical); + assert widthMm > 0 && heightMm > 0 : String.format("Invalid physical device size: %dx%d", widthMm, heightMm); + assert scale > 0 : String.format("Invalid display scale: %d", scale); this.name = name; this.x = x; diff --git a/src/java.desktop/unix/classes/sun/awt/wl/WLInputState.java b/src/java.desktop/unix/classes/sun/awt/wl/WLInputState.java index 73d08d9cd371..6d3ac5dd2def 100644 --- a/src/java.desktop/unix/classes/sun/awt/wl/WLInputState.java +++ b/src/java.desktop/unix/classes/sun/awt/wl/WLInputState.java @@ -242,7 +242,9 @@ record WLInputState(WLPointerEvent eventWithSurface, WLPointerEvent newEventWithTimestamp, WLPointerEvent newEventWithPosition) { if (pointerEvent.hasButtonEvent() && pointerEvent.getIsButtonPressed() && newEventWithSurface != null) { - assert newEventWithTimestamp != null && newEventWithPosition != null; + assert newEventWithTimestamp != null && newEventWithPosition != null + : "Events with timestamp and position are both required to be present"; + int clickCount = 1; final boolean pressedSameButton = pointerButtonPressedEvent != null && pointerEvent.getButtonCode() == pointerButtonPressedEvent.linuxCode; diff --git a/src/java.desktop/unix/classes/sun/awt/wl/WLKeyboard.java b/src/java.desktop/unix/classes/sun/awt/wl/WLKeyboard.java index 3d61a62ad504..04302a2ab803 100644 --- a/src/java.desktop/unix/classes/sun/awt/wl/WLKeyboard.java +++ b/src/java.desktop/unix/classes/sun/awt/wl/WLKeyboard.java @@ -48,7 +48,7 @@ class WLKeyboard { // called from native code void setRepeatInfo(int charsPerSecond, int delayMillis) { // this function receives (0, 0) when key repeat is disabled - assert EventQueue.isDispatchThread(); + assert EventQueue.isDispatchThread() : "Method must only be invoked on EDT"; this.delayBeforeRepeatMillis = delayMillis; if (charsPerSecond > 0) { this.delayBetweenRepeatMillis = (int) (1000.0 / charsPerSecond); @@ -64,7 +64,7 @@ class WLKeyboard { } void cancelRepeat() { - assert EventQueue.isDispatchThread(); + assert EventQueue.isDispatchThread() : "Method must only be invoked on EDT"; if (currentRepeatTask != null) { currentRepeatTask.cancel(); currentRepeatTask = null; @@ -74,7 +74,7 @@ class WLKeyboard { // called from native code void stopRepeat(int keycode) { - assert EventQueue.isDispatchThread(); + assert EventQueue.isDispatchThread() : "Method must only be invoked on EDT"; if (currentRepeatKeycode == keycode) { cancelRepeat(); } @@ -82,7 +82,7 @@ class WLKeyboard { // called from native code void startRepeat(long serial, long timestamp, int keycode) { - assert EventQueue.isDispatchThread(); + assert EventQueue.isDispatchThread() : "Method must only be invoked on EDT"; cancelRepeat(); if (keycode == 0 || !isRepeatEnabled()) { return; @@ -123,7 +123,7 @@ class WLKeyboard { public native boolean isNumLockPressed(); public void onLostFocus() { - assert EventQueue.isDispatchThread(); + assert EventQueue.isDispatchThread() : "Method must only be invoked on EDT"; keyRepeatManager.cancelRepeat(); cancelCompose(); } diff --git a/src/java.desktop/unix/classes/sun/awt/wl/WLMainSurface.java b/src/java.desktop/unix/classes/sun/awt/wl/WLMainSurface.java index 3060ac7f3532..0a9abec225a2 100644 --- a/src/java.desktop/unix/classes/sun/awt/wl/WLMainSurface.java +++ b/src/java.desktop/unix/classes/sun/awt/wl/WLMainSurface.java @@ -91,7 +91,7 @@ public class WLMainSurface extends WLSurface { } public void activateByAnotherSurface(long serial, long activatingSurfacePtr) { - assert SunToolkit.isAWTLockHeldByCurrentThread(); + assert SunToolkit.isAWTLockHeldByCurrentThread() : "This method must be invoked while holding the AWT lock"; assertIsValid(); nativeActivate(getNativePtr(), serial, activatingSurfacePtr); diff --git a/src/java.desktop/unix/classes/sun/awt/wl/WLPointerEvent.java b/src/java.desktop/unix/classes/sun/awt/wl/WLPointerEvent.java index d3e9889b5958..d995fddafc4f 100644 --- a/src/java.desktop/unix/classes/sun/awt/wl/WLPointerEvent.java +++ b/src/java.desktop/unix/classes/sun/awt/wl/WLPointerEvent.java @@ -217,37 +217,37 @@ class WLPointerEvent { } public long getSurface() { - assert hasSurface(); + assert hasSurface() : "The event must have a valid surface"; return surface; } public long getSerial() { - assert hasSerial(); + assert hasSerial() : "The event must have a valid serial"; return serial; } public long getTimestamp() { - assert hasTimestamp(); + assert hasTimestamp() : "The event must have a valid timestamp"; return timestamp; } public int getSurfaceX() { - assert hasCoordinates(); + assert hasCoordinates() : "The event must have valid coordinates"; return surface_x; } public int getSurfaceY() { - assert hasCoordinates(); + assert hasCoordinates() : "The event must have valid coordinates"; return surface_y; } public int getButtonCode() { - assert hasButtonEvent(); + assert hasButtonEvent() : "Must have a button event to get the button code"; return buttonCode; } public boolean getIsButtonPressed() { - assert hasButtonEvent(); + assert hasButtonEvent() : "Must have a button event to get the button state"; return isButtonPressed; } @@ -270,12 +270,12 @@ class WLPointerEvent { } public double getXAxisVectorValue() { - assert xAxisHasVectorValue(); + assert xAxisHasVectorValue() : "Must have an X axis vector value"; return xAxis_vectorValue; } public int getXAxisSteps120Value() { - assert xAxisHasSteps120Value(); + assert xAxisHasSteps120Value() : "Must have an X axis steps120 value"; return xAxis_steps120Value; } @@ -298,12 +298,12 @@ class WLPointerEvent { } public double getYAxisVectorValue() { - assert yAxisHasVectorValue(); + assert yAxisHasVectorValue() : "Must have an Y axis vector value"; return yAxis_vectorValue; } public int getYAxisSteps120Value() { - assert yAxisHasSteps120Value(); + assert yAxisHasSteps120Value(): "Must have an Y axis steps120 value"; return yAxis_steps120Value; } diff --git a/src/java.desktop/unix/classes/sun/awt/wl/WLRobotPeer.java b/src/java.desktop/unix/classes/sun/awt/wl/WLRobotPeer.java index d3edc8890c8c..41dd7d0ebcf1 100644 --- a/src/java.desktop/unix/classes/sun/awt/wl/WLRobotPeer.java +++ b/src/java.desktop/unix/classes/sun/awt/wl/WLRobotPeer.java @@ -171,7 +171,7 @@ public class WLRobotPeer implements RobotPeer { static Point getLocationOfWLSurface(WLSurface wlSurface) { checkExtensionPresent(); - assert SunToolkit.isAWTLockHeldByCurrentThread(); + assert SunToolkit.isAWTLockHeldByCurrentThread() : "This method must be invoked while holding the AWT lock"; final long wlSurfacePtr = wlSurface.getWlSurfacePtr(); // The native implementation allows for just one such request at a time diff --git a/src/java.desktop/unix/classes/sun/awt/wl/WLSurface.java b/src/java.desktop/unix/classes/sun/awt/wl/WLSurface.java index 5a8cd6a7a38b..5accbc64cdc2 100644 --- a/src/java.desktop/unix/classes/sun/awt/wl/WLSurface.java +++ b/src/java.desktop/unix/classes/sun/awt/wl/WLSurface.java @@ -57,7 +57,7 @@ public class WLSurface { } public void dispose() { - assert SunToolkit.isAWTLockHeldByCurrentThread(); + assert SunToolkit.isAWTLockHeldByCurrentThread() : "This method must be invoked while holding the AWT lock"; if (isValid) { hide(); @@ -67,7 +67,7 @@ public class WLSurface { } public void hide() { - assert SunToolkit.isAWTLockHeldByCurrentThread(); + assert SunToolkit.isAWTLockHeldByCurrentThread() : "This method must be invoked while holding the AWT lock"; assertIsValid(); if (surfaceData == null) return; @@ -85,14 +85,14 @@ public class WLSurface { } public boolean hasSurfaceData() { - assert SunToolkit.isAWTLockHeldByCurrentThread(); + assert SunToolkit.isAWTLockHeldByCurrentThread() : "This method must be invoked while holding the AWT lock"; assertIsValid(); return surfaceData != null; } public void associateWithSurfaceData(SurfaceData data) { - assert SunToolkit.isAWTLockHeldByCurrentThread(); + assert SunToolkit.isAWTLockHeldByCurrentThread() : "This method must be invoked while holding the AWT lock"; Objects.requireNonNull(data); assertIsValid(); @@ -103,7 +103,7 @@ public class WLSurface { } public void commit() { - assert SunToolkit.isAWTLockHeldByCurrentThread(); + assert SunToolkit.isAWTLockHeldByCurrentThread() : "This method must be invoked while holding the AWT lock"; assertIsValid(); nativeCommitWlSurface(nativePtr); @@ -115,28 +115,28 @@ public class WLSurface { * @return a pointer to wl_surface native object */ public long getWlSurfacePtr() { - assert SunToolkit.isAWTLockHeldByCurrentThread(); + assert SunToolkit.isAWTLockHeldByCurrentThread() : "This method must be invoked while holding the AWT lock"; assertIsValid(); return wlSurfacePtr; } protected long getNativePtr() { - assert SunToolkit.isAWTLockHeldByCurrentThread(); + assert SunToolkit.isAWTLockHeldByCurrentThread() : "This method must be invoked while holding the AWT lock"; assertIsValid(); return nativePtr; } public void setSize(int width, int height) { - assert SunToolkit.isAWTLockHeldByCurrentThread(); + assert SunToolkit.isAWTLockHeldByCurrentThread() : "This method must be invoked while holding the AWT lock"; assertIsValid(); nativeSetSize(nativePtr, width, height); } public void setOpaqueRegion(int x, int y, int width, int height) { - assert SunToolkit.isAWTLockHeldByCurrentThread(); + assert SunToolkit.isAWTLockHeldByCurrentThread() : "This method must be invoked while holding the AWT lock"; assertIsValid(); nativeSetOpaqueRegion(nativePtr, x, y, width, height); @@ -151,7 +151,7 @@ public class WLSurface { } public void updateSurfaceSize(int surfaceWidth, int surfaceHeight) { - assert SunToolkit.isAWTLockHeldByCurrentThread(); + assert SunToolkit.isAWTLockHeldByCurrentThread() : "This method must be invoked while holding the AWT lock"; assertIsValid(); setSize(surfaceWidth, surfaceHeight); diff --git a/src/java.desktop/unix/classes/sun/awt/wl/WLToolkit.java b/src/java.desktop/unix/classes/sun/awt/wl/WLToolkit.java index cbab8a45e392..efe4f46ba14a 100644 --- a/src/java.desktop/unix/classes/sun/awt/wl/WLToolkit.java +++ b/src/java.desktop/unix/classes/sun/awt/wl/WLToolkit.java @@ -311,7 +311,7 @@ public class WLToolkit extends UNIXToolkit implements Runnable { private static void dispatchPointerEvent(WLPointerEvent e) { // Invoked from the native code - assert EventQueue.isDispatchThread(); + assert EventQueue.isDispatchThread() : "Method must only be invoked on EDT"; if (log.isLoggable(PlatformLogger.Level.FINE)) log.fine("dispatchPointerEvent: " + e); @@ -342,7 +342,7 @@ public class WLToolkit extends UNIXToolkit implements Runnable { char keyChar, int modifiers) { // Invoked from the native code - assert EventQueue.isDispatchThread(); + assert EventQueue.isDispatchThread() : "Method must only be invoked on EDT"; inputState = inputState.updatedFromKeyEvent(serial); @@ -405,14 +405,14 @@ public class WLToolkit extends UNIXToolkit implements Runnable { } private static void dispatchKeyboardModifiersEvent(long serial) { - assert EventQueue.isDispatchThread(); + assert EventQueue.isDispatchThread() : "Method must only be invoked on EDT"; inputState = inputState.updatedFromKeyboardModifiersEvent(serial, keyboard.getModifiers()); WLDropTargetContextPeer.getInstance().handleModifiersUpdate(); } private static void dispatchKeyboardEnterEvent(long serial, long surfacePtr) { // Invoked from the native code - assert EventQueue.isDispatchThread(); + assert EventQueue.isDispatchThread() : "Method must only be invoked on EDT"; if (logKeys.isLoggable(PlatformLogger.Level.FINE)) { logKeys.fine("dispatchKeyboardEnterEvent: " + serial + ", surface 0x" @@ -441,7 +441,7 @@ public class WLToolkit extends UNIXToolkit implements Runnable { private static void dispatchKeyboardLeaveEvent(long serial, long surfacePtr) { // Invoked from the native code - assert EventQueue.isDispatchThread(); + assert EventQueue.isDispatchThread() : "Method must only be invoked on EDT"; if (logKeys.isLoggable(PlatformLogger.Level.FINE)) { logKeys.fine("dispatchKeyboardLeaveEvent: " + serial + ", surface 0x" diff --git a/src/java.desktop/unix/classes/sun/awt/wl/im/text_input_unstable_v3/ClientComponentCaretPositionTracker.java b/src/java.desktop/unix/classes/sun/awt/wl/im/text_input_unstable_v3/ClientComponentCaretPositionTracker.java index 2486b0ed4e59..1b09721529c4 100644 --- a/src/java.desktop/unix/classes/sun/awt/wl/im/text_input_unstable_v3/ClientComponentCaretPositionTracker.java +++ b/src/java.desktop/unix/classes/sun/awt/wl/im/text_input_unstable_v3/ClientComponentCaretPositionTracker.java @@ -67,7 +67,7 @@ class ClientComponentCaretPositionTracker implements ComponentListener, CaretLis public void startTracking(final Component component) { - assert(EventQueue.isDispatchThread()); + assert EventQueue.isDispatchThread() : "Method must only be invoked on EDT"; if (log.isLoggable(PlatformLogger.Level.FINER)) { log.finer( @@ -108,7 +108,7 @@ class ClientComponentCaretPositionTracker implements ComponentListener, CaretLis } public void stopTrackingCurrentComponent() { - assert(EventQueue.isDispatchThread()); + assert EventQueue.isDispatchThread() : "Method must only be invoked on EDT"; if (log.isLoggable(PlatformLogger.Level.FINER)) { log.finer(String.format("stopTrackingCurrentComponent(): this=%s.", this), new Throwable("Stacktrace")); @@ -160,7 +160,7 @@ class ClientComponentCaretPositionTracker implements ComponentListener, CaretLis } public Component getTrackedComponentIfTracking() { - assert(EventQueue.isDispatchThread()); + assert EventQueue.isDispatchThread() : "Method must only be invoked on EDT"; final Component trackedComponentStrong; if (trackedComponent == null) { @@ -188,7 +188,7 @@ class ClientComponentCaretPositionTracker implements ComponentListener, CaretLis public void deferUpdates() { - assert(EventQueue.isDispatchThread()); + assert EventQueue.isDispatchThread() : "Method must only be invoked on EDT"; if (log.isLoggable(PlatformLogger.Level.FINER)) { log.finer(String.format("deferUpdates(): this=%s.", this), new Throwable("Stacktrace")); @@ -198,7 +198,7 @@ class ClientComponentCaretPositionTracker implements ComponentListener, CaretLis } public void resumeUpdates(final boolean discardDeferredUpdates) { - assert(EventQueue.isDispatchThread()); + assert EventQueue.isDispatchThread() : "Method must only be invoked on EDT"; if (log.isLoggable(PlatformLogger.Level.FINER)) { log.finer(String.format("resumeUpdates(%b): this=%s.", discardDeferredUpdates, this), new Throwable("Stacktrace")); @@ -215,7 +215,7 @@ class ClientComponentCaretPositionTracker implements ComponentListener, CaretLis } public boolean areUpdatesDeferred() { - assert(EventQueue.isDispatchThread()); + assert EventQueue.isDispatchThread() : "Method must only be invoked on EDT"; return updatesAreDeferred; } @@ -225,7 +225,7 @@ class ClientComponentCaretPositionTracker implements ComponentListener, CaretLis /** This method is intended to be called from the owning IM's {@link java.awt.im.spi.InputMethod#dispatchEvent(AWTEvent)}. */ public void onIMDispatchEvent(AWTEvent event) { - assert(EventQueue.isDispatchThread()); + assert EventQueue.isDispatchThread() : "Method must only be invoked on EDT"; if (log.isLoggable(PlatformLogger.Level.FINER)) { log.finer("onIMDispatchEvent(event={0}): this={1}.", event, this); @@ -254,7 +254,7 @@ class ClientComponentCaretPositionTracker implements ComponentListener, CaretLis /** This method is intended to be called from the owning IM's {@link java.awt.im.spi.InputMethod#notifyClientWindowChange(Rectangle)}. */ public void onIMNotifyClientWindowChange(Rectangle location) { - assert(EventQueue.isDispatchThread()); + assert EventQueue.isDispatchThread() : "Method must only be invoked on EDT"; if (log.isLoggable(PlatformLogger.Level.FINER)) { log.finer("onIMNotifyClientWindowChange(location={0}): this={1}.", location, this); @@ -333,7 +333,7 @@ class ClientComponentCaretPositionTracker implements ComponentListener, CaretLis private WLInputMethodZwpTextInputV3 getOwnerIm() { - assert(EventQueue.isDispatchThread()); + assert EventQueue.isDispatchThread() : "Method must only be invoked on EDT"; final WLInputMethodZwpTextInputV3 thisImStrong; if (this.im == null) { diff --git a/src/java.desktop/unix/classes/sun/awt/wl/im/text_input_unstable_v3/InputContextState.java b/src/java.desktop/unix/classes/sun/awt/wl/im/text_input_unstable_v3/InputContextState.java index 676e02971e7e..f043d4a6530b 100644 --- a/src/java.desktop/unix/classes/sun/awt/wl/im/text_input_unstable_v3/InputContextState.java +++ b/src/java.desktop/unix/classes/sun/awt/wl/im/text_input_unstable_v3/InputContextState.java @@ -40,7 +40,7 @@ final class InputContextState { public InputContextState(long nativeContextPtr) { - assert(nativeContextPtr != 0); + assert nativeContextPtr != 0 : "Cannot create an input context from a NULL pointer"; this.nativeContextPtr = nativeContextPtr; } diff --git a/src/java.desktop/unix/classes/sun/awt/wl/im/text_input_unstable_v3/JavaPreeditString.java b/src/java.desktop/unix/classes/sun/awt/wl/im/text_input_unstable_v3/JavaPreeditString.java index ca65bfc83881..ee4ecdf42921 100644 --- a/src/java.desktop/unix/classes/sun/awt/wl/im/text_input_unstable_v3/JavaPreeditString.java +++ b/src/java.desktop/unix/classes/sun/awt/wl/im/text_input_unstable_v3/JavaPreeditString.java @@ -82,8 +82,8 @@ record JavaPreeditString(String text, int cursorBeginCodeUnit, int cursorEndCode } if (resultText == null) { - assert(fixedCursorBeginUtf8Byte == 0); - assert(fixedCursorEndUtf8Byte == 0); + assert fixedCursorBeginUtf8Byte == 0 : "Cursor begin byte must be zero for an empty string"; + assert fixedCursorEndUtf8Byte == 0 : "Cursor end byte must be zero for an empty string"; return JavaPreeditString.EMPTY; } diff --git a/src/java.desktop/unix/classes/sun/awt/wl/im/text_input_unstable_v3/WLInputMethodDescriptorZwpTextInputV3.java b/src/java.desktop/unix/classes/sun/awt/wl/im/text_input_unstable_v3/WLInputMethodDescriptorZwpTextInputV3.java index 75d61c5b5571..73f74decb8d6 100644 --- a/src/java.desktop/unix/classes/sun/awt/wl/im/text_input_unstable_v3/WLInputMethodDescriptorZwpTextInputV3.java +++ b/src/java.desktop/unix/classes/sun/awt/wl/im/text_input_unstable_v3/WLInputMethodDescriptorZwpTextInputV3.java @@ -71,7 +71,7 @@ public final class WLInputMethodDescriptorZwpTextInputV3 implements InputMethodD @Override public String getInputMethodDisplayName(Locale inputLocale, Locale displayLanguage) { - assert isAvailableOnPlatform(); + assert isAvailableOnPlatform() : "IM must be available on the platform"; // This is how it's implemented in all other Toolkits. // @@ -183,7 +183,7 @@ public final class WLInputMethodDescriptorZwpTextInputV3 implements InputMethodD private WLInputMethodDescriptorZwpTextInputV3() { - assert isAvailableOnPlatform(); + assert isAvailableOnPlatform() : "IM must be available on the platform"; initAndGetToolkitStartupLocale(); } diff --git a/src/java.desktop/unix/classes/sun/awt/wl/im/text_input_unstable_v3/WLInputMethodZwpTextInputV3.java b/src/java.desktop/unix/classes/sun/awt/wl/im/text_input_unstable_v3/WLInputMethodZwpTextInputV3.java index d57dced8ca9c..12e0f9d70449 100644 --- a/src/java.desktop/unix/classes/sun/awt/wl/im/text_input_unstable_v3/WLInputMethodZwpTextInputV3.java +++ b/src/java.desktop/unix/classes/sun/awt/wl/im/text_input_unstable_v3/WLInputMethodZwpTextInputV3.java @@ -243,7 +243,7 @@ final class WLInputMethodZwpTextInputV3 extends InputMethodAdapter { } // "The method is only called when the input method is inactive." - assert(this.awtActivationStatus != AWTActivationStatus.ACTIVATED); + assert this.awtActivationStatus != AWTActivationStatus.ACTIVATED : "The method is called when the IM is active"; // The protocol doesn't provide a separate method for hiding the IM window(s), // but this effect can be achieved by disabling the native context. @@ -259,7 +259,7 @@ final class WLInputMethodZwpTextInputV3 extends InputMethodAdapter { } // "The method is only called when the input method is inactive." - assert(this.awtActivationStatus != AWTActivationStatus.ACTIVATED); + assert this.awtActivationStatus != AWTActivationStatus.ACTIVATED : "The method is called when the IM is active"; wlDisableContextNow(); } @@ -374,10 +374,10 @@ final class WLInputMethodZwpTextInputV3 extends InputMethodAdapter { /* AWT-side methods section */ private static void awtFillWlContentTypeOf(Component component, OutgoingChanges out) { - assert(component != null); - assert(out != null); + assert component != null : "Component must not be null"; + assert out != null : "OutgoingChanges must not be null"; - assert(EventQueue.isDispatchThread()); + assert EventQueue.isDispatchThread() : "Method must only be invoked on EDT"; // TODO: there's no dedicated AWT/Swing API for that, but we can make a few guesses, e.g. // (component instanceof JPasswordField) ? ContentPurpose.PASSWORD @@ -389,7 +389,7 @@ final class WLInputMethodZwpTextInputV3 extends InputMethodAdapter { * compatible with {@code zwp_text_input_v3::set_cursor_rectangle} API; */ private static Rectangle awtGetWlCursorRectangleOf(Component component) { - assert EventQueue.isDispatchThread(); + assert EventQueue.isDispatchThread() : "Method must only be invoked on EDT"; Rectangle result = null; @@ -434,7 +434,7 @@ final class WLInputMethodZwpTextInputV3 extends InputMethodAdapter { * @throws IllegalArgumentException if {@code visibleComponent} is {@code null} or isn't showing on the screen. */ private static Rectangle awtGetCaretOf(Component visibleComponent) { - assert(EventQueue.isDispatchThread()); + assert EventQueue.isDispatchThread() : "Method must only be invoked on EDT"; if (!Objects.requireNonNull(visibleComponent, "visibleComponent").isShowing()) { throw new IllegalArgumentException("visibleComponent must be showing"); @@ -474,7 +474,7 @@ final class WLInputMethodZwpTextInputV3 extends InputMethodAdapter { } private static Rectangle awtGetVisibleRectOf(final Component component) { - assert(EventQueue.isDispatchThread()); + assert EventQueue.isDispatchThread() : "Method must only be invoked on EDT"; if (component instanceof javax.swing.JComponent jComponent) { return jComponent.getVisibleRect(); @@ -488,7 +488,7 @@ final class WLInputMethodZwpTextInputV3 extends InputMethodAdapter { * or {@code null} if the rectangle couldn't be determined. */ private static Rectangle awtConvertRectOnComponentToRectOnWlSurface(Component component, Rectangle rectOnComponent) { - assert(EventQueue.isDispatchThread()); + assert EventQueue.isDispatchThread() : "Method must only be invoked on EDT"; Objects.requireNonNull(component, "component"); @@ -536,7 +536,7 @@ final class WLInputMethodZwpTextInputV3 extends InputMethodAdapter { * or its closest ancestor meeting these requirements. */ private static Window awtGetWlSurfaceComponentOf(Component component) { - assert EventQueue.isDispatchThread(); + assert EventQueue.isDispatchThread() : "Method must only be invoked on EDT"; return WLComponentPeer.getToplevelFor(component); } @@ -557,8 +557,8 @@ final class WLInputMethodZwpTextInputV3 extends InputMethodAdapter { log.finer("awtPostIMESafely(preeditString={0}, commitString={1}): this={2}.", preeditString, commitString, this); } - assert(preeditString != null); - assert(commitString != null); + assert preeditString != null : "Pre-edit string must be present"; + assert commitString != null : "Commit string must be present"; try { if (awtActivationStatus != AWTActivationStatus.ACTIVATED) { @@ -769,8 +769,8 @@ final class WLInputMethodZwpTextInputV3 extends InputMethodAdapter { specialPreeditHighlightingBegin = swapTemp; } - assert(specialPreeditHighlightingBegin >= 0); - assert(specialPreeditHighlightingEnd <= preeditTextLength); + assert specialPreeditHighlightingBegin >= 0 : "specialPreeditHighlightingBegin is invalid"; + assert specialPreeditHighlightingEnd <= preeditTextLength : "specialPreeditHighlightingEnd is out of range"; // v // |BASIC+SPECIAL...| @@ -827,10 +827,10 @@ final class WLInputMethodZwpTextInputV3 extends InputMethodAdapter { // The methods in this section implement the core logic of working with the "text-input-unstable-v3" protocol. private void wlInitializeContext() throws AWTException { - assert(wlInputContextState == null); - assert(wlPendingChanges == null); - assert(wlBeingCommittedChanges == null); - assert(wlIncomingChanges == null); + assert wlInputContextState == null : "Must not initialize input context twice"; + assert wlPendingChanges == null : "Must not initialize pending changes twice"; + assert wlBeingCommittedChanges == null : "Must not initialize being-committed changes twice"; + assert wlIncomingChanges == null : "Must not initialize incoming changes twice"; long nativeCtxPtr = 0; @@ -878,7 +878,7 @@ final class WLInputMethodZwpTextInputV3 extends InputMethodAdapter { * followed by a {@code zwp_text_input_v3::commit} request. */ private void wlSendPendingChangesNow() { - assert(wlCanSendChangesNow()); + assert wlCanSendChangesNow() : "Must be able to send pending changes now"; final OutgoingChanges changesToSend = wlPendingChanges; wlPendingChanges = null; @@ -997,7 +997,7 @@ final class WLInputMethodZwpTextInputV3 extends InputMethodAdapter { throw new IllegalStateException("Attempt to enable an input context which hasn't entered any surface"); } - assert(wlContextCanBeEnabledNow()); + assert wlContextCanBeEnabledNow() : "Can't enable InputContext"; // This way we guarantee the context won't accidentally get disabled because such a change has been scheduled earlier. // Anyway we consider any previously scheduled changes outdated because an 'enable' request is supposed to @@ -1029,7 +1029,7 @@ final class WLInputMethodZwpTextInputV3 extends InputMethodAdapter { awtFillWlContentTypeOf(getClientComponent(), changeSet); wlScheduleContextNewChanges(changeSet); - assert(wlPendingChanges != null); + assert wlPendingChanges != null : "Must have non-empty pending changes"; // Pretending there are no committed, but not applied yet changes, so that wlCanSendChangesNow() is true. // We can do that because the assumption #1 and because any previously committed changes get lost when a @@ -1038,7 +1038,7 @@ final class WLInputMethodZwpTextInputV3 extends InputMethodAdapter { // set_surrounding_text, set_text_change_cause, set_content_type, and set_cursor_rectangle requests [...]" wlBeingCommittedChanges = null; - assert(wlCanSendChangesNow()); + assert wlCanSendChangesNow() : "Must be able to send pending changes now"; wlSendPendingChangesNow(); // See the assumption #2 above. @@ -1103,10 +1103,10 @@ final class WLInputMethodZwpTextInputV3 extends InputMethodAdapter { } } - assert(wlInputContextState.getCurrentWlSurfacePtr() != 0); + assert wlInputContextState.getCurrentWlSurfacePtr() != 0 : "InputContext must have a valid current surface pointer"; wlScheduleContextNewChanges(new OutgoingChanges().setEnabledState(false)); - assert(wlPendingChanges != null); + assert wlPendingChanges != null : "Must have non-empty pending changes"; // Pretending there are no committed, but not applied yet changes, so that wlCanSendChangesNow() is true. // We can do that because the assumption #1 and because any previously committed changes get lost when a @@ -1114,7 +1114,7 @@ final class WLInputMethodZwpTextInputV3 extends InputMethodAdapter { // "After an enter event or disable request all state information is invalidated and needs to be resent by the client." wlBeingCommittedChanges = null; - assert(wlCanSendChangesNow()); + assert wlCanSendChangesNow() : "Must be able to send pending changes now"; wlSendPendingChangesNow(); // See the assumption #2 above. @@ -1206,7 +1206,7 @@ final class WLInputMethodZwpTextInputV3 extends InputMethodAdapter { /** Called by {@link ClientComponentCaretPositionTracker} */ boolean wlUpdateCursorRectangle(final boolean forceUpdate) { - assert(EventQueue.isDispatchThread()); + assert EventQueue.isDispatchThread() : "Method must only be invoked on EDT"; if (log.isLoggable(PlatformLogger.Level.FINER)) { log.finer("wlUpdateCursorRectangle(): forceUpdate={0}, this={1}.", forceUpdate, this); @@ -1290,7 +1290,7 @@ final class WLInputMethodZwpTextInputV3 extends InputMethodAdapter { /** Called in response to {@code zwp_text_input_v3::enter} events. */ private void zwp_text_input_v3_onEnter(long enteredWlSurfacePtr) { - assert EventQueue.isDispatchThread(); + assert EventQueue.isDispatchThread() : "Method must only be invoked on EDT"; try { if (log.isLoggable(PlatformLogger.Level.FINE)) { @@ -1312,7 +1312,7 @@ final class WLInputMethodZwpTextInputV3 extends InputMethodAdapter { /** Called in response to {@code zwp_text_input_v3::leave} events. */ private void zwp_text_input_v3_onLeave(long leftWlSurfacePtr) { - assert EventQueue.isDispatchThread(); + assert EventQueue.isDispatchThread() : "Method must only be invoked on EDT"; try { if (log.isLoggable(PlatformLogger.Level.FINE)) { @@ -1335,7 +1335,7 @@ final class WLInputMethodZwpTextInputV3 extends InputMethodAdapter { /** Called in response to {@code zwp_text_input_v3::preedit_string} events. */ private void zwp_text_input_v3_onPreeditString(byte[] preeditStrUtf8, int cursorBeginUtf8Byte, int cursorEndUtf8Byte) { - assert EventQueue.isDispatchThread(); + assert EventQueue.isDispatchThread() : "Method must only be invoked on EDT"; try { if (log.isLoggable(PlatformLogger.Level.FINE)) { @@ -1355,7 +1355,7 @@ final class WLInputMethodZwpTextInputV3 extends InputMethodAdapter { /** Called in response to {@code zwp_text_input_v3::commit_string} events. */ private void zwp_text_input_v3_onCommitString(byte[] commitStrUtf8) { - assert EventQueue.isDispatchThread(); + assert EventQueue.isDispatchThread() : "Method must only be invoked on EDT"; try { if (log.isLoggable(PlatformLogger.Level.FINE)) { @@ -1375,7 +1375,7 @@ final class WLInputMethodZwpTextInputV3 extends InputMethodAdapter { /** Called in response to {@code zwp_text_input_v3::delete_surrounding_text} events. */ private void zwp_text_input_v3_onDeleteSurroundingText(long numberOfUtf8BytesBeforeToDelete, long numberOfUtf8BytesAfterToDelete) { - assert EventQueue.isDispatchThread(); + assert EventQueue.isDispatchThread() : "Method must only be invoked on EDT"; // TODO: support the surrounding text API (set_surrounding_text + set_text_change_cause | delete_surrounding text) // at least for particular cases. @@ -1394,7 +1394,7 @@ final class WLInputMethodZwpTextInputV3 extends InputMethodAdapter { /** Called in response to {@code zwp_text_input_v3::done} events. */ private void zwp_text_input_v3_onDone(long doneSerial) { - assert EventQueue.isDispatchThread(); + assert EventQueue.isDispatchThread() : "Method must only be invoked on EDT"; try { if (log.isLoggable(PlatformLogger.Level.FINE)) {