-
-
Notifications
You must be signed in to change notification settings - Fork 301
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
Derive source file from builder when processing DS annotations #6458
base: master
Are you sure you want to change the base?
Conversation
Looks ok to me. A second opinion would be good. |
I approve the intent of this, as it is a pain having the error marker on the pom, but I have two questions:
Other than that it looks good. |
Bndtools seem to use the |
This is the code which tries to add the marker: bnd/bndtools.builder/src/org/bndtools/builder/handlers/component/DSAnnotationErrorHandler.java Lines 25 to 53 in 1588a4c
As you can see it uses the "default resource" namely the pom, when it either doesn't have a class name to operate on, or it can't find the named class. Setting the class name in all cases, then fixing this piece of code if it isn't working, seems like the correct solution. |
I don't understand, this will still not report the correct file name in a maven build. |
In which case I'm not sure that I understand - is this not an issue relating to Bndtools error markers in Eclipse? |
Currently if one uses the bnd-maven-plugin and has a component that contains an error this is annotated at the pom.xml file as an error what is confusing. This now checks if an error is created if the source file to the class can be found in the builder and then uses that as the file for reporting the error. Due to bnd operating on the class files we still can't know the exact line number (would require to parse it e.g. with JDT AST) but having the actual file annotated already helps to identify the error faster. Signed-off-by: Christoph Läubrich <[email protected]>
4de33af
to
3ebbce7
Compare
bnd/maven-plugins/bnd-maven-plugin/src/main/java/aQute/bnd/maven/plugin/AbstractBndMavenPlugin.java Line 170 in 1588a4c
bnd/maven-plugins/bnd-maven-plugin/src/main/java/aQute/bnd/maven/plugin/AbstractBndMavenPlugin.java Lines 524 to 571 in 1588a4c
these will then result in error markers in Eclipse if for example m2e is used. Because previously there was no source file given in the This is how it looks with current
|
That’s all great, but is there any way to engage the existing marker plugin during the maven build? That already does all the work to decorate the specific method/field/type and it seems silly to duplicate it. |
I don't see how this could work as the plugin is working on the workspace model of eclipse (and therefore can provide richer support at the moment). The next hing is that the place that creates the marker does not knows where an error originates and probably should not know that there is something like DS Plugin at all. Beside that the decoration is part of m2e already so nothing much has to be "duplicated" beside that one needs correct information on the marker. |
No. not bndtools. Here is my interpretation: ---
title: bndlib, bndtools, m2e, bnd-maven-plugin
---
classDiagram
bndlib <|-- bndtools
bndlib <|-- m2e
bndlib <|-- bnd-maven-plugin
class bndtools{
+ DSAnnotationErrorHandler
}
--
So:
Correct me if I am wrong. |
I think this is mostly correct, basically in bndlib there is the The DSPlugin generates some errors that have a In the maven plugins (or elsewhere when you use the builder) this can not be used as there is no UI and no Eclipse Workspace. In m2e (that provides a So in the meanwhile this at least forwards the filename to other users of bnd outside the bndtools build. |
So to me this sounds like an improvement of user/developer experience, by adding a small information which wasn't there before (the filename). The expectation of @timothyjward to have a more centralized approach similar to the bndtools
And maybe @laeubi already has an idea for another PR :)
@laeubi maybe have a look at |
Currently if one uses the bnd-maven-plugin and has a component that contains an error this is annotated at the pom.xml file as an error what is confusing.
This now checks if an error is created if the source file to the class can be found in the builder and then uses that as the file for reporting the error. Due to bnd operating on the class files we still can't know the exact line number (would require to parse it e.g. with JDT AST) but having the actual file annotated already helps to identify the error faster.