Changes between Version 79 and Version 80 of j2p


Ignore:
Timestamp:
05/30/24 09:39:46 (5 months ago)
Author:
wouter
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • j2p

    v79 v80  
    1818The repo contains the translator in the module named "core". The other modules, ending with "-t", are translator plug-ins described below.
    1919
    20 == Internal mechanism
     20== Core Translation
    2121For 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).
    2222
     
    3636
    3737But 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
     40The 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
     42Generally, 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
     49Therefore, we recommend to place method @Annotations **before** the javadoc, like this
     50{{{
     51@NonNull @Override
     52/** @return  a string representation of the object ....*/
     53public String toString() { ... }
     54}}}
    3855
    3956==== constructs