You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Vasily Zakharov (JIRA)" <ji...@apache.org> on 2007/10/23 05:42:50 UTC

[jira] Created: (HARMONY-5005) [drlvm][kernel] Field.getGenericType() fails on a parametrized class from custom classloader

[drlvm][kernel] Field.getGenericType() fails on a parametrized class from custom classloader
--------------------------------------------------------------------------------------------

                 Key: HARMONY-5005
                 URL: https://issues.apache.org/jira/browse/HARMONY-5005
             Project: Harmony
          Issue Type: Bug
          Components: App-Oriented Bug Reports, DRLVM
            Reporter: Vasily Zakharov
            Priority: Critical


java.lang.reflect.Field.getGenericType() fails if the field it's called upon is a parametrized class unavailable through the system class loader. To reproduce use the following code:

import java.lang.reflect.*;
import java.net.*;
public class Test {
    public static void main(String[] args) {
        try {
            ClassLoader loader = new URLClassLoader(new URL[] { new URL("file:foo.jar") } );
            Class cls = loader.loadClass("Foo");
            Field field = cls.getDeclaredField("field");
            Type type = field.getGenericType();
            System.out.println("SUCCESS: " + type);
        } catch (Exception e) {
            e.printStackTrace(System.out);
        }
    }
}
class Foo {
    java.util.List<Foo> field;
}

After compilation create a foo.jar containing Foo.class and then make sure to remove Foo.class file:

$ jar cvf foo.jar Foo.class
$ rm Foo.class
$ java Test

Output on RI:

SUCCESS: java.util.List<Foo>

Output on Harmony:

java.lang.TypeNotPresentException: Type Foo not present
	at org.apache.harmony.lang.reflect.support.AuxiliaryCreator.createTypeArgs(AuxiliaryCreator.java:216)
	at org.apache.harmony.lang.reflect.parser.Parser.parseFieldGenericType(Parser.java:358)
	at java.lang.reflect.Field.getGenericType(Field.java:72)
	at Test.main(Test.java:9)
Caused by: java.lang.ClassNotFoundException: Foo
	at org.apache.harmony.lang.reflect.support.AuxiliaryLoader.findClass(AuxiliaryLoader.java:119)
	at org.apache.harmony.lang.reflect.support.AuxiliaryCreator.createTypeArg(AuxiliaryCreator.java:192)
	at org.apache.harmony.lang.reflect.support.AuxiliaryCreator.createTypeArgs(AuxiliaryCreator.java:214)
	at org.apache.harmony.lang.reflect.parser.Parser.parseFieldGenericType(Parser.java:358)
	... 2 more

My guess is the problem lies in AuxiliaryLoader.findClass() method, line 67 - the method explicitly uses system class loader to load the target class, which clearly fails if the target class is available through some other classloader. It seems logical to use the classloader of the class whose field is being processed instead. However, the fix seems non-trivial as in the existing architecture the information on the containing class is lost when Parser is called.

This issue prevents Apache Geronimo 2.0 from starting on Harmony.


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (HARMONY-5005) [drlvm][kernel][geronimo] Field.getGenericType() fails on a parametrized class from custom classloader

Posted by "Vasily Zakharov (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-5005?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Vasily Zakharov updated HARMONY-5005:
-------------------------------------

    Patch Info: [Patch Available]

> [drlvm][kernel][geronimo] Field.getGenericType() fails on a parametrized class from custom classloader
> ------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-5005
>                 URL: https://issues.apache.org/jira/browse/HARMONY-5005
>             Project: Harmony
>          Issue Type: Bug
>          Components: App-Oriented Bug Reports, DRLVM
>            Reporter: Vasily Zakharov
>            Assignee: Gregory Shimansky
>            Priority: Critical
>         Attachments: 01-H5005-formatting.patch, 02-H5005.patch
>
>
> java.lang.reflect.Field.getGenericType() fails if the field it's called upon is a parametrized class unavailable through the system class loader. To reproduce use the following code:
> import java.lang.reflect.*;
> import java.net.*;
> public class Test {
>     public static void main(String[] args) {
>         try {
>             ClassLoader loader = new URLClassLoader(new URL[] { new URL("file:foo.jar") } );
>             Class cls = loader.loadClass("Foo");
>             Field field = cls.getDeclaredField("field");
>             Type type = field.getGenericType();
>             System.out.println("SUCCESS: " + type);
>         } catch (Exception e) {
>             e.printStackTrace(System.out);
>         }
>     }
> }
> class Foo {
>     java.util.List<Foo> field;
> }
> After compilation create a foo.jar containing Foo.class and then make sure to remove Foo.class file:
> $ jar cvf foo.jar Foo.class
> $ rm Foo.class
> $ java Test
> Output on RI:
> SUCCESS: java.util.List<Foo>
> Output on Harmony:
> java.lang.TypeNotPresentException: Type Foo not present
> 	at org.apache.harmony.lang.reflect.support.AuxiliaryCreator.createTypeArgs(AuxiliaryCreator.java:216)
> 	at org.apache.harmony.lang.reflect.parser.Parser.parseFieldGenericType(Parser.java:358)
> 	at java.lang.reflect.Field.getGenericType(Field.java:72)
> 	at Test.main(Test.java:9)
> Caused by: java.lang.ClassNotFoundException: Foo
> 	at org.apache.harmony.lang.reflect.support.AuxiliaryLoader.findClass(AuxiliaryLoader.java:119)
> 	at org.apache.harmony.lang.reflect.support.AuxiliaryCreator.createTypeArg(AuxiliaryCreator.java:192)
> 	at org.apache.harmony.lang.reflect.support.AuxiliaryCreator.createTypeArgs(AuxiliaryCreator.java:214)
> 	at org.apache.harmony.lang.reflect.parser.Parser.parseFieldGenericType(Parser.java:358)
> 	... 2 more
> My guess is the problem lies in AuxiliaryLoader.findClass() method, line 67 - the method explicitly uses system class loader to load the target class, which clearly fails if the target class is available through some other classloader. It seems logical to use the classloader of the class whose field is being processed instead. However, the fix seems non-trivial as in the existing architecture the information on the containing class is lost when Parser is called.
> This issue prevents Apache Geronimo 2.0 from starting on Harmony.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (HARMONY-5005) [drlvm][kernel][geronimo] Field.getGenericType() fails on a parametrized class from custom classloader

Posted by "Vasily Zakharov (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HARMONY-5005?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12538809 ] 

Vasily Zakharov commented on HARMONY-5005:
------------------------------------------

Vladimir, please make sure to remove the Foo.class file before running the test.


> [drlvm][kernel][geronimo] Field.getGenericType() fails on a parametrized class from custom classloader
> ------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-5005
>                 URL: https://issues.apache.org/jira/browse/HARMONY-5005
>             Project: Harmony
>          Issue Type: Bug
>          Components: App-Oriented Bug Reports, DRLVM
>            Reporter: Vasily Zakharov
>            Priority: Critical
>
> java.lang.reflect.Field.getGenericType() fails if the field it's called upon is a parametrized class unavailable through the system class loader. To reproduce use the following code:
> import java.lang.reflect.*;
> import java.net.*;
> public class Test {
>     public static void main(String[] args) {
>         try {
>             ClassLoader loader = new URLClassLoader(new URL[] { new URL("file:foo.jar") } );
>             Class cls = loader.loadClass("Foo");
>             Field field = cls.getDeclaredField("field");
>             Type type = field.getGenericType();
>             System.out.println("SUCCESS: " + type);
>         } catch (Exception e) {
>             e.printStackTrace(System.out);
>         }
>     }
> }
> class Foo {
>     java.util.List<Foo> field;
> }
> After compilation create a foo.jar containing Foo.class and then make sure to remove Foo.class file:
> $ jar cvf foo.jar Foo.class
> $ rm Foo.class
> $ java Test
> Output on RI:
> SUCCESS: java.util.List<Foo>
> Output on Harmony:
> java.lang.TypeNotPresentException: Type Foo not present
> 	at org.apache.harmony.lang.reflect.support.AuxiliaryCreator.createTypeArgs(AuxiliaryCreator.java:216)
> 	at org.apache.harmony.lang.reflect.parser.Parser.parseFieldGenericType(Parser.java:358)
> 	at java.lang.reflect.Field.getGenericType(Field.java:72)
> 	at Test.main(Test.java:9)
> Caused by: java.lang.ClassNotFoundException: Foo
> 	at org.apache.harmony.lang.reflect.support.AuxiliaryLoader.findClass(AuxiliaryLoader.java:119)
> 	at org.apache.harmony.lang.reflect.support.AuxiliaryCreator.createTypeArg(AuxiliaryCreator.java:192)
> 	at org.apache.harmony.lang.reflect.support.AuxiliaryCreator.createTypeArgs(AuxiliaryCreator.java:214)
> 	at org.apache.harmony.lang.reflect.parser.Parser.parseFieldGenericType(Parser.java:358)
> 	... 2 more
> My guess is the problem lies in AuxiliaryLoader.findClass() method, line 67 - the method explicitly uses system class loader to load the target class, which clearly fails if the target class is available through some other classloader. It seems logical to use the classloader of the class whose field is being processed instead. However, the fix seems non-trivial as in the existing architecture the information on the containing class is lost when Parser is called.
> This issue prevents Apache Geronimo 2.0 from starting on Harmony.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (HARMONY-5005) [drlvm][kernel][geronimo] Field.getGenericType() fails on a parametrized class from custom classloader

Posted by "Gregory Shimansky (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-5005?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Gregory Shimansky reassigned HARMONY-5005:
------------------------------------------

    Assignee: Gregory Shimansky

