Skip to content

Commit 877ed68

Browse files
author
Stephen Cobbe
committed
Make serializers public.
1 parent 2d05ecc commit 877ed68

File tree

1 file changed

+1
-43
lines changed

1 file changed

+1
-43
lines changed

generator/java.stoneg.py

Lines changed: 1 addition & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1642,48 +1642,7 @@ def update_by_reference(data_type, namespace):
16421642

16431643
@staticmethod
16441644
def _resolve_serializer_visibility(api):
1645-
visibility = defaultdict(lambda: Visibility.NONE)
1646-
1647-
def update(data_type, new_visibility):
1648-
visibility[data_type] = max(visibility[data_type], new_visibility)
1649-
1650-
def update_by_reference(data_type, namespace):
1651-
if data_type.namespace == namespace:
1652-
update(data_type, Visibility.PACKAGE)
1653-
else:
1654-
update(data_type, Visibility.PUBLIC)
1655-
1656-
# Calculate initial visibility state based on routes that use our data types.
1657-
for namespace in api.namespaces.values():
1658-
for route in namespace.routes:
1659-
for data_type in (route.arg_data_type, route.result_data_type, route.error_data_type):
1660-
data_type = get_underlying_type(data_type)
1661-
if is_user_defined_type(data_type):
1662-
update_by_reference(data_type, namespace)
1663-
1664-
# Not iterate repeatedly, cascading the visibility out to other required data types as necessary
1665-
prev_state = None
1666-
cur_state = visibility.copy()
1667-
while prev_state != cur_state:
1668-
for namespace in api.namespaces.values():
1669-
for data_type in namespace.data_types:
1670-
if not visibility[data_type].is_visible:
1671-
continue
1672-
1673-
for field in data_type.all_fields:
1674-
field_data_type = get_underlying_type(field.data_type)
1675-
if is_user_defined_type(field_data_type):
1676-
update_by_reference(field_data_type, namespace)
1677-
1678-
# parents need access to their enumerated subtype serializers
1679-
if is_struct_type(data_type) and data_type.has_enumerated_subtypes():
1680-
for subtype in data_type.get_enumerated_subtypes():
1681-
update_by_reference(subtype.data_type, namespace)
1682-
1683-
prev_state = cur_state
1684-
cur_state = visibility.copy()
1685-
1686-
return visibility
1645+
return defaultdict(lambda: Visibility.PUBLIC)
16871646

16881647
@staticmethod
16891648
def get_spec_filename(element):
@@ -3747,7 +3706,6 @@ def generate_struct_serializer(self, data_type):
37473706
generics=[j.java_class(data_type)])
37483707

37493708
w.out('')
3750-
w.javadoc("For internal use only.")
37513709
with w.class_block(j.serializer_class(data_type), visibility=visibility, parent_class=parent_class):
37523710
w.out('public static final %s INSTANCE = new %s();',
37533711
j.serializer_class(data_type),

0 commit comments

Comments
 (0)