-- | High level representation of methods in a class file, including their attributes and code.
module H2JVM.ClassFile.Method (
    CodeAttribute (..),
    StackMapFrame (..),
    VerificationTypeInfo (..),
    LineNumberTableEntry (..),
    ClassFileMethod (..),
    MethodAttribute (..),
    ExceptionTableEntry (..),
    CodeAttributeData (..),
)
where

import Data.Data
import Data.List.NonEmpty (NonEmpty)
import Data.Text (Text)
import GHC.Generics (Generic)

import H2JVM.Builder.Label
import H2JVM.ClassFile.AccessFlags (MethodAccessFlag)
import H2JVM.Data.TypeMergingList (DataMergeable (merge), TypeMergingList, errorDifferentConstructors)
import H2JVM.Descriptor (MethodDescriptor)
import H2JVM.Instruction
import H2JVM.Internal.Pretty (Pretty (pretty))
import H2JVM.Internal.Raw.Types (U1, U2)
import H2JVM.Type (ClassInfoType)

-- | A high level representation of a method in a class file.
data ClassFileMethod = ClassFileMethod
    { ClassFileMethod -> [MethodAccessFlag]
methodAccessFlags :: [MethodAccessFlag]
    -- ^ Access flags for the method.
    , ClassFileMethod -> Text
methodName :: Text
    -- ^ The name of the method.
    , ClassFileMethod -> MethodDescriptor
methodDescriptor :: MethodDescriptor
    -- ^ The descriptor of the method.
    , ClassFileMethod -> TypeMergingList MethodAttribute
methodAttributes :: TypeMergingList MethodAttribute
    -- ^ The attributes of the method.
    }
    deriving (Int -> ClassFileMethod -> ShowS
[ClassFileMethod] -> ShowS
ClassFileMethod -> String
(Int -> ClassFileMethod -> ShowS)
-> (ClassFileMethod -> String)
-> ([ClassFileMethod] -> ShowS)
-> Show ClassFileMethod
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ClassFileMethod -> ShowS
showsPrec :: Int -> ClassFileMethod -> ShowS
$cshow :: ClassFileMethod -> String
show :: ClassFileMethod -> String
$cshowList :: [ClassFileMethod] -> ShowS
showList :: [ClassFileMethod] -> ShowS
Show)

-- | An attribute of a method.
newtype MethodAttribute
    = -- | The bytecode instructions and execution context of the method body.
      Code CodeAttributeData
    deriving (Typeable MethodAttribute
Typeable MethodAttribute =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> MethodAttribute -> c MethodAttribute)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c MethodAttribute)
-> (MethodAttribute -> Constr)
-> (MethodAttribute -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c MethodAttribute))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c MethodAttribute))
-> ((forall b. Data b => b -> b)
    -> MethodAttribute -> MethodAttribute)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> MethodAttribute -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> MethodAttribute -> r)
-> (forall u.
    (forall d. Data d => d -> u) -> MethodAttribute -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> MethodAttribute -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d)
    -> MethodAttribute -> m MethodAttribute)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> MethodAttribute -> m MethodAttribute)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> MethodAttribute -> m MethodAttribute)
-> Data MethodAttribute
MethodAttribute -> Constr
MethodAttribute -> DataType
(forall b. Data b => b -> b) -> MethodAttribute -> MethodAttribute
forall a.
Typeable a =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u.
Int -> (forall d. Data d => d -> u) -> MethodAttribute -> u
forall u. (forall d. Data d => d -> u) -> MethodAttribute -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> MethodAttribute -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> MethodAttribute -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> MethodAttribute -> m MethodAttribute
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> MethodAttribute -> m MethodAttribute
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c MethodAttribute
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> MethodAttribute -> c MethodAttribute
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c MethodAttribute)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c MethodAttribute)
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> MethodAttribute -> c MethodAttribute
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> MethodAttribute -> c MethodAttribute
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c MethodAttribute
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c MethodAttribute
$ctoConstr :: MethodAttribute -> Constr
toConstr :: MethodAttribute -> Constr
$cdataTypeOf :: MethodAttribute -> DataType
dataTypeOf :: MethodAttribute -> DataType
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c MethodAttribute)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c MethodAttribute)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c MethodAttribute)
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c MethodAttribute)
$cgmapT :: (forall b. Data b => b -> b) -> MethodAttribute -> MethodAttribute
gmapT :: (forall b. Data b => b -> b) -> MethodAttribute -> MethodAttribute
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> MethodAttribute -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> MethodAttribute -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> MethodAttribute -> r
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> MethodAttribute -> r
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> MethodAttribute -> [u]
gmapQ :: forall u. (forall d. Data d => d -> u) -> MethodAttribute -> [u]
$cgmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> MethodAttribute -> u
gmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> MethodAttribute -> u
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> MethodAttribute -> m MethodAttribute
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> MethodAttribute -> m MethodAttribute
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> MethodAttribute -> m MethodAttribute
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> MethodAttribute -> m MethodAttribute
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> MethodAttribute -> m MethodAttribute
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> MethodAttribute -> m MethodAttribute
Data, (forall x. MethodAttribute -> Rep MethodAttribute x)
-> (forall x. Rep MethodAttribute x -> MethodAttribute)
-> Generic MethodAttribute
forall x. Rep MethodAttribute x -> MethodAttribute
forall x. MethodAttribute -> Rep MethodAttribute x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. MethodAttribute -> Rep MethodAttribute x
from :: forall x. MethodAttribute -> Rep MethodAttribute x
$cto :: forall x. Rep MethodAttribute x -> MethodAttribute
to :: forall x. Rep MethodAttribute x -> MethodAttribute
Generic, Int -> MethodAttribute -> ShowS
[MethodAttribute] -> ShowS
MethodAttribute -> String
(Int -> MethodAttribute -> ShowS)
-> (MethodAttribute -> String)
-> ([MethodAttribute] -> ShowS)
-> Show MethodAttribute
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> MethodAttribute -> ShowS
showsPrec :: Int -> MethodAttribute -> ShowS
$cshow :: MethodAttribute -> String
show :: MethodAttribute -> String
$cshowList :: [MethodAttribute] -> ShowS
showList :: [MethodAttribute] -> ShowS
Show)

-- | The data contained in a @Code@ attribute.
data CodeAttributeData = CodeAttributeData
    { CodeAttributeData -> U2
maxStack :: U2
    -- ^ The maximum stack size used by the method.
    , CodeAttributeData -> U2
maxLocals :: U2
    -- ^ The maximum number of local variables used by the method.
    , CodeAttributeData -> NonEmpty Instruction
code :: NonEmpty Instruction
    -- ^ The bytecode instructions of the method.
    , CodeAttributeData -> [ExceptionTableEntry]
exceptionTable :: [ExceptionTableEntry]
    -- ^ The exception table of the method.
    , CodeAttributeData -> [CodeAttribute]
codeAttributes :: [CodeAttribute]
    -- ^ Code attributes (like stack map tables and line number tables).
    }
    deriving (Typeable CodeAttributeData
Typeable CodeAttributeData =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g)
 -> CodeAttributeData
 -> c CodeAttributeData)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c CodeAttributeData)
-> (CodeAttributeData -> Constr)
-> (CodeAttributeData -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c CodeAttributeData))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c CodeAttributeData))
-> ((forall b. Data b => b -> b)
    -> CodeAttributeData -> CodeAttributeData)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> CodeAttributeData -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> CodeAttributeData -> r)
-> (forall u.
    (forall d. Data d => d -> u) -> CodeAttributeData -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> CodeAttributeData -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d)
    -> CodeAttributeData -> m CodeAttributeData)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> CodeAttributeData -> m CodeAttributeData)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> CodeAttributeData -> m CodeAttributeData)
-> Data CodeAttributeData
CodeAttributeData -> Constr
CodeAttributeData -> DataType
(forall b. Data b => b -> b)
-> CodeAttributeData -> CodeAttributeData
forall a.
Typeable a =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u.
Int -> (forall d. Data d => d -> u) -> CodeAttributeData -> u
forall u. (forall d. Data d => d -> u) -> CodeAttributeData -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> CodeAttributeData -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> CodeAttributeData -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> CodeAttributeData -> m CodeAttributeData
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> CodeAttributeData -> m CodeAttributeData
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c CodeAttributeData
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> CodeAttributeData -> c CodeAttributeData
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c CodeAttributeData)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c CodeAttributeData)
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> CodeAttributeData -> c CodeAttributeData
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> CodeAttributeData -> c CodeAttributeData
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c CodeAttributeData
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c CodeAttributeData
$ctoConstr :: CodeAttributeData -> Constr
toConstr :: CodeAttributeData -> Constr
$cdataTypeOf :: CodeAttributeData -> DataType
dataTypeOf :: CodeAttributeData -> DataType
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c CodeAttributeData)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c CodeAttributeData)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c CodeAttributeData)
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c CodeAttributeData)
$cgmapT :: (forall b. Data b => b -> b)
-> CodeAttributeData -> CodeAttributeData
gmapT :: (forall b. Data b => b -> b)
-> CodeAttributeData -> CodeAttributeData
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> CodeAttributeData -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> CodeAttributeData -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> CodeAttributeData -> r
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> CodeAttributeData -> r
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> CodeAttributeData -> [u]
gmapQ :: forall u. (forall d. Data d => d -> u) -> CodeAttributeData -> [u]
$cgmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> CodeAttributeData -> u
gmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> CodeAttributeData -> u
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> CodeAttributeData -> m CodeAttributeData
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> CodeAttributeData -> m CodeAttributeData
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> CodeAttributeData -> m CodeAttributeData
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> CodeAttributeData -> m CodeAttributeData
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> CodeAttributeData -> m CodeAttributeData
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> CodeAttributeData -> m CodeAttributeData
Data, (forall x. CodeAttributeData -> Rep CodeAttributeData x)
-> (forall x. Rep CodeAttributeData x -> CodeAttributeData)
-> Generic CodeAttributeData
forall x. Rep CodeAttributeData x -> CodeAttributeData
forall x. CodeAttributeData -> Rep CodeAttributeData x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. CodeAttributeData -> Rep CodeAttributeData x
from :: forall x. CodeAttributeData -> Rep CodeAttributeData x
$cto :: forall x. Rep CodeAttributeData x -> CodeAttributeData
to :: forall x. Rep CodeAttributeData x -> CodeAttributeData
Generic, Int -> CodeAttributeData -> ShowS
[CodeAttributeData] -> ShowS
CodeAttributeData -> String
(Int -> CodeAttributeData -> ShowS)
-> (CodeAttributeData -> String)
-> ([CodeAttributeData] -> ShowS)
-> Show CodeAttributeData
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> CodeAttributeData -> ShowS
showsPrec :: Int -> CodeAttributeData -> ShowS
$cshow :: CodeAttributeData -> String
show :: CodeAttributeData -> String
$cshowList :: [CodeAttributeData] -> ShowS
showList :: [CodeAttributeData] -> ShowS
Show)

-- | An entry in the method's exception handler table.
data ExceptionTableEntry = ExceptionTableEntry
    { ExceptionTableEntry -> Int
startPc :: Int
    -- ^ The start of the instruction range protected by this handler.
    , ExceptionTableEntry -> Int
endPc :: Int
    -- ^ The end of the instruction range protected by this handler.
    , ExceptionTableEntry -> Int
handlerPc :: Int
    -- ^ The instruction address to branch to when an exception is caught.
    , ExceptionTableEntry -> Maybe ClassInfoType
catchType :: Maybe ClassInfoType
    -- ^ The class type of the exception caught (or 'Nothing' for all/@finally@).
    }
    deriving (Typeable ExceptionTableEntry
Typeable ExceptionTableEntry =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g)
 -> ExceptionTableEntry
 -> c ExceptionTableEntry)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c ExceptionTableEntry)
-> (ExceptionTableEntry -> Constr)
-> (ExceptionTableEntry -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c ExceptionTableEntry))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c ExceptionTableEntry))
-> ((forall b. Data b => b -> b)
    -> ExceptionTableEntry -> ExceptionTableEntry)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> ExceptionTableEntry -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> ExceptionTableEntry -> r)
-> (forall u.
    (forall d. Data d => d -> u) -> ExceptionTableEntry -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> ExceptionTableEntry -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d)
    -> ExceptionTableEntry -> m ExceptionTableEntry)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> ExceptionTableEntry -> m ExceptionTableEntry)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> ExceptionTableEntry -> m ExceptionTableEntry)
-> Data ExceptionTableEntry
ExceptionTableEntry -> Constr
ExceptionTableEntry -> DataType
(forall b. Data b => b -> b)
-> ExceptionTableEntry -> ExceptionTableEntry
forall a.
Typeable a =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u.
Int -> (forall d. Data d => d -> u) -> ExceptionTableEntry -> u
forall u.
(forall d. Data d => d -> u) -> ExceptionTableEntry -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ExceptionTableEntry -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ExceptionTableEntry -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> ExceptionTableEntry -> m ExceptionTableEntry
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> ExceptionTableEntry -> m ExceptionTableEntry
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ExceptionTableEntry
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> ExceptionTableEntry
-> c ExceptionTableEntry
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c ExceptionTableEntry)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c ExceptionTableEntry)
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> ExceptionTableEntry
-> c ExceptionTableEntry
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> ExceptionTableEntry
-> c ExceptionTableEntry
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ExceptionTableEntry
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ExceptionTableEntry
$ctoConstr :: ExceptionTableEntry -> Constr
toConstr :: ExceptionTableEntry -> Constr
$cdataTypeOf :: ExceptionTableEntry -> DataType
dataTypeOf :: ExceptionTableEntry -> DataType
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c ExceptionTableEntry)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c ExceptionTableEntry)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c ExceptionTableEntry)
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c ExceptionTableEntry)
$cgmapT :: (forall b. Data b => b -> b)
-> ExceptionTableEntry -> ExceptionTableEntry
gmapT :: (forall b. Data b => b -> b)
-> ExceptionTableEntry -> ExceptionTableEntry
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ExceptionTableEntry -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ExceptionTableEntry -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ExceptionTableEntry -> r
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ExceptionTableEntry -> r
$cgmapQ :: forall u.
(forall d. Data d => d -> u) -> ExceptionTableEntry -> [u]
gmapQ :: forall u.
(forall d. Data d => d -> u) -> ExceptionTableEntry -> [u]
$cgmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> ExceptionTableEntry -> u
gmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> ExceptionTableEntry -> u
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> ExceptionTableEntry -> m ExceptionTableEntry
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> ExceptionTableEntry -> m ExceptionTableEntry
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> ExceptionTableEntry -> m ExceptionTableEntry
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> ExceptionTableEntry -> m ExceptionTableEntry
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> ExceptionTableEntry -> m ExceptionTableEntry
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> ExceptionTableEntry -> m ExceptionTableEntry
Data, (forall x. ExceptionTableEntry -> Rep ExceptionTableEntry x)
-> (forall x. Rep ExceptionTableEntry x -> ExceptionTableEntry)
-> Generic ExceptionTableEntry
forall x. Rep ExceptionTableEntry x -> ExceptionTableEntry
forall x. ExceptionTableEntry -> Rep ExceptionTableEntry x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. ExceptionTableEntry -> Rep ExceptionTableEntry x
from :: forall x. ExceptionTableEntry -> Rep ExceptionTableEntry x
$cto :: forall x. Rep ExceptionTableEntry x -> ExceptionTableEntry
to :: forall x. Rep ExceptionTableEntry x -> ExceptionTableEntry
Generic, Int -> ExceptionTableEntry -> ShowS
[ExceptionTableEntry] -> ShowS
ExceptionTableEntry -> String
(Int -> ExceptionTableEntry -> ShowS)
-> (ExceptionTableEntry -> String)
-> ([ExceptionTableEntry] -> ShowS)
-> Show ExceptionTableEntry
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ExceptionTableEntry -> ShowS
showsPrec :: Int -> ExceptionTableEntry -> ShowS
$cshow :: ExceptionTableEntry -> String
show :: ExceptionTableEntry -> String
$cshowList :: [ExceptionTableEntry] -> ShowS
showList :: [ExceptionTableEntry] -> ShowS
Show)

-- | Additional properties of the compiled method bytecode.
data CodeAttribute
    = -- | Line number information for debugging stack traces.
      LineNumberTable [LineNumberTableEntry]
    | -- | Stack map frame table for JVM verification.
      StackMapTable [StackMapFrame]
    deriving (Typeable CodeAttribute
Typeable CodeAttribute =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> CodeAttribute -> c CodeAttribute)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c CodeAttribute)
-> (CodeAttribute -> Constr)
-> (CodeAttribute -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c CodeAttribute))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c CodeAttribute))
-> ((forall b. Data b => b -> b) -> CodeAttribute -> CodeAttribute)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> CodeAttribute -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> CodeAttribute -> r)
-> (forall u. (forall d. Data d => d -> u) -> CodeAttribute -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> CodeAttribute -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> CodeAttribute -> m CodeAttribute)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> CodeAttribute -> m CodeAttribute)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> CodeAttribute -> m CodeAttribute)
-> Data CodeAttribute
CodeAttribute -> Constr
CodeAttribute -> DataType
(forall b. Data b => b -> b) -> CodeAttribute -> CodeAttribute
forall a.
Typeable a =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> CodeAttribute -> u
forall u. (forall d. Data d => d -> u) -> CodeAttribute -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> CodeAttribute -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> CodeAttribute -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> CodeAttribute -> m CodeAttribute
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> CodeAttribute -> m CodeAttribute
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c CodeAttribute
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> CodeAttribute -> c CodeAttribute
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c CodeAttribute)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c CodeAttribute)
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> CodeAttribute -> c CodeAttribute
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> CodeAttribute -> c CodeAttribute
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c CodeAttribute
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c CodeAttribute
$ctoConstr :: CodeAttribute -> Constr
toConstr :: CodeAttribute -> Constr
$cdataTypeOf :: CodeAttribute -> DataType
dataTypeOf :: CodeAttribute -> DataType
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c CodeAttribute)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c CodeAttribute)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c CodeAttribute)
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c CodeAttribute)
$cgmapT :: (forall b. Data b => b -> b) -> CodeAttribute -> CodeAttribute
gmapT :: (forall b. Data b => b -> b) -> CodeAttribute -> CodeAttribute
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> CodeAttribute -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> CodeAttribute -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> CodeAttribute -> r
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> CodeAttribute -> r
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> CodeAttribute -> [u]
gmapQ :: forall u. (forall d. Data d => d -> u) -> CodeAttribute -> [u]
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> CodeAttribute -> u
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> CodeAttribute -> u
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> CodeAttribute -> m CodeAttribute
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> CodeAttribute -> m CodeAttribute
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> CodeAttribute -> m CodeAttribute
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> CodeAttribute -> m CodeAttribute
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> CodeAttribute -> m CodeAttribute
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> CodeAttribute -> m CodeAttribute
Data, CodeAttribute -> CodeAttribute -> Bool
(CodeAttribute -> CodeAttribute -> Bool)
-> (CodeAttribute -> CodeAttribute -> Bool) -> Eq CodeAttribute
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: CodeAttribute -> CodeAttribute -> Bool
== :: CodeAttribute -> CodeAttribute -> Bool
$c/= :: CodeAttribute -> CodeAttribute -> Bool
/= :: CodeAttribute -> CodeAttribute -> Bool
Eq, (forall x. CodeAttribute -> Rep CodeAttribute x)
-> (forall x. Rep CodeAttribute x -> CodeAttribute)
-> Generic CodeAttribute
forall x. Rep CodeAttribute x -> CodeAttribute
forall x. CodeAttribute -> Rep CodeAttribute x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. CodeAttribute -> Rep CodeAttribute x
from :: forall x. CodeAttribute -> Rep CodeAttribute x
$cto :: forall x. Rep CodeAttribute x -> CodeAttribute
to :: forall x. Rep CodeAttribute x -> CodeAttribute
Generic, Int -> CodeAttribute -> ShowS
[CodeAttribute] -> ShowS
CodeAttribute -> String
(Int -> CodeAttribute -> ShowS)
-> (CodeAttribute -> String)
-> ([CodeAttribute] -> ShowS)
-> Show CodeAttribute
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> CodeAttribute -> ShowS
showsPrec :: Int -> CodeAttribute -> ShowS
$cshow :: CodeAttribute -> String
show :: CodeAttribute -> String
$cshowList :: [CodeAttribute] -> ShowS
showList :: [CodeAttribute] -> ShowS
Show)

instance DataMergeable CodeAttribute where
    merge :: HasCallStack => CodeAttribute -> CodeAttribute -> CodeAttribute
merge (LineNumberTable [LineNumberTableEntry]
a) (LineNumberTable [LineNumberTableEntry]
b) = [LineNumberTableEntry] -> CodeAttribute
LineNumberTable ([LineNumberTableEntry]
a [LineNumberTableEntry]
-> [LineNumberTableEntry] -> [LineNumberTableEntry]
forall a. Semigroup a => a -> a -> a
<> [LineNumberTableEntry]
b)
    merge (StackMapTable [StackMapFrame]
a) (StackMapTable [StackMapFrame]
b) = [StackMapFrame] -> CodeAttribute
StackMapTable ([StackMapFrame]
a [StackMapFrame] -> [StackMapFrame] -> [StackMapFrame]
forall a. Semigroup a => a -> a -> a
<> [StackMapFrame]
b)
    merge CodeAttribute
x CodeAttribute
y = CodeAttribute -> CodeAttribute -> CodeAttribute
forall a b. (Data a, HasCallStack) => a -> a -> b
errorDifferentConstructors CodeAttribute
x CodeAttribute
y

instance DataMergeable MethodAttribute where
    merge :: HasCallStack =>
MethodAttribute -> MethodAttribute -> MethodAttribute
merge (Code CodeAttributeData
a) (Code CodeAttributeData
b) = CodeAttributeData -> MethodAttribute
Code (CodeAttributeData -> CodeAttributeData -> CodeAttributeData
forall a. (DataMergeable a, HasCallStack) => a -> a -> a
merge CodeAttributeData
a CodeAttributeData
b)

instance DataMergeable CodeAttributeData where
    merge :: HasCallStack =>
CodeAttributeData -> CodeAttributeData -> CodeAttributeData
merge (CodeAttributeData U2
a U2
b NonEmpty Instruction
c [ExceptionTableEntry]
d [CodeAttribute]
e) (CodeAttributeData U2
a' U2
b' NonEmpty Instruction
c' [ExceptionTableEntry]
d' [CodeAttribute]
e') =
        U2
-> U2
-> NonEmpty Instruction
-> [ExceptionTableEntry]
-> [CodeAttribute]
-> CodeAttributeData
CodeAttributeData (U2 -> U2 -> U2
forall a. Ord a => a -> a -> a
max U2
a U2
a') (U2 -> U2 -> U2
forall a. Ord a => a -> a -> a
max U2
b U2
b') (NonEmpty Instruction
c NonEmpty Instruction
-> NonEmpty Instruction -> NonEmpty Instruction
forall a. Semigroup a => a -> a -> a
<> NonEmpty Instruction
c') ([ExceptionTableEntry]
d [ExceptionTableEntry]
-> [ExceptionTableEntry] -> [ExceptionTableEntry]
forall a. Semigroup a => a -> a -> a
<> [ExceptionTableEntry]
d') ([CodeAttribute]
e [CodeAttribute] -> [CodeAttribute] -> [CodeAttribute]
forall a. Semigroup a => a -> a -> a
<> [CodeAttribute]
e')

-- | Represents a JVM stack map frame table entry.
data StackMapFrame
    = -- | The frame has the same local variables and an empty operand stack.
      SameFrame Label
    | -- | The operand stack is empty, and the last @k@ local variables are absent.
      ChopFrame
        -- | How many locals to chop (@k@)
        !U1
        -- | The label of the next instruction
        !Label
    | -- | The frame has the same local variables and exactly one operand stack item.
      SameLocals1StackItemFrame !VerificationTypeInfo Label
    | -- | The operand stack is empty, and new local variables are appended.
      AppendFrame ![VerificationTypeInfo] !Label
    | -- | Complete frame specification describing both locals and operand stack.
      FullFrame ![VerificationTypeInfo] ![VerificationTypeInfo] !Label
    deriving (Typeable StackMapFrame
Typeable StackMapFrame =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> StackMapFrame -> c StackMapFrame)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c StackMapFrame)
-> (StackMapFrame -> Constr)
-> (StackMapFrame -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c StackMapFrame))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c StackMapFrame))
-> ((forall b. Data b => b -> b) -> StackMapFrame -> StackMapFrame)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> StackMapFrame -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> StackMapFrame -> r)
-> (forall u. (forall d. Data d => d -> u) -> StackMapFrame -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> StackMapFrame -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> StackMapFrame -> m StackMapFrame)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> StackMapFrame -> m StackMapFrame)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> StackMapFrame -> m StackMapFrame)
-> Data StackMapFrame
StackMapFrame -> Constr
StackMapFrame -> DataType
(forall b. Data b => b -> b) -> StackMapFrame -> StackMapFrame
forall a.
Typeable a =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> StackMapFrame -> u
forall u. (forall d. Data d => d -> u) -> StackMapFrame -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> StackMapFrame -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> StackMapFrame -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> StackMapFrame -> m StackMapFrame
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> StackMapFrame -> m StackMapFrame
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c StackMapFrame
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> StackMapFrame -> c StackMapFrame
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c StackMapFrame)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c StackMapFrame)
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> StackMapFrame -> c StackMapFrame
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> StackMapFrame -> c StackMapFrame
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c StackMapFrame
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c StackMapFrame
$ctoConstr :: StackMapFrame -> Constr
toConstr :: StackMapFrame -> Constr
$cdataTypeOf :: StackMapFrame -> DataType
dataTypeOf :: StackMapFrame -> DataType
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c StackMapFrame)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c StackMapFrame)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c StackMapFrame)
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c StackMapFrame)
$cgmapT :: (forall b. Data b => b -> b) -> StackMapFrame -> StackMapFrame
gmapT :: (forall b. Data b => b -> b) -> StackMapFrame -> StackMapFrame
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> StackMapFrame -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> StackMapFrame -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> StackMapFrame -> r
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> StackMapFrame -> r
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> StackMapFrame -> [u]
gmapQ :: forall u. (forall d. Data d => d -> u) -> StackMapFrame -> [u]
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> StackMapFrame -> u
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> StackMapFrame -> u
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> StackMapFrame -> m StackMapFrame
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> StackMapFrame -> m StackMapFrame
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> StackMapFrame -> m StackMapFrame
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> StackMapFrame -> m StackMapFrame
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> StackMapFrame -> m StackMapFrame
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> StackMapFrame -> m StackMapFrame
Data, StackMapFrame -> StackMapFrame -> Bool
(StackMapFrame -> StackMapFrame -> Bool)
-> (StackMapFrame -> StackMapFrame -> Bool) -> Eq StackMapFrame
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: StackMapFrame -> StackMapFrame -> Bool
== :: StackMapFrame -> StackMapFrame -> Bool
$c/= :: StackMapFrame -> StackMapFrame -> Bool
/= :: StackMapFrame -> StackMapFrame -> Bool
Eq, Int -> StackMapFrame -> ShowS
[StackMapFrame] -> ShowS
StackMapFrame -> String
(Int -> StackMapFrame -> ShowS)
-> (StackMapFrame -> String)
-> ([StackMapFrame] -> ShowS)
-> Show StackMapFrame
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> StackMapFrame -> ShowS
showsPrec :: Int -> StackMapFrame -> ShowS
$cshow :: StackMapFrame -> String
show :: StackMapFrame -> String
$cshowList :: [StackMapFrame] -> ShowS
showList :: [StackMapFrame] -> ShowS
Show)

-- | Verification type metadata for a stack or local variable slot.
data VerificationTypeInfo
    = -- | Unusable or uninitialised slot.
      TopVariableInfo
    | -- | An 32-bit integer or smaller type (boolean, byte, char, short).
      IntegerVariableInfo
    | -- | A 32-bit single-precision floating point.
      FloatVariableInfo
    | -- | A 64-bit long integer.
      LongVariableInfo
    | -- | A 64-bit double-precision floating point.
      DoubleVariableInfo
    | -- | The null reference.
      NullVariableInfo
    | -- | An uninitialised reference of the current class constructor context.
      UninitializedThisVariableInfo
    | -- | A reference to an object of the specified class.
      ObjectVariableInfo !ClassInfoType
    | -- | An uninitialised reference to an object allocated by a `new` instruction at the given label.
      UninitializedVariableInfo !Label
    deriving (Typeable VerificationTypeInfo
Typeable VerificationTypeInfo =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g)
 -> VerificationTypeInfo
 -> c VerificationTypeInfo)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c VerificationTypeInfo)
-> (VerificationTypeInfo -> Constr)
-> (VerificationTypeInfo -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c VerificationTypeInfo))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c VerificationTypeInfo))
-> ((forall b. Data b => b -> b)
    -> VerificationTypeInfo -> VerificationTypeInfo)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> VerificationTypeInfo -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> VerificationTypeInfo -> r)
-> (forall u.
    (forall d. Data d => d -> u) -> VerificationTypeInfo -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> VerificationTypeInfo -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d)
    -> VerificationTypeInfo -> m VerificationTypeInfo)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> VerificationTypeInfo -> m VerificationTypeInfo)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> VerificationTypeInfo -> m VerificationTypeInfo)
-> Data VerificationTypeInfo
VerificationTypeInfo -> Constr
VerificationTypeInfo -> DataType
(forall b. Data b => b -> b)
-> VerificationTypeInfo -> VerificationTypeInfo
forall a.
Typeable a =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u.
Int -> (forall d. Data d => d -> u) -> VerificationTypeInfo -> u
forall u.
(forall d. Data d => d -> u) -> VerificationTypeInfo -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> VerificationTypeInfo -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> VerificationTypeInfo -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> VerificationTypeInfo -> m VerificationTypeInfo
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> VerificationTypeInfo -> m VerificationTypeInfo
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c VerificationTypeInfo
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> VerificationTypeInfo
-> c VerificationTypeInfo
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c VerificationTypeInfo)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c VerificationTypeInfo)
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> VerificationTypeInfo
-> c VerificationTypeInfo
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> VerificationTypeInfo
-> c VerificationTypeInfo
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c VerificationTypeInfo
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c VerificationTypeInfo
$ctoConstr :: VerificationTypeInfo -> Constr
toConstr :: VerificationTypeInfo -> Constr
$cdataTypeOf :: VerificationTypeInfo -> DataType
dataTypeOf :: VerificationTypeInfo -> DataType
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c VerificationTypeInfo)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c VerificationTypeInfo)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c VerificationTypeInfo)
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c VerificationTypeInfo)
$cgmapT :: (forall b. Data b => b -> b)
-> VerificationTypeInfo -> VerificationTypeInfo
gmapT :: (forall b. Data b => b -> b)
-> VerificationTypeInfo -> VerificationTypeInfo
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> VerificationTypeInfo -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> VerificationTypeInfo -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> VerificationTypeInfo -> r
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> VerificationTypeInfo -> r
$cgmapQ :: forall u.
(forall d. Data d => d -> u) -> VerificationTypeInfo -> [u]
gmapQ :: forall u.
(forall d. Data d => d -> u) -> VerificationTypeInfo -> [u]
$cgmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> VerificationTypeInfo -> u
gmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> VerificationTypeInfo -> u
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> VerificationTypeInfo -> m VerificationTypeInfo
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> VerificationTypeInfo -> m VerificationTypeInfo
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> VerificationTypeInfo -> m VerificationTypeInfo
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> VerificationTypeInfo -> m VerificationTypeInfo
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> VerificationTypeInfo -> m VerificationTypeInfo
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> VerificationTypeInfo -> m VerificationTypeInfo
Data, VerificationTypeInfo -> VerificationTypeInfo -> Bool
(VerificationTypeInfo -> VerificationTypeInfo -> Bool)
-> (VerificationTypeInfo -> VerificationTypeInfo -> Bool)
-> Eq VerificationTypeInfo
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: VerificationTypeInfo -> VerificationTypeInfo -> Bool
== :: VerificationTypeInfo -> VerificationTypeInfo -> Bool
$c/= :: VerificationTypeInfo -> VerificationTypeInfo -> Bool
/= :: VerificationTypeInfo -> VerificationTypeInfo -> Bool
Eq, Int -> VerificationTypeInfo -> ShowS
[VerificationTypeInfo] -> ShowS
VerificationTypeInfo -> String
(Int -> VerificationTypeInfo -> ShowS)
-> (VerificationTypeInfo -> String)
-> ([VerificationTypeInfo] -> ShowS)
-> Show VerificationTypeInfo
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> VerificationTypeInfo -> ShowS
showsPrec :: Int -> VerificationTypeInfo -> ShowS
$cshow :: VerificationTypeInfo -> String
show :: VerificationTypeInfo -> String
$cshowList :: [VerificationTypeInfo] -> ShowS
showList :: [VerificationTypeInfo] -> ShowS
Show)

-- | Map a JVM bytecode offset to a source code line number.
data LineNumberTableEntry = LineNumberTableEntry
    { LineNumberTableEntry -> U2
lineNumberTableEntryStartPc :: U2
    -- ^ The starting instruction address/offset.
    , LineNumberTableEntry -> U2
lineNumberTableEntryLineNumber :: U2
    -- ^ The source code line number.
    }
    deriving (Typeable LineNumberTableEntry
Typeable LineNumberTableEntry =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g)
 -> LineNumberTableEntry
 -> c LineNumberTableEntry)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c LineNumberTableEntry)
-> (LineNumberTableEntry -> Constr)
-> (LineNumberTableEntry -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c LineNumberTableEntry))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c LineNumberTableEntry))
-> ((forall b. Data b => b -> b)
    -> LineNumberTableEntry -> LineNumberTableEntry)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> LineNumberTableEntry -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> LineNumberTableEntry -> r)
-> (forall u.
    (forall d. Data d => d -> u) -> LineNumberTableEntry -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> LineNumberTableEntry -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d)
    -> LineNumberTableEntry -> m LineNumberTableEntry)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> LineNumberTableEntry -> m LineNumberTableEntry)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> LineNumberTableEntry -> m LineNumberTableEntry)
-> Data LineNumberTableEntry
LineNumberTableEntry -> Constr
LineNumberTableEntry -> DataType
(forall b. Data b => b -> b)
-> LineNumberTableEntry -> LineNumberTableEntry
forall a.
Typeable a =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u.
Int -> (forall d. Data d => d -> u) -> LineNumberTableEntry -> u
forall u.
(forall d. Data d => d -> u) -> LineNumberTableEntry -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> LineNumberTableEntry -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> LineNumberTableEntry -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> LineNumberTableEntry -> m LineNumberTableEntry
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> LineNumberTableEntry -> m LineNumberTableEntry
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c LineNumberTableEntry
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> LineNumberTableEntry
-> c LineNumberTableEntry
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c LineNumberTableEntry)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c LineNumberTableEntry)
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> LineNumberTableEntry
-> c LineNumberTableEntry
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> LineNumberTableEntry
-> c LineNumberTableEntry
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c LineNumberTableEntry
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c LineNumberTableEntry
$ctoConstr :: LineNumberTableEntry -> Constr
toConstr :: LineNumberTableEntry -> Constr
$cdataTypeOf :: LineNumberTableEntry -> DataType
dataTypeOf :: LineNumberTableEntry -> DataType
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c LineNumberTableEntry)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c LineNumberTableEntry)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c LineNumberTableEntry)
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c LineNumberTableEntry)
$cgmapT :: (forall b. Data b => b -> b)
-> LineNumberTableEntry -> LineNumberTableEntry
gmapT :: (forall b. Data b => b -> b)
-> LineNumberTableEntry -> LineNumberTableEntry
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> LineNumberTableEntry -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> LineNumberTableEntry -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> LineNumberTableEntry -> r
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> LineNumberTableEntry -> r
$cgmapQ :: forall u.
(forall d. Data d => d -> u) -> LineNumberTableEntry -> [u]
gmapQ :: forall u.
(forall d. Data d => d -> u) -> LineNumberTableEntry -> [u]
$cgmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> LineNumberTableEntry -> u
gmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> LineNumberTableEntry -> u
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> LineNumberTableEntry -> m LineNumberTableEntry
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> LineNumberTableEntry -> m LineNumberTableEntry
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> LineNumberTableEntry -> m LineNumberTableEntry
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> LineNumberTableEntry -> m LineNumberTableEntry
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> LineNumberTableEntry -> m LineNumberTableEntry
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> LineNumberTableEntry -> m LineNumberTableEntry
Data, LineNumberTableEntry -> LineNumberTableEntry -> Bool
(LineNumberTableEntry -> LineNumberTableEntry -> Bool)
-> (LineNumberTableEntry -> LineNumberTableEntry -> Bool)
-> Eq LineNumberTableEntry
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: LineNumberTableEntry -> LineNumberTableEntry -> Bool
== :: LineNumberTableEntry -> LineNumberTableEntry -> Bool
$c/= :: LineNumberTableEntry -> LineNumberTableEntry -> Bool
/= :: LineNumberTableEntry -> LineNumberTableEntry -> Bool
Eq, Int -> LineNumberTableEntry -> ShowS
[LineNumberTableEntry] -> ShowS
LineNumberTableEntry -> String
(Int -> LineNumberTableEntry -> ShowS)
-> (LineNumberTableEntry -> String)
-> ([LineNumberTableEntry] -> ShowS)
-> Show LineNumberTableEntry
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> LineNumberTableEntry -> ShowS
showsPrec :: Int -> LineNumberTableEntry -> ShowS
$cshow :: LineNumberTableEntry -> String
show :: LineNumberTableEntry -> String
$cshowList :: [LineNumberTableEntry] -> ShowS
showList :: [LineNumberTableEntry] -> ShowS
Show)

instance Pretty ClassFileMethod where
    pretty :: forall ann. ClassFileMethod -> Doc ann
pretty (ClassFileMethod [MethodAccessFlag]
accessFlags Text
name MethodDescriptor
descriptor TypeMergingList MethodAttribute
attributes) =
        [MethodAccessFlag] -> Doc ann
forall ann. [MethodAccessFlag] -> Doc ann
forall a ann. Pretty a => a -> Doc ann
pretty [MethodAccessFlag]
accessFlags Doc ann -> Doc ann -> Doc ann
forall a. Semigroup a => a -> a -> a
<> Doc ann
" " Doc ann -> Doc ann -> Doc ann
forall a. Semigroup a => a -> a -> a
<> MethodDescriptor -> Doc ann
forall a ann. Pretty a => a -> Doc ann
forall ann. MethodDescriptor -> Doc ann
pretty MethodDescriptor
descriptor Doc ann -> Doc ann -> Doc ann
forall a. Semigroup a => a -> a -> a
<> Doc ann
" " Doc ann -> Doc ann -> Doc ann
forall a. Semigroup a => a -> a -> a
<> Text -> Doc ann
forall a ann. Pretty a => a -> Doc ann
forall ann. Text -> Doc ann
pretty Text
name Doc ann -> Doc ann -> Doc ann
forall a. Semigroup a => a -> a -> a
<> Doc ann
" " Doc ann -> Doc ann -> Doc ann
forall a. Semigroup a => a -> a -> a
<> TypeMergingList MethodAttribute -> Doc ann
forall a ann. Pretty a => a -> Doc ann
forall ann. TypeMergingList MethodAttribute -> Doc ann
pretty TypeMergingList MethodAttribute
attributes

instance Pretty MethodAttribute where
    pretty :: forall ann. MethodAttribute -> Doc ann
pretty (Code CodeAttributeData
a) = Doc ann
"Code " Doc ann -> Doc ann -> Doc ann
forall a. Semigroup a => a -> a -> a
<> CodeAttributeData -> Doc ann
forall a ann. Pretty a => a -> Doc ann
forall ann. CodeAttributeData -> Doc ann
pretty CodeAttributeData
a

instance Pretty CodeAttributeData where
    pretty :: forall ann. CodeAttributeData -> Doc ann
pretty CodeAttributeData{U2
maxStack :: CodeAttributeData -> U2
maxStack :: U2
maxStack, U2
maxLocals :: CodeAttributeData -> U2
maxLocals :: U2
maxLocals, NonEmpty Instruction
code :: CodeAttributeData -> NonEmpty Instruction
code :: NonEmpty Instruction
code, [ExceptionTableEntry]
exceptionTable :: CodeAttributeData -> [ExceptionTableEntry]
exceptionTable :: [ExceptionTableEntry]
exceptionTable, [CodeAttribute]
codeAttributes :: CodeAttributeData -> [CodeAttribute]
codeAttributes :: [CodeAttribute]
codeAttributes} =
        Doc ann
"CodeAttributeData " Doc ann -> Doc ann -> Doc ann
forall a. Semigroup a => a -> a -> a
<> U2 -> Doc ann
forall ann. U2 -> Doc ann
forall a ann. Pretty a => a -> Doc ann
pretty U2
maxStack Doc ann -> Doc ann -> Doc ann
forall a. Semigroup a => a -> a -> a
<> Doc ann
" " Doc ann -> Doc ann -> Doc ann
forall a. Semigroup a => a -> a -> a
<> U2 -> Doc ann
forall ann. U2 -> Doc ann
forall a ann. Pretty a => a -> Doc ann
pretty U2
maxLocals Doc ann -> Doc ann -> Doc ann
forall a. Semigroup a => a -> a -> a
<> Doc ann
" " Doc ann -> Doc ann -> Doc ann
forall a. Semigroup a => a -> a -> a
<> NonEmpty Instruction -> Doc ann
forall ann. NonEmpty Instruction -> Doc ann
forall a ann. Pretty a => a -> Doc ann
pretty NonEmpty Instruction
code Doc ann -> Doc ann -> Doc ann
forall a. Semigroup a => a -> a -> a
<> Doc ann
" " Doc ann -> Doc ann -> Doc ann
forall a. Semigroup a => a -> a -> a
<> [ExceptionTableEntry] -> Doc ann
forall ann. [ExceptionTableEntry] -> Doc ann
forall a ann. Pretty a => a -> Doc ann
pretty [ExceptionTableEntry]
exceptionTable Doc ann -> Doc ann -> Doc ann
forall a. Semigroup a => a -> a -> a
<> Doc ann
" " Doc ann -> Doc ann -> Doc ann
forall a. Semigroup a => a -> a -> a
<> [CodeAttribute] -> Doc ann
forall ann. [CodeAttribute] -> Doc ann
forall a ann. Pretty a => a -> Doc ann
pretty [CodeAttribute]
codeAttributes

instance Pretty ExceptionTableEntry where
    pretty :: forall ann. ExceptionTableEntry -> Doc ann
pretty ExceptionTableEntry{Int
startPc :: ExceptionTableEntry -> Int
startPc :: Int
startPc, Int
endPc :: ExceptionTableEntry -> Int
endPc :: Int
endPc, Int
handlerPc :: ExceptionTableEntry -> Int
handlerPc :: Int
handlerPc, Maybe ClassInfoType
catchType :: ExceptionTableEntry -> Maybe ClassInfoType
catchType :: Maybe ClassInfoType
catchType} =
        Doc ann
"ExceptionTableEntry " Doc ann -> Doc ann -> Doc ann
forall a. Semigroup a => a -> a -> a
<> Int -> Doc ann
forall ann. Int -> Doc ann
forall a ann. Pretty a => a -> Doc ann
pretty Int
startPc Doc ann -> Doc ann -> Doc ann
forall a. Semigroup a => a -> a -> a
<> Doc ann
" " Doc ann -> Doc ann -> Doc ann
forall a. Semigroup a => a -> a -> a
<> Int -> Doc ann
forall ann. Int -> Doc ann
forall a ann. Pretty a => a -> Doc ann
pretty Int
endPc Doc ann -> Doc ann -> Doc ann
forall a. Semigroup a => a -> a -> a
<> Doc ann
" " Doc ann -> Doc ann -> Doc ann
forall a. Semigroup a => a -> a -> a
<> Int -> Doc ann
forall ann. Int -> Doc ann
forall a ann. Pretty a => a -> Doc ann
pretty Int
handlerPc Doc ann -> Doc ann -> Doc ann
forall a. Semigroup a => a -> a -> a
<> Doc ann
" " Doc ann -> Doc ann -> Doc ann
forall a. Semigroup a => a -> a -> a
<> Maybe ClassInfoType -> Doc ann
forall ann. Maybe ClassInfoType -> Doc ann
forall a ann. Pretty a => a -> Doc ann
pretty Maybe ClassInfoType
catchType

instance Pretty CodeAttribute where
    pretty :: forall ann. CodeAttribute -> Doc ann
pretty (LineNumberTable [LineNumberTableEntry]
a) = Doc ann
"LineNumberTable " Doc ann -> Doc ann -> Doc ann
forall a. Semigroup a => a -> a -> a
<> [LineNumberTableEntry] -> Doc ann
forall ann. [LineNumberTableEntry] -> Doc ann
forall a ann. Pretty a => a -> Doc ann
pretty [LineNumberTableEntry]
a
    pretty (StackMapTable [StackMapFrame]
a) = Doc ann
"StackMapTable " Doc ann -> Doc ann -> Doc ann
forall a. Semigroup a => a -> a -> a
<> [StackMapFrame] -> Doc ann
forall ann. [StackMapFrame] -> Doc ann
forall a ann. Pretty a => a -> Doc ann
pretty [StackMapFrame]
a

instance Pretty StackMapFrame where
    pretty :: forall ann. StackMapFrame -> Doc ann
pretty (SameFrame Label
a) = Doc ann
"SameFrame " Doc ann -> Doc ann -> Doc ann
forall a. Semigroup a => a -> a -> a
<> Label -> Doc ann
forall a ann. Pretty a => a -> Doc ann
forall ann. Label -> Doc ann
pretty Label
a
    pretty (ChopFrame U1
a Label
b) = Doc ann
"ChopFrame " Doc ann -> Doc ann -> Doc ann
forall a. Semigroup a => a -> a -> a
<> U1 -> Doc ann
forall ann. U1 -> Doc ann
forall a ann. Pretty a => a -> Doc ann
pretty U1
a Doc ann -> Doc ann -> Doc ann
forall a. Semigroup a => a -> a -> a
<> Doc ann
" " Doc ann -> Doc ann -> Doc ann
forall a. Semigroup a => a -> a -> a
<> Label -> Doc ann
forall a ann. Pretty a => a -> Doc ann
forall ann. Label -> Doc ann
pretty Label
b
    pretty (SameLocals1StackItemFrame VerificationTypeInfo
a Label
b) = Doc ann
"SameLocals1StackItemFrame " Doc ann -> Doc ann -> Doc ann
forall a. Semigroup a => a -> a -> a
<> VerificationTypeInfo -> Doc ann
forall a ann. Pretty a => a -> Doc ann
forall ann. VerificationTypeInfo -> Doc ann
pretty VerificationTypeInfo
a Doc ann -> Doc ann -> Doc ann
forall a. Semigroup a => a -> a -> a
<> Doc ann
" " Doc ann -> Doc ann -> Doc ann
forall a. Semigroup a => a -> a -> a
<> Label -> Doc ann
forall a ann. Pretty a => a -> Doc ann
forall ann. Label -> Doc ann
pretty Label
b
    pretty (AppendFrame [VerificationTypeInfo]
a Label
b) = Doc ann
"AppendFrame " Doc ann -> Doc ann -> Doc ann
forall a. Semigroup a => a -> a -> a
<> [VerificationTypeInfo] -> Doc ann
forall ann. [VerificationTypeInfo] -> Doc ann
forall a ann. Pretty a => a -> Doc ann
pretty [VerificationTypeInfo]
a Doc ann -> Doc ann -> Doc ann
forall a. Semigroup a => a -> a -> a
<> Doc ann
" " Doc ann -> Doc ann -> Doc ann
forall a. Semigroup a => a -> a -> a
<> Label -> Doc ann
forall a ann. Pretty a => a -> Doc ann
forall ann. Label -> Doc ann
pretty Label
b
    pretty (FullFrame [VerificationTypeInfo]
a [VerificationTypeInfo]
b Label
c) = Doc ann
"FullFrame " Doc ann -> Doc ann -> Doc ann
forall a. Semigroup a => a -> a -> a
<> [VerificationTypeInfo] -> Doc ann
forall ann. [VerificationTypeInfo] -> Doc ann
forall a ann. Pretty a => a -> Doc ann
pretty [VerificationTypeInfo]
a Doc ann -> Doc ann -> Doc ann
forall a. Semigroup a => a -> a -> a
<> Doc ann
" " Doc ann -> Doc ann -> Doc ann
forall a. Semigroup a => a -> a -> a
<> [VerificationTypeInfo] -> Doc ann
forall ann. [VerificationTypeInfo] -> Doc ann
forall a ann. Pretty a => a -> Doc ann
pretty [VerificationTypeInfo]
b Doc ann -> Doc ann -> Doc ann
forall a. Semigroup a => a -> a -> a
<> Doc ann
" " Doc ann -> Doc ann -> Doc ann
forall a. Semigroup a => a -> a -> a
<> Label -> Doc ann
forall a ann. Pretty a => a -> Doc ann
forall ann. Label -> Doc ann
pretty Label
c

instance Pretty VerificationTypeInfo where
    pretty :: forall ann. VerificationTypeInfo -> Doc ann
pretty VerificationTypeInfo
TopVariableInfo = Doc ann
"TopVariableInfo"
    pretty VerificationTypeInfo
IntegerVariableInfo = Doc ann
"IntegerVariableInfo"
    pretty VerificationTypeInfo
FloatVariableInfo = Doc ann
"FloatVariableInfo"
    pretty VerificationTypeInfo
LongVariableInfo = Doc ann
"LongVariableInfo"
    pretty VerificationTypeInfo
DoubleVariableInfo = Doc ann
"DoubleVariableInfo"
    pretty VerificationTypeInfo
NullVariableInfo = Doc ann
"NullVariableInfo"
    pretty VerificationTypeInfo
UninitializedThisVariableInfo = Doc ann
"UninitializedThisVariableInfo"
    pretty (ObjectVariableInfo ClassInfoType
a) = Doc ann
"ObjectVariableInfo " Doc ann -> Doc ann -> Doc ann
forall a. Semigroup a => a -> a -> a
<> ClassInfoType -> Doc ann
forall a ann. Pretty a => a -> Doc ann
forall ann. ClassInfoType -> Doc ann
pretty ClassInfoType
a
    pretty (UninitializedVariableInfo Label
a) = Doc ann
"UninitializedVariableInfo " Doc ann -> Doc ann -> Doc ann
forall a. Semigroup a => a -> a -> a
<> Label -> Doc ann
forall a ann. Pretty a => a -> Doc ann
forall ann. Label -> Doc ann
pretty Label
a

instance Pretty LineNumberTableEntry where
    pretty :: forall ann. LineNumberTableEntry -> Doc ann
pretty LineNumberTableEntry{U2
lineNumberTableEntryStartPc :: LineNumberTableEntry -> U2
lineNumberTableEntryStartPc :: U2
lineNumberTableEntryStartPc, U2
lineNumberTableEntryLineNumber :: LineNumberTableEntry -> U2
lineNumberTableEntryLineNumber :: U2
lineNumberTableEntryLineNumber} =
        Doc ann
"LineNumberTableEntry " Doc ann -> Doc ann -> Doc ann
forall a. Semigroup a => a -> a -> a
<> U2 -> Doc ann
forall ann. U2 -> Doc ann
forall a ann. Pretty a => a -> Doc ann
pretty U2
lineNumberTableEntryStartPc Doc ann -> Doc ann -> Doc ann
forall a. Semigroup a => a -> a -> a
<> Doc ann
" " Doc ann -> Doc ann -> Doc ann
forall a. Semigroup a => a -> a -> a
<> U2 -> Doc ann
forall ann. U2 -> Doc ann
forall a ann. Pretty a => a -> Doc ann
pretty U2
lineNumberTableEntryLineNumber