Changes between Version 79 and Version 80 of j2p
- Timestamp:
- 05/30/24 09:39:46 (6 months ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
j2p
v79 v80 18 18 The repo contains the translator in the module named "core". The other modules, ending with "-t", are translator plug-ins described below. 19 19 20 == Internal mechanism20 == Core Translation 21 21 For normal use, you do not need to know exactly how the translation is done. But the way the translator works becomes highly relevant if you want to inject your own python translations into the code (see the following section). 22 22 … … 36 36 37 37 But the translator can intercept special classes and make dedicated translations. For instance if a class C is implementing {{{Iterator}}} and it is of class C, translating {{{it.next()}}} gives {{{next(it)}}}, and the definition {{{void iterator()}}} translates to {{{__iter__(self)}}}. These are all handled in the translator classes, in this example in {{{tudelft.utilities.j2p.t.java.util.Iterator}}}. 38 39 === Comments 40 The exact location of comments is very important as it determines to which java element the comment is attached to. And where it is attached to determines how it is translated, and which element it modifies if you use #PY annotations to override the translation (see below). 41 42 Generally, a comment attaches to the element that comes next to it. 43 44 ||next element||placement of comment in translation|| 45 ||@Annotation||before the annotation|| 46 ||method declaration, method modifier||first item in the method|| 47 ||class declaration||before the class|| 48 49 Therefore, we recommend to place method @Annotations **before** the javadoc, like this 50 {{{ 51 @NonNull @Override 52 /** @return a string representation of the object ....*/ 53 public String toString() { ... } 54 }}} 38 55 39 56 ==== constructs