Skip to content

chore: remove Serializable from all non-essential classes - #136

Merged
mitonize merged 7 commits into
develop-2.0from
chore/remove-serialize-subsystem
May 16, 2026
Merged

mitonize merged 7 commits into
develop-2.0from
chore/remove-serialize-subsystem

Conversation

@mitonize

@mitonize mitonize commented May 10, 2026 •

Copy link
Copy Markdown
Collaborator

概要

Specificationのシリアライズ機能を廃止としたい。

シリアライズ機能は、ビルドされたTemplateやPageのインスタンスをディスクに書き出して
ビルド過程を削減する目的で存在している。
下記のような期待効果が見込めた。

  • サーバの再起動直後のウォームアップ期間の短縮
  • キャッシュから追い出されたときの再ビルド負荷の低減

しかしながら、昨今のサーバ能力やJVM性能の向上、コンテナを前提としたサーバ構成など
前述の期待効果が相対的に小さくなっていたり、発揮しづらい状況になっている。
(シリアライズされたファイルをコンテナイメージに事前に焼き付けておく運用も現実的ではなくウォームアップ改善に寄与しない)

一方で、 #120 でキャッシュ制御をモダンで広く使われている Caffeineベースに変更しており、
容量のコントロールやLRUなどのキャッシュの破棄ポリシーの信頼性が向上していることから
これまでよりキャッシュ保持件数を柔軟に上げられると考える。

また、シリアライズ処理は独自のレイアウトとなっていたり、読み出しのインスタンス復元の
ロジックが複雑になっており保守の難易度が高い。

結論

現在の環境では、テンプレートエンジンの Serializable 機能は実装上不要と判断。

変更内容

Serialize subsystem 削除に伴い、Serializable インタフェースが不要となったすべてのクラスから Serializable を除去します。

  • API インタフェース (11個): NodeObject, NodeTreeWalker, CompiledScript, ProcessorProperty, ServiceCycle, Response, TemplateProcessor, ProcessorTreeWalker, PropertyConverter, ServiceProvider, PropertySet から Serializable を削除
  • API メソッドシグネチャ: Serializable → Object に変更
    • addInformalProperty(PrefixAwareName, Serializable) → Object
    • addVirtualProperty(PrefixAwareName, Serializable) → Object
    • PropertyConverter.convert() 戻り型
  • Impl クラス (~90クラス): serialVersionUID を削除
    • Processor 系クラス(AbstractAttributableProcessor, AttributeProcessor, CDATAProcessor, etc.)
    • SpecificationNode 系(NamespaceImpl, NodeAttributeImpl, NodeTreeWalkerImpl, etc.)
    • Scope 系(AbstractReadOnlyAttributeScope, AbstractWritableAttributeScope, ParamScope, etc.)
    • Script 系(AbstractCompiledScript, ComplexScript, LiteralScript, SourceCompiledScriptImpl, etc.)
    • Builder 系(ProcessorDefinitionImpl, PropertyDefinitionImpl, TemplateBuilderImpl, etc.)
  • 特殊ケース:
    • StandardScope: 明示的 implements Serializable を除去
    • WrapFactoryImpl: 明示的 implements Serializable を除去
    • ProcessorDefinitionImpl: instanceof Serializable ガードを除去
    • message.properties: ProcessorDefinitionImpl.3 を削除

Serializable 保持対象(必要)

  • Exception/Error サブクラス(Throwable 経由)
  • Servlet クラス(HttpServlet 経由)
  • SessionScope/RequestScope 系スコープクラス
  • Rhino NativeJavaObject / ScriptableObject サブクラス
  • Jaxen DefaultNavigator / BaseXPath サブクラス
  • TemplateBuilderImpl.AbsoluteCompareList(ArrayList 継承)

テスト結果

  • コンパイル: ✅ BUILD SUCCESS
  • テスト: ✅ 545/545 PASSED

mitonize added 5 commits May 11, 2026 00:03
Remove Serializable interface and serialVersionUID from all classes that
were Serializable solely through the serialize subsystem (which has been
removed in prior commits).

Changes:
- API interfaces: remove 'extends/implements Serializable' from
  NodeObject, NodeTreeWalker, CompiledScript, ProcessorProperty,
  ServiceCycle, Response, TemplateProcessor, ProcessorTreeWalker,
  PropertyConverter, ServiceProvider, PropertySet
- API method signatures: Serializable -> Object for
  addInformalProperty, addVirtualProperty, PropertyConverter.convert()
- Impl classes: remove serialVersionUID from ~90 classes no longer
  Serializable (processors, specification nodes, scope classes,
  script classes, builder classes, etc.)
- StandardScope: remove explicit 'implements Serializable'
- WrapFactoryImpl: remove explicit 'implements Serializable'
- ProcessorDefinitionImpl: remove instanceof Serializable guard
- message.properties: remove now-orphaned ProcessorDefinitionImpl.3

Retained Serializable (through non-Mayaa paths):
- Exception/Error subclasses (via Throwable)
- Servlet classes (via HttpServlet)
- SessionScope/RequestScope and their implementations
- Rhino NativeJavaObject / ScriptableObject subclasses
- Jaxen DefaultNavigator / BaseXPath subclasses
- TemplateBuilderImpl.AbsoluteCompareList (extends ArrayList)
@mitonize
mitonize changed the base branch from master to develop-2.0 May 10, 2026 16:22
@mitonize mitonize added this to the v2.0.0 milestone May 11, 2026
@mitonize
mitonize merged commit c3d687d into develop-2.0 May 16, 2026
1 check passed
@mitonize
mitonize deleted the chore/remove-serialize-subsystem branch May 20, 2026 04:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant