jsr341-experts@el-spec.java.net

[jsr341-experts] Importing classes

From: Kin-man Chung <kinman.chung_at_oracle.com>
Date: Fri, 05 Aug 2011 13:57:31 -0700

While working on static fields, I was thinking about importing classes
so that you can write

     #{T(Boolean).TRUE}

instead of

     #{T(java.lang.Boolean).TRUE}

and a method in ELManager to do that:

     public void importClass(String className);

e.g. elManager.importClass("java.lang.Boolean");

I would like to also allow wild cards, like "java.lang.*", but have no
idea how the wild cards can be implemented. I don't think there is an
API in the classloaderr to get all the classes in a package.

If wild cards are not allowed, do you think it is still useful to have
imports? I think it would still be useful to pre-import all java.lang
classes, and that can be implemented by listing the classes in java.lang
package, and do an explicit import of the classes in the list. Clunky,
but works, and hidden from the user.

Kin-man