[jboss-jira] [JBoss JIRA] Commented: (EJBTHREE-1626) Create a ClassLoader capable of loading Primitives

Andrew Lee Rubinger (JIRA) jira-events at lists.jboss.org
Mon Dec 15 11:17:06 EST 2008


    [ https://jira.jboss.org/jira/browse/EJBTHREE-1626?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12442620#action_12442620 ] 

Andrew Lee Rubinger commented on EJBTHREE-1626:
-----------------------------------------------

Calling logic should look like:

Class<?> possiblePrimitiveClass = new PrimitiveCapableClassLoader(Thread.currentThread().getContextClassLoader()).loadClass(possiblyPrimitiveClassName); 

Class.forName is not allowed here:

http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Class.html#forName(java.lang.String,%20boolean,%20java.lang.ClassLoader)

"If name denotes a primitive type or void, an attempt will be made to locate a user-defined class in the unnamed package whose name is name. Therefore, this method cannot be used to obtain any of the Class objects representing primitive types or void. "

> Create a ClassLoader capable of loading Primitives
> --------------------------------------------------
>
>                 Key: EJBTHREE-1626
>                 URL: https://jira.jboss.org/jira/browse/EJBTHREE-1626
>             Project: EJB 3.0
>          Issue Type: Task
>          Components: common
>            Reporter: Andrew Lee Rubinger
>            Assignee: jaikiran pai
>             Fix For: 1.0.0-CR1
>
>
> In some instances we must load the class for primitives ie:
> void.class
> double.class
> Centralize this logic in a PrimitiveCapableClassLoader(ClassLoader parent) which follows a child-first delegation model to handle primitives, and if not, go to the parent.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the jboss-jira mailing list