> [drlvm][kernel][geronimo] Field.getGenericType() fails on a parametrized class from custom classloader
> ------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-5005
>                 URL: https://issues.apache.org/jira/browse/HARMONY-5005
>             Project: Harmony
>          Issue Type: Bug
>          Components: App-Oriented Bug Reports, DRLVM
>            Reporter: Vasily Zakharov
>            Assignee: Gregory Shimansky
>            Priority: Critical
>         Attachments: 01-H5005-formatting.patch, 02-H5005.patch
>
>
> java.lang.reflect.Field.getGenericType() fails if the field it's called upon is a parametrized class unavailable through the system class loader. To reproduce use the following code:
> import java.lang.reflect.*;
> import java.net.*;
> public class Test {
>     public static void main(String[] args) {
>         try {
>             ClassLoader loader = new URLClassLoader(new URL[] { new URL("file:foo.jar") } );
>             Class cls = loader.loadClass("Foo");
>             Field field = cls.getDeclaredField("field");
>             Type type = field.getGenericType();
>             System.out.println("SUCCESS: " + type);
>         } catch (Exception e) {
>             e.printStackTrace(System.out);
>         }
>     }
> }
> class Foo {
>     java.util.List<Foo> field;
> }
> After compilation create a foo.jar containing Foo.class and then make sure to remove Foo.class file:
> $ jar cvf foo.jar Foo.class
> $ rm Foo.class
> $ java Test
> Output on RI:
> SUCCESS: java.util.List<Foo>
> Output on Harmony:
> java.lang.TypeNotPresentException: Type Foo not present
> 	at org.apache.harmony.lang.reflect.support.AuxiliaryCreator.createTypeArgs(AuxiliaryCreator.java:216)
> 	at org.apache.harmony.lang.reflect.parser.Parser.parseFieldGenericType(Parser.java:358)
> 	at java.lang.reflect.Field.getGenericType(Field.java:72)
> 	at Test.main(Test.java:9)
> Caused by: java.lang.ClassNotFoundException: Foo
> 	at org.apache.harmony.lang.reflect.support.AuxiliaryLoader.findClass(AuxiliaryLoader.java:119)
> 	at org.apache.harmony.lang.reflect.support.AuxiliaryCreator.createTypeArg(AuxiliaryCreator.java:192)
> 	at org.apache.harmony.lang.reflect.support.AuxiliaryCreator.createTypeArgs(AuxiliaryCreator.java:214)
> 	at org.apache.harmony.lang.reflect.parser.Parser.parseFieldGenericType(Parser.java:358)
> 	... 2 more
> My guess is the problem lies in AuxiliaryLoader.findClass() method, line 67 - the method explicitly uses system class loader to load the target class, which clearly fails if the target class is available through some other classloader. It seems logical to use the classloader of the class whose field is being processed instead. However, the fix seems non-trivial as in the existing architecture the information on the containing class is lost when Parser is called.
> This issue prevents Apache Geronimo 2.0 from starting on Harmony.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (HARMONY-5005) [drlvm][kernel][geronimo] Field.getGenericType() fails on a parametrized class from custom classloader

Posted by "Vasily Zakharov (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-5005?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Vasily Zakharov updated HARMONY-5005:
-------------------------------------

    Summary: [drlvm][kernel][geronimo] Field.getGenericType() fails on a parametrized class from custom classloader  (was: [drlvm][kernel] Field.getGenericType() fails on a parametrized class from custom classloader)

> [drlvm][kernel][geronimo] Field.getGenericType() fails on a parametrized class from custom classloader
> ------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-5005
>                 URL: https://issues.apache.org/jira/browse/HARMONY-5005
>             Project: Harmony
>          Issue Type: Bug
>          Components: App-Oriented Bug Reports, DRLVM
>            Reporter: Vasily Zakharov
>            Priority: Critical
>
> java.lang.reflect.Field.getGenericType() fails if the field it's called upon is a parametrized class unavailable through the system class loader. To reproduce use the following code:
> import java.lang.reflect.*;
> import java.net.*;
> public class Test {
>     public static void main(String[] args) {
>         try {
>             ClassLoader loader = new URLClassLoader(new URL[] { new URL("file:foo.jar") } );
>             Class cls = loader.loadClass("Foo");
>             Field field = cls.getDeclaredField("field");
>             Type type = field.getGenericType();
>             System.out.println("SUCCESS: " + type);
>         } catch (Exception e) {
>             e.printStackTrace(System.out);
>         }
>     }
> }
> class Foo {
>     java.util.List<Foo> field;
> }
> After compilation create a foo.jar containing Foo.class and then make sure to remove Foo.class file:
> $ jar cvf foo.jar Foo.class
> $ rm Foo.class
> $ java Test
> Output on RI:
> SUCCESS: java.util.List<Foo>
> Output on Harmony:
> java.lang.TypeNotPresentException: Type Foo not present
> 	at org.apache.harmony.lang.reflect.support.AuxiliaryCreator.createTypeArgs(AuxiliaryCreator.java:216)
> 	at org.apache.harmony.lang.reflect.parser.Parser.parseFieldGenericType(Parser.java:358)
> 	at java.lang.reflect.Field.getGenericType(Field.java:72)
> 	at Test.main(Test.java:9)
> Caused by: java.lang.ClassNotFoundException: Foo
> 	at org.apache.harmony.lang.reflect.support.AuxiliaryLoader.findClass(AuxiliaryLoader.java:119)
> 	at org.apache.harmony.lang.reflect.support.AuxiliaryCreator.createTypeArg(AuxiliaryCreator.java:192)
> 	at org.apache.harmony.lang.reflect.support.AuxiliaryCreator.createTypeArgs(AuxiliaryCreator.java:214)
> 	at org.apache.harmony.lang.reflect.parser.Parser.parseFieldGenericType(Parser.java:358)
> 	... 2 more
> My guess is the problem lies in AuxiliaryLoader.findClass() method, line 67 - the method explicitly uses system class loader to load the target class, which clearly fails if the target class is available through some other classloader. It seems logical to use the classloader of the class whose field is being processed instead. However, the fix seems non-trivial as in the existing architecture the information on the containing class is lost when Parser is called.
> This issue prevents Apache Geronimo 2.0 from starting on Harmony.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (HARMONY-5005) [drlvm][kernel][geronimo] Field.getGenericType() fails on a parametrized class from custom classloader

Posted by "Vladimir Beliaev (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HARMONY-5005?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12538814 ] 

Vladimir Beliaev commented on HARMONY-5005:
-------------------------------------------

I've missed several steps of reproducing - the bug exist actually. Sorry for confusion.

> [drlvm][kernel][geronimo] Field.getGenericType() fails on a parametrized class from custom classloader
> ------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-5005
>                 URL: https://issues.apache.org/jira/browse/HARMONY-5005
>             Project: Harmony
>          Issue Type: Bug
>          Components: App-Oriented Bug Reports, DRLVM
>            Reporter: Vasily Zakharov
>            Priority: Critical
>
> java.lang.reflect.Field.getGenericType() fails if the field it's called upon is a parametrized class unavailable through the system class loader. To reproduce use the following code:
> import java.lang.reflect.*;
> import java.net.*;
> public class Test {
>     public static void main(String[] args) {
>         try {
>             ClassLoader loader = new URLClassLoader(new URL[] { new URL("file:foo.jar") } );
>             Class cls = loader.loadClass("Foo");
>             Field field = cls.getDeclaredField("field");
>             Type type = field.getGenericType();
>             System.out.println("SUCCESS: " + type);
>         } catch (Exception e) {
>             e.printStackTrace(System.out);
>         }
>     }
> }
> class Foo {
>     java.util.List<Foo> field;
> }
> After compilation create a foo.jar containing Foo.class and then make sure to remove Foo.class file:
> $ jar cvf foo.jar Foo.class
> $ rm Foo.class
> $ java Test
> Output on RI:
> SUCCESS: java.util.List<Foo>
> Output on Harmony:
> java.lang.TypeNotPresentException: Type Foo not present
> 	at org.apache.harmony.lang.reflect.support.AuxiliaryCreator.createTypeArgs(AuxiliaryCreator.java:216)
> 	at org.apache.harmony.lang.reflect.parser.Parser.parseFieldGenericType(Parser.java:358)
> 	at java.lang.reflect.Field.getGenericType(Field.java:72)
> 	at Test.main(Test.java:9)
> Caused by: java.lang.ClassNotFoundException: Foo
> 	at org.apache.harmony.lang.reflect.support.AuxiliaryLoader.findClass(AuxiliaryLoader.java:119)
> 	at org.apache.harmony.lang.reflect.support.AuxiliaryCreator.createTypeArg(AuxiliaryCreator.java:192)
> 	at org.apache.harmony.lang.reflect.support.AuxiliaryCreator.createTypeArgs(AuxiliaryCreator.java:214)
> 	at org.apache.harmony.lang.reflect.parser.Parser.parseFieldGenericType(Parser.java:358)
> 	... 2 more
> My guess is the problem lies in AuxiliaryLoader.findClass() method, line 67 - the method explicitly uses system class loader to load the target class, which clearly fails if the target class is available through some other classloader. It seems logical to use the classloader of the class whose field is being processed instead. However, the fix seems non-trivial as in the existing architecture the information on the containing class is lost when Parser is called.
> This issue prevents Apache Geronimo 2.0 from starting on Harmony.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (HARMONY-5005) [drlvm][kernel][geronimo] Field.getGenericType() fails on a parametrized class from custom classloader

Posted by "Vasily Zakharov (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HARMONY-5005?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12540939 ] 

Vasily Zakharov commented on HARMONY-5005:
------------------------------------------

This issue is similar in visible effect to HARMONY-5086.


> [drlvm][kernel][geronimo] Field.getGenericType() fails on a parametrized class from custom classloader
> ------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-5005
>                 URL: https://issues.apache.org/jira/browse/HARMONY-5005
>             Project: Harmony
>          Issue Type: Bug
>          Components: App-Oriented Bug Reports, DRLVM
>            Reporter: Vasily Zakharov
>            Assignee: Gregory Shimansky
>            Priority: Critical
>         Attachments: 01-H5005-formatting.patch, 02-H5005.patch
>
>
> java.lang.reflect.Field.getGenericType() fails if the field it's called upon is a parametrized class unavailable through the system class loader. To reproduce use the following code:
> import java.lang.reflect.*;
> import java.net.*;
> public class Test {
>     public static void main(String[] args) {
>         try {
>             ClassLoader loader = new URLClassLoader(new URL[] { new URL("file:foo.jar") } );
>             Class cls = loader.loadClass("Foo");
>             Field field = cls.getDeclaredField("field");
>             Type type = field.getGenericType();
>             System.out.println("SUCCESS: " + type);
>         } catch (Exception e) {
>             e.printStackTrace(System.out);
>         }
>     }
> }
> class Foo {
>     java.util.List<Foo> field;
> }
> After compilation create a foo.jar containing Foo.class and then make sure to remove Foo.class file:
> $ jar cvf foo.jar Foo.class
> $ rm Foo.class
> $ java Test
> Output on RI:
> SUCCESS: java.util.List<Foo>
> Output on Harmony:
> java.lang.TypeNotPresentException: Type Foo not present
> 	at org.apache.harmony.lang.reflect.support.AuxiliaryCreator.createTypeArgs(AuxiliaryCreator.java:216)
> 	at org.apache.harmony.lang.reflect.parser.Parser.parseFieldGenericType(Parser.java:358)
> 	at java.lang.reflect.Field.getGenericType(Field.java:72)
> 	at Test.main(Test.java:9)
> Caused by: java.lang.ClassNotFoundException: Foo
> 	at org.apache.harmony.lang.reflect.support.AuxiliaryLoader.findClass(AuxiliaryLoader.java:119)
> 	at org.apache.harmony.lang.reflect.support.AuxiliaryCreator.createTypeArg(AuxiliaryCreator.java:192)
> 	at org.apache.harmony.lang.reflect.support.AuxiliaryCreator.createTypeArgs(AuxiliaryCreator.java:214)
> 	at org.apache.harmony.lang.reflect.parser.Parser.parseFieldGenericType(Parser.java:358)
> 	... 2 more
> My guess is the problem lies in AuxiliaryLoader.findClass() method, line 67 - the method explicitly uses system class loader to load the target class, which clearly fails if the target class is available through some other classloader. It seems logical to use the classloader of the class whose field is being processed instead. However, the fix seems non-trivial as in the existing architecture the information on the containing class is lost when Parser is called.
> This issue prevents Apache Geronimo 2.0 from starting on Harmony.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (HARMONY-5005) [drlvm][kernel][geronimo] Field.getGenericType() fails on a parametrized class from custom classloader

Posted by "Vladimir Beliaev (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-5005?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Vladimir Beliaev updated HARMONY-5005:
--------------------------------------

    Attachment: 02-H5005.patch

Here is the patch. Its idea is:

1. each caller of AuxiliaryLoader.findClass keeps the reference to "wrapping" Class/Method/Field/Constructor instance called "startPoint".

2. so AuxiliaryLoader.findClass must utilize the ClassLoader of startPoint to load required type.

That's it... With the attached patch the functionality is not "changed" but it is "extended"... The required type loading (and resolution) starts with ClassLoader taken from startPoint or with SystemClassLoader.

Thanks
Vladimir

> [drlvm][kernel][geronimo] Field.getGenericType() fails on a parametrized class from custom classloader
> ------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-5005
>                 URL: https://issues.apache.org/jira/browse/HARMONY-5005
>             Project: Harmony
>          Issue Type: Bug
>          Components: App-Oriented Bug Reports, DRLVM
>            Reporter: Vasily Zakharov
>            Priority: Critical
>         Attachments: 01-H5005-formatting.patch, 02-H5005.patch
>
>
> java.lang.reflect.Field.getGenericType() fails if the field it's called upon is a parametrized class unavailable through the system class loader. To reproduce use the following code:
> import java.lang.reflect.*;
> import java.net.*;
> public class Test {
>     public static void main(String[] args) {
>         try {
>             ClassLoader loader = new URLClassLoader(new URL[] { new URL("file:foo.jar") } );
>             Class cls = loader.loadClass("Foo");
>             Field field = cls.getDeclaredField("field");
>             Type type = field.getGenericType();
>             System.out.println("SUCCESS: " + type);
>         } catch (Exception e) {
>             e.printStackTrace(System.out);
>         }
>     }
> }
> class Foo {
>     java.util.List<Foo> field;
> }
> After compilation create a foo.jar containing Foo.class and then make sure to remove Foo.class file:
> $ jar cvf foo.jar Foo.class
> $ rm Foo.class
> $ java Test
> Output on RI:
> SUCCESS: java.util.List<Foo>
> Output on Harmony:
> java.lang.TypeNotPresentException: Type Foo not present
> 	at org.apache.harmony.lang.reflect.support.AuxiliaryCreator.createTypeArgs(AuxiliaryCreator.java:216)
> 	at org.apache.harmony.lang.reflect.parser.Parser.parseFieldGenericType(Parser.java:358)
> 	at java.lang.reflect.Field.getGenericType(Field.java:72)
> 	at Test.main(Test.java:9)
> Caused by: java.lang.ClassNotFoundException: Foo
> 	at org.apache.harmony.lang.reflect.support.AuxiliaryLoader.findClass(AuxiliaryLoader.java:119)
> 	at org.apache.harmony.lang.reflect.support.AuxiliaryCreator.createTypeArg(AuxiliaryCreator.java:192)
> 	at org.apache.harmony.lang.reflect.support.AuxiliaryCreator.createTypeArgs(AuxiliaryCreator.java:214)
> 	at org.apache.harmony.lang.reflect.parser.Parser.parseFieldGenericType(Parser.java:358)
> 	... 2 more
> My guess is the problem lies in AuxiliaryLoader.findClass() method, line 67 - the method explicitly uses system class loader to load the target class, which clearly fails if the target class is available through some other classloader. It seems logical to use the classloader of the class whose field is being processed instead. However, the fix seems non-trivial as in the existing architecture the information on the containing class is lost when Parser is called.
> This issue prevents Apache Geronimo 2.0 from starting on Harmony.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (HARMONY-5005) [drlvm][kernel][geronimo] Field.getGenericType() fails on a parametrized class from custom classloader

Posted by "Vladimir Beliaev (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-5005?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Vladimir Beliaev updated HARMONY-5005:
--------------------------------------

    Attachment: 01-H5005-formatting.patch

I've experimented with Class Loader propagation... I've passed your test and DRLVM kernel tests (which includes tests on Generics)... 

I'll double check & submit the patch tomorrow... Meanwhile it would be helpfull to get the formatting patch committed....

> [drlvm][kernel][geronimo] Field.getGenericType() fails on a parametrized class from custom classloader
> ------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-5005
>                 URL: https://issues.apache.org/jira/browse/HARMONY-5005
>             Project: Harmony
>          Issue Type: Bug
>          Components: App-Oriented Bug Reports, DRLVM
>            Reporter: Vasily Zakharov
>            Priority: Critical
>         Attachments: 01-H5005-formatting.patch
>
>
> java.lang.reflect.Field.getGenericType() fails if the field it's called upon is a parametrized class unavailable through the system class loader. To reproduce use the following code:
> import java.lang.reflect.*;
> import java.net.*;
> public class Test {
>     public static void main(String[] args) {
>         try {
>             ClassLoader loader = new URLClassLoader(new URL[] { new URL("file:foo.jar") } );
>             Class cls = loader.loadClass("Foo");
>             Field field = cls.getDeclaredField("field");
>             Type type = field.getGenericType();
>             System.out.println("SUCCESS: " + type);
>         } catch (Exception e) {
>             e.printStackTrace(System.out);
>         }
>     }
> }
> class Foo {
>     java.util.List<Foo> field;
> }
> After compilation create a foo.jar containing Foo.class and then make sure to remove Foo.class file:
> $ jar cvf foo.jar Foo.class
> $ rm Foo.class
> $ java Test
> Output on RI:
> SUCCESS: java.util.List<Foo>
> Output on Harmony:
> java.lang.TypeNotPresentException: Type Foo not present
> 	at org.apache.harmony.lang.reflect.support.AuxiliaryCreator.createTypeArgs(AuxiliaryCreator.java:216)
> 	at org.apache.harmony.lang.reflect.parser.Parser.parseFieldGenericType(Parser.java:358)
> 	at java.lang.reflect.Field.getGenericType(Field.java:72)
> 	at Test.main(Test.java:9)
> Caused by: java.lang.ClassNotFoundException: Foo
> 	at org.apache.harmony.lang.reflect.support.AuxiliaryLoader.findClass(AuxiliaryLoader.java:119)
> 	at org.apache.harmony.lang.reflect.support.AuxiliaryCreator.createTypeArg(AuxiliaryCreator.java:192)
> 	at org.apache.harmony.lang.reflect.support.AuxiliaryCreator.createTypeArgs(AuxiliaryCreator.java:214)
> 	at org.apache.harmony.lang.reflect.parser.Parser.parseFieldGenericType(Parser.java:358)
> 	... 2 more
> My guess is the problem lies in AuxiliaryLoader.findClass() method, line 67 - the method explicitly uses system class loader to load the target class, which clearly fails if the target class is available through some other classloader. It seems logical to use the classloader of the class whose field is being processed instead. However, the fix seems non-trivial as in the existing architecture the information on the containing class is lost when Parser is called.
> This issue prevents Apache Geronimo 2.0 from starting on Harmony.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (HARMONY-5005) [drlvm][kernel][geronimo] Field.getGenericType() fails on a parametrized class from custom classloader

Posted by "Gregory Shimansky (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HARMONY-5005?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12539370 ] 

Gregory Shimansky commented on HARMONY-5005:
--------------------------------------------

Formatting patch is committed at 591009.

> [drlvm][kernel][geronimo] Field.getGenericType() fails on a parametrized class from custom classloader
> ------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-5005
>                 URL: https://issues.apache.org/jira/browse/HARMONY-5005
>             Project: Harmony
>          Issue Type: Bug
>          Components: App-Oriented Bug Reports, DRLVM
>            Reporter: Vasily Zakharov
>            Assignee: Gregory Shimansky
>            Priority: Critical
>         Attachments: 01-H5005-formatting.patch, 02-H5005.patch
>
>
> java.lang.reflect.Field.getGenericType() fails if the field it's called upon is a parametrized class unavailable through the system class loader. To reproduce use the following code:
> import java.lang.reflect.*;
> import java.net.*;
> public class Test {
>     public static void main(String[] args) {
>         try {
>             ClassLoader loader = new URLClassLoader(new URL[] { new URL("file:foo.jar") } );
>             Class cls = loader.loadClass("Foo");
>             Field field = cls.getDeclaredField("field");
>             Type type = field.getGenericType();
>             System.out.println("SUCCESS: " + type);
>         } catch (Exception e) {
>             e.printStackTrace(System.out);
>         }
>     }
> }
> class Foo {
>     java.util.List<Foo> field;
> }
> After compilation create a foo.jar containing Foo.class and then make sure to remove Foo.class file:
> $ jar cvf foo.jar Foo.class
> $ rm Foo.class
> $ java Test
> Output on RI:
> SUCCESS: java.util.List<Foo>
> Output on Harmony:
> java.lang.TypeNotPresentException: Type Foo not present
> 	at org.apache.harmony.lang.reflect.support.AuxiliaryCreator.createTypeArgs(AuxiliaryCreator.java:216)
> 	at org.apache.harmony.lang.reflect.parser.Parser.parseFieldGenericType(Parser.java:358)
> 	at java.lang.reflect.Field.getGenericType(Field.java:72)
> 	at Test.main(Test.java:9)
> Caused by: java.lang.ClassNotFoundException: Foo
> 	at org.apache.harmony.lang.reflect.support.AuxiliaryLoader.findClass(AuxiliaryLoader.java:119)
> 	at org.apache.harmony.lang.reflect.support.AuxiliaryCreator.createTypeArg(AuxiliaryCreator.java:192)
> 	at org.apache.harmony.lang.reflect.support.AuxiliaryCreator.createTypeArgs(AuxiliaryCreator.java:214)
> 	at org.apache.harmony.lang.reflect.parser.Parser.parseFieldGenericType(Parser.java:358)
> 	... 2 more
> My guess is the problem lies in AuxiliaryLoader.findClass() method, line 67 - the method explicitly uses system class loader to load the target class, which clearly fails if the target class is available through some other classloader. It seems logical to use the classloader of the class whose field is being processed instead. However, the fix seems non-trivial as in the existing architecture the information on the containing class is lost when Parser is called.
> This issue prevents Apache Geronimo 2.0 from starting on Harmony.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (HARMONY-5005) [drlvm][kernel][geronimo] Field.getGenericType() fails on a parametrized class from custom classloader

Posted by "Vladimir Beliaev (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HARMONY-5005?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12538793 ] 

Vladimir Beliaev commented on HARMONY-5005:
-------------------------------------------

I failed to reproduce this issue on yesterday revision:

~/test-5005 $ ../trunk-release/working_vm/build/deploy/jdk/jre/bin/java -showversion Test

        Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software Foundation or its licensors, as applicable.
        java version "1.5.0" 
        pre-alpha : not complete or compatible
        svn = r589818, (Oct 29 2007), Windows/ia32/msvc 1310, release build
        http://harmony.apache.org
        SUCCESS: java.util.List<Foo>

Vasily, please provide more information on what way you reproduced this bug.

Thanks
Vladimir Beliaev

> [drlvm][kernel][geronimo] Field.getGenericType() fails on a parametrized class from custom classloader
> ------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-5005
>                 URL: https://issues.apache.org/jira/browse/HARMONY-5005
>             Project: Harmony
>          Issue Type: Bug
>          Components: App-Oriented Bug Reports, DRLVM
>            Reporter: Vasily Zakharov
>            Priority: Critical
>
> java.lang.reflect.Field.getGenericType() fails if the field it's called upon is a parametrized class unavailable through the system class loader. To reproduce use the following code:
> import java.lang.reflect.*;
> import java.net.*;
> public class Test {
>     public static void main(String[] args) {
>         try {
>             ClassLoader loader = new URLClassLoader(new URL[] { new URL("file:foo.jar") } );
>             Class cls = loader.loadClass("Foo");
>             Field field = cls.getDeclaredField("field");
>             Type type = field.getGenericType();
>             System.out.println("SUCCESS: " + type);
>         } catch (Exception e) {
>             e.printStackTrace(System.out);
>         }
>     }
> }
> class Foo {
>     java.util.List<Foo> field;
> }
> After compilation create a foo.jar containing Foo.class and then make sure to remove Foo.class file:
> $ jar cvf foo.jar Foo.class
> $ rm Foo.class
> $ java Test
> Output on RI:
> SUCCESS: java.util.List<Foo>
> Output on Harmony:
> java.lang.TypeNotPresentException: Type Foo not present
> 	at org.apache.harmony.lang.reflect.support.AuxiliaryCreator.createTypeArgs(AuxiliaryCreator.java:216)
> 	at org.apache.harmony.lang.reflect.parser.Parser.parseFieldGenericType(Parser.java:358)
> 	at java.lang.reflect.Field.getGenericType(Field.java:72)
> 	at Test.main(Test.java:9)
> Caused by: java.lang.ClassNotFoundException: Foo
> 	at org.apache.harmony.lang.reflect.support.AuxiliaryLoader.findClass(AuxiliaryLoader.java:119)
> 	at org.apache.harmony.lang.reflect.support.AuxiliaryCreator.createTypeArg(AuxiliaryCreator.java:192)
> 	at org.apache.harmony.lang.reflect.support.AuxiliaryCreator.createTypeArgs(AuxiliaryCreator.java:214)
> 	at org.apache.harmony.lang.reflect.parser.Parser.parseFieldGenericType(Parser.java:358)
> 	... 2 more
> My guess is the problem lies in AuxiliaryLoader.findClass() method, line 67 - the method explicitly uses system class loader to load the target class, which clearly fails if the target class is available through some other classloader. It seems logical to use the classloader of the class whose field is being processed instead. However, the fix seems non-trivial as in the existing architecture the information on the containing class is lost when Parser is called.
> This issue prevents Apache Geronimo 2.0 from starting on Harmony.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (HARMONY-5005) [drlvm][kernel][geronimo] Field.getGenericType() fails on a parametrized class from custom classloader

Posted by "Gregory Shimansky (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-5005?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Gregory Shimansky resolved HARMONY-5005.
----------------------------------------

    Resolution: Fixed

Patch is applied at 591050. Please check that the bug is fixed now.

> [drlvm][kernel][geronimo] Field.getGenericType() fails on a parametrized class from custom classloader
> ------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-5005
>                 URL: https://issues.apache.org/jira/browse/HARMONY-5005
>             Project: Harmony
>          Issue Type: Bug
>          Components: App-Oriented Bug Reports, DRLVM
>            Reporter: Vasily Zakharov
>            Assignee: Gregory Shimansky
>            Priority: Critical
>         Attachments: 01-H5005-formatting.patch, 02-H5005.patch
>
>
> java.lang.reflect.Field.getGenericType() fails if the field it's called upon is a parametrized class unavailable through the system class loader. To reproduce use the following code:
> import java.lang.reflect.*;
> import java.net.*;
> public class Test {
>     public static void main(String[] args) {
>         try {
>             ClassLoader loader = new URLClassLoader(new URL[] { new URL("file:foo.jar") } );
>             Class cls = loader.loadClass("Foo");
>             Field field = cls.getDeclaredField("field");
>             Type type = field.getGenericType();
>             System.out.println("SUCCESS: " + type);
>         } catch (Exception e) {
>             e.printStackTrace(System.out);
>         }
>     }
> }
> class Foo {
>     java.util.List<Foo> field;
> }
> After compilation create a foo.jar containing Foo.class and then make sure to remove Foo.class file:
> $ jar cvf foo.jar Foo.class
> $ rm Foo.class
> $ java Test
> Output on RI:
> SUCCESS: java.util.List<Foo>
> Output on Harmony:
> java.lang.TypeNotPresentException: Type Foo not present
> 	at org.apache.harmony.lang.reflect.support.AuxiliaryCreator.createTypeArgs(AuxiliaryCreator.java:216)
> 	at org.apache.harmony.lang.reflect.parser.Parser.parseFieldGenericType(Parser.java:358)
> 	at java.lang.reflect.Field.getGenericType(Field.java:72)
> 	at Test.main(Test.java:9)
> Caused by: java.lang.ClassNotFoundException: Foo
> 	at org.apache.harmony.lang.reflect.support.AuxiliaryLoader.findClass(AuxiliaryLoader.java:119)
> 	at org.apache.harmony.lang.reflect.support.AuxiliaryCreator.createTypeArg(AuxiliaryCreator.java:192)
> 	at org.apache.harmony.lang.reflect.support.AuxiliaryCreator.createTypeArgs(AuxiliaryCreator.java:214)
> 	at org.apache.harmony.lang.reflect.parser.Parser.parseFieldGenericType(Parser.java:358)
> 	... 2 more
> My guess is the problem lies in AuxiliaryLoader.findClass() method, line 67 - the method explicitly uses system class loader to load the target class, which clearly fails if the target class is available through some other classloader. It seems logical to use the classloader of the class whose field is being processed instead. However, the fix seems non-trivial as in the existing architecture the information on the containing class is lost when Parser is called.
> This issue prevents Apache Geronimo 2.0 from starting on Harmony.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Closed: (HARMONY-5005) [drlvm][kernel][geronimo] Field.getGenericType() fails on a parametrized class from custom classloader

Posted by "Vasily Zakharov (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-5005?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Vasily Zakharov closed HARMONY-5005.
------------------------------------


Vladimir, Gregory, thank you very much, the problem is fixed!


> [drlvm][kernel][geronimo] Field.getGenericType() fails on a parametrized class from custom classloader
> ------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-5005
>                 URL: https://issues.apache.org/jira/browse/HARMONY-5005
>             Project: Harmony
>          Issue Type: Bug
>          Components: App-Oriented Bug Reports, DRLVM
>            Reporter: Vasily Zakharov
>            Assignee: Gregory Shimansky
>            Priority: Critical
>         Attachments: 01-H5005-formatting.patch, 02-H5005.patch
>
>
> java.lang.reflect.Field.getGenericType() fails if the field it's called upon is a parametrized class unavailable through the system class loader. To reproduce use the following code:
> import java.lang.reflect.*;
> import java.net.*;
> public class Test {
>     public static void main(String[] args) {
>         try {
>             ClassLoader loader = new URLClassLoader(new URL[] { new URL("file:foo.jar") } );
>             Class cls = loader.loadClass("Foo");
>             Field field = cls.getDeclaredField("field");
>             Type type = field.getGenericType();
>             System.out.println("SUCCESS: " + type);
>         } catch (Exception e) {
>             e.printStackTrace(System.out);
>         }
>     }
> }
> class Foo {
>     java.util.List<Foo> field;
> }
> After compilation create a foo.jar containing Foo.class and then make sure to remove Foo.class file:
> $ jar cvf foo.jar Foo.class
> $ rm Foo.class
> $ java Test
> Output on RI:
> SUCCESS: java.util.List<Foo>
> Output on Harmony:
> java.lang.TypeNotPresentException: Type Foo not present
> 	at org.apache.harmony.lang.reflect.support.AuxiliaryCreator.createTypeArgs(AuxiliaryCreator.java:216)
> 	at org.apache.harmony.lang.reflect.parser.Parser.parseFieldGenericType(Parser.java:358)
> 	at java.lang.reflect.Field.getGenericType(Field.java:72)
> 	at Test.main(Test.java:9)
> Caused by: java.lang.ClassNotFoundException: Foo
> 	at org.apache.harmony.lang.reflect.support.AuxiliaryLoader.findClass(AuxiliaryLoader.java:119)
> 	at org.apache.harmony.lang.reflect.support.AuxiliaryCreator.createTypeArg(AuxiliaryCreator.java:192)
> 	at org.apache.harmony.lang.reflect.support.AuxiliaryCreator.createTypeArgs(AuxiliaryCreator.java:214)
> 	at org.apache.harmony.lang.reflect.parser.Parser.parseFieldGenericType(Parser.java:358)
> 	... 2 more
> My guess is the problem lies in AuxiliaryLoader.findClass() method, line 67 - the method explicitly uses system class loader to load the target class, which clearly fails if the target class is available through some other classloader. It seems logical to use the classloader of the class whose field is being processed instead. However, the fix seems non-trivial as in the existing architecture the information on the containing class is lost when Parser is called.
> This issue prevents Apache Geronimo 2.0 from starting on Harmony.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.