Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support DS 1.4 + DS 1.5 in the Annotation processor #36

Open
laeubi opened this issue Apr 21, 2022 · 10 comments
Open

Support DS 1.4 + DS 1.5 in the Annotation processor #36

laeubi opened this issue Apr 21, 2022 · 10 comments

Comments

@laeubi
Copy link
Contributor

laeubi commented Apr 21, 2022

Currently DS supports a maximum level of 1.3 for DS components.

@HannesWell
Copy link
Member

When enabling 1.4 I think it would be best to include 1.5 as well (unless there are major additional difficulties, I have not yet looked into the details):
https://search.maven.org/artifact/org.osgi/org.osgi.service.component.annotations

@laeubi
Copy link
Contributor Author

laeubi commented Apr 22, 2022

Sure I have not yet checked what has changed between 1.3 -> 1.4 -> 1.5 maybe @tjwatson or @bjhargrave can give a short summary.

@laeubi
Copy link
Contributor Author

laeubi commented Apr 22, 2022

thanks for the doc reference, I have one question regarding constructor injection (maybe also just overseen that):

Ho is this supposed to work with annotation? Should a annotation processor simply assume that constructor injection is desired if there is a public non-default constructor?

@bjhargrave
Copy link

The constructor must be annotated @Activate and the constructor arguments which are not activation object types must be annotated @Reference.

See https://github.com/osgi/osgi/blob/b9f994ed76c755ebe2634465a27e46429ee0b836/org.osgi.impl.bundle.component.annotations/src/org/osgi/impl/bundle/component/annotations/ConstructorInjection.java#L49-L58 for a test example.

@laeubi
Copy link
Contributor Author

laeubi commented Apr 22, 2022

Sounds obvious, thanks for the example!

@kwin
Copy link

kwin commented Oct 7, 2022

Particularly useful are https://docs.osgi.org/specification/osgi.cmpn/7.0.0/service.component.html#org.osgi.service.component.propertytypes. Unfortunately there is no warning from PDE when those non-supported property type annotations are found. They are just silently ignored.

@HannesWell
Copy link
Member

As suggested in #269 we could consider to use the PDE DS processor internally to generate the component XML.

But only if it is possible to get back errors/warnings from the BND-processor, so that they can be displayed in the java files.
This might be more work in the beginning but for future versions we can inherit the implementation work from BND.

@laeubi
Copy link
Contributor Author

laeubi commented Nov 1, 2022

One limitation currently is that BND works on class-files only (I'm currently experimenting with using AST Parser and source files instead), so errors will only be reported after safe/compile/generate of the XML. Another drawback is that BND is currently not really very configurable in this regard, at Tycho I "trick" BND by generate the manifest and data into a intermediate directory and then analyze the Manifest to find the generated XMLs... far from optimal.

So having real Eclipse "while you type" support and suggestions, JDT/PDE is much more superior in this regards.

laeubi added a commit to laeubi/eclipse.pde that referenced this issue Nov 29, 2023
Currently PDE only support versions up to DS 1.3 but 1.4 has some major
improvements.

This adds the necessary support and the official TCK from the OSGi
specification to support DS 1.4 features in PDE.

See eclipse-pde#36
Fix eclipse-pde#191
Fix eclipse-pde#219
laeubi added a commit to laeubi/eclipse.pde that referenced this issue Nov 29, 2023
Currently PDE only support versions up to DS 1.3 but 1.4 has some major
improvements.

This adds the necessary support and the official TCK from the OSGi
specification to support DS 1.4 features in PDE.

See eclipse-pde#36
Fix eclipse-pde#191
Fix eclipse-pde#219
@laeubi
Copy link
Contributor Author

laeubi commented Nov 29, 2023

laeubi added a commit to laeubi/eclipse.pde that referenced this issue Nov 29, 2023
Currently PDE only support versions up to DS 1.3 but 1.4 has some major
improvements.

This adds the necessary support and the official TCK from the OSGi
specification to support DS 1.4 features in PDE.

See eclipse-pde#36
Fix eclipse-pde#191
Fix eclipse-pde#219
laeubi added a commit that referenced this issue Nov 29, 2023
Currently PDE only support versions up to DS 1.3 but 1.4 has some major
improvements.

This adds the necessary support and the official TCK from the OSGi
specification to support DS 1.4 features in PDE.

See #36
Fix #191
Fix #219
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants