https://issues.apache.org/bugzilla/show_bug.cgi?id=57135

            Bug ID: 57135
           Summary: ImportHandler shall ignore non-public classes
           Product: Tomcat 8
           Version: 8.0.14
          Hardware: PC
            Status: NEW
          Severity: minor
          Priority: P2
         Component: EL
          Assignee: dev@tomcat.apache.org
          Reporter: knst.koli...@gmail.com

EL 3.0 specification says in 1.22.2 "Imports of Packages, Classes, and Static
Fields" that "Importing a package imports all the classes in the package."

I think that that is wrong and it shall actually say that it imports all
*public* classes in the package.

It may result in spirituous conflicts during resolveClass() -- see the example
below.

Consider the following example:
================================
Mr.Cameron has class com.cameron.Terminator and uses package import to make it
accessible.

ImportHandler handler = new ImportHandler();
handler.importPackage("com.cameron");
handler.resolveClass("Terminator");

If it really were importing all classes from a package, the above code will run
successfully on some JRE, but will fail on Oracle Java 7 JRE that has
"java.lang.Terminator" class, due to ambiguity between the two classes.

The "java.lang.Terminator" class is not part of public API of a JRE. A JRE
vendor is free to add such classes. It should not cause such spiritual
failures.


Javadoc for javax.el.ImportHandler in JavaEE 7 [1] says that
resolveClass(String) throws ELException - if the class is <...> not public.

If resolveClass(String) method were changed to return 'null' for non-public
classes instead of throwing an ELException, it would be a bit easier to
implement.

[1] http://docs.oracle.com/javaee/7/api/javax/el/ImportHandler.html

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to