Skip to content

Commit

Permalink
Hex values are parsed before return in AnnotationMember::getValue() (#…
Browse files Browse the repository at this point in the history
…116)

* Fix error when parsing hex value for member id

Signed-off-by: adriancampo <adriancampo@eprosima.com>

* Moved logic to to parse hex values to AnnotationMember

Signed-off-by: adriancampo <adriancampo@eprosima.com>

---------

Signed-off-by: adriancampo <adriancampo@eprosima.com>
  • Loading branch information
adriancampo authored Dec 12, 2023
1 parent 003aa5c commit 40f1b32
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/main/java/com/eprosima/idl/parser/tree/AnnotationMember.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,19 @@ public String getValue()
}
}
}
if (m_typecode.isPrimitiveType())
{
if (m_value != null)
{
// Check if the string starts with "0x" to determine if it's hexadecimal
if (m_value.startsWith("0x")) {
// If it's hexadecimal, parse it using parseInt with radix 16
return Integer.toString(Integer.parseInt(m_value.substring(2), 16));
} else {
return m_value;
}
}
}
return m_value;
}

Expand Down

0 comments on commit 40f1b32

Please sign in to comment.