jglick / sezpoz

SezPoz: lightweight, annotation-based service loader
29 stars 11 forks source link

SezPoz Not Working in Eclipse #4

Open LarryNorth opened 11 years ago

LarryNorth commented 11 years ago

SezPoz does not work in Eclipse (Juno). Only one reference to an @Indexable annotation is indexed even though the annotation is used several times.

I believe this occurs because the behavior of Eclipse's APT is different than Oracle's. When a resource does not exist, Eclipse's implementation of method FileObject.openInputStream throws an IOException; Oracle's throws a FileNotFoundException. Unfortunately, SezPoz's Indexer6.write method expects and swallows a FileNotFoundException, not an IOException.

Because method FileObject.openInputStream is documented to throw an IOException, not a FileNotFoundException, SezPoz's Indexer6.write method should look for an IOException instead of a FileNotFoundException.

I discovered this while trying to build Jenkins in Eclipse.

dscho commented 11 years ago

We're building https://github.com/imagej/imagej in Eclipse Juno all the time... Do you target JDK7?

dscho commented 11 years ago

Just for fun, I cloned https://github.com/jenkinsci/jenkins, imported into my Eclipse Juno running on Linux amd64 and built it using the project-specific settings as per m2e's imported project, in particular JavaSE-1.6. It compiles without errors, just a ton of raw type warnings.

@LarryNorth do you have any more information about your setup that could explain why I cannot reproduce?

LarryNorth commented 11 years ago

Fixed by enabling Run this container's processors in batch mode in the Factory Path's Advanced Options. Sorry for the confusion.

Though I still think expecting method FileObject.openInputStream() to throw a FileNotFoundException instead of an IOException is sketchy.

LarryNorth commented 11 years ago

Out of curiosity, I changed SezPoz's Indexer6.write method to catch IOException instead of FileNotFoundException. With that change SezPoz works in Eclipse without enabling Run this container's processors in batch mode.

LarryNorth commented 11 years ago

This Eclipse project demonstrates the problem.

jglick commented 9 years ago

Maybe a duplicate of #5?

jglick commented 6 years ago

Maybe related to #13? Should perhaps be catching IOException just for the call to openInputStream(), but treat any other throw sites as errors.