Bug 1443 - GlueGen: Parse Java annotations in source files
Summary: GlueGen: Parse Java annotations in source files
Status: RESOLVED FIXED
Alias: None
Product: Gluegen
Classification: JogAmp
Component: core (show other bugs)
Version: 2.5.0
Hardware: All all
: P4 normal
Assignee: Mathieu Féry (MathiusD)
URL:
Depends on:
Blocks: 1435
  Show dependency treegraph
 
Reported: 2023-08-07 22:49 CEST by Sven Gothel
Modified: 2023-08-07 23:29 CEST (History)
1 user (show)

See Also:
Type: FEATURE
SCM Refs:
2abb40b0ca9a6a06bdbe3e66b4235301ed15c693
Workaround: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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