Support class and method annotations. #14
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I have implemented Java annotations for both Python classes and methods, as well as method signatures. I added jUnit tests to support that the implementation works as expected. Support for field signatures and annotations is being worked on, but is not included in this pull request. I would like my work reviewed. Please let me know If you have any questions, critiques, or objections.
The method to clamp a class has changed because the clamp meta-class is called and compiles the class before any class decorators are applied. Instead of using a meta-class:
The
@clamp_class()decorator is used to clamp the class. This compiles the class once it is decorated which happens after any other decorators on the class have been applied:A class can be annotated using
@annotate()but it must be applied before (i.e., below)@clamp_class():A method signature can be specified using
@method()which must be the first (i.e., bottom most decorator). A method decorated with@method()will be exported to the Java class file and directly accessible from Java:@classmethodor@staticmethodare not supported yet.Exception information can be added to the method signature using
@throws()after (i.e., above) the@method()decorator:A method can be annotated using the
@annotate()decorator after (i.e., above) the@method()decorator as well:A method's arguments can also be annotated by name using
@annotate()after (i.e., above) the@method()decorator: