ceylon-ide-eclipse icon indicating copy to clipboard operation
ceylon-ide-eclipse copied to clipboard

Model loader gets confused when it finds empty Java files

Open bjansen opened this issue 8 years ago • 1 comments

In ceylon-ide-common, we have a file named SingleSourceUnitPackage.java, which is entirely commented because it was rewritten in Ceylon in a file named SingleSourceUnitPackage.ceylon, located in the same package.

When I try to import this class in a Ceylon unit that belongs to another project that depends on ceylon-ide-common, I get a strange error in Eclipse:

could not determine type of function or value reference: 'singleSourceUnitPackage'  
imported declaration not found: 'SingleSourceUnitPackage'
type does not exist: 'SingleSourceUnitPackage'

If I remove the empty Java file, the error disappears. The CLI seems to ignore the Java file as expected.

ceylon-ide-eclipse does not suffer from this issue because classes that use SingleSourceUnitPackage are all written in Java.

bjansen avatar Jun 01 '16 21:06 bjansen

I can also work around the problem by renaming the Java file. It looks like the JDT model loader assumes that Foo.java will always contain a class Foo, whereas the file can be empty.

bjansen avatar Jun 01 '16 21:06 bjansen