eclipse-sisu / sisu-project

Sisu Inject
https://www.eclipse.org/sisu
Eclipse Public License 2.0
17 stars 15 forks source link

Option to propagate exceptions in SpaceScanner.accept #108

Closed kriegaex closed 4 weeks ago

kriegaex commented 5 months ago

Relates to https://github.com/codehaus-plexus/plexus-compiler/issues/347.

According to my analysis in https://github.com/codehaus-plexus/plexus-compiler/issues/347#issuecomment-1916310042, Sisu silently swallows errors caused by UnsupportedClassVersionError. Projects using Sisu Inject cannot react to such problems, because they have no way to find out that anything went wrong. The exception is caught and logged to the debug channel:

https://github.com/eclipse/sisu.inject/blob/550bd96afa244d22ea0fc84bef5d9b0a356bac25/org.eclipse.sisu.inject/src/main/java/org/eclipse/sisu/space/SpaceScanner.java#L113-L116

The only way to see anything on the console is MAVEN_OPTS=-Dsisu.debug, but that only helps in the analysis, not in fixing the problem.

Ironically, the ASM class visitor parsing the target class as such would be able to do so, given that the internal ASM version of Sisu can read the corresponding class file. The UnsupportedClassVersionError does not come from parsing the class, but from trying to load it, which I am not sure is even necessary at this point. Even if it is, consuming projects should have a way to find out about any problems occurring in Sisu and be able to handle them according to their own needs, e.g. by issuing a comprehensive error, log a warning or whatever.

kwin commented 5 months ago

This duplicates #97