How the variable annotation works?

I’ve tried below in the python console:

>>> import bpy
>>> 
>>> class MyMaterialSubProps(bpy.types.PropertyGroup):
...     my_float: bpy.props.FloatProperty()
... 
>>> class MyMaterialGroupProps(bpy.types.PropertyGroup):
...     sub_group: bpy.props.PointerProperty(type=MyMaterialSubProps)
... 
>>> def register():
...     bpy.utils.register_class(MyMaterialSubProps)
...     bpy.utils.register_class(MyMaterialGroupProps)
...     bpy.types.Material.my_custom_props: bpy.props.PointerProperty(type=MyMaterialGroupProps)
... 
>>> def unregister():
...     del bpy.types.Material.my_custom_props
...     bpy.utils.unregister_class(MyMaterialGroupProps)
...     bpy.utils.unregister_class(MyMaterialSubProps)
...     
>>> register()
>>> bpy.types.Material.my_custom_props
Traceback (most recent call last):
  File "<blender_console>", line 1, in <module>
AttributeError: type object 'Material' has no attribute 'my_custom_props'

>>> del bpy.types.Material.my_custom_props
Traceback (most recent call last):
  File "<blender_console>", line 1, in <module>
AttributeError: my_custom_props

I want to know how exactly the annotation works, according to the PEP0526, it only add a key-value pair in __annotations__ dict, how these annotation really added the identifier ? to my test , del didn’t really delete the identifer. Is there anything I understand incorrectly?

in that case, you have to assign it with = operator.

def register():
    bpy.utils.register_class(MyMaterialSubProps)
    bpy.utils.register_class(MyMaterialGroupProps)
    bpy.types.Material.my_custom_props = bpy.props.PointerProperty(type=MyMaterialGroupProps)

Hmm, but official documentation explicitly give an example of this, I think it should be runnable, but it raise error at del line, the assignment is old way I heard, but I am using 3.1, shouldn’t I use variable annotation way?

https://docs.blender.org/api/current/info_overview.html#

# add a new property to an existing type
bpy.types.Object.my_float: bpy.props.FloatProperty()
# remove
del bpy.types.Object.my_float