Open lreto opened 1 year ago
I want to contribute, to add empty constructors to DTOs. But please suggest me which DTO classes are where can I find those. This will be my first contribution if you kindly help.
The following classes caused troubles in our case:
Do you mean to do this only in all files?
public class SubscriptionItem {
private String name;
private Object state;
public SubscriptionItem();
}
It would also be possible to do this with a Lombok annotation. This would look something like this
@Builder
@Data
@NoArgsConstructor
@AllArgsConstructor
public class SubscribeMessage {
@AllArgsConstructor
is needed for the @Builder
I think.
Thank you all. We will look into it
Is this issue still open? I would like to work on this if it is.
Most DTOs in the PubNub SDK don't have a default (empty) constructor. Gson, which is used to serialize and deserialize the DTOs, uses the empty constructor to create instances of the DTO classes. If this is not possible (as it is the case in most classes of the PubNub SDK),
sun.misc.Unsafe.allocateInstance()
is used for the allocation. This works fine under normal circumstances. However, since we use PubNub on a hardware with limited resources, we try to minimize the JRE size and memory usage. We use a tailored JRE that includes as few modules as possible.sun.misc.Unsafe.allocateInstance()
is part of thejdk.unsupported
module, which we normally don't include in our JRE.It would be helpful for us if empty constructors were added to all DTOs (for example with Lombok's
@NoArgsConstructor
) so that the PubNub SDK worked without the jdk.unsupported module.