Bug 1443

Summary: GlueGen: Parse Java annotations in source files
Product: [JogAmp] Gluegen Reporter: Sven Gothel <sgothel>
Component: coreAssignee: Mathieu Féry (MathiusD) <mfery>
Status: RESOLVED FIXED    
Severity: normal CC: mfery
Priority: P4    
Version: 2.5.0   
Hardware: All   
OS: all   
Type: FEATURE SCM Refs:
2abb40b0ca9a6a06bdbe3e66b4235301ed15c693
Workaround: ---
Bug Depends on:    
Bug Blocks: 1435    

Description Sven Gothel 2023-08-07 22:49:46 CEST
Java annotations shall be supported 
when parsing Java source files in GlueGen.

Java annotations, see https://en.wikipedia.org/wiki/Java_annotation
Comment 1 Sven Gothel 2023-08-07 22:52:11 CEST
Mathieu Féry added this features in commit 2abb40b0ca9a6a06bdbe3e66b4235301ed15c693.

* Add basic management of annotations (with or w/o parameter(s)) (Retrieved in statement, classes and interfaces but not used)
Comment 3 Mathieu Féry (MathiusD) 2023-08-07 23:29:59 CEST
Annotation management was made necessary by the Java Callback generation (Bug 1435) functionality. However, as the grammar was originally designed to parse java files compatible with JLS 1.3, annotations wasn't supported.

So by following the JLS below: https://docs.oracle.com/javase/specs/jls/se8/html/jls-9.html#jls-9.7.4 since GlueGen requires a JVM 8 or higher, annotations have been added to the following positions (and in each case before and after modifiers):
 * Class declaration
 * Interface declaration
 * Field
 * Method
 * Parameters

Additional notes :
Java Callback need this modification because generate some inner interfaces and classes implements other with @Override annotation.

Parsing such files is necessary when using the following directives (Cf documentation related here: https://jogamp.org/gluegen/doc/GlueGen_Mapping.html#oo-style-api-interface-mapping):
 * ExtendedInterfaceSymbolsIgnore
 * ExtendedInterfaceSymbolsOnly
 * ExtendedImplementationSymbolsIgnore
 * ExtendedImplementationSymbolsOnly
 * ExtendedIntfAndImplSymbolsIgnore
 * ExtendedIntfAndImplSymbolsOnly