You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by se...@apache.org on 2013/08/21 14:06:37 UTC

svn commit: r1516142 - /commons/proper/jci/trunk/compilers/eclipse/src/main/java/org/apache/commons/jci/compilers/EclipseJavaCompiler.java

Author: sebb
Date: Wed Aug 21 12:06:36 2013
New Revision: 1516142

URL: http://svn.apache.org/r1516142
Log:
Document the isPackage() bug
Fix one obvious case - package-info

Modified:
    commons/proper/jci/trunk/compilers/eclipse/src/main/java/org/apache/commons/jci/compilers/EclipseJavaCompiler.java

Modified: commons/proper/jci/trunk/compilers/eclipse/src/main/java/org/apache/commons/jci/compilers/EclipseJavaCompiler.java
URL: http://svn.apache.org/viewvc/commons/proper/jci/trunk/compilers/eclipse/src/main/java/org/apache/commons/jci/compilers/EclipseJavaCompiler.java?rev=1516142&r1=1516141&r2=1516142&view=diff
==============================================================================
--- commons/proper/jci/trunk/compilers/eclipse/src/main/java/org/apache/commons/jci/compilers/EclipseJavaCompiler.java (original)
+++ commons/proper/jci/trunk/compilers/eclipse/src/main/java/org/apache/commons/jci/compilers/EclipseJavaCompiler.java Wed Aug 21 12:06:36 2013
@@ -297,6 +297,11 @@ public final class EclipseJavaCompiler e
 
             private boolean isPackage( final String pClazzName ) {
 
+                // reject this early as it is cheap
+                if (pClazzName.contains("-")) { // "-" is not valid in package names
+                    return false;
+                }
+
                 final InputStream is = pClassLoader.getResourceAsStream(ConversionUtils.convertClassToResourcePath(pClazzName));
                 if (is != null) {
                     log.debug("found the class for " + pClazzName + "- no package");
@@ -315,6 +320,13 @@ public final class EclipseJavaCompiler e
                     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 jci.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;
             }