in compilers/eclipse/src/main/java/org/apache/commons/jci2/compiler/eclipse/EclipseJavaCompiler.java [311:344]
private boolean isPackage( final String className ) {
// reject this early as it is cheap
if (className.contains("-")) { // "-" is not valid in package names
return false;
}
final InputStream is = classLoader.getResourceAsStream(ConversionUtils.convertClassToResourcePath(className));
if (is != null) {
log.debug("found the class for " + className + "- no package");
try {
is.close();
} catch (final IOException ie) {
log.error("could not close input stream", ie);
}
return false;
}
// FIXME: this should not be tied to the extension
final String source = className.replace('.', '/') + ".java";
if (resourceReader.isAvailable(source)) {
log.debug("found the source " + source + " for " + className + " - no package ");
return false;
}
/*
* See https://issues.apache.org/jira/browse/JCI-59
* At present, the code assumes that anything else is a package name
* This is wrong, as for example jci2.AdditionalTopLevel is not a package name.
* It's not clear how to fix this in general.
* It would seem to need access to the input classpath and/or the generated classes.
*/
return true;
}