Skip to content

Conversation

@ic0ns
Copy link
Contributor

@ic0ns ic0ns commented Jun 9, 2025

Summary

  • Renamed ArrayConverter to DataConverter to better reflect its purpose as a general data conversion utility
  • Maintained backward compatibility by keeping ArrayConverter as a deprecated wrapper that delegates to DataConverter
  • Added comprehensive test coverage for the new DataConverter class
  • All existing functionality remains unchanged with deprecation warnings to guide migration

Problem

The ArrayConverter class name was misleading since it handles conversion of various data types (integers, longs, BigIntegers, hex strings, etc.), not just arrays. The name suggested it was only for array operations when it's actually a comprehensive data conversion utility.

Solution

  • Created new DataConverter class with identical functionality
  • Deprecated ArrayConverter with clear migration path via @deprecated annotations
  • Maintained 100% backward compatibility to prevent breaking dependent projects
  • Added documentation pointing to the new class

Files Changed

  • Added: DataConverter.java - New class with all conversion functionality
  • Modified: ArrayConverter.java - Now deprecated wrapper that delegates to DataConverter
  • Added: DataConverterTest.java - Complete test suite for new class

Migration Guide

Existing code using ArrayConverter will continue to work but will show deprecation warnings. To migrate:

// Old (deprecated)
import de.rub.nds.modifiablevariable.util.ArrayConverter;
ArrayConverter.bytesToHexString(data);

// New (recommended)
import de.rub.nds.modifiablevariable.util.DataConverter;
DataConverter.bytesToHexString(data);

Impact on Dependent Projects

This change provides a migration path for the 3,385 references to ArrayConverter across all TLS-Attacker projects:

  • ModifiableVariable: 297 references
  • TLS-Attacker-Development: 2,669 references
  • TLS-Scanner-Development: 115 references
  • TLS-Breaker-Development: 116 references
  • Protocol-Attacker-Development: 90 references
  • ASN.1-Attacker-Development: 69 references
  • X509-Attacker-Development: 29 references

Projects can migrate at their own pace while maintaining compatibility.

Fixes #217

- Created new DataConverter class with the same functionality
- Marked ArrayConverter as @deprecated with delegation to DataConverter
- Added DataConverterTest as copy of ArrayConverterTest
- Maintained backward compatibility for existing users
- All existing code continues to work with deprecation warnings

This change addresses issue #217 by providing a more accurate class name
that reflects the broader data conversion capabilities beyond just arrays.

The deprecation approach allows for gradual migration across dependent projects.

Fixes #217
@ic0ns ic0ns requested review from NErinola and mmaehren June 10, 2025 12:11
@ic0ns ic0ns merged commit b7175c6 into main Jun 10, 2025
12 checks passed
@ic0ns ic0ns deleted the fix/rename-arrayconverter-to-dataconverter-217 branch June 10, 2025 18:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rename ArrayConverter class

3 participants