part5polymorphic: add F05-F08 (default typing modes, type validation, sealed hierarchies, unknown subtypes) for the rewritten polymorphism post (#59)
Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01JXVi2GMQ7bR5EmbUFdDj7N
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
NONE (no default typing): {"any":{"label":"t"},"colour":"RED","dot":{"x":2},"items":["a"],"numbers":[1,2],"shape":{"x":1},"tag":{"label":"t"},"text":"s"}
|
||||
|
||||
JAVA_LANG_OBJECT:
|
||||
{"any":["~Tag",{"label":"t"}],"colour":"RED","dot":{"x":2},"items":["a"],"numbers":[1,2],"shape":{"x":1},"tag":{"label":"t"},"text":"s"}
|
||||
|
||||
OBJECT_AND_NON_CONCRETE:
|
||||
{"any":["~Tag",{"label":"t"}],"colour":"RED","dot":{"x":2},"items":["java.util.ImmutableCollections$List12",["a"]],"numbers":[1,2],"shape":["~Dot",{"x":1}],"tag":{"label":"t"},"text":"s"}
|
||||
|
||||
NON_CONCRETE_AND_ARRAYS:
|
||||
{"any":["~Tag",{"label":"t"}],"colour":"RED","dot":{"x":2},"items":["java.util.ImmutableCollections$List12",["a"]],"numbers":[1,2],"shape":["~Dot",{"x":1}],"tag":{"label":"t"},"text":"s"}
|
||||
|
||||
NON_FINAL:
|
||||
["~Holder",{"any":["~Tag",{"label":"t"}],"colour":"RED","dot":{"x":2},"items":["java.util.ImmutableCollections$List12",["a"]],"numbers":[1,2],"shape":["~Dot",{"x":1}],"tag":{"label":"t"},"text":"s"}]
|
||||
|
||||
NON_FINAL_AND_ENUMS:
|
||||
["~Holder",{"any":["~Tag",{"label":"t"}],"colour":["~Colour","RED"],"dot":{"x":2},"items":["java.util.ImmutableCollections$List12",["a"]],"numbers":[1,2],"shape":["~Dot",{"x":1}],"tag":{"label":"t"},"text":"s"}]
|
||||
|
||||
NON_FINAL_AND_RECORDS:
|
||||
["~Holder",{"any":["~Tag",{"label":"t"}],"colour":"RED","dot":["~Dot",{"x":2}],"items":["java.util.ImmutableCollections$List12",["a"]],"numbers":[1,2],"shape":["~Dot",{"x":1}],"tag":{"label":"t"},"text":"s"}]
|
||||
@@ -0,0 +1,6 @@
|
||||
default mapper, Good (listed in @JsonSubTypes) -> accepted Good
|
||||
default mapper, Rogue (not listed) -> accepted Rogue
|
||||
FAIL_ON_SUBTYPE_CLASS_NOT_REGISTERED, Good -> accepted Good
|
||||
FAIL_ON_SUBTYPE_CLASS_NOT_REGISTERED, Rogue -> InvalidTypeIdException
|
||||
PolymorphicTypeValidator allowing only Good, Good -> accepted Good
|
||||
PolymorphicTypeValidator allowing only Good, Rogue -> InvalidTypeIdException
|
||||
@@ -0,0 +1,11 @@
|
||||
each as Event.class:
|
||||
{"kind":"payment","id":"p1","amount":10.0}
|
||||
{"kind":"refund","id":"r1","amount":4.0}
|
||||
{"kind":"login","user":"ann"}
|
||||
{"kind":"F07SealedHierarchies$Logout","user":"ann"}
|
||||
round trip equal: true
|
||||
payment 10.0
|
||||
refund 4.0
|
||||
login ann
|
||||
logout ann
|
||||
nested sealed type read as Audit.class: Login[user=bo]
|
||||
@@ -0,0 +1,7 @@
|
||||
defaultImpl, known name -> Click[x=3]
|
||||
defaultImpl, unknown name 'swipe' -> Unknown[]
|
||||
defaultImpl, class-name attack -> Unknown[]
|
||||
defaultImpl, discriminator missing -> Unknown[]
|
||||
FAIL_ON_INVALID_SUBTYPE off, unknown name -> null
|
||||
FAIL_ON_INVALID_SUBTYPE off, missing discriminator -> null
|
||||
default, unknown name -> InvalidTypeIdException
|
||||
Reference in New Issue
Block a user