Skip to content

[Bug]: unexpected data type for List fields in OPM #1947

Open
@JoelGaechter

Description

@JoelGaechter

What happened?

When trying to query multiple values as a collection using a single tag, as follows, the (inner) datatypes returned do not match the field.

@PlcTag("input-register:1:UINT[2]")
private List<Integer> registers;

The field on the returned (ByteBuddy proxy) instance would be of type List<PlcUINT>. The problem is that if we then want to use list elements as Integer, this causes a ClassCastException.

The expected behavior IMO would be that the list is of type List<Integer> similar as it works for single values, e.g, @PlcTag("input-register:1:UINT") => int.

Note:
When trying to use an array, e.g., int[] instead, the field can not be assigned at all, as the call returns a list.

Version

v0.12.0

Programming Languages

  • plc4j
  • plc4go
  • plc4c
  • plc4net

Protocols

  • AB-Ethernet
  • ADS /AMS
  • BACnet/IP
  • CANopen
  • DeltaV
  • DF1
  • EtherNet/IP
  • Firmata
  • KNXnet/IP
  • Modbus
  • OPC-UA
  • S7

Metadata

Metadata

Assignees

No one assigned

    Labels

    javaPull requests that update Java code

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions