feat[classfile]: PrettySerialize instances

only a little bit broken formatting
This commit is contained in:
vegowotenks 2025-08-20 19:25:26 +02:00
parent b82ce2646b
commit 5e6736e8da
20 changed files with 108 additions and 45 deletions

View file

@ -14,12 +14,13 @@ import GHC.Generics ( Generically, Generic, Generically(..) )
import Language.Java.Classfile.Flags (Flags, FlagMask (..))
import Language.Java.Classfile.ConstantPool.References (Utf8Reference)
import Language.Java.Classfile.Attributes (Attributes)
import Pretty.Serialize (PrettySerialize)
-- | Word16-Array of Fields.
newtype Fields = Fields (Array Word16 Field)
deriving stock Show
deriving newtype Extractable
deriving newtype (Extractable, PrettySerialize)
-- | All the access flags a field can have
@ -33,7 +34,8 @@ data FieldFlag
| Transient
| Synthetic
| Enumeration -- original "Enum"
deriving stock (Show, Eq, Ord, Enum, Bounded)
deriving stock (Show, Eq, Ord, Enum, Bounded, Generic)
deriving PrettySerialize via Generically FieldFlag
instance FlagMask FieldFlag where
type FlagType FieldFlag = Word16
@ -58,4 +60,4 @@ data Field = Field
, attribute :: Attributes
}
deriving stock (Show, Generic)
deriving Extractable via Generically Field
deriving (Extractable, PrettySerialize) via Generically Field