You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "kwin (via GitHub)" <gi...@apache.org> on 2026/05/11 09:20:39 UTC

[PR] fix(migrate_annotations): implement method name escape rules for OSGi… [sling-whiteboard]

kwin opened a new pull request, #124:
URL: https://github.com/apache/sling-whiteboard/pull/124

   … properties and add corresponding unit tests


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@sling.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(migrate_annotations): implement method name escape rules for OSGi… [sling-whiteboard]

Posted by "kwin (via GitHub)" <gi...@apache.org>.
kwin commented on code in PR #124:
URL: https://github.com/apache/sling-whiteboard/pull/124#discussion_r3217767765


##########
skills/osgi-scr-migrator/scripts/migrate_annotations.py:
##########
@@ -122,6 +122,27 @@ def to_metatype_attribute(self, indent: str = '    ') -> str:
 
         return f'{indent}{attr_annotation}\n{indent}{java_type} {method_name}(){default_value};'
 
+    @staticmethod
+    def _property_id_to_method_name(property_id: str) -> str:
+        """Map an OSGi property id to a method name using metatype escape rules.
+
+        This is the inverse of the id generation rules from
+        org.osgi.service.metatype.annotations.AttributeDefinition.
+        """
+        escaped = []
+        for ch in property_id:
+            if ch == '.':
+                escaped.append('_')
+            elif ch == '_':
+                escaped.append('__')
+            elif ch == '-':
+                escaped.append('$_$')

Review Comment:
   Only supported since Metatype 1.4/R7 (https://github.com/apache/sling-whiteboard/blob/2e287ed315a11776f8e85c2421a9805a6022288a/skills/osgi-scr-migrator/scripts/migrate_pom.py#L175), but the pom is always migrated to the latest version anyhow.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@sling.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(migrate_annotations): implement method name escape rules for OSGi… [sling-whiteboard]

Posted by "kwin (via GitHub)" <gi...@apache.org>.
kwin merged PR #124:
URL: https://github.com/apache/sling-whiteboard/pull/124


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@sling.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org