feat(allure-model): add optional attachment size by noomorph · Pull Request #1182 · allure-framework/allure-java

Context

This PR adds an optional size field to the io.qameta.allure.model.Attachment class to eliminate HEAD HTTP roundtrips for remote attachments (when they are implemented, of course — but here it is a chicken and egg problem).

This change aligns with ongoing efforts to add optional size support across Allure implementations.
See related PR in allure-js: allure-framework/allure-js#1302

Changes:

  • Added optional Long size field to Attachment class
  • Added getSize() and setSize() methods following existing patterns
  • Field is nullable to maintain backward compatibility

Benefits:

  • Enables efficient attachment handling when size is already known from JSON
  • Eliminates need for reflection-based workarounds
  • Maintains backward compatibility with existing code
  • Follows Allure's established patterns and conventions
  • Supports remote attachment workflows without HTTP roundtrips

Checklist