Skip to content

Commit a97e746

Browse files
authored
Merge pull request #307 from hypfvieh/issue306
Issue 306: Fixed handling of class names
2 parents c2f3956 + 8c72974 commit a97e746

4 files changed

Lines changed: 129 additions & 2 deletions

File tree

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@ The library will remain open source and MIT licensed and can still be used, fork
8888
- Virtual-Threads can be enabled/disabled for each of the different executor services used in `ReceivingService`: `SIGNAL`, `ERROR`, `METHODCALL`, `METHODRETURN`
8989
- default remains native threads on all executors
9090
- Fixed possible NullPointerException in SASL auth ([#294](https://github.com/hypfvieh/dbus-java/issues/294))
91-
- Fixed SASL authentication issue when running in server mode in combination with unix sockets ([#298](https://github.com/hypfvieh/dbus-java/issues/298))
91+
- Fixed SASL authentication issue when running in server mode in combination with unix sockets ([#298](https://github.com/hypfvieh/dbus-java/issues/298))
92+
- Fixed various issues with `InterfaceCodeGenerator` ([#302](https://github.com/hypfvieh/dbus-java/issues/302), [#303](https://github.com/hypfvieh/dbus-java/issues/303), [#304], (https://github.com/hypfvieh/dbus-java/issues/304), [#306](https://github.com/hypfvieh/dbus-java/issues/306)
9293

9394
##### Changes in 5.2.0 (2025-12-21):
9495
- removed properties from dbus-java.version which causes issues with reproducable builds ([PR#279](https://github.com/hypfvieh/dbus-java/issues/279))

dbus-java-utils/src/main/java/org/freedesktop/dbus/utils/generator/ClassBuilderInfo.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@ public String toString() {
476476
}
477477

478478
private String handleArg(Object _value) {
479-
if (_value instanceof String s) {
479+
if (_value instanceof String s && !s.endsWith(".class")) {
480480
return "\"" + s + "\"";
481481
} else {
482482
return String.valueOf(_value);

dbus-java-utils/src/test/java/org/freedesktop/dbus/utils/generator/InterfaceCodeGeneratorTest.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,20 @@ void testHandleStructSignals() throws Exception {
130130

131131
}
132132

133+
@Test
134+
void testIssue306() throws Exception {
135+
InterfaceCodeGenerator ci2 = loadDBusXmlFile(true,
136+
new File("src/test/resources/CreateInterface/xdg-desktop/org.freedesktop.impl.portal.Notification.xml"),
137+
"/", "org.freedesktop.impl.portal.Notification");
138+
Map<File, String> analyze = ci2.analyze(true);
139+
140+
assertEquals(1, analyze.size());
141+
142+
String clzContent = analyze.get(analyze.keySet().iterator().next());
143+
144+
assertTrue(clzContent.contains("@DBusBoundProperty(type = PropertySupportedOptionsType.class)"));
145+
}
146+
133147
@Test
134148
void testCreateSampleStructArgs() throws Exception {
135149
InterfaceCodeGenerator ci2 = loadDBusXmlFile(
Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
<?xml version="1.0"?>
2+
<!--
3+
Copyright (C) 2016 Red Hat, Inc.
4+
5+
SPDX-License-Identifier: LGPL-2.1-or-later
6+
7+
This library is free software; you can redistribute it and/or
8+
modify it under the terms of the GNU Lesser General Public
9+
License as published by the Free Software Foundation; either
10+
version 2.1 of the License, or (at your option) any later version.
11+
12+
This library is distributed in the hope that it will be useful,
13+
but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15+
Lesser General Public License for more details.
16+
17+
You should have received a copy of the GNU Lesser General Public
18+
License along with this library. If not, see <http://www.gnu.org/licenses/>.
19+
20+
Author: Matthias Clasen <mclasen@redhat.com>
21+
-->
22+
23+
<node name="/" xmlns:doc="http://www.freedesktop.org/dbus/1.0/doc.dtd">
24+
<!--
25+
org.freedesktop.impl.portal.Notification:
26+
@short_description: Notification portal backend interface
27+
28+
This notification interface lets sandboxed applications
29+
send and withdraw notifications.
30+
31+
This documentation describes version 2 of this interface.
32+
-->
33+
<interface name="org.freedesktop.impl.portal.Notification">
34+
<!--
35+
AddNotification:
36+
@app_id: App id of the application
37+
@id: Application-provided ID for this notification
38+
@notification: Vardict with the serialized notification
39+
40+
Sends a notification.
41+
42+
The ID can be used to later withdraw the notification.
43+
If the application reuses the same ID without withdrawing,
44+
the notification is updated with the new one. It's possible
45+
to set ``show-as-new`` hint in the ``display-hint`` property
46+
to animate replacing the notification instead of updating it.
47+
48+
The format of the @notification is the same as for
49+
:ref:`org.freedesktop.portal.Notification.AddNotification`.
50+
51+
Since version 2, the icon property never uses the ``bytes`` option.
52+
-->
53+
<method name="AddNotification">
54+
<annotation name="org.gtk.GDBus.C.UnixFD" value="true"/>
55+
<arg type="s" name="app_id" direction="in"/>
56+
<arg type="s" name="id" direction="in"/>
57+
<annotation name="org.qtproject.QtDBus.QtTypeName.In2" value="QVariantMap"/>
58+
<arg type="a{sv}" name="notification" direction="in"/>
59+
</method>
60+
<!--
61+
RemoveNotification:
62+
@app_id: App id of the application
63+
@id: Application-provided ID for this notification
64+
65+
Withdraws a notification.
66+
-->
67+
<method name="RemoveNotification">
68+
<arg type="s" name="app_id" direction="in"/>
69+
<arg type="s" name="id" direction="in"/>
70+
</method>
71+
72+
<!--
73+
SupportedOptions:
74+
75+
Some properties in :ref:`org.freedesktop.impl.portal.Notification.AddNotification`
76+
may have options advertised by the notification server.
77+
78+
The format is the same as for ``SupportedOptions`` property of
79+
:ref:`org.freedesktop.portal.Notification`.
80+
-->
81+
<property name="SupportedOptions" type="a{sv}" access="read">
82+
<annotation name="org.qtproject.QtDBus.QtTypeName" value="QVariantMap"/>
83+
</property>
84+
85+
<!--
86+
ActionInvoked:
87+
@app_id: App id of the application
88+
@id: the application-provided ID for the notification
89+
@action: the name of the action
90+
@parameter: an array containing additional information
91+
92+
Send to the application when a non-exported action is
93+
activated.
94+
95+
The @parameter contains the following values in order:
96+
97+
#. The `target` for the action, if one was specified.
98+
99+
#. The `platform-data` as vardict containing an ``activation-token`` (``s``) for
100+
`XDG Activation
101+
<https://gitlab.freedesktop.org/wayland/wayland-protocols/-/blob/main/staging/xdg-activation/xdg-activation-v1.xml>`_
102+
-->
103+
<signal name="ActionInvoked">
104+
<arg type="s" name="app_id"/>
105+
<arg type="s" name="id"/>
106+
<arg type="s" name="action"/>
107+
<arg type="av" name="parameter"/>
108+
</signal>
109+
110+
<property name="version" type="u" access="read"/>
111+
</interface>
112+
</node>

0 commit comments

Comments
 (0